SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.

This is a big one, touching lots of files.  Some of the platforms
aren't tested yet.  Briefly, this changes the return value of the
os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the
time functions localtime(), gmtime(), and strptime() from tuples into
pseudo-sequences.  When accessed as a sequence, they behave exactly as
before.  But they also have attributes like st_mtime or tm_year.  The
stat return value, moreover, has a few platform-specific attributes
that are not available through the sequence interface (because
everybody expects the sequence to have a fixed length, these couldn't
be added there).  If your platform's struct stat doesn't define
st_blksize, st_blocks or st_rdev, they won't be accessible from Python
either.

(Still missing is a documentation update.)
This commit is contained in:
Guido van Rossum 2001-10-18 20:34:25 +00:00
parent 8dd7adeb34
commit 98bf58f1c6
11 changed files with 814 additions and 240 deletions

39
Include/structseq.h Normal file
View File

@ -0,0 +1,39 @@
/* Tuple object interface */
#ifndef Py_STRUCTSEQ_H
#define Py_STRUCTSEQ_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct PyStructSequence_Field {
char *name;
char *doc;
} PyStructSequence_Field;
typedef struct PyStructSequence_Desc {
char *name;
char *doc;
struct PyStructSequence_Field *fields;
int n_in_sequence;
} PyStructSequence_Desc;
extern DL_IMPORT(void) PyStructSequence_InitType(PyTypeObject *type,
PyStructSequence_Desc *desc);
extern DL_IMPORT(PyObject *) PyStructSequence_New(PyTypeObject* type);
typedef struct {
PyObject_VAR_HEAD
PyObject *ob_item[1];
} PyStructSequence;
/* Macro, *only* to be used to fill in brand new objects */
#define PyStructSequence_SET_ITEM(op, i, v) \
(((PyStructSequence *)(op))->ob_item[i] = v)
#ifdef __cplusplus
}
#endif
#endif /* !Py_STRUCTSEQ_H */

View File

@ -11,7 +11,6 @@ warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__)
from test_support import TESTFN, run_unittest from test_support import TESTFN, run_unittest
class TemporaryFileTests(unittest.TestCase): class TemporaryFileTests(unittest.TestCase):
def setUp(self): def setUp(self):
self.files = [] self.files = []
@ -61,10 +60,128 @@ class TemporaryFileTests(unittest.TestCase):
"test_os") "test_os")
self.check_tempfile(os.tmpnam()) self.check_tempfile(os.tmpnam())
# Test attributes on return values from os.*stat* family.
class StatAttributeTests(unittest.TestCase):
def setUp(self):
os.mkdir(TESTFN)
self.fname = os.path.join(TESTFN, "f1")
f = open(self.fname, 'wb')
f.write("ABC")
f.close()
def tearDown(self):
os.unlink(self.fname)
os.rmdir(TESTFN)
def test_stat_attributes(self):
if not hasattr(os, "stat"):
return
import stat
result = os.stat(self.fname)
# Make sure direct access works
self.assertEquals(result[stat.ST_SIZE], 3)
self.assertEquals(result.st_size, 3)
import sys
# Make sure all the attributes are there
members = dir(result)
for name in dir(stat):
if name[:3] == 'ST_':
attr = name.lower()
self.assertEquals(getattr(result, attr),
result[getattr(stat, name)])
self.assert_(attr in members)
try:
result[200]
self.fail("No exception thrown")
except IndexError:
pass
# Make sure that assignment fails
try:
result.st_mode = 1
self.fail("No exception thrown")
except TypeError:
pass
try:
result.st_rdev = 1
self.fail("No exception thrown")
except TypeError:
pass
try:
result.parrot = 1
self.fail("No exception thrown")
except AttributeError:
pass
# Use the stat_result constructor with a too-short tuple.
try:
result2 = os.stat_result((10,))
self.fail("No exception thrown")
except TypeError:
pass
# Use the constructr with a too-long tuple.
try:
result2 = os.stat_result((0,1,2,3,4,5,6,7,8,9,10,11,12,13,14))
except TypeError:
pass
def test_statvfs_attributes(self):
if not hasattr(os, "statvfs"):
return
import statvfs
result = os.statvfs(self.fname)
# Make sure direct access works
self.assertEquals(result.f_bfree, result[statvfs.F_BFREE])
# Make sure all the attributes are there
members = dir(result)
for name in dir(statvfs):
if name[:2] == 'F_':
attr = name.lower()
self.assertEquals(getattr(result, attr),
result[getattr(statvfs, name)])
self.assert_(attr in members)
# Make sure that assignment really fails
try:
result.f_bfree = 1
self.fail("No exception thrown")
except TypeError:
pass
try:
result.parrot = 1
self.fail("No exception thrown")
except AttributeError:
pass
# Use the constructor with a too-short tuple.
try:
result2 = os.statvfs_result((10,))
self.fail("No exception thrown")
except TypeError:
pass
# Use the constructr with a too-long tuple.
try:
result2 = os.statvfs_result((0,1,2,3,4,5,6,7,8,9,10,11,12,13,14))
except TypeError:
pass
def test_main(): def test_main():
run_unittest(TemporaryFileTests) run_unittest(TemporaryFileTests)
run_unittest(StatAttributeTests)
if __name__ == "__main__": if __name__ == "__main__":
test_main() test_main()

View File

@ -25,6 +25,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Mac module implementation */ /* Mac module implementation */
#include "Python.h" #include "Python.h"
#include "structseq.h"
#include "ceval.h" #include "ceval.h"
#include <stdio.h> #include <stdio.h>
@ -460,11 +461,119 @@ mac_rmdir(self, args)
return mac_1str(args, rmdir); return mac_1str(args, rmdir);
} }
static char stat_result__doc__[] =
"stat_result: Result from stat or lstat.\n\n\
This object may be accessed either as a tuple of\n\
(mode,ino,dev,nlink,uid,gid,size,atime,mtime,ctime)\n\
or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.\n\
\n\
Macintosh: The fields st_rsize, st_creator, and st_type are available from\n\
os.xstat.\n\
\n\
See os.stat for more information.\n";
#define COMMON_STAT_RESULT_FIELDS \
{ "st_mode", "protection bits" }, \
{ "st_ino", "inode" }, \
{ "st_dev", "device" }, \
{ "st_nlink", "number of hard links" }, \
{ "st_uid", "user ID of owner" }, \
{ "st_gid", "group ID of owner" }, \
{ "st_size", "total size, in bytes" }, \
{ "st_atime", "time of last access" }, \
{ "st_mtime", "time of last modification" }, \
{ "st_ctime", "time of last change" },
static PyStructSequence_Field stat_result_fields[] = {
COMMON_STAT_RESULT_FIELDS
{0}
};
static PyStructSequence_Desc stat_result_desc = {
"stat_result",
stat_result__doc__,
stat_result_fields,
10
};
static PyTypeObject StatResultType;
#ifdef TARGET_API_MAC_OS8
static PyStructSequence_Field xstat_result_fields[] = {
COMMON_XSTAT_RESULT_FIELDS
{ "st_rsize" },
{ "st_creator" },
{ "st_type "},
{0}
};
static PyStructSequence_Desc xstat_result_desc = {
"xstat_result",
stat_result__doc__,
xstat_result_fields,
13
};
static PyTypeObject XStatResultType;
#endif
static PyObject *
_pystat_from_struct_stat(struct stat st, void* _mst)
{
PyObject *v;
#if TARGET_API_MAC_OS8
struct macstat *mst;
if (_mst != NULL)
v = PyStructSequence_New(&XStatResultType);
else
#endif
v = PyStructSequence_New(&StatResultType);
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st.st_mode));
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st.st_ino));
PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st.st_dev));
PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long)st.st_nlink));
PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long)st.st_uid));
PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long)st.st_gid));
PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong((long)st.st_size));
PyStructSequence_SET_ITEM(v, 7,
PyFloat_FromDouble((double)st.st_atime));
PyStructSequence_SET_ITEM(v, 8,
PyFloat_FromDouble((double)st.st_mtime));
PyStructSequence_SET_ITEM(v, 9,
PyFloat_FromDouble((double)st.st_ctime));
#if TARGET_API_MAC_OS8
if (_mst != NULL) {
mst = (struct macstat *) _mst;
PyStructSequence_SET_ITEM(v, 10,
PyInt_FromLong((long)mst->st_rsize));
PyStructSequence_SET_ITEM(v, 11,
PyString_FromStringAndSize(mst->st_creator,
4));
PyStructSequence_SET_ITEM(v, 12,
PyString_FromStringAndSize(mst->st_type,
4));
}
#endif
if (PyErr_Occurred()) {
Py_DECREF(v);
return NULL;
}
return v;
}
static PyObject * static PyObject *
mac_stat(self, args) mac_stat(self, args)
PyObject *self; PyObject *self;
PyObject *args; PyObject *args;
{ {
PyObject *v;
struct stat st; struct stat st;
char *path; char *path;
int res; int res;
@ -475,17 +584,8 @@ mac_stat(self, args)
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (res != 0) if (res != 0)
return mac_error(); return mac_error();
return Py_BuildValue("(lllllllddd)",
(long)st.st_mode, return _pystat_from_struct_stat(st, NULL);
(long)st.st_ino,
(long)st.st_dev,
(long)st.st_nlink,
(long)st.st_uid,
(long)st.st_gid,
(long)st.st_size,
(double)st.st_atime,
(double)st.st_mtime,
(double)st.st_ctime);
} }
#ifdef WEHAVE_FSTAT #ifdef WEHAVE_FSTAT
@ -504,17 +604,8 @@ mac_fstat(self, args)
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (res != 0) if (res != 0)
return mac_error(); return mac_error();
return Py_BuildValue("(lllllllddd)",
(long)st.st_mode, return _pystat_from_struct_stat(st, NULL);
(long)st.st_ino,
(long)st.st_dev,
(long)st.st_nlink,
(long)st.st_uid,
(long)st.st_gid,
(long)st.st_size,
(double)st.st_atime,
(double)st.st_mtime,
(double)st.st_ctime);
} }
#endif /* WEHAVE_FSTAT */ #endif /* WEHAVE_FSTAT */
@ -545,20 +636,8 @@ mac_xstat(self, args)
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (res != 0) if (res != 0)
return mac_error(); return mac_error();
return Py_BuildValue("(llllllldddls#s#)",
(long)st.st_mode, return _pystat_from_struct_stat(st, (void*) &mst);
(long)st.st_ino,
(long)st.st_dev,
(long)st.st_nlink,
(long)st.st_uid,
(long)st.st_gid,
(long)st.st_size,
(double)st.st_atime,
(double)st.st_mtime,
(double)st.st_ctime,
(long)mst.st_rsize,
mst.st_creator, 4,
mst.st_type, 4);
} }
#endif #endif
@ -766,4 +845,12 @@ initmac()
/* Initialize mac.error exception */ /* Initialize mac.error exception */
MacError = PyErr_NewException("mac.error", NULL, NULL); MacError = PyErr_NewException("mac.error", NULL, NULL);
PyDict_SetItemString(d, "error", MacError); PyDict_SetItemString(d, "error", MacError);
PyStructSequence_InitType(&StatResultType, &stat_result_desc);
PyDict_SetItemString(d, "stat_result", (PyObject*) &StatResultType);
#if TARGET_API_MAC_OS8
PyStructSequence_InitType(&XStatResultType, &xstat_result_desc);
PyDict_SetItemString(d, "xstat_result", (PyObject*) &XStatResultType);
#endif
} }

View File

@ -263,6 +263,7 @@ OBJECT_OBJS= \
Objects/rangeobject.o \ Objects/rangeobject.o \
Objects/sliceobject.o \ Objects/sliceobject.o \
Objects/stringobject.o \ Objects/stringobject.o \
Objects/structseq.o \
Objects/tupleobject.o \ Objects/tupleobject.o \
Objects/typeobject.o \ Objects/typeobject.o \
Objects/weakrefobject.o \ Objects/weakrefobject.o \
@ -465,6 +466,7 @@ PYTHON_HEADERS= \
Include/rangeobject.h \ Include/rangeobject.h \
Include/sliceobject.h \ Include/sliceobject.h \
Include/stringobject.h \ Include/stringobject.h \
Include/structseq.h \
Include/structmember.h \ Include/structmember.h \
Include/symtable.h \ Include/symtable.h \
Include/sysmodule.h \ Include/sysmodule.h \

View File

@ -48,7 +48,17 @@ Extension modules
- readline now supports setting the startup_hook and the pre_event_hook. - readline now supports setting the startup_hook and the pre_event_hook.
- posix supports chroot and setgroups where available. - os and posix supports chroot() and setgroups() where available. The
stat(), fstat(), statvfs() and fstatvfs() functions now return
"pseudo-sequences" -- the various fields can now be accessed as
attributes (e.g. os.stat("/").st_mtime) but for backwards
compatibility they also behave as a fixed-length sequence. Some
platform-specific fields (e.g. st_rdev) are only accessible as
attributes.
- time: localtime(), gmtime() and strptime() now return a
pseudo-sequence similar to the os.stat() return value, with
attributes like tm_year etc.
- Decompression objects in the zlib module now accept an optional - Decompression objects in the zlib module now accept an optional
second parameter to decompress() that specifies the maximum amount second parameter to decompress() that specifies the maximum amount

View File

@ -17,6 +17,7 @@ disguised Unix interface). Refer to the library manual and\n\
corresponding Unix manual entries for more information on calls."; corresponding Unix manual entries for more information on calls.";
#include "Python.h" #include "Python.h"
#include "structseq.h"
#if defined(PYOS_OS2) #if defined(PYOS_OS2)
#define INCL_DOS #define INCL_DOS
@ -516,42 +517,152 @@ posix_2str(PyObject *args, char *format,
return Py_None; return Py_None;
} }
static char stat_result__doc__[] =
"stat_result: Result from stat or lstat.\n\n\
This object may be accessed either as a tuple of\n\
(mode,ino,dev,nlink,uid,gid,size,atime,mtime,ctime)\n\
or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.\n\
\n\
Posix/windows: If your platform supports st_blksize, st_blocks, or st_rdev,
they are available as attributes only.\n\
\n\
See os.stat for more information.\n";
static PyStructSequence_Field stat_result_fields[] = {
{"st_mode", "protection bits"},
{"st_ino", "inode"},
{"st_dev", "device"},
{"st_nlink", "number of hard links"},
{"st_uid", "user ID of owner"},
{"st_gid", "group ID of owner"},
{"st_size", "total size, in bytes"},
{"st_atime", "time of last access"},
{"st_mtime", "time of last modification"},
{"st_ctime", "time of last change"},
#ifdef HAVE_ST_BLKSIZE
{"st_blksize", "blocksize for filesystem I/O"},
#endif
#ifdef HAVE_ST_BLOCKS
{"st_blocks", "number of blocks allocated"},
#endif
#ifdef HAVE_ST_RDEV
{"st_rdev", "device type (if inode device)"},
#endif
{0}
};
#ifdef HAVE_ST_BLKSIZE
#define ST_BLKSIZE_IDX 10
#else
#define ST_BLKSIZE_IDX 9
#endif
#ifdef HAVE_ST_BLOCKS
#define ST_BLOCKS_IDX (ST_BLKSIZE_IDX+1)
#else
#define ST_BLOCKS_IDX ST_BLKSIZE_IDX
#endif
#ifdef HAVE_ST_RDEV
#define ST_RDEV_IDX (ST_BLOCKS_IDX+1)
#else
#define ST_RDEV_IDX ST_BLOCKS_IDX
#endif
static PyStructSequence_Desc stat_result_desc = {
"stat_result", /* name */
stat_result__doc__, /* doc */
stat_result_fields,
10
};
static char statvfs_result__doc__[] =
"statvfs_result: Result from statvfs or fstatvfs.\n\n\
This object may be accessed either as a tuple of\n\
(bsize,frsize,blocks,bfree,bavail,files,ffree,favail,flag,namemax),
or via the attributes f_bsize, f_frsize, f_blocks, f_bfree, and so on.
\n\
See os.statvfs for more information.\n";
static PyStructSequence_Field statvfs_result_fields[] = {
{"f_bsize", },
{"f_frsize", },
{"f_blocks", },
{"f_bfree", },
{"f_bavail", },
{"f_files", },
{"f_ffree", },
{"f_favail", },
{"f_flag", },
{"f_namemax",},
{0}
};
static PyStructSequence_Desc statvfs_result_desc = {
"statvfs_result", /* name */
statvfs_result__doc__, /* doc */
statvfs_result_fields,
10
};
static PyTypeObject StatResultType;
static PyTypeObject StatVFSResultType;
/* pack a system stat C structure into the Python stat tuple /* pack a system stat C structure into the Python stat tuple
(used by posix_stat() and posix_fstat()) */ (used by posix_stat() and posix_fstat()) */
static PyObject* static PyObject*
_pystat_fromstructstat(STRUCT_STAT st) _pystat_fromstructstat(STRUCT_STAT st)
{ {
PyObject *v = PyTuple_New(10); PyObject *v = PyStructSequence_New(&StatResultType);
if (v == NULL) if (v == NULL)
return NULL; return NULL;
PyTuple_SetItem(v, 0, PyInt_FromLong((long)st.st_mode)); PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st.st_mode));
#ifdef HAVE_LARGEFILE_SUPPORT #ifdef HAVE_LARGEFILE_SUPPORT
PyTuple_SetItem(v, 1, PyLong_FromLongLong((LONG_LONG)st.st_ino)); PyStructSequence_SET_ITEM(v, 1,
PyLong_FromLongLong((LONG_LONG)st.st_ino));
#else #else
PyTuple_SetItem(v, 1, PyInt_FromLong((long)st.st_ino)); PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st.st_ino));
#endif #endif
#if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS) #if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS)
PyTuple_SetItem(v, 2, PyLong_FromLongLong((LONG_LONG)st.st_dev)); PyStructSequence_SET_ITEM(v, 2,
PyLong_FromLongLong((LONG_LONG)st.st_dev));
#else #else
PyTuple_SetItem(v, 2, PyInt_FromLong((long)st.st_dev)); PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st.st_dev));
#endif #endif
PyTuple_SetItem(v, 3, PyInt_FromLong((long)st.st_nlink)); PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long)st.st_nlink));
PyTuple_SetItem(v, 4, PyInt_FromLong((long)st.st_uid)); PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long)st.st_uid));
PyTuple_SetItem(v, 5, PyInt_FromLong((long)st.st_gid)); PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long)st.st_gid));
#ifdef HAVE_LARGEFILE_SUPPORT #ifdef HAVE_LARGEFILE_SUPPORT
PyTuple_SetItem(v, 6, PyLong_FromLongLong((LONG_LONG)st.st_size)); PyStructSequence_SET_ITEM(v, 6,
PyLong_FromLongLong((LONG_LONG)st.st_size));
#else #else
PyTuple_SetItem(v, 6, PyInt_FromLong(st.st_size)); PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st.st_size));
#endif #endif
#if SIZEOF_TIME_T > SIZEOF_LONG #if SIZEOF_TIME_T > SIZEOF_LONG
PyTuple_SetItem(v, 7, PyLong_FromLongLong((LONG_LONG)st.st_atime)); PyStructSequence_SET_ITEM(v, 7,
PyTuple_SetItem(v, 8, PyLong_FromLongLong((LONG_LONG)st.st_mtime)); PyLong_FromLongLong((LONG_LONG)st.st_atime));
PyTuple_SetItem(v, 9, PyLong_FromLongLong((LONG_LONG)st.st_ctime)); PyStructSequence_SET_ITEM(v, 8,
PyLong_FromLongLong((LONG_LONG)st.st_mtime));
PyStructSequence_SET_ITEM(v, 9,
PyLong_FromLongLong((LONG_LONG)st.st_ctime));
#else #else
PyTuple_SetItem(v, 7, PyInt_FromLong((long)st.st_atime)); PyStructSequence_SET_ITEM(v, 7, PyInt_FromLong((long)st.st_atime));
PyTuple_SetItem(v, 8, PyInt_FromLong((long)st.st_mtime)); PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long)st.st_mtime));
PyTuple_SetItem(v, 9, PyInt_FromLong((long)st.st_ctime)); PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long)st.st_ctime));
#endif
#ifdef HAVE_ST_BLKSIZE
PyStructSequence_SET_ITEM(v, ST_BLKSIZE_IDX,
PyInt_FromLong((long)st.st_blksize));
#endif
#ifdef HAVE_ST_BLOCKS
PyStructSequence_SET_ITEM(v, ST_BLOCKS_IDX,
PyInt_FromLong((long)st.st_blocks));
#endif
#ifdef HAVE_ST_RDEV
PyStructSequence_SET_ITEM(v, ST_RDEV_IDX,
PyInt_FromLong((long)st.st_rdev));
#endif #endif
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
@ -562,7 +673,6 @@ _pystat_fromstructstat(STRUCT_STAT st)
return v; return v;
} }
static PyObject * static PyObject *
posix_do_stat(PyObject *self, PyObject *args, char *format, posix_do_stat(PyObject *self, PyObject *args, char *format,
int (*statfunc)(const char *, STRUCT_STAT *)) int (*statfunc)(const char *, STRUCT_STAT *))
@ -4173,6 +4283,45 @@ posix_WSTOPSIG(PyObject *self, PyObject *args)
#endif #endif
#include <sys/statvfs.h> #include <sys/statvfs.h>
static PyObject*
_pystatvfs_fromstructstatvfs(struct statvfs st) {
PyObject *v = PyStructSequence_New(&StatVFSResultType);
if (v == NULL)
return NULL;
#if !defined(HAVE_LARGEFILE_SUPPORT)
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize));
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize));
PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long) st.f_blocks));
PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long) st.f_bfree));
PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long) st.f_bavail));
PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long) st.f_files));
PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong((long) st.f_ffree));
PyStructSequence_SET_ITEM(v, 7, PyInt_FromLong((long) st.f_favail));
PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag));
PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax));
#else
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize));
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize));
PyStructSequence_SET_ITEM(v, 2,
PyLong_FromLongLong((LONG_LONG) st.f_blocks));
PyStructSequence_SET_ITEM(v, 3,
PyLong_FromLongLong((LONG_LONG) st.f_bfree));
PyStructSequence_SET_ITEM(v, 4,
PyLong_FromLongLong((LONG_LONG) st.f_bavail));
PyStructSequence_SET_ITEM(v, 5,
PyLong_FromLongLong((LONG_LONG) st.f_files));
PyStructSequence_SET_ITEM(v, 6,
PyLong_FromLongLong((LONG_LONG) st.f_ffree));
PyStructSequence_SET_ITEM(v, 7,
PyLong_FromLongLong((LONG_LONG) st.f_favail));
PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag));
PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax));
#endif
return v;
}
static char posix_fstatvfs__doc__[] = static char posix_fstatvfs__doc__[] =
"fstatvfs(fd) -> \n\ "fstatvfs(fd) -> \n\
(bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax)\n\ (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax)\n\
@ -4183,6 +4332,7 @@ posix_fstatvfs(PyObject *self, PyObject *args)
{ {
int fd, res; int fd, res;
struct statvfs st; struct statvfs st;
if (!PyArg_ParseTuple(args, "i:fstatvfs", &fd)) if (!PyArg_ParseTuple(args, "i:fstatvfs", &fd))
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
@ -4190,31 +4340,8 @@ posix_fstatvfs(PyObject *self, PyObject *args)
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (res != 0) if (res != 0)
return posix_error(); return posix_error();
#if !defined(HAVE_LARGEFILE_SUPPORT)
return Py_BuildValue("(llllllllll)", return _pystatvfs_fromstructstatvfs(st);
(long) st.f_bsize,
(long) st.f_frsize,
(long) st.f_blocks,
(long) st.f_bfree,
(long) st.f_bavail,
(long) st.f_files,
(long) st.f_ffree,
(long) st.f_favail,
(long) st.f_flag,
(long) st.f_namemax);
#else
return Py_BuildValue("(llLLLLLLll)",
(long) st.f_bsize,
(long) st.f_frsize,
(LONG_LONG) st.f_blocks,
(LONG_LONG) st.f_bfree,
(LONG_LONG) st.f_bavail,
(LONG_LONG) st.f_files,
(LONG_LONG) st.f_ffree,
(LONG_LONG) st.f_favail,
(long) st.f_flag,
(long) st.f_namemax);
#endif
} }
#endif /* HAVE_FSTATVFS */ #endif /* HAVE_FSTATVFS */
@ -4240,31 +4367,8 @@ posix_statvfs(PyObject *self, PyObject *args)
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (res != 0) if (res != 0)
return posix_error_with_filename(path); return posix_error_with_filename(path);
#if !defined(HAVE_LARGEFILE_SUPPORT)
return Py_BuildValue("(llllllllll)", return _pystatvfs_fromstructstatvfs(st);
(long) st.f_bsize,
(long) st.f_frsize,
(long) st.f_blocks,
(long) st.f_bfree,
(long) st.f_bavail,
(long) st.f_files,
(long) st.f_ffree,
(long) st.f_favail,
(long) st.f_flag,
(long) st.f_namemax);
#else /* HAVE_LARGEFILE_SUPPORT */
return Py_BuildValue("(llLLLLLLll)",
(long) st.f_bsize,
(long) st.f_frsize,
(LONG_LONG) st.f_blocks,
(LONG_LONG) st.f_bfree,
(LONG_LONG) st.f_bavail,
(LONG_LONG) st.f_files,
(LONG_LONG) st.f_ffree,
(LONG_LONG) st.f_favail,
(long) st.f_flag,
(long) st.f_namemax);
#endif
} }
#endif /* HAVE_STATVFS */ #endif /* HAVE_STATVFS */
@ -5825,4 +5929,10 @@ INITFUNC(void)
if (posix_putenv_garbage == NULL) if (posix_putenv_garbage == NULL)
posix_putenv_garbage = PyDict_New(); posix_putenv_garbage = PyDict_New();
#endif #endif
PyStructSequence_InitType(&StatResultType, &stat_result_desc);
PyDict_SetItemString(d, "stat_result", (PyObject*) &StatResultType);
PyStructSequence_InitType(&StatVFSResultType, &statvfs_result_desc);
PyDict_SetItemString(d, "statvfs_result", (PyObject*) &StatResultType);
} }

View File

@ -2,6 +2,7 @@
/* Time module */ /* Time module */
#include "Python.h" #include "Python.h"
#include "structseq.h"
#include <ctype.h> #include <ctype.h>
@ -210,19 +211,53 @@ static char sleep_doc[] =
Delay execution for a given number of seconds. The argument may be\n\ Delay execution for a given number of seconds. The argument may be\n\
a floating point number for subsecond precision."; a floating point number for subsecond precision.";
static PyStructSequence_Field struct_time_type_fields[] = {
{"tm_year", NULL},
{"tm_mon", NULL},
{"tm_mday", NULL},
{"tm_hour", NULL},
{"tm_min", NULL},
{"tm_sec", NULL},
{"tm_wday", NULL},
{"tm_yday", NULL},
{"tm_isdst", NULL},
{0}
};
static PyStructSequence_Desc struct_time_type_desc = {
"struct_time",
NULL,
struct_time_type_fields,
9,
};
static PyTypeObject StructTimeType;
static PyObject * static PyObject *
tmtotuple(struct tm *p) tmtotuple(struct tm *p)
{ {
return Py_BuildValue("(iiiiiiiii)", PyObject *v = PyStructSequence_New(&StructTimeType);
p->tm_year + 1900, if (v == NULL)
p->tm_mon + 1, /* Want January == 1 */ return NULL;
p->tm_mday,
p->tm_hour, #define SET(i,val) PyStructSequence_SET_ITEM(v, i, PyInt_FromLong((long) val))
p->tm_min,
p->tm_sec, SET(0, p->tm_year + 1900);
(p->tm_wday + 6) % 7, /* Want Monday == 0 */ SET(1, p->tm_mon + 1); /* Want January == 1 */
p->tm_yday + 1, /* Want January, 1 == 1 */ SET(2, p->tm_mday);
p->tm_isdst); SET(3, p->tm_hour);
SET(4, p->tm_min);
SET(5, p->tm_sec);
SET(6, (p->tm_wday + 6) % 7); /* Want Monday == 0 */
SET(7, p->tm_yday + 1); /* Want January, 1 == 1 */
SET(8, p->tm_isdst);
#undef SET
if (PyErr_Occurred()) {
Py_XDECREF(v);
return NULL;
}
return v;
} }
static PyObject * static PyObject *
@ -674,6 +709,9 @@ inittime(void)
ins(d, "tzname", Py_BuildValue("(zz)", _tzname[0], _tzname[1])); ins(d, "tzname", Py_BuildValue("(zz)", _tzname[0], _tzname[1]));
#endif /* __CYGWIN__ */ #endif /* __CYGWIN__ */
#endif /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ #endif /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/
PyStructSequence_InitType(&StructTimeType, &struct_time_type_desc);
PyDict_SetItemString(d, "struct_time", (PyObject*) &StructTimeType);
} }
@ -852,5 +890,6 @@ floatsleep(double secs)
#endif /* !__WATCOMC__ || __QNX__ */ #endif /* !__WATCOMC__ || __QNX__ */
#endif /* !macintosh */ #endif /* !macintosh */
#endif /* !HAVE_SELECT */ #endif /* !HAVE_SELECT */
return 0; return 0;
} }

View File

@ -113,8 +113,46 @@ static PyObject *riscos_listdir(PyObject *self,PyObject *args)
return d; return d;
} }
static char stat_result__doc__[] =
"stat_result: Result from stat or lstat.\n\n\
This object may be accessed either as a tuple of\n\
(mode,ino,dev,nlink,uid,gid,size,atime,mtime,ctime)\n\
or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.\n\
\n\
RiscOS: The fields st_ftype, st_attrs, and st_obtype are also available.\n\
\n\
See os.stat for more information.\n";
static PyStructSequence_Field stat_result_fields[] = {
{ "st_mode", "protection bits" },
{ "st_ino", "inode" },
{ "st_dev", "device" },
{ "st_nlink", "number of hard links" },
{ "st_uid", "user ID of owner" },
{ "st_gid", "group ID of owner" },
{ "st_size", "total size, in bytes" },
{ "st_atime", "time of last access" },
{ "st_mtime", "time of last modification" },
{ "st_ctime", "time of last change" },
{ "st_ftype", "file type" },
{ "st_attrs", "attributes" },
{ "st_obtype", "object type" }
{ 0 }
};
static PyStructSequence_Desc stat_result_desc = {
"stat_result",
stat_result__doc__,
stat_result_fields,
13
};
static PyTypeObject StatResultType;
static PyObject *riscos_stat(PyObject *self,PyObject *args) static PyObject *riscos_stat(PyObject *self,PyObject *args)
{ char *path; {
PyObject *v;
char *path;
int ob,len; int ob,len;
bits t=0; bits t=0;
bits ld,ex,at,ft,mode; bits ld,ex,at,ft,mode;
@ -130,21 +168,34 @@ static PyObject *riscos_stat(PyObject *self,PyObject *args)
if(ft!=-1) t=unixtime(ld,ex); if(ft!=-1) t=unixtime(ld,ex);
mode|=(at&7)<<6; mode|=(at&7)<<6;
mode|=((at&112)*9)>>4; mode|=((at&112)*9)>>4;
return Py_BuildValue("(lllllllllllll)",
(long)mode,/*st_mode*/ v = PyStructSequence_New(&StatResultType);
0,/*st_ino*/
0,/*st_dev*/ PyStructSequence_SET_ITEM(v, 0,
0,/*st_nlink*/ PyInt_FromLong((long) mode)); /*st_mode*/
0,/*st_uid*/ PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) 0)); /*st_ino*/
0,/*st_gid*/ PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long) 0)); /*st_dev*/
(long)len,/*st_size*/ PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long) 0)); /*st_nlink*/
(long)t,/*st_atime*/ PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long) 0)); /*st_uid*/
(long)t,/*st_mtime*/ PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long) 0)); /*st_gid*/
(long)t,/*st_ctime*/ PyStructSequence_SET_ITEM(v, 6,
(long)ft,/*file type*/ PyInt_FromLong((long) len)); /*st_size*/
(long)at,/*attributes*/ PyStructSequence_SET_ITEM(v, 7, PyInt_FromLong((long) t)); /*st_atime*/
(long)ob/*object type*/ PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) t)); /*st_mtime*/
); PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) t)); /*st_ctime*/
PyStructSequence_SET_ITEM(v, 10,
PyInt_FromLong((long) ft)); /*file type*/
PyStructSequence_SET_ITEM(v, 11,
PyInt_FromLong((long) at)); /*attributes*/
PyStructSequence_SET_ITEM(v, 12,
PyInt_FromLong((long) ot)); /*object type*/
if (PyErr_Occurred()) {
Py_DECREF(v);
return NULL;
}
return v;
} }
static PyObject *riscos_chmod(PyObject *self,PyObject *args) static PyObject *riscos_chmod(PyObject *self,PyObject *args)
@ -271,7 +322,7 @@ static PyMethodDef riscos_methods[] = {
void void
initriscos() initriscos()
{ {
PyObject *m, *d; PyObject *m, *d, *stat_m;
m = Py_InitModule("riscos", riscos_methods); m = Py_InitModule("riscos", riscos_methods);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
@ -280,4 +331,7 @@ initriscos()
RiscosError = PyString_FromString("riscos.error"); RiscosError = PyString_FromString("riscos.error");
if (RiscosError == NULL || PyDict_SetItemString(d, "error", RiscosError) != 0) if (RiscosError == NULL || PyDict_SetItemString(d, "error", RiscosError) != 0)
Py_FatalError("can't define riscos.error"); Py_FatalError("can't define riscos.error");
PyStructSequence_InitType(&StatResultType, &stat_result_desc);
PyDict_SetItemString(d, "stat_result", (PyObject*) &StatResultType);
} }

316
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# From configure.in Revision: 1.272 # From configure.in Revision: 1.273
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13 # Generated automatically using autoconf version 2.13
@ -5783,21 +5783,125 @@ EOF
fi fi
fi fi
echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
echo "configure:5788: checking for st_rdev in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5793 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
int main() {
struct stat s; s.st_rdev;
; return 0; }
EOF
if { (eval echo configure:5801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_rdev=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_struct_st_rdev=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6
if test $ac_cv_struct_st_rdev = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_ST_RDEV 1
EOF
fi
echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
echo "configure:5822: checking for st_blksize in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5827 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
int main() {
struct stat s; s.st_blksize;
; return 0; }
EOF
if { (eval echo configure:5835: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_blksize=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_struct_st_blksize=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6
if test $ac_cv_struct_st_blksize = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_ST_BLKSIZE 1
EOF
fi
echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6
echo "configure:5856: checking for st_blocks in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5861 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
int main() {
struct stat s; s.st_blocks;
; return 0; }
EOF
if { (eval echo configure:5869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_blocks=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_struct_st_blocks=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_struct_st_blocks" 1>&6
if test $ac_cv_struct_st_blocks = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_ST_BLOCKS 1
EOF
else
LIBOBJS="$LIBOBJS fileblocks.${ac_objext}"
fi
echo $ac_n "checking for time.h that defines altzone""... $ac_c" 1>&6 echo $ac_n "checking for time.h that defines altzone""... $ac_c" 1>&6
echo "configure:5789: checking for time.h that defines altzone" >&5 echo "configure:5893: checking for time.h that defines altzone" >&5
if eval "test \"`echo '$''{'ac_cv_header_time_altzone'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_time_altzone'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5794 "configure" #line 5898 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <time.h> #include <time.h>
int main() { int main() {
return altzone; return altzone;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:5801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:5905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ac_cv_header_time_altzone=yes ac_cv_header_time_altzone=yes
else else
@ -5819,9 +5923,9 @@ fi
was_it_defined=no was_it_defined=no
echo $ac_n "checking whether sys/select.h and sys/time.h may both be included""... $ac_c" 1>&6 echo $ac_n "checking whether sys/select.h and sys/time.h may both be included""... $ac_c" 1>&6
echo "configure:5823: checking whether sys/select.h and sys/time.h may both be included" >&5 echo "configure:5927: checking whether sys/select.h and sys/time.h may both be included" >&5
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5825 "configure" #line 5929 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
@ -5832,7 +5936,7 @@ int main() {
; ;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:5836: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:5940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define SYS_SELECT_WITH_SYS_TIME 1 #define SYS_SELECT_WITH_SYS_TIME 1
@ -5846,12 +5950,12 @@ rm -f conftest*
echo "$ac_t""$was_it_defined" 1>&6 echo "$ac_t""$was_it_defined" 1>&6
echo $ac_n "checking for addrinfo""... $ac_c" 1>&6 echo $ac_n "checking for addrinfo""... $ac_c" 1>&6
echo "configure:5850: checking for addrinfo" >&5 echo "configure:5954: checking for addrinfo" >&5
if eval "test \"`echo '$''{'ac_cv_struct_addrinfo'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_struct_addrinfo'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5855 "configure" #line 5959 "configure"
#include "confdefs.h" #include "confdefs.h"
# include <netdb.h> # include <netdb.h>
@ -5859,7 +5963,7 @@ int main() {
struct addrinfo a struct addrinfo a
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:5863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:5967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ac_cv_struct_addrinfo=yes ac_cv_struct_addrinfo=yes
else else
@ -5880,12 +5984,12 @@ EOF
fi fi
echo $ac_n "checking for sockaddr_storage""... $ac_c" 1>&6 echo $ac_n "checking for sockaddr_storage""... $ac_c" 1>&6
echo "configure:5884: checking for sockaddr_storage" >&5 echo "configure:5988: checking for sockaddr_storage" >&5
if eval "test \"`echo '$''{'ac_cv_struct_sockaddr_storage'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_struct_sockaddr_storage'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5889 "configure" #line 5993 "configure"
#include "confdefs.h" #include "confdefs.h"
# include <sys/types.h> # include <sys/types.h>
@ -5894,7 +5998,7 @@ int main() {
struct sockaddr_storage s struct sockaddr_storage s
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:5898: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ac_cv_struct_sockaddr_storage=yes ac_cv_struct_sockaddr_storage=yes
else else
@ -5917,14 +6021,14 @@ fi
# checks for compiler characteristics # checks for compiler characteristics
echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
echo "configure:5921: checking whether char is unsigned" >&5 echo "configure:6025: checking whether char is unsigned" >&5
if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
if test "$GCC" = yes; then if test "$GCC" = yes; then
# GCC predefines this symbol on systems where it applies. # GCC predefines this symbol on systems where it applies.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5928 "configure" #line 6032 "configure"
#include "confdefs.h" #include "confdefs.h"
#ifdef __CHAR_UNSIGNED__ #ifdef __CHAR_UNSIGNED__
yes yes
@ -5946,7 +6050,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5950 "configure" #line 6054 "configure"
#include "confdefs.h" #include "confdefs.h"
/* volatile prevents gcc2 from optimizing the test away on sparcs. */ /* volatile prevents gcc2 from optimizing the test away on sparcs. */
#if !defined(__STDC__) || __STDC__ != 1 #if !defined(__STDC__) || __STDC__ != 1
@ -5956,7 +6060,7 @@ main() {
volatile char c = 255; exit(c < 0); volatile char c = 255; exit(c < 0);
} }
EOF EOF
if { (eval echo configure:5960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:6064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_c_char_unsigned=yes ac_cv_c_char_unsigned=yes
else else
@ -5980,12 +6084,12 @@ EOF
fi fi
echo $ac_n "checking for working const""... $ac_c" 1>&6 echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:5984: checking for working const" >&5 echo "configure:6088: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 5989 "configure" #line 6093 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
@ -6034,7 +6138,7 @@ ccp = (char const *const *) p;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ac_cv_c_const=yes ac_cv_c_const=yes
else else
@ -6057,16 +6161,16 @@ fi
works=no works=no
echo $ac_n "checking for working volatile""... $ac_c" 1>&6 echo $ac_n "checking for working volatile""... $ac_c" 1>&6
echo "configure:6061: checking for working volatile" >&5 echo "configure:6165: checking for working volatile" >&5
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6063 "configure" #line 6167 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
volatile int x; x = 0; volatile int x; x = 0;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6070: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
works=yes works=yes
else else
@ -6083,16 +6187,16 @@ echo "$ac_t""$works" 1>&6
works=no works=no
echo $ac_n "checking for working signed char""... $ac_c" 1>&6 echo $ac_n "checking for working signed char""... $ac_c" 1>&6
echo "configure:6087: checking for working signed char" >&5 echo "configure:6191: checking for working signed char" >&5
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6089 "configure" #line 6193 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() { int main() {
signed char c; signed char c;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
works=yes works=yes
else else
@ -6109,16 +6213,16 @@ echo "$ac_t""$works" 1>&6
have_prototypes=no have_prototypes=no
echo $ac_n "checking for prototypes""... $ac_c" 1>&6 echo $ac_n "checking for prototypes""... $ac_c" 1>&6
echo "configure:6113: checking for prototypes" >&5 echo "configure:6217: checking for prototypes" >&5
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6115 "configure" #line 6219 "configure"
#include "confdefs.h" #include "confdefs.h"
int foo(int x) { return 0; } int foo(int x) { return 0; }
int main() { int main() {
return foo(10); return foo(10);
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6226: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define HAVE_PROTOTYPES 1 #define HAVE_PROTOTYPES 1
@ -6133,9 +6237,9 @@ echo "$ac_t""$have_prototypes" 1>&6
works=no works=no
echo $ac_n "checking for variable length prototypes and stdarg.h""... $ac_c" 1>&6 echo $ac_n "checking for variable length prototypes and stdarg.h""... $ac_c" 1>&6
echo "configure:6137: checking for variable length prototypes and stdarg.h" >&5 echo "configure:6241: checking for variable length prototypes and stdarg.h" >&5
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6139 "configure" #line 6243 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdarg.h> #include <stdarg.h>
@ -6152,7 +6256,7 @@ int main() {
return foo(10, "", 3.14); return foo(10, "", 3.14);
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define HAVE_STDARG_PROTOTYPES 1 #define HAVE_STDARG_PROTOTYPES 1
@ -6168,16 +6272,16 @@ echo "$ac_t""$works" 1>&6
if test "$have_prototypes" = yes; then if test "$have_prototypes" = yes; then
bad_prototypes=no bad_prototypes=no
echo $ac_n "checking for bad exec* prototypes""... $ac_c" 1>&6 echo $ac_n "checking for bad exec* prototypes""... $ac_c" 1>&6
echo "configure:6172: checking for bad exec* prototypes" >&5 echo "configure:6276: checking for bad exec* prototypes" >&5
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6174 "configure" #line 6278 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <unistd.h> #include <unistd.h>
int main() { int main() {
char **t;execve("@",t,t); char **t;execve("@",t,t);
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
: :
else else
echo "configure: failed program was:" >&5 echo "configure: failed program was:" >&5
@ -6194,9 +6298,9 @@ fi
# check if sockaddr has sa_len member # check if sockaddr has sa_len member
echo $ac_n "checking if sockaddr has sa_len member""... $ac_c" 1>&6 echo $ac_n "checking if sockaddr has sa_len member""... $ac_c" 1>&6
echo "configure:6198: checking if sockaddr has sa_len member" >&5 echo "configure:6302: checking if sockaddr has sa_len member" >&5
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6200 "configure" #line 6304 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -6205,7 +6309,7 @@ struct sockaddr x;
x.sa_len = 0; x.sa_len = 0;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
echo "$ac_t""yes" 1>&6 echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
@ -6221,7 +6325,7 @@ fi
rm -f conftest* rm -f conftest*
echo $ac_n "checking for bad static forward""... $ac_c" 1>&6 echo $ac_n "checking for bad static forward""... $ac_c" 1>&6
echo "configure:6225: checking for bad static forward" >&5 echo "configure:6329: checking for bad static forward" >&5
if eval "test \"`echo '$''{'ac_cv_bad_static_forward'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_bad_static_forward'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -6229,7 +6333,7 @@ else
ac_cv_bad_static_forward=no ac_cv_bad_static_forward=no
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6233 "configure" #line 6337 "configure"
#include "confdefs.h" #include "confdefs.h"
struct s { int a; int b; }; struct s { int a; int b; };
@ -6244,7 +6348,7 @@ main() {
exit(!((int)&foo == foobar())); exit(!((int)&foo == foobar()));
} }
EOF EOF
if { (eval echo configure:6248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:6352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_bad_static_forward=no ac_cv_bad_static_forward=no
else else
@ -6269,9 +6373,9 @@ fi
va_list_is_array=no va_list_is_array=no
echo $ac_n "checking whether va_list is an array""... $ac_c" 1>&6 echo $ac_n "checking whether va_list is an array""... $ac_c" 1>&6
echo "configure:6273: checking whether va_list is an array" >&5 echo "configure:6377: checking whether va_list is an array" >&5
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6275 "configure" #line 6379 "configure"
#include "confdefs.h" #include "confdefs.h"
#ifdef HAVE_STDARG_PROTOTYPES #ifdef HAVE_STDARG_PROTOTYPES
@ -6284,7 +6388,7 @@ int main() {
va_list list1, list2; list1 = list2; va_list list1, list2; list1 = list2;
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6288: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
: :
else else
echo "configure: failed program was:" >&5 echo "configure: failed program was:" >&5
@ -6300,12 +6404,12 @@ echo "$ac_t""$va_list_is_array" 1>&6
# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-( # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
echo $ac_n "checking for gethostbyname_r""... $ac_c" 1>&6 echo $ac_n "checking for gethostbyname_r""... $ac_c" 1>&6
echo "configure:6304: checking for gethostbyname_r" >&5 echo "configure:6408: checking for gethostbyname_r" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname_r'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_gethostbyname_r'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6309 "configure" #line 6413 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname_r(); below. */ which can conflict with char gethostbyname_r(); below. */
@ -6328,7 +6432,7 @@ gethostbyname_r();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:6436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_gethostbyname_r=yes" eval "ac_cv_func_gethostbyname_r=yes"
else else
@ -6348,11 +6452,11 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname_r`\" = yes"; then
EOF EOF
echo $ac_n "checking gethostbyname_r with 6 args""... $ac_c" 1>&6 echo $ac_n "checking gethostbyname_r with 6 args""... $ac_c" 1>&6
echo "configure:6352: checking gethostbyname_r with 6 args" >&5 echo "configure:6456: checking gethostbyname_r with 6 args" >&5
OLD_CFLAGS=$CFLAGS OLD_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS" CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6356 "configure" #line 6460 "configure"
#include "confdefs.h" #include "confdefs.h"
# include <netdb.h> # include <netdb.h>
@ -6369,7 +6473,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6373: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6477: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
@ -6389,9 +6493,9 @@ else
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
echo $ac_n "checking gethostbyname_r with 5 args""... $ac_c" 1>&6 echo $ac_n "checking gethostbyname_r with 5 args""... $ac_c" 1>&6
echo "configure:6393: checking gethostbyname_r with 5 args" >&5 echo "configure:6497: checking gethostbyname_r with 5 args" >&5
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6395 "configure" #line 6499 "configure"
#include "confdefs.h" #include "confdefs.h"
# include <netdb.h> # include <netdb.h>
@ -6408,7 +6512,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6412: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6516: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
@ -6428,9 +6532,9 @@ else
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
echo $ac_n "checking gethostbyname_r with 3 args""... $ac_c" 1>&6 echo $ac_n "checking gethostbyname_r with 3 args""... $ac_c" 1>&6
echo "configure:6432: checking gethostbyname_r with 3 args" >&5 echo "configure:6536: checking gethostbyname_r with 3 args" >&5
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6434 "configure" #line 6538 "configure"
#include "confdefs.h" #include "confdefs.h"
# include <netdb.h> # include <netdb.h>
@ -6445,7 +6549,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:6553: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
@ -6481,12 +6585,12 @@ else
for ac_func in gethostbyname for ac_func in gethostbyname
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6485: checking for $ac_func" >&5 echo "configure:6589: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6490 "configure" #line 6594 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -6509,7 +6613,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:6617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -6547,12 +6651,12 @@ fi
# Linux requires this for correct f.p. operations # Linux requires this for correct f.p. operations
echo $ac_n "checking for __fpu_control""... $ac_c" 1>&6 echo $ac_n "checking for __fpu_control""... $ac_c" 1>&6
echo "configure:6551: checking for __fpu_control" >&5 echo "configure:6655: checking for __fpu_control" >&5
if eval "test \"`echo '$''{'ac_cv_func___fpu_control'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func___fpu_control'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6556 "configure" #line 6660 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char __fpu_control(); below. */ which can conflict with char __fpu_control(); below. */
@ -6575,7 +6679,7 @@ __fpu_control();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:6683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func___fpu_control=yes" eval "ac_cv_func___fpu_control=yes"
else else
@ -6593,7 +6697,7 @@ if eval "test \"`echo '$ac_cv_func_'__fpu_control`\" = yes"; then
else else
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
echo $ac_n "checking for __fpu_control in -lieee""... $ac_c" 1>&6 echo $ac_n "checking for __fpu_control in -lieee""... $ac_c" 1>&6
echo "configure:6597: checking for __fpu_control in -lieee" >&5 echo "configure:6701: checking for __fpu_control in -lieee" >&5
ac_lib_var=`echo ieee'_'__fpu_control | sed 'y%./+-%__p_%'` ac_lib_var=`echo ieee'_'__fpu_control | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -6601,7 +6705,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lieee $LIBS" LIBS="-lieee $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6605 "configure" #line 6709 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -6612,7 +6716,7 @@ int main() {
__fpu_control() __fpu_control()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:6720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -6645,7 +6749,7 @@ fi
# Check for --with-fpectl # Check for --with-fpectl
echo $ac_n "checking for --with-fpectl""... $ac_c" 1>&6 echo $ac_n "checking for --with-fpectl""... $ac_c" 1>&6
echo "configure:6649: checking for --with-fpectl" >&5 echo "configure:6753: checking for --with-fpectl" >&5
# Check whether --with-fpectl or --without-fpectl was given. # Check whether --with-fpectl or --without-fpectl was given.
if test "${with_fpectl+set}" = set; then if test "${with_fpectl+set}" = set; then
withval="$with_fpectl" withval="$with_fpectl"
@ -6670,7 +6774,7 @@ BeOS) ;;
*) LIBM=-lm *) LIBM=-lm
esac esac
echo $ac_n "checking for --with-libm=STRING""... $ac_c" 1>&6 echo $ac_n "checking for --with-libm=STRING""... $ac_c" 1>&6
echo "configure:6674: checking for --with-libm=STRING" >&5 echo "configure:6778: checking for --with-libm=STRING" >&5
# Check whether --with-libm or --without-libm was given. # Check whether --with-libm or --without-libm was given.
if test "${with_libm+set}" = set; then if test "${with_libm+set}" = set; then
withval="$with_libm" withval="$with_libm"
@ -6691,7 +6795,7 @@ fi
# check for --with-libc=... # check for --with-libc=...
echo $ac_n "checking for --with-libc=STRING""... $ac_c" 1>&6 echo $ac_n "checking for --with-libc=STRING""... $ac_c" 1>&6
echo "configure:6695: checking for --with-libc=STRING" >&5 echo "configure:6799: checking for --with-libc=STRING" >&5
# Check whether --with-libc or --without-libc was given. # Check whether --with-libc or --without-libc was given.
if test "${with_libc+set}" = set; then if test "${with_libc+set}" = set; then
withval="$with_libc" withval="$with_libc"
@ -6715,12 +6819,12 @@ LIBS="$LIBS $LIBM"
for ac_func in hypot for ac_func in hypot
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6719: checking for $ac_func" >&5 echo "configure:6823: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6724 "configure" #line 6828 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -6743,7 +6847,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:6851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -6773,7 +6877,7 @@ LIBS=$LIBS_SAVE
# check whether malloc(0) returns NULL or not # check whether malloc(0) returns NULL or not
echo $ac_n "checking what malloc(0) returns""... $ac_c" 1>&6 echo $ac_n "checking what malloc(0) returns""... $ac_c" 1>&6
echo "configure:6777: checking what malloc(0) returns" >&5 echo "configure:6881: checking what malloc(0) returns" >&5
if eval "test \"`echo '$''{'ac_cv_malloc_zero'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_malloc_zero'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -6781,7 +6885,7 @@ else
ac_cv_malloc_zero=nonnull ac_cv_malloc_zero=nonnull
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6785 "configure" #line 6889 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_STDLIB #ifdef HAVE_STDLIB
@ -6800,7 +6904,7 @@ main() {
exit(0); exit(0);
} }
EOF EOF
if { (eval echo configure:6804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:6908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_malloc_zero=nonnull ac_cv_malloc_zero=nonnull
else else
@ -6826,17 +6930,17 @@ fi
# check for wchar.h # check for wchar.h
ac_safe=`echo "wchar.h" | sed 'y%./+-%__p_%'` ac_safe=`echo "wchar.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for wchar.h""... $ac_c" 1>&6 echo $ac_n "checking for wchar.h""... $ac_c" 1>&6
echo "configure:6830: checking for wchar.h" >&5 echo "configure:6934: checking for wchar.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6835 "configure" #line 6939 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <wchar.h> #include <wchar.h>
EOF EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:6840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } { (eval echo configure:6944: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then if test -z "$ac_err"; then
rm -rf conftest* rm -rf conftest*
@ -6867,7 +6971,7 @@ fi
if test "$wchar_h" = yes if test "$wchar_h" = yes
then then
echo $ac_n "checking size of wchar_t""... $ac_c" 1>&6 echo $ac_n "checking size of wchar_t""... $ac_c" 1>&6
echo "configure:6871: checking size of wchar_t" >&5 echo "configure:6975: checking size of wchar_t" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_wchar_t'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_sizeof_wchar_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -6875,7 +6979,7 @@ else
ac_cv_sizeof_wchar_t=4 ac_cv_sizeof_wchar_t=4
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6879 "configure" #line 6983 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
main() main()
@ -6886,7 +6990,7 @@ main()
exit(0); exit(0);
} }
EOF EOF
if { (eval echo configure:6890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:6994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_sizeof_wchar_t=`cat conftestval` ac_cv_sizeof_wchar_t=`cat conftestval`
else else
@ -6908,7 +7012,7 @@ EOF
fi fi
echo $ac_n "checking what type to use for unicode""... $ac_c" 1>&6 echo $ac_n "checking what type to use for unicode""... $ac_c" 1>&6
echo "configure:6912: checking what type to use for unicode" >&5 echo "configure:7016: checking what type to use for unicode" >&5
# Check whether --enable-unicode or --disable-unicode was given. # Check whether --enable-unicode or --disable-unicode was given.
if test "${enable_unicode+set}" = set; then if test "${enable_unicode+set}" = set; then
enableval="$enable_unicode" enableval="$enable_unicode"
@ -6983,14 +7087,14 @@ fi
# check for endianness # check for endianness
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
echo "configure:6987: checking whether byte ordering is bigendian" >&5 echo "configure:7091: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
ac_cv_c_bigendian=unknown ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro. # See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6994 "configure" #line 7098 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -7001,11 +7105,11 @@ int main() {
#endif #endif
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:7005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:7109: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not. # It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 7009 "configure" #line 7113 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -7016,7 +7120,7 @@ int main() {
#endif #endif
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:7020: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:7124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ac_cv_c_bigendian=yes ac_cv_c_bigendian=yes
else else
@ -7036,7 +7140,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 7040 "configure" #line 7144 "configure"
#include "confdefs.h" #include "confdefs.h"
main () { main () {
/* Are we little or big endian? From Harbison&Steele. */ /* Are we little or big endian? From Harbison&Steele. */
@ -7049,7 +7153,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1); exit (u.c[sizeof (long) - 1] == 1);
} }
EOF EOF
if { (eval echo configure:7053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:7157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_c_bigendian=no ac_cv_c_bigendian=no
else else
@ -7076,7 +7180,7 @@ fi
# Check whether right shifting a negative integer extends the sign bit # Check whether right shifting a negative integer extends the sign bit
# or fills with zeros (like the Cray J90, according to Tim Peters). # or fills with zeros (like the Cray J90, according to Tim Peters).
echo $ac_n "checking whether right shift extends the sign bit""... $ac_c" 1>&6 echo $ac_n "checking whether right shift extends the sign bit""... $ac_c" 1>&6
echo "configure:7080: checking whether right shift extends the sign bit" >&5 echo "configure:7184: checking whether right shift extends the sign bit" >&5
if eval "test \"`echo '$''{'ac_cv_rshift_extends_sign'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_rshift_extends_sign'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -7085,7 +7189,7 @@ if test "$cross_compiling" = yes; then
ac_cv_rshift_extends_sign=yes ac_cv_rshift_extends_sign=yes
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 7089 "configure" #line 7193 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() int main()
@ -7094,7 +7198,7 @@ int main()
} }
EOF EOF
if { (eval echo configure:7098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:7202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_rshift_extends_sign=yes ac_cv_rshift_extends_sign=yes
else else
@ -7119,13 +7223,13 @@ fi
# check for getc_unlocked and related locking functions # check for getc_unlocked and related locking functions
echo $ac_n "checking for getc_unlocked() and friends""... $ac_c" 1>&6 echo $ac_n "checking for getc_unlocked() and friends""... $ac_c" 1>&6
echo "configure:7123: checking for getc_unlocked() and friends" >&5 echo "configure:7227: checking for getc_unlocked() and friends" >&5
if eval "test \"`echo '$''{'ac_cv_have_getc_unlocked'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_have_getc_unlocked'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 7129 "configure" #line 7233 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
int main() { int main() {
@ -7137,7 +7241,7 @@ int main() {
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:7141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:7245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
ac_cv_have_getc_unlocked=yes ac_cv_have_getc_unlocked=yes
else else
@ -7160,7 +7264,7 @@ fi
# check for readline 4.0 # check for readline 4.0
echo $ac_n "checking for rl_pre_input_hook in -lreadline""... $ac_c" 1>&6 echo $ac_n "checking for rl_pre_input_hook in -lreadline""... $ac_c" 1>&6
echo "configure:7164: checking for rl_pre_input_hook in -lreadline" >&5 echo "configure:7268: checking for rl_pre_input_hook in -lreadline" >&5
ac_lib_var=`echo readline'_'rl_pre_input_hook | sed 'y%./+-%__p_%'` ac_lib_var=`echo readline'_'rl_pre_input_hook | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -7168,7 +7272,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lreadline -ltermcap $LIBS" LIBS="-lreadline -ltermcap $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 7172 "configure" #line 7276 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -7179,7 +7283,7 @@ int main() {
rl_pre_input_hook() rl_pre_input_hook()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:7183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:7287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -7205,7 +7309,7 @@ fi
# check for readline 4.2 # check for readline 4.2
echo $ac_n "checking for rl_completion_matches in -lreadline""... $ac_c" 1>&6 echo $ac_n "checking for rl_completion_matches in -lreadline""... $ac_c" 1>&6
echo "configure:7209: checking for rl_completion_matches in -lreadline" >&5 echo "configure:7313: checking for rl_completion_matches in -lreadline" >&5
ac_lib_var=`echo readline'_'rl_completion_matches | sed 'y%./+-%__p_%'` ac_lib_var=`echo readline'_'rl_completion_matches | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -7213,7 +7317,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lreadline -ltermcap $LIBS" LIBS="-lreadline -ltermcap $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 7217 "configure" #line 7321 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -7224,7 +7328,7 @@ int main() {
rl_completion_matches() rl_completion_matches()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:7228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then if { (eval echo configure:7332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -7249,7 +7353,7 @@ fi
echo $ac_n "checking for broken nice()""... $ac_c" 1>&6 echo $ac_n "checking for broken nice()""... $ac_c" 1>&6
echo "configure:7253: checking for broken nice()" >&5 echo "configure:7357: checking for broken nice()" >&5
if eval "test \"`echo '$''{'ac_cv_broken_nice'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_broken_nice'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -7258,7 +7362,7 @@ if test "$cross_compiling" = yes; then
ac_cv_broken_nice=no ac_cv_broken_nice=no
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 7262 "configure" #line 7366 "configure"
#include "confdefs.h" #include "confdefs.h"
int main() int main()
@ -7270,7 +7374,7 @@ int main()
} }
EOF EOF
if { (eval echo configure:7274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null if { (eval echo configure:7378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then then
ac_cv_broken_nice=yes ac_cv_broken_nice=yes
else else
@ -7301,12 +7405,12 @@ cat >> confdefs.h <<\EOF
#endif #endif
EOF EOF
echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
echo "configure:7305: checking for socklen_t" >&5 echo "configure:7409: checking for socklen_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 7310 "configure" #line 7414 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#if STDC_HEADERS #if STDC_HEADERS
@ -7355,7 +7459,7 @@ done
SRCDIRS="Parser Grammar Objects Python Modules" SRCDIRS="Parser Grammar Objects Python Modules"
echo $ac_n "checking for build directories""... $ac_c" 1>&6 echo $ac_n "checking for build directories""... $ac_c" 1>&6
echo "configure:7359: checking for build directories" >&5 echo "configure:7463: checking for build directories" >&5
for dir in $SRCDIRS; do for dir in $SRCDIRS; do
if test ! -d $dir; then if test ! -d $dir; then
mkdir $dir mkdir $dir

View File

@ -1534,6 +1534,9 @@ AC_CHECK_FUNCS(getnameinfo)
AC_HEADER_TIME AC_HEADER_TIME
AC_STRUCT_TM AC_STRUCT_TM
AC_STRUCT_TIMEZONE AC_STRUCT_TIMEZONE
AC_STRUCT_ST_RDEV
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_MSG_CHECKING(for time.h that defines altzone) AC_MSG_CHECKING(for time.h that defines altzone)
AC_CACHE_VAL(ac_cv_header_time_altzone, AC_CACHE_VAL(ac_cv_header_time_altzone,

View File

@ -18,6 +18,15 @@
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t #undef gid_t
/* Define if your struct stat has st_blksize. */
#undef HAVE_ST_BLKSIZE
/* Define if your struct stat has st_blocks. */
#undef HAVE_ST_BLOCKS
/* Define if your struct stat has st_rdev. */
#undef HAVE_ST_RDEV
/* Define if your struct tm has tm_zone. */ /* Define if your struct tm has tm_zone. */
#undef HAVE_TM_ZONE #undef HAVE_TM_ZONE