blob: 226ab686997c3c6a5ba611a1c44892467ce475e3 [file] [log] [blame]
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001dnl Process this file with autoconf 2.0 or later to make a configure script.
2AC_REVISION($Revision$)
3AC_PREREQ(2.0)
Guido van Rossum6085e321993-12-26 18:24:40 +00004AC_INIT(Include/object.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00005AC_CONFIG_HEADER(config.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +00006
Guido van Rossumb418f891996-07-30 18:06:02 +00007# NEXTSTEP stuff
8AC_MSG_CHECKING(for --with-next-archs)
9AC_ARG_WITH(next-archs,
10 [--with-next-archs='arch1 arch2 ..' build MAB binary], [
11 if test -n "$withval"; then
12 ac_sys_cpu=_`/usr/lib/arch_tool -choose_obj_dir $withval`
13 ac_arch_flags=`/usr/lib/arch_tool -archify_list $withval`
14 else
15 ac_sys_cpu=_`arch`
16 fi
17], [])
18AC_MSG_RESULT($with_next_archs)
19
20# Set name for machine-dependent library files
21AC_SUBST(MACHDEP)
22AC_MSG_CHECKING(MACHDEP)
23if test -z "$MACHDEP"
24then
25 if test -f /usr/lib/NextStep/software_version; then
26 set X `hostinfo | grep 'NeXT Mach.*:' | \
27 sed -e 's/://' -e 's/\./_/'` && \
28 ac_sys_system=next && ac_sys_release=$4
29 MACHDEP="$ac_sys_system$ac_sys_release$ac_sys_cpu"
30 else
31 ac_sys_system=`uname -s`
Guido van Rossum8a2574e1996-07-31 22:45:54 +000032 if test "$ac_sys_system" = "AIX" ; then
33 ac_sys_release=`uname -v`
34 else
35 ac_sys_release=`uname -r`
36 fi
Guido van Rossumb418f891996-07-30 18:06:02 +000037 ac_md_system=`echo $ac_sys_system |
38 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
39 ac_md_release=`echo $ac_sys_release |
40 tr -d '[/ ]' | sed 's/\..*//'`
41 MACHDEP="$ac_md_system$ac_md_release"
42 fi
43 case MACHDEP in
44 '') MACHDEP=unknown;;
45 esac
46fi
47AC_MSG_RESULT($MACHDEP)
48
Guido van Rossum627b2d71993-12-24 10:39:16 +000049# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000050AC_MSG_CHECKING(for --without-gcc)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000051AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000052 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000053 no) CC=cc
54 without_gcc=yes;;
55 yes) CC=gcc
56 without_gcc=no;;
57 *) CC=$withval
58 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +000059 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +000060 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +000061 OSF1) CC=cc
62 without_gcc=;;
63 *) without_gcc=no;;
64 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +000065AC_MSG_RESULT($without_gcc)
66
Guido van Rossum03ad99f1995-03-09 14:09:54 +000067# If the user switches compilers, we can't believe the cache
68if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
69then
70 AC_ERROR(cached CC is different -- throw away $cache_file
71(it is also a good idea to do 'make clean' before compiling))
72fi
73
Guido van Rossum627b2d71993-12-24 10:39:16 +000074AC_PROG_CC
75AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +000076AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000077AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +000078AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +000079AC_SUBST(INSTALL_PROGRAM)
80AC_SUBST(INSTALL_DATA)
Guido van Rossum4e8af441994-08-19 15:33:54 +000081# Install just never works :-(
82if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +000083then
84 INSTALL=cp
85 INSTALL_PROGRAM=cp
86 INSTALL_DATA=cp
87else
88 INSTALL_PROGRAM="$INSTALL"
89 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +000090fi
Guido van Rossumb418f891996-07-30 18:06:02 +000091
Guido van Rossum4e8af441994-08-19 15:33:54 +000092# Optimizer/debugger flags passed between Makefiles
Guido van Rossumb418f891996-07-30 18:06:02 +000093AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +000094if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +000095then
96 case $ac_sys_system in
Guido van Rossumc5a39031996-07-31 17:35:03 +000097 NeXT|next) OPT="-g -Wall -O3 -fomit-frame-pointer";;
Guido van Rossumb418f891996-07-30 18:06:02 +000098 *) OPT="-O";;
99 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000100fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000101
Guido van Rossumc5a39031996-07-31 17:35:03 +0000102if test -z "$ac_arch_flags"
103then
104 OPT="$OPT $ac_arch_flags"
105fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000106# checks for UNIX variants that set C preprocessor variables
107AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000108AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000109
Guido van Rossum627b2d71993-12-24 10:39:16 +0000110# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000111AC_HEADER_STDC
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000112AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h ncurses.h \
113signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
Guido van Rossum22b6db61996-06-28 20:18:10 +0000114sys/audioio.h sys/lock.h sys/param.h sys/select.h sys/time.h sys/times.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000115sys/un.h sys/utsname.h sys/wait.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000116AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000117
118# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000119was_it_defined=no
120AC_MSG_CHECKING(for clock_t in time.h)
121AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
122AC_MSG_RESULT($was_it_defined)
123
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000124AC_TYPE_MODE_T
125AC_TYPE_OFF_T
126AC_TYPE_PID_T
127AC_TYPE_SIGNAL
128AC_TYPE_SIZE_T
129AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000130
Guido van Rossumac405f61994-09-12 10:56:06 +0000131
132# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000133AC_SUBST(SO)
134AC_SUBST(LDSHARED)
135AC_SUBST(CCSHARED)
136AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000137# SO is the extension of shared libraries `(including the dot!)
138# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000139AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000140if test -z "$SO"
141then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000142 case $ac_sys_system in
Guido van Rossumac405f61994-09-12 10:56:06 +0000143 hp*|HP*) SO=.sl;;
Guido van Rossumb418f891996-07-30 18:06:02 +0000144 NeXT|next) SO=.a;; # no shared libs on NeXT 3.3 and less
Guido van Rossumac405f61994-09-12 10:56:06 +0000145 *) SO=.so;;
146 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000147fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000148AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000149# LDSHARED is the ld *command* used to create shared library
150# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000151AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000152if test -z "$LDSHARED"
153then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000154 case $ac_sys_system/$ac_sys_release in
Guido van Rossum8a2574e1996-07-31 22:45:54 +0000155 AIX*) LDSHARED="ld_so_aix";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000156 IRIX*) LDSHARED="ld -shared";;
157 SunOS/4*) LDSHARED="ld";;
158 SunOS/5*) LDSHARED="ld -G";;
159 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000160 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000161 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000162 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum68242b51996-05-28 22:53:03 +0000163 FreeBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000164 NeXT|next/3*) LDSHARED="ld -u libsys_s";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000165 *) LDSHARED="ld";;
166 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000167fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000168AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000169# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000170# library -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000171AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000172if test -z "$CCSHARED"
173then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000174 case $ac_sys_system in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000175 hp*|HP*) if test "$GCC" = yes;
176 then CCSHARED="-fpic";
177 else CCSHARED="+z";
178 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000179 Linux*) CCSHARED="-fpic";;
Guido van Rossum68242b51996-05-28 22:53:03 +0000180 FreeBSD*) CCSHARED="-fpic";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000181 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000182fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000183AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000184# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000185# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000186AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000187if test -z "$LINKFORSHARED"
188then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000189 case $ac_sys_system in
Guido van Rossum8a2574e1996-07-31 22:45:54 +0000190 AIX*) LINKFORSHARED="-Wl,-bE:python.exp";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000191 hp*|HP*) LINKFORSHARED="-Wl,-E";;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000192 Linux*) LINKFORSHARED="-rdynamic";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000193 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000194fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000195AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000196
Guido van Rossum627b2d71993-12-24 10:39:16 +0000197# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000198AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
199AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
200AC_CHECK_LIB(sun, getpwnam) # NIS (== YP) interface for IRIX 4
Guido van Rossum71001e41995-01-26 00:44:03 +0000201# The following three (nsl,inet,socket) are needed on Sequent;
202# the order of checking must be this. Most SVR4 platforms will
203# need -lsocket and -lnsl. However on SGI IRIX 5, these exist but
204# broken. I see no elegant solution (probably CHECK_LIB should be
205# fixed to only add the library if the given entry point is not
206# satisfied without it).
207if test "`uname -s`" != IRIX
208then
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000209AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
210AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
211AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Guido van Rossum71001e41995-01-26 00:44:03 +0000212fi
Guido van Rossumc5a39031996-07-31 17:35:03 +0000213AC_MSG_CHECKING(for --with-libs)
214AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [
215AC_MSG_RESULT($withval)
216LIBS="$withval $LIBS"
217], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000218
Guido van Rossum68242b51996-05-28 22:53:03 +0000219# XXX need to check whether libreadline.a actually exists there!
220# XXX Also, on some systems, it's libreadline.so...
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000221AC_MSG_CHECKING(for --with-readline)
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000222AC_ARG_WITH(readline, [--with-readline[=DIRECTORY] use GNU readline library], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000223AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000224AC_DEFINE(WITH_READLINE)
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000225if test -d "$withval"
226then LIBS="$LIBS -L$withval"
Guido van Rossum627b2d71993-12-24 10:39:16 +0000227fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000228termcap=
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000229AC_CHECK_LIB(termcap, tgetent, [termcap=termcap], [
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000230AC_CHECK_LIB(termlib, tgetent, [termcap=termlib], [
231AC_ERROR(no working termcap/termlib -- do not use --with-readline)])])
232AC_CHECK_LIB(readline, readline, [
233LIBS="$LIBS -lreadline"
234# Avoid possible conflict between shared libraries termcap and gl
235# on IRIX 5: both contain a routine called clear.
236if test -f /usr/lib/lib$termcap.a
237then LIBS="$LIBS /usr/lib/lib$termcap.a"
238else LIBS="$LIBS -l$termcap"
239fi
240], [AC_ERROR(no working GNU readline -- do not use --with-readline)],
241-l$termcap)],
242AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000243
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000244AC_MSG_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000245AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000246AC_MSG_RESULT($withval)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000247if test -d "$withval"
248then LIBS="$LIBS -L$withval"
249fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000250AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
251AC_DEFINE(C_THREADS)
252LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000253AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000254AC_DEFINE(_POSIX_THREADS)
255LIBS="$LIBS -lpthreads"
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000256LIBOBJS="$LIBOBJS thread.o"], [
257AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
258AC_DEFINE(_POSIX_THREADS)
259LIBS="$LIBS -lpthread"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000260LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossumb418f891996-07-30 18:06:02 +0000261])])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000262AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000263LIBS="$LIBS -lmpc"
264LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000265AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000266LIBS="$LIBS -lthread"
267LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000268], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000269
Guido van Rossum68242b51996-05-28 22:53:03 +0000270# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000271AC_SUBST(DLINCLDIR)
272DLINCLDIR=/
273
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000274AC_MSG_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000275AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000276AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000277AC_DEFINE(WITH_SGI_DL)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000278dldir=$withval
279if test -d "$dldir"
280then LIBS="$LIBS -L$dldir"
281else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
282fi
283DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000284LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000285
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000286AC_MSG_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000287AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000288AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000289AC_DEFINE(WITH_DL_DLD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000290dldir=`echo "$withval" | sed 's/,.*//'`
291dlddir=`echo "$withval" | sed 's/.*,//'`
292if test -d "$dldir" -a -d "$dlddir"
293then LIBS="$LIBS -L$dldir -L$dlddir"
294else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
295fi
296DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000297LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000298
299# checks for library functions
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000300AC_CHECK_FUNCS(chown clock dlopen flock ftime ftruncate \
Guido van Rossum68242b51996-05-28 22:53:03 +0000301 gethostname_r getpeername getpgrp getpid gettimeofday getwd \
Guido van Rossumdde43171996-07-24 02:41:31 +0000302 link lstat mkfifo nice plock putenv readlink \
Guido van Rossum68242b51996-05-28 22:53:03 +0000303 select setgid setuid setsid setpgid setpgrp setvbuf \
304 sigaction siginterrupt sigrelse strftime symlink \
Guido van Rossumb418f891996-07-30 18:06:02 +0000305 tcgetpgrp tcsetpgrp times truncate uname waitpid)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000306AC_REPLACE_FUNCS(dup2 getcwd strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000307AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
308AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
309AC_CHECK_FUNC(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000310
311# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000312AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000313AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000314AC_STRUCT_TIMEZONE
315
316AC_MSG_CHECKING(for time.h that defines altzone)
317AC_CACHE_VAL(ac_cv_header_time_altzone,
318[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
319 ac_cv_header_time_altzone=yes,
320 ac_cv_header_time_altzone=no)])
321AC_MSG_RESULT($ac_cv_header_time_altzone)
322if test $ac_cv_header_time_altzone = yes; then
323 AC_DEFINE(HAVE_ALTZONE)
324fi
325
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000326was_it_defined=no
327AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000328AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000329#include <sys/types.h>
330#include <sys/select.h>
331#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000332], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
333AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000334
335# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000336
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000337AC_C_CHAR_UNSIGNED
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000338
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000339AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000340
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000341works=no
342AC_MSG_CHECKING(for working volatile)
343AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
344AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000345
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000346works=no
347AC_MSG_CHECKING(for working signed char)
348AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
349AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000350
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000351have_prototypes=no
352AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000353AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
354AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000355AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000356
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000357works=no
358AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000359AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000360#include <stdarg.h>
361int foo(int x, ...) { return 0; }
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000362], [return foo(10, 11, 12);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000363AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
364AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000365
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000366if test "$have_prototypes" = yes; then
367bad_prototypes=no
368AC_MSG_CHECKING(for bad exec* prototypes)
369AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
370 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
371AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000372fi
373
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000374bad_forward=no
375AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000376AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000377struct s { int a; int b; };
378static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000379int foobar() {
380 static int random;
381 random = (int) &foo;
382 return random;
383}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000384static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000385main() {
386 exit(!((int)&foo == foobar()));
387}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000388], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
389AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000390
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000391va_list_is_array=no
392AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000393AC_TRY_COMPILE([
394#ifdef HAVE_STDARG_PROTOTYPES
395#include <stdarg.h>
396#else
397#include <varargs.h>
398#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000399], [va_list list1, list2; list1 = list2;], ,
400AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
401AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000402
Guido van Rossum627b2d71993-12-24 10:39:16 +0000403# checks for system services
404# (none yet)
405
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000406# Linux requires this for correct f.p. operations
407AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000408
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000409# check for --with-libm=...
410AC_SUBST(LIBM)
411LIBM=-lm
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000412AC_ARG_WITH(libm, [--with-libm=STRING math library], [
413if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000414then LIBM=$withval
415else AC_ERROR(proper usage is --with-libm=STRING)
416fi])
417
418# check for --with-libc=...
419AC_SUBST(LIBC)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000420AC_ARG_WITH(libc, [--with-libc=STRING C library], [
421if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000422then LIBC=$withval
423else AC_ERROR(proper usage is --with-libc=STRING)
424fi])
425
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000426# check for hypot() in math library
427LIBS_SAVE=$LIBS
428LIBS="$LIBS $LIBM"
429AC_CHECK_FUNCS(hypot)
430LIBS=$LIBS_SAVE
431
Guido van Rossum7d473291995-01-20 14:12:16 +0000432# check for getopt
433AC_MSG_CHECKING(for genuine getopt)
434AC_CACHE_VAL(ac_cv_func_getopt,
435[AC_TRY_RUN([#include <stdio.h>
436extern int optind, opterr, getopt();
437extern char* optarg;
438int main() {
439 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
440 opterr = 0;
441 if (getopt(3, av, "f:") == 'f') { exit(1); }
442 exit(0);
443}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
444AC_MSG_RESULT($ac_cv_func_getopt)
445test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
446AC_SUBST(LIBOBJS)dnl
447
Guido van Rossum627b2d71993-12-24 10:39:16 +0000448# generate output files
Guido van Rossumb418f891996-07-30 18:06:02 +0000449AC_OUTPUT(Makefile \
450 Objects/Makefile \
451 Parser/Makefile \
452 Python/Makefile \
453 Modules/Makefile.pre)