blob: d6eba15ef1b138e5d979fc449ce7e53fa34b8787 [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
Guido van Rossumb97ef171997-09-28 05:44:03 +000031 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
Guido van Rossum91922671997-10-09 20:24:13 +000035
Guido van Rossumb418f891996-07-30 18:06:02 +000036# Set name for machine-dependent library files
37AC_SUBST(MACHDEP)
38AC_MSG_CHECKING(MACHDEP)
39if test -z "$MACHDEP"
40then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000041 ac_sys_system=`uname -s`
42 if test "$ac_sys_system" = "AIX" ; then
43 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000044 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000045 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000046 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000047 ac_md_system=`echo $ac_sys_system |
48 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
49 ac_md_release=`echo $ac_sys_release |
50 tr -d '[/ ]' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000051 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000052
Guido van Rossumbcd91e01997-03-20 20:46:29 +000053 case $MACHDEP in
Guido van Rossumb97ef171997-09-28 05:44:03 +000054 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000055 esac
56fi
Guido van Rossum91922671997-10-09 20:24:13 +000057
58#
59# SGI compilers allow the specification of the both the ABI and the
60# ISA on the command line. Depending on the values of these switches,
61# different and often incompatable code will be generated.
62#
63# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
64# thus supply support for various ABI/ISA combinations. The MACHDEP
65# variable is also adjusted.
66#
67AC_SUBST(SGI_ABI)
68if test ! -z "$SGI_ABI"
69then
70 CC="cc $SGI_ABI"
71 LDFLAGS="$SGI_ABI $LDFLAGS"
72 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
73fi
Guido van Rossumb418f891996-07-30 18:06:02 +000074AC_MSG_RESULT($MACHDEP)
75
Guido van Rossum91922671997-10-09 20:24:13 +000076#
77# CCC is the command that compiles C++ programs
78#
79# Not all make programs have this predefined.
80#
81AC_SUBST(SET_CCC)
82AC_MSG_CHECKING(CCC)
83if test -z "$CCC"
84then
85 case $ac_sys_system in
86 IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";;
Guido van Rossumfb4533c1998-10-02 14:39:42 +000087 Linux*) SET_CCC="CCC= g++";;
Guido van Rossum91922671997-10-09 20:24:13 +000088 *) SET_CCC=""
89 esac
90else
91 SET_CCC="CCC= ${CCC}"
92fi
93AC_MSG_RESULT($SET_CCC)
94
95
Guido van Rossum627b2d71993-12-24 10:39:16 +000096# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000097AC_MSG_CHECKING(for --without-gcc)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000098AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000099 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000100 no) CC=cc
101 without_gcc=yes;;
102 yes) CC=gcc
103 without_gcc=no;;
104 *) CC=$withval
105 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000106 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000107 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +0000108 OSF1) CC=cc
109 without_gcc=;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000110 BeOS*) CC=cc
111 without_gcc=;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000112 *) without_gcc=no;;
113 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000114AC_MSG_RESULT($without_gcc)
115
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000116# If the user switches compilers, we can't believe the cache
117if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
118then
119 AC_ERROR(cached CC is different -- throw away $cache_file
120(it is also a good idea to do 'make clean' before compiling))
121fi
122
Guido van Rossum627b2d71993-12-24 10:39:16 +0000123AC_PROG_CC
Guido van Rossumfb842551997-08-06 23:42:07 +0000124
Guido van Rossum84561611997-08-21 00:08:11 +0000125case $ac_sys_system in
126hp*|HP*)
127 case $CC in
128 cc|*/cc) CC="$CC -Aa -D_HPUX_SOURCE";;
129 esac;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000130BeOS*)
131 case $CC in
132 cc) CC=cc;;
133 esac;;
Guido van Rossum84561611997-08-21 00:08:11 +0000134esac
135
Guido van Rossumfb842551997-08-06 23:42:07 +0000136# LINKCC is the command that links the python executable -- default is $(CC).
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000137# This is altered for AIX and BeOS in order to build the export list before
138# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000139AC_SUBST(LINKCC)
140AC_MSG_CHECKING(LINKCC)
141if test -z "$LINKCC"
142then
143 case $ac_sys_system in
144 AIX*)
Guido van Rossum45140f91997-08-29 18:44:06 +0000145 LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000146 BeOS*)
147 LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) -nodup \$(OPT)"
148 REALLIBRARY='libpython$(VERSION).so';;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000149 dgux*)
150 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000151 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000152 esac
153fi
154AC_MSG_RESULT($LINKCC)
155
Guido van Rossum627b2d71993-12-24 10:39:16 +0000156AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000157AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000158AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000159AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +0000160AC_SUBST(INSTALL_PROGRAM)
161AC_SUBST(INSTALL_DATA)
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000162AC_SUBST(REALLIBRARY)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000163# Install just never works :-(
164if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +0000165then
166 INSTALL=cp
167 INSTALL_PROGRAM=cp
168 INSTALL_DATA=cp
169else
170 INSTALL_PROGRAM="$INSTALL"
171 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000172fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000173
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000174# Not every filesystem supports hard links
175AC_SUBST(LN)
176if test -z "$LN" ; then
177 case $ac_sys_system in
178 BeOS*) LN="ln -s";;
179 *) LN=ln;;
180 esac
181fi
182
Guido van Rossum4e8af441994-08-19 15:33:54 +0000183# Optimizer/debugger flags passed between Makefiles
Guido van Rossumb418f891996-07-30 18:06:02 +0000184AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000185if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000186then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000187 case $GCC in
188 yes)
189 case $ac_cv_prog_cc_g in
190 yes) OPT="-g -O2";;
191 *) OPT="-O2";;
192 esac
193 ;;
Guido van Rossumb418f891996-07-30 18:06:02 +0000194 *) OPT="-O";;
195 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000196fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000197
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000198if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000199then
200 OPT="$OPT $ac_arch_flags"
201fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000202# checks for UNIX variants that set C preprocessor variables
203AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000204AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000205
Guido van Rossum91922671997-10-09 20:24:13 +0000206AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
207AC_CACHE_VAL(ac_cv_opt_olimit_ok,
208[ac_save_cc="$CC"
209CC="$CC -OPT:Olimit=0"
210AC_TRY_RUN([int main() { return 0; }],
211 ac_cv_opt_olimit_ok=yes,
212 ac_cv_opt_olimit_ok=no)
213CC="$ac_save_cc"])
214AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000215if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000216 OPT="$OPT -OPT:Olimit=0"
Guido van Rossumf8678121998-07-07 21:05:09 +0000217else
218 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
219 AC_CACHE_VAL(ac_cv_olimit_ok,
220 [ac_save_cc="$CC"
221 CC="$CC -Olimit 1500"
222 AC_TRY_RUN([int main() { return 0; }],
223 ac_cv_olimit_ok=yes,
224 ac_cv_olimit_ok=no)
225 CC="$ac_save_cc"])
226 AC_MSG_RESULT($ac_cv_olimit_ok)
227 if test $ac_cv_olimit_ok = yes; then
228 OPT="$OPT -Olimit 1500"
229 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000230fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000231
232AC_SUBST(DGUX_IS_BROKEN)
233if test "$MACHDEP" != "dguxR4"
234then
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000235 REALLIBRARY='libpython$(VERSION).a'
Guido van Rossum35742851998-02-19 21:32:40 +0000236 DGUX_IS_BROKEN="true"
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000237else
238 REALLIBRARY='libpython$(VERSION).so'
239 OPT="$OPT -pic"
Guido van Rossum35742851998-02-19 21:32:40 +0000240 DGUX_IS_BROKEN="make $REALLIBRARY"
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000241fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000242
Guido van Rossum300fda71996-08-19 21:58:16 +0000243# check for ANSI or K&R ("traditional") preprocessor
244AC_MSG_CHECKING(for C preprocessor type)
245AC_TRY_COMPILE([
246#define spam(name, doc) {#name, &name, #name "() -- " doc}
247int foo;
248struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
249], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
250AC_MSG_RESULT($cpp_type)
251
Guido van Rossum627b2d71993-12-24 10:39:16 +0000252# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000253AC_HEADER_STDC
Guido van Rossum96013151997-10-08 22:47:52 +0000254AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h pthread.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000255signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000256sys/audioio.h sys/file.h sys/lock.h \
257sys/param.h sys/select.h sys/time.h sys/times.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000258sys/un.h sys/utsname.h sys/wait.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000259AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000260
261# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000262was_it_defined=no
263AC_MSG_CHECKING(for clock_t in time.h)
264AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
265AC_MSG_RESULT($was_it_defined)
266
Guido van Rossum300fda71996-08-19 21:58:16 +0000267# Add some code to confdefs.h so that the test for off_t works on SCO
268cat >> confdefs.h <<\EOF
269#if defined(SCO_DS)
270#undef _OFF_T
271#endif
272EOF
273
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000274AC_TYPE_MODE_T
275AC_TYPE_OFF_T
276AC_TYPE_PID_T
277AC_TYPE_SIGNAL
278AC_TYPE_SIZE_T
279AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000280
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000281AC_CHECK_SIZEOF(int)
282AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000283AC_CHECK_SIZEOF(void *)
Guido van Rossumac405f61994-09-12 10:56:06 +0000284
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000285AC_MSG_CHECKING(for long long support)
286have_long_long=no
287AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
288AC_MSG_RESULT($have_long_long)
289if test $have_long_long = yes ; then
290AC_CHECK_SIZEOF(long long)
291fi
292
Guido van Rossumac405f61994-09-12 10:56:06 +0000293# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000294AC_SUBST(SO)
295AC_SUBST(LDSHARED)
296AC_SUBST(CCSHARED)
297AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000298# SO is the extension of shared libraries `(including the dot!)
299# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000300AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000301if test -z "$SO"
302then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000303 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000304 hp*|HP*) SO=.sl;;
305 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000306 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000307fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000308AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000309# LDSHARED is the ld *command* used to create shared library
310# -- "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 +0000311AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000312if test -z "$LDSHARED"
313then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000314 case $ac_sys_system/$ac_sys_release in
Guido van Rossum45140f91997-08-29 18:44:06 +0000315 AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000316 BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000317 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000318 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000319 SunOS/4*) LDSHARED="ld";;
320 SunOS/5*) LDSHARED="ld -G";;
321 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000322 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000323 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000324 next/*) LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000325 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000326 dgux*) LDSHARED="ld -G";;
Guido van Rossum1f740161998-04-13 15:27:21 +0000327 FreeBSD*|NetBSD*|OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000328 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000329 *) LDSHARED="ld";;
330 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000331fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000332AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000333# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000334# library -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000335AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000336if test -z "$CCSHARED"
337then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000338 case $ac_sys_system/$ac_sys_release in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000339 hp*|HP*) if test "$GCC" = yes;
340 then CCSHARED="-fpic";
341 else CCSHARED="+z";
342 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000343 Linux*) CCSHARED="-fpic";;
Guido van Rossum1f740161998-04-13 15:27:21 +0000344 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fpic";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000345 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000346 IRIX*/6*) case $CC in
347 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000348 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000349 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000350 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000351fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000352AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000353# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000354# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000355AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000356if test -z "$LINKFORSHARED"
357then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000358 case $ac_sys_system/$ac_sys_release in
Guido van Rossum69f65801998-03-03 21:47:00 +0000359 AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000360 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000361 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000362 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum79c970c1997-08-16 14:35:26 +0000363 next/*) LINKFORSHARED="-u libsys_s";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000364 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000365 SunOS/5*) case $CC in
366 *gcc*)
367 if $CC -Xlinker -V 2>/dev/null | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000368 then
369 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000370 fi;;
371 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000372 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000373fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000374AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000375
Guido van Rossum627b2d71993-12-24 10:39:16 +0000376# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000377AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
378AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum2cb56601998-05-07 13:25:56 +0000379AC_CHECK_LIB(m, pow) # Std math lib -- assume needed if it exists
Guido van Rossum70c7f481998-03-26 18:44:10 +0000380# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
381# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000382# BeOS' sockets are stashed in libnet.
383case "$ac_sys_system" in
384IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000385*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000386AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000387AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000388AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
389;;
390esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000391
Guido van Rossumc5a39031996-07-31 17:35:03 +0000392AC_MSG_CHECKING(for --with-libs)
393AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [
394AC_MSG_RESULT($withval)
395LIBS="$withval $LIBS"
396], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000397
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000398AC_MSG_CHECKING(for --with(out)-readline)
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000399AC_ARG_WITH(readline,
Guido van Rossum3c7c6781997-08-05 21:47:42 +0000400[--with(out)-readline obsolete, edit Modules/Setup instead],
401[AC_MSG_RESULT($withval)
402AC_ERROR(--with(out)-readline is obsolete, edit Modules/Setup instead)],
403[AC_MSG_RESULT(not specified.)])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000404
Guido van Rossum009f7871997-12-04 00:51:42 +0000405AC_SUBST(USE_THREAD_MODULE)
406USE_THREAD_MODULE="#"
407
Guido van Rossum54d93d41997-01-22 20:51:58 +0000408AC_MSG_CHECKING(for --with-dec-threads)
409AC_SUBST(LDLAST)
410AC_ARG_WITH(dec-threads,
411[--with-dec-threads use DEC Alpha/OSF1 thread-safe libraries],
412[AC_MSG_RESULT($withval)
413LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000414if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000415 with_thread="$withval";
416fi],
417AC_MSG_RESULT(no))
418
419AC_MSG_CHECKING(for --with-threads)
420AC_ARG_WITH(threads, [--with-threads alias for --with-thread],
421[AC_MSG_RESULT($withval)
422if test "${with_thread+set}" != set; then
423 with_thread="$withval";
424fi],
425AC_MSG_RESULT(no))
426
427AC_MSG_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000428AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum009f7871997-12-04 00:51:42 +0000429USE_THREAD_MODULE=
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000430AC_MSG_RESULT($withval)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000431if test -d "$withval"
Guido van Rossum300fda71996-08-19 21:58:16 +0000432then LDFLAGS="$LDFLAGS -L$withval"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000433fi
Guido van Rossum9caf77a1996-08-01 00:52:26 +0000434AC_DEFINE(_REENTRANT)
Guido van Rossumb418f891996-07-30 18:06:02 +0000435AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
436AC_DEFINE(C_THREADS)
437LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000438AC_CHECK_FUNC(pthread_create, [AC_DEFINE(WITH_THREAD)
439AC_DEFINE(_POSIX_THREADS)
440LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000441AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
442AC_DEFINE(BEOS_THREADS)
443LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000444AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000445AC_DEFINE(_POSIX_THREADS)
446LIBS="$LIBS -lpthreads"
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000447LIBOBJS="$LIBOBJS thread.o"], [
448AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
449AC_DEFINE(_POSIX_THREADS)
450LIBS="$LIBS -lpthread"
Guido van Rossum6400c261997-05-22 20:34:27 +0000451LIBOBJS="$LIBOBJS thread.o"], [
Guido van Rossum49545951997-12-02 19:28:29 +0000452AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
453AC_DEFINE(_POSIX_THREADS)
454LIBS="$LIBS -lc_r"
455LIBOBJS="$LIBOBJS thread.o"], [
Guido van Rossum6400c261997-05-22 20:34:27 +0000456AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
457AC_DEFINE(_POSIX_THREADS)
458LIBS="$LIBS -lthread"
Guido van Rossumb93a8621998-05-07 13:27:32 +0000459LIBOBJS="$LIBOBJS thread.o"], [
460AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
461AC_DEFINE(_POSIX_THREADS)
462LIBS="$LIBS -lcma"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000463LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000464])])])])])])])
Guido van Rossum6400c261997-05-22 20:34:27 +0000465
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000466AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000467LIBS="$LIBS -lmpc"
468LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000469AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000470LIBS="$LIBS -lthread"
471LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000472], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000473
Guido van Rossum68242b51996-05-28 22:53:03 +0000474# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000475AC_SUBST(DLINCLDIR)
476DLINCLDIR=/
477
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000478AC_MSG_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000479AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000480AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000481AC_DEFINE(WITH_SGI_DL)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000482dldir=$withval
483if test -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000484then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000485else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
486fi
487DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000488LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000489
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000490AC_MSG_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000491AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000492AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000493AC_DEFINE(WITH_DL_DLD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000494dldir=`echo "$withval" | sed 's/,.*//'`
495dlddir=`echo "$withval" | sed 's/.*,//'`
496if test -d "$dldir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000497then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000498else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
499fi
500DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000501LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000502
503# checks for library functions
Guido van Rossum1171ee61997-08-22 20:42:00 +0000504AC_CHECK_FUNCS(alarm chown clock dlopen execv flock fork ftime ftruncate \
505 gethostname_r getpeername getpgrp getpid getpwent gettimeofday getwd \
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000506 kill link lstat mkfifo mktime nice pause plock pthread_init putenv readlink \
Guido van Rossum96013151997-10-08 22:47:52 +0000507 select setgid setlocale setuid setsid setpgid setpgrp setvbuf \
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000508 sigaction siginterrupt sigrelse strftime strptime symlink \
Guido van Rossum08d6be41998-06-11 15:19:05 +0000509 tcgetpgrp tcsetpgrp timegm times truncate uname waitpid)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000510AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000511AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
512AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
513AC_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 +0000514
515# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000516AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000517AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000518AC_STRUCT_TIMEZONE
519
520AC_MSG_CHECKING(for time.h that defines altzone)
521AC_CACHE_VAL(ac_cv_header_time_altzone,
522[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
523 ac_cv_header_time_altzone=yes,
524 ac_cv_header_time_altzone=no)])
525AC_MSG_RESULT($ac_cv_header_time_altzone)
526if test $ac_cv_header_time_altzone = yes; then
527 AC_DEFINE(HAVE_ALTZONE)
528fi
529
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000530was_it_defined=no
531AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000532AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000533#include <sys/types.h>
534#include <sys/select.h>
535#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000536], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
537AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000538
539# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000540
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000541AC_C_CHAR_UNSIGNED
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000542
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000543AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000544
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000545works=no
546AC_MSG_CHECKING(for working volatile)
547AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
548AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000549
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000550works=no
551AC_MSG_CHECKING(for working signed char)
552AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
553AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000554
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000555have_prototypes=no
556AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000557AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
558AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000559AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000560
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000561works=no
562AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000563AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000564#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +0000565int foo(int x, ...) {
566 va_list va;
567 va_start(va, x);
568 va_arg(va, int);
569 va_arg(va, char *);
570 va_arg(va, double);
571 return 0;
572}
573], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000574AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
575AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000576
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000577if test "$have_prototypes" = yes; then
578bad_prototypes=no
579AC_MSG_CHECKING(for bad exec* prototypes)
580AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
581 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
582AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000583fi
584
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000585bad_forward=no
586AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000587AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000588struct s { int a; int b; };
589static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000590int foobar() {
591 static int random;
592 random = (int) &foo;
593 return random;
594}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000595static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000596main() {
597 exit(!((int)&foo == foobar()));
598}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000599], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
600AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000601
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000602va_list_is_array=no
603AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000604AC_TRY_COMPILE([
605#ifdef HAVE_STDARG_PROTOTYPES
606#include <stdarg.h>
607#else
608#include <varargs.h>
609#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000610], [va_list list1, list2; list1 = list2;], ,
611AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
612AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000613
Guido van Rossum627b2d71993-12-24 10:39:16 +0000614# checks for system services
615# (none yet)
616
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000617# Linux requires this for correct f.p. operations
618AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000619
Guido van Rossum93274221997-05-09 02:42:00 +0000620# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +0000621AC_MSG_CHECKING(for --with-fpectl)
622AC_ARG_WITH(fpectl, [--with-fpectl enable SIGFPE catching], [
623if test "$withval" != no
624then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
625else AC_MSG_RESULT(no)
626fi])
627
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000628# check for --with-libm=...
629AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000630case $ac_sys_system in
631next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000632BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000633*) LIBM=-lm
634esac
Guido van Rossum93274221997-05-09 02:42:00 +0000635AC_MSG_CHECKING(for --with-libm=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000636AC_ARG_WITH(libm, [--with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000637if test "$withval" = no
638then LIBM=
639 AC_MSG_RESULT(force LIBM empty)
640elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000641then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000642 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000643else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000644fi],
645[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000646
647# check for --with-libc=...
648AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +0000649AC_MSG_CHECKING(for --with-libc=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000650AC_ARG_WITH(libc, [--with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000651if test "$withval" = no
652then LIBC=
653 AC_MSG_RESULT(force LIBC empty)
654elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000655then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000656 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000657else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000658fi],
659[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000660
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000661# check for hypot() in math library
662LIBS_SAVE=$LIBS
663LIBS="$LIBS $LIBM"
664AC_CHECK_FUNCS(hypot)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000665AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000666LIBS=$LIBS_SAVE
667
Guido van Rossum7d473291995-01-20 14:12:16 +0000668# check for getopt
669AC_MSG_CHECKING(for genuine getopt)
670AC_CACHE_VAL(ac_cv_func_getopt,
671[AC_TRY_RUN([#include <stdio.h>
672extern int optind, opterr, getopt();
673extern char* optarg;
674int main() {
675 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
676 opterr = 0;
677 if (getopt(3, av, "f:") == 'f') { exit(1); }
678 exit(0);
679}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
680AC_MSG_RESULT($ac_cv_func_getopt)
681test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
682AC_SUBST(LIBOBJS)dnl
683
Guido van Rossumad713701997-07-10 22:42:38 +0000684# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +0000685AC_MSG_CHECKING(what malloc(0) returns)
686AC_CACHE_VAL(ac_cv_malloc_zero,
687[AC_TRY_RUN([#include <stdio.h>
688#ifdef HAVE_STDLIB
689#include <stdlib.h>
690#else
691char *malloc(), *realloc();
692int *free();
693#endif
694main() {
695 char *p;
696 p = malloc(0);
697 if (p == NULL) exit(1);
698 p = realloc(p, 0);
699 if (p == NULL) exit(1);
700 free(p);
701 exit(0);
702}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
703AC_MSG_RESULT($ac_cv_malloc_zero)
704if test "$ac_cv_malloc_zero" = null
705then
706 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
707fi
708
Guido van Rossum627b2d71993-12-24 10:39:16 +0000709# generate output files
Guido van Rossumb418f891996-07-30 18:06:02 +0000710AC_OUTPUT(Makefile \
711 Objects/Makefile \
712 Parser/Makefile \
713 Python/Makefile \
Guido van Rossum009f7871997-12-04 00:51:42 +0000714 Modules/Makefile.pre \
715 Modules/Setup.thread)