blob: 396728b73644f8240a05b6f39efd795aea8a48ef [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
276# MacOSX framework builds need more magic. LDLIBRARY is the dynamic library that
277# we build, but we do not want to link against it (we will find it with a -framework
278# option). For this reason there is an extra variable BLDLIBRARY against which Python
279# and the extension modules are linked, BLDLIBRARY. This is normally the same
280# as LDLIBRARY, but empty for MacOSX framework builds.
281if test "$enable_framework"
282then
283 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
284 LDLIBRARYDIR='$(PYTHONFRAMEWORKDIR)'
285 BLDLIBRARY=''
286else
287 BLDLIBRARY='$(LDLIBRARY)'
288fi
289
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000290AC_MSG_RESULT($LDLIBRARY)
291
Guido van Rossum627b2d71993-12-24 10:39:16 +0000292AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000293AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000294AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000295
296case $MACHDEP in
297bsdos*)
298 # install -d does not work on BSDI
299 if test -z "$INSTALL"
300 then
301 INSTALL="${srcdir}/install-sh -c"
302 fi
303esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000304AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000305
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000306# Not every filesystem supports hard links
307AC_SUBST(LN)
308if test -z "$LN" ; then
309 case $ac_sys_system in
310 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000311 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000312 *) LN=ln;;
313 esac
314fi
315
Fred Drake9f715822001-07-11 06:27:00 +0000316# Check for --with-pydebug
317AC_MSG_CHECKING(for --with-pydebug)
318AC_ARG_WITH(pydebug,
319[ --with-pydebug build with Py_DEBUG defined], [
320if test "$withval" != no
321then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
322else AC_MSG_RESULT(no); Py_DEBUG='false'
323fi],
324[AC_MSG_RESULT(no)])
325
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000326# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000327AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000328if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000329then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000330 case $GCC in
331 yes)
332 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000333 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000334 if test "$Py_DEBUG" = 'true' ; then
335 # Optimization messes up debuggers, so turn it off for
336 # debug builds.
337 OPT="-g -Wall -Wstrict-prototypes"
338 else
339 OPT="-g -O3 -Wall -Wstrict-prototypes"
340 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000341 *)
Fred Drake9f715822001-07-11 06:27:00 +0000342 OPT="-O3 -Wall -Wstrict-prototypes";;
343 esac
344 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000345 *)
346 case $ac_sys_system in
347 UnixWare*)
348 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
349 *)
350 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000351 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000352 esac
Jack Jansenca06bc62001-08-03 15:32:23 +0000353 case $ac_sys_system in
354 Darwin*)
355 OPT="$OPT -no-cpp-precomp";;
356 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000357fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000358
Trent Mick635f6fb2000-08-23 21:33:05 +0000359# The current (beta) Monterey compiler dies with optimizations
360case $ac_sys_system in
361Monterey*) OPT="";;
362esac
363
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000364if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000365then
366 OPT="$OPT $ac_arch_flags"
367fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000368
Guido van Rossum91922671997-10-09 20:24:13 +0000369AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
370AC_CACHE_VAL(ac_cv_opt_olimit_ok,
371[ac_save_cc="$CC"
372CC="$CC -OPT:Olimit=0"
373AC_TRY_RUN([int main() { return 0; }],
374 ac_cv_opt_olimit_ok=yes,
375 ac_cv_opt_olimit_ok=no)
376CC="$ac_save_cc"])
377AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000378if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000379 case $ac_sys_system in
380 Darwin*) OPT="$OPT" ;;
381 *) OPT="$OPT -OPT:Olimit=0";;
382 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000383else
384 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
385 AC_CACHE_VAL(ac_cv_olimit_ok,
386 [ac_save_cc="$CC"
387 CC="$CC -Olimit 1500"
388 AC_TRY_RUN([int main() { return 0; }],
389 ac_cv_olimit_ok=yes,
390 ac_cv_olimit_ok=no)
391 CC="$ac_save_cc"])
392 AC_MSG_RESULT($ac_cv_olimit_ok)
393 if test $ac_cv_olimit_ok = yes; then
394 OPT="$OPT -Olimit 1500"
395 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000396fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000397
Martin v. Löwis130fb172001-07-19 11:00:41 +0000398# -Kpthread, if available, provides the right #defines
399# and linker options to make pthread_create available
400AC_MSG_CHECKING(whether $CC accepts -Kpthread)
401AC_CACHE_VAL(ac_cv_kpthread,
402[ac_save_cc="$CC"
403CC="$CC -Kpthread"
404AC_TRY_LINK([#include <pthread.h>],[pthread_create(0,0,0,0)],
405 ac_cv_kpthread=yes,
406 ac_cv_kpthread=no)
407CC="$ac_save_cc"])
408
409# GCC does not reject -Kpthread as an illegal option, it merely complains that
410# it is unrecognized
411if test "$GCC" = "yes"
412then ac_cv_kpthread="no, we have gcc"
413fi
414AC_MSG_RESULT($ac_cv_kpthread)
415
Fred Drakece81d592000-07-09 14:39:29 +0000416dnl # check for ANSI or K&R ("traditional") preprocessor
417dnl AC_MSG_CHECKING(for C preprocessor type)
418dnl AC_TRY_COMPILE([
419dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
420dnl int foo;
421dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
422dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
423dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000424
Guido van Rossum627b2d71993-12-24 10:39:16 +0000425# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000426AC_HEADER_STDC
Martin v. Löwis9b75dca2001-08-10 13:58:50 +0000427AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h langinfo.h locale.h \
428ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000429signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000430sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000431sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000432sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
Martin v. Löwis1ba3fd52001-08-10 20:29:40 +0000433ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h netpacket/packet.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000434AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000435
436# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000437was_it_defined=no
438AC_MSG_CHECKING(for clock_t in time.h)
439AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
440AC_MSG_RESULT($was_it_defined)
441
Guido van Rossum300fda71996-08-19 21:58:16 +0000442# Add some code to confdefs.h so that the test for off_t works on SCO
443cat >> confdefs.h <<\EOF
444#if defined(SCO_DS)
445#undef _OFF_T
446#endif
447EOF
448
Guido van Rossumef2255b2000-03-10 22:30:29 +0000449# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000450AC_TYPE_MODE_T
451AC_TYPE_OFF_T
452AC_TYPE_PID_T
453AC_TYPE_SIGNAL
454AC_TYPE_SIZE_T
455AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000456
Guido van Rossumef2255b2000-03-10 22:30:29 +0000457# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000458AC_CHECK_SIZEOF(int)
459AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000460AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000461AC_CHECK_SIZEOF(char)
462AC_CHECK_SIZEOF(short)
463AC_CHECK_SIZEOF(float)
464AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000465AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000466
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000467AC_MSG_CHECKING(for long long support)
468have_long_long=no
469AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
470AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000471if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000472AC_CHECK_SIZEOF(long long)
473fi
474
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000475AC_MSG_CHECKING(for uintptr_t support)
476have_uintptr_t=no
477AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
478AC_MSG_RESULT($have_uintptr_t)
479if test "$have_uintptr_t" = yes ; then
480AC_CHECK_SIZEOF(uintptr_t)
481fi
482
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000483# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
484AC_MSG_CHECKING(size of off_t)
485AC_CACHE_VAL(ac_cv_sizeof_off_t,
486[AC_TRY_RUN([#include <stdio.h>
487#include <sys/types.h>
488main()
489{
490 FILE *f=fopen("conftestval", "w");
491 if (!f) exit(1);
492 fprintf(f, "%d\n", sizeof(off_t));
493 exit(0);
494}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
495])
496AC_MSG_RESULT($ac_cv_sizeof_off_t)
497AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
498
499AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000500if test "$have_long_long" = yes -a \
501 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
502 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000503 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
504 AC_MSG_RESULT(yes)
505else
506 AC_MSG_RESULT(no)
507fi
508
Fred Drakea3f6e912000-06-29 20:44:47 +0000509# AC_CHECK_SIZEOF() doesn't include <time.h>.
510AC_MSG_CHECKING(size of time_t)
511AC_CACHE_VAL(ac_cv_sizeof_time_t,
512[AC_TRY_RUN([#include <stdio.h>
513#include <time.h>
514main()
515{
516 FILE *f=fopen("conftestval", "w");
517 if (!f) exit(1);
518 fprintf(f, "%d\n", sizeof(time_t));
519 exit(0);
520}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
521])
522AC_MSG_RESULT($ac_cv_sizeof_time_t)
523AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
524
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000525
Trent Mick635f6fb2000-08-23 21:33:05 +0000526# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000527ac_save_cc="$CC"
528if test "$ac_cv_kpthread" = "yes"
529then CC="$CC -Kpthread"
530fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000531AC_MSG_CHECKING(for pthread_t)
532have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000533AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000534AC_MSG_RESULT($have_pthread_t)
535if test "$have_pthread_t" = yes ; then
536 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
537 AC_MSG_CHECKING(size of pthread_t)
538 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
539 [AC_TRY_RUN([#include <stdio.h>
540 #include <pthread.h>
541 main()
542 {
543 FILE *f=fopen("conftestval", "w");
544 if (!f) exit(1);
545 fprintf(f, "%d\n", sizeof(pthread_t));
546 exit(0);
547 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
548 ])
549 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
550 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
551fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000552CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000553
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000554AC_MSG_CHECKING(for --enable-toolbox-glue)
555AC_ARG_ENABLE(toolbox-glue,
556[ --enable-toolbox-glue disable/enable MacOSX glue code for extensions])
557
558if test -z "$enable_toolbox_glue"
559then
560 case $ac_sys_system/$ac_sys_release in
561 Darwin/*)
562 enable_toolbox_glue="yes";;
563 *)
564 enable_toolbox_glue="no";;
565 esac
566fi
567case "$enable_toolbox_glue" in
568yes)
569 extra_frameworks="-framework Carbon -framework Foundation"
570 extra_machdep_objs="Python/mactoolboxglue.o"
571 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
572 ;;
573*)
574 extra_frameworks=""
575 extra_machdep_objs=""
576 ;;
577esac
578AC_MSG_RESULT($enable_toolbox_glue)
579
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000580AC_SUBST(LIBTOOL_CRUFT)
581case $ac_sys_system/$ac_sys_release in
Guido van Rossum5839e582000-10-09 19:52:35 +0000582 Darwin/*)
583 ns_undef_sym='_environ'
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000584 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym"
585 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
586 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
587 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000588esac
589
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000590AC_MSG_CHECKING(for --enable-framework)
591if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000592then
Jack Jansenca06bc62001-08-03 15:32:23 +0000593 OPT="$OPT -fno-common -dynamic"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000594 # -U __environ is needed since bundles don't have access
595 # to crt0 when built but will always be linked against it
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000596 # -F. is needed to allow linking to the framework while
597 # in the build location.
598
599 LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-U,$ns_undef_sym"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000600 AC_DEFINE(WITH_NEXT_FRAMEWORK)
601 AC_MSG_RESULT(yes)
602else
603 AC_MSG_RESULT(no)
604fi
605
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000606AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000607case $ac_sys_system/$ac_sys_release in
608 Darwin/*)
609 AC_DEFINE(WITH_DYLD)
610 AC_MSG_RESULT(always on for Darwin)
611 ;;
612 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000613 AC_MSG_RESULT(no)
614 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000615esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000616
Guido van Rossumac405f61994-09-12 10:56:06 +0000617# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000618AC_SUBST(SO)
619AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000620AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000621AC_SUBST(CCSHARED)
622AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000623# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000624# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000625AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000626if test -z "$SO"
627then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000628 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000629 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000630 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000631 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000632 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000633fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000634AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000635# LDSHARED is the ld *command* used to create shared library
636# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000637# (Shared libraries in this instance are shared modules to be loaded into
638# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000639AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000640if test -z "$LDSHARED"
641then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000642 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000643 AIX*)
644 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
645 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
646 ;;
647 BeOS*)
648 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
649 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
650 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000651 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000652 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000653 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +0000654 SunOS/5*)
655 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000656 then LDSHARED='$(CC) -shared'
Greg Ward57c9a6632000-05-26 12:22:54 +0000657 else LDSHARED="ld -G";
658 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000659 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000660 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000661 DYNIX/ptx*) LDSHARED="ld -G";;
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000662 Darwin/*)
663 LDSHARED='$(CC) $(LDFLAGS) -bundle'
664 if test "$enable_framework" ; then
665 # Link against the framework. All externals should be defined.
666 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
667 else
668 # No framework. Ignore undefined symbols, assuming they come from Python
669 LDSHARED="$LDSHARED -undefined suppress"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000670 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000671 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000672 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000673 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000674 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000675 NetBSD*)
676 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
677 then
678 LDSHARED="cc -shared"
679 else
680 LDSHARED="ld -Bshareable"
681 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000682 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000683 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000684 then
685 LDSHARED="cc -shared ${LDFLAGS}"
686 else
687 LDSHARED="ld -Bshareable ${LDFLAGS}"
688 fi;;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000689 UnixWare*)
690 if test "$GCC" = "yes"
691 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000692 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000693 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000694 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000695 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000696 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000697 *) LDSHARED="ld";;
698 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000699fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000700AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000701BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000702# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000703# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000704AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000705if test -z "$CCSHARED"
706then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000707 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000708 SunOS*) if test "$GCC" = yes;
709 then CCSHARED="-fPIC";
710 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000711 hp*|HP*) if test "$GCC" = yes;
712 then CCSHARED="-fpic";
713 else CCSHARED="+z";
714 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000715 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000716 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000717 OpenBSD*) CCSHARED="-fpic";;
718 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000719 UnixWare*)
720 if test "$GCC" = "yes"
721 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000722 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000723 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000724 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000725 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000726 IRIX*/6*) case $CC in
727 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000728 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000729 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000730 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000731 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000732fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000733AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000734# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000735# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000736AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000737if test -z "$LINKFORSHARED"
738then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000739 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000740 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000741 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000742 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000743 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000744 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000745 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000746 Darwin/*)
747 # -u __dummy makes the linker aware of the objc runtime
748 # in System.framework; otherwise, __objcInit (referenced in
749 # crt1.o) gets erroneously defined as common, which breaks dynamic
750 # loading of any modules which reference it in System.framework.
751 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
752 # not used by the core itself but which needs to be in the core so
753 # that dynamically loaded extension modules have access to it.
754 LINKFORSHARED="-u __dummy -u _PyMac_Error -framework System"
755 if test "$enable_framework"
756 then
757 LINKFORSHARED="$LINKFORSHARED -framework Python"
758 fi
759 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000760 UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000761 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000762 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000763 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000764 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
765 then
766 LINKFORSHARED="-Wl,--export-dynamic"
767 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000768 SunOS/5*) case $CC in
769 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000770 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000771 then
772 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000773 fi;;
774 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000775 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000776fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000777AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000778
Neil Schemenauer61c51152001-01-26 16:18:16 +0000779AC_SUBST(CFLAGSFORSHARED)
780AC_MSG_CHECKING(CFLAGSFORSHARED)
781if test ! "$LIBRARY" = "$LDLIBRARY"
782then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000783 case $ac_sys_system in
784 CYGWIN*)
785 # Cygwin needs CCSHARED when building extension DLLs
786 # but not when building the interpreter DLL.
787 CFLAGSFORSHARED='';;
788 *)
789 CFLAGSFORSHARED='$(CCSHARED)'
790 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000791fi
792AC_MSG_RESULT($CFLAGSFORSHARED)
793
Guido van Rossum627b2d71993-12-24 10:39:16 +0000794# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000795AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
796AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000797
798# checks for system dependent C++ extensions support
799case "$ac_sys_system" in
800 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
801 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
802 [loadAndInit("", 0, "")],
803 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
804 AC_MSG_RESULT(yes)],
805 [AC_MSG_RESULT(no)]);;
806 *) ;;
807esac
808
Guido van Rossum70c7f481998-03-26 18:44:10 +0000809# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
810# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000811# BeOS' sockets are stashed in libnet.
812case "$ac_sys_system" in
813IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000814*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000815AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000816AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000817;;
818esac
819case "$ac_sys_system" in
820BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000821AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
822;;
823esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000824
Guido van Rossumc5a39031996-07-31 17:35:03 +0000825AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000826AC_ARG_WITH(libs,
827[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000828AC_MSG_RESULT($withval)
829LIBS="$withval $LIBS"
830], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000831
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000832# Determine if signalmodule should be used.
833AC_SUBST(USE_SIGNAL_MODULE)
834AC_SUBST(SIGNAL_OBJS)
835AC_MSG_CHECKING(for --with-signal-module)
836AC_ARG_WITH(signal-module,
837[ --with-signal-module disable/enable signal module])
838
839if test -z "$with_signal_module"
840then with_signal_module="yes"
841fi
842AC_MSG_RESULT($with_signal_module)
843
844if test "${with_signal_module}" = "yes"; then
845 USE_SIGNAL_MODULE=""
846 SIGNAL_OBJS=""
847else
848 USE_SIGNAL_MODULE="#"
849 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
850fi
851
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000852# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000853AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000854USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000855
Guido van Rossum54d93d41997-01-22 20:51:58 +0000856AC_MSG_CHECKING(for --with-dec-threads)
857AC_SUBST(LDLAST)
858AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000859[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
860AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000861LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000862if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000863 with_thread="$withval";
864fi],
865AC_MSG_RESULT(no))
866
867AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000868AC_ARG_WITH(threads,
869[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000870
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000871# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000872AC_ARG_WITH(thread,
873[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
874with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000875
876if test -z "$with_threads"
877then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000878fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000879AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000880
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000881if test "$with_threads" = "no"
882then
883 USE_THREAD_MODULE="#"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000884elif test "$ac_cv_kpthread" = "yes"
885then
886 CC="$CC -Kpthread"
887 AC_DEFINE(WITH_THREAD)
888 AC_DEFINE(_POSIX_THREADS)
889 LIBOBJS="$LIBOBJS thread.o"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000890else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000891 if test ! -z "$with_threads" -a -d "$with_threads"
892 then LDFLAGS="$LDFLAGS -L$with_threads"
893 fi
894 if test ! -z "$withval" -a -d "$withval"
895 then LDFLAGS="$LDFLAGS -L$withval"
896 fi
897 AC_DEFINE(_REENTRANT)
898 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
899 AC_DEFINE(C_THREADS)
900 LIBOBJS="$LIBOBJS thread.o"],[
901 AC_MSG_CHECKING(for --with-pth)
902 AC_ARG_WITH(pth,
903 [ --with-pth use GNU pth threading libraries], [
904 AC_MSG_RESULT($withval)
905 AC_DEFINE(WITH_THREAD)
906 AC_DEFINE(HAVE_PTH)
907 LIBS="-lpth $LIBS"
908 LIBOBJS="$LIBOBJS thread.o"],[
909 AC_MSG_RESULT(no)
910 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000911 case $ac_sys_system in
912 Darwin*) ;;
913 *) AC_DEFINE(_POSIX_THREADS);;
914 esac
Martin v. Löwis130fb172001-07-19 11:00:41 +0000915 LIBS="-lpthread $LIBS"
916 LIBOBJS="$LIBOBJS thread.o"],[
917 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
918 case $ac_sys_system in
919 Darwin*) ;;
920 *) AC_DEFINE(_POSIX_THREADS);;
921 esac
922 LIBOBJS="$LIBOBJS thread.o"],[
923 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
924 AC_DEFINE(BEOS_THREADS)
925 LIBOBJS="$LIBOBJS thread.o"],[
926 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
927 AC_DEFINE(_POSIX_THREADS)
928 LIBS="$LIBS -lpthreads"
929 LIBOBJS="$LIBOBJS thread.o"], [
930 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
931 AC_DEFINE(_POSIX_THREADS)
932 LIBS="$LIBS -lc_r"
933 LIBOBJS="$LIBOBJS thread.o"], [
934 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
935 AC_DEFINE(_POSIX_THREADS)
936 LIBS="$LIBS -lthread"
937 LIBOBJS="$LIBOBJS thread.o"], [
938 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
939 AC_DEFINE(_POSIX_THREADS)
940 LIBS="$LIBS -lpthread"
941 LIBOBJS="$LIBOBJS thread.o"], [
942 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
943 AC_DEFINE(_POSIX_THREADS)
944 LIBS="$LIBS -lcma"
945 LIBOBJS="$LIBOBJS thread.o"],[
946 USE_THREAD_MODULE="#"])
947 ])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000948
Martin v. Löwis130fb172001-07-19 11:00:41 +0000949 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
950 LIBS="$LIBS -lmpc"
951 LIBOBJS="$LIBOBJS thread.o"
952 USE_THREAD_MODULE=""])
953 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
954 LIBS="$LIBS -lthread"
955 LIBOBJS="$LIBOBJS thread.o"
956 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +0000957
Martin v. Löwis130fb172001-07-19 11:00:41 +0000958 if test "$USE_THREAD_MODULE" != "#"
959 then
960 # If the above checks didn't disable threads, (at least) OSF1
961 # needs this '-threads' argument during linking.
962 case $ac_sys_system in
963 OSF1) LDLAST=-threads;;
964 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +0000965 fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000966fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000967
Martin v. Löwisa2ac6022001-08-09 11:40:14 +0000968# Check for enable-ipv6
969AC_MSG_CHECKING([whether to enable ipv6])
970AC_ARG_ENABLE(ipv6,
971[ --enable-ipv6 Enable ipv6 (with ipv4) support
972 --disable-ipv6 Disable ipv6 support],
973[ case "$enableval" in
974 no)
975 AC_MSG_RESULT(no)
976 ipv6=no
977 ;;
978 *) AC_MSG_RESULT(yes)
979 AC_DEFINE(ENABLE_IPV6)
980 ipv6=yes
981 ;;
982 esac ],
983
984 AC_TRY_RUN([ /* AF_INET6 available check */
985#include <sys/types.h>
986#include <sys/socket.h>
987main()
988{
989 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
990 exit(1);
991 else
992 exit(0);
993}
994],
995 AC_MSG_RESULT(yes)
996 AC_DEFINE(ENABLE_IPV6)
997 ipv6=yes,
998 AC_MSG_RESULT(no)
999 ipv6=no,
1000 AC_MSG_RESULT(no)
1001 ipv6=no
1002))
1003
1004ipv6type=unknown
1005ipv6lib=none
1006ipv6trylibc=no
1007
1008if test "$ipv6" = "yes"; then
1009 AC_MSG_CHECKING([ipv6 stack type])
1010 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta; do
1011 case $i in
1012 inria)
1013 dnl http://www.kame.net/
1014 AC_EGREP_CPP(yes, [dnl
1015#include <netinet/in.h>
1016#ifdef IPV6_INRIA_VERSION
1017yes
1018#endif],
1019 [ipv6type=$i;
1020 OPT="-DINET6 $OPT"])
1021 ;;
1022 kame)
1023 dnl http://www.kame.net/
1024 AC_EGREP_CPP(yes, [dnl
1025#include <netinet/in.h>
1026#ifdef __KAME__
1027yes
1028#endif],
1029 [ipv6type=$i;
1030 ipv6lib=inet6
1031 ipv6libdir=/usr/local/v6/lib
1032 ipv6trylibc=yes
1033 OPT="-DINET6 $OPT"])
1034 ;;
1035 linux-glibc)
1036 dnl http://www.v6.linux.or.jp/
1037 AC_EGREP_CPP(yes, [dnl
1038#include <features.h>
1039#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1040yes
1041#endif],
1042 [ipv6type=$i;
1043 ipv6trylibc=yes
1044 OPT="-DINET6 $OPT"])
1045 ;;
1046 linux-inet6)
1047 dnl http://www.v6.linux.or.jp/
1048 if test -d /usr/inet6; then
1049 ipv6type=$i
1050 ipv6lib=inet6
1051 ipv6libdir=/usr/inet6/lib
1052 OPT="-DINET6 -I/usr/inet6/include $OPT"
1053 fi
1054 ;;
1055 solaris)
1056 if test -f /etc/netconfig; then
1057 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1058 ipv6type=$i
1059 ipv6trylibc=yes
1060 OPT="-DINET6 $OPT"
1061 fi
1062 fi
1063 ;;
1064 toshiba)
1065 AC_EGREP_CPP(yes, [dnl
1066#include <sys/param.h>
1067#ifdef _TOSHIBA_INET6
1068yes
1069#endif],
1070 [ipv6type=$i;
1071 ipv6lib=inet6;
1072 ipv6libdir=/usr/local/v6/lib;
1073 OPT="-DINET6 $OPT"])
1074 ;;
1075 v6d)
1076 AC_EGREP_CPP(yes, [dnl
1077#include </usr/local/v6/include/sys/v6config.h>
1078#ifdef __V6D__
1079yes
1080#endif],
1081 [ipv6type=$i;
1082 ipv6lib=v6;
1083 ipv6libdir=/usr/local/v6/lib;
1084 OPT="-I/usr/local/v6/include $OPT"])
1085 ;;
1086 zeta)
1087 AC_EGREP_CPP(yes, [dnl
1088#include <sys/param.h>
1089#ifdef _ZETA_MINAMI_INET6
1090yes
1091#endif],
1092 [ipv6type=$i;
1093 ipv6lib=inet6;
1094 ipv6libdir=/usr/local/v6/lib;
1095 OPT="-DINET6 $OPT"])
1096 ;;
1097 esac
1098 if test "$ipv6type" != "unknown"; then
1099 break
1100 fi
1101 done
1102 AC_MSG_RESULT($ipv6type)
1103fi
1104
1105if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1106 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1107 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1108 echo "using lib$ipv6lib"
1109 else
1110 if test $ipv6trylibc = "yes"; then
1111 echo "using libc"
1112 else
1113 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1114 echo "You need to fetch lib$ipv6lib.a from appropriate"
1115 echo 'ipv6 kit and compile beforehand.'
1116 exit 1
1117 fi
1118 fi
1119fi
1120
Barry Warsawef82cd72000-06-30 16:21:01 +00001121# Check for GC support
1122AC_SUBST(USE_GC_MODULE)
1123USE_GC_MODULE=""
1124AC_MSG_CHECKING(for --with-cycle-gc)
1125AC_ARG_WITH(cycle-gc,
1126[ --with(out)-cycle-gc disable/enable garbage collection])
1127
1128if test -z "$with_cycle_gc"
1129then with_cycle_gc="yes"
1130fi
1131if test "$with_cycle_gc" = "no"
1132then
1133 USE_GC_MODULE="#"
1134else
1135 AC_DEFINE(WITH_CYCLE_GC)
1136fi
1137AC_MSG_RESULT($with_cycle_gc)
1138
Neil Schemenauera35c6882001-02-27 04:45:05 +00001139# Check for Python-specific malloc support
1140AC_MSG_CHECKING(for --with-pymalloc)
1141AC_ARG_WITH(pymalloc,
1142[ --with(out)-pymalloc disable/enable specialized mallocs], [
1143if test "$withval" != no
1144then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1145else AC_MSG_RESULT(no)
1146fi],
1147[AC_MSG_RESULT(no)])
1148
Barry Warsawef82cd72000-06-30 16:21:01 +00001149# Check for --with-wctype-functions
1150AC_MSG_CHECKING(for --with-wctype-functions)
1151AC_ARG_WITH(wctype-functions,
1152[ --with-wctype-functions use wctype.h functions], [
1153if test "$withval" != no
1154then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1155else AC_MSG_RESULT(no)
1156fi],
1157[AC_MSG_RESULT(no)])
1158
Guido van Rossum68242b51996-05-28 22:53:03 +00001159# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001160AC_SUBST(DLINCLDIR)
1161DLINCLDIR=/
1162
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001163AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001164AC_ARG_WITH(sgi-dl,
1165[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001166AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001167AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +00001168DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001169dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001170if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001171then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001172else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1173fi
1174DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001175LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001176
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001177AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001178AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001179AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001180AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001181DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001182dldir=`echo "$withval" | sed 's/,.*//'`
1183dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001184if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001185then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001186else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1187fi
1188DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001189LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001190
Guido van Rossume97ee181999-12-20 21:27:22 +00001191# the dlopen() function means we might want to use dynload_shlib.o. some
1192# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001193AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001194
1195# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1196# loading of modules.
1197AC_SUBST(DYNLOADFILE)
1198AC_MSG_CHECKING(DYNLOADFILE)
1199if test -z "$DYNLOADFILE"
1200then
1201 case $ac_sys_system/$ac_sys_release in
1202 AIX*) DYNLOADFILE="dynload_aix.o";;
1203 BeOS*) DYNLOADFILE="dynload_beos.o";;
1204 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001205 Darwin/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001206 *)
1207 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1208 # out any dynamic loading
1209 if test "$ac_cv_func_dlopen" = yes
1210 then DYNLOADFILE="dynload_shlib.o"
1211 else DYNLOADFILE="dynload_stub.o"
1212 fi
1213 ;;
1214 esac
1215fi
1216AC_MSG_RESULT($DYNLOADFILE)
1217if test "$DYNLOADFILE" != "dynload_stub.o"
1218then
1219 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1220fi
1221
Jack Jansenc49e5b72001-06-19 15:00:23 +00001222# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1223
1224AC_SUBST(MACHDEP_OBJS)
1225AC_MSG_CHECKING(MACHDEP_OBJS)
1226if test -z "$MACHDEP_OBJS"
1227then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001228 MACHDEP_OBJS=$extra_machdep_objs
1229else
1230 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00001231fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001232AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00001233
Guido van Rossum627b2d71993-12-24 10:39:16 +00001234# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001235AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001236 flock fork fsync fdatasync fpathconf ftime ftruncate \
Andrew M. Kuchlinga9586c72001-01-08 17:58:56 +00001237 getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwis864e9ff2001-08-04 22:32:03 +00001238 hstrerror inet_pton kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001239 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001240 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001241 select setegid seteuid setgid \
Martin v. Löwis791bfda2001-07-24 06:33:08 +00001242 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
Fred Drake35a092f1999-12-13 16:23:35 +00001243 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001244 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Woutersc2c12dc2001-07-11 14:45:34 +00001245 truncate uname waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001246
Fred Drake8cef4cf2000-06-28 16:40:38 +00001247# check for openpty and forkpty
1248
1249AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1250AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1251
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001252# check for long file support functions
1253AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1254
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001255AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001256AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1257AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1258AC_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 +00001259
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001260AC_CHECK_FUNCS(getaddrinfo, [dnl
1261AC_MSG_CHECKING(getaddrinfo bug)
1262AC_TRY_RUN([
1263#include <sys/types.h>
1264#include <netdb.h>
1265#include <string.h>
1266#include <sys/socket.h>
1267#include <netinet/in.h>
1268
1269main()
1270{
1271 int passive, gaierr, inet4 = 0, inet6 = 0;
1272 struct addrinfo hints, *ai, *aitop;
1273 char straddr[INET6_ADDRSTRLEN], strport[16];
1274
1275 for (passive = 0; passive <= 1; passive++) {
1276 memset(&hints, 0, sizeof(hints));
1277 hints.ai_family = AF_UNSPEC;
1278 hints.ai_flags = passive ? AI_PASSIVE : 0;
1279 hints.ai_socktype = SOCK_STREAM;
1280 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1281 (void)gai_strerror(gaierr);
1282 goto bad;
1283 }
1284 for (ai = aitop; ai; ai = ai->ai_next) {
1285 if (ai->ai_addr == NULL ||
1286 ai->ai_addrlen == 0 ||
1287 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1288 straddr, sizeof(straddr), strport, sizeof(strport),
1289 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1290 goto bad;
1291 }
1292 switch (ai->ai_family) {
1293 case AF_INET:
1294 if (strcmp(strport, "54321") != 0) {
1295 goto bad;
1296 }
1297 if (passive) {
1298 if (strcmp(straddr, "0.0.0.0") != 0) {
1299 goto bad;
1300 }
1301 } else {
1302 if (strcmp(straddr, "127.0.0.1") != 0) {
1303 goto bad;
1304 }
1305 }
1306 inet4++;
1307 break;
1308 case AF_INET6:
1309 if (strcmp(strport, "54321") != 0) {
1310 goto bad;
1311 }
1312 if (passive) {
1313 if (strcmp(straddr, "::") != 0) {
1314 goto bad;
1315 }
1316 } else {
1317 if (strcmp(straddr, "::1") != 0) {
1318 goto bad;
1319 }
1320 }
1321 inet6++;
1322 break;
1323 case AF_UNSPEC:
1324 goto bad;
1325 break;
1326 default:
1327 /* another family support? */
1328 break;
1329 }
1330 }
1331 }
1332
1333 if (!(inet4 == 0 || inet4 == 2))
1334 goto bad;
1335 if (!(inet6 == 0 || inet6 == 2))
1336 goto bad;
1337
1338 if (aitop)
1339 freeaddrinfo(aitop);
1340 exit(0);
1341
1342 bad:
1343 if (aitop)
1344 freeaddrinfo(aitop);
1345 exit(1);
1346}
1347],
1348AC_MSG_RESULT(good)
1349buggygetaddrinfo=no,
1350AC_MSG_RESULT(buggy)
1351buggygetaddrinfo=yes,
1352AC_MSG_RESULT(buggy)
1353buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
1354
1355if test "$buggygetaddrinfo" = "yes"; then
1356 if test "$ipv6" = "yes"; then
1357 echo 'Fatal: You must get working getaddrinfo() function.'
1358 echo ' or you can specify "--disable-ipv6"'.
1359 exit 1
1360 fi
1361fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00001362AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001363
Guido van Rossum627b2d71993-12-24 10:39:16 +00001364# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001365AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001366AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001367AC_STRUCT_TIMEZONE
1368
1369AC_MSG_CHECKING(for time.h that defines altzone)
1370AC_CACHE_VAL(ac_cv_header_time_altzone,
1371[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1372 ac_cv_header_time_altzone=yes,
1373 ac_cv_header_time_altzone=no)])
1374AC_MSG_RESULT($ac_cv_header_time_altzone)
1375if test $ac_cv_header_time_altzone = yes; then
1376 AC_DEFINE(HAVE_ALTZONE)
1377fi
1378
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001379was_it_defined=no
1380AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001381AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001382#include <sys/types.h>
1383#include <sys/select.h>
1384#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001385], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1386AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001387
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001388AC_MSG_CHECKING(for addrinfo)
1389AC_CACHE_VAL(ac_cv_struct_addrinfo,
1390AC_TRY_COMPILE([
1391# include <netdb.h>],
1392 [struct addrinfo a],
1393 ac_cv_struct_addrinfo=yes,
1394 ac_cv_struct_addrinfo=no))
1395AC_MSG_RESULT($ac_cv_struct_addrinfo)
1396if test $ac_cv_struct_addrinfo = yes; then
1397 AC_DEFINE(HAVE_ADDRINFO)
1398fi
1399
1400AC_MSG_CHECKING(for sockaddr_storage)
1401AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1402AC_TRY_COMPILE([
1403# include <sys/types.h>
1404# include <sys/socket.h>],
1405 [struct sockaddr_storage s],
1406 ac_cv_struct_sockaddr_storage=yes,
1407 ac_cv_struct_sockaddr_storage=no))
1408AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1409if test $ac_cv_struct_sockaddr_storage = yes; then
1410 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1411fi
1412
Guido van Rossum627b2d71993-12-24 10:39:16 +00001413# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001414
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001415AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001416AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001417
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001418works=no
1419AC_MSG_CHECKING(for working volatile)
1420AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1421AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001422
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001423works=no
1424AC_MSG_CHECKING(for working signed char)
1425AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1426AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001427
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001428have_prototypes=no
1429AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001430AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1431AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001432AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001433
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001434works=no
1435AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001436AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001437#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001438int foo(int x, ...) {
1439 va_list va;
1440 va_start(va, x);
1441 va_arg(va, int);
1442 va_arg(va, char *);
1443 va_arg(va, double);
1444 return 0;
1445}
1446], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001447AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1448AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001449
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001450if test "$have_prototypes" = yes; then
1451bad_prototypes=no
1452AC_MSG_CHECKING(for bad exec* prototypes)
1453AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1454 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1455AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001456fi
1457
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001458# check if sockaddr has sa_len member
1459AC_MSG_CHECKING(if sockaddr has sa_len member)
1460AC_TRY_COMPILE([#include <sys/types.h>
1461#include <sys/socket.h>],
1462[struct sockaddr x;
1463x.sa_len = 0;],
1464 AC_MSG_RESULT(yes)
1465 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1466 AC_MSG_RESULT(no))
1467
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001468AC_MSG_CHECKING(for bad static forward)
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001469AC_CACHE_VAL(ac_cv_bad_static_forward,
1470[AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001471struct s { int a; int b; };
1472static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001473int foobar() {
1474 static int random;
1475 random = (int) &foo;
1476 return random;
1477}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001478static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001479main() {
1480 exit(!((int)&foo == foobar()));
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001481}], ac_cv_bad_static_forward=no, ac_cv_bad_static_forward=yes)])
1482AC_MSG_RESULT($ac_cv_bad_static_forward)
1483if test "$ac_cv_bad_static_forward" = yes
1484then
1485 AC_DEFINE(BAD_STATIC_FORWARD)
1486fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001487
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001488va_list_is_array=no
1489AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001490AC_TRY_COMPILE([
1491#ifdef HAVE_STDARG_PROTOTYPES
1492#include <stdarg.h>
1493#else
1494#include <varargs.h>
1495#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001496], [va_list list1, list2; list1 = list2;], ,
1497AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1498AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001499
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001500# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1501AC_CHECK_FUNC(gethostbyname_r, [
1502 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1503 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1504 OLD_CFLAGS=$CFLAGS
1505 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1506 AC_TRY_COMPILE([
1507# include <netdb.h>
1508 ], [
1509 char *name;
1510 struct hostent *he, *res;
1511 char buffer[2048];
1512 int buflen = 2048;
1513 int h_errnop;
1514
1515 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1516 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001517 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001518 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1519 AC_MSG_RESULT(yes)
1520 ], [
1521 AC_MSG_RESULT(no)
1522 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1523 AC_TRY_COMPILE([
1524# include <netdb.h>
1525 ], [
1526 char *name;
1527 struct hostent *he;
1528 char buffer[2048];
1529 int buflen = 2048;
1530 int h_errnop;
1531
1532 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1533 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001534 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001535 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1536 AC_MSG_RESULT(yes)
1537 ], [
1538 AC_MSG_RESULT(no)
1539 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1540 AC_TRY_COMPILE([
1541# include <netdb.h>
1542 ], [
1543 char *name;
1544 struct hostent *he;
1545 struct hostent_data data;
1546
1547 (void) gethostbyname_r(name, he, &data);
1548 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001549 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001550 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1551 AC_MSG_RESULT(yes)
1552 ], [
1553 AC_MSG_RESULT(no)
1554 ])
1555 ])
1556 ])
1557 CFLAGS=$OLD_CFLAGS
1558], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001559 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001560])
1561AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1562AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1563AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001564AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001565AC_SUBST(HAVE_GETHOSTBYNAME)
1566
Guido van Rossum627b2d71993-12-24 10:39:16 +00001567# checks for system services
1568# (none yet)
1569
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001570# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001571AC_CHECK_FUNC(__fpu_control,
1572 [],
1573 [AC_CHECK_LIB(ieee, __fpu_control)
1574])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001575
Guido van Rossum93274221997-05-09 02:42:00 +00001576# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001577AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001578AC_ARG_WITH(fpectl,
1579[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001580if test "$withval" != no
1581then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1582else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001583fi],
1584[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001585
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001586# check for --with-libm=...
1587AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001588case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001589Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001590BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001591*) LIBM=-lm
1592esac
Guido van Rossum93274221997-05-09 02:42:00 +00001593AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001594AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001595if test "$withval" = no
1596then LIBM=
1597 AC_MSG_RESULT(force LIBM empty)
1598elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001599then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001600 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001601else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001602fi],
1603[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001604
1605# check for --with-libc=...
1606AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001607AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001608AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001609if test "$withval" = no
1610then LIBC=
1611 AC_MSG_RESULT(force LIBC empty)
1612elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001613then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001614 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001615else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001616fi],
1617[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001618
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001619# check for hypot() in math library
1620LIBS_SAVE=$LIBS
1621LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001622AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001623LIBS=$LIBS_SAVE
1624
Guido van Rossumad713701997-07-10 22:42:38 +00001625# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001626AC_MSG_CHECKING(what malloc(0) returns)
1627AC_CACHE_VAL(ac_cv_malloc_zero,
1628[AC_TRY_RUN([#include <stdio.h>
1629#ifdef HAVE_STDLIB
1630#include <stdlib.h>
1631#else
1632char *malloc(), *realloc();
1633int *free();
1634#endif
1635main() {
1636 char *p;
1637 p = malloc(0);
1638 if (p == NULL) exit(1);
1639 p = realloc(p, 0);
1640 if (p == NULL) exit(1);
1641 free(p);
1642 exit(0);
1643}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1644AC_MSG_RESULT($ac_cv_malloc_zero)
1645if test "$ac_cv_malloc_zero" = null
1646then
1647 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1648fi
1649
Guido van Rossumef2255b2000-03-10 22:30:29 +00001650# check for wchar.h
1651AC_CHECK_HEADER(wchar.h,
1652AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1653wchar_h="no"
1654)
1655
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001656# determine wchar_t size
1657if test "$wchar_h" = yes
1658then
1659 AC_CHECK_SIZEOF(wchar_t)
1660fi
1661
1662AC_MSG_CHECKING(what type to use for unicode)
1663AC_ARG_ENABLE(unicode,
1664[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1665
1666if test $enable_unicode = yes
1667then
Martin v. Löwisfd917792001-06-27 20:22:04 +00001668 # Without any arguments, Py_UNICODE defaults to two-byte mode
1669 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001670fi
1671
1672case "$enable_unicode" in
1673ucs2) unicode_size="2"
1674 AC_DEFINE(Py_UNICODE_SIZE,2)
1675 ;;
1676ucs4) unicode_size="4"
1677 AC_DEFINE(Py_UNICODE_SIZE,4)
1678 ;;
1679esac
1680
1681if test "$enable_unicode" = "no"
1682then
1683 AC_MSG_RESULT(not used)
1684else
1685 AC_DEFINE(Py_USING_UNICODE)
1686 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1687 then
1688 PY_UNICODE_TYPE="wchar_t"
1689 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1690 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1691 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1692 then
1693 PY_UNICODE_TYPE="unsigned short"
1694 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1695 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1696 then
1697 PY_UNICODE_TYPE="unsigned long"
1698 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1699 else
1700 PY_UNICODE_TYPE="no type found"
1701 fi
1702 AC_MSG_RESULT($PY_UNICODE_TYPE)
1703fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00001704
1705# check for endianness
1706AC_C_BIGENDIAN
1707
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001708# Check whether right shifting a negative integer extends the sign bit
1709# or fills with zeros (like the Cray J90, according to Tim Peters).
1710AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001711AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001712AC_TRY_RUN([
1713int main()
1714{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001715 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001716}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001717], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1718AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1719if test "$ac_cv_rshift_extends_sign" = no
1720then
1721 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1722fi
1723
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001724# check for getc_unlocked and related locking functions
1725AC_MSG_CHECKING(for getc_unlocked() and friends)
1726AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1727AC_TRY_LINK([#include <stdio.h>],[
1728 FILE *f = fopen("/dev/null", "r");
1729 flockfile(f);
1730 getc_unlocked(f);
1731 funlockfile(f);
1732], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1733AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1734if test "$ac_cv_have_getc_unlocked" = yes
1735then
1736 AC_DEFINE(HAVE_GETC_UNLOCKED)
1737fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001738
Guido van Rossum353ae582001-07-10 16:45:32 +00001739# check for readline 4.2
1740AC_CHECK_LIB(readline, rl_completion_matches,
1741 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1742
Thomas Wouterse38b2f12001-07-11 22:35:31 +00001743AC_MSG_CHECKING(for broken nice())
1744AC_CACHE_VAL(ac_cv_broken_nice, [
1745AC_TRY_RUN([
1746int main()
1747{
1748 int val1 = nice(1);
1749 if (val1 != -1 && val1 == nice(2))
1750 exit(0);
1751 exit(1);
1752}
1753],ac_cv_broken_nice=yes, ac_cv_broken_nice=no)])
1754AC_MSG_RESULT($ac_cv_broken_nice)
1755if test "$ac_cv_broken_nice" = yes
1756then
1757 AC_DEFINE(HAVE_BROKEN_NICE)
1758fi
1759
Guido van Rossum95713eb2000-05-18 20:53:31 +00001760# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1761# Add sys/socket.h to confdefs.h
1762cat >> confdefs.h <<\EOF
1763#ifdef HAVE_SYS_SOCKET_H
1764#include <sys/socket.h>
1765#endif
1766EOF
1767AC_CHECK_TYPE(socklen_t, int)
1768
Neil Schemenauerf25cf6c2001-03-04 06:39:33 +00001769# Add Python/ prefix to LIBOBJS
1770libobjs=$LIBOBJS
1771LIBOBJS=
1772for obj in $libobjs; do
1773 LIBOBJS="$LIBOBJS Python/$obj"
1774done
1775
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001776#AC_MSG_CHECKING(for Modules/Setup)
1777#if test ! -f Modules/Setup ; then
1778# if test ! -d Modules ; then
1779# mkdir Modules
1780# fi
1781# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1782# AC_MSG_RESULT(creating)
1783#else
1784# AC_MSG_RESULT(already exists)
1785#fi
1786
1787AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00001788SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001789AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001790for dir in $SRCDIRS; do
1791 if test ! -d $dir; then
1792 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001793 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001794done
1795AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001796
Guido van Rossum627b2d71993-12-24 10:39:16 +00001797# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001798AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001799
1800echo "creating Setup"
1801if test ! -f Modules/Setup
1802then
1803 cp $srcdir/Modules/Setup.dist Modules/Setup
1804fi
1805
1806echo "creating Setup.local"
1807if test ! -f Modules/Setup.local
1808then
1809 echo "# Edit this file for local setup changes" >Modules/Setup.local
1810fi
1811
1812echo "creating Makefile"
1813$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1814 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00001815 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00001816mv config.c Modules