blob: 3c55a4d801ed9db108c278a909782e6d3bb10ae6 [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;;
17 esac], [without_gcc=no])
18AC_MSG_RESULT($without_gcc)
19
Guido van Rossum03ad99f1995-03-09 14:09:54 +000020# If the user switches compilers, we can't believe the cache
21if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
22then
23 AC_ERROR(cached CC is different -- throw away $cache_file
24(it is also a good idea to do 'make clean' before compiling))
25fi
26
Guido van Rossum627b2d71993-12-24 10:39:16 +000027AC_PROG_CC
28AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +000029AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000030AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +000031AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +000032AC_SUBST(INSTALL_PROGRAM)
33AC_SUBST(INSTALL_DATA)
Guido van Rossum4e8af441994-08-19 15:33:54 +000034# Install just never works :-(
35if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +000036then
37 INSTALL=cp
38 INSTALL_PROGRAM=cp
39 INSTALL_DATA=cp
40else
41 INSTALL_PROGRAM="$INSTALL"
42 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +000043fi
44AC_SUBST(OPT)
45# Optimizer/debugger flags passed between Makefiles
46if test -z "$OPT"
47then OPT=-O
48fi
Guido van Rossum627b2d71993-12-24 10:39:16 +000049
50# checks for UNIX variants that set C preprocessor variables
51AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +000052AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +000053
Guido van Rossum627b2d71993-12-24 10:39:16 +000054# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000055AC_HEADER_STDC
Guido van Rossumb65a48e1995-06-14 18:21:23 +000056AC_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 +000057AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +000058
59# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000060was_it_defined=no
61AC_MSG_CHECKING(for clock_t in time.h)
62AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
63AC_MSG_RESULT($was_it_defined)
64
Guido van Rossum76be6ed1995-01-02 18:33:54 +000065AC_TYPE_MODE_T
66AC_TYPE_OFF_T
67AC_TYPE_PID_T
68AC_TYPE_SIGNAL
69AC_TYPE_SIZE_T
70AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +000071
Guido van Rossumac405f61994-09-12 10:56:06 +000072# Set name for machine-dependent library files
73AC_SUBST(MACHDEP)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000074AC_MSG_CHECKING(MACHDEP)
Guido van Rossumac405f61994-09-12 10:56:06 +000075if test -z "$MACHDEP"
76then
Guido van Rossum76be6ed1995-01-02 18:33:54 +000077 ac_sys_system=`uname -s | tr -d ' ' | tr '[[A-Z]]' '[[a-z]]'`
78 ac_sys_release=`uname -r | tr -d ' ' | sed 's/\..*//'`
79 MACHDEP="$ac_sys_system$ac_sys_release"
Guido van Rossumac405f61994-09-12 10:56:06 +000080 case MACHDEP in
81 '') MACHDEP=unknown;;
82 esac
Guido van Rossumac405f61994-09-12 10:56:06 +000083fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +000084AC_MSG_RESULT($MACHDEP)
Guido van Rossumac405f61994-09-12 10:56:06 +000085
86# Set info about shared libraries.
87# XXX This should try things out instead of testing uname!
88AC_SUBST(SO)
89AC_SUBST(LDSHARED)
90AC_SUBST(CCSHARED)
91AC_SUBST(LINKFORSHARED)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000092ac_sys_system=`uname -s`
93ac_sys_release=`uname -r`
Guido van Rossumac405f61994-09-12 10:56:06 +000094# SO is the extension of shared libraries `(including the dot!)
95# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +000096AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +000097if test -z "$SO"
98then
Guido van Rossum76be6ed1995-01-02 18:33:54 +000099 case $ac_sys_system in
Guido van Rossumac405f61994-09-12 10:56:06 +0000100 hp*|HP*) SO=.sl;;
101 *) SO=.so;;
102 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000103fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000104AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000105# LDSHARED is the ld *command* used to create shared library
106# -- "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 +0000107AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000108if test -z "$LDSHARED"
109then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000110 case $ac_sys_system/$ac_sys_release in
Guido van Rossumac405f61994-09-12 10:56:06 +0000111 IRIX*) LDSHARED="ld -shared";;
112 SunOS/4*) LDSHARED="ld";;
113 SunOS/5*) LDSHARED="ld -G";;
114 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000115 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000116 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000117 Linux*) LDSHARED="gcc-elf -shared";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000118 *) LDSHARED="ld";;
119 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000120fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000121AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000122# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000123# library -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000124AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000125if test -z "$CCSHARED"
126then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000127 case $ac_sys_system in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000128 hp*|HP*) if test "$GCC" = yes;
129 then CCSHARED="-fpic";
130 else CCSHARED="+z";
131 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000132 Linux*) CCSHARED="-fpic";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000133 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000134fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000135AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000136# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000137# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000138AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000139if test -z "$LINKFORSHARED"
140then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000141 case $ac_sys_system in
Guido van Rossumac405f61994-09-12 10:56:06 +0000142 hp*|HP*) LINKFORSHARED="-Wl,-E";;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000143 Linux*) LINKFORSHARED="-rdynamic";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000144 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000145fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000146AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000147
Guido van Rossum627b2d71993-12-24 10:39:16 +0000148# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000149AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
150AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
151AC_CHECK_LIB(sun, getpwnam) # NIS (== YP) interface for IRIX 4
Guido van Rossum71001e41995-01-26 00:44:03 +0000152# The following three (nsl,inet,socket) are needed on Sequent;
153# the order of checking must be this. Most SVR4 platforms will
154# need -lsocket and -lnsl. However on SGI IRIX 5, these exist but
155# broken. I see no elegant solution (probably CHECK_LIB should be
156# fixed to only add the library if the given entry point is not
157# satisfied without it).
158if test "`uname -s`" != IRIX
159then
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000160AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
161AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
162AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Guido van Rossum71001e41995-01-26 00:44:03 +0000163fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000164
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000165AC_MSG_CHECKING(for --with-readline)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000166AC_ARG_WITH(readline, [--with-readline=DIRECTORY GNU readline], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000167AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000168AC_DEFINE(WITH_READLINE)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000169if test ! -d "$withval"
170then AC_ERROR(proper usage is --with-readline=DIRECTORY)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000171fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000172termcap=
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000173AC_CHECK_LIB(termcap, tgetent, [termcap=termcap], [
174AC_CHECK_LIB(termlib, tgetent, [termcap=termlib])])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000175if test ! -z "$termcap"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000176then LIBS="$LIBS $withval/libreadline.a"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000177 # Avoid possible conflict between shared libraries termcap and gl
178 # on IRIX 5: both contain a routine called clear.
179 if test -f /usr/lib/lib$termcap.a
180 then LIBS="$LIBS /usr/lib/lib$termcap.a"
181 else LIBS="$LIBS -l$termcap"
182 fi
183else AC_ERROR(no working termcap/termlib, do not use --with-readline)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000184fi], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000185
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000186AC_MSG_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000187AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000188AC_MSG_RESULT($withval)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000189if test -d "$withval"
190then LIBS="$LIBS -L$withval"
191fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000192AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000193AC_DEFINE(_POSIX_THREADS)
194LIBS="$LIBS -lpthreads"
195LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000196AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000197LIBS="$LIBS -lmpc"
198LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000199AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000200LIBS="$LIBS -lthread"
201LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000202], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000203
204# -I${DLINCLDIR} is added to the compile rule for import.o
205AC_SUBST(DLINCLDIR)
206DLINCLDIR=/
207
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000208AC_MSG_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000209AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000210AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000211AC_DEFINE(WITH_SGI_DL)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000212dldir=$withval
213if test -d "$dldir"
214then LIBS="$LIBS -L$dldir"
215else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
216fi
217DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000218LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000219
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000220AC_MSG_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000221AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000222AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000223AC_DEFINE(WITH_DL_DLD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000224dldir=`echo "$withval" | sed 's/,.*//'`
225dlddir=`echo "$withval" | sed 's/.*,//'`
226if test -d "$dldir" -a -d "$dlddir"
227then LIBS="$LIBS -L$dldir -L$dlddir"
228else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
229fi
230DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000231LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000232
233# checks for library functions
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000234AC_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 symlink tcgetpgrp tcsetpgrp times truncate uname waitpid)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000235AC_REPLACE_FUNCS(dup2 getcwd strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000236AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
237AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
238AC_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 +0000239
240# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000241AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000242AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000243AC_STRUCT_TIMEZONE
244
245AC_MSG_CHECKING(for time.h that defines altzone)
246AC_CACHE_VAL(ac_cv_header_time_altzone,
247[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
248 ac_cv_header_time_altzone=yes,
249 ac_cv_header_time_altzone=no)])
250AC_MSG_RESULT($ac_cv_header_time_altzone)
251if test $ac_cv_header_time_altzone = yes; then
252 AC_DEFINE(HAVE_ALTZONE)
253fi
254
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000255was_it_defined=no
256AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000257AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000258#include <sys/types.h>
259#include <sys/select.h>
260#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000261], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
262AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000263
264# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000265
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000266AC_C_CHAR_UNSIGNED
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000267
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000268AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000269
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000270works=no
271AC_MSG_CHECKING(for working volatile)
272AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
273AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000274
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000275works=no
276AC_MSG_CHECKING(for working signed char)
277AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
278AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000279
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000280have_prototypes=no
281AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000282AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
283AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000284AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000285
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000286works=no
287AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000288AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000289#include <stdarg.h>
290int foo(int x, ...) { return 0; }
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000291], [return foo(10, 11, 12);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000292AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
293AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000294
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000295if test "$have_prototypes" = yes; then
296bad_prototypes=no
297AC_MSG_CHECKING(for bad exec* prototypes)
298AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
299 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
300AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000301fi
302
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000303bad_forward=no
304AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000305AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000306struct s { int a; int b; };
307static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000308int foobar() {
309 static int random;
310 random = (int) &foo;
311 return random;
312}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000313static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000314main() {
315 exit(!((int)&foo == foobar()));
316}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000317], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
318AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000319
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000320va_list_is_array=no
321AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000322AC_TRY_COMPILE([
323#ifdef HAVE_STDARG_PROTOTYPES
324#include <stdarg.h>
325#else
326#include <varargs.h>
327#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000328], [va_list list1, list2; list1 = list2;], ,
329AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
330AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000331
Guido van Rossum627b2d71993-12-24 10:39:16 +0000332# checks for system services
333# (none yet)
334
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000335# Linux requires this for correct f.p. operations
336AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000337
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000338# check for --with-libm=...
339AC_SUBST(LIBM)
340LIBM=-lm
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000341AC_ARG_WITH(libm, [--with-libm=STRING math library], [
342if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000343then LIBM=$withval
344else AC_ERROR(proper usage is --with-libm=STRING)
345fi])
346
347# check for --with-libc=...
348AC_SUBST(LIBC)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000349AC_ARG_WITH(libc, [--with-libc=STRING C library], [
350if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000351then LIBC=$withval
352else AC_ERROR(proper usage is --with-libc=STRING)
353fi])
354
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000355# check for hypot() in math library
356LIBS_SAVE=$LIBS
357LIBS="$LIBS $LIBM"
358AC_CHECK_FUNCS(hypot)
359LIBS=$LIBS_SAVE
360
Guido van Rossum7d473291995-01-20 14:12:16 +0000361# check for getopt
362AC_MSG_CHECKING(for genuine getopt)
363AC_CACHE_VAL(ac_cv_func_getopt,
364[AC_TRY_RUN([#include <stdio.h>
365extern int optind, opterr, getopt();
366extern char* optarg;
367int main() {
368 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
369 opterr = 0;
370 if (getopt(3, av, "f:") == 'f') { exit(1); }
371 exit(0);
372}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
373AC_MSG_RESULT($ac_cv_func_getopt)
374test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
375AC_SUBST(LIBOBJS)dnl
376
Guido van Rossum627b2d71993-12-24 10:39:16 +0000377# generate output files
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000378AC_OUTPUT(Makefile Objects/Makefile Parser/Makefile Python/Makefile Modules/Makefile.pre)