blob: d667cab4834a1197f2c517bd564b80ca8cf179ad [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],[
18 PYTHONFRAMEWORK=Python
19 PYTHONFRAMEWORKDIR=Python.framework
20 case $enableval in
21 yes)
22 enableval=/Library/Frameworks
23 PYTHONFRAMEWORKPREFIX=$enableval
24 ;;
25 *)
26 PYTHONFRAMEWORKPREFIX=$enableval
27 esac
28 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
29 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
30 ],[
31 PYTHONFRAMEWORK=
32 PYTHONFRAMEWORKDIR=
33 PYTHONFRAMEWORKPREFIX=
34 PYTHONFRAMEWORKINSTALLDIR=
35 enable_framework=
36])
37AC_SUBST(PYTHONFRAMEWORK)
38AC_SUBST(PYTHONFRAMEWORKDIR)
39AC_SUBST(PYTHONFRAMEWORKPREFIX)
40AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
Guido van Rossum4b6b5791996-09-09 20:09:34 +000041
Jack Jansenb6e9cad2001-08-15 01:26:28 +000042##AC_ARG_WITH(dyld,
43##[ --with-dyld Use (OpenStep|Rhapsody) dynamic linker],,)
44##
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`
Martin v. Löwis130fb172001-07-19 11:00:41 +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
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +000063 cygwin*) MACHDEP="cygwin";;
Guido van Rossumb97ef171997-09-28 05:44:03 +000064 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000065 esac
66fi
Guido van Rossum91922671997-10-09 20:24:13 +000067
68#
69# SGI compilers allow the specification of the both the ABI and the
70# ISA on the command line. Depending on the values of these switches,
71# different and often incompatable code will be generated.
72#
73# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
74# thus supply support for various ABI/ISA combinations. The MACHDEP
75# variable is also adjusted.
76#
77AC_SUBST(SGI_ABI)
78if test ! -z "$SGI_ABI"
79then
80 CC="cc $SGI_ABI"
81 LDFLAGS="$SGI_ABI $LDFLAGS"
82 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
83fi
Guido van Rossumb418f891996-07-30 18:06:02 +000084AC_MSG_RESULT($MACHDEP)
85
Guido van Rossum627b2d71993-12-24 10:39:16 +000086# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000087AC_MSG_CHECKING(for --without-gcc)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000088AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000089 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000090 no) CC=cc
91 without_gcc=yes;;
92 yes) CC=gcc
93 without_gcc=no;;
94 *) CC=$withval
95 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +000096 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +000097 case $ac_sys_system in
Neil Schemenauerb3531b82001-02-16 04:09:05 +000098 AIX*) CC=cc_r
99 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000100 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000101 case $BE_HOST_CPU in
102 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000103 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000104 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000105 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 +0000106 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000107 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000108 ;;
109 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000110 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000111 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000112 OPT=-O
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000113 ;;
114 *)
Fred Drake5790be12000-10-09 17:06:13 +0000115 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000116 ;;
117 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000118 AR="\$(srcdir)/Modules/ar_beos"
119 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000120 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000121 Monterey*)
122 RANLIB=:
Martin v. Löwis130fb172001-07-19 11:00:41 +0000123 without_gcc=;;
124 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000125 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000126AC_MSG_RESULT($without_gcc)
127
Guido van Rossum27552902001-01-23 01:52:26 +0000128AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000129AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000130MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000131AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000132AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000133 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000134 case $withval in
135 no) CXX=
136 with_cxx=no;;
137 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000138 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000139 with_cxx=$withval;;
140 esac], [
141 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000142 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000143])
144AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000145
146dnl The following fragment works similar to AC_PROG_CXX.
147dnl It does not fail if CXX is not found, and it is not executed if
148dnl --with-cxx was given.
149dnl Finally, it does not test whether CXX is g++.
150
151if test "$check_cxx" = "yes"
152then
153 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
154 if test "$CXX" = "notfound"
155 then
156 CXX=
157 else
158 AC_PROG_CXX_WORKS
159 fi
160fi
161
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000162# If the user switches compilers, we can't believe the cache
163if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
164then
165 AC_ERROR(cached CC is different -- throw away $cache_file
166(it is also a good idea to do 'make clean' before compiling))
167fi
168
Guido van Rossum627b2d71993-12-24 10:39:16 +0000169AC_PROG_CC
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000170
171# checks for UNIX variants that set C preprocessor variables
172AC_AIX
173AC_MINIX
174
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000175AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000176AC_MSG_CHECKING(for --with-suffix)
177AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
178 case $withval in
179 no) EXEEXT=;;
180 yes) EXEEXT=.exe;;
181 *) EXEEXT=$withval;;
182 esac])
183AC_MSG_RESULT($EXEEXT)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000184# Test whether we're running on a non-case-sensitive system, in which
185# case we give a warning if no ext is given
186if test -d "python" -a -z "$EXEEXT"
187then
188 AC_MSG_WARN(This filesystem is not case-sensitive so you should probably use --with-suffix)
189fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000190
Guido van Rossumdd997f71998-10-07 19:58:26 +0000191case $MACHDEP in
192bsdos*)
193 case $CC in
194 gcc) CC="$CC -D_HAVE_BSDI";;
195 esac;;
196esac
197
Guido van Rossum84561611997-08-21 00:08:11 +0000198case $ac_sys_system in
199hp*|HP*)
200 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000201 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000202 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000203Monterey*)
204 case $CC in
205 cc) CC="$CC -Wl,-Bexport";;
206 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000207SunOS*)
208 # Some functions have a prototype only with that define, e.g. confstr
209 AC_DEFINE(__EXTENSIONS__)
210 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000211esac
212
Martin v. Löwise8964d42001-03-06 12:09:07 +0000213
Neil Schemenauer61c51152001-01-26 16:18:16 +0000214AC_SUBST(LIBRARY)
215AC_MSG_CHECKING(LIBRARY)
216if test -z "$LIBRARY"
217then
218 LIBRARY='libpython$(VERSION).a'
219fi
220AC_MSG_RESULT($LIBRARY)
221
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000222# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000223# name of the library into which to insert object files). BLDLIBRARY is also
224# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
225# is blank as the main program is not linked directly against LDLIBRARY.
226# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
227# systems without shared libraries, LDLIBRARY is the same as LIBRARY
228# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
229# DLLLIBRARY is the shared (i.e., DLL) library.
230#
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000231AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000232AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000233AC_SUBST(BLDLIBRARY)
234AC_SUBST(LDLIBRARYDIR)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000235LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000236BLDLIBRARY='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000237DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000238LDLIBRARYDIR=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000239
Guido van Rossumfb842551997-08-06 23:42:07 +0000240# LINKCC is the command that links the python executable -- default is $(CC).
Fred Drake5790be12000-10-09 17:06:13 +0000241# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000242# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000243AC_SUBST(LINKCC)
244AC_MSG_CHECKING(LINKCC)
245if test -z "$LINKCC"
246then
247 case $ac_sys_system in
248 AIX*)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000249 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000250 dgux*)
251 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000252 Monterey64*)
253 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000254 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000255 esac
256fi
257AC_MSG_RESULT($LINKCC)
258
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000259AC_MSG_CHECKING(LDLIBRARY)
260
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000261# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000262case $MACHDEP in
263dguxR4)
264 LDLIBRARY='libpython$(VERSION).so'
265 OPT="$OPT -pic"
266 ;;
267beos*)
268 LDLIBRARY='libpython$(VERSION).so'
269 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000270cygwin*)
271 LDLIBRARY='libpython$(VERSION).dll.a'
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000272 DLLLIBRARY='libpython$(VERSION).dll'
Guido van Rossumaef734b2001-01-10 21:09:12 +0000273 ;;
Fred Drake5790be12000-10-09 17:06:13 +0000274esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000275
Guido van Rossumb8552162001-09-05 14:58:11 +0000276# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
277# library that we build, but we do not want to link against it (we
278# will find it with a -framework option). For this reason there is an
279# extra variable BLDLIBRARY against which Python and the extension
280# modules are linked, BLDLIBRARY. This is normally the same as
281# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000282if test "$enable_framework"
283then
284 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
285 LDLIBRARYDIR='$(PYTHONFRAMEWORKDIR)'
286 BLDLIBRARY=''
287else
288 BLDLIBRARY='$(LDLIBRARY)'
289fi
290
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000291AC_MSG_RESULT($LDLIBRARY)
292
Guido van Rossum627b2d71993-12-24 10:39:16 +0000293AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000294AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000295AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000296
297case $MACHDEP in
298bsdos*)
299 # install -d does not work on BSDI
300 if test -z "$INSTALL"
301 then
302 INSTALL="${srcdir}/install-sh -c"
303 fi
304esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000305AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000306
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000307# Not every filesystem supports hard links
308AC_SUBST(LN)
309if test -z "$LN" ; then
310 case $ac_sys_system in
311 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000312 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000313 *) LN=ln;;
314 esac
315fi
316
Fred Drake9f715822001-07-11 06:27:00 +0000317# Check for --with-pydebug
318AC_MSG_CHECKING(for --with-pydebug)
319AC_ARG_WITH(pydebug,
320[ --with-pydebug build with Py_DEBUG defined], [
321if test "$withval" != no
322then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
323else AC_MSG_RESULT(no); Py_DEBUG='false'
324fi],
325[AC_MSG_RESULT(no)])
326
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000327# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000328AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000329if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000330then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000331 case $GCC in
332 yes)
333 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000334 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000335 if test "$Py_DEBUG" = 'true' ; then
336 # Optimization messes up debuggers, so turn it off for
337 # debug builds.
338 OPT="-g -Wall -Wstrict-prototypes"
339 else
340 OPT="-g -O3 -Wall -Wstrict-prototypes"
341 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000342 *)
Fred Drake9f715822001-07-11 06:27:00 +0000343 OPT="-O3 -Wall -Wstrict-prototypes";;
344 esac
345 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000346 *)
347 case $ac_sys_system in
348 UnixWare*)
349 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
350 *)
351 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000352 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000353 esac
Jack Jansenca06bc62001-08-03 15:32:23 +0000354 case $ac_sys_system in
355 Darwin*)
356 OPT="$OPT -no-cpp-precomp";;
357 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000358fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000359
Trent Mick635f6fb2000-08-23 21:33:05 +0000360# The current (beta) Monterey compiler dies with optimizations
361case $ac_sys_system in
362Monterey*) OPT="";;
363esac
364
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000365if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000366then
367 OPT="$OPT $ac_arch_flags"
368fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000369
Guido van Rossum91922671997-10-09 20:24:13 +0000370AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
371AC_CACHE_VAL(ac_cv_opt_olimit_ok,
372[ac_save_cc="$CC"
373CC="$CC -OPT:Olimit=0"
374AC_TRY_RUN([int main() { return 0; }],
375 ac_cv_opt_olimit_ok=yes,
376 ac_cv_opt_olimit_ok=no)
377CC="$ac_save_cc"])
378AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000379if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000380 case $ac_sys_system in
381 Darwin*) OPT="$OPT" ;;
382 *) OPT="$OPT -OPT:Olimit=0";;
383 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000384else
385 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
386 AC_CACHE_VAL(ac_cv_olimit_ok,
387 [ac_save_cc="$CC"
388 CC="$CC -Olimit 1500"
389 AC_TRY_RUN([int main() { return 0; }],
390 ac_cv_olimit_ok=yes,
391 ac_cv_olimit_ok=no)
392 CC="$ac_save_cc"])
393 AC_MSG_RESULT($ac_cv_olimit_ok)
394 if test $ac_cv_olimit_ok = yes; then
395 OPT="$OPT -Olimit 1500"
396 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000397fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000398
Martin v. Löwis130fb172001-07-19 11:00:41 +0000399# -Kpthread, if available, provides the right #defines
400# and linker options to make pthread_create available
401AC_MSG_CHECKING(whether $CC accepts -Kpthread)
402AC_CACHE_VAL(ac_cv_kpthread,
403[ac_save_cc="$CC"
404CC="$CC -Kpthread"
405AC_TRY_LINK([#include <pthread.h>],[pthread_create(0,0,0,0)],
406 ac_cv_kpthread=yes,
407 ac_cv_kpthread=no)
408CC="$ac_save_cc"])
409
410# GCC does not reject -Kpthread as an illegal option, it merely complains that
411# it is unrecognized
412if test "$GCC" = "yes"
413then ac_cv_kpthread="no, we have gcc"
414fi
415AC_MSG_RESULT($ac_cv_kpthread)
416
Fred Drakece81d592000-07-09 14:39:29 +0000417dnl # check for ANSI or K&R ("traditional") preprocessor
418dnl AC_MSG_CHECKING(for C preprocessor type)
419dnl AC_TRY_COMPILE([
420dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
421dnl int foo;
422dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
423dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
424dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000425
Guido van Rossum627b2d71993-12-24 10:39:16 +0000426# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000427AC_HEADER_STDC
Martin v. Löwis9b75dca2001-08-10 13:58:50 +0000428AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h langinfo.h locale.h \
429ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000430signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000431sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000432sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000433sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
Martin v. Löwis1ba3fd52001-08-10 20:29:40 +0000434ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h netpacket/packet.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000435AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000436
437# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000438was_it_defined=no
439AC_MSG_CHECKING(for clock_t in time.h)
440AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
441AC_MSG_RESULT($was_it_defined)
442
Guido van Rossum810cc512001-09-09 23:51:39 +0000443# Two defines needed to enable largefile support on various platforms
444# These may affect some typedefs
445AC_DEFINE(_LARGEFILE_SOURCE)
446AC_DEFINE(_FILE_OFFSET_BITS, 64)
447
Guido van Rossum300fda71996-08-19 21:58:16 +0000448# Add some code to confdefs.h so that the test for off_t works on SCO
449cat >> confdefs.h <<\EOF
450#if defined(SCO_DS)
451#undef _OFF_T
452#endif
453EOF
454
Guido van Rossumef2255b2000-03-10 22:30:29 +0000455# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000456AC_TYPE_MODE_T
457AC_TYPE_OFF_T
458AC_TYPE_PID_T
459AC_TYPE_SIGNAL
460AC_TYPE_SIZE_T
461AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000462
Guido van Rossumef2255b2000-03-10 22:30:29 +0000463# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000464AC_CHECK_SIZEOF(int)
465AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000466AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000467AC_CHECK_SIZEOF(char)
468AC_CHECK_SIZEOF(short)
469AC_CHECK_SIZEOF(float)
470AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000471AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000472
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000473AC_MSG_CHECKING(for long long support)
474have_long_long=no
475AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
476AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000477if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000478AC_CHECK_SIZEOF(long long)
479fi
480
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000481AC_MSG_CHECKING(for uintptr_t support)
482have_uintptr_t=no
483AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
484AC_MSG_RESULT($have_uintptr_t)
485if test "$have_uintptr_t" = yes ; then
486AC_CHECK_SIZEOF(uintptr_t)
487fi
488
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000489# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
490AC_MSG_CHECKING(size of off_t)
491AC_CACHE_VAL(ac_cv_sizeof_off_t,
492[AC_TRY_RUN([#include <stdio.h>
493#include <sys/types.h>
494main()
495{
496 FILE *f=fopen("conftestval", "w");
497 if (!f) exit(1);
498 fprintf(f, "%d\n", sizeof(off_t));
499 exit(0);
500}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
501])
502AC_MSG_RESULT($ac_cv_sizeof_off_t)
503AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
504
505AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000506if test "$have_long_long" = yes -a \
507 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
508 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000509 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
510 AC_MSG_RESULT(yes)
511else
512 AC_MSG_RESULT(no)
513fi
514
Fred Drakea3f6e912000-06-29 20:44:47 +0000515# AC_CHECK_SIZEOF() doesn't include <time.h>.
516AC_MSG_CHECKING(size of time_t)
517AC_CACHE_VAL(ac_cv_sizeof_time_t,
518[AC_TRY_RUN([#include <stdio.h>
519#include <time.h>
520main()
521{
522 FILE *f=fopen("conftestval", "w");
523 if (!f) exit(1);
524 fprintf(f, "%d\n", sizeof(time_t));
525 exit(0);
526}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
527])
528AC_MSG_RESULT($ac_cv_sizeof_time_t)
529AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
530
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000531
Trent Mick635f6fb2000-08-23 21:33:05 +0000532# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000533ac_save_cc="$CC"
534if test "$ac_cv_kpthread" = "yes"
535then CC="$CC -Kpthread"
536fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000537AC_MSG_CHECKING(for pthread_t)
538have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000539AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000540AC_MSG_RESULT($have_pthread_t)
541if test "$have_pthread_t" = yes ; then
542 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
543 AC_MSG_CHECKING(size of pthread_t)
544 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
545 [AC_TRY_RUN([#include <stdio.h>
546 #include <pthread.h>
547 main()
548 {
549 FILE *f=fopen("conftestval", "w");
550 if (!f) exit(1);
551 fprintf(f, "%d\n", sizeof(pthread_t));
552 exit(0);
553 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
554 ])
555 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
556 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
557fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000558CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000559
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000560AC_MSG_CHECKING(for --enable-toolbox-glue)
561AC_ARG_ENABLE(toolbox-glue,
562[ --enable-toolbox-glue disable/enable MacOSX glue code for extensions])
563
564if test -z "$enable_toolbox_glue"
565then
566 case $ac_sys_system/$ac_sys_release in
567 Darwin/*)
568 enable_toolbox_glue="yes";;
569 *)
570 enable_toolbox_glue="no";;
571 esac
572fi
573case "$enable_toolbox_glue" in
574yes)
575 extra_frameworks="-framework Carbon -framework Foundation"
576 extra_machdep_objs="Python/mactoolboxglue.o"
Jack Jansen591cbed2001-08-15 13:55:15 +0000577 extra_undefs="-u __dummy -u _PyMac_Error"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000578 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
579 ;;
580*)
581 extra_frameworks=""
582 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +0000583 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000584 ;;
585esac
586AC_MSG_RESULT($enable_toolbox_glue)
587
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000588AC_SUBST(LIBTOOL_CRUFT)
589case $ac_sys_system/$ac_sys_release in
Jack Jansena3891ea2001-09-07 14:25:12 +0000590 Darwin/1.4*)
591 ns_undef_sym='_environ'
592 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym"
593 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
594 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
595 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +0000596 Darwin/*)
597 ns_undef_sym='_environ'
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000598 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym"
599 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
600 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
601 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000602esac
603
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000604AC_MSG_CHECKING(for --enable-framework)
605if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000606then
Jack Jansenca06bc62001-08-03 15:32:23 +0000607 OPT="$OPT -fno-common -dynamic"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000608 # -U __environ is needed since bundles don't have access
609 # to crt0 when built but will always be linked against it
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000610 # -F. is needed to allow linking to the framework while
611 # in the build location.
612
Jack Jansena3891ea2001-09-07 14:25:12 +0000613 case $ac_sys_system/$ac_sys_release in
614 Darwin/1.4*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";;
615 Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-U,$ns_undef_sym";;
616 esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000617 AC_DEFINE(WITH_NEXT_FRAMEWORK)
618 AC_MSG_RESULT(yes)
619else
620 AC_MSG_RESULT(no)
621fi
622
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000623AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000624case $ac_sys_system/$ac_sys_release in
625 Darwin/*)
626 AC_DEFINE(WITH_DYLD)
627 AC_MSG_RESULT(always on for Darwin)
628 ;;
629 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000630 AC_MSG_RESULT(no)
631 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000632esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000633
Guido van Rossumac405f61994-09-12 10:56:06 +0000634# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000635AC_SUBST(SO)
636AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000637AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000638AC_SUBST(CCSHARED)
639AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000640# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000641# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000642AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000643if test -z "$SO"
644then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000645 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000646 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000647 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000648 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000649 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000650fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000651AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000652# LDSHARED is the ld *command* used to create shared library
Martin v. Löwis5b718fc2001-09-10 15:34:42 +0000653# -- "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 +0000654# (Shared libraries in this instance are shared modules to be loaded into
655# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000656AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000657if test -z "$LDSHARED"
658then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000659 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000660 AIX*)
661 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
662 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
663 ;;
664 BeOS*)
665 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
666 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
667 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000668 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000669 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000670 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +0000671 SunOS/5*)
672 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000673 then LDSHARED='$(CC) -shared'
Martin v. Löwis5b718fc2001-09-10 15:34:42 +0000674 else LDSHARED="$(CC) -G";
Greg Ward57c9a6632000-05-26 12:22:54 +0000675 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000676 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000677 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000678 DYNIX/ptx*) LDSHARED="ld -G";;
Jack Jansena3891ea2001-09-07 14:25:12 +0000679 Darwin/1.4*)
680 LDSHARED='$(CC) $(LDFLAGS) -bundle'
681 if test "$enable_framework" ; then
682 # Link against the framework. All externals should be defined.
683 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
684 else
685 # No framework. Ignore undefined symbols, assuming they come from Python
686 LDSHARED="$LDSHARED -flat_namespace -undefined suppress"
687 fi ;;
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000688 Darwin/*)
689 LDSHARED='$(CC) $(LDFLAGS) -bundle'
690 if test "$enable_framework" ; then
691 # Link against the framework. All externals should be defined.
692 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
693 else
694 # No framework. Ignore undefined symbols, assuming they come from Python
695 LDSHARED="$LDSHARED -undefined suppress"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000696 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000697 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000698 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000699 BSD/OS*/4*) LDSHARED="gcc -shared";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000700 OpenBSD*|NetBSD*|FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000701 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000702 then
703 LDSHARED="cc -shared ${LDFLAGS}"
704 else
705 LDSHARED="ld -Bshareable ${LDFLAGS}"
706 fi;;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000707 UnixWare*)
708 if test "$GCC" = "yes"
709 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000710 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000711 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000712 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000713 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000714 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000715 *) LDSHARED="ld";;
716 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000717fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000718AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000719BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000720# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000721# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000722AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000723if test -z "$CCSHARED"
724then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000725 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000726 SunOS*) if test "$GCC" = yes;
727 then CCSHARED="-fPIC";
728 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000729 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +0000730 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +0000731 else CCSHARED="+z";
732 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000733 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000734 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000735 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000736 UnixWare*)
737 if test "$GCC" = "yes"
738 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000739 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000740 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000741 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000742 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000743 IRIX*/6*) case $CC in
744 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000745 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000746 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000747 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000748 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000749fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000750AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000751# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000752# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000753AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000754if test -z "$LINKFORSHARED"
755then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000756 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000757 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000758 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000759 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000760 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000761 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000762 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000763 Darwin/*)
764 # -u __dummy makes the linker aware of the objc runtime
765 # in System.framework; otherwise, __objcInit (referenced in
766 # crt1.o) gets erroneously defined as common, which breaks dynamic
767 # loading of any modules which reference it in System.framework.
768 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
769 # not used by the core itself but which needs to be in the core so
770 # that dynamically loaded extension modules have access to it.
Jack Jansen591cbed2001-08-15 13:55:15 +0000771 LINKFORSHARED="$extra_undefs -framework System"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000772 if test "$enable_framework"
773 then
774 LINKFORSHARED="$LINKFORSHARED -framework Python"
775 fi
776 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000777 UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000778 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000779 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000780 FreeBSD*|NetBSD*|OpenBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000781 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
782 then
783 LINKFORSHARED="-Wl,--export-dynamic"
784 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000785 SunOS/5*) case $CC in
786 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000787 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000788 then
789 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000790 fi;;
791 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000792 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000793fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000794AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000795
Neil Schemenauer61c51152001-01-26 16:18:16 +0000796AC_SUBST(CFLAGSFORSHARED)
797AC_MSG_CHECKING(CFLAGSFORSHARED)
798if test ! "$LIBRARY" = "$LDLIBRARY"
799then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000800 case $ac_sys_system in
801 CYGWIN*)
802 # Cygwin needs CCSHARED when building extension DLLs
803 # but not when building the interpreter DLL.
804 CFLAGSFORSHARED='';;
805 *)
806 CFLAGSFORSHARED='$(CCSHARED)'
807 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000808fi
809AC_MSG_RESULT($CFLAGSFORSHARED)
810
Guido van Rossum627b2d71993-12-24 10:39:16 +0000811# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000812AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
813AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000814
815# checks for system dependent C++ extensions support
816case "$ac_sys_system" in
817 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
818 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
819 [loadAndInit("", 0, "")],
820 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
821 AC_MSG_RESULT(yes)],
822 [AC_MSG_RESULT(no)]);;
823 *) ;;
824esac
825
Guido van Rossum70c7f481998-03-26 18:44:10 +0000826# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
827# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000828# BeOS' sockets are stashed in libnet.
829case "$ac_sys_system" in
830IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000831*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000832AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000833AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000834;;
835esac
836case "$ac_sys_system" in
837BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000838AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
839;;
840esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000841
Guido van Rossumc5a39031996-07-31 17:35:03 +0000842AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000843AC_ARG_WITH(libs,
844[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000845AC_MSG_RESULT($withval)
846LIBS="$withval $LIBS"
847], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000848
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000849# Determine if signalmodule should be used.
850AC_SUBST(USE_SIGNAL_MODULE)
851AC_SUBST(SIGNAL_OBJS)
852AC_MSG_CHECKING(for --with-signal-module)
853AC_ARG_WITH(signal-module,
854[ --with-signal-module disable/enable signal module])
855
856if test -z "$with_signal_module"
857then with_signal_module="yes"
858fi
859AC_MSG_RESULT($with_signal_module)
860
861if test "${with_signal_module}" = "yes"; then
862 USE_SIGNAL_MODULE=""
863 SIGNAL_OBJS=""
864else
865 USE_SIGNAL_MODULE="#"
866 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
867fi
868
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000869# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000870AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000871USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000872
Guido van Rossum54d93d41997-01-22 20:51:58 +0000873AC_MSG_CHECKING(for --with-dec-threads)
874AC_SUBST(LDLAST)
875AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000876[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
877AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000878LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000879if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000880 with_thread="$withval";
881fi],
882AC_MSG_RESULT(no))
883
884AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000885AC_ARG_WITH(threads,
886[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000887
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000888# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000889AC_ARG_WITH(thread,
890[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
891with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000892
893if test -z "$with_threads"
894then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000895fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000896AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000897
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000898if test "$with_threads" = "no"
899then
900 USE_THREAD_MODULE="#"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000901elif test "$ac_cv_kpthread" = "yes"
902then
903 CC="$CC -Kpthread"
904 AC_DEFINE(WITH_THREAD)
905 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000906 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000907 LIBOBJS="$LIBOBJS thread.o"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000908else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000909 if test ! -z "$with_threads" -a -d "$with_threads"
910 then LDFLAGS="$LDFLAGS -L$with_threads"
911 fi
912 if test ! -z "$withval" -a -d "$withval"
913 then LDFLAGS="$LDFLAGS -L$withval"
914 fi
915 AC_DEFINE(_REENTRANT)
916 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
917 AC_DEFINE(C_THREADS)
918 LIBOBJS="$LIBOBJS thread.o"],[
919 AC_MSG_CHECKING(for --with-pth)
920 AC_ARG_WITH(pth,
921 [ --with-pth use GNU pth threading libraries], [
922 AC_MSG_RESULT($withval)
923 AC_DEFINE(WITH_THREAD)
924 AC_DEFINE(HAVE_PTH)
925 LIBS="-lpth $LIBS"
926 LIBOBJS="$LIBOBJS thread.o"],[
927 AC_MSG_RESULT(no)
928 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000929 case $ac_sys_system in
930 Darwin*) ;;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000931 *) AC_DEFINE(_POSIX_THREADS)
932 posix_threads=yes
933 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000934 esac
Martin v. Löwis130fb172001-07-19 11:00:41 +0000935 LIBS="-lpthread $LIBS"
936 LIBOBJS="$LIBOBJS thread.o"],[
937 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
938 case $ac_sys_system in
939 Darwin*) ;;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000940 *) AC_DEFINE(_POSIX_THREADS)
941 posix_threads=yes
942 ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000943 esac
944 LIBOBJS="$LIBOBJS thread.o"],[
945 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
946 AC_DEFINE(BEOS_THREADS)
947 LIBOBJS="$LIBOBJS thread.o"],[
948 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
949 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000950 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000951 LIBS="$LIBS -lpthreads"
952 LIBOBJS="$LIBOBJS thread.o"], [
953 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
954 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000955 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000956 LIBS="$LIBS -lc_r"
957 LIBOBJS="$LIBOBJS thread.o"], [
958 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
959 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000960 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000961 LIBS="$LIBS -lthread"
962 LIBOBJS="$LIBOBJS thread.o"], [
963 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
964 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000965 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000966 LIBS="$LIBS -lpthread"
967 LIBOBJS="$LIBOBJS thread.o"], [
968 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
969 AC_DEFINE(_POSIX_THREADS)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000970 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +0000971 LIBS="$LIBS -lcma"
972 LIBOBJS="$LIBOBJS thread.o"],[
973 USE_THREAD_MODULE="#"])
974 ])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000975
Guido van Rossumd0b69ec2001-09-10 14:10:54 +0000976 if test "$posix_threads" = "yes"; then
977 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
978 AC_CACHE_VAL(ac_cv_pthread_system_supported,
979 [AC_TRY_RUN([#include <pthread.h>
980 void *foo(void *parm) {
981 return NULL;
982 }
983 main() {
984 pthread_attr_t attr;
985 if (pthread_attr_init(&attr)) exit(-1);
986 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
987 if (pthread_create(NULL, &attr, foo, NULL)) exit(-1);
988 exit(0);
989 }], ac_cv_pthread_system_supported=yes, ac_cv_pthread_system_supported=no)
990 ])
991 AC_MSG_RESULT($ac_cv_pthread_system_supported)
992 if test "$ac_cv_pthread_system_supported" = "yes"; then
993 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED)
994 fi
995 fi
996
Martin v. Löwis130fb172001-07-19 11:00:41 +0000997 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
998 LIBS="$LIBS -lmpc"
999 LIBOBJS="$LIBOBJS thread.o"
1000 USE_THREAD_MODULE=""])
1001 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1002 LIBS="$LIBS -lthread"
1003 LIBOBJS="$LIBOBJS thread.o"
1004 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001005
Martin v. Löwis130fb172001-07-19 11:00:41 +00001006 if test "$USE_THREAD_MODULE" != "#"
1007 then
1008 # If the above checks didn't disable threads, (at least) OSF1
1009 # needs this '-threads' argument during linking.
1010 case $ac_sys_system in
1011 OSF1) LDLAST=-threads;;
1012 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001013 fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001014fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001015
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001016# Check for enable-ipv6
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001017AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001018AC_ARG_ENABLE(ipv6,
1019[ --enable-ipv6 Enable ipv6 (with ipv4) support
1020 --disable-ipv6 Disable ipv6 support],
1021[ case "$enableval" in
1022 no)
1023 AC_MSG_RESULT(no)
1024 ipv6=no
1025 ;;
1026 *) AC_MSG_RESULT(yes)
1027 AC_DEFINE(ENABLE_IPV6)
1028 ipv6=yes
1029 ;;
1030 esac ],
1031
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001032[
1033dnl the check does not work on cross compilation case...
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001034 AC_TRY_RUN([ /* AF_INET6 available check */
1035#include <sys/types.h>
1036#include <sys/socket.h>
1037main()
1038{
1039 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1040 exit(1);
1041 else
1042 exit(0);
1043}
1044],
1045 AC_MSG_RESULT(yes)
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001046 ipv6=yes,
1047 AC_MSG_RESULT(no)
1048 ipv6=no,
1049 AC_MSG_RESULT(no)
1050 ipv6=no
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001051)
1052
1053if test "$ipv6" = "yes"; then
1054 AC_MSG_CHECKING(if RFC2553 API is available)
1055 AC_TRY_COMPILE([#include <sys/types.h>
1056#include <netinet/in.h>],
1057 [struct sockaddr_in6 x;
1058x.sin6_scope_id;],
1059 AC_MSG_RESULT(yes)
1060 ipv6=yes,
1061 AC_MSG_RESULT(no, IPv6 disabled)
1062 ipv6=no)
1063fi
1064
1065if test "$ipv6" = "yes"; then
1066 AC_DEFINE(ENABLE_IPV6)
1067fi
1068])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001069
1070ipv6type=unknown
1071ipv6lib=none
1072ipv6trylibc=no
1073
1074if test "$ipv6" = "yes"; then
1075 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00001076 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1077 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001078 case $i in
1079 inria)
1080 dnl http://www.kame.net/
1081 AC_EGREP_CPP(yes, [dnl
1082#include <netinet/in.h>
1083#ifdef IPV6_INRIA_VERSION
1084yes
1085#endif],
1086 [ipv6type=$i;
1087 OPT="-DINET6 $OPT"])
1088 ;;
1089 kame)
1090 dnl http://www.kame.net/
1091 AC_EGREP_CPP(yes, [dnl
1092#include <netinet/in.h>
1093#ifdef __KAME__
1094yes
1095#endif],
1096 [ipv6type=$i;
1097 ipv6lib=inet6
1098 ipv6libdir=/usr/local/v6/lib
1099 ipv6trylibc=yes
1100 OPT="-DINET6 $OPT"])
1101 ;;
1102 linux-glibc)
1103 dnl http://www.v6.linux.or.jp/
1104 AC_EGREP_CPP(yes, [dnl
1105#include <features.h>
1106#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1107yes
1108#endif],
1109 [ipv6type=$i;
1110 ipv6trylibc=yes
1111 OPT="-DINET6 $OPT"])
1112 ;;
1113 linux-inet6)
1114 dnl http://www.v6.linux.or.jp/
1115 if test -d /usr/inet6; then
1116 ipv6type=$i
1117 ipv6lib=inet6
1118 ipv6libdir=/usr/inet6/lib
1119 OPT="-DINET6 -I/usr/inet6/include $OPT"
1120 fi
1121 ;;
1122 solaris)
1123 if test -f /etc/netconfig; then
1124 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1125 ipv6type=$i
1126 ipv6trylibc=yes
1127 OPT="-DINET6 $OPT"
1128 fi
1129 fi
1130 ;;
1131 toshiba)
1132 AC_EGREP_CPP(yes, [dnl
1133#include <sys/param.h>
1134#ifdef _TOSHIBA_INET6
1135yes
1136#endif],
1137 [ipv6type=$i;
1138 ipv6lib=inet6;
1139 ipv6libdir=/usr/local/v6/lib;
1140 OPT="-DINET6 $OPT"])
1141 ;;
1142 v6d)
1143 AC_EGREP_CPP(yes, [dnl
1144#include </usr/local/v6/include/sys/v6config.h>
1145#ifdef __V6D__
1146yes
1147#endif],
1148 [ipv6type=$i;
1149 ipv6lib=v6;
1150 ipv6libdir=/usr/local/v6/lib;
1151 OPT="-I/usr/local/v6/include $OPT"])
1152 ;;
1153 zeta)
1154 AC_EGREP_CPP(yes, [dnl
1155#include <sys/param.h>
1156#ifdef _ZETA_MINAMI_INET6
1157yes
1158#endif],
1159 [ipv6type=$i;
1160 ipv6lib=inet6;
1161 ipv6libdir=/usr/local/v6/lib;
1162 OPT="-DINET6 $OPT"])
1163 ;;
1164 esac
1165 if test "$ipv6type" != "unknown"; then
1166 break
1167 fi
1168 done
1169 AC_MSG_RESULT($ipv6type)
1170fi
1171
1172if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1173 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1174 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1175 echo "using lib$ipv6lib"
1176 else
1177 if test $ipv6trylibc = "yes"; then
1178 echo "using libc"
1179 else
1180 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1181 echo "You need to fetch lib$ipv6lib.a from appropriate"
1182 echo 'ipv6 kit and compile beforehand.'
1183 exit 1
1184 fi
1185 fi
1186fi
1187
Barry Warsawef82cd72000-06-30 16:21:01 +00001188# Check for GC support
Barry Warsawef82cd72000-06-30 16:21:01 +00001189AC_MSG_CHECKING(for --with-cycle-gc)
1190AC_ARG_WITH(cycle-gc,
1191[ --with(out)-cycle-gc disable/enable garbage collection])
1192
1193if test -z "$with_cycle_gc"
1194then with_cycle_gc="yes"
1195fi
Neil Schemenauer9c63e6d2001-08-29 23:44:38 +00001196if test "$with_cycle_gc" != "no"
Barry Warsawef82cd72000-06-30 16:21:01 +00001197then
Barry Warsawef82cd72000-06-30 16:21:01 +00001198 AC_DEFINE(WITH_CYCLE_GC)
1199fi
1200AC_MSG_RESULT($with_cycle_gc)
1201
Neil Schemenauera35c6882001-02-27 04:45:05 +00001202# Check for Python-specific malloc support
1203AC_MSG_CHECKING(for --with-pymalloc)
1204AC_ARG_WITH(pymalloc,
1205[ --with(out)-pymalloc disable/enable specialized mallocs], [
1206if test "$withval" != no
1207then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1208else AC_MSG_RESULT(no)
1209fi],
1210[AC_MSG_RESULT(no)])
1211
Barry Warsawef82cd72000-06-30 16:21:01 +00001212# Check for --with-wctype-functions
1213AC_MSG_CHECKING(for --with-wctype-functions)
1214AC_ARG_WITH(wctype-functions,
1215[ --with-wctype-functions use wctype.h functions], [
1216if test "$withval" != no
1217then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1218else AC_MSG_RESULT(no)
1219fi],
1220[AC_MSG_RESULT(no)])
1221
Guido van Rossum68242b51996-05-28 22:53:03 +00001222# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001223AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00001224DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001225
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001226AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001227AC_ARG_WITH(sgi-dl,
1228[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001229AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001230AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +00001231DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001232dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001233if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001234then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001235else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1236fi
1237DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001238LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001239
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001240AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001241AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001242AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001243AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001244DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001245dldir=`echo "$withval" | sed 's/,.*//'`
1246dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001247if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001248then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001249else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1250fi
1251DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001252LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001253
Guido van Rossume97ee181999-12-20 21:27:22 +00001254# the dlopen() function means we might want to use dynload_shlib.o. some
1255# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001256AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001257
1258# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1259# loading of modules.
1260AC_SUBST(DYNLOADFILE)
1261AC_MSG_CHECKING(DYNLOADFILE)
1262if test -z "$DYNLOADFILE"
1263then
1264 case $ac_sys_system/$ac_sys_release in
1265 AIX*) DYNLOADFILE="dynload_aix.o";;
1266 BeOS*) DYNLOADFILE="dynload_beos.o";;
1267 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001268 Darwin/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001269 *)
1270 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1271 # out any dynamic loading
1272 if test "$ac_cv_func_dlopen" = yes
1273 then DYNLOADFILE="dynload_shlib.o"
1274 else DYNLOADFILE="dynload_stub.o"
1275 fi
1276 ;;
1277 esac
1278fi
1279AC_MSG_RESULT($DYNLOADFILE)
1280if test "$DYNLOADFILE" != "dynload_stub.o"
1281then
1282 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1283fi
1284
Jack Jansenc49e5b72001-06-19 15:00:23 +00001285# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1286
1287AC_SUBST(MACHDEP_OBJS)
1288AC_MSG_CHECKING(MACHDEP_OBJS)
1289if test -z "$MACHDEP_OBJS"
1290then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001291 MACHDEP_OBJS=$extra_machdep_objs
1292else
1293 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00001294fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001295AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00001296
Guido van Rossum627b2d71993-12-24 10:39:16 +00001297# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001298AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001299 flock fork fsync fdatasync fpathconf ftime ftruncate \
Martin v. Löwisf95dd0a2001-08-15 17:14:33 +00001300 gai_strerror getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwis864e9ff2001-08-04 22:32:03 +00001301 hstrerror inet_pton kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001302 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001303 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001304 select setegid seteuid setgid \
Martin v. Löwis791bfda2001-07-24 06:33:08 +00001305 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
Fred Drake35a092f1999-12-13 16:23:35 +00001306 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001307 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Woutersc2c12dc2001-07-11 14:45:34 +00001308 truncate uname waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001309
Fred Drake8cef4cf2000-06-28 16:40:38 +00001310# check for openpty and forkpty
1311
1312AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1313AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1314
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001315# check for long file support functions
1316AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1317
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001318AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001319AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1320AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1321AC_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 +00001322
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001323AC_CHECK_FUNCS(getaddrinfo, [dnl
1324AC_MSG_CHECKING(getaddrinfo bug)
1325AC_TRY_RUN([
1326#include <sys/types.h>
1327#include <netdb.h>
1328#include <string.h>
1329#include <sys/socket.h>
1330#include <netinet/in.h>
1331
1332main()
1333{
1334 int passive, gaierr, inet4 = 0, inet6 = 0;
1335 struct addrinfo hints, *ai, *aitop;
1336 char straddr[INET6_ADDRSTRLEN], strport[16];
1337
1338 for (passive = 0; passive <= 1; passive++) {
1339 memset(&hints, 0, sizeof(hints));
1340 hints.ai_family = AF_UNSPEC;
1341 hints.ai_flags = passive ? AI_PASSIVE : 0;
1342 hints.ai_socktype = SOCK_STREAM;
1343 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1344 (void)gai_strerror(gaierr);
1345 goto bad;
1346 }
1347 for (ai = aitop; ai; ai = ai->ai_next) {
1348 if (ai->ai_addr == NULL ||
1349 ai->ai_addrlen == 0 ||
1350 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1351 straddr, sizeof(straddr), strport, sizeof(strport),
1352 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1353 goto bad;
1354 }
1355 switch (ai->ai_family) {
1356 case AF_INET:
1357 if (strcmp(strport, "54321") != 0) {
1358 goto bad;
1359 }
1360 if (passive) {
1361 if (strcmp(straddr, "0.0.0.0") != 0) {
1362 goto bad;
1363 }
1364 } else {
1365 if (strcmp(straddr, "127.0.0.1") != 0) {
1366 goto bad;
1367 }
1368 }
1369 inet4++;
1370 break;
1371 case AF_INET6:
1372 if (strcmp(strport, "54321") != 0) {
1373 goto bad;
1374 }
1375 if (passive) {
1376 if (strcmp(straddr, "::") != 0) {
1377 goto bad;
1378 }
1379 } else {
1380 if (strcmp(straddr, "::1") != 0) {
1381 goto bad;
1382 }
1383 }
1384 inet6++;
1385 break;
1386 case AF_UNSPEC:
1387 goto bad;
1388 break;
1389 default:
1390 /* another family support? */
1391 break;
1392 }
1393 }
1394 }
1395
1396 if (!(inet4 == 0 || inet4 == 2))
1397 goto bad;
1398 if (!(inet6 == 0 || inet6 == 2))
1399 goto bad;
1400
1401 if (aitop)
1402 freeaddrinfo(aitop);
1403 exit(0);
1404
1405 bad:
1406 if (aitop)
1407 freeaddrinfo(aitop);
1408 exit(1);
1409}
1410],
1411AC_MSG_RESULT(good)
1412buggygetaddrinfo=no,
1413AC_MSG_RESULT(buggy)
1414buggygetaddrinfo=yes,
1415AC_MSG_RESULT(buggy)
1416buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
1417
1418if test "$buggygetaddrinfo" = "yes"; then
1419 if test "$ipv6" = "yes"; then
1420 echo 'Fatal: You must get working getaddrinfo() function.'
1421 echo ' or you can specify "--disable-ipv6"'.
1422 exit 1
1423 fi
1424fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00001425AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001426
Guido van Rossum627b2d71993-12-24 10:39:16 +00001427# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001428AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001429AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001430AC_STRUCT_TIMEZONE
1431
1432AC_MSG_CHECKING(for time.h that defines altzone)
1433AC_CACHE_VAL(ac_cv_header_time_altzone,
1434[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1435 ac_cv_header_time_altzone=yes,
1436 ac_cv_header_time_altzone=no)])
1437AC_MSG_RESULT($ac_cv_header_time_altzone)
1438if test $ac_cv_header_time_altzone = yes; then
1439 AC_DEFINE(HAVE_ALTZONE)
1440fi
1441
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001442was_it_defined=no
1443AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001444AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001445#include <sys/types.h>
1446#include <sys/select.h>
1447#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001448], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1449AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001450
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001451AC_MSG_CHECKING(for addrinfo)
1452AC_CACHE_VAL(ac_cv_struct_addrinfo,
1453AC_TRY_COMPILE([
1454# include <netdb.h>],
1455 [struct addrinfo a],
1456 ac_cv_struct_addrinfo=yes,
1457 ac_cv_struct_addrinfo=no))
1458AC_MSG_RESULT($ac_cv_struct_addrinfo)
1459if test $ac_cv_struct_addrinfo = yes; then
1460 AC_DEFINE(HAVE_ADDRINFO)
1461fi
1462
1463AC_MSG_CHECKING(for sockaddr_storage)
1464AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1465AC_TRY_COMPILE([
1466# include <sys/types.h>
1467# include <sys/socket.h>],
1468 [struct sockaddr_storage s],
1469 ac_cv_struct_sockaddr_storage=yes,
1470 ac_cv_struct_sockaddr_storage=no))
1471AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1472if test $ac_cv_struct_sockaddr_storage = yes; then
1473 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1474fi
1475
Guido van Rossum627b2d71993-12-24 10:39:16 +00001476# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001477
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001478AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001479AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001480
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001481works=no
1482AC_MSG_CHECKING(for working volatile)
1483AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1484AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001485
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001486works=no
1487AC_MSG_CHECKING(for working signed char)
1488AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1489AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001490
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001491have_prototypes=no
1492AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001493AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1494AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001495AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001496
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001497works=no
1498AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001499AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001500#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001501int foo(int x, ...) {
1502 va_list va;
1503 va_start(va, x);
1504 va_arg(va, int);
1505 va_arg(va, char *);
1506 va_arg(va, double);
1507 return 0;
1508}
1509], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001510AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1511AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001512
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001513if test "$have_prototypes" = yes; then
1514bad_prototypes=no
1515AC_MSG_CHECKING(for bad exec* prototypes)
1516AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1517 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1518AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001519fi
1520
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001521# check if sockaddr has sa_len member
1522AC_MSG_CHECKING(if sockaddr has sa_len member)
1523AC_TRY_COMPILE([#include <sys/types.h>
1524#include <sys/socket.h>],
1525[struct sockaddr x;
1526x.sa_len = 0;],
1527 AC_MSG_RESULT(yes)
1528 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1529 AC_MSG_RESULT(no))
1530
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001531AC_MSG_CHECKING(for bad static forward)
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001532AC_CACHE_VAL(ac_cv_bad_static_forward,
1533[AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001534struct s { int a; int b; };
1535static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001536int foobar() {
1537 static int random;
1538 random = (int) &foo;
1539 return random;
1540}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001541static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001542main() {
1543 exit(!((int)&foo == foobar()));
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001544}], ac_cv_bad_static_forward=no, ac_cv_bad_static_forward=yes)])
1545AC_MSG_RESULT($ac_cv_bad_static_forward)
1546if test "$ac_cv_bad_static_forward" = yes
1547then
1548 AC_DEFINE(BAD_STATIC_FORWARD)
1549fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001550
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001551va_list_is_array=no
1552AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001553AC_TRY_COMPILE([
1554#ifdef HAVE_STDARG_PROTOTYPES
1555#include <stdarg.h>
1556#else
1557#include <varargs.h>
1558#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001559], [va_list list1, list2; list1 = list2;], ,
1560AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1561AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001562
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001563# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1564AC_CHECK_FUNC(gethostbyname_r, [
1565 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1566 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1567 OLD_CFLAGS=$CFLAGS
1568 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1569 AC_TRY_COMPILE([
1570# include <netdb.h>
1571 ], [
1572 char *name;
1573 struct hostent *he, *res;
1574 char buffer[2048];
1575 int buflen = 2048;
1576 int h_errnop;
1577
1578 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1579 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001580 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001581 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1582 AC_MSG_RESULT(yes)
1583 ], [
1584 AC_MSG_RESULT(no)
1585 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1586 AC_TRY_COMPILE([
1587# include <netdb.h>
1588 ], [
1589 char *name;
1590 struct hostent *he;
1591 char buffer[2048];
1592 int buflen = 2048;
1593 int h_errnop;
1594
1595 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1596 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001597 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001598 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1599 AC_MSG_RESULT(yes)
1600 ], [
1601 AC_MSG_RESULT(no)
1602 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1603 AC_TRY_COMPILE([
1604# include <netdb.h>
1605 ], [
1606 char *name;
1607 struct hostent *he;
1608 struct hostent_data data;
1609
1610 (void) gethostbyname_r(name, he, &data);
1611 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001612 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001613 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1614 AC_MSG_RESULT(yes)
1615 ], [
1616 AC_MSG_RESULT(no)
1617 ])
1618 ])
1619 ])
1620 CFLAGS=$OLD_CFLAGS
1621], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001622 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001623])
1624AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1625AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1626AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001627AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001628AC_SUBST(HAVE_GETHOSTBYNAME)
1629
Guido van Rossum627b2d71993-12-24 10:39:16 +00001630# checks for system services
1631# (none yet)
1632
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001633# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001634AC_CHECK_FUNC(__fpu_control,
1635 [],
1636 [AC_CHECK_LIB(ieee, __fpu_control)
1637])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001638
Guido van Rossum93274221997-05-09 02:42:00 +00001639# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001640AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001641AC_ARG_WITH(fpectl,
1642[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001643if test "$withval" != no
1644then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1645else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001646fi],
1647[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001648
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001649# check for --with-libm=...
1650AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001651case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001652Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001653BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001654*) LIBM=-lm
1655esac
Guido van Rossum93274221997-05-09 02:42:00 +00001656AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001657AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001658if test "$withval" = no
1659then LIBM=
1660 AC_MSG_RESULT(force LIBM empty)
1661elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001662then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001663 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001664else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001665fi],
1666[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001667
1668# check for --with-libc=...
1669AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001670AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001671AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001672if test "$withval" = no
1673then LIBC=
1674 AC_MSG_RESULT(force LIBC empty)
1675elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001676then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001677 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001678else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001679fi],
1680[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001681
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001682# check for hypot() in math library
1683LIBS_SAVE=$LIBS
1684LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001685AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001686LIBS=$LIBS_SAVE
1687
Guido van Rossumad713701997-07-10 22:42:38 +00001688# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001689AC_MSG_CHECKING(what malloc(0) returns)
1690AC_CACHE_VAL(ac_cv_malloc_zero,
1691[AC_TRY_RUN([#include <stdio.h>
1692#ifdef HAVE_STDLIB
1693#include <stdlib.h>
1694#else
1695char *malloc(), *realloc();
1696int *free();
1697#endif
1698main() {
1699 char *p;
1700 p = malloc(0);
1701 if (p == NULL) exit(1);
1702 p = realloc(p, 0);
1703 if (p == NULL) exit(1);
1704 free(p);
1705 exit(0);
1706}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1707AC_MSG_RESULT($ac_cv_malloc_zero)
1708if test "$ac_cv_malloc_zero" = null
1709then
1710 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1711fi
1712
Guido van Rossumef2255b2000-03-10 22:30:29 +00001713# check for wchar.h
1714AC_CHECK_HEADER(wchar.h,
1715AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1716wchar_h="no"
1717)
1718
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001719# determine wchar_t size
1720if test "$wchar_h" = yes
1721then
1722 AC_CHECK_SIZEOF(wchar_t)
1723fi
1724
1725AC_MSG_CHECKING(what type to use for unicode)
1726AC_ARG_ENABLE(unicode,
1727[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1728
1729if test $enable_unicode = yes
1730then
Martin v. Löwisfd917792001-06-27 20:22:04 +00001731 # Without any arguments, Py_UNICODE defaults to two-byte mode
1732 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001733fi
1734
1735case "$enable_unicode" in
1736ucs2) unicode_size="2"
1737 AC_DEFINE(Py_UNICODE_SIZE,2)
1738 ;;
1739ucs4) unicode_size="4"
1740 AC_DEFINE(Py_UNICODE_SIZE,4)
1741 ;;
1742esac
1743
Martin v. Löwis339d0f72001-08-17 18:39:25 +00001744AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001745if test "$enable_unicode" = "no"
1746then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00001747 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001748 AC_MSG_RESULT(not used)
1749else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00001750 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001751 AC_DEFINE(Py_USING_UNICODE)
1752 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1753 then
1754 PY_UNICODE_TYPE="wchar_t"
1755 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1756 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1757 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1758 then
1759 PY_UNICODE_TYPE="unsigned short"
1760 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1761 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1762 then
1763 PY_UNICODE_TYPE="unsigned long"
1764 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1765 else
1766 PY_UNICODE_TYPE="no type found"
1767 fi
1768 AC_MSG_RESULT($PY_UNICODE_TYPE)
1769fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00001770
1771# check for endianness
1772AC_C_BIGENDIAN
1773
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001774# Check whether right shifting a negative integer extends the sign bit
1775# or fills with zeros (like the Cray J90, according to Tim Peters).
1776AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001777AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001778AC_TRY_RUN([
1779int main()
1780{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001781 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001782}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001783], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1784AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1785if test "$ac_cv_rshift_extends_sign" = no
1786then
1787 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1788fi
1789
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001790# check for getc_unlocked and related locking functions
1791AC_MSG_CHECKING(for getc_unlocked() and friends)
1792AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1793AC_TRY_LINK([#include <stdio.h>],[
1794 FILE *f = fopen("/dev/null", "r");
1795 flockfile(f);
1796 getc_unlocked(f);
1797 funlockfile(f);
1798], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1799AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1800if test "$ac_cv_have_getc_unlocked" = yes
1801then
1802 AC_DEFINE(HAVE_GETC_UNLOCKED)
1803fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001804
Guido van Rossum353ae582001-07-10 16:45:32 +00001805# check for readline 4.2
1806AC_CHECK_LIB(readline, rl_completion_matches,
1807 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1808
Thomas Wouterse38b2f12001-07-11 22:35:31 +00001809AC_MSG_CHECKING(for broken nice())
1810AC_CACHE_VAL(ac_cv_broken_nice, [
1811AC_TRY_RUN([
1812int main()
1813{
1814 int val1 = nice(1);
1815 if (val1 != -1 && val1 == nice(2))
1816 exit(0);
1817 exit(1);
1818}
1819],ac_cv_broken_nice=yes, ac_cv_broken_nice=no)])
1820AC_MSG_RESULT($ac_cv_broken_nice)
1821if test "$ac_cv_broken_nice" = yes
1822then
1823 AC_DEFINE(HAVE_BROKEN_NICE)
1824fi
1825
Guido van Rossum95713eb2000-05-18 20:53:31 +00001826# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1827# Add sys/socket.h to confdefs.h
1828cat >> confdefs.h <<\EOF
1829#ifdef HAVE_SYS_SOCKET_H
1830#include <sys/socket.h>
1831#endif
1832EOF
1833AC_CHECK_TYPE(socklen_t, int)
1834
Neil Schemenauerf25cf6c2001-03-04 06:39:33 +00001835# Add Python/ prefix to LIBOBJS
1836libobjs=$LIBOBJS
1837LIBOBJS=
1838for obj in $libobjs; do
1839 LIBOBJS="$LIBOBJS Python/$obj"
1840done
1841
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001842#AC_MSG_CHECKING(for Modules/Setup)
1843#if test ! -f Modules/Setup ; then
1844# if test ! -d Modules ; then
1845# mkdir Modules
1846# fi
1847# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1848# AC_MSG_RESULT(creating)
1849#else
1850# AC_MSG_RESULT(already exists)
1851#fi
1852
1853AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00001854SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001855AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001856for dir in $SRCDIRS; do
1857 if test ! -d $dir; then
1858 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001859 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001860done
1861AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001862
Guido van Rossum627b2d71993-12-24 10:39:16 +00001863# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001864AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001865
1866echo "creating Setup"
1867if test ! -f Modules/Setup
1868then
1869 cp $srcdir/Modules/Setup.dist Modules/Setup
1870fi
1871
1872echo "creating Setup.local"
1873if test ! -f Modules/Setup.local
1874then
1875 echo "# Edit this file for local setup changes" >Modules/Setup.local
1876fi
1877
1878echo "creating Makefile"
1879$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1880 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00001881 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00001882mv config.c Modules