blob: 0fd8cee28588c6230532eeaaa1eb6aae07c86f73 [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)
Neil Schemenauer7d645772001-01-17 21:59:33 +00009VERSION=2.1
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 Rossum627b2d71993-12-24 10:39:16 +000085# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000086AC_MSG_CHECKING(for --without-gcc)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000087AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000088 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000089 no) CC=cc
90 without_gcc=yes;;
91 yes) CC=gcc
92 without_gcc=no;;
93 *) CC=$withval
94 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +000095 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +000096 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +000097 OSF1) CC=cc
98 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +000099 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000100 case $BE_HOST_CPU in
101 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000102 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000103 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000104 OPT="-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma"
105 CCSHARED="UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000106 LDFLAGS="$LDFLAGS -nodup"
107
108 AR="$PWD/BeOS/ar-fake"
109 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000110 ;;
111 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000112 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000113 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000114 OPT=-O
115 # Really should use srcdir instead of PWD
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000116 AR="$PWD/BeOS/ar-fake"
117 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000118 ;;
119 *)
Fred Drake5790be12000-10-09 17:06:13 +0000120 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000121 ;;
122 esac
123 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000124 Monterey*)
125 RANLIB=:
126 without_gcc=;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000127 *) without_gcc=no;;
128 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000129AC_MSG_RESULT($without_gcc)
130
Guido van Rossum27552902001-01-23 01:52:26 +0000131AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000132AC_SUBST(MAINOBJ)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000133MAINOBJ=Modules/python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000134AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000135AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000136 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000137 case $withval in
138 no) CXX=
139 with_cxx=no;;
140 *) CXX=$withval
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000141 MAINOBJ=Modules/ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000142 with_cxx=$withval;;
143 esac], [
144 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000145 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000146])
147AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000148
149dnl The following fragment works similar to AC_PROG_CXX.
150dnl It does not fail if CXX is not found, and it is not executed if
151dnl --with-cxx was given.
152dnl Finally, it does not test whether CXX is g++.
153
154if test "$check_cxx" = "yes"
155then
156 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
157 if test "$CXX" = "notfound"
158 then
159 CXX=
160 else
161 AC_PROG_CXX_WORKS
162 fi
163fi
164
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000165# If the user switches compilers, we can't believe the cache
166if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
167then
168 AC_ERROR(cached CC is different -- throw away $cache_file
169(it is also a good idea to do 'make clean' before compiling))
170fi
171
Guido van Rossum627b2d71993-12-24 10:39:16 +0000172AC_PROG_CC
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000173AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000174AC_MSG_CHECKING(for --with-suffix)
175AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
176 case $withval in
177 no) EXEEXT=;;
178 yes) EXEEXT=.exe;;
179 *) EXEEXT=$withval;;
180 esac])
181AC_MSG_RESULT($EXEEXT)
Guido van Rossumfb842551997-08-06 23:42:07 +0000182
Guido van Rossumdd997f71998-10-07 19:58:26 +0000183case $MACHDEP in
184bsdos*)
185 case $CC in
186 gcc) CC="$CC -D_HAVE_BSDI";;
187 esac;;
188esac
189
Guido van Rossum84561611997-08-21 00:08:11 +0000190case $ac_sys_system in
191hp*|HP*)
192 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000193 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000194 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000195Monterey*)
196 case $CC in
197 cc) CC="$CC -Wl,-Bexport";;
198 esac;;
Guido van Rossum84561611997-08-21 00:08:11 +0000199esac
200
Neil Schemenauer61c51152001-01-26 16:18:16 +0000201AC_SUBST(LIBRARY)
202AC_MSG_CHECKING(LIBRARY)
203if test -z "$LIBRARY"
204then
205 LIBRARY='libpython$(VERSION).a'
206fi
207AC_MSG_RESULT($LIBRARY)
208
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000209# LDLIBRARY is the name of the library to link against (as opposed to the
210# name of the library into which to insert object files). On systems
211# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
Guido van Rossumaef734b2001-01-10 21:09:12 +0000212# the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the
213# shared (i.e., DLL) library.
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000214AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000215AC_SUBST(DLLLIBRARY)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000216LDLIBRARY="$LIBRARY"
Guido van Rossum27552902001-01-23 01:52:26 +0000217DLLLIBRARY=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000218
Guido van Rossumfb842551997-08-06 23:42:07 +0000219# LINKCC is the command that links the python executable -- default is $(CC).
Fred Drake5790be12000-10-09 17:06:13 +0000220# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000221# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000222AC_SUBST(LINKCC)
223AC_MSG_CHECKING(LINKCC)
224if test -z "$LINKCC"
225then
226 case $ac_sys_system in
227 AIX*)
Guido van Rossum45140f91997-08-29 18:44:06 +0000228 LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000229 dgux*)
230 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000231 Monterey64*)
232 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000233 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000234 esac
235fi
236AC_MSG_RESULT($LINKCC)
237
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000238AC_MSG_CHECKING(LDLIBRARY)
239
240# NeXT framework builds require that the 'ar' library be converted into
241# a bundle using libtool.
242if test "$with_next_framework"
243then
244 LDLIBRARY='libpython$(VERSION).dylib'
245fi
246
247# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000248case $MACHDEP in
249dguxR4)
250 LDLIBRARY='libpython$(VERSION).so'
251 OPT="$OPT -pic"
252 ;;
253beos*)
254 LDLIBRARY='libpython$(VERSION).so'
255 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000256cygwin*)
257 LDLIBRARY='libpython$(VERSION).dll.a'
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000258 DLLLIBRARY='libpython$(VERSION).dll'
Guido van Rossumaef734b2001-01-10 21:09:12 +0000259 ;;
Fred Drake5790be12000-10-09 17:06:13 +0000260esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000261AC_MSG_RESULT($LDLIBRARY)
262
Guido van Rossum627b2d71993-12-24 10:39:16 +0000263AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000264AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000265AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000266AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000267
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000268# Not every filesystem supports hard links
269AC_SUBST(LN)
270if test -z "$LN" ; then
271 case $ac_sys_system in
272 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000273 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000274 *) LN=ln;;
275 esac
276fi
277
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000278# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000279AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000280if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000281then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000282 case $GCC in
283 yes)
284 case $ac_cv_prog_cc_g in
Neil Schemenauer61c51152001-01-26 16:18:16 +0000285 yes) OPT="-g -O2 -Wall -Wstrict-prototypes";;
286 *) OPT="-O2 -Wall -Wstrict-prototypes";;
Guido van Rossumb5875b61997-07-18 23:29:09 +0000287 esac
288 ;;
Guido van Rossumb418f891996-07-30 18:06:02 +0000289 *) OPT="-O";;
290 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000291fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000292
Trent Mick635f6fb2000-08-23 21:33:05 +0000293# The current (beta) Monterey compiler dies with optimizations
294case $ac_sys_system in
295Monterey*) OPT="";;
296esac
297
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000298if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000299then
300 OPT="$OPT $ac_arch_flags"
301fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000302# checks for UNIX variants that set C preprocessor variables
303AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000304AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000305
Guido van Rossum91922671997-10-09 20:24:13 +0000306AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
307AC_CACHE_VAL(ac_cv_opt_olimit_ok,
308[ac_save_cc="$CC"
309CC="$CC -OPT:Olimit=0"
310AC_TRY_RUN([int main() { return 0; }],
311 ac_cv_opt_olimit_ok=yes,
312 ac_cv_opt_olimit_ok=no)
313CC="$ac_save_cc"])
314AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000315if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000316 case $ac_sys_system in
317 Darwin*) OPT="$OPT" ;;
318 *) OPT="$OPT -OPT:Olimit=0";;
319 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000320else
321 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
322 AC_CACHE_VAL(ac_cv_olimit_ok,
323 [ac_save_cc="$CC"
324 CC="$CC -Olimit 1500"
325 AC_TRY_RUN([int main() { return 0; }],
326 ac_cv_olimit_ok=yes,
327 ac_cv_olimit_ok=no)
328 CC="$ac_save_cc"])
329 AC_MSG_RESULT($ac_cv_olimit_ok)
330 if test $ac_cv_olimit_ok = yes; then
331 OPT="$OPT -Olimit 1500"
332 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000333fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000334
Fred Drakece81d592000-07-09 14:39:29 +0000335dnl # check for ANSI or K&R ("traditional") preprocessor
336dnl AC_MSG_CHECKING(for C preprocessor type)
337dnl AC_TRY_COMPILE([
338dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
339dnl int foo;
340dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
341dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
342dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000343
Guido van Rossum627b2d71993-12-24 10:39:16 +0000344# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000345AC_HEADER_STDC
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000346AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000347signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drakec9cb8472000-08-31 16:11:07 +0000348sys/audioio.h sys/file.h sys/lock.h db_185.h db.h \
Guido van Rossum95713eb2000-05-18 20:53:31 +0000349sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000350sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
351ndbm.h db1/ndbm.h gdbm/ndbm.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000352AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000353
354# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000355was_it_defined=no
356AC_MSG_CHECKING(for clock_t in time.h)
357AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
358AC_MSG_RESULT($was_it_defined)
359
Guido van Rossum300fda71996-08-19 21:58:16 +0000360# Add some code to confdefs.h so that the test for off_t works on SCO
361cat >> confdefs.h <<\EOF
362#if defined(SCO_DS)
363#undef _OFF_T
364#endif
365EOF
366
Guido van Rossumef2255b2000-03-10 22:30:29 +0000367# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000368AC_TYPE_MODE_T
369AC_TYPE_OFF_T
370AC_TYPE_PID_T
371AC_TYPE_SIGNAL
372AC_TYPE_SIZE_T
373AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000374
Guido van Rossumef2255b2000-03-10 22:30:29 +0000375# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000376AC_CHECK_SIZEOF(int)
377AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000378AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000379AC_CHECK_SIZEOF(char)
380AC_CHECK_SIZEOF(short)
381AC_CHECK_SIZEOF(float)
382AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000383AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000384
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000385AC_MSG_CHECKING(for long long support)
386have_long_long=no
387AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
388AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000389if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000390AC_CHECK_SIZEOF(long long)
391fi
392
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000393AC_MSG_CHECKING(for uintptr_t support)
394have_uintptr_t=no
395AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
396AC_MSG_RESULT($have_uintptr_t)
397if test "$have_uintptr_t" = yes ; then
398AC_CHECK_SIZEOF(uintptr_t)
399fi
400
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000401# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
402AC_MSG_CHECKING(size of off_t)
403AC_CACHE_VAL(ac_cv_sizeof_off_t,
404[AC_TRY_RUN([#include <stdio.h>
405#include <sys/types.h>
406main()
407{
408 FILE *f=fopen("conftestval", "w");
409 if (!f) exit(1);
410 fprintf(f, "%d\n", sizeof(off_t));
411 exit(0);
412}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
413])
414AC_MSG_RESULT($ac_cv_sizeof_off_t)
415AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
416
417AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000418if test "$have_long_long" = yes -a \
419 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
420 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000421 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
422 AC_MSG_RESULT(yes)
423else
424 AC_MSG_RESULT(no)
425fi
426
Fred Drakea3f6e912000-06-29 20:44:47 +0000427# AC_CHECK_SIZEOF() doesn't include <time.h>.
428AC_MSG_CHECKING(size of time_t)
429AC_CACHE_VAL(ac_cv_sizeof_time_t,
430[AC_TRY_RUN([#include <stdio.h>
431#include <time.h>
432main()
433{
434 FILE *f=fopen("conftestval", "w");
435 if (!f) exit(1);
436 fprintf(f, "%d\n", sizeof(time_t));
437 exit(0);
438}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
439])
440AC_MSG_RESULT($ac_cv_sizeof_time_t)
441AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
442
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000443
Trent Mick635f6fb2000-08-23 21:33:05 +0000444# if have pthread_t then define SIZEOF_PTHREAD_T
445AC_MSG_CHECKING(for pthread_t)
446have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000447AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000448AC_MSG_RESULT($have_pthread_t)
449if test "$have_pthread_t" = yes ; then
450 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
451 AC_MSG_CHECKING(size of pthread_t)
452 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
453 [AC_TRY_RUN([#include <stdio.h>
454 #include <pthread.h>
455 main()
456 {
457 FILE *f=fopen("conftestval", "w");
458 if (!f) exit(1);
459 fprintf(f, "%d\n", sizeof(pthread_t));
460 exit(0);
461 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
462 ])
463 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
464 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
465fi
466
467
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000468# Minor variations in building a framework between NextStep versions 4 and 5
469AC_SUBST(LIBTOOL_CRUFT)
470case $ac_sys_system/$ac_sys_release in
Guido van Rossum5839e582000-10-09 19:52:35 +0000471 Darwin/*)
472 ns_undef_sym='_environ'
473 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000474 next/4*)
475 ns_undef_sym='__environ'
476 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
477 next/5*)
478 ns_undef_sym='_environ'
479 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
480esac
481
482AC_MSG_CHECKING(for --with-next-framework)
483if test "$with_next_framework"
484then
485 OPT="$OPT -fno-common"
486 # -U __environ is needed since bundles don't have access
487 # to crt0 when built but will always be linked against it
488 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
489 AC_DEFINE(WITH_NEXT_FRAMEWORK)
490 AC_MSG_RESULT(yes)
491else
492 AC_MSG_RESULT(no)
493fi
494
495AC_MSG_CHECKING(for --with-dyld)
496if test "$with_next_framework" -o "$with_dyld"
497then
498 if test "$with_dyld"
499 then
500 AC_MSG_RESULT(yes)
501 else
502 AC_MSG_RESULT(required for framework build)
503 fi
504 AC_DEFINE(WITH_DYLD)
505 ns_dyld='set'
506else
507 AC_MSG_RESULT(no)
508fi
509
Guido van Rossumac405f61994-09-12 10:56:06 +0000510# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000511AC_SUBST(SO)
512AC_SUBST(LDSHARED)
513AC_SUBST(CCSHARED)
514AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000515# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000516# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000517AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000518if test -z "$SO"
519then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000520 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000521 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000522 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000523 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000524 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000525fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000526AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000527# LDSHARED is the ld *command* used to create shared library
528# -- "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 +0000529# (Shared libraries in this instance are shared modules to be loaded into
530# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000531AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000532if test -z "$LDSHARED"
533then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000534 case $ac_sys_system/$ac_sys_release in
Guido van Rossum45140f91997-08-29 18:44:06 +0000535 AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000536 BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000537 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000538 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000539 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +0000540 SunOS/5*)
541 if test "$GCC" = "yes"
Greg Warda1c4da22000-11-07 15:44:21 +0000542 then LDSHARED='$(CC) -shared'
Greg Ward57c9a6632000-05-26 12:22:54 +0000543 else LDSHARED="ld -G";
544 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000545 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000546 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000547 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000548 Darwin/*|next/*)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000549 if test "$ns_dyld"
Guido van Rossumacb14c72001-01-10 21:41:16 +0000550 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000551 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
552 fi
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000553 if test "$with_next_framework" ; then
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000554 LDSHARED="$LDSHARED \$(LDLIBRARY)"
555 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000556 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000557 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000558 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000559 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000560 NetBSD*)
561 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
562 then
563 LDSHARED="cc -shared"
564 else
565 LDSHARED="ld -Bshareable"
566 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000567 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000568 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000569 then
570 LDSHARED="cc -shared ${LDFLAGS}"
571 else
572 LDSHARED="ld -Bshareable ${LDFLAGS}"
573 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000574 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000575 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000576 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000577 *) LDSHARED="ld";;
578 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000579fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000580AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000581# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000582# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000583AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000584if test -z "$CCSHARED"
585then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000586 case $ac_sys_system/$ac_sys_release in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000587 hp*|HP*) if test "$GCC" = yes;
588 then CCSHARED="-fpic";
589 else CCSHARED="+z";
590 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000591 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000592 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000593 OpenBSD*) CCSHARED="-fpic";;
594 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000595 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000596 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000597 IRIX*/6*) case $CC in
598 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000599 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000600 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000601 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000602 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000603fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000604AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000605# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000606# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000607AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000608if test -z "$LINKFORSHARED"
609then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000610 case $ac_sys_system/$ac_sys_release in
Guido van Rossum69f65801998-03-03 21:47:00 +0000611 AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000612 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000613 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000614 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000615 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000616 # -u libsys_s pulls in all symbols in libsys
617 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
618 # -u __dummy makes the linker aware of the objc runtime
619 # in System.framework; otherwise, __objcInit (referenced in
620 # crt1.o) gets erroneously defined as common, which breaks dynamic
621 # loading of any modules which reference it in System.framework
622 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Guido van Rossumacb14c72001-01-10 21:41:16 +0000623 Darwin/*) LINKFORSHARED="-u __dummy -framework System -framework Foundation" ;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000624 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000625 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000626 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000627 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
628 then
629 LINKFORSHARED="-Wl,--export-dynamic"
630 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000631 SunOS/5*) case $CC in
632 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000633 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000634 then
635 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000636 fi;;
637 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000638 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000639fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000640AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000641
Neil Schemenauer61c51152001-01-26 16:18:16 +0000642AC_SUBST(CFLAGSFORSHARED)
643AC_MSG_CHECKING(CFLAGSFORSHARED)
644if test ! "$LIBRARY" = "$LDLIBRARY"
645then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000646 case $ac_sys_system in
647 CYGWIN*)
648 # Cygwin needs CCSHARED when building extension DLLs
649 # but not when building the interpreter DLL.
650 CFLAGSFORSHARED='';;
651 *)
652 CFLAGSFORSHARED='$(CCSHARED)'
653 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000654fi
655AC_MSG_RESULT($CFLAGSFORSHARED)
656
Guido van Rossum627b2d71993-12-24 10:39:16 +0000657# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000658AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
659AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000660
Skip Montanarocb853262000-08-30 22:29:48 +0000661# Check for --with-pydebug
662AC_MSG_CHECKING(for --with-pydebug)
663AC_ARG_WITH(pydebug,
664[ --with-pydebug build with Py_DEBUG defined], [
665if test "$withval" != no
666then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes)
667else AC_MSG_RESULT(no)
668fi],
669[AC_MSG_RESULT(no)])
670
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000671# checks for system dependent C++ extensions support
672case "$ac_sys_system" in
673 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
674 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
675 [loadAndInit("", 0, "")],
676 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
677 AC_MSG_RESULT(yes)],
678 [AC_MSG_RESULT(no)]);;
679 *) ;;
680esac
681
Guido van Rossum70c7f481998-03-26 18:44:10 +0000682# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
683# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000684# BeOS' sockets are stashed in libnet.
685case "$ac_sys_system" in
686IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000687*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000688AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000689AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000690;;
691esac
692case "$ac_sys_system" in
693BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000694AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
695;;
696esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000697
Guido van Rossumc5a39031996-07-31 17:35:03 +0000698AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000699AC_ARG_WITH(libs,
700[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000701AC_MSG_RESULT($withval)
702LIBS="$withval $LIBS"
703], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000704
Eric S. Raymonda8885402001-01-17 08:25:11 +0000705#
706# These are used to generate Setup.config. They autoconfigure several
707# features that are otherwise severe pains in the butt.
708#
709# ncurses
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000710AC_SUBST(USE_NCURSES_MODULE)
711AC_CHECK_LIB(ncurses, initscr,
712 [USE_NCURSES_MODULE=""],
713 [USE_NCURSES_MODULE="#"],
714 -ltermcap)
Eric S. Raymonda8885402001-01-17 08:25:11 +0000715# GNU readline
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000716AC_SUBST(USE_READLINE_MODULE)
717AC_CHECK_LIB(readline, readline,
718 [USE_READLINE_MODULE=""],
719 [USE_READLINE_MODULE="#"],
720 -ltermcap)
Eric S. Raymonda8885402001-01-17 08:25:11 +0000721# gdbm(3)
722AC_SUBST(USE_GDBM_MODULE)
723AC_SUBST(HAVE_LIBGDBM)
724AC_CHECK_LIB(gdbm, gdbm_open,
725 [USE_GDBM_MODULE=""
726 HAVE_LIBGDBM=-lgdbm],
727 [USE_GDBM_MODULE="#"
728 HAVE_LIBGDBM=""])
729# ndbm(3)
730AC_SUBST(USE_NDBM_MODULE)
731AC_SUBST(HAVE_LIBNDBM)
732AC_CHECK_LIB(ndbm, ndbm_open,
733 [USE_NDBM_MODULE=""
734 HAVE_LIBNDBM=-lndbm],
735 [USE_NDBM_MODULE="#"
736 HAVE_LIBNDBM=""])
737# crypt(3)
738AC_SUBST(USE_CRYPT_MODULE)
739AC_SUBST(HAVE_LIBCRYPT)
740AC_CHECK_LIB(crypt, crypt,
741 [USE_CRYPT_MODULE=""
742 HAVE_LIBCRYPT=-lcrypt],
743 [USE_CRYPT_MODULE="#"
744 HAVE_LIBCRYPT=""])
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000745
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000746
747# Determine if signalmodule should be used.
748AC_SUBST(USE_SIGNAL_MODULE)
749AC_SUBST(SIGNAL_OBJS)
750AC_MSG_CHECKING(for --with-signal-module)
751AC_ARG_WITH(signal-module,
752[ --with-signal-module disable/enable signal module])
753
754if test -z "$with_signal_module"
755then with_signal_module="yes"
756fi
757AC_MSG_RESULT($with_signal_module)
758
759if test "${with_signal_module}" = "yes"; then
760 USE_SIGNAL_MODULE=""
761 SIGNAL_OBJS=""
762else
763 USE_SIGNAL_MODULE="#"
764 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
765fi
766
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000767# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000768AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000769USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000770
Guido van Rossum54d93d41997-01-22 20:51:58 +0000771AC_MSG_CHECKING(for --with-dec-threads)
772AC_SUBST(LDLAST)
773AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000774[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
775AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000776LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000777if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000778 with_thread="$withval";
779fi],
780AC_MSG_RESULT(no))
781
782AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000783AC_ARG_WITH(threads,
784[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000785
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000786# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000787AC_ARG_WITH(thread,
788[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
789with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000790
791if test -z "$with_threads"
792then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000793fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000794AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000795
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000796if test "$with_threads" = "no"
797then
798 USE_THREAD_MODULE="#"
799else
Guido van Rossum40951012000-10-07 16:21:27 +0000800 if test ! -z "$with_threads" -a -d "$with_threads"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000801 then LDFLAGS="$LDFLAGS -L$with_threads"
802 fi
Guido van Rossum40951012000-10-07 16:21:27 +0000803 if test ! -z "$withval" -a -d "$withval"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000804 then LDFLAGS="$LDFLAGS -L$withval"
805 fi
806 AC_DEFINE(_REENTRANT)
807 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
808 AC_DEFINE(C_THREADS)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000809 LIBOBJS="$LIBOBJS Python/thread.o"],[
Guido van Rossum9e8181b2000-09-19 00:46:46 +0000810 AC_MSG_CHECKING(for --with-pth)
811 AC_ARG_WITH(pth,
812 [ --with-pth use GNU pth threading libraries], [
813 AC_MSG_RESULT($withval)
814 AC_DEFINE(WITH_THREAD)
815 AC_DEFINE(HAVE_PTH)
816 LIBS="-lpth $LIBS"
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000817 LIBOBJS="$LIBOBJS Python/thread.o"],[
Guido van Rossum9e8181b2000-09-19 00:46:46 +0000818 AC_MSG_RESULT(no)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000819 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
820 AC_DEFINE(_POSIX_THREADS)
821 LIBS="-lpthread $LIBS"
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000822 LIBOBJS="$LIBOBJS Python/thread.o"],[
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000823 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Guido van Rossum5839e582000-10-09 19:52:35 +0000824 case $ac_sys_system in
825 Darwin*) ;;
826 *) AC_DEFINE(_POSIX_THREADS);;
827 esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000828 LIBOBJS="$LIBOBJS Python/thread.o"],[
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000829 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
830 AC_DEFINE(BEOS_THREADS)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000831 LIBOBJS="$LIBOBJS Python/thread.o"],[
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000832 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
833 AC_DEFINE(_POSIX_THREADS)
834 LIBS="$LIBS -lpthreads"
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000835 LIBOBJS="$LIBOBJS Python/thread.o"], [
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000836 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
837 AC_DEFINE(_POSIX_THREADS)
838 LIBS="$LIBS -lc_r"
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000839 LIBOBJS="$LIBOBJS Python/thread.o"], [
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000840 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
841 AC_DEFINE(_POSIX_THREADS)
842 LIBS="$LIBS -lthread"
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000843 LIBOBJS="$LIBOBJS Python/thread.o"], [
Guido van Rossum8d6e8af2000-10-30 17:45:07 +0000844 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
845 AC_DEFINE(_POSIX_THREADS)
846 LIBS="$LIBS -lpthread"
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000847 LIBOBJS="$LIBOBJS Python/thread.o"], [
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000848 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
849 AC_DEFINE(_POSIX_THREADS)
850 LIBS="$LIBS -lcma"
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000851 LIBOBJS="$LIBOBJS Python/thread.o"],[
Thomas Wouters0db2b2b2000-08-26 11:33:43 +0000852 USE_THREAD_MODULE="#"])
Guido van Rossum8d6e8af2000-10-30 17:45:07 +0000853 ])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000854
855 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
856 LIBS="$LIBS -lmpc"
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000857 LIBOBJS="$LIBOBJS Python/thread.o"
Thomas Wouters0db2b2b2000-08-26 11:33:43 +0000858 USE_THREAD_MODULE=""])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000859 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
860 LIBS="$LIBS -lthread"
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000861 LIBOBJS="$LIBOBJS Python/thread.o"
Thomas Wouters0db2b2b2000-08-26 11:33:43 +0000862 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +0000863
864 if test "$USE_THREAD_MODULE" != "#"
865 then
866 # If the above checks didn't disable threads, (at least) OSF1
867 # needs this '-threads' argument during linking.
868 case $ac_sys_system in
869 OSF1) LDLAST=-threads;;
870 esac
871 fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000872fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000873
Barry Warsawef82cd72000-06-30 16:21:01 +0000874# Check for GC support
875AC_SUBST(USE_GC_MODULE)
876USE_GC_MODULE=""
877AC_MSG_CHECKING(for --with-cycle-gc)
878AC_ARG_WITH(cycle-gc,
879[ --with(out)-cycle-gc disable/enable garbage collection])
880
881if test -z "$with_cycle_gc"
882then with_cycle_gc="yes"
883fi
884if test "$with_cycle_gc" = "no"
885then
886 USE_GC_MODULE="#"
887else
888 AC_DEFINE(WITH_CYCLE_GC)
889fi
890AC_MSG_RESULT($with_cycle_gc)
891
Barry Warsawa57b89b2001-01-15 17:07:21 +0000892# Check for DBM support
893AC_SUBST(USE_DBM_MODULE)
894USE_DBM_MODULE=""
895AC_MSG_CHECKING(for --with-dbm)
896AC_ARG_WITH(dbm,
897[ --with(out)-dbm disable/enable dbm module])
898
899# enabled by default but one of the dbm.h files must be found
Sjoerd Mullender124698c2001-01-17 09:42:21 +0000900if test "$ac_cv_header_ndbm_h" = "yes" -o "$ac_cv_header_db1_ndbm_h" = "yes" -o "$ac_cv_header_gdbm_ndbm_h" = "yes"
Barry Warsawa57b89b2001-01-15 17:07:21 +0000901then
902 if test "$with_dbm" != "no"
903 then with_dbm="yes"
904 fi
905else
906 # make sure user knows why dbm support wasn't enabled even though
907 # s/he requested it
908 if test "$with_dbm" = "yes"
Eric S. Raymonda8885402001-01-17 08:25:11 +0000909 then echo $ac_n "(requested but no ndbm.h was found) $ac_c"
Barry Warsawa57b89b2001-01-15 17:07:21 +0000910 fi
911 with_dbm="no"
912fi
913
914if test "$with_dbm" = "no"
915then
916 USE_DBM_MODULE="#"
917else
918 AC_DEFINE(WITH_LIBNDBM)
919fi
920AC_MSG_RESULT($with_dbm)
921
922if test "$with_dbm" = "yes"
923then
924 # check for libndbm
925 AC_SUBST(HAVE_LIBNDBM)
926 AC_CHECK_FUNC(dbmopen, [HAVE_LIBNDBM=], [HAVE_LIBNDBM=-lndbm])
927fi
928
Fred Drakec9cb8472000-08-31 16:11:07 +0000929# Check for LIBDB support
930# either --with-libdb or, in its absence, the presence of db.h
931AC_SUBST(USE_BSDDB_MODULE)
932USE_BSDDB_MODULE=""
933AC_MSG_CHECKING(for --with-libdb)
934AC_ARG_WITH(libdb,
935[ --with(out)-libdb disable/enable bsddb module])
936
Skip Montanarob89f41e2000-09-04 04:06:05 +0000937# enabled by default, but db.h must be found
938if test "$ac_cv_header_db_h" = "yes"
939then
940 if test "$with_libdb" != "no"
941 then with_libdb="yes"
942 fi
943else
Fred Drake5790be12000-10-09 17:06:13 +0000944 # make sure user knows why bsddb support wasn't enabled even
Skip Montanarob89f41e2000-09-04 04:06:05 +0000945 # though s/he requested it
946 if test "$with_libdb" = "yes"
947 then echo $ac_n "(requested, but db.h was not found) $ac_c"
948 fi
949 with_libdb="no"
Fred Drakec9cb8472000-08-31 16:11:07 +0000950fi
Skip Montanarob89f41e2000-09-04 04:06:05 +0000951
Fred Drakec9cb8472000-08-31 16:11:07 +0000952if test "$with_libdb" = "no"
953then
954 USE_BSDDB_MODULE="#"
955else
956 AC_DEFINE(WITH_LIBDB)
957fi
958AC_MSG_RESULT($with_libdb)
959
Skip Montanaroed33c9a2000-09-08 02:17:15 +0000960if test "$with_libdb" = "yes"
961then
962 # check for libdb; BSD systems have the DB routines in libc --tg
963 AC_SUBST(HAVE_LIBDB)
Martin v. Löwis05a65d62000-09-24 19:40:25 +0000964 # If dbopen is not in libc, then checking whether it is in libdb
965 # is difficult: db_185.h may #define it as __db185_open
966 # Instead, we just trust it is in libdb; linking will fail if it
967 # is not.
968 AC_CHECK_FUNC(dbopen, [HAVE_LIBDB=], [HAVE_LIBDB=-ldb])
Skip Montanaroed33c9a2000-09-08 02:17:15 +0000969fi
970
Barry Warsawef82cd72000-06-30 16:21:01 +0000971# Check for --with-wctype-functions
972AC_MSG_CHECKING(for --with-wctype-functions)
973AC_ARG_WITH(wctype-functions,
974[ --with-wctype-functions use wctype.h functions], [
975if test "$withval" != no
976then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
977else AC_MSG_RESULT(no)
978fi],
979[AC_MSG_RESULT(no)])
980
Guido van Rossum68242b51996-05-28 22:53:03 +0000981# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000982AC_SUBST(DLINCLDIR)
983DLINCLDIR=/
984
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000985AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000986AC_ARG_WITH(sgi-dl,
987[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000988AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000989AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +0000990DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000991dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +0000992if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000993then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000994else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
995fi
996DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000997LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000998
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000999AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001000AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001001AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001002AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001003DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001004dldir=`echo "$withval" | sed 's/,.*//'`
1005dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001006if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001007then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001008else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1009fi
1010DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001011LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001012
Guido van Rossume97ee181999-12-20 21:27:22 +00001013# the dlopen() function means we might want to use dynload_shlib.o. some
1014# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001015AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001016
1017# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1018# loading of modules.
1019AC_SUBST(DYNLOADFILE)
1020AC_MSG_CHECKING(DYNLOADFILE)
1021if test -z "$DYNLOADFILE"
1022then
1023 case $ac_sys_system/$ac_sys_release in
1024 AIX*) DYNLOADFILE="dynload_aix.o";;
1025 BeOS*) DYNLOADFILE="dynload_beos.o";;
1026 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Guido van Rossum5839e582000-10-09 19:52:35 +00001027 Darwin/*|next/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001028 *)
1029 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1030 # out any dynamic loading
1031 if test "$ac_cv_func_dlopen" = yes
1032 then DYNLOADFILE="dynload_shlib.o"
1033 else DYNLOADFILE="dynload_stub.o"
1034 fi
1035 ;;
1036 esac
1037fi
1038AC_MSG_RESULT($DYNLOADFILE)
1039if test "$DYNLOADFILE" != "dynload_stub.o"
1040then
1041 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1042fi
1043
Guido van Rossum627b2d71993-12-24 10:39:16 +00001044# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001045AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001046 flock fork fsync fdatasync fpathconf ftime ftruncate \
Andrew M. Kuchlinga9586c72001-01-08 17:58:56 +00001047 getgroups getlogin getpeername getpid getpwent getwd \
Andrew M. Kuchling898527b2000-06-18 14:54:13 +00001048 kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001049 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001050 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001051 select setegid seteuid setgid \
Thomas Wouters3a584202000-08-05 23:28:51 +00001052 setlocale setregid setreuid setsid setpgid setuid setvbuf \
Fred Drake35a092f1999-12-13 16:23:35 +00001053 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001054 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Wouters70c21a12000-07-14 14:28:33 +00001055 truncate uname waitpid _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001056
Fred Drake8cef4cf2000-06-28 16:40:38 +00001057# check for openpty and forkpty
1058
1059AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1060AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1061
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001062# check for long file support functions
1063AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1064
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001065AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001066AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1067AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1068AC_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 +00001069
1070# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001071AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001072AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001073AC_STRUCT_TIMEZONE
1074
1075AC_MSG_CHECKING(for time.h that defines altzone)
1076AC_CACHE_VAL(ac_cv_header_time_altzone,
1077[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1078 ac_cv_header_time_altzone=yes,
1079 ac_cv_header_time_altzone=no)])
1080AC_MSG_RESULT($ac_cv_header_time_altzone)
1081if test $ac_cv_header_time_altzone = yes; then
1082 AC_DEFINE(HAVE_ALTZONE)
1083fi
1084
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001085was_it_defined=no
1086AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001087AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001088#include <sys/types.h>
1089#include <sys/select.h>
1090#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001091], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1092AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001093
1094# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001095
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001096AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001097AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001098
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001099works=no
1100AC_MSG_CHECKING(for working volatile)
1101AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1102AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001103
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001104works=no
1105AC_MSG_CHECKING(for working signed char)
1106AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1107AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001108
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001109have_prototypes=no
1110AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001111AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1112AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001113AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001114
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001115works=no
1116AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001117AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001118#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001119int foo(int x, ...) {
1120 va_list va;
1121 va_start(va, x);
1122 va_arg(va, int);
1123 va_arg(va, char *);
1124 va_arg(va, double);
1125 return 0;
1126}
1127], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001128AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1129AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001130
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001131if test "$have_prototypes" = yes; then
1132bad_prototypes=no
1133AC_MSG_CHECKING(for bad exec* prototypes)
1134AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1135 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1136AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001137fi
1138
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001139bad_forward=no
1140AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001141AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001142struct s { int a; int b; };
1143static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001144int foobar() {
1145 static int random;
1146 random = (int) &foo;
1147 return random;
1148}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001149static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001150main() {
1151 exit(!((int)&foo == foobar()));
1152}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001153], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
1154AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001155
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001156va_list_is_array=no
1157AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001158AC_TRY_COMPILE([
1159#ifdef HAVE_STDARG_PROTOTYPES
1160#include <stdarg.h>
1161#else
1162#include <varargs.h>
1163#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001164], [va_list list1, list2; list1 = list2;], ,
1165AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1166AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001167
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001168# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1169AC_CHECK_FUNC(gethostbyname_r, [
1170 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1171 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1172 OLD_CFLAGS=$CFLAGS
1173 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1174 AC_TRY_COMPILE([
1175# include <netdb.h>
1176 ], [
1177 char *name;
1178 struct hostent *he, *res;
1179 char buffer[2048];
1180 int buflen = 2048;
1181 int h_errnop;
1182
1183 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1184 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001185 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001186 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1187 AC_MSG_RESULT(yes)
1188 ], [
1189 AC_MSG_RESULT(no)
1190 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1191 AC_TRY_COMPILE([
1192# include <netdb.h>
1193 ], [
1194 char *name;
1195 struct hostent *he;
1196 char buffer[2048];
1197 int buflen = 2048;
1198 int h_errnop;
1199
1200 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1201 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001202 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001203 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1204 AC_MSG_RESULT(yes)
1205 ], [
1206 AC_MSG_RESULT(no)
1207 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1208 AC_TRY_COMPILE([
1209# include <netdb.h>
1210 ], [
1211 char *name;
1212 struct hostent *he;
1213 struct hostent_data data;
1214
1215 (void) gethostbyname_r(name, he, &data);
1216 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001217 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001218 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1219 AC_MSG_RESULT(yes)
1220 ], [
1221 AC_MSG_RESULT(no)
1222 ])
1223 ])
1224 ])
1225 CFLAGS=$OLD_CFLAGS
1226], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001227 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001228])
1229AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1230AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1231AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001232AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001233AC_SUBST(HAVE_GETHOSTBYNAME)
1234
Guido van Rossum627b2d71993-12-24 10:39:16 +00001235# checks for system services
1236# (none yet)
1237
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001238# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001239AC_CHECK_FUNC(__fpu_control,
1240 [],
1241 [AC_CHECK_LIB(ieee, __fpu_control)
1242])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001243
Guido van Rossum93274221997-05-09 02:42:00 +00001244# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001245AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001246AC_ARG_WITH(fpectl,
1247[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001248if test "$withval" != no
1249then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1250else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001251fi],
1252[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001253
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001254# check for --with-libm=...
1255AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001256case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001257Darwin) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001258next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001259BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001260*) LIBM=-lm
1261esac
Guido van Rossum93274221997-05-09 02:42:00 +00001262AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001263AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001264if test "$withval" = no
1265then LIBM=
1266 AC_MSG_RESULT(force LIBM empty)
1267elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001268then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001269 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001270else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001271fi],
1272[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001273
1274# check for --with-libc=...
1275AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001276AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001277AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001278if test "$withval" = no
1279then LIBC=
1280 AC_MSG_RESULT(force LIBC empty)
1281elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001282then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001283 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001284else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001285fi],
1286[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001287
Guido van Rossum4c3f57c2001-01-10 20:40:46 +00001288# check for --with-check-import-case
1289AC_ARG_WITH(check-import-case,
1290[ --with-check-import-case enable imported module name case checking],,)
1291AC_MSG_CHECKING(for --with-check-import-case)
1292if test "$with_check_import_case"
1293then
1294 AC_DEFINE(CHECK_IMPORT_CASE)
1295 AC_MSG_RESULT(yes)
1296else
1297 AC_MSG_RESULT(no)
1298fi
1299
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001300# check for hypot() in math library
1301LIBS_SAVE=$LIBS
1302LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001303AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001304LIBS=$LIBS_SAVE
1305
Guido van Rossumad713701997-07-10 22:42:38 +00001306# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001307AC_MSG_CHECKING(what malloc(0) returns)
1308AC_CACHE_VAL(ac_cv_malloc_zero,
1309[AC_TRY_RUN([#include <stdio.h>
1310#ifdef HAVE_STDLIB
1311#include <stdlib.h>
1312#else
1313char *malloc(), *realloc();
1314int *free();
1315#endif
1316main() {
1317 char *p;
1318 p = malloc(0);
1319 if (p == NULL) exit(1);
1320 p = realloc(p, 0);
1321 if (p == NULL) exit(1);
1322 free(p);
1323 exit(0);
1324}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1325AC_MSG_RESULT($ac_cv_malloc_zero)
1326if test "$ac_cv_malloc_zero" = null
1327then
1328 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1329fi
1330
Guido van Rossumef2255b2000-03-10 22:30:29 +00001331# check for wchar.h
1332AC_CHECK_HEADER(wchar.h,
1333AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1334wchar_h="no"
1335)
1336
1337# check for usable wchar_t
1338usable_wchar_t="unkown"
1339AC_MSG_CHECKING(for usable wchar_t)
1340AC_TRY_RUN([
1341#include "wchar.h"
1342#include "wctype.h"
1343main() {
1344 wchar_t s;
1345 if (sizeof(s) == 2)
1346 exit(0);
1347 else
1348 exit(1);
1349}
1350],
1351AC_DEFINE(HAVE_USABLE_WCHAR_T) usable_wchar_t="yes",
1352usable_wchar_t="no")
1353AC_MSG_RESULT($usable_wchar_t)
1354
1355# check for endianness
1356AC_C_BIGENDIAN
1357
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001358# Check whether right shifting a negative integer extends the sign bit
1359# or fills with zeros (like the Cray J90, according to Tim Peters).
1360AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001361AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001362AC_TRY_RUN([
1363int main()
1364{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001365 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001366}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001367], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1368AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1369if test "$ac_cv_rshift_extends_sign" = no
1370then
1371 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1372fi
1373
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001374# check for getc_unlocked and related locking functions
1375AC_MSG_CHECKING(for getc_unlocked() and friends)
1376AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1377AC_TRY_LINK([#include <stdio.h>],[
1378 FILE *f = fopen("/dev/null", "r");
1379 flockfile(f);
1380 getc_unlocked(f);
1381 funlockfile(f);
1382], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1383AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1384if test "$ac_cv_have_getc_unlocked" = yes
1385then
1386 AC_DEFINE(HAVE_GETC_UNLOCKED)
1387fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001388
Guido van Rossum95713eb2000-05-18 20:53:31 +00001389# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1390# Add sys/socket.h to confdefs.h
1391cat >> confdefs.h <<\EOF
1392#ifdef HAVE_SYS_SOCKET_H
1393#include <sys/socket.h>
1394#endif
1395EOF
1396AC_CHECK_TYPE(socklen_t, int)
1397
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001398#AC_MSG_CHECKING(for Modules/Setup)
1399#if test ! -f Modules/Setup ; then
1400# if test ! -d Modules ; then
1401# mkdir Modules
1402# fi
1403# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1404# AC_MSG_RESULT(creating)
1405#else
1406# AC_MSG_RESULT(already exists)
1407#fi
1408
1409AC_SUBST(SRCDIRS)
1410SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001411AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001412for dir in $SRCDIRS; do
1413 if test ! -d $dir; then
1414 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001415 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001416done
1417AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001418
Guido van Rossum627b2d71993-12-24 10:39:16 +00001419# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001420AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001421
1422echo "creating Setup"
1423if test ! -f Modules/Setup
1424then
1425 cp $srcdir/Modules/Setup.dist Modules/Setup
1426fi
1427
1428echo "creating Setup.local"
1429if test ! -f Modules/Setup.local
1430then
1431 echo "# Edit this file for local setup changes" >Modules/Setup.local
1432fi
1433
1434echo "creating Makefile"
1435$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1436 -s Modules Modules/Setup.config \
1437 Modules/Setup Modules/Setup.local