blob: 21ac8906c090c467a50cdba684407383117ad70e [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 Rossum642b6781997-07-19 19:35:41 +00007# Set VERSION so we only need to edit in one place (i.e., here)
8AC_SUBST(VERSION)
9VERSION=1.5
10
Guido van Rossumb418f891996-07-30 18:06:02 +000011# NEXTSTEP stuff
Guido van Rossum4b6b5791996-09-09 20:09:34 +000012if test -f /usr/lib/NextStep/software_version; then
13
14 AC_MSG_CHECKING(for --with-next-archs)
15 AC_ARG_WITH(next-archs,
16 [--with-next-archs='arch1 arch2 ..' build MAB binary], [
17 if test -n "$withval"; then
Guido van Rossum2bb4f551996-09-10 18:19:59 +000018 ac_arch_flags=`/usr/lib/arch_tool -archify_list $withval`
19 # GCC does not currently support multi archs on the NeXT
20 with_gcc=no
Guido van Rossum4b6b5791996-09-09 20:09:34 +000021 fi
22 AC_MSG_RESULT($with_next_archs)
23 ], [AC_MSG_RESULT(none: using `arch`)])
24
25 if test -z "$MACHDEP"
26 then
27 set X `hostinfo | grep 'NeXT Mach.*:' | \
28 sed -e 's/://' -e 's/\./_/'` && \
29 ac_sys_system=next && ac_sys_release=$4
30
31 MACHDEP="$ac_sys_system$ac_sys_release"
Guido van Rossumb418f891996-07-30 18:06:02 +000032 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000033fi
Guido van Rossumb418f891996-07-30 18:06:02 +000034
35# Set name for machine-dependent library files
36AC_SUBST(MACHDEP)
37AC_MSG_CHECKING(MACHDEP)
38if test -z "$MACHDEP"
39then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000040 ac_sys_system=`uname -s`
41 if test "$ac_sys_system" = "AIX" ; then
42 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000043 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000044 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000045 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000046 ac_md_system=`echo $ac_sys_system |
47 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
48 ac_md_release=`echo $ac_sys_release |
49 tr -d '[/ ]' | sed 's/\..*//'`
50 MACHDEP="$ac_md_system$ac_md_release"
51
Guido van Rossumbcd91e01997-03-20 20:46:29 +000052 case $MACHDEP in
Guido van Rossumb418f891996-07-30 18:06:02 +000053 '') MACHDEP=unknown;;
54 esac
55fi
56AC_MSG_RESULT($MACHDEP)
57
Guido van Rossum627b2d71993-12-24 10:39:16 +000058# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000059AC_MSG_CHECKING(for --without-gcc)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000060AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000061 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000062 no) CC=cc
63 without_gcc=yes;;
64 yes) CC=gcc
65 without_gcc=no;;
66 *) CC=$withval
67 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +000068 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +000069 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +000070 OSF1) CC=cc
71 without_gcc=;;
72 *) without_gcc=no;;
73 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +000074AC_MSG_RESULT($without_gcc)
75
Guido van Rossum03ad99f1995-03-09 14:09:54 +000076# If the user switches compilers, we can't believe the cache
77if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
78then
79 AC_ERROR(cached CC is different -- throw away $cache_file
80(it is also a good idea to do 'make clean' before compiling))
81fi
82
Guido van Rossum627b2d71993-12-24 10:39:16 +000083AC_PROG_CC
Guido van Rossumfb842551997-08-06 23:42:07 +000084
85# LINKCC is the command that links the python executable -- default is $(CC).
86# This is altered for AIX in order to build the export list before linking.
87AC_SUBST(LINKCC)
88AC_MSG_CHECKING(LINKCC)
89if test -z "$LINKCC"
90then
91 case $ac_sys_system in
92 AIX*)
93 LINKCC="makexp_aix python.exp \"\" \$(MYLIBS) \$(ADDOBJS); \$(CC)";;
94 *) LINKCC="\$(CC)";;
95 esac
96fi
97AC_MSG_RESULT($LINKCC)
98
Guido van Rossum627b2d71993-12-24 10:39:16 +000099AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000100AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000101AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000102AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +0000103AC_SUBST(INSTALL_PROGRAM)
104AC_SUBST(INSTALL_DATA)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000105# Install just never works :-(
106if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +0000107then
108 INSTALL=cp
109 INSTALL_PROGRAM=cp
110 INSTALL_DATA=cp
111else
112 INSTALL_PROGRAM="$INSTALL"
113 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000114fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000115
Guido van Rossum4e8af441994-08-19 15:33:54 +0000116# Optimizer/debugger flags passed between Makefiles
Guido van Rossumb418f891996-07-30 18:06:02 +0000117AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000118if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000119then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000120 case $GCC in
121 yes)
122 case $ac_cv_prog_cc_g in
123 yes) OPT="-g -O2";;
124 *) OPT="-O2";;
125 esac
126 ;;
Guido van Rossumb418f891996-07-30 18:06:02 +0000127 *) OPT="-O";;
128 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000129fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000130
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000131if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000132then
133 OPT="$OPT $ac_arch_flags"
134fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000135# checks for UNIX variants that set C preprocessor variables
136AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000137AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000138
Guido van Rossum201afe51997-05-14 21:14:44 +0000139AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
140AC_CACHE_VAL(ac_cv_olimit_ok,
141[ac_save_cc="$CC"
142CC="$CC -Olimit 1500"
Guido van Rossum7f059ad1997-05-30 14:22:30 +0000143AC_TRY_RUN([int main() { return 0; }],
Guido van Rossum201afe51997-05-14 21:14:44 +0000144 ac_cv_olimit_ok=yes,
145 ac_cv_olimit_ok=no)
146CC="$ac_save_cc"])
147AC_MSG_RESULT($ac_cv_olimit_ok)
148if test $ac_cv_olimit_ok = yes; then
149 OPT="$OPT -Olimit 1500"
150fi
151
Guido van Rossum300fda71996-08-19 21:58:16 +0000152# check for ANSI or K&R ("traditional") preprocessor
153AC_MSG_CHECKING(for C preprocessor type)
154AC_TRY_COMPILE([
155#define spam(name, doc) {#name, &name, #name "() -- " doc}
156int foo;
157struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
158], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
159AC_MSG_RESULT($cpp_type)
160
Guido van Rossum627b2d71993-12-24 10:39:16 +0000161# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000162AC_HEADER_STDC
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000163AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h ncurses.h pthread.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000164signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000165sys/audioio.h sys/file.h sys/lock.h \
166sys/param.h sys/select.h sys/time.h sys/times.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000167sys/un.h sys/utsname.h sys/wait.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000168AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000169
170# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000171was_it_defined=no
172AC_MSG_CHECKING(for clock_t in time.h)
173AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
174AC_MSG_RESULT($was_it_defined)
175
Guido van Rossum300fda71996-08-19 21:58:16 +0000176# Add some code to confdefs.h so that the test for off_t works on SCO
177cat >> confdefs.h <<\EOF
178#if defined(SCO_DS)
179#undef _OFF_T
180#endif
181EOF
182
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000183AC_TYPE_MODE_T
184AC_TYPE_OFF_T
185AC_TYPE_PID_T
186AC_TYPE_SIGNAL
187AC_TYPE_SIZE_T
188AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000189
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000190AC_CHECK_SIZEOF(int)
191AC_CHECK_SIZEOF(long)
Guido van Rossumac405f61994-09-12 10:56:06 +0000192
193# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000194AC_SUBST(SO)
195AC_SUBST(LDSHARED)
196AC_SUBST(CCSHARED)
197AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000198# SO is the extension of shared libraries `(including the dot!)
199# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000200AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000201if test -z "$SO"
202then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000203 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000204 hp*|HP*) SO=.sl;;
205 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000206 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000207fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000208AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000209# LDSHARED is the ld *command* used to create shared library
210# -- "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 +0000211AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000212if test -z "$LDSHARED"
213then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000214 case $ac_sys_system/$ac_sys_release in
Guido van Rossum300fda71996-08-19 21:58:16 +0000215 AIX*) LDSHARED="ld_so_aix \$(CC)";;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000216 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum7f059ad1997-05-30 14:22:30 +0000217 IRIX*/6*) LDSHARED="ld $SGI_ABI -shared -all"; OPT="$OPT $SGI_ABI";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000218 SunOS/4*) LDSHARED="ld";;
219 SunOS/5*) LDSHARED="ld -G";;
220 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000221 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000222 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000223 next/*) LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000224 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum68242b51996-05-28 22:53:03 +0000225 FreeBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000226 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000227 *) LDSHARED="ld";;
228 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000229fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000230AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000231# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000232# library -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000233AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000234if test -z "$CCSHARED"
235then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000236 case $ac_sys_system/$ac_sys_release in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000237 hp*|HP*) if test "$GCC" = yes;
238 then CCSHARED="-fpic";
239 else CCSHARED="+z";
240 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000241 Linux*) CCSHARED="-fpic";;
Guido van Rossum68242b51996-05-28 22:53:03 +0000242 FreeBSD*) CCSHARED="-fpic";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000243 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Guido van Rossum7f059ad1997-05-30 14:22:30 +0000244 IRIX*/6*) CCSHARED="$SGI_ABI -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000245 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000246fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000247AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000248# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000249# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000250AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000251if test -z "$LINKFORSHARED"
252then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000253 case $ac_sys_system/$ac_sys_release in
Guido van Rossumc5d14a61997-05-13 17:59:29 +0000254 AIX*) LINKFORSHARED='-Wl,-bE:$(srcdir)/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000255 hp*|HP*)
256 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/sharedmodules";;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000257 Linux*) LINKFORSHARED="-rdynamic";;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000258 next) LINKFORSHARED="-u libsys_s";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000259 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Guido van Rossum7f059ad1997-05-30 14:22:30 +0000260 IRIX*/6*) LINKFORSHARED="$SGI_ABI -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000261 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000262fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000263AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000264
Guido van Rossum627b2d71993-12-24 10:39:16 +0000265# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000266AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
267AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
268AC_CHECK_LIB(sun, getpwnam) # NIS (== YP) interface for IRIX 4
Guido van Rossum71001e41995-01-26 00:44:03 +0000269# The following three (nsl,inet,socket) are needed on Sequent;
270# the order of checking must be this. Most SVR4 platforms will
271# need -lsocket and -lnsl. However on SGI IRIX 5, these exist but
272# broken. I see no elegant solution (probably CHECK_LIB should be
273# fixed to only add the library if the given entry point is not
274# satisfied without it).
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000275if test "$ac_sys_system" != IRIX
Guido van Rossum71001e41995-01-26 00:44:03 +0000276then
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000277AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
278AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
279AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Guido van Rossum71001e41995-01-26 00:44:03 +0000280fi
Guido van Rossumc5a39031996-07-31 17:35:03 +0000281AC_MSG_CHECKING(for --with-libs)
282AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [
283AC_MSG_RESULT($withval)
284LIBS="$withval $LIBS"
285], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000286
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000287AC_MSG_CHECKING(for --with(out)-readline)
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000288AC_ARG_WITH(readline,
Guido van Rossum3c7c6781997-08-05 21:47:42 +0000289[--with(out)-readline obsolete, edit Modules/Setup instead],
290[AC_MSG_RESULT($withval)
291AC_ERROR(--with(out)-readline is obsolete, edit Modules/Setup instead)],
292[AC_MSG_RESULT(not specified.)])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000293
Guido van Rossum54d93d41997-01-22 20:51:58 +0000294AC_MSG_CHECKING(for --with-dec-threads)
295AC_SUBST(LDLAST)
296AC_ARG_WITH(dec-threads,
297[--with-dec-threads use DEC Alpha/OSF1 thread-safe libraries],
298[AC_MSG_RESULT($withval)
299LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000300if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000301 with_thread="$withval";
302fi],
303AC_MSG_RESULT(no))
304
305AC_MSG_CHECKING(for --with-threads)
306AC_ARG_WITH(threads, [--with-threads alias for --with-thread],
307[AC_MSG_RESULT($withval)
308if test "${with_thread+set}" != set; then
309 with_thread="$withval";
310fi],
311AC_MSG_RESULT(no))
312
313AC_MSG_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000314AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000315AC_MSG_RESULT($withval)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000316if test -d "$withval"
Guido van Rossum300fda71996-08-19 21:58:16 +0000317then LDFLAGS="$LDFLAGS -L$withval"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000318fi
Guido van Rossum9caf77a1996-08-01 00:52:26 +0000319AC_DEFINE(_REENTRANT)
Guido van Rossumb418f891996-07-30 18:06:02 +0000320AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
321AC_DEFINE(C_THREADS)
322LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000323AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000324AC_DEFINE(_POSIX_THREADS)
325LIBS="$LIBS -lpthreads"
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000326LIBOBJS="$LIBOBJS thread.o"], [
327AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
328AC_DEFINE(_POSIX_THREADS)
329LIBS="$LIBS -lpthread"
Guido van Rossum6400c261997-05-22 20:34:27 +0000330LIBOBJS="$LIBOBJS thread.o"], [
331AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
332AC_DEFINE(_POSIX_THREADS)
333LIBS="$LIBS -lthread"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000334LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum6400c261997-05-22 20:34:27 +0000335])])])
336
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000337AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000338LIBS="$LIBS -lmpc"
339LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000340AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000341LIBS="$LIBS -lthread"
342LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000343], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000344
Guido van Rossum68242b51996-05-28 22:53:03 +0000345# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000346AC_SUBST(DLINCLDIR)
347DLINCLDIR=/
348
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000349AC_MSG_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000350AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000351AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000352AC_DEFINE(WITH_SGI_DL)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000353dldir=$withval
354if test -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000355then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000356else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
357fi
358DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000359LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000360
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000361AC_MSG_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000362AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000363AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000364AC_DEFINE(WITH_DL_DLD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000365dldir=`echo "$withval" | sed 's/,.*//'`
366dlddir=`echo "$withval" | sed 's/.*,//'`
367if test -d "$dldir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000368then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000369else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
370fi
371DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000372LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000373
374# checks for library functions
Guido van Rossum93cfa951997-05-22 20:12:34 +0000375AC_CHECK_FUNCS(chown clock dlopen execv flock fork ftime ftruncate \
Guido van Rossum68242b51996-05-28 22:53:03 +0000376 gethostname_r getpeername getpgrp getpid gettimeofday getwd \
Guido van Rossum93cfa951997-05-22 20:12:34 +0000377 kill link lstat mkfifo nice plock putenv readlink \
Guido van Rossum68242b51996-05-28 22:53:03 +0000378 select setgid setuid setsid setpgid setpgrp setvbuf \
379 sigaction siginterrupt sigrelse strftime symlink \
Guido van Rossumb418f891996-07-30 18:06:02 +0000380 tcgetpgrp tcsetpgrp times truncate uname waitpid)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000381AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000382AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
383AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
384AC_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 +0000385
386# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000387AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000388AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000389AC_STRUCT_TIMEZONE
390
391AC_MSG_CHECKING(for time.h that defines altzone)
392AC_CACHE_VAL(ac_cv_header_time_altzone,
393[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
394 ac_cv_header_time_altzone=yes,
395 ac_cv_header_time_altzone=no)])
396AC_MSG_RESULT($ac_cv_header_time_altzone)
397if test $ac_cv_header_time_altzone = yes; then
398 AC_DEFINE(HAVE_ALTZONE)
399fi
400
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000401was_it_defined=no
402AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000403AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000404#include <sys/types.h>
405#include <sys/select.h>
406#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000407], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
408AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000409
410# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000411
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000412AC_C_CHAR_UNSIGNED
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000413
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000414AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000415
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000416works=no
417AC_MSG_CHECKING(for working volatile)
418AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
419AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000420
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000421works=no
422AC_MSG_CHECKING(for working signed char)
423AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
424AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000425
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000426have_prototypes=no
427AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000428AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
429AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000430AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000431
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000432works=no
433AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000434AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000435#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +0000436int foo(int x, ...) {
437 va_list va;
438 va_start(va, x);
439 va_arg(va, int);
440 va_arg(va, char *);
441 va_arg(va, double);
442 return 0;
443}
444], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000445AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
446AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000447
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000448if test "$have_prototypes" = yes; then
449bad_prototypes=no
450AC_MSG_CHECKING(for bad exec* prototypes)
451AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
452 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
453AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000454fi
455
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000456bad_forward=no
457AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000458AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000459struct s { int a; int b; };
460static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000461int foobar() {
462 static int random;
463 random = (int) &foo;
464 return random;
465}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000466static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000467main() {
468 exit(!((int)&foo == foobar()));
469}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000470], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
471AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000472
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000473va_list_is_array=no
474AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000475AC_TRY_COMPILE([
476#ifdef HAVE_STDARG_PROTOTYPES
477#include <stdarg.h>
478#else
479#include <varargs.h>
480#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000481], [va_list list1, list2; list1 = list2;], ,
482AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
483AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000484
Guido van Rossum627b2d71993-12-24 10:39:16 +0000485# checks for system services
486# (none yet)
487
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000488# Linux requires this for correct f.p. operations
489AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000490
Guido van Rossum93274221997-05-09 02:42:00 +0000491# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +0000492AC_MSG_CHECKING(for --with-fpectl)
493AC_ARG_WITH(fpectl, [--with-fpectl enable SIGFPE catching], [
494if test "$withval" != no
495then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
496else AC_MSG_RESULT(no)
497fi])
498
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000499# check for --with-libm=...
500AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000501case $ac_sys_system in
502next) ;;
503*) LIBM=-lm
504esac
Guido van Rossum93274221997-05-09 02:42:00 +0000505AC_MSG_CHECKING(for --with-libm=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000506AC_ARG_WITH(libm, [--with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000507if test "$withval" = no
508then LIBM=
509 AC_MSG_RESULT(force LIBM empty)
510elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000511then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000512 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000513else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000514fi],
515[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000516
517# check for --with-libc=...
518AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +0000519AC_MSG_CHECKING(for --with-libc=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000520AC_ARG_WITH(libc, [--with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000521if test "$withval" = no
522then LIBC=
523 AC_MSG_RESULT(force LIBC empty)
524elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000525then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000526 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000527else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000528fi],
529[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000530
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000531# check for hypot() in math library
532LIBS_SAVE=$LIBS
533LIBS="$LIBS $LIBM"
534AC_CHECK_FUNCS(hypot)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000535AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000536LIBS=$LIBS_SAVE
537
Guido van Rossum7d473291995-01-20 14:12:16 +0000538# check for getopt
539AC_MSG_CHECKING(for genuine getopt)
540AC_CACHE_VAL(ac_cv_func_getopt,
541[AC_TRY_RUN([#include <stdio.h>
542extern int optind, opterr, getopt();
543extern char* optarg;
544int main() {
545 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
546 opterr = 0;
547 if (getopt(3, av, "f:") == 'f') { exit(1); }
548 exit(0);
549}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
550AC_MSG_RESULT($ac_cv_func_getopt)
551test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
552AC_SUBST(LIBOBJS)dnl
553
Guido van Rossumad713701997-07-10 22:42:38 +0000554# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +0000555AC_MSG_CHECKING(what malloc(0) returns)
556AC_CACHE_VAL(ac_cv_malloc_zero,
557[AC_TRY_RUN([#include <stdio.h>
558#ifdef HAVE_STDLIB
559#include <stdlib.h>
560#else
561char *malloc(), *realloc();
562int *free();
563#endif
564main() {
565 char *p;
566 p = malloc(0);
567 if (p == NULL) exit(1);
568 p = realloc(p, 0);
569 if (p == NULL) exit(1);
570 free(p);
571 exit(0);
572}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
573AC_MSG_RESULT($ac_cv_malloc_zero)
574if test "$ac_cv_malloc_zero" = null
575then
576 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
577fi
578
Guido van Rossum627b2d71993-12-24 10:39:16 +0000579# generate output files
Guido van Rossumb418f891996-07-30 18:06:02 +0000580AC_OUTPUT(Makefile \
581 Objects/Makefile \
582 Parser/Makefile \
583 Python/Makefile \
584 Modules/Makefile.pre)