blob: 32147bf5f5010d14cd8b0f9b25ae8d4baed40bc3 [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)
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +00005AC_CONFIG_HEADER(pyconfig.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 Rossum6db412b2001-04-18 04:37:57 +00009VERSION=2.2
Guido van Rossum642b6781997-07-19 19:35:41 +000010
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +000011# Arguments passed to configure.
12AC_SUBST(CONFIG_ARGS)
13CONFIG_ARGS="$ac_configure_args"
14
Guido van Rossum4b6b5791996-09-09 20:09:34 +000015
Jack Jansenb6e9cad2001-08-15 01:26:28 +000016AC_ARG_ENABLE(framework,
17[ --enable-framework[=INSTALLDIR] Build (MacOSX|Darwin) framework],[
Jack Jansenb6e9cad2001-08-15 01:26:28 +000018 case $enableval in
19 yes)
20 enableval=/Library/Frameworks
Jack Jansen127e56e2001-09-11 14:41:54 +000021 esac
22 case $enableval in
23 no)
24 PYTHONFRAMEWORK=
25 PYTHONFRAMEWORKDIR=no-framework
26 PYTHONFRAMEWORKPREFIX=
27 PYTHONFRAMEWORKINSTALLDIR=
28 enable_framework=
Jack Jansenb6e9cad2001-08-15 01:26:28 +000029 ;;
30 *)
Jack Jansen127e56e2001-09-11 14:41:54 +000031 PYTHONFRAMEWORK=Python
32 PYTHONFRAMEWORKDIR=Python.framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +000033 PYTHONFRAMEWORKPREFIX=$enableval
Jack Jansen127e56e2001-09-11 14:41:54 +000034 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
35 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
Jack Jansenb6e9cad2001-08-15 01:26:28 +000036 esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +000037 ],[
38 PYTHONFRAMEWORK=
Jack Jansen127e56e2001-09-11 14:41:54 +000039 PYTHONFRAMEWORKDIR=no-framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +000040 PYTHONFRAMEWORKPREFIX=
41 PYTHONFRAMEWORKINSTALLDIR=
42 enable_framework=
43])
44AC_SUBST(PYTHONFRAMEWORK)
45AC_SUBST(PYTHONFRAMEWORKDIR)
46AC_SUBST(PYTHONFRAMEWORKPREFIX)
47AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
Guido van Rossum4b6b5791996-09-09 20:09:34 +000048
Jack Jansenb6e9cad2001-08-15 01:26:28 +000049##AC_ARG_WITH(dyld,
50##[ --with-dyld Use (OpenStep|Rhapsody) dynamic linker],,)
51##
Guido van Rossumb418f891996-07-30 18:06:02 +000052# Set name for machine-dependent library files
53AC_SUBST(MACHDEP)
54AC_MSG_CHECKING(MACHDEP)
55if test -z "$MACHDEP"
56then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000057 ac_sys_system=`uname -s`
Martin v. Löwis130fb172001-07-19 11:00:41 +000058 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000059 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000060 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000061 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000062 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000063 ac_md_system=`echo $ac_sys_system |
64 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
65 ac_md_release=`echo $ac_sys_release |
66 tr -d '[/ ]' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000067 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000068
Guido van Rossumbcd91e01997-03-20 20:46:29 +000069 case $MACHDEP in
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +000070 cygwin*) MACHDEP="cygwin";;
Guido van Rossumb97ef171997-09-28 05:44:03 +000071 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000072 esac
73fi
Guido van Rossum91922671997-10-09 20:24:13 +000074
75#
76# SGI compilers allow the specification of the both the ABI and the
77# ISA on the command line. Depending on the values of these switches,
78# different and often incompatable code will be generated.
79#
80# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
81# thus supply support for various ABI/ISA combinations. The MACHDEP
82# variable is also adjusted.
83#
84AC_SUBST(SGI_ABI)
85if test ! -z "$SGI_ABI"
86then
87 CC="cc $SGI_ABI"
88 LDFLAGS="$SGI_ABI $LDFLAGS"
89 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
90fi
Guido van Rossumb418f891996-07-30 18:06:02 +000091AC_MSG_RESULT($MACHDEP)
92
Guido van Rossum627b2d71993-12-24 10:39:16 +000093# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000094AC_MSG_CHECKING(for --without-gcc)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000095AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000096 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000097 no) CC=cc
98 without_gcc=yes;;
99 yes) CC=gcc
100 without_gcc=no;;
101 *) CC=$withval
102 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000103 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000104 case $ac_sys_system in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000105 AIX*) CC=cc_r
106 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000107 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000108 case $BE_HOST_CPU in
109 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000110 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000111 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000112 OPT="-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma"
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000113 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000114 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000115 ;;
116 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000117 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000118 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000119 OPT=-O
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000120 ;;
121 *)
Fred Drake5790be12000-10-09 17:06:13 +0000122 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000123 ;;
124 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000125 AR="\$(srcdir)/Modules/ar_beos"
126 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000127 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000128 Monterey*)
129 RANLIB=:
Martin v. Löwis130fb172001-07-19 11:00:41 +0000130 without_gcc=;;
131 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000132 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000133AC_MSG_RESULT($without_gcc)
134
Guido van Rossum27552902001-01-23 01:52:26 +0000135AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000136AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000137MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000138AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000139AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000140 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000141 case $withval in
142 no) CXX=
143 with_cxx=no;;
144 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000145 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000146 with_cxx=$withval;;
147 esac], [
148 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000149 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000150])
151AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000152
153dnl The following fragment works similar to AC_PROG_CXX.
154dnl It does not fail if CXX is not found, and it is not executed if
155dnl --with-cxx was given.
156dnl Finally, it does not test whether CXX is g++.
157
158if test "$check_cxx" = "yes"
159then
160 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
161 if test "$CXX" = "notfound"
162 then
163 CXX=
164 else
165 AC_PROG_CXX_WORKS
166 fi
167fi
168
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000169# If the user switches compilers, we can't believe the cache
170if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
171then
172 AC_ERROR(cached CC is different -- throw away $cache_file
173(it is also a good idea to do 'make clean' before compiling))
174fi
175
Guido van Rossum627b2d71993-12-24 10:39:16 +0000176AC_PROG_CC
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000177
178# checks for UNIX variants that set C preprocessor variables
179AC_AIX
180AC_MINIX
181
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000182AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000183AC_MSG_CHECKING(for --with-suffix)
184AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
185 case $withval in
186 no) EXEEXT=;;
187 yes) EXEEXT=.exe;;
188 *) EXEEXT=$withval;;
189 esac])
190AC_MSG_RESULT($EXEEXT)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000191# Test whether we're running on a non-case-sensitive system, in which
192# case we give a warning if no ext is given
193if test -d "python" -a -z "$EXEEXT"
194then
195 AC_MSG_WARN(This filesystem is not case-sensitive so you should probably use --with-suffix)
196fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000197
Guido van Rossumdd997f71998-10-07 19:58:26 +0000198case $MACHDEP in
199bsdos*)
200 case $CC in
201 gcc) CC="$CC -D_HAVE_BSDI";;
202 esac;;
203esac
204
Guido van Rossum84561611997-08-21 00:08:11 +0000205case $ac_sys_system in
206hp*|HP*)
207 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000208 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000209 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000210Monterey*)
211 case $CC in
212 cc) CC="$CC -Wl,-Bexport";;
213 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000214SunOS*)
215 # Some functions have a prototype only with that define, e.g. confstr
216 AC_DEFINE(__EXTENSIONS__)
217 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000218esac
219
Martin v. Löwise8964d42001-03-06 12:09:07 +0000220
Neil Schemenauer61c51152001-01-26 16:18:16 +0000221AC_SUBST(LIBRARY)
222AC_MSG_CHECKING(LIBRARY)
223if test -z "$LIBRARY"
224then
225 LIBRARY='libpython$(VERSION).a'
226fi
227AC_MSG_RESULT($LIBRARY)
228
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000229# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000230# name of the library into which to insert object files). BLDLIBRARY is also
231# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
232# is blank as the main program is not linked directly against LDLIBRARY.
233# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
234# systems without shared libraries, LDLIBRARY is the same as LIBRARY
235# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
236# DLLLIBRARY is the shared (i.e., DLL) library.
237#
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000238AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000239AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000240AC_SUBST(BLDLIBRARY)
241AC_SUBST(LDLIBRARYDIR)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000242LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000243BLDLIBRARY='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000244DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000245LDLIBRARYDIR=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000246
Guido van Rossumfb842551997-08-06 23:42:07 +0000247# LINKCC is the command that links the python executable -- default is $(CC).
Fred Drake5790be12000-10-09 17:06:13 +0000248# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000249# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000250AC_SUBST(LINKCC)
251AC_MSG_CHECKING(LINKCC)
252if test -z "$LINKCC"
253then
254 case $ac_sys_system in
255 AIX*)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000256 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000257 dgux*)
258 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000259 Monterey64*)
260 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000261 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000262 esac
263fi
264AC_MSG_RESULT($LINKCC)
265
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000266AC_MSG_CHECKING(LDLIBRARY)
267
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000268# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000269case $MACHDEP in
270dguxR4)
271 LDLIBRARY='libpython$(VERSION).so'
272 OPT="$OPT -pic"
273 ;;
274beos*)
275 LDLIBRARY='libpython$(VERSION).so'
276 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000277cygwin*)
278 LDLIBRARY='libpython$(VERSION).dll.a'
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000279 DLLLIBRARY='libpython$(VERSION).dll'
Guido van Rossumaef734b2001-01-10 21:09:12 +0000280 ;;
Fred Drake5790be12000-10-09 17:06:13 +0000281esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000282
Guido van Rossumb8552162001-09-05 14:58:11 +0000283# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
284# library that we build, but we do not want to link against it (we
285# will find it with a -framework option). For this reason there is an
286# extra variable BLDLIBRARY against which Python and the extension
287# modules are linked, BLDLIBRARY. This is normally the same as
288# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000289if test "$enable_framework"
290then
291 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
292 LDLIBRARYDIR='$(PYTHONFRAMEWORKDIR)'
293 BLDLIBRARY=''
294else
295 BLDLIBRARY='$(LDLIBRARY)'
296fi
297
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000298AC_MSG_RESULT($LDLIBRARY)
299
Guido van Rossum627b2d71993-12-24 10:39:16 +0000300AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000301AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000302AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000303
304case $MACHDEP in
305bsdos*)
306 # install -d does not work on BSDI
307 if test -z "$INSTALL"
308 then
309 INSTALL="${srcdir}/install-sh -c"
310 fi
311esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000312AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000313
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000314# Not every filesystem supports hard links
315AC_SUBST(LN)
316if test -z "$LN" ; then
317 case $ac_sys_system in
318 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000319 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000320 *) LN=ln;;
321 esac
322fi
323
Fred Drake9f715822001-07-11 06:27:00 +0000324# Check for --with-pydebug
325AC_MSG_CHECKING(for --with-pydebug)
326AC_ARG_WITH(pydebug,
327[ --with-pydebug build with Py_DEBUG defined], [
328if test "$withval" != no
329then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
330else AC_MSG_RESULT(no); Py_DEBUG='false'
331fi],
332[AC_MSG_RESULT(no)])
333
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000334# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000335AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000336if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000337then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000338 case $GCC in
339 yes)
340 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000341 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000342 if test "$Py_DEBUG" = 'true' ; then
343 # Optimization messes up debuggers, so turn it off for
344 # debug builds.
345 OPT="-g -Wall -Wstrict-prototypes"
346 else
347 OPT="-g -O3 -Wall -Wstrict-prototypes"
348 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000349 *)
Fred Drake9f715822001-07-11 06:27:00 +0000350 OPT="-O3 -Wall -Wstrict-prototypes";;
351 esac
352 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000353 *)
354 case $ac_sys_system in
355 UnixWare*)
356 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
357 *)
358 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000359 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000360 esac
Jack Jansenca06bc62001-08-03 15:32:23 +0000361 case $ac_sys_system in
362 Darwin*)
363 OPT="$OPT -no-cpp-precomp";;
364 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000365fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000366
Trent Mick635f6fb2000-08-23 21:33:05 +0000367# The current (beta) Monterey compiler dies with optimizations
368case $ac_sys_system in
369Monterey*) OPT="";;
370esac
371
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000372if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000373then
374 OPT="$OPT $ac_arch_flags"
375fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000376
Guido van Rossum91922671997-10-09 20:24:13 +0000377AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
378AC_CACHE_VAL(ac_cv_opt_olimit_ok,
379[ac_save_cc="$CC"
380CC="$CC -OPT:Olimit=0"
381AC_TRY_RUN([int main() { return 0; }],
382 ac_cv_opt_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000383 ac_cv_opt_olimit_ok=no,
Guido van Rossum91922671997-10-09 20:24:13 +0000384 ac_cv_opt_olimit_ok=no)
385CC="$ac_save_cc"])
386AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000387if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000388 case $ac_sys_system in
389 Darwin*) OPT="$OPT" ;;
390 *) OPT="$OPT -OPT:Olimit=0";;
391 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000392else
393 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
394 AC_CACHE_VAL(ac_cv_olimit_ok,
395 [ac_save_cc="$CC"
396 CC="$CC -Olimit 1500"
397 AC_TRY_RUN([int main() { return 0; }],
398 ac_cv_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000399 ac_cv_olimit_ok=no,
Guido van Rossumf8678121998-07-07 21:05:09 +0000400 ac_cv_olimit_ok=no)
401 CC="$ac_save_cc"])
402 AC_MSG_RESULT($ac_cv_olimit_ok)
403 if test $ac_cv_olimit_ok = yes; then
404 OPT="$OPT -Olimit 1500"
405 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000406fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000407
Martin v. Löwis130fb172001-07-19 11:00:41 +0000408# -Kpthread, if available, provides the right #defines
409# and linker options to make pthread_create available
410AC_MSG_CHECKING(whether $CC accepts -Kpthread)
411AC_CACHE_VAL(ac_cv_kpthread,
412[ac_save_cc="$CC"
413CC="$CC -Kpthread"
414AC_TRY_LINK([#include <pthread.h>],[pthread_create(0,0,0,0)],
415 ac_cv_kpthread=yes,
416 ac_cv_kpthread=no)
417CC="$ac_save_cc"])
418
419# GCC does not reject -Kpthread as an illegal option, it merely complains that
420# it is unrecognized
421if test "$GCC" = "yes"
422then ac_cv_kpthread="no, we have gcc"
423fi
424AC_MSG_RESULT($ac_cv_kpthread)
425
Fred Drakece81d592000-07-09 14:39:29 +0000426dnl # check for ANSI or K&R ("traditional") preprocessor
427dnl AC_MSG_CHECKING(for C preprocessor type)
428dnl AC_TRY_COMPILE([
429dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
430dnl int foo;
431dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
432dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
433dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000434
Guido van Rossum627b2d71993-12-24 10:39:16 +0000435# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000436AC_HEADER_STDC
Martin v. Löwis9b75dca2001-08-10 13:58:50 +0000437AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h langinfo.h locale.h \
438ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000439signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000440sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000441sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000442sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
Martin v. Löwis1ba3fd52001-08-10 20:29:40 +0000443ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h netpacket/packet.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000444AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000445
446# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000447was_it_defined=no
448AC_MSG_CHECKING(for clock_t in time.h)
449AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
450AC_MSG_RESULT($was_it_defined)
451
Guido van Rossum810cc512001-09-09 23:51:39 +0000452# Two defines needed to enable largefile support on various platforms
453# These may affect some typedefs
454AC_DEFINE(_LARGEFILE_SOURCE)
455AC_DEFINE(_FILE_OFFSET_BITS, 64)
456
Guido van Rossum300fda71996-08-19 21:58:16 +0000457# Add some code to confdefs.h so that the test for off_t works on SCO
458cat >> confdefs.h <<\EOF
459#if defined(SCO_DS)
460#undef _OFF_T
461#endif
462EOF
463
Guido van Rossumef2255b2000-03-10 22:30:29 +0000464# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000465AC_TYPE_MODE_T
466AC_TYPE_OFF_T
467AC_TYPE_PID_T
468AC_TYPE_SIGNAL
469AC_TYPE_SIZE_T
470AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000471
Guido van Rossumef2255b2000-03-10 22:30:29 +0000472# Sizes of various common basic types
Guido van Rossum3065c942001-09-17 04:03:14 +0000473AC_CHECK_SIZEOF(int, 4)
474AC_CHECK_SIZEOF(long, 4)
475AC_CHECK_SIZEOF(void *, 4)
476AC_CHECK_SIZEOF(char, 1)
477AC_CHECK_SIZEOF(short, 2)
478AC_CHECK_SIZEOF(float, 4)
479AC_CHECK_SIZEOF(double, 8)
480AC_CHECK_SIZEOF(fpos_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +0000481
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000482AC_MSG_CHECKING(for long long support)
483have_long_long=no
484AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
485AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000486if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000487AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000488fi
489
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000490AC_MSG_CHECKING(for uintptr_t support)
491have_uintptr_t=no
492AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
493AC_MSG_RESULT($have_uintptr_t)
494if test "$have_uintptr_t" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000495AC_CHECK_SIZEOF(uintptr_t, 4)
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000496fi
497
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000498# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
499AC_MSG_CHECKING(size of off_t)
500AC_CACHE_VAL(ac_cv_sizeof_off_t,
501[AC_TRY_RUN([#include <stdio.h>
502#include <sys/types.h>
503main()
504{
505 FILE *f=fopen("conftestval", "w");
506 if (!f) exit(1);
507 fprintf(f, "%d\n", sizeof(off_t));
508 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000509}],
510ac_cv_sizeof_off_t=`cat conftestval`,
511ac_cv_sizeof_off_t=0,
512ac_cv_sizeof_off_t=4)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000513])
514AC_MSG_RESULT($ac_cv_sizeof_off_t)
515AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
516
517AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000518if test "$have_long_long" = yes -a \
519 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
520 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000521 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
522 AC_MSG_RESULT(yes)
523else
524 AC_MSG_RESULT(no)
525fi
526
Fred Drakea3f6e912000-06-29 20:44:47 +0000527# AC_CHECK_SIZEOF() doesn't include <time.h>.
528AC_MSG_CHECKING(size of time_t)
529AC_CACHE_VAL(ac_cv_sizeof_time_t,
530[AC_TRY_RUN([#include <stdio.h>
531#include <time.h>
532main()
533{
534 FILE *f=fopen("conftestval", "w");
535 if (!f) exit(1);
536 fprintf(f, "%d\n", sizeof(time_t));
537 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000538}],
539ac_cv_sizeof_time_t=`cat conftestval`,
540ac_cv_sizeof_time_t=0,
541ac_cv_sizeof_time_t=4)
Fred Drakea3f6e912000-06-29 20:44:47 +0000542])
543AC_MSG_RESULT($ac_cv_sizeof_time_t)
544AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
545
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000546
Trent Mick635f6fb2000-08-23 21:33:05 +0000547# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000548ac_save_cc="$CC"
549if test "$ac_cv_kpthread" = "yes"
550then CC="$CC -Kpthread"
551fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000552AC_MSG_CHECKING(for pthread_t)
553have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000554AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000555AC_MSG_RESULT($have_pthread_t)
556if test "$have_pthread_t" = yes ; then
557 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
558 AC_MSG_CHECKING(size of pthread_t)
559 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
560 [AC_TRY_RUN([#include <stdio.h>
561 #include <pthread.h>
562 main()
563 {
564 FILE *f=fopen("conftestval", "w");
565 if (!f) exit(1);
566 fprintf(f, "%d\n", sizeof(pthread_t));
567 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000568 }],
569 ac_cv_sizeof_pthread_t=`cat conftestval`,
570 ac_cv_sizeof_pthread_t=0,
571 ac_cv_sizeof_pthread_t=4)
Trent Mick635f6fb2000-08-23 21:33:05 +0000572 ])
573 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
574 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
575fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000576CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000577
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000578AC_MSG_CHECKING(for --enable-toolbox-glue)
579AC_ARG_ENABLE(toolbox-glue,
580[ --enable-toolbox-glue disable/enable MacOSX glue code for extensions])
581
582if test -z "$enable_toolbox_glue"
583then
584 case $ac_sys_system/$ac_sys_release in
585 Darwin/*)
586 enable_toolbox_glue="yes";;
587 *)
588 enable_toolbox_glue="no";;
589 esac
590fi
591case "$enable_toolbox_glue" in
592yes)
593 extra_frameworks="-framework Carbon -framework Foundation"
594 extra_machdep_objs="Python/mactoolboxglue.o"
Jack Jansen591cbed2001-08-15 13:55:15 +0000595 extra_undefs="-u __dummy -u _PyMac_Error"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000596 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
597 ;;
598*)
599 extra_frameworks=""
600 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +0000601 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000602 ;;
603esac
604AC_MSG_RESULT($enable_toolbox_glue)
605
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000606AC_SUBST(LIBTOOL_CRUFT)
607case $ac_sys_system/$ac_sys_release in
Jack Jansena3891ea2001-09-07 14:25:12 +0000608 Darwin/1.4*)
609 ns_undef_sym='_environ'
610 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym"
611 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
612 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
613 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +0000614 Darwin/*)
615 ns_undef_sym='_environ'
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000616 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym"
617 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
618 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
619 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000620esac
621
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000622AC_MSG_CHECKING(for --enable-framework)
623if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000624then
Jack Jansenca06bc62001-08-03 15:32:23 +0000625 OPT="$OPT -fno-common -dynamic"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000626 # -U __environ is needed since bundles don't have access
627 # to crt0 when built but will always be linked against it
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000628 # -F. is needed to allow linking to the framework while
629 # in the build location.
630
Jack Jansena3891ea2001-09-07 14:25:12 +0000631 case $ac_sys_system/$ac_sys_release in
632 Darwin/1.4*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";;
633 Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-U,$ns_undef_sym";;
634 esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000635 AC_DEFINE(WITH_NEXT_FRAMEWORK)
636 AC_MSG_RESULT(yes)
637else
638 AC_MSG_RESULT(no)
639fi
640
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000641AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000642case $ac_sys_system/$ac_sys_release in
643 Darwin/*)
644 AC_DEFINE(WITH_DYLD)
645 AC_MSG_RESULT(always on for Darwin)
646 ;;
647 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000648 AC_MSG_RESULT(no)
649 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000650esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000651
Guido van Rossumac405f61994-09-12 10:56:06 +0000652# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000653AC_SUBST(SO)
654AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000655AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000656AC_SUBST(CCSHARED)
657AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000658# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000659# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000660AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000661if test -z "$SO"
662then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000663 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000664 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000665 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000666 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000667 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000668fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000669AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000670# LDSHARED is the ld *command* used to create shared library
Martin v. Löwis5b718fc2001-09-10 15:34:42 +0000671# -- "ld" on SunOS 4.x.x, "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000672# (Shared libraries in this instance are shared modules to be loaded into
673# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000674AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000675if test -z "$LDSHARED"
676then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000677 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000678 AIX*)
679 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
680 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
681 ;;
682 BeOS*)
683 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
684 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
685 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000686 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000687 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000688 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +0000689 SunOS/5*)
690 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000691 then LDSHARED='$(CC) -shared'
Martin v. Löwis5b718fc2001-09-10 15:34:42 +0000692 else LDSHARED="$(CC) -G";
Greg Ward57c9a6632000-05-26 12:22:54 +0000693 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000694 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000695 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000696 DYNIX/ptx*) LDSHARED="ld -G";;
Jack Jansena3891ea2001-09-07 14:25:12 +0000697 Darwin/1.4*)
698 LDSHARED='$(CC) $(LDFLAGS) -bundle'
699 if test "$enable_framework" ; then
700 # Link against the framework. All externals should be defined.
701 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
702 else
703 # No framework. Ignore undefined symbols, assuming they come from Python
704 LDSHARED="$LDSHARED -flat_namespace -undefined suppress"
705 fi ;;
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000706 Darwin/*)
707 LDSHARED='$(CC) $(LDFLAGS) -bundle'
708 if test "$enable_framework" ; then
709 # Link against the framework. All externals should be defined.
710 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
711 else
712 # No framework. Ignore undefined symbols, assuming they come from Python
713 LDSHARED="$LDSHARED -undefined suppress"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000714 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000715 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000716 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000717 BSD/OS*/4*) LDSHARED="gcc -shared";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000718 OpenBSD*|NetBSD*|FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000719 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000720 then
721 LDSHARED="cc -shared ${LDFLAGS}"
722 else
723 LDSHARED="ld -Bshareable ${LDFLAGS}"
724 fi;;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000725 UnixWare*)
726 if test "$GCC" = "yes"
727 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000728 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000729 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000730 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000731 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000732 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000733 *) LDSHARED="ld";;
734 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000735fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000736AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000737BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000738# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000739# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000740AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000741if test -z "$CCSHARED"
742then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000743 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000744 SunOS*) if test "$GCC" = yes;
745 then CCSHARED="-fPIC";
746 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000747 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +0000748 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +0000749 else CCSHARED="+z";
750 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000751 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000752 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000753 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000754 UnixWare*)
755 if test "$GCC" = "yes"
756 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000757 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000758 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000759 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000760 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000761 IRIX*/6*) case $CC in
762 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000763 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000764 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000765 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000766 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000767fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000768AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000769# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000770# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000771AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000772if test -z "$LINKFORSHARED"
773then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000774 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000775 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000776 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000777 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000778 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000779 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000780 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000781 Darwin/*)
782 # -u __dummy makes the linker aware of the objc runtime
783 # in System.framework; otherwise, __objcInit (referenced in
784 # crt1.o) gets erroneously defined as common, which breaks dynamic
785 # loading of any modules which reference it in System.framework.
786 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
787 # not used by the core itself but which needs to be in the core so
788 # that dynamically loaded extension modules have access to it.
Jack Jansen591cbed2001-08-15 13:55:15 +0000789 LINKFORSHARED="$extra_undefs -framework System"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000790 if test "$enable_framework"
791 then
792 LINKFORSHARED="$LINKFORSHARED -framework Python"
793 fi
794 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000795 UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000796 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000797 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000798 FreeBSD*|NetBSD*|OpenBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000799 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
800 then
801 LINKFORSHARED="-Wl,--export-dynamic"
802 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000803 SunOS/5*) case $CC in
804 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000805 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000806 then
807 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000808 fi;;
809 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000810 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000811fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000812AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000813
Neil Schemenauer61c51152001-01-26 16:18:16 +0000814AC_SUBST(CFLAGSFORSHARED)
815AC_MSG_CHECKING(CFLAGSFORSHARED)
816if test ! "$LIBRARY" = "$LDLIBRARY"
817then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000818 case $ac_sys_system in
819 CYGWIN*)
820 # Cygwin needs CCSHARED when building extension DLLs
821 # but not when building the interpreter DLL.
822 CFLAGSFORSHARED='';;
823 *)
824 CFLAGSFORSHARED='$(CCSHARED)'
825 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000826fi
827AC_MSG_RESULT($CFLAGSFORSHARED)
828
Guido van Rossum627b2d71993-12-24 10:39:16 +0000829# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000830AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
831AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000832
833# checks for system dependent C++ extensions support
834case "$ac_sys_system" in
835 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
836 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
837 [loadAndInit("", 0, "")],
838 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
839 AC_MSG_RESULT(yes)],
840 [AC_MSG_RESULT(no)]);;
841 *) ;;
842esac
843
Guido van Rossum70c7f481998-03-26 18:44:10 +0000844# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
845# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000846# BeOS' sockets are stashed in libnet.
847case "$ac_sys_system" in
848IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000849*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000850AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000851AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000852;;
853esac
854case "$ac_sys_system" in
855BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000856AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
857;;
858esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000859
Guido van Rossumc5a39031996-07-31 17:35:03 +0000860AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000861AC_ARG_WITH(libs,
862[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000863AC_MSG_RESULT($withval)
864LIBS="$withval $LIBS"
865], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000866
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000867# Determine if signalmodule should be used.
868AC_SUBST(USE_SIGNAL_MODULE)
869AC_SUBST(SIGNAL_OBJS)
870AC_MSG_CHECKING(for --with-signal-module)
871AC_ARG_WITH(signal-module,
872[ --with-signal-module disable/enable signal module])
873
874if test -z "$with_signal_module"
875then with_signal_module="yes"
876fi
877AC_MSG_RESULT($with_signal_module)
878
879if test "${with_signal_module}" = "yes"; then
880 USE_SIGNAL_MODULE=""
881 SIGNAL_OBJS=""
882else
883 USE_SIGNAL_MODULE="#"
884 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
885fi
886
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000887# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000888AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000889USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000890
Guido van Rossum54d93d41997-01-22 20:51:58 +0000891AC_MSG_CHECKING(for --with-dec-threads)
892AC_SUBST(LDLAST)
893AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000894[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
895AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000896LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000897if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000898 with_thread="$withval";
899fi],
900AC_MSG_RESULT(no))
901
902AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000903AC_ARG_WITH(threads,
904[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000905
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000906# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000907AC_ARG_WITH(thread,
908[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
909with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000910
911if test -z "$with_threads"
912then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000913fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000914AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000915
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000916if test "$with_threads" = "no"
917then
918 USE_THREAD_MODULE="#"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000919elif test "$ac_cv_kpthread" = "yes"
920then
921 CC="$CC -Kpthread"
922 AC_DEFINE(WITH_THREAD)
923 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000924 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000925 LIBOBJS="$LIBOBJS thread.o"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000926else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000927 if test ! -z "$with_threads" -a -d "$with_threads"
928 then LDFLAGS="$LDFLAGS -L$with_threads"
929 fi
930 if test ! -z "$withval" -a -d "$withval"
931 then LDFLAGS="$LDFLAGS -L$withval"
932 fi
933 AC_DEFINE(_REENTRANT)
934 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
935 AC_DEFINE(C_THREADS)
936 LIBOBJS="$LIBOBJS thread.o"],[
937 AC_MSG_CHECKING(for --with-pth)
938 AC_ARG_WITH(pth,
939 [ --with-pth use GNU pth threading libraries], [
940 AC_MSG_RESULT($withval)
941 AC_DEFINE(WITH_THREAD)
942 AC_DEFINE(HAVE_PTH)
943 LIBS="-lpth $LIBS"
944 LIBOBJS="$LIBOBJS thread.o"],[
945 AC_MSG_RESULT(no)
946 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000947 case $ac_sys_system in
948 Darwin*) ;;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000949 *) AC_DEFINE(_POSIX_THREADS)
950 posix_threads=yes
951 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000952 esac
Martin v. Löwis130fb172001-07-19 11:00:41 +0000953 LIBS="-lpthread $LIBS"
954 LIBOBJS="$LIBOBJS thread.o"],[
955 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
956 case $ac_sys_system in
957 Darwin*) ;;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000958 *) AC_DEFINE(_POSIX_THREADS)
959 posix_threads=yes
960 ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000961 esac
962 LIBOBJS="$LIBOBJS thread.o"],[
963 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
964 AC_DEFINE(BEOS_THREADS)
965 LIBOBJS="$LIBOBJS thread.o"],[
966 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
967 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000968 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000969 LIBS="$LIBS -lpthreads"
970 LIBOBJS="$LIBOBJS thread.o"], [
971 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
972 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000973 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000974 LIBS="$LIBS -lc_r"
975 LIBOBJS="$LIBOBJS thread.o"], [
976 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
977 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000978 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000979 LIBS="$LIBS -lthread"
980 LIBOBJS="$LIBOBJS thread.o"], [
981 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
982 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000983 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000984 LIBS="$LIBS -lpthread"
985 LIBOBJS="$LIBOBJS thread.o"], [
986 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
987 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000988 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000989 LIBS="$LIBS -lcma"
990 LIBOBJS="$LIBOBJS thread.o"],[
991 USE_THREAD_MODULE="#"])
992 ])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000993
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000994 if test "$posix_threads" = "yes"; then
995 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
996 AC_CACHE_VAL(ac_cv_pthread_system_supported,
997 [AC_TRY_RUN([#include <pthread.h>
998 void *foo(void *parm) {
999 return NULL;
1000 }
1001 main() {
1002 pthread_attr_t attr;
1003 if (pthread_attr_init(&attr)) exit(-1);
1004 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
1005 if (pthread_create(NULL, &attr, foo, NULL)) exit(-1);
1006 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00001007 }],
1008 ac_cv_pthread_system_supported=yes,
1009 ac_cv_pthread_system_supported=no,
1010 ac_cv_pthread_system_supported=no)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001011 ])
1012 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1013 if test "$ac_cv_pthread_system_supported" = "yes"; then
1014 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED)
1015 fi
1016 fi
1017
Martin v. Löwis130fb172001-07-19 11:00:41 +00001018 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1019 LIBS="$LIBS -lmpc"
1020 LIBOBJS="$LIBOBJS thread.o"
1021 USE_THREAD_MODULE=""])
1022 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1023 LIBS="$LIBS -lthread"
1024 LIBOBJS="$LIBOBJS thread.o"
1025 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001026
Martin v. Löwis130fb172001-07-19 11:00:41 +00001027 if test "$USE_THREAD_MODULE" != "#"
1028 then
1029 # If the above checks didn't disable threads, (at least) OSF1
1030 # needs this '-threads' argument during linking.
1031 case $ac_sys_system in
1032 OSF1) LDLAST=-threads;;
1033 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001034 fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001035fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001036
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001037# Check for enable-ipv6
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001038AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001039AC_ARG_ENABLE(ipv6,
1040[ --enable-ipv6 Enable ipv6 (with ipv4) support
1041 --disable-ipv6 Disable ipv6 support],
1042[ case "$enableval" in
1043 no)
1044 AC_MSG_RESULT(no)
1045 ipv6=no
1046 ;;
1047 *) AC_MSG_RESULT(yes)
1048 AC_DEFINE(ENABLE_IPV6)
1049 ipv6=yes
1050 ;;
1051 esac ],
1052
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001053[
1054dnl the check does not work on cross compilation case...
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001055 AC_TRY_RUN([ /* AF_INET6 available check */
1056#include <sys/types.h>
1057#include <sys/socket.h>
1058main()
1059{
1060 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1061 exit(1);
1062 else
1063 exit(0);
1064}
1065],
1066 AC_MSG_RESULT(yes)
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001067 ipv6=yes,
1068 AC_MSG_RESULT(no)
1069 ipv6=no,
1070 AC_MSG_RESULT(no)
1071 ipv6=no
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001072)
1073
1074if test "$ipv6" = "yes"; then
1075 AC_MSG_CHECKING(if RFC2553 API is available)
1076 AC_TRY_COMPILE([#include <sys/types.h>
1077#include <netinet/in.h>],
1078 [struct sockaddr_in6 x;
1079x.sin6_scope_id;],
1080 AC_MSG_RESULT(yes)
1081 ipv6=yes,
1082 AC_MSG_RESULT(no, IPv6 disabled)
1083 ipv6=no)
1084fi
1085
1086if test "$ipv6" = "yes"; then
1087 AC_DEFINE(ENABLE_IPV6)
1088fi
1089])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001090
1091ipv6type=unknown
1092ipv6lib=none
1093ipv6trylibc=no
1094
1095if test "$ipv6" = "yes"; then
1096 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00001097 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1098 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001099 case $i in
1100 inria)
1101 dnl http://www.kame.net/
1102 AC_EGREP_CPP(yes, [dnl
1103#include <netinet/in.h>
1104#ifdef IPV6_INRIA_VERSION
1105yes
1106#endif],
1107 [ipv6type=$i;
1108 OPT="-DINET6 $OPT"])
1109 ;;
1110 kame)
1111 dnl http://www.kame.net/
1112 AC_EGREP_CPP(yes, [dnl
1113#include <netinet/in.h>
1114#ifdef __KAME__
1115yes
1116#endif],
1117 [ipv6type=$i;
1118 ipv6lib=inet6
1119 ipv6libdir=/usr/local/v6/lib
1120 ipv6trylibc=yes
1121 OPT="-DINET6 $OPT"])
1122 ;;
1123 linux-glibc)
1124 dnl http://www.v6.linux.or.jp/
1125 AC_EGREP_CPP(yes, [dnl
1126#include <features.h>
1127#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1128yes
1129#endif],
1130 [ipv6type=$i;
1131 ipv6trylibc=yes
1132 OPT="-DINET6 $OPT"])
1133 ;;
1134 linux-inet6)
1135 dnl http://www.v6.linux.or.jp/
1136 if test -d /usr/inet6; then
1137 ipv6type=$i
1138 ipv6lib=inet6
1139 ipv6libdir=/usr/inet6/lib
1140 OPT="-DINET6 -I/usr/inet6/include $OPT"
1141 fi
1142 ;;
1143 solaris)
1144 if test -f /etc/netconfig; then
1145 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1146 ipv6type=$i
1147 ipv6trylibc=yes
1148 OPT="-DINET6 $OPT"
1149 fi
1150 fi
1151 ;;
1152 toshiba)
1153 AC_EGREP_CPP(yes, [dnl
1154#include <sys/param.h>
1155#ifdef _TOSHIBA_INET6
1156yes
1157#endif],
1158 [ipv6type=$i;
1159 ipv6lib=inet6;
1160 ipv6libdir=/usr/local/v6/lib;
1161 OPT="-DINET6 $OPT"])
1162 ;;
1163 v6d)
1164 AC_EGREP_CPP(yes, [dnl
1165#include </usr/local/v6/include/sys/v6config.h>
1166#ifdef __V6D__
1167yes
1168#endif],
1169 [ipv6type=$i;
1170 ipv6lib=v6;
1171 ipv6libdir=/usr/local/v6/lib;
1172 OPT="-I/usr/local/v6/include $OPT"])
1173 ;;
1174 zeta)
1175 AC_EGREP_CPP(yes, [dnl
1176#include <sys/param.h>
1177#ifdef _ZETA_MINAMI_INET6
1178yes
1179#endif],
1180 [ipv6type=$i;
1181 ipv6lib=inet6;
1182 ipv6libdir=/usr/local/v6/lib;
1183 OPT="-DINET6 $OPT"])
1184 ;;
1185 esac
1186 if test "$ipv6type" != "unknown"; then
1187 break
1188 fi
1189 done
1190 AC_MSG_RESULT($ipv6type)
1191fi
1192
1193if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1194 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1195 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1196 echo "using lib$ipv6lib"
1197 else
1198 if test $ipv6trylibc = "yes"; then
1199 echo "using libc"
1200 else
1201 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1202 echo "You need to fetch lib$ipv6lib.a from appropriate"
1203 echo 'ipv6 kit and compile beforehand.'
1204 exit 1
1205 fi
1206 fi
1207fi
1208
Barry Warsawef82cd72000-06-30 16:21:01 +00001209# Check for GC support
Barry Warsawef82cd72000-06-30 16:21:01 +00001210AC_MSG_CHECKING(for --with-cycle-gc)
1211AC_ARG_WITH(cycle-gc,
1212[ --with(out)-cycle-gc disable/enable garbage collection])
1213
1214if test -z "$with_cycle_gc"
1215then with_cycle_gc="yes"
1216fi
Neil Schemenauer9c63e6d2001-08-29 23:44:38 +00001217if test "$with_cycle_gc" != "no"
Barry Warsawef82cd72000-06-30 16:21:01 +00001218then
Barry Warsawef82cd72000-06-30 16:21:01 +00001219 AC_DEFINE(WITH_CYCLE_GC)
1220fi
1221AC_MSG_RESULT($with_cycle_gc)
1222
Neil Schemenauera35c6882001-02-27 04:45:05 +00001223# Check for Python-specific malloc support
1224AC_MSG_CHECKING(for --with-pymalloc)
1225AC_ARG_WITH(pymalloc,
1226[ --with(out)-pymalloc disable/enable specialized mallocs], [
1227if test "$withval" != no
1228then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1229else AC_MSG_RESULT(no)
1230fi],
1231[AC_MSG_RESULT(no)])
1232
Barry Warsawef82cd72000-06-30 16:21:01 +00001233# Check for --with-wctype-functions
1234AC_MSG_CHECKING(for --with-wctype-functions)
1235AC_ARG_WITH(wctype-functions,
1236[ --with-wctype-functions use wctype.h functions], [
1237if test "$withval" != no
1238then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1239else AC_MSG_RESULT(no)
1240fi],
1241[AC_MSG_RESULT(no)])
1242
Guido van Rossum68242b51996-05-28 22:53:03 +00001243# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001244AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00001245DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001246
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001247AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001248AC_ARG_WITH(sgi-dl,
1249[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001250AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001251AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +00001252DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001253dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001254if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001255then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001256else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1257fi
1258DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001259LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001260
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001261AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001262AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001263AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001264AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001265DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001266dldir=`echo "$withval" | sed 's/,.*//'`
1267dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001268if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001269then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001270else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1271fi
1272DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001273LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001274
Guido van Rossume97ee181999-12-20 21:27:22 +00001275# the dlopen() function means we might want to use dynload_shlib.o. some
1276# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001277AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001278
1279# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1280# loading of modules.
1281AC_SUBST(DYNLOADFILE)
1282AC_MSG_CHECKING(DYNLOADFILE)
1283if test -z "$DYNLOADFILE"
1284then
1285 case $ac_sys_system/$ac_sys_release in
1286 AIX*) DYNLOADFILE="dynload_aix.o";;
1287 BeOS*) DYNLOADFILE="dynload_beos.o";;
1288 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001289 Darwin/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001290 *)
1291 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1292 # out any dynamic loading
1293 if test "$ac_cv_func_dlopen" = yes
1294 then DYNLOADFILE="dynload_shlib.o"
1295 else DYNLOADFILE="dynload_stub.o"
1296 fi
1297 ;;
1298 esac
1299fi
1300AC_MSG_RESULT($DYNLOADFILE)
1301if test "$DYNLOADFILE" != "dynload_stub.o"
1302then
1303 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1304fi
1305
Jack Jansenc49e5b72001-06-19 15:00:23 +00001306# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1307
1308AC_SUBST(MACHDEP_OBJS)
1309AC_MSG_CHECKING(MACHDEP_OBJS)
1310if test -z "$MACHDEP_OBJS"
1311then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001312 MACHDEP_OBJS=$extra_machdep_objs
1313else
1314 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00001315fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001316AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00001317
Guido van Rossum627b2d71993-12-24 10:39:16 +00001318# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001319AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001320 flock fork fsync fdatasync fpathconf ftime ftruncate \
Martin v. Löwisf95dd0a2001-08-15 17:14:33 +00001321 gai_strerror getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwis864e9ff2001-08-04 22:32:03 +00001322 hstrerror inet_pton kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001323 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001324 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001325 select setegid seteuid setgid \
Martin v. Löwis791bfda2001-07-24 06:33:08 +00001326 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
Fred Drake35a092f1999-12-13 16:23:35 +00001327 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001328 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Woutersc2c12dc2001-07-11 14:45:34 +00001329 truncate uname waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001330
Fred Drake8cef4cf2000-06-28 16:40:38 +00001331# check for openpty and forkpty
1332
1333AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1334AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1335
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001336# check for long file support functions
1337AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1338
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001339AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001340AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1341AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1342AC_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 +00001343
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001344AC_CHECK_FUNCS(getaddrinfo, [dnl
1345AC_MSG_CHECKING(getaddrinfo bug)
1346AC_TRY_RUN([
1347#include <sys/types.h>
1348#include <netdb.h>
1349#include <string.h>
1350#include <sys/socket.h>
1351#include <netinet/in.h>
1352
1353main()
1354{
1355 int passive, gaierr, inet4 = 0, inet6 = 0;
1356 struct addrinfo hints, *ai, *aitop;
1357 char straddr[INET6_ADDRSTRLEN], strport[16];
1358
1359 for (passive = 0; passive <= 1; passive++) {
1360 memset(&hints, 0, sizeof(hints));
1361 hints.ai_family = AF_UNSPEC;
1362 hints.ai_flags = passive ? AI_PASSIVE : 0;
1363 hints.ai_socktype = SOCK_STREAM;
1364 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1365 (void)gai_strerror(gaierr);
1366 goto bad;
1367 }
1368 for (ai = aitop; ai; ai = ai->ai_next) {
1369 if (ai->ai_addr == NULL ||
1370 ai->ai_addrlen == 0 ||
1371 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1372 straddr, sizeof(straddr), strport, sizeof(strport),
1373 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1374 goto bad;
1375 }
1376 switch (ai->ai_family) {
1377 case AF_INET:
1378 if (strcmp(strport, "54321") != 0) {
1379 goto bad;
1380 }
1381 if (passive) {
1382 if (strcmp(straddr, "0.0.0.0") != 0) {
1383 goto bad;
1384 }
1385 } else {
1386 if (strcmp(straddr, "127.0.0.1") != 0) {
1387 goto bad;
1388 }
1389 }
1390 inet4++;
1391 break;
1392 case AF_INET6:
1393 if (strcmp(strport, "54321") != 0) {
1394 goto bad;
1395 }
1396 if (passive) {
1397 if (strcmp(straddr, "::") != 0) {
1398 goto bad;
1399 }
1400 } else {
1401 if (strcmp(straddr, "::1") != 0) {
1402 goto bad;
1403 }
1404 }
1405 inet6++;
1406 break;
1407 case AF_UNSPEC:
1408 goto bad;
1409 break;
1410 default:
1411 /* another family support? */
1412 break;
1413 }
1414 }
1415 }
1416
1417 if (!(inet4 == 0 || inet4 == 2))
1418 goto bad;
1419 if (!(inet6 == 0 || inet6 == 2))
1420 goto bad;
1421
1422 if (aitop)
1423 freeaddrinfo(aitop);
1424 exit(0);
1425
1426 bad:
1427 if (aitop)
1428 freeaddrinfo(aitop);
1429 exit(1);
1430}
1431],
1432AC_MSG_RESULT(good)
1433buggygetaddrinfo=no,
1434AC_MSG_RESULT(buggy)
1435buggygetaddrinfo=yes,
1436AC_MSG_RESULT(buggy)
1437buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
1438
1439if test "$buggygetaddrinfo" = "yes"; then
1440 if test "$ipv6" = "yes"; then
1441 echo 'Fatal: You must get working getaddrinfo() function.'
1442 echo ' or you can specify "--disable-ipv6"'.
1443 exit 1
1444 fi
1445fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00001446AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001447
Guido van Rossum627b2d71993-12-24 10:39:16 +00001448# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001449AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001450AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001451AC_STRUCT_TIMEZONE
1452
1453AC_MSG_CHECKING(for time.h that defines altzone)
1454AC_CACHE_VAL(ac_cv_header_time_altzone,
1455[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1456 ac_cv_header_time_altzone=yes,
1457 ac_cv_header_time_altzone=no)])
1458AC_MSG_RESULT($ac_cv_header_time_altzone)
1459if test $ac_cv_header_time_altzone = yes; then
1460 AC_DEFINE(HAVE_ALTZONE)
1461fi
1462
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001463was_it_defined=no
1464AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001465AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001466#include <sys/types.h>
1467#include <sys/select.h>
1468#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001469], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1470AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001471
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001472AC_MSG_CHECKING(for addrinfo)
1473AC_CACHE_VAL(ac_cv_struct_addrinfo,
1474AC_TRY_COMPILE([
1475# include <netdb.h>],
1476 [struct addrinfo a],
1477 ac_cv_struct_addrinfo=yes,
1478 ac_cv_struct_addrinfo=no))
1479AC_MSG_RESULT($ac_cv_struct_addrinfo)
1480if test $ac_cv_struct_addrinfo = yes; then
1481 AC_DEFINE(HAVE_ADDRINFO)
1482fi
1483
1484AC_MSG_CHECKING(for sockaddr_storage)
1485AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1486AC_TRY_COMPILE([
1487# include <sys/types.h>
1488# include <sys/socket.h>],
1489 [struct sockaddr_storage s],
1490 ac_cv_struct_sockaddr_storage=yes,
1491 ac_cv_struct_sockaddr_storage=no))
1492AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1493if test $ac_cv_struct_sockaddr_storage = yes; then
1494 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1495fi
1496
Guido van Rossum627b2d71993-12-24 10:39:16 +00001497# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001498
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001499AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001500AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001501
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001502works=no
1503AC_MSG_CHECKING(for working volatile)
1504AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1505AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001506
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001507works=no
1508AC_MSG_CHECKING(for working signed char)
1509AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1510AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001511
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001512have_prototypes=no
1513AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001514AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1515AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001516AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001517
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001518works=no
1519AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001520AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001521#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001522int foo(int x, ...) {
1523 va_list va;
1524 va_start(va, x);
1525 va_arg(va, int);
1526 va_arg(va, char *);
1527 va_arg(va, double);
1528 return 0;
1529}
1530], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001531AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1532AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001533
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001534if test "$have_prototypes" = yes; then
1535bad_prototypes=no
1536AC_MSG_CHECKING(for bad exec* prototypes)
1537AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1538 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1539AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001540fi
1541
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001542# check if sockaddr has sa_len member
1543AC_MSG_CHECKING(if sockaddr has sa_len member)
1544AC_TRY_COMPILE([#include <sys/types.h>
1545#include <sys/socket.h>],
1546[struct sockaddr x;
1547x.sa_len = 0;],
1548 AC_MSG_RESULT(yes)
1549 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1550 AC_MSG_RESULT(no))
1551
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001552AC_MSG_CHECKING(for bad static forward)
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001553AC_CACHE_VAL(ac_cv_bad_static_forward,
1554[AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001555struct s { int a; int b; };
1556static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001557int foobar() {
1558 static int random;
1559 random = (int) &foo;
1560 return random;
1561}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001562static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001563main() {
1564 exit(!((int)&foo == foobar()));
Guido van Rossum3065c942001-09-17 04:03:14 +00001565}],
1566ac_cv_bad_static_forward=no,
1567ac_cv_bad_static_forward=yes,
1568ac_cv_bad_static_forward=no)])
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001569AC_MSG_RESULT($ac_cv_bad_static_forward)
1570if test "$ac_cv_bad_static_forward" = yes
1571then
1572 AC_DEFINE(BAD_STATIC_FORWARD)
1573fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001574
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001575va_list_is_array=no
1576AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001577AC_TRY_COMPILE([
1578#ifdef HAVE_STDARG_PROTOTYPES
1579#include <stdarg.h>
1580#else
1581#include <varargs.h>
1582#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001583], [va_list list1, list2; list1 = list2;], ,
1584AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1585AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001586
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001587# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1588AC_CHECK_FUNC(gethostbyname_r, [
1589 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1590 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1591 OLD_CFLAGS=$CFLAGS
1592 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1593 AC_TRY_COMPILE([
1594# include <netdb.h>
1595 ], [
1596 char *name;
1597 struct hostent *he, *res;
1598 char buffer[2048];
1599 int buflen = 2048;
1600 int h_errnop;
1601
1602 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1603 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001604 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001605 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1606 AC_MSG_RESULT(yes)
1607 ], [
1608 AC_MSG_RESULT(no)
1609 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1610 AC_TRY_COMPILE([
1611# include <netdb.h>
1612 ], [
1613 char *name;
1614 struct hostent *he;
1615 char buffer[2048];
1616 int buflen = 2048;
1617 int h_errnop;
1618
1619 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1620 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001621 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001622 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1623 AC_MSG_RESULT(yes)
1624 ], [
1625 AC_MSG_RESULT(no)
1626 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1627 AC_TRY_COMPILE([
1628# include <netdb.h>
1629 ], [
1630 char *name;
1631 struct hostent *he;
1632 struct hostent_data data;
1633
1634 (void) gethostbyname_r(name, he, &data);
1635 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001636 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001637 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1638 AC_MSG_RESULT(yes)
1639 ], [
1640 AC_MSG_RESULT(no)
1641 ])
1642 ])
1643 ])
1644 CFLAGS=$OLD_CFLAGS
1645], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001646 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001647])
1648AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1649AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1650AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001651AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001652AC_SUBST(HAVE_GETHOSTBYNAME)
1653
Guido van Rossum627b2d71993-12-24 10:39:16 +00001654# checks for system services
1655# (none yet)
1656
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001657# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001658AC_CHECK_FUNC(__fpu_control,
1659 [],
1660 [AC_CHECK_LIB(ieee, __fpu_control)
1661])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001662
Guido van Rossum93274221997-05-09 02:42:00 +00001663# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001664AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001665AC_ARG_WITH(fpectl,
1666[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001667if test "$withval" != no
1668then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1669else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001670fi],
1671[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001672
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001673# check for --with-libm=...
1674AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001675case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001676Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001677BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001678*) LIBM=-lm
1679esac
Guido van Rossum93274221997-05-09 02:42:00 +00001680AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001681AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001682if test "$withval" = no
1683then LIBM=
1684 AC_MSG_RESULT(force LIBM empty)
1685elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001686then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001687 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001688else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001689fi],
1690[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001691
1692# check for --with-libc=...
1693AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001694AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001695AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001696if test "$withval" = no
1697then LIBC=
1698 AC_MSG_RESULT(force LIBC empty)
1699elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001700then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001701 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001702else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001703fi],
1704[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001705
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001706# check for hypot() in math library
1707LIBS_SAVE=$LIBS
1708LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001709AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001710LIBS=$LIBS_SAVE
1711
Guido van Rossumad713701997-07-10 22:42:38 +00001712# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001713AC_MSG_CHECKING(what malloc(0) returns)
1714AC_CACHE_VAL(ac_cv_malloc_zero,
1715[AC_TRY_RUN([#include <stdio.h>
1716#ifdef HAVE_STDLIB
1717#include <stdlib.h>
1718#else
1719char *malloc(), *realloc();
1720int *free();
1721#endif
1722main() {
1723 char *p;
1724 p = malloc(0);
1725 if (p == NULL) exit(1);
1726 p = realloc(p, 0);
1727 if (p == NULL) exit(1);
1728 free(p);
1729 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00001730}],
1731ac_cv_malloc_zero=nonnull,
1732ac_cv_malloc_zero=null,
1733ac_cv_malloc_zero=nonnull)]) # XXX arm cross-compile?
Guido van Rossumad713701997-07-10 22:42:38 +00001734AC_MSG_RESULT($ac_cv_malloc_zero)
1735if test "$ac_cv_malloc_zero" = null
1736then
1737 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1738fi
1739
Guido van Rossumef2255b2000-03-10 22:30:29 +00001740# check for wchar.h
1741AC_CHECK_HEADER(wchar.h,
1742AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1743wchar_h="no"
1744)
1745
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001746# determine wchar_t size
1747if test "$wchar_h" = yes
1748then
Guido van Rossum3065c942001-09-17 04:03:14 +00001749 AC_CHECK_SIZEOF(wchar_t, 4)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001750fi
1751
1752AC_MSG_CHECKING(what type to use for unicode)
1753AC_ARG_ENABLE(unicode,
1754[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1755
1756if test $enable_unicode = yes
1757then
Martin v. Löwisfd917792001-06-27 20:22:04 +00001758 # Without any arguments, Py_UNICODE defaults to two-byte mode
1759 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001760fi
1761
1762case "$enable_unicode" in
1763ucs2) unicode_size="2"
1764 AC_DEFINE(Py_UNICODE_SIZE,2)
1765 ;;
1766ucs4) unicode_size="4"
1767 AC_DEFINE(Py_UNICODE_SIZE,4)
1768 ;;
1769esac
1770
Martin v. Löwis339d0f72001-08-17 18:39:25 +00001771AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001772if test "$enable_unicode" = "no"
1773then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00001774 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001775 AC_MSG_RESULT(not used)
1776else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00001777 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001778 AC_DEFINE(Py_USING_UNICODE)
1779 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1780 then
1781 PY_UNICODE_TYPE="wchar_t"
1782 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1783 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1784 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1785 then
1786 PY_UNICODE_TYPE="unsigned short"
1787 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1788 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1789 then
1790 PY_UNICODE_TYPE="unsigned long"
1791 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1792 else
1793 PY_UNICODE_TYPE="no type found"
1794 fi
1795 AC_MSG_RESULT($PY_UNICODE_TYPE)
1796fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00001797
1798# check for endianness
1799AC_C_BIGENDIAN
1800
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001801# Check whether right shifting a negative integer extends the sign bit
1802# or fills with zeros (like the Cray J90, according to Tim Peters).
1803AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001804AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001805AC_TRY_RUN([
1806int main()
1807{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001808 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001809}
Guido van Rossum3065c942001-09-17 04:03:14 +00001810],
1811ac_cv_rshift_extends_sign=yes,
1812ac_cv_rshift_extends_sign=no,
1813ac_cv_rshift_extends_sign=yes)])
Vladimir Marangozova6180282000-07-12 05:05:06 +00001814AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1815if test "$ac_cv_rshift_extends_sign" = no
1816then
1817 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1818fi
1819
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001820# check for getc_unlocked and related locking functions
1821AC_MSG_CHECKING(for getc_unlocked() and friends)
1822AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1823AC_TRY_LINK([#include <stdio.h>],[
1824 FILE *f = fopen("/dev/null", "r");
1825 flockfile(f);
1826 getc_unlocked(f);
1827 funlockfile(f);
1828], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1829AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1830if test "$ac_cv_have_getc_unlocked" = yes
1831then
1832 AC_DEFINE(HAVE_GETC_UNLOCKED)
1833fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001834
Guido van Rossum353ae582001-07-10 16:45:32 +00001835# check for readline 4.2
1836AC_CHECK_LIB(readline, rl_completion_matches,
1837 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1838
Thomas Wouterse38b2f12001-07-11 22:35:31 +00001839AC_MSG_CHECKING(for broken nice())
1840AC_CACHE_VAL(ac_cv_broken_nice, [
1841AC_TRY_RUN([
1842int main()
1843{
1844 int val1 = nice(1);
1845 if (val1 != -1 && val1 == nice(2))
1846 exit(0);
1847 exit(1);
1848}
Guido van Rossum3065c942001-09-17 04:03:14 +00001849],
1850ac_cv_broken_nice=yes,
1851ac_cv_broken_nice=no,
1852ac_cv_broken_nice=no)])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00001853AC_MSG_RESULT($ac_cv_broken_nice)
1854if test "$ac_cv_broken_nice" = yes
1855then
1856 AC_DEFINE(HAVE_BROKEN_NICE)
1857fi
1858
Guido van Rossum95713eb2000-05-18 20:53:31 +00001859# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1860# Add sys/socket.h to confdefs.h
1861cat >> confdefs.h <<\EOF
1862#ifdef HAVE_SYS_SOCKET_H
1863#include <sys/socket.h>
1864#endif
1865EOF
1866AC_CHECK_TYPE(socklen_t, int)
1867
Neil Schemenauerf25cf6c2001-03-04 06:39:33 +00001868# Add Python/ prefix to LIBOBJS
1869libobjs=$LIBOBJS
1870LIBOBJS=
1871for obj in $libobjs; do
1872 LIBOBJS="$LIBOBJS Python/$obj"
1873done
1874
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001875#AC_MSG_CHECKING(for Modules/Setup)
1876#if test ! -f Modules/Setup ; then
1877# if test ! -d Modules ; then
1878# mkdir Modules
1879# fi
1880# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1881# AC_MSG_RESULT(creating)
1882#else
1883# AC_MSG_RESULT(already exists)
1884#fi
1885
1886AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00001887SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001888AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001889for dir in $SRCDIRS; do
1890 if test ! -d $dir; then
1891 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001892 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001893done
1894AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001895
Guido van Rossum627b2d71993-12-24 10:39:16 +00001896# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001897AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001898
1899echo "creating Setup"
1900if test ! -f Modules/Setup
1901then
1902 cp $srcdir/Modules/Setup.dist Modules/Setup
1903fi
1904
1905echo "creating Setup.local"
1906if test ! -f Modules/Setup.local
1907then
1908 echo "# Edit this file for local setup changes" >Modules/Setup.local
1909fi
1910
1911echo "creating Makefile"
1912$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1913 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00001914 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00001915mv config.c Modules