blob: 36f38be7a26e831f880dce9f339f7b42b7852fae [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}";;
87 *) SET_CCC=""
88 esac
89else
90 SET_CCC="CCC= ${CCC}"
91fi
92AC_MSG_RESULT($SET_CCC)
93
94
Guido van Rossum627b2d71993-12-24 10:39:16 +000095# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000096AC_MSG_CHECKING(for --without-gcc)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000097AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000098 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000099 no) CC=cc
100 without_gcc=yes;;
101 yes) CC=gcc
102 without_gcc=no;;
103 *) CC=$withval
104 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000105 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000106 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +0000107 OSF1) CC=cc
108 without_gcc=;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000109 BeOS*) CC=cc
110 without_gcc=;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000111 *) without_gcc=no;;
112 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000113AC_MSG_RESULT($without_gcc)
114
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000115# If the user switches compilers, we can't believe the cache
116if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
117then
118 AC_ERROR(cached CC is different -- throw away $cache_file
119(it is also a good idea to do 'make clean' before compiling))
120fi
121
Guido van Rossum627b2d71993-12-24 10:39:16 +0000122AC_PROG_CC
Guido van Rossumfb842551997-08-06 23:42:07 +0000123
Guido van Rossum84561611997-08-21 00:08:11 +0000124case $ac_sys_system in
125hp*|HP*)
126 case $CC in
127 cc|*/cc) CC="$CC -Aa -D_HPUX_SOURCE";;
128 esac;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000129BeOS*)
130 case $CC in
131 cc) CC=cc;;
132 esac;;
Guido van Rossum84561611997-08-21 00:08:11 +0000133esac
134
Guido van Rossumfb842551997-08-06 23:42:07 +0000135# LINKCC is the command that links the python executable -- default is $(CC).
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000136# This is altered for AIX and BeOS in order to build the export list before
137# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000138AC_SUBST(LINKCC)
139AC_MSG_CHECKING(LINKCC)
140if test -z "$LINKCC"
141then
142 case $ac_sys_system in
143 AIX*)
Guido van Rossum45140f91997-08-29 18:44:06 +0000144 LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000145 BeOS*)
146 LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) -nodup \$(OPT)"
147 REALLIBRARY='libpython$(VERSION).so';;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000148 dgux*)
149 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000150 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000151 esac
152fi
153AC_MSG_RESULT($LINKCC)
154
Guido van Rossum627b2d71993-12-24 10:39:16 +0000155AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000156AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000157AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000158AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +0000159AC_SUBST(INSTALL_PROGRAM)
160AC_SUBST(INSTALL_DATA)
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000161AC_SUBST(REALLIBRARY)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000162# Install just never works :-(
163if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +0000164then
165 INSTALL=cp
166 INSTALL_PROGRAM=cp
167 INSTALL_DATA=cp
168else
169 INSTALL_PROGRAM="$INSTALL"
170 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000171fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000172
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000173# Not every filesystem supports hard links
174AC_SUBST(LN)
175if test -z "$LN" ; then
176 case $ac_sys_system in
177 BeOS*) LN="ln -s";;
178 *) LN=ln;;
179 esac
180fi
181
Guido van Rossum4e8af441994-08-19 15:33:54 +0000182# Optimizer/debugger flags passed between Makefiles
Guido van Rossumb418f891996-07-30 18:06:02 +0000183AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000184if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000185then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000186 case $GCC in
187 yes)
188 case $ac_cv_prog_cc_g in
189 yes) OPT="-g -O2";;
190 *) OPT="-O2";;
191 esac
192 ;;
Guido van Rossumb418f891996-07-30 18:06:02 +0000193 *) OPT="-O";;
194 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000195fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000196
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000197if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000198then
199 OPT="$OPT $ac_arch_flags"
200fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000201# checks for UNIX variants that set C preprocessor variables
202AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000203AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000204
Guido van Rossum91922671997-10-09 20:24:13 +0000205AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
206AC_CACHE_VAL(ac_cv_opt_olimit_ok,
207[ac_save_cc="$CC"
208CC="$CC -OPT:Olimit=0"
209AC_TRY_RUN([int main() { return 0; }],
210 ac_cv_opt_olimit_ok=yes,
211 ac_cv_opt_olimit_ok=no)
212CC="$ac_save_cc"])
213AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000214if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000215 OPT="$OPT -OPT:Olimit=0"
Guido van Rossumf8678121998-07-07 21:05:09 +0000216else
217 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
218 AC_CACHE_VAL(ac_cv_olimit_ok,
219 [ac_save_cc="$CC"
220 CC="$CC -Olimit 1500"
221 AC_TRY_RUN([int main() { return 0; }],
222 ac_cv_olimit_ok=yes,
223 ac_cv_olimit_ok=no)
224 CC="$ac_save_cc"])
225 AC_MSG_RESULT($ac_cv_olimit_ok)
226 if test $ac_cv_olimit_ok = yes; then
227 OPT="$OPT -Olimit 1500"
228 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000229fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000230
231AC_SUBST(DGUX_IS_BROKEN)
232if test "$MACHDEP" != "dguxR4"
233then
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000234 REALLIBRARY='libpython$(VERSION).a'
Guido van Rossum35742851998-02-19 21:32:40 +0000235 DGUX_IS_BROKEN="true"
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000236else
237 REALLIBRARY='libpython$(VERSION).so'
238 OPT="$OPT -pic"
Guido van Rossum35742851998-02-19 21:32:40 +0000239 DGUX_IS_BROKEN="make $REALLIBRARY"
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000240fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000241
Guido van Rossum300fda71996-08-19 21:58:16 +0000242# check for ANSI or K&R ("traditional") preprocessor
243AC_MSG_CHECKING(for C preprocessor type)
244AC_TRY_COMPILE([
245#define spam(name, doc) {#name, &name, #name "() -- " doc}
246int foo;
247struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
248], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
249AC_MSG_RESULT($cpp_type)
250
Guido van Rossum627b2d71993-12-24 10:39:16 +0000251# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000252AC_HEADER_STDC
Guido van Rossum96013151997-10-08 22:47:52 +0000253AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h pthread.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000254signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000255sys/audioio.h sys/file.h sys/lock.h \
256sys/param.h sys/select.h sys/time.h sys/times.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000257sys/un.h sys/utsname.h sys/wait.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000258AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000259
260# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000261was_it_defined=no
262AC_MSG_CHECKING(for clock_t in time.h)
263AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
264AC_MSG_RESULT($was_it_defined)
265
Guido van Rossum300fda71996-08-19 21:58:16 +0000266# Add some code to confdefs.h so that the test for off_t works on SCO
267cat >> confdefs.h <<\EOF
268#if defined(SCO_DS)
269#undef _OFF_T
270#endif
271EOF
272
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000273AC_TYPE_MODE_T
274AC_TYPE_OFF_T
275AC_TYPE_PID_T
276AC_TYPE_SIGNAL
277AC_TYPE_SIZE_T
278AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000279
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000280AC_CHECK_SIZEOF(int)
281AC_CHECK_SIZEOF(long)
Guido van Rossumac405f61994-09-12 10:56:06 +0000282
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000283AC_MSG_CHECKING(for long long support)
284have_long_long=no
285AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
286AC_MSG_RESULT($have_long_long)
287if test $have_long_long = yes ; then
288AC_CHECK_SIZEOF(long long)
289fi
290
Guido van Rossumac405f61994-09-12 10:56:06 +0000291# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000292AC_SUBST(SO)
293AC_SUBST(LDSHARED)
294AC_SUBST(CCSHARED)
295AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000296# SO is the extension of shared libraries `(including the dot!)
297# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000298AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000299if test -z "$SO"
300then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000301 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000302 hp*|HP*) SO=.sl;;
303 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000304 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000305fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000306AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000307# LDSHARED is the ld *command* used to create shared library
308# -- "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 +0000309AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000310if test -z "$LDSHARED"
311then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000312 case $ac_sys_system/$ac_sys_release in
Guido van Rossum45140f91997-08-29 18:44:06 +0000313 AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000314 BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000315 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000316 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000317 SunOS/4*) LDSHARED="ld";;
318 SunOS/5*) LDSHARED="ld -G";;
319 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000320 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000321 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000322 next/*) LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000323 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000324 dgux*) LDSHARED="ld -G";;
Guido van Rossum1f740161998-04-13 15:27:21 +0000325 FreeBSD*|NetBSD*|OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000326 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000327 *) LDSHARED="ld";;
328 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000329fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000330AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000331# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000332# library -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000333AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000334if test -z "$CCSHARED"
335then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000336 case $ac_sys_system/$ac_sys_release in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000337 hp*|HP*) if test "$GCC" = yes;
338 then CCSHARED="-fpic";
339 else CCSHARED="+z";
340 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000341 Linux*) CCSHARED="-fpic";;
Guido van Rossum1f740161998-04-13 15:27:21 +0000342 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fpic";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000343 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000344 IRIX*/6*) case $CC in
345 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000346 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000347 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000348 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000349fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000350AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000351# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000352# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000353AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000354if test -z "$LINKFORSHARED"
355then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000356 case $ac_sys_system/$ac_sys_release in
Guido van Rossum69f65801998-03-03 21:47:00 +0000357 AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000358 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000359 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000360 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum79c970c1997-08-16 14:35:26 +0000361 next/*) LINKFORSHARED="-u libsys_s";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000362 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000363 SunOS/5*) case $CC in
364 *gcc*)
365 if $CC -Xlinker -V 2>/dev/null | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000366 then
367 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000368 fi;;
369 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000370 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000371fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000372AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000373
Guido van Rossum627b2d71993-12-24 10:39:16 +0000374# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000375AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
376AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum2cb56601998-05-07 13:25:56 +0000377AC_CHECK_LIB(m, pow) # Std math lib -- assume needed if it exists
Guido van Rossum70c7f481998-03-26 18:44:10 +0000378# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
379# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000380# BeOS' sockets are stashed in libnet.
381case "$ac_sys_system" in
382IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000383*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000384AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000385AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000386AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
387;;
388esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000389
Guido van Rossumc5a39031996-07-31 17:35:03 +0000390AC_MSG_CHECKING(for --with-libs)
391AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [
392AC_MSG_RESULT($withval)
393LIBS="$withval $LIBS"
394], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000395
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000396AC_MSG_CHECKING(for --with(out)-readline)
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000397AC_ARG_WITH(readline,
Guido van Rossum3c7c6781997-08-05 21:47:42 +0000398[--with(out)-readline obsolete, edit Modules/Setup instead],
399[AC_MSG_RESULT($withval)
400AC_ERROR(--with(out)-readline is obsolete, edit Modules/Setup instead)],
401[AC_MSG_RESULT(not specified.)])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000402
Guido van Rossum009f7871997-12-04 00:51:42 +0000403AC_SUBST(USE_THREAD_MODULE)
404USE_THREAD_MODULE="#"
405
Guido van Rossum54d93d41997-01-22 20:51:58 +0000406AC_MSG_CHECKING(for --with-dec-threads)
407AC_SUBST(LDLAST)
408AC_ARG_WITH(dec-threads,
409[--with-dec-threads use DEC Alpha/OSF1 thread-safe libraries],
410[AC_MSG_RESULT($withval)
411LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000412if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000413 with_thread="$withval";
414fi],
415AC_MSG_RESULT(no))
416
417AC_MSG_CHECKING(for --with-threads)
418AC_ARG_WITH(threads, [--with-threads alias for --with-thread],
419[AC_MSG_RESULT($withval)
420if test "${with_thread+set}" != set; then
421 with_thread="$withval";
422fi],
423AC_MSG_RESULT(no))
424
425AC_MSG_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000426AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum009f7871997-12-04 00:51:42 +0000427USE_THREAD_MODULE=
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000428AC_MSG_RESULT($withval)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000429if test -d "$withval"
Guido van Rossum300fda71996-08-19 21:58:16 +0000430then LDFLAGS="$LDFLAGS -L$withval"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000431fi
Guido van Rossum9caf77a1996-08-01 00:52:26 +0000432AC_DEFINE(_REENTRANT)
Guido van Rossumb418f891996-07-30 18:06:02 +0000433AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
434AC_DEFINE(C_THREADS)
435LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000436AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
437AC_DEFINE(BEOS_THREADS)
438LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000439AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000440AC_DEFINE(_POSIX_THREADS)
441LIBS="$LIBS -lpthreads"
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000442LIBOBJS="$LIBOBJS thread.o"], [
443AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
444AC_DEFINE(_POSIX_THREADS)
445LIBS="$LIBS -lpthread"
Guido van Rossum6400c261997-05-22 20:34:27 +0000446LIBOBJS="$LIBOBJS thread.o"], [
Guido van Rossum49545951997-12-02 19:28:29 +0000447AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
448AC_DEFINE(_POSIX_THREADS)
449LIBS="$LIBS -lc_r"
450LIBOBJS="$LIBOBJS thread.o"], [
Guido van Rossum6400c261997-05-22 20:34:27 +0000451AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
452AC_DEFINE(_POSIX_THREADS)
453LIBS="$LIBS -lthread"
Guido van Rossumb93a8621998-05-07 13:27:32 +0000454LIBOBJS="$LIBOBJS thread.o"], [
455AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
456AC_DEFINE(_POSIX_THREADS)
457LIBS="$LIBS -lcma"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000458LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000459])])])])])])
Guido van Rossum6400c261997-05-22 20:34:27 +0000460
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000461AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000462LIBS="$LIBS -lmpc"
463LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000464AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000465LIBS="$LIBS -lthread"
466LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000467], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000468
Guido van Rossum68242b51996-05-28 22:53:03 +0000469# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000470AC_SUBST(DLINCLDIR)
471DLINCLDIR=/
472
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000473AC_MSG_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000474AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000475AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000476AC_DEFINE(WITH_SGI_DL)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000477dldir=$withval
478if test -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000479then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000480else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
481fi
482DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000483LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000484
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000485AC_MSG_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000486AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000487AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000488AC_DEFINE(WITH_DL_DLD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000489dldir=`echo "$withval" | sed 's/,.*//'`
490dlddir=`echo "$withval" | sed 's/.*,//'`
491if test -d "$dldir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000492then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000493else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
494fi
495DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000496LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000497
498# checks for library functions
Guido van Rossum1171ee61997-08-22 20:42:00 +0000499AC_CHECK_FUNCS(alarm chown clock dlopen execv flock fork ftime ftruncate \
500 gethostname_r getpeername getpgrp getpid getpwent gettimeofday getwd \
Guido van Rossum18099751998-03-06 17:14:34 +0000501 kill link lstat mkfifo mktime nice pause plock putenv readlink \
Guido van Rossum96013151997-10-08 22:47:52 +0000502 select setgid setlocale setuid setsid setpgid setpgrp setvbuf \
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000503 sigaction siginterrupt sigrelse strftime strptime symlink \
Guido van Rossum08d6be41998-06-11 15:19:05 +0000504 tcgetpgrp tcsetpgrp timegm times truncate uname waitpid)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000505AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000506AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
507AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
508AC_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 +0000509
510# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000511AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000512AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000513AC_STRUCT_TIMEZONE
514
515AC_MSG_CHECKING(for time.h that defines altzone)
516AC_CACHE_VAL(ac_cv_header_time_altzone,
517[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
518 ac_cv_header_time_altzone=yes,
519 ac_cv_header_time_altzone=no)])
520AC_MSG_RESULT($ac_cv_header_time_altzone)
521if test $ac_cv_header_time_altzone = yes; then
522 AC_DEFINE(HAVE_ALTZONE)
523fi
524
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000525was_it_defined=no
526AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000527AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000528#include <sys/types.h>
529#include <sys/select.h>
530#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000531], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
532AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000533
534# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000535
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000536AC_C_CHAR_UNSIGNED
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000537
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000538AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000539
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000540works=no
541AC_MSG_CHECKING(for working volatile)
542AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
543AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000544
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000545works=no
546AC_MSG_CHECKING(for working signed char)
547AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
548AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000549
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000550have_prototypes=no
551AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000552AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
553AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000554AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000555
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000556works=no
557AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000558AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000559#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +0000560int foo(int x, ...) {
561 va_list va;
562 va_start(va, x);
563 va_arg(va, int);
564 va_arg(va, char *);
565 va_arg(va, double);
566 return 0;
567}
568], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000569AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
570AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000571
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000572if test "$have_prototypes" = yes; then
573bad_prototypes=no
574AC_MSG_CHECKING(for bad exec* prototypes)
575AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
576 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
577AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000578fi
579
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000580bad_forward=no
581AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000582AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000583struct s { int a; int b; };
584static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000585int foobar() {
586 static int random;
587 random = (int) &foo;
588 return random;
589}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000590static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000591main() {
592 exit(!((int)&foo == foobar()));
593}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000594], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
595AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000596
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000597va_list_is_array=no
598AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000599AC_TRY_COMPILE([
600#ifdef HAVE_STDARG_PROTOTYPES
601#include <stdarg.h>
602#else
603#include <varargs.h>
604#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000605], [va_list list1, list2; list1 = list2;], ,
606AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
607AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000608
Guido van Rossum627b2d71993-12-24 10:39:16 +0000609# checks for system services
610# (none yet)
611
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000612# Linux requires this for correct f.p. operations
613AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000614
Guido van Rossum93274221997-05-09 02:42:00 +0000615# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +0000616AC_MSG_CHECKING(for --with-fpectl)
617AC_ARG_WITH(fpectl, [--with-fpectl enable SIGFPE catching], [
618if test "$withval" != no
619then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
620else AC_MSG_RESULT(no)
621fi])
622
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000623# check for --with-libm=...
624AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000625case $ac_sys_system in
626next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000627BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000628*) LIBM=-lm
629esac
Guido van Rossum93274221997-05-09 02:42:00 +0000630AC_MSG_CHECKING(for --with-libm=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000631AC_ARG_WITH(libm, [--with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000632if test "$withval" = no
633then LIBM=
634 AC_MSG_RESULT(force LIBM empty)
635elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000636then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000637 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000638else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000639fi],
640[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000641
642# check for --with-libc=...
643AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +0000644AC_MSG_CHECKING(for --with-libc=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000645AC_ARG_WITH(libc, [--with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000646if test "$withval" = no
647then LIBC=
648 AC_MSG_RESULT(force LIBC empty)
649elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000650then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000651 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000652else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000653fi],
654[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000655
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000656# check for hypot() in math library
657LIBS_SAVE=$LIBS
658LIBS="$LIBS $LIBM"
659AC_CHECK_FUNCS(hypot)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000660AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000661LIBS=$LIBS_SAVE
662
Guido van Rossum7d473291995-01-20 14:12:16 +0000663# check for getopt
664AC_MSG_CHECKING(for genuine getopt)
665AC_CACHE_VAL(ac_cv_func_getopt,
666[AC_TRY_RUN([#include <stdio.h>
667extern int optind, opterr, getopt();
668extern char* optarg;
669int main() {
670 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
671 opterr = 0;
672 if (getopt(3, av, "f:") == 'f') { exit(1); }
673 exit(0);
674}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
675AC_MSG_RESULT($ac_cv_func_getopt)
676test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
677AC_SUBST(LIBOBJS)dnl
678
Guido van Rossumad713701997-07-10 22:42:38 +0000679# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +0000680AC_MSG_CHECKING(what malloc(0) returns)
681AC_CACHE_VAL(ac_cv_malloc_zero,
682[AC_TRY_RUN([#include <stdio.h>
683#ifdef HAVE_STDLIB
684#include <stdlib.h>
685#else
686char *malloc(), *realloc();
687int *free();
688#endif
689main() {
690 char *p;
691 p = malloc(0);
692 if (p == NULL) exit(1);
693 p = realloc(p, 0);
694 if (p == NULL) exit(1);
695 free(p);
696 exit(0);
697}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
698AC_MSG_RESULT($ac_cv_malloc_zero)
699if test "$ac_cv_malloc_zero" = null
700then
701 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
702fi
703
Guido van Rossum627b2d71993-12-24 10:39:16 +0000704# generate output files
Guido van Rossumb418f891996-07-30 18:06:02 +0000705AC_OUTPUT(Makefile \
706 Objects/Makefile \
707 Parser/Makefile \
708 Python/Makefile \
Guido van Rossum009f7871997-12-04 00:51:42 +0000709 Modules/Makefile.pre \
710 Modules/Setup.thread)