blob: 77ab0a3a88f0b6997d28c047a7d1df079c3ce99c [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)
Guido van Rossumb9a22a12000-06-30 02:48:53 +00009VERSION=2.0
Guido van Rossum642b6781997-07-19 19:35:41 +000010
Guido van Rossum3dc0a512000-10-05 18:00:06 +000011# NEXTSTEP|MacOSX|Darwin stuff
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000012if test -f /usr/lib/NextStep/software_version -o -f /System/Library/CoreServices/software_version ; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000013
14 AC_MSG_CHECKING(for --with-next-archs)
15 AC_ARG_WITH(next-archs,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000016 [ --with-next-archs='arch1 arch2 ..' build MAB binary], [
Guido van Rossum4b6b5791996-09-09 20:09:34 +000017 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
Guido van Rossum3dc0a512000-10-05 18:00:06 +000027 ac_sys_system=`uname -s`
28 if test "$ac_sys_system" = "Darwin" ; then
29 ac_sys_release=`uname -r`
30 else
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000031 set X `hostinfo | egrep '(NeXT Mach|Kernel Release).*:' | \
Guido van Rossum3dc0a512000-10-05 18:00:06 +000032 sed -e 's/://' -e 's/\./_/'` && \
33 ac_sys_system=next && ac_sys_release=$4
34 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000035
Guido van Rossum3dc0a512000-10-05 18:00:06 +000036 MACHDEP="$ac_sys_system$ac_sys_release"
Guido van Rossumb418f891996-07-30 18:06:02 +000037 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000038fi
Guido van Rossumb418f891996-07-30 18:06:02 +000039
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000040AC_ARG_WITH(next-framework,
Guido van Rossum3dc0a512000-10-05 18:00:06 +000041[ --with-next-framework Build (OpenStep|Rhapsody|MacOSX|Darwin) framework],,)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000042AC_ARG_WITH(dyld,
Guido van Rossum3dc0a512000-10-05 18:00:06 +000043[ --with-dyld Use (OpenStep|Rhapsody|MacOSX|Darwin) dynamic linker],,)
Guido van Rossum91922671997-10-09 20:24:13 +000044
Guido van Rossumb418f891996-07-30 18:06:02 +000045# Set name for machine-dependent library files
46AC_SUBST(MACHDEP)
47AC_MSG_CHECKING(MACHDEP)
48if test -z "$MACHDEP"
49then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000050 ac_sys_system=`uname -s`
Trent Mick635f6fb2000-08-23 21:33:05 +000051 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000052 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000053 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000054 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000055 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000056 ac_md_system=`echo $ac_sys_system |
57 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
58 ac_md_release=`echo $ac_sys_release |
59 tr -d '[/ ]' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000060 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000061
Guido van Rossumbcd91e01997-03-20 20:46:29 +000062 case $MACHDEP in
Guido van Rossumb97ef171997-09-28 05:44:03 +000063 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000064 esac
65fi
Guido van Rossum91922671997-10-09 20:24:13 +000066
67#
68# SGI compilers allow the specification of the both the ABI and the
69# ISA on the command line. Depending on the values of these switches,
70# different and often incompatable code will be generated.
71#
72# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
73# thus supply support for various ABI/ISA combinations. The MACHDEP
74# variable is also adjusted.
75#
76AC_SUBST(SGI_ABI)
77if test ! -z "$SGI_ABI"
78then
79 CC="cc $SGI_ABI"
80 LDFLAGS="$SGI_ABI $LDFLAGS"
81 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
82fi
Guido van Rossumb418f891996-07-30 18:06:02 +000083AC_MSG_RESULT($MACHDEP)
84
Guido van Rossum91922671997-10-09 20:24:13 +000085#
86# CCC is the command that compiles C++ programs
87#
88# Not all make programs have this predefined.
89#
Guido van Rossum95012191999-12-16 17:50:52 +000090#AC_SUBST(SET_CCC)
91#AC_MSG_CHECKING(CCC)
92#if test -z "$CCC"
93#then
94# case $ac_sys_system in
95# IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";;
96# Linux*) SET_CCC="CCC= g++";;
97# *) SET_CCC=""
98# esac
99#else
100# SET_CCC="CCC= ${CCC}"
101#fi
102#AC_MSG_RESULT($SET_CCC)
Guido van Rossum91922671997-10-09 20:24:13 +0000103
104
Guido van Rossum627b2d71993-12-24 10:39:16 +0000105# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000106AC_MSG_CHECKING(for --without-gcc)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000107AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000108 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000109 no) CC=cc
110 without_gcc=yes;;
111 yes) CC=gcc
112 without_gcc=no;;
113 *) CC=$withval
114 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000115 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000116 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +0000117 OSF1) CC=cc
118 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000119 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000120 case $BE_HOST_CPU in
121 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000122 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000123 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000124 OPT="-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma"
125 CCSHARED="UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000126 LDFLAGS="$LDFLAGS -nodup"
127
128 AR="$PWD/BeOS/ar-fake"
129 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000130 ;;
131 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000132 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000133 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000134 OPT=-O
135 # Really should use srcdir instead of PWD
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000136 AR="$PWD/BeOS/ar-fake"
137 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000138 ;;
139 *)
Fred Drake5790be12000-10-09 17:06:13 +0000140 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000141 ;;
142 esac
143 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000144 Monterey*)
145 RANLIB=:
146 without_gcc=;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000147 *) without_gcc=no;;
148 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000149AC_MSG_RESULT($without_gcc)
150
Guido van Rossum95012191999-12-16 17:50:52 +0000151AC_SUBST(SET_CXX)
152AC_SUBST(MAINOBJ)
153MAINOBJ=python.o
154AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000155AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000156 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000157 case $withval in
158 no) CXX=
159 with_cxx=no;;
160 *) CXX=$withval
161 MAINOBJ=ccpython.o
162 with_cxx=$withval;;
163 esac], [
164 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000165 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000166])
167AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000168
169dnl The following fragment works similar to AC_PROG_CXX.
170dnl It does not fail if CXX is not found, and it is not executed if
171dnl --with-cxx was given.
172dnl Finally, it does not test whether CXX is g++.
173
174if test "$check_cxx" = "yes"
175then
176 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
177 if test "$CXX" = "notfound"
178 then
179 CXX=
180 else
181 AC_PROG_CXX_WORKS
182 fi
183fi
184
Guido van Rossume1262332000-09-22 19:41:56 +0000185SET_CXX="CXX=$CXX"
Guido van Rossum95012191999-12-16 17:50:52 +0000186
Martin v. Löwis537970f2000-12-13 17:37:02 +0000187
Guido van Rossum95012191999-12-16 17:50:52 +0000188#AC_MSG_CHECKING(CCC)
189#if test -z "$CCC"
190#then
191# case $ac_sys_system in
192# IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";;
193# Linux*) SET_CCC="CCC= g++";;
194# *) SET_CCC=""
195# esac
196#else
197# SET_CCC="CCC= ${CCC}"
198#fi
199#AC_MSG_RESULT($SET_CCC)
200
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000201# If the user switches compilers, we can't believe the cache
202if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
203then
204 AC_ERROR(cached CC is different -- throw away $cache_file
205(it is also a good idea to do 'make clean' before compiling))
206fi
207
Guido van Rossum627b2d71993-12-24 10:39:16 +0000208AC_PROG_CC
Guido van Rossumff555e32000-09-22 15:38:21 +0000209AC_SUBST(EXE)
210AC_MSG_CHECKING(for --with-suffix)
211AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
212 case $withval in
213 no) EXE=;;
214 yes) EXE=.exe;;
215 *) EXE=$withval;;
216 esac])
217AC_MSG_RESULT($EXE)
Guido van Rossumfb842551997-08-06 23:42:07 +0000218
Guido van Rossumdd997f71998-10-07 19:58:26 +0000219case $MACHDEP in
220bsdos*)
221 case $CC in
222 gcc) CC="$CC -D_HAVE_BSDI";;
223 esac;;
224esac
225
Guido van Rossum84561611997-08-21 00:08:11 +0000226case $ac_sys_system in
227hp*|HP*)
228 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000229 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000230 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000231Monterey*)
232 case $CC in
233 cc) CC="$CC -Wl,-Bexport";;
234 esac;;
Guido van Rossum84561611997-08-21 00:08:11 +0000235esac
236
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000237# LDLIBRARY is the name of the library to link against (as opposed to the
238# name of the library into which to insert object files). On systems
239# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
240# the Makefiles).
241AC_SUBST(MAKE_LDLIBRARY)
242AC_SUBST(LDLIBRARY)
243LDLIBRARY=''
244
Guido van Rossumfb842551997-08-06 23:42:07 +0000245# LINKCC is the command that links the python executable -- default is $(CC).
Fred Drake5790be12000-10-09 17:06:13 +0000246# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000247# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000248AC_SUBST(LINKCC)
249AC_MSG_CHECKING(LINKCC)
Guido van Rossum95012191999-12-16 17:50:52 +0000250if test -z "$LINKCC" -a ! -z "$CXX"
251then
252 LINKCC="$CXX"
253fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000254if test -z "$LINKCC"
255then
256 case $ac_sys_system in
257 AIX*)
Guido van Rossum45140f91997-08-29 18:44:06 +0000258 LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000259 dgux*)
260 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000261 Monterey64*)
262 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000263 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000264 esac
265fi
266AC_MSG_RESULT($LINKCC)
267
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000268AC_MSG_CHECKING(LDLIBRARY)
269
270# NeXT framework builds require that the 'ar' library be converted into
271# a bundle using libtool.
272if test "$with_next_framework"
273then
274 LDLIBRARY='libpython$(VERSION).dylib'
275fi
276
277# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000278case $MACHDEP in
279dguxR4)
280 LDLIBRARY='libpython$(VERSION).so'
281 OPT="$OPT -pic"
282 ;;
283beos*)
284 LDLIBRARY='libpython$(VERSION).so'
285 ;;
286esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000287AC_MSG_RESULT($LDLIBRARY)
288
289# If LDLIBRARY is different from LIBRARY, emit a rule to build it.
290if test -z "$LDLIBRARY"
291then
292 LDLIBRARY='libpython$(VERSION).a'
293 MAKE_LDLIBRARY="true"
294else
295 MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)'
296fi
297
Guido van Rossum627b2d71993-12-24 10:39:16 +0000298AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000299AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000300AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000301AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +0000302AC_SUBST(INSTALL_PROGRAM)
303AC_SUBST(INSTALL_DATA)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000304# Install just never works :-(
305if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +0000306then
307 INSTALL=cp
308 INSTALL_PROGRAM=cp
309 INSTALL_DATA=cp
310else
311 INSTALL_PROGRAM="$INSTALL"
312 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000313fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000314
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000315# Not every filesystem supports hard links
316AC_SUBST(LN)
317if test -z "$LN" ; then
318 case $ac_sys_system in
319 BeOS*) LN="ln -s";;
320 *) LN=ln;;
321 esac
322fi
323
Guido van Rossum4e8af441994-08-19 15:33:54 +0000324# Optimizer/debugger flags passed between Makefiles
Guido van Rossumb418f891996-07-30 18:06:02 +0000325AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000326if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000327then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000328 case $GCC in
329 yes)
330 case $ac_cv_prog_cc_g in
Greg Warda1c4da22000-11-07 15:44:21 +0000331 yes) OPT="-g -O2 -Wall -Wstrict-prototypes -fPIC";;
332 *) OPT="-O2 -Wall -Wstrict-prototypes -fPIC";;
Guido van Rossumb5875b61997-07-18 23:29:09 +0000333 esac
334 ;;
Guido van Rossumb418f891996-07-30 18:06:02 +0000335 *) OPT="-O";;
336 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000337fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000338
Trent Mick635f6fb2000-08-23 21:33:05 +0000339# The current (beta) Monterey compiler dies with optimizations
340case $ac_sys_system in
341Monterey*) OPT="";;
342esac
343
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000344if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000345then
346 OPT="$OPT $ac_arch_flags"
347fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000348# checks for UNIX variants that set C preprocessor variables
349AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000350AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000351
Guido van Rossum91922671997-10-09 20:24:13 +0000352AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
353AC_CACHE_VAL(ac_cv_opt_olimit_ok,
354[ac_save_cc="$CC"
355CC="$CC -OPT:Olimit=0"
356AC_TRY_RUN([int main() { return 0; }],
357 ac_cv_opt_olimit_ok=yes,
358 ac_cv_opt_olimit_ok=no)
359CC="$ac_save_cc"])
360AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000361if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000362 case $ac_sys_system in
363 Darwin*) OPT="$OPT" ;;
364 *) OPT="$OPT -OPT:Olimit=0";;
365 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000366else
367 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
368 AC_CACHE_VAL(ac_cv_olimit_ok,
369 [ac_save_cc="$CC"
370 CC="$CC -Olimit 1500"
371 AC_TRY_RUN([int main() { return 0; }],
372 ac_cv_olimit_ok=yes,
373 ac_cv_olimit_ok=no)
374 CC="$ac_save_cc"])
375 AC_MSG_RESULT($ac_cv_olimit_ok)
376 if test $ac_cv_olimit_ok = yes; then
377 OPT="$OPT -Olimit 1500"
378 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000379fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000380
Fred Drakece81d592000-07-09 14:39:29 +0000381dnl # check for ANSI or K&R ("traditional") preprocessor
382dnl AC_MSG_CHECKING(for C preprocessor type)
383dnl AC_TRY_COMPILE([
384dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
385dnl int foo;
386dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
387dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
388dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000389
Guido van Rossum627b2d71993-12-24 10:39:16 +0000390# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000391AC_HEADER_STDC
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000392AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000393signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
Fred Drakec9cb8472000-08-31 16:11:07 +0000394sys/audioio.h sys/file.h sys/lock.h db_185.h db.h \
Guido van Rossum95713eb2000-05-18 20:53:31 +0000395sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000396sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
397ndbm.h db1/ndbm.h gdbm/ndbm.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000398AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000399
400# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000401was_it_defined=no
402AC_MSG_CHECKING(for clock_t in time.h)
403AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
404AC_MSG_RESULT($was_it_defined)
405
Guido van Rossum300fda71996-08-19 21:58:16 +0000406# Add some code to confdefs.h so that the test for off_t works on SCO
407cat >> confdefs.h <<\EOF
408#if defined(SCO_DS)
409#undef _OFF_T
410#endif
411EOF
412
Guido van Rossumef2255b2000-03-10 22:30:29 +0000413# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000414AC_TYPE_MODE_T
415AC_TYPE_OFF_T
416AC_TYPE_PID_T
417AC_TYPE_SIGNAL
418AC_TYPE_SIZE_T
419AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000420
Guido van Rossumef2255b2000-03-10 22:30:29 +0000421# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000422AC_CHECK_SIZEOF(int)
423AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000424AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000425AC_CHECK_SIZEOF(char)
426AC_CHECK_SIZEOF(short)
427AC_CHECK_SIZEOF(float)
428AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000429AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000430
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000431AC_MSG_CHECKING(for long long support)
432have_long_long=no
433AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
434AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000435if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000436AC_CHECK_SIZEOF(long long)
437fi
438
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000439AC_MSG_CHECKING(for uintptr_t support)
440have_uintptr_t=no
441AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
442AC_MSG_RESULT($have_uintptr_t)
443if test "$have_uintptr_t" = yes ; then
444AC_CHECK_SIZEOF(uintptr_t)
445fi
446
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000447# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
448AC_MSG_CHECKING(size of off_t)
449AC_CACHE_VAL(ac_cv_sizeof_off_t,
450[AC_TRY_RUN([#include <stdio.h>
451#include <sys/types.h>
452main()
453{
454 FILE *f=fopen("conftestval", "w");
455 if (!f) exit(1);
456 fprintf(f, "%d\n", sizeof(off_t));
457 exit(0);
458}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
459])
460AC_MSG_RESULT($ac_cv_sizeof_off_t)
461AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
462
463AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000464if test "$have_long_long" = yes -a \
465 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
466 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000467 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
468 AC_MSG_RESULT(yes)
469else
470 AC_MSG_RESULT(no)
471fi
472
Fred Drakea3f6e912000-06-29 20:44:47 +0000473# AC_CHECK_SIZEOF() doesn't include <time.h>.
474AC_MSG_CHECKING(size of time_t)
475AC_CACHE_VAL(ac_cv_sizeof_time_t,
476[AC_TRY_RUN([#include <stdio.h>
477#include <time.h>
478main()
479{
480 FILE *f=fopen("conftestval", "w");
481 if (!f) exit(1);
482 fprintf(f, "%d\n", sizeof(time_t));
483 exit(0);
484}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
485])
486AC_MSG_RESULT($ac_cv_sizeof_time_t)
487AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
488
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000489
Trent Mick635f6fb2000-08-23 21:33:05 +0000490# if have pthread_t then define SIZEOF_PTHREAD_T
491AC_MSG_CHECKING(for pthread_t)
492have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000493AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000494AC_MSG_RESULT($have_pthread_t)
495if test "$have_pthread_t" = yes ; then
496 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
497 AC_MSG_CHECKING(size of pthread_t)
498 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
499 [AC_TRY_RUN([#include <stdio.h>
500 #include <pthread.h>
501 main()
502 {
503 FILE *f=fopen("conftestval", "w");
504 if (!f) exit(1);
505 fprintf(f, "%d\n", sizeof(pthread_t));
506 exit(0);
507 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
508 ])
509 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
510 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
511fi
512
513
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000514# Minor variations in building a framework between NextStep versions 4 and 5
515AC_SUBST(LIBTOOL_CRUFT)
516case $ac_sys_system/$ac_sys_release in
Guido van Rossum5839e582000-10-09 19:52:35 +0000517 Darwin/*)
518 ns_undef_sym='_environ'
519 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000520 next/4*)
521 ns_undef_sym='__environ'
522 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
523 next/5*)
524 ns_undef_sym='_environ'
525 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
526esac
527
528AC_MSG_CHECKING(for --with-next-framework)
529if test "$with_next_framework"
530then
531 OPT="$OPT -fno-common"
532 # -U __environ is needed since bundles don't have access
533 # to crt0 when built but will always be linked against it
534 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
535 AC_DEFINE(WITH_NEXT_FRAMEWORK)
536 AC_MSG_RESULT(yes)
537else
538 AC_MSG_RESULT(no)
539fi
540
541AC_MSG_CHECKING(for --with-dyld)
542if test "$with_next_framework" -o "$with_dyld"
543then
544 if test "$with_dyld"
545 then
546 AC_MSG_RESULT(yes)
547 else
548 AC_MSG_RESULT(required for framework build)
549 fi
550 AC_DEFINE(WITH_DYLD)
551 ns_dyld='set'
552else
553 AC_MSG_RESULT(no)
554fi
555
Guido van Rossumac405f61994-09-12 10:56:06 +0000556# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000557AC_SUBST(SO)
558AC_SUBST(LDSHARED)
559AC_SUBST(CCSHARED)
560AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000561# SO is the extension of shared libraries `(including the dot!)
562# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000563AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000564if test -z "$SO"
565then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000566 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000567 hp*|HP*) SO=.sl;;
568 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000569 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000570fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000571AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000572# LDSHARED is the ld *command* used to create shared library
573# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000574# (Shared libraries in this instance are shared modules to be loaded into
575# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000576AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000577if test -z "$LDSHARED"
578then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000579 case $ac_sys_system/$ac_sys_release in
Guido van Rossum45140f91997-08-29 18:44:06 +0000580 AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000581 BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000582 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000583 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000584 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +0000585 SunOS/5*)
586 if test "$GCC" = "yes"
Greg Warda1c4da22000-11-07 15:44:21 +0000587 then LDSHARED='$(CC) -shared'
Greg Ward57c9a6632000-05-26 12:22:54 +0000588 else LDSHARED="ld -G";
589 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000590 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000591 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000592 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000593 Darwin/*|next/*)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000594 if test "$ns_dyld"
Guido van Rossum5839e582000-10-09 19:52:35 +0000595 then
596 if test "$ac_sys_system" = Darwin
597 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
598 else LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
599 fi
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000600 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
601 fi
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000602 if test "$with_next_framework" ; then
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000603 LDSHARED="$LDSHARED \$(LDLIBRARY)"
604 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000605 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000606 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000607 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000608 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000609 NetBSD*)
610 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
611 then
612 LDSHARED="cc -shared"
613 else
614 LDSHARED="ld -Bshareable"
615 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000616 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000617 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000618 then
619 LDSHARED="cc -shared ${LDFLAGS}"
620 else
621 LDSHARED="ld -Bshareable ${LDFLAGS}"
622 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000623 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000624 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000625 *) LDSHARED="ld";;
626 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000627fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000628AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000629# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000630# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000631AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000632if test -z "$CCSHARED"
633then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000634 case $ac_sys_system/$ac_sys_release in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000635 hp*|HP*) if test "$GCC" = yes;
636 then CCSHARED="-fpic";
637 else CCSHARED="+z";
638 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000639 Linux*) CCSHARED="-fpic";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000640 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000641 OpenBSD*) CCSHARED="-fpic";;
642 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000643 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000644 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000645 IRIX*/6*) case $CC in
646 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000647 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000648 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000649 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000650fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000651AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000652# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000653# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000654AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000655if test -z "$LINKFORSHARED"
656then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000657 case $ac_sys_system/$ac_sys_release in
Guido van Rossum69f65801998-03-03 21:47:00 +0000658 AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000659 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000660 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000661 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000662 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000663 # -u libsys_s pulls in all symbols in libsys
664 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
665 # -u __dummy makes the linker aware of the objc runtime
666 # in System.framework; otherwise, __objcInit (referenced in
667 # crt1.o) gets erroneously defined as common, which breaks dynamic
668 # loading of any modules which reference it in System.framework
669 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Guido van Rossum5839e582000-10-09 19:52:35 +0000670 Darwin/*) LINKFORSHARED="-framework System" ;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000671 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000672 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000673 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000674 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
675 then
676 LINKFORSHARED="-Wl,--export-dynamic"
677 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000678 SunOS/5*) case $CC in
679 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000680 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000681 then
682 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000683 fi;;
684 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000685 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000686fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000687AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000688
Guido van Rossum627b2d71993-12-24 10:39:16 +0000689# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000690AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
691AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000692
Skip Montanarocb853262000-08-30 22:29:48 +0000693# Check for --with-pydebug
694AC_MSG_CHECKING(for --with-pydebug)
695AC_ARG_WITH(pydebug,
696[ --with-pydebug build with Py_DEBUG defined], [
697if test "$withval" != no
698then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes)
699else AC_MSG_RESULT(no)
700fi],
701[AC_MSG_RESULT(no)])
702
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000703# checks for system dependent C++ extensions support
704case "$ac_sys_system" in
705 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
706 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
707 [loadAndInit("", 0, "")],
708 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
709 AC_MSG_RESULT(yes)],
710 [AC_MSG_RESULT(no)]);;
711 *) ;;
712esac
713
Guido van Rossum70c7f481998-03-26 18:44:10 +0000714# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
715# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000716# BeOS' sockets are stashed in libnet.
717case "$ac_sys_system" in
718IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000719*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000720AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000721AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000722;;
723esac
724case "$ac_sys_system" in
725BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000726AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
727;;
728esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000729
Guido van Rossumc5a39031996-07-31 17:35:03 +0000730AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000731AC_ARG_WITH(libs,
732[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000733AC_MSG_RESULT($withval)
734LIBS="$withval $LIBS"
735], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000736
Guido van Rossum009f7871997-12-04 00:51:42 +0000737AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000738USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000739
Guido van Rossum54d93d41997-01-22 20:51:58 +0000740AC_MSG_CHECKING(for --with-dec-threads)
741AC_SUBST(LDLAST)
742AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000743[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
744AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000745LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000746if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000747 with_thread="$withval";
748fi],
749AC_MSG_RESULT(no))
750
751AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000752AC_ARG_WITH(threads,
753[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000754
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000755# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000756AC_ARG_WITH(thread,
757[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
758with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000759
760if test -z "$with_threads"
761then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000762fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000763AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000764
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000765if test "$with_threads" = "no"
766then
767 USE_THREAD_MODULE="#"
768else
Guido van Rossum40951012000-10-07 16:21:27 +0000769 if test ! -z "$with_threads" -a -d "$with_threads"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000770 then LDFLAGS="$LDFLAGS -L$with_threads"
771 fi
Guido van Rossum40951012000-10-07 16:21:27 +0000772 if test ! -z "$withval" -a -d "$withval"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000773 then LDFLAGS="$LDFLAGS -L$withval"
774 fi
775 AC_DEFINE(_REENTRANT)
776 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
777 AC_DEFINE(C_THREADS)
778 LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum9e8181b2000-09-19 00:46:46 +0000779 AC_MSG_CHECKING(for --with-pth)
780 AC_ARG_WITH(pth,
781 [ --with-pth use GNU pth threading libraries], [
782 AC_MSG_RESULT($withval)
783 AC_DEFINE(WITH_THREAD)
784 AC_DEFINE(HAVE_PTH)
785 LIBS="-lpth $LIBS"
786 LIBOBJS="$LIBOBJS thread.o"],[
787 AC_MSG_RESULT(no)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000788 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
789 AC_DEFINE(_POSIX_THREADS)
790 LIBS="-lpthread $LIBS"
791 LIBOBJS="$LIBOBJS thread.o"],[
792 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Guido van Rossum5839e582000-10-09 19:52:35 +0000793 case $ac_sys_system in
794 Darwin*) ;;
795 *) AC_DEFINE(_POSIX_THREADS);;
796 esac
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000797 LIBOBJS="$LIBOBJS thread.o"],[
798 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
799 AC_DEFINE(BEOS_THREADS)
800 LIBOBJS="$LIBOBJS thread.o"],[
801 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
802 AC_DEFINE(_POSIX_THREADS)
803 LIBS="$LIBS -lpthreads"
804 LIBOBJS="$LIBOBJS thread.o"], [
805 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
806 AC_DEFINE(_POSIX_THREADS)
807 LIBS="$LIBS -lc_r"
808 LIBOBJS="$LIBOBJS thread.o"], [
809 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
810 AC_DEFINE(_POSIX_THREADS)
811 LIBS="$LIBS -lthread"
812 LIBOBJS="$LIBOBJS thread.o"], [
Guido van Rossum8d6e8af2000-10-30 17:45:07 +0000813 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
814 AC_DEFINE(_POSIX_THREADS)
815 LIBS="$LIBS -lpthread"
816 LIBOBJS="$LIBOBJS thread.o"], [
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000817 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
818 AC_DEFINE(_POSIX_THREADS)
819 LIBS="$LIBS -lcma"
Thomas Wouters0db2b2b2000-08-26 11:33:43 +0000820 LIBOBJS="$LIBOBJS thread.o"],[
821 USE_THREAD_MODULE="#"])
Guido van Rossum8d6e8af2000-10-30 17:45:07 +0000822 ])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000823
824 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
825 LIBS="$LIBS -lmpc"
Thomas Wouters0db2b2b2000-08-26 11:33:43 +0000826 LIBOBJS="$LIBOBJS thread.o"
827 USE_THREAD_MODULE=""])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000828 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
829 LIBS="$LIBS -lthread"
Thomas Wouters0db2b2b2000-08-26 11:33:43 +0000830 LIBOBJS="$LIBOBJS thread.o"
831 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +0000832
833 if test "$USE_THREAD_MODULE" != "#"
834 then
835 # If the above checks didn't disable threads, (at least) OSF1
836 # needs this '-threads' argument during linking.
837 case $ac_sys_system in
838 OSF1) LDLAST=-threads;;
839 esac
840 fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000841fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000842
Barry Warsawef82cd72000-06-30 16:21:01 +0000843# Check for GC support
844AC_SUBST(USE_GC_MODULE)
845USE_GC_MODULE=""
846AC_MSG_CHECKING(for --with-cycle-gc)
847AC_ARG_WITH(cycle-gc,
848[ --with(out)-cycle-gc disable/enable garbage collection])
849
850if test -z "$with_cycle_gc"
851then with_cycle_gc="yes"
852fi
853if test "$with_cycle_gc" = "no"
854then
855 USE_GC_MODULE="#"
856else
857 AC_DEFINE(WITH_CYCLE_GC)
858fi
859AC_MSG_RESULT($with_cycle_gc)
860
Fred Drakec9cb8472000-08-31 16:11:07 +0000861# Check for LIBDB support
862# either --with-libdb or, in its absence, the presence of db.h
863AC_SUBST(USE_BSDDB_MODULE)
864USE_BSDDB_MODULE=""
865AC_MSG_CHECKING(for --with-libdb)
866AC_ARG_WITH(libdb,
867[ --with(out)-libdb disable/enable bsddb module])
868
Skip Montanarob89f41e2000-09-04 04:06:05 +0000869# enabled by default, but db.h must be found
870if test "$ac_cv_header_db_h" = "yes"
871then
872 if test "$with_libdb" != "no"
873 then with_libdb="yes"
874 fi
875else
Fred Drake5790be12000-10-09 17:06:13 +0000876 # make sure user knows why bsddb support wasn't enabled even
Skip Montanarob89f41e2000-09-04 04:06:05 +0000877 # though s/he requested it
878 if test "$with_libdb" = "yes"
879 then echo $ac_n "(requested, but db.h was not found) $ac_c"
880 fi
881 with_libdb="no"
Fred Drakec9cb8472000-08-31 16:11:07 +0000882fi
Skip Montanarob89f41e2000-09-04 04:06:05 +0000883
Fred Drakec9cb8472000-08-31 16:11:07 +0000884if test "$with_libdb" = "no"
885then
886 USE_BSDDB_MODULE="#"
887else
888 AC_DEFINE(WITH_LIBDB)
889fi
890AC_MSG_RESULT($with_libdb)
891
Skip Montanaroed33c9a2000-09-08 02:17:15 +0000892if test "$with_libdb" = "yes"
893then
894 # check for libdb; BSD systems have the DB routines in libc --tg
895 AC_SUBST(HAVE_LIBDB)
Martin v. Löwis05a65d62000-09-24 19:40:25 +0000896 # If dbopen is not in libc, then checking whether it is in libdb
897 # is difficult: db_185.h may #define it as __db185_open
898 # Instead, we just trust it is in libdb; linking will fail if it
899 # is not.
900 AC_CHECK_FUNC(dbopen, [HAVE_LIBDB=], [HAVE_LIBDB=-ldb])
Skip Montanaroed33c9a2000-09-08 02:17:15 +0000901fi
902
Barry Warsawef82cd72000-06-30 16:21:01 +0000903# Check for --with-wctype-functions
904AC_MSG_CHECKING(for --with-wctype-functions)
905AC_ARG_WITH(wctype-functions,
906[ --with-wctype-functions use wctype.h functions], [
907if test "$withval" != no
908then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
909else AC_MSG_RESULT(no)
910fi],
911[AC_MSG_RESULT(no)])
912
Guido van Rossum68242b51996-05-28 22:53:03 +0000913# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000914AC_SUBST(DLINCLDIR)
915DLINCLDIR=/
916
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000917AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000918AC_ARG_WITH(sgi-dl,
919[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000920AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000921AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +0000922DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000923dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +0000924if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000925then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000926else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
927fi
928DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000929LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000930
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000931AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000932AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000933AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000934AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +0000935DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000936dldir=`echo "$withval" | sed 's/,.*//'`
937dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +0000938if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000939then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000940else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
941fi
942DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000943LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000944
Guido van Rossume97ee181999-12-20 21:27:22 +0000945# the dlopen() function means we might want to use dynload_shlib.o. some
946# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +0000947AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +0000948
949# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
950# loading of modules.
951AC_SUBST(DYNLOADFILE)
952AC_MSG_CHECKING(DYNLOADFILE)
953if test -z "$DYNLOADFILE"
954then
955 case $ac_sys_system/$ac_sys_release in
956 AIX*) DYNLOADFILE="dynload_aix.o";;
957 BeOS*) DYNLOADFILE="dynload_beos.o";;
958 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Guido van Rossum5839e582000-10-09 19:52:35 +0000959 Darwin/*|next/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +0000960 *)
961 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
962 # out any dynamic loading
963 if test "$ac_cv_func_dlopen" = yes
964 then DYNLOADFILE="dynload_shlib.o"
965 else DYNLOADFILE="dynload_stub.o"
966 fi
967 ;;
968 esac
969fi
970AC_MSG_RESULT($DYNLOADFILE)
971if test "$DYNLOADFILE" != "dynload_stub.o"
972then
973 AC_DEFINE(HAVE_DYNAMIC_LOADING)
974fi
975
Guido van Rossum627b2d71993-12-24 10:39:16 +0000976# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +0000977AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +0000978 flock fork fsync fdatasync fpathconf ftime ftruncate \
Andrew M. Kuchling78a14422000-11-29 02:44:05 +0000979 getgroups getline getlogin getpeername getpid getpwent getwd \
Andrew M. Kuchling898527b2000-06-18 14:54:13 +0000980 kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000981 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +0000982 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +0000983 select setegid seteuid setgid \
Thomas Wouters3a584202000-08-05 23:28:51 +0000984 setlocale setregid setreuid setsid setpgid setuid setvbuf \
Fred Drake35a092f1999-12-13 16:23:35 +0000985 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +0000986 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Wouters70c21a12000-07-14 14:28:33 +0000987 truncate uname waitpid _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000988
Fred Drake8cef4cf2000-06-28 16:40:38 +0000989# check for openpty and forkpty
990
991AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
992AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
993
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000994# check for long file support functions
995AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
996
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000997AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +0000998AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
999AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1000AC_CHECK_FUNCS(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 +00001001
1002# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001003AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001004AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001005AC_STRUCT_TIMEZONE
1006
1007AC_MSG_CHECKING(for time.h that defines altzone)
1008AC_CACHE_VAL(ac_cv_header_time_altzone,
1009[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1010 ac_cv_header_time_altzone=yes,
1011 ac_cv_header_time_altzone=no)])
1012AC_MSG_RESULT($ac_cv_header_time_altzone)
1013if test $ac_cv_header_time_altzone = yes; then
1014 AC_DEFINE(HAVE_ALTZONE)
1015fi
1016
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001017was_it_defined=no
1018AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001019AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001020#include <sys/types.h>
1021#include <sys/select.h>
1022#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001023], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1024AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001025
1026# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001027
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001028AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001029AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001030
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001031works=no
1032AC_MSG_CHECKING(for working volatile)
1033AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1034AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001035
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001036works=no
1037AC_MSG_CHECKING(for working signed char)
1038AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1039AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001040
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001041have_prototypes=no
1042AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001043AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1044AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001045AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001046
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001047works=no
1048AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001049AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001050#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001051int foo(int x, ...) {
1052 va_list va;
1053 va_start(va, x);
1054 va_arg(va, int);
1055 va_arg(va, char *);
1056 va_arg(va, double);
1057 return 0;
1058}
1059], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001060AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1061AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001062
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001063if test "$have_prototypes" = yes; then
1064bad_prototypes=no
1065AC_MSG_CHECKING(for bad exec* prototypes)
1066AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1067 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1068AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001069fi
1070
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001071bad_forward=no
1072AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001073AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001074struct s { int a; int b; };
1075static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001076int foobar() {
1077 static int random;
1078 random = (int) &foo;
1079 return random;
1080}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001081static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001082main() {
1083 exit(!((int)&foo == foobar()));
1084}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001085], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
1086AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001087
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001088va_list_is_array=no
1089AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001090AC_TRY_COMPILE([
1091#ifdef HAVE_STDARG_PROTOTYPES
1092#include <stdarg.h>
1093#else
1094#include <varargs.h>
1095#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001096], [va_list list1, list2; list1 = list2;], ,
1097AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1098AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001099
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001100# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1101AC_CHECK_FUNC(gethostbyname_r, [
1102 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1103 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1104 OLD_CFLAGS=$CFLAGS
1105 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1106 AC_TRY_COMPILE([
1107# include <netdb.h>
1108 ], [
1109 char *name;
1110 struct hostent *he, *res;
1111 char buffer[2048];
1112 int buflen = 2048;
1113 int h_errnop;
1114
1115 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1116 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001117 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001118 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1119 AC_MSG_RESULT(yes)
1120 ], [
1121 AC_MSG_RESULT(no)
1122 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1123 AC_TRY_COMPILE([
1124# include <netdb.h>
1125 ], [
1126 char *name;
1127 struct hostent *he;
1128 char buffer[2048];
1129 int buflen = 2048;
1130 int h_errnop;
1131
1132 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1133 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001134 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001135 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1136 AC_MSG_RESULT(yes)
1137 ], [
1138 AC_MSG_RESULT(no)
1139 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1140 AC_TRY_COMPILE([
1141# include <netdb.h>
1142 ], [
1143 char *name;
1144 struct hostent *he;
1145 struct hostent_data data;
1146
1147 (void) gethostbyname_r(name, he, &data);
1148 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001149 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001150 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1151 AC_MSG_RESULT(yes)
1152 ], [
1153 AC_MSG_RESULT(no)
1154 ])
1155 ])
1156 ])
1157 CFLAGS=$OLD_CFLAGS
1158], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001159 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001160])
1161AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1162AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1163AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001164AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001165AC_SUBST(HAVE_GETHOSTBYNAME)
1166
Guido van Rossum627b2d71993-12-24 10:39:16 +00001167# checks for system services
1168# (none yet)
1169
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001170# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001171AC_CHECK_FUNC(__fpu_control,
1172 [],
1173 [AC_CHECK_LIB(ieee, __fpu_control)
1174])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001175
Guido van Rossum93274221997-05-09 02:42:00 +00001176# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001177AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001178AC_ARG_WITH(fpectl,
1179[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001180if test "$withval" != no
1181then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1182else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001183fi],
1184[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001185
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001186# check for --with-libm=...
1187AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001188case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001189Darwin) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001190next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001191BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001192*) LIBM=-lm
1193esac
Guido van Rossum93274221997-05-09 02:42:00 +00001194AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001195AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001196if test "$withval" = no
1197then LIBM=
1198 AC_MSG_RESULT(force LIBM empty)
1199elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001200then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001201 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001202else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001203fi],
1204[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001205
1206# check for --with-libc=...
1207AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001208AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001209AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001210if test "$withval" = no
1211then LIBC=
1212 AC_MSG_RESULT(force LIBC empty)
1213elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001214then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001215 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001216else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001217fi],
1218[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001219
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001220# check for hypot() in math library
1221LIBS_SAVE=$LIBS
1222LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001223AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001224LIBS=$LIBS_SAVE
1225
Guido van Rossumad713701997-07-10 22:42:38 +00001226# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001227AC_MSG_CHECKING(what malloc(0) returns)
1228AC_CACHE_VAL(ac_cv_malloc_zero,
1229[AC_TRY_RUN([#include <stdio.h>
1230#ifdef HAVE_STDLIB
1231#include <stdlib.h>
1232#else
1233char *malloc(), *realloc();
1234int *free();
1235#endif
1236main() {
1237 char *p;
1238 p = malloc(0);
1239 if (p == NULL) exit(1);
1240 p = realloc(p, 0);
1241 if (p == NULL) exit(1);
1242 free(p);
1243 exit(0);
1244}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1245AC_MSG_RESULT($ac_cv_malloc_zero)
1246if test "$ac_cv_malloc_zero" = null
1247then
1248 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1249fi
1250
Guido van Rossumef2255b2000-03-10 22:30:29 +00001251# check for wchar.h
1252AC_CHECK_HEADER(wchar.h,
1253AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1254wchar_h="no"
1255)
1256
1257# check for usable wchar_t
1258usable_wchar_t="unkown"
1259AC_MSG_CHECKING(for usable wchar_t)
1260AC_TRY_RUN([
1261#include "wchar.h"
1262#include "wctype.h"
1263main() {
1264 wchar_t s;
1265 if (sizeof(s) == 2)
1266 exit(0);
1267 else
1268 exit(1);
1269}
1270],
1271AC_DEFINE(HAVE_USABLE_WCHAR_T) usable_wchar_t="yes",
1272usable_wchar_t="no")
1273AC_MSG_RESULT($usable_wchar_t)
1274
1275# check for endianness
1276AC_C_BIGENDIAN
1277
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001278# Check whether right shifting a negative integer extends the sign bit
1279# or fills with zeros (like the Cray J90, according to Tim Peters).
1280AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001281AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001282AC_TRY_RUN([
1283int main()
1284{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001285 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001286}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001287], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1288AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1289if test "$ac_cv_rshift_extends_sign" = no
1290then
1291 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1292fi
1293
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001294# check for getc_unlocked and related locking functions
1295AC_MSG_CHECKING(for getc_unlocked() and friends)
1296AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1297AC_TRY_LINK([#include <stdio.h>],[
1298 FILE *f = fopen("/dev/null", "r");
1299 flockfile(f);
1300 getc_unlocked(f);
1301 funlockfile(f);
1302], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1303AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1304if test "$ac_cv_have_getc_unlocked" = yes
1305then
1306 AC_DEFINE(HAVE_GETC_UNLOCKED)
1307fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001308
Guido van Rossum95713eb2000-05-18 20:53:31 +00001309# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1310# Add sys/socket.h to confdefs.h
1311cat >> confdefs.h <<\EOF
1312#ifdef HAVE_SYS_SOCKET_H
1313#include <sys/socket.h>
1314#endif
1315EOF
1316AC_CHECK_TYPE(socklen_t, int)
1317
Fred Drake036144d2000-10-26 17:09:35 +00001318AC_MSG_CHECKING(for Modules/Setup)
1319if test ! -f Modules/Setup ; then
Fred Drake884d3ba2000-11-02 17:52:56 +00001320 if test ! -d Modules ; then
1321 mkdir Modules
1322 fi
Fred Drake036144d2000-10-26 17:09:35 +00001323 cp "$srcdir/Modules/Setup.dist" Modules/Setup
1324 AC_MSG_RESULT(creating)
1325else
1326 AC_MSG_RESULT(already exists)
1327fi
1328
Guido van Rossum627b2d71993-12-24 10:39:16 +00001329# generate output files
Guido van Rossumb418f891996-07-30 18:06:02 +00001330AC_OUTPUT(Makefile \
1331 Objects/Makefile \
1332 Parser/Makefile \
Sjoerd Mullender59bb0802000-08-17 11:38:18 +00001333 Grammar/Makefile \
Guido van Rossumb418f891996-07-30 18:06:02 +00001334 Python/Makefile \
Guido van Rossum009f7871997-12-04 00:51:42 +00001335 Modules/Makefile.pre \
Barry Warsawef82cd72000-06-30 16:21:01 +00001336 Modules/Setup.config)