blob: 7dc63c8468fbbcaa84ef4b1e4d55478ea9200693 [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
7# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +00008AC_MSG_CHECKING(for --without-gcc)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00009AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000010 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000011 no) CC=cc
12 without_gcc=yes;;
13 yes) CC=gcc
14 without_gcc=no;;
15 *) CC=$withval
16 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +000017 esac], [
18 case `uname -s` in
19 OSF1) CC=cc
20 without_gcc=;;
21 *) without_gcc=no;;
22 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +000023AC_MSG_RESULT($without_gcc)
24
Guido van Rossum03ad99f1995-03-09 14:09:54 +000025# If the user switches compilers, we can't believe the cache
26if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
27then
28 AC_ERROR(cached CC is different -- throw away $cache_file
29(it is also a good idea to do 'make clean' before compiling))
30fi
31
Guido van Rossum627b2d71993-12-24 10:39:16 +000032AC_PROG_CC
33AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +000034AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000035AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +000036AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +000037AC_SUBST(INSTALL_PROGRAM)
38AC_SUBST(INSTALL_DATA)
Guido van Rossum4e8af441994-08-19 15:33:54 +000039# Install just never works :-(
40if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +000041then
42 INSTALL=cp
43 INSTALL_PROGRAM=cp
44 INSTALL_DATA=cp
45else
46 INSTALL_PROGRAM="$INSTALL"
47 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +000048fi
49AC_SUBST(OPT)
50# Optimizer/debugger flags passed between Makefiles
51if test -z "$OPT"
52then OPT=-O
53fi
Guido van Rossum627b2d71993-12-24 10:39:16 +000054
55# checks for UNIX variants that set C preprocessor variables
56AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +000057AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +000058
Guido van Rossum627b2d71993-12-24 10:39:16 +000059# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000060AC_HEADER_STDC
Guido van Rossumb65a48e1995-06-14 18:21:23 +000061AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h sys/audioio.h sys/param.h sys/select.h sys/time.h sys/times.h sys/un.h sys/utsname.h sys/wait.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000062AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +000063
64# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000065was_it_defined=no
66AC_MSG_CHECKING(for clock_t in time.h)
67AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
68AC_MSG_RESULT($was_it_defined)
69
Guido van Rossum76be6ed1995-01-02 18:33:54 +000070AC_TYPE_MODE_T
71AC_TYPE_OFF_T
72AC_TYPE_PID_T
73AC_TYPE_SIGNAL
74AC_TYPE_SIZE_T
75AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +000076
Guido van Rossumac405f61994-09-12 10:56:06 +000077# Set name for machine-dependent library files
78AC_SUBST(MACHDEP)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000079AC_MSG_CHECKING(MACHDEP)
Guido van Rossumac405f61994-09-12 10:56:06 +000080if test -z "$MACHDEP"
81then
Guido van Rossum2242fd11995-09-19 16:19:29 +000082 ac_sys_system=`uname -s | tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
83 ac_sys_release=`uname -r | tr -d '[/ ]' | sed 's/\..*//'`
Guido van Rossum45ee2ea1995-08-28 02:44:00 +000084 ac_sys_cpu=`(uname -p 2>/dev/null || uname -m) |
Guido van Rossum2242fd11995-09-19 16:19:29 +000085 tr '[[A-Z]]' '[[a-z]]'`
Guido van Rossum45ee2ea1995-08-28 02:44:00 +000086## MACHDEP="$ac_sys_system$ac_sys_release$ac_sys_cpu"
Guido van Rossum76be6ed1995-01-02 18:33:54 +000087 MACHDEP="$ac_sys_system$ac_sys_release"
Guido van Rossumac405f61994-09-12 10:56:06 +000088 case MACHDEP in
89 '') MACHDEP=unknown;;
90 esac
Guido van Rossumac405f61994-09-12 10:56:06 +000091fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +000092AC_MSG_RESULT($MACHDEP)
Guido van Rossumac405f61994-09-12 10:56:06 +000093
94# Set info about shared libraries.
95# XXX This should try things out instead of testing uname!
96AC_SUBST(SO)
97AC_SUBST(LDSHARED)
98AC_SUBST(CCSHARED)
99AC_SUBST(LINKFORSHARED)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000100ac_sys_system=`uname -s`
101ac_sys_release=`uname -r`
Guido van Rossumac405f61994-09-12 10:56:06 +0000102# SO is the extension of shared libraries `(including the dot!)
103# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000104AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000105if test -z "$SO"
106then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000107 case $ac_sys_system in
Guido van Rossumac405f61994-09-12 10:56:06 +0000108 hp*|HP*) SO=.sl;;
109 *) SO=.so;;
110 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000111fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000112AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000113# LDSHARED is the ld *command* used to create shared library
114# -- "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 +0000115AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000116if test -z "$LDSHARED"
117then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000118 case $ac_sys_system/$ac_sys_release in
Guido van Rossumac405f61994-09-12 10:56:06 +0000119 IRIX*) LDSHARED="ld -shared";;
120 SunOS/4*) LDSHARED="ld";;
121 SunOS/5*) LDSHARED="ld -G";;
122 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000123 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000124 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000125 Linux*) LDSHARED="gcc-elf -shared";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000126 *) LDSHARED="ld";;
127 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000128fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000129AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000130# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000131# library -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000132AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000133if test -z "$CCSHARED"
134then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000135 case $ac_sys_system in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000136 hp*|HP*) if test "$GCC" = yes;
137 then CCSHARED="-fpic";
138 else CCSHARED="+z";
139 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000140 Linux*) CCSHARED="-fpic";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000141 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000142fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000143AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000144# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000145# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000146AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000147if test -z "$LINKFORSHARED"
148then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000149 case $ac_sys_system in
Guido van Rossumac405f61994-09-12 10:56:06 +0000150 hp*|HP*) LINKFORSHARED="-Wl,-E";;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000151 Linux*) LINKFORSHARED="-rdynamic";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000152 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000153fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000154AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000155
Guido van Rossum627b2d71993-12-24 10:39:16 +0000156# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000157AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
158AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
159AC_CHECK_LIB(sun, getpwnam) # NIS (== YP) interface for IRIX 4
Guido van Rossum71001e41995-01-26 00:44:03 +0000160# The following three (nsl,inet,socket) are needed on Sequent;
161# the order of checking must be this. Most SVR4 platforms will
162# need -lsocket and -lnsl. However on SGI IRIX 5, these exist but
163# broken. I see no elegant solution (probably CHECK_LIB should be
164# fixed to only add the library if the given entry point is not
165# satisfied without it).
166if test "`uname -s`" != IRIX
167then
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000168AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
169AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
170AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Guido van Rossum71001e41995-01-26 00:44:03 +0000171fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000172
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000173AC_MSG_CHECKING(for --with-readline)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000174AC_ARG_WITH(readline, [--with-readline=DIRECTORY GNU readline], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000175AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000176AC_DEFINE(WITH_READLINE)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000177if test ! -d "$withval"
178then AC_ERROR(proper usage is --with-readline=DIRECTORY)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000179fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000180termcap=
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000181AC_CHECK_LIB(termcap, tgetent, [termcap=termcap], [
182AC_CHECK_LIB(termlib, tgetent, [termcap=termlib])])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000183if test ! -z "$termcap"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000184then LIBS="$LIBS $withval/libreadline.a"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000185 # Avoid possible conflict between shared libraries termcap and gl
186 # on IRIX 5: both contain a routine called clear.
187 if test -f /usr/lib/lib$termcap.a
188 then LIBS="$LIBS /usr/lib/lib$termcap.a"
189 else LIBS="$LIBS -l$termcap"
190 fi
191else AC_ERROR(no working termcap/termlib, do not use --with-readline)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000192fi], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000193
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000194AC_MSG_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000195AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000196AC_MSG_RESULT($withval)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000197if test -d "$withval"
198then LIBS="$LIBS -L$withval"
199fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000200AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000201AC_DEFINE(_POSIX_THREADS)
202LIBS="$LIBS -lpthreads"
203LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000204AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000205LIBS="$LIBS -lmpc"
206LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000207AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000208LIBS="$LIBS -lthread"
209LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000210], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000211
212# -I${DLINCLDIR} is added to the compile rule for import.o
213AC_SUBST(DLINCLDIR)
214DLINCLDIR=/
215
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000216AC_MSG_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000217AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000218AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000219AC_DEFINE(WITH_SGI_DL)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000220dldir=$withval
221if test -d "$dldir"
222then LIBS="$LIBS -L$dldir"
223else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
224fi
225DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000226LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000227
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000228AC_MSG_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000229AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000230AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000231AC_DEFINE(WITH_DL_DLD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000232dldir=`echo "$withval" | sed 's/,.*//'`
233dlddir=`echo "$withval" | sed 's/.*,//'`
234if test -d "$dldir" -a -d "$dlddir"
235then LIBS="$LIBS -L$dldir -L$dlddir"
236else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
237fi
238DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000239LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000240
241# checks for library functions
Guido van Rossum55a214e1995-09-13 17:48:09 +0000242AC_CHECK_FUNCS(chown clock dlopen ftime ftruncate gethostname_r gettimeofday getpeername getpgrp getpid getwd link lstat nice readlink select setgid setuid setsid setpgid setpgrp setvbuf siginterrupt strftime symlink tcgetpgrp tcsetpgrp times truncate uname waitpid)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000243AC_REPLACE_FUNCS(dup2 getcwd strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000244AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
245AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
246AC_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 +0000247
248# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000249AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000250AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000251AC_STRUCT_TIMEZONE
252
253AC_MSG_CHECKING(for time.h that defines altzone)
254AC_CACHE_VAL(ac_cv_header_time_altzone,
255[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
256 ac_cv_header_time_altzone=yes,
257 ac_cv_header_time_altzone=no)])
258AC_MSG_RESULT($ac_cv_header_time_altzone)
259if test $ac_cv_header_time_altzone = yes; then
260 AC_DEFINE(HAVE_ALTZONE)
261fi
262
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000263was_it_defined=no
264AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000265AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000266#include <sys/types.h>
267#include <sys/select.h>
268#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000269], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
270AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000271
272# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000273
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000274AC_C_CHAR_UNSIGNED
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000275
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000276AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000277
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000278works=no
279AC_MSG_CHECKING(for working volatile)
280AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
281AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000282
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000283works=no
284AC_MSG_CHECKING(for working signed char)
285AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
286AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000287
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000288have_prototypes=no
289AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000290AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
291AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000292AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000293
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000294works=no
295AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000296AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000297#include <stdarg.h>
298int foo(int x, ...) { return 0; }
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000299], [return foo(10, 11, 12);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000300AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
301AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000302
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000303if test "$have_prototypes" = yes; then
304bad_prototypes=no
305AC_MSG_CHECKING(for bad exec* prototypes)
306AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
307 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
308AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000309fi
310
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000311bad_forward=no
312AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000313AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000314struct s { int a; int b; };
315static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000316int foobar() {
317 static int random;
318 random = (int) &foo;
319 return random;
320}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000321static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000322main() {
323 exit(!((int)&foo == foobar()));
324}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000325], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
326AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000327
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000328va_list_is_array=no
329AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000330AC_TRY_COMPILE([
331#ifdef HAVE_STDARG_PROTOTYPES
332#include <stdarg.h>
333#else
334#include <varargs.h>
335#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000336], [va_list list1, list2; list1 = list2;], ,
337AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
338AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000339
Guido van Rossum627b2d71993-12-24 10:39:16 +0000340# checks for system services
341# (none yet)
342
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000343# Linux requires this for correct f.p. operations
344AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000345
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000346# check for --with-libm=...
347AC_SUBST(LIBM)
348LIBM=-lm
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000349AC_ARG_WITH(libm, [--with-libm=STRING math library], [
350if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000351then LIBM=$withval
352else AC_ERROR(proper usage is --with-libm=STRING)
353fi])
354
355# check for --with-libc=...
356AC_SUBST(LIBC)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000357AC_ARG_WITH(libc, [--with-libc=STRING C library], [
358if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000359then LIBC=$withval
360else AC_ERROR(proper usage is --with-libc=STRING)
361fi])
362
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000363# check for hypot() in math library
364LIBS_SAVE=$LIBS
365LIBS="$LIBS $LIBM"
366AC_CHECK_FUNCS(hypot)
367LIBS=$LIBS_SAVE
368
Guido van Rossum7d473291995-01-20 14:12:16 +0000369# check for getopt
370AC_MSG_CHECKING(for genuine getopt)
371AC_CACHE_VAL(ac_cv_func_getopt,
372[AC_TRY_RUN([#include <stdio.h>
373extern int optind, opterr, getopt();
374extern char* optarg;
375int main() {
376 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
377 opterr = 0;
378 if (getopt(3, av, "f:") == 'f') { exit(1); }
379 exit(0);
380}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
381AC_MSG_RESULT($ac_cv_func_getopt)
382test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
383AC_SUBST(LIBOBJS)dnl
384
Guido van Rossum627b2d71993-12-24 10:39:16 +0000385# generate output files
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000386AC_OUTPUT(Makefile Objects/Makefile Parser/Makefile Python/Makefile Modules/Makefile.pre)