blob: ab38bcff2ac90a8e60983363d50b8c1d732beb22 [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 Rossumdd997f71998-10-07 19:58:26 +0000125case $MACHDEP in
126bsdos*)
127 case $CC in
128 gcc) CC="$CC -D_HAVE_BSDI";;
129 esac;;
130esac
131
Guido van Rossum84561611997-08-21 00:08:11 +0000132case $ac_sys_system in
133hp*|HP*)
134 case $CC in
135 cc|*/cc) CC="$CC -Aa -D_HPUX_SOURCE";;
136 esac;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000137BeOS*)
138 case $CC in
139 cc) CC=cc;;
140 esac;;
Guido van Rossum84561611997-08-21 00:08:11 +0000141esac
142
Guido van Rossumfb842551997-08-06 23:42:07 +0000143# LINKCC is the command that links the python executable -- default is $(CC).
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000144# This is altered for AIX and BeOS in order to build the export list before
145# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000146AC_SUBST(LINKCC)
147AC_MSG_CHECKING(LINKCC)
148if test -z "$LINKCC"
149then
150 case $ac_sys_system in
151 AIX*)
Guido van Rossum45140f91997-08-29 18:44:06 +0000152 LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000153 BeOS*)
Guido van Rossum2666a151998-12-17 18:07:35 +0000154 LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) \$(OPT)"
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000155 REALLIBRARY='libpython$(VERSION).so';;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000156 dgux*)
157 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000158 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000159 esac
160fi
161AC_MSG_RESULT($LINKCC)
162
Guido van Rossum627b2d71993-12-24 10:39:16 +0000163AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000164AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000165AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000166AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +0000167AC_SUBST(INSTALL_PROGRAM)
168AC_SUBST(INSTALL_DATA)
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000169AC_SUBST(REALLIBRARY)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000170# Install just never works :-(
171if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +0000172then
173 INSTALL=cp
174 INSTALL_PROGRAM=cp
175 INSTALL_DATA=cp
176else
177 INSTALL_PROGRAM="$INSTALL"
178 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000179fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000180
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000181# Not every filesystem supports hard links
182AC_SUBST(LN)
183if test -z "$LN" ; then
184 case $ac_sys_system in
185 BeOS*) LN="ln -s";;
186 *) LN=ln;;
187 esac
188fi
189
Guido van Rossum4e8af441994-08-19 15:33:54 +0000190# Optimizer/debugger flags passed between Makefiles
Guido van Rossumb418f891996-07-30 18:06:02 +0000191AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000192if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000193then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000194 case $GCC in
195 yes)
196 case $ac_cv_prog_cc_g in
197 yes) OPT="-g -O2";;
198 *) OPT="-O2";;
199 esac
200 ;;
Guido van Rossumb418f891996-07-30 18:06:02 +0000201 *) OPT="-O";;
202 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000203fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000204
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000205if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000206then
207 OPT="$OPT $ac_arch_flags"
208fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000209# checks for UNIX variants that set C preprocessor variables
210AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000211AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000212
Guido van Rossum91922671997-10-09 20:24:13 +0000213AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
214AC_CACHE_VAL(ac_cv_opt_olimit_ok,
215[ac_save_cc="$CC"
216CC="$CC -OPT:Olimit=0"
217AC_TRY_RUN([int main() { return 0; }],
218 ac_cv_opt_olimit_ok=yes,
219 ac_cv_opt_olimit_ok=no)
220CC="$ac_save_cc"])
221AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000222if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000223 OPT="$OPT -OPT:Olimit=0"
Guido van Rossumf8678121998-07-07 21:05:09 +0000224else
225 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
226 AC_CACHE_VAL(ac_cv_olimit_ok,
227 [ac_save_cc="$CC"
228 CC="$CC -Olimit 1500"
229 AC_TRY_RUN([int main() { return 0; }],
230 ac_cv_olimit_ok=yes,
231 ac_cv_olimit_ok=no)
232 CC="$ac_save_cc"])
233 AC_MSG_RESULT($ac_cv_olimit_ok)
234 if test $ac_cv_olimit_ok = yes; then
235 OPT="$OPT -Olimit 1500"
236 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000237fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000238
239AC_SUBST(DGUX_IS_BROKEN)
240if test "$MACHDEP" != "dguxR4"
241then
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000242 REALLIBRARY='libpython$(VERSION).a'
Guido van Rossum35742851998-02-19 21:32:40 +0000243 DGUX_IS_BROKEN="true"
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000244else
245 REALLIBRARY='libpython$(VERSION).so'
246 OPT="$OPT -pic"
Guido van Rossum35742851998-02-19 21:32:40 +0000247 DGUX_IS_BROKEN="make $REALLIBRARY"
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000248fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000249
Guido van Rossum300fda71996-08-19 21:58:16 +0000250# check for ANSI or K&R ("traditional") preprocessor
251AC_MSG_CHECKING(for C preprocessor type)
252AC_TRY_COMPILE([
253#define spam(name, doc) {#name, &name, #name "() -- " doc}
254int foo;
255struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
256], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
257AC_MSG_RESULT($cpp_type)
258
Guido van Rossum627b2d71993-12-24 10:39:16 +0000259# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000260AC_HEADER_STDC
Guido van Rossum96013151997-10-08 22:47:52 +0000261AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h pthread.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000262signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000263sys/audioio.h sys/file.h sys/lock.h \
264sys/param.h sys/select.h sys/time.h sys/times.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000265sys/un.h sys/utsname.h sys/wait.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000266AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000267
268# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000269was_it_defined=no
270AC_MSG_CHECKING(for clock_t in time.h)
271AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
272AC_MSG_RESULT($was_it_defined)
273
Guido van Rossum300fda71996-08-19 21:58:16 +0000274# Add some code to confdefs.h so that the test for off_t works on SCO
275cat >> confdefs.h <<\EOF
276#if defined(SCO_DS)
277#undef _OFF_T
278#endif
279EOF
280
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000281AC_TYPE_MODE_T
282AC_TYPE_OFF_T
283AC_TYPE_PID_T
284AC_TYPE_SIGNAL
285AC_TYPE_SIZE_T
286AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000287
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000288AC_CHECK_SIZEOF(int)
289AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000290AC_CHECK_SIZEOF(void *)
Guido van Rossumac405f61994-09-12 10:56:06 +0000291
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000292AC_MSG_CHECKING(for long long support)
293have_long_long=no
294AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
295AC_MSG_RESULT($have_long_long)
296if test $have_long_long = yes ; then
297AC_CHECK_SIZEOF(long long)
298fi
299
Guido van Rossumac405f61994-09-12 10:56:06 +0000300# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000301AC_SUBST(SO)
302AC_SUBST(LDSHARED)
303AC_SUBST(CCSHARED)
304AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000305# SO is the extension of shared libraries `(including the dot!)
306# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000307AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000308if test -z "$SO"
309then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000310 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000311 hp*|HP*) SO=.sl;;
312 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000313 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000314fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000315AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000316# LDSHARED is the ld *command* used to create shared library
317# -- "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 +0000318AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000319if test -z "$LDSHARED"
320then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000321 case $ac_sys_system/$ac_sys_release in
Guido van Rossum45140f91997-08-29 18:44:06 +0000322 AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000323 BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000324 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000325 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000326 SunOS/4*) LDSHARED="ld";;
327 SunOS/5*) LDSHARED="ld -G";;
328 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000329 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000330 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000331 next/*) LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000332 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000333 dgux*) LDSHARED="ld -G";;
Guido van Rossum2666a151998-12-17 18:07:35 +0000334 FreeBSD*/3*) LDSHARED="gcc -shared";;
Guido van Rossum1f740161998-04-13 15:27:21 +0000335 FreeBSD*|NetBSD*|OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000336 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000337 *) LDSHARED="ld";;
338 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000339fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000340AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000341# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000342# library -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000343AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000344if test -z "$CCSHARED"
345then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000346 case $ac_sys_system/$ac_sys_release in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000347 hp*|HP*) if test "$GCC" = yes;
348 then CCSHARED="-fpic";
349 else CCSHARED="+z";
350 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000351 Linux*) CCSHARED="-fpic";;
Guido van Rossum1f740161998-04-13 15:27:21 +0000352 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fpic";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000353 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000354 IRIX*/6*) case $CC in
355 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000356 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000357 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000358 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000359fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000360AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000361# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000362# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000363AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000364if test -z "$LINKFORSHARED"
365then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000366 case $ac_sys_system/$ac_sys_release in
Guido van Rossum69f65801998-03-03 21:47:00 +0000367 AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000368 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000369 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossum2666a151998-12-17 18:07:35 +0000370 FreeBSD/3*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000371 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum79c970c1997-08-16 14:35:26 +0000372 next/*) LINKFORSHARED="-u libsys_s";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000373 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000374 SunOS/5*) case $CC in
375 *gcc*)
376 if $CC -Xlinker -V 2>/dev/null | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000377 then
378 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000379 fi;;
380 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000381 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000382fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000383AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000384
Guido van Rossum627b2d71993-12-24 10:39:16 +0000385# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000386AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
387AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum2cb56601998-05-07 13:25:56 +0000388AC_CHECK_LIB(m, pow) # Std math lib -- assume needed if it exists
Guido van Rossum70c7f481998-03-26 18:44:10 +0000389# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
390# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000391# BeOS' sockets are stashed in libnet.
392case "$ac_sys_system" in
393IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000394*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000395AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000396AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000397AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
398;;
399esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000400
Guido van Rossumc5a39031996-07-31 17:35:03 +0000401AC_MSG_CHECKING(for --with-libs)
402AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [
403AC_MSG_RESULT($withval)
404LIBS="$withval $LIBS"
405], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000406
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000407AC_MSG_CHECKING(for --with(out)-readline)
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000408AC_ARG_WITH(readline,
Guido van Rossum3c7c6781997-08-05 21:47:42 +0000409[--with(out)-readline obsolete, edit Modules/Setup instead],
410[AC_MSG_RESULT($withval)
411AC_ERROR(--with(out)-readline is obsolete, edit Modules/Setup instead)],
412[AC_MSG_RESULT(not specified.)])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000413
Guido van Rossum009f7871997-12-04 00:51:42 +0000414AC_SUBST(USE_THREAD_MODULE)
415USE_THREAD_MODULE="#"
416
Guido van Rossum54d93d41997-01-22 20:51:58 +0000417AC_MSG_CHECKING(for --with-dec-threads)
418AC_SUBST(LDLAST)
419AC_ARG_WITH(dec-threads,
420[--with-dec-threads use DEC Alpha/OSF1 thread-safe libraries],
421[AC_MSG_RESULT($withval)
422LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000423if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000424 with_thread="$withval";
425fi],
426AC_MSG_RESULT(no))
427
428AC_MSG_CHECKING(for --with-threads)
429AC_ARG_WITH(threads, [--with-threads alias for --with-thread],
430[AC_MSG_RESULT($withval)
431if test "${with_thread+set}" != set; then
432 with_thread="$withval";
433fi],
434AC_MSG_RESULT(no))
435
436AC_MSG_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000437AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum009f7871997-12-04 00:51:42 +0000438USE_THREAD_MODULE=
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000439AC_MSG_RESULT($withval)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000440if test -d "$withval"
Guido van Rossum300fda71996-08-19 21:58:16 +0000441then LDFLAGS="$LDFLAGS -L$withval"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000442fi
Guido van Rossum9caf77a1996-08-01 00:52:26 +0000443AC_DEFINE(_REENTRANT)
Guido van Rossumb418f891996-07-30 18:06:02 +0000444AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
445AC_DEFINE(C_THREADS)
446LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum2666a151998-12-17 18:07:35 +0000447AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000448AC_DEFINE(_POSIX_THREADS)
449LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000450AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
451AC_DEFINE(BEOS_THREADS)
452LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000453AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000454AC_DEFINE(_POSIX_THREADS)
455LIBS="$LIBS -lpthreads"
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000456LIBOBJS="$LIBOBJS thread.o"], [
457AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
458AC_DEFINE(_POSIX_THREADS)
459LIBS="$LIBS -lpthread"
Guido van Rossum6400c261997-05-22 20:34:27 +0000460LIBOBJS="$LIBOBJS thread.o"], [
Guido van Rossum49545951997-12-02 19:28:29 +0000461AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
462AC_DEFINE(_POSIX_THREADS)
463LIBS="$LIBS -lc_r"
464LIBOBJS="$LIBOBJS thread.o"], [
Guido van Rossum6400c261997-05-22 20:34:27 +0000465AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
466AC_DEFINE(_POSIX_THREADS)
467LIBS="$LIBS -lthread"
Guido van Rossumb93a8621998-05-07 13:27:32 +0000468LIBOBJS="$LIBOBJS thread.o"], [
469AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
470AC_DEFINE(_POSIX_THREADS)
471LIBS="$LIBS -lcma"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000472LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000473])])])])])])])
Guido van Rossum6400c261997-05-22 20:34:27 +0000474
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000475AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000476LIBS="$LIBS -lmpc"
477LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000478AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000479LIBS="$LIBS -lthread"
480LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000481], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000482
Guido van Rossum68242b51996-05-28 22:53:03 +0000483# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000484AC_SUBST(DLINCLDIR)
485DLINCLDIR=/
486
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000487AC_MSG_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000488AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000489AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000490AC_DEFINE(WITH_SGI_DL)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000491dldir=$withval
492if test -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000493then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000494else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
495fi
496DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000497LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000498
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000499AC_MSG_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000500AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000501AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000502AC_DEFINE(WITH_DL_DLD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000503dldir=`echo "$withval" | sed 's/,.*//'`
504dlddir=`echo "$withval" | sed 's/.*,//'`
505if test -d "$dldir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000506then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000507else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
508fi
509DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000510LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000511
512# checks for library functions
Guido van Rossum1171ee61997-08-22 20:42:00 +0000513AC_CHECK_FUNCS(alarm chown clock dlopen execv flock fork ftime ftruncate \
514 gethostname_r getpeername getpgrp getpid getpwent gettimeofday getwd \
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000515 kill link lstat mkfifo mktime nice pause plock pthread_init putenv readlink \
Guido van Rossum96013151997-10-08 22:47:52 +0000516 select setgid setlocale setuid setsid setpgid setpgrp setvbuf \
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000517 sigaction siginterrupt sigrelse strftime strptime symlink \
Guido van Rossum08d6be41998-06-11 15:19:05 +0000518 tcgetpgrp tcsetpgrp timegm times truncate uname waitpid)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000519AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000520AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
521AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
522AC_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 +0000523
524# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000525AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000526AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000527AC_STRUCT_TIMEZONE
528
529AC_MSG_CHECKING(for time.h that defines altzone)
530AC_CACHE_VAL(ac_cv_header_time_altzone,
531[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
532 ac_cv_header_time_altzone=yes,
533 ac_cv_header_time_altzone=no)])
534AC_MSG_RESULT($ac_cv_header_time_altzone)
535if test $ac_cv_header_time_altzone = yes; then
536 AC_DEFINE(HAVE_ALTZONE)
537fi
538
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000539was_it_defined=no
540AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000541AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000542#include <sys/types.h>
543#include <sys/select.h>
544#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000545], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
546AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000547
548# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000549
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000550AC_C_CHAR_UNSIGNED
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000551
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000552AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000553
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000554works=no
555AC_MSG_CHECKING(for working volatile)
556AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
557AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000558
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000559works=no
560AC_MSG_CHECKING(for working signed char)
561AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
562AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000563
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000564have_prototypes=no
565AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000566AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
567AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000568AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000569
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000570works=no
571AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000572AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000573#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +0000574int foo(int x, ...) {
575 va_list va;
576 va_start(va, x);
577 va_arg(va, int);
578 va_arg(va, char *);
579 va_arg(va, double);
580 return 0;
581}
582], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000583AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
584AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000585
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000586if test "$have_prototypes" = yes; then
587bad_prototypes=no
588AC_MSG_CHECKING(for bad exec* prototypes)
589AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
590 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
591AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000592fi
593
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000594bad_forward=no
595AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000596AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000597struct s { int a; int b; };
598static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000599int foobar() {
600 static int random;
601 random = (int) &foo;
602 return random;
603}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000604static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000605main() {
606 exit(!((int)&foo == foobar()));
607}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000608], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
609AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000610
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000611va_list_is_array=no
612AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000613AC_TRY_COMPILE([
614#ifdef HAVE_STDARG_PROTOTYPES
615#include <stdarg.h>
616#else
617#include <varargs.h>
618#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000619], [va_list list1, list2; list1 = list2;], ,
620AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
621AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000622
Guido van Rossum627b2d71993-12-24 10:39:16 +0000623# checks for system services
624# (none yet)
625
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000626# Linux requires this for correct f.p. operations
627AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000628
Guido van Rossum93274221997-05-09 02:42:00 +0000629# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +0000630AC_MSG_CHECKING(for --with-fpectl)
631AC_ARG_WITH(fpectl, [--with-fpectl enable SIGFPE catching], [
632if test "$withval" != no
633then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
634else AC_MSG_RESULT(no)
635fi])
636
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000637# check for --with-libm=...
638AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000639case $ac_sys_system in
640next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000641BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000642*) LIBM=-lm
643esac
Guido van Rossum93274221997-05-09 02:42:00 +0000644AC_MSG_CHECKING(for --with-libm=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000645AC_ARG_WITH(libm, [--with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000646if test "$withval" = no
647then LIBM=
648 AC_MSG_RESULT(force LIBM empty)
649elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000650then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000651 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000652else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000653fi],
654[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000655
656# check for --with-libc=...
657AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +0000658AC_MSG_CHECKING(for --with-libc=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000659AC_ARG_WITH(libc, [--with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000660if test "$withval" = no
661then LIBC=
662 AC_MSG_RESULT(force LIBC empty)
663elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000664then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000665 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000666else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000667fi],
668[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000669
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000670# check for hypot() in math library
671LIBS_SAVE=$LIBS
672LIBS="$LIBS $LIBM"
673AC_CHECK_FUNCS(hypot)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000674AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000675LIBS=$LIBS_SAVE
676
Guido van Rossum7d473291995-01-20 14:12:16 +0000677# check for getopt
678AC_MSG_CHECKING(for genuine getopt)
679AC_CACHE_VAL(ac_cv_func_getopt,
680[AC_TRY_RUN([#include <stdio.h>
681extern int optind, opterr, getopt();
682extern char* optarg;
683int main() {
684 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
685 opterr = 0;
686 if (getopt(3, av, "f:") == 'f') { exit(1); }
687 exit(0);
688}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
689AC_MSG_RESULT($ac_cv_func_getopt)
690test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
691AC_SUBST(LIBOBJS)dnl
692
Guido van Rossumad713701997-07-10 22:42:38 +0000693# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +0000694AC_MSG_CHECKING(what malloc(0) returns)
695AC_CACHE_VAL(ac_cv_malloc_zero,
696[AC_TRY_RUN([#include <stdio.h>
697#ifdef HAVE_STDLIB
698#include <stdlib.h>
699#else
700char *malloc(), *realloc();
701int *free();
702#endif
703main() {
704 char *p;
705 p = malloc(0);
706 if (p == NULL) exit(1);
707 p = realloc(p, 0);
708 if (p == NULL) exit(1);
709 free(p);
710 exit(0);
711}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
712AC_MSG_RESULT($ac_cv_malloc_zero)
713if test "$ac_cv_malloc_zero" = null
714then
715 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
716fi
717
Guido van Rossum627b2d71993-12-24 10:39:16 +0000718# generate output files
Guido van Rossumb418f891996-07-30 18:06:02 +0000719AC_OUTPUT(Makefile \
720 Objects/Makefile \
721 Parser/Makefile \
722 Python/Makefile \
Guido van Rossum009f7871997-12-04 00:51:42 +0000723 Modules/Makefile.pre \
724 Modules/Setup.thread)