blob: 61aaa97123748a3b6ff30c8754ac8012b321a989 [file] [log] [blame]
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001dnl Process this file with autoconf 2.0 or later to make a configure script.
2AC_REVISION($Revision$)
3AC_PREREQ(2.0)
Guido van Rossum6085e321993-12-26 18:24:40 +00004AC_INIT(Include/object.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00005AC_CONFIG_HEADER(config.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +00006
Guido van Rossum642b6781997-07-19 19:35:41 +00007# Set VERSION so we only need to edit in one place (i.e., here)
8AC_SUBST(VERSION)
Guido van 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 Rossum3dc0a512000-10-05 18:00:06 +000015# NEXTSTEP|MacOSX|Darwin stuff
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000016if test -f /usr/lib/NextStep/software_version -o -f /System/Library/CoreServices/software_version ; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000017
18 AC_MSG_CHECKING(for --with-next-archs)
19 AC_ARG_WITH(next-archs,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000020 [ --with-next-archs='arch1 arch2 ..' build MAB binary], [
Guido van Rossum4b6b5791996-09-09 20:09:34 +000021 if test -n "$withval"; then
Guido van Rossum2bb4f551996-09-10 18:19:59 +000022 ac_arch_flags=`/usr/lib/arch_tool -archify_list $withval`
23 # GCC does not currently support multi archs on the NeXT
24 with_gcc=no
Guido van Rossum4b6b5791996-09-09 20:09:34 +000025 fi
26 AC_MSG_RESULT($with_next_archs)
27 ], [AC_MSG_RESULT(none: using `arch`)])
28
29 if test -z "$MACHDEP"
30 then
Guido van Rossum3dc0a512000-10-05 18:00:06 +000031 ac_sys_system=`uname -s`
32 if test "$ac_sys_system" = "Darwin" ; then
33 ac_sys_release=`uname -r`
34 else
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000035 set X `hostinfo | egrep '(NeXT Mach|Kernel Release).*:' | \
Guido van Rossum3dc0a512000-10-05 18:00:06 +000036 sed -e 's/://' -e 's/\./_/'` && \
37 ac_sys_system=next && ac_sys_release=$4
38 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000039
Guido van Rossum3dc0a512000-10-05 18:00:06 +000040 MACHDEP="$ac_sys_system$ac_sys_release"
Guido van Rossumb418f891996-07-30 18:06:02 +000041 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000042fi
Guido van Rossumb418f891996-07-30 18:06:02 +000043
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000044AC_ARG_WITH(next-framework,
Guido van Rossum3dc0a512000-10-05 18:00:06 +000045[ --with-next-framework Build (OpenStep|Rhapsody|MacOSX|Darwin) framework],,)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000046AC_ARG_WITH(dyld,
Guido van Rossum3dc0a512000-10-05 18:00:06 +000047[ --with-dyld Use (OpenStep|Rhapsody|MacOSX|Darwin) dynamic linker],,)
Guido van Rossum91922671997-10-09 20:24:13 +000048
Guido van Rossumb418f891996-07-30 18:06:02 +000049# Set name for machine-dependent library files
50AC_SUBST(MACHDEP)
51AC_MSG_CHECKING(MACHDEP)
52if test -z "$MACHDEP"
53then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000054 ac_sys_system=`uname -s`
Martin v. Löwis130fb172001-07-19 11:00:41 +000055 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000056 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000057 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000058 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000059 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000060 ac_md_system=`echo $ac_sys_system |
61 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
62 ac_md_release=`echo $ac_sys_release |
63 tr -d '[/ ]' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000064 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000065
Guido van Rossumbcd91e01997-03-20 20:46:29 +000066 case $MACHDEP in
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +000067 cygwin*) MACHDEP="cygwin";;
Guido van Rossumb97ef171997-09-28 05:44:03 +000068 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000069 esac
70fi
Guido van Rossum91922671997-10-09 20:24:13 +000071
72#
73# SGI compilers allow the specification of the both the ABI and the
74# ISA on the command line. Depending on the values of these switches,
75# different and often incompatable code will be generated.
76#
77# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
78# thus supply support for various ABI/ISA combinations. The MACHDEP
79# variable is also adjusted.
80#
81AC_SUBST(SGI_ABI)
82if test ! -z "$SGI_ABI"
83then
84 CC="cc $SGI_ABI"
85 LDFLAGS="$SGI_ABI $LDFLAGS"
86 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
87fi
Guido van Rossumb418f891996-07-30 18:06:02 +000088AC_MSG_RESULT($MACHDEP)
89
Guido van Rossum627b2d71993-12-24 10:39:16 +000090# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000091AC_MSG_CHECKING(for --without-gcc)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000092AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000093 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000094 no) CC=cc
95 without_gcc=yes;;
96 yes) CC=gcc
97 without_gcc=no;;
98 *) CC=$withval
99 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000100 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000101 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +0000102 OSF1) CC=cc
103 without_gcc=;;
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000104 AIX*) CC=cc_r
105 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000106 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000107 case $BE_HOST_CPU in
108 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000109 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000110 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000111 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 +0000112 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000113 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000114 ;;
115 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000116 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000117 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000118 OPT=-O
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000119 ;;
120 *)
Fred Drake5790be12000-10-09 17:06:13 +0000121 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000122 ;;
123 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000124 AR="\$(srcdir)/Modules/ar_beos"
125 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000126 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000127 Monterey*)
128 RANLIB=:
Martin v. Löwis130fb172001-07-19 11:00:41 +0000129 without_gcc=;;
130 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000131 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000132AC_MSG_RESULT($without_gcc)
133
Guido van Rossum27552902001-01-23 01:52:26 +0000134AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000135AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000136MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000137AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000138AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000139 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000140 case $withval in
141 no) CXX=
142 with_cxx=no;;
143 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000144 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000145 with_cxx=$withval;;
146 esac], [
147 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000148 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000149])
150AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000151
152dnl The following fragment works similar to AC_PROG_CXX.
153dnl It does not fail if CXX is not found, and it is not executed if
154dnl --with-cxx was given.
155dnl Finally, it does not test whether CXX is g++.
156
157if test "$check_cxx" = "yes"
158then
159 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
160 if test "$CXX" = "notfound"
161 then
162 CXX=
163 else
164 AC_PROG_CXX_WORKS
165 fi
166fi
167
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000168# If the user switches compilers, we can't believe the cache
169if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
170then
171 AC_ERROR(cached CC is different -- throw away $cache_file
172(it is also a good idea to do 'make clean' before compiling))
173fi
174
Guido van Rossum627b2d71993-12-24 10:39:16 +0000175AC_PROG_CC
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000176AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000177AC_MSG_CHECKING(for --with-suffix)
178AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
179 case $withval in
180 no) EXEEXT=;;
181 yes) EXEEXT=.exe;;
182 *) EXEEXT=$withval;;
183 esac])
184AC_MSG_RESULT($EXEEXT)
Guido van Rossumfb842551997-08-06 23:42:07 +0000185
Guido van Rossumdd997f71998-10-07 19:58:26 +0000186case $MACHDEP in
187bsdos*)
188 case $CC in
189 gcc) CC="$CC -D_HAVE_BSDI";;
190 esac;;
191esac
192
Guido van Rossum84561611997-08-21 00:08:11 +0000193case $ac_sys_system in
194hp*|HP*)
195 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000196 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000197 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000198Monterey*)
199 case $CC in
200 cc) CC="$CC -Wl,-Bexport";;
201 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000202SunOS*)
203 # Some functions have a prototype only with that define, e.g. confstr
204 AC_DEFINE(__EXTENSIONS__)
205 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000206esac
207
Martin v. Löwise8964d42001-03-06 12:09:07 +0000208
Neil Schemenauer61c51152001-01-26 16:18:16 +0000209AC_SUBST(LIBRARY)
210AC_MSG_CHECKING(LIBRARY)
211if test -z "$LIBRARY"
212then
213 LIBRARY='libpython$(VERSION).a'
214fi
215AC_MSG_RESULT($LIBRARY)
216
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000217# LDLIBRARY is the name of the library to link against (as opposed to the
218# name of the library into which to insert object files). On systems
219# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
Guido van Rossumaef734b2001-01-10 21:09:12 +0000220# the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the
221# shared (i.e., DLL) library.
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000222AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000223AC_SUBST(DLLLIBRARY)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000224LDLIBRARY="$LIBRARY"
Guido van Rossum27552902001-01-23 01:52:26 +0000225DLLLIBRARY=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000226
Guido van Rossumfb842551997-08-06 23:42:07 +0000227# LINKCC is the command that links the python executable -- default is $(CC).
Fred Drake5790be12000-10-09 17:06:13 +0000228# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000229# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000230AC_SUBST(LINKCC)
231AC_MSG_CHECKING(LINKCC)
232if test -z "$LINKCC"
233then
234 case $ac_sys_system in
235 AIX*)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000236 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000237 dgux*)
238 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000239 Monterey64*)
240 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000241 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000242 esac
243fi
244AC_MSG_RESULT($LINKCC)
245
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000246AC_MSG_CHECKING(LDLIBRARY)
247
248# NeXT framework builds require that the 'ar' library be converted into
249# a bundle using libtool.
250if test "$with_next_framework"
251then
252 LDLIBRARY='libpython$(VERSION).dylib'
253fi
254
255# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000256case $MACHDEP in
257dguxR4)
258 LDLIBRARY='libpython$(VERSION).so'
259 OPT="$OPT -pic"
260 ;;
261beos*)
262 LDLIBRARY='libpython$(VERSION).so'
263 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000264cygwin*)
265 LDLIBRARY='libpython$(VERSION).dll.a'
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000266 DLLLIBRARY='libpython$(VERSION).dll'
Guido van Rossumaef734b2001-01-10 21:09:12 +0000267 ;;
Fred Drake5790be12000-10-09 17:06:13 +0000268esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000269AC_MSG_RESULT($LDLIBRARY)
270
Guido van Rossum627b2d71993-12-24 10:39:16 +0000271AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000272AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000273AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000274
275case $MACHDEP in
276bsdos*)
277 # install -d does not work on BSDI
278 if test -z "$INSTALL"
279 then
280 INSTALL="${srcdir}/install-sh -c"
281 fi
282esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000283AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000284
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000285# Not every filesystem supports hard links
286AC_SUBST(LN)
287if test -z "$LN" ; then
288 case $ac_sys_system in
289 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000290 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000291 *) LN=ln;;
292 esac
293fi
294
Fred Drake9f715822001-07-11 06:27:00 +0000295# Check for --with-pydebug
296AC_MSG_CHECKING(for --with-pydebug)
297AC_ARG_WITH(pydebug,
298[ --with-pydebug build with Py_DEBUG defined], [
299if test "$withval" != no
300then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
301else AC_MSG_RESULT(no); Py_DEBUG='false'
302fi],
303[AC_MSG_RESULT(no)])
304
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000305# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000306AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000307if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000308then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000309 case $GCC in
310 yes)
311 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000312 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000313 if test "$Py_DEBUG" = 'true' ; then
314 # Optimization messes up debuggers, so turn it off for
315 # debug builds.
316 OPT="-g -Wall -Wstrict-prototypes"
317 else
318 OPT="-g -O3 -Wall -Wstrict-prototypes"
319 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000320 *)
Fred Drake9f715822001-07-11 06:27:00 +0000321 OPT="-O3 -Wall -Wstrict-prototypes";;
322 esac
323 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000324 *)
325 case $ac_sys_system in
326 UnixWare*)
327 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
328 *)
329 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000330 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000331 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000332fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000333
Trent Mick635f6fb2000-08-23 21:33:05 +0000334# The current (beta) Monterey compiler dies with optimizations
335case $ac_sys_system in
336Monterey*) OPT="";;
337esac
338
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000339if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000340then
341 OPT="$OPT $ac_arch_flags"
342fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000343# checks for UNIX variants that set C preprocessor variables
344AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000345AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000346
Guido van Rossum91922671997-10-09 20:24:13 +0000347AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
348AC_CACHE_VAL(ac_cv_opt_olimit_ok,
349[ac_save_cc="$CC"
350CC="$CC -OPT:Olimit=0"
351AC_TRY_RUN([int main() { return 0; }],
352 ac_cv_opt_olimit_ok=yes,
353 ac_cv_opt_olimit_ok=no)
354CC="$ac_save_cc"])
355AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000356if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000357 case $ac_sys_system in
358 Darwin*) OPT="$OPT" ;;
359 *) OPT="$OPT -OPT:Olimit=0";;
360 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000361else
362 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
363 AC_CACHE_VAL(ac_cv_olimit_ok,
364 [ac_save_cc="$CC"
365 CC="$CC -Olimit 1500"
366 AC_TRY_RUN([int main() { return 0; }],
367 ac_cv_olimit_ok=yes,
368 ac_cv_olimit_ok=no)
369 CC="$ac_save_cc"])
370 AC_MSG_RESULT($ac_cv_olimit_ok)
371 if test $ac_cv_olimit_ok = yes; then
372 OPT="$OPT -Olimit 1500"
373 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000374fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000375
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000376# Check for enable-ipv6
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000377AC_MSG_CHECKING([whether to enable ipv6])
378AC_ARG_ENABLE(ipv6,
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +0000379[ --enable-ipv6 Enable ipv6 (with ipv4) support
380 --disable-ipv6 Disable ipv6 support],
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000381[ case "$enableval" in
382 no)
383 AC_MSG_RESULT(no)
384 ipv6=no
385 ;;
386 *) AC_MSG_RESULT(yes)
387 AC_DEFINE(ENABLE_IPV6)
388 ipv6=yes
389 ;;
390 esac ],
391
Fred Drake9f715822001-07-11 06:27:00 +0000392 AC_TRY_RUN([ /* AF_INET6 available check */
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000393#include <sys/types.h>
394#include <sys/socket.h>
395main()
396{
397 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
398 exit(1);
399 else
400 exit(0);
401}
402],
403 AC_MSG_RESULT(yes)
404 AC_DEFINE(ENABLE_IPV6)
405 ipv6=yes,
406 AC_MSG_RESULT(no)
407 ipv6=no,
408 AC_MSG_RESULT(no)
409 ipv6=no
410))
411
412ipv6type=unknown
413ipv6lib=none
414ipv6trylibc=no
415
416if test "$ipv6" = "yes"; then
417 AC_MSG_CHECKING([ipv6 stack type])
418 for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do
419 case $i in
420 inria)
421 dnl http://www.kame.net/
422 AC_EGREP_CPP(yes, [dnl
423#include <netinet/in.h>
424#ifdef IPV6_INRIA_VERSION
425yes
426#endif],
427 [ipv6type=$i;
428 OPT="-DINET6 $OPT"])
429 ;;
430 kame)
431 dnl http://www.kame.net/
432 AC_EGREP_CPP(yes, [dnl
433#include <netinet/in.h>
434#ifdef __KAME__
435yes
436#endif],
437 [ipv6type=$i;
438 ipv6lib=inet6
439 ipv6libdir=/usr/local/v6/lib
440 ipv6trylibc=yes
441 OPT="-DINET6 $OPT"])
442 ;;
443 linux-glibc)
444 dnl http://www.v6.linux.or.jp/
445 AC_EGREP_CPP(yes, [dnl
446#include <features.h>
447#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
448yes
449#endif],
450 [ipv6type=$i;
451 ipv6trylibc=yes
452 OPT="-DINET6 $OPT"])
453 ;;
454 linux-inet6)
455 dnl http://www.v6.linux.or.jp/
456 if test -d /usr/inet6; then
457 ipv6type=$i
458 ipv6lib=inet6
459 ipv6libdir=/usr/inet6/lib
460 OPT="-DINET6 -I/usr/inet6/include $OPT"
461 fi
462 ;;
463 toshiba)
464 AC_EGREP_CPP(yes, [dnl
465#include <sys/param.h>
466#ifdef _TOSHIBA_INET6
467yes
468#endif],
469 [ipv6type=$i;
470 ipv6lib=inet6;
471 ipv6libdir=/usr/local/v6/lib;
472 OPT="-DINET6 $OPT"])
473 ;;
474 v6d)
475 AC_EGREP_CPP(yes, [dnl
476#include </usr/local/v6/include/sys/v6config.h>
477#ifdef __V6D__
478yes
479#endif],
480 [ipv6type=$i;
481 ipv6lib=v6;
482 ipv6libdir=/usr/local/v6/lib;
483 OPT="-I/usr/local/v6/include $OPT"])
484 ;;
485 zeta)
486 AC_EGREP_CPP(yes, [dnl
487#include <sys/param.h>
488#ifdef _ZETA_MINAMI_INET6
489yes
490#endif],
491 [ipv6type=$i;
492 ipv6lib=inet6;
493 ipv6libdir=/usr/local/v6/lib;
494 OPT="-DINET6 $OPT"])
495 ;;
496 esac
497 if test "$ipv6type" != "unknown"; then
498 break
499 fi
500 done
501 AC_MSG_RESULT($ipv6type)
502fi
503
504if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
505 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
506 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
507 echo "using lib$ipv6lib"
508 else
509 if test $ipv6trylibc = "yes"; then
510 echo "using libc"
511 else
512 echo 'Fatal: no $ipv6lib library found. cannot continue.'
513 echo "You need to fetch lib$ipv6lib.a from appropriate"
514 echo 'ipv6 kit and compile beforehand.'
515 exit 1
516 fi
517 fi
518fi
519
Martin v. Löwis130fb172001-07-19 11:00:41 +0000520# -Kpthread, if available, provides the right #defines
521# and linker options to make pthread_create available
522AC_MSG_CHECKING(whether $CC accepts -Kpthread)
523AC_CACHE_VAL(ac_cv_kpthread,
524[ac_save_cc="$CC"
525CC="$CC -Kpthread"
526AC_TRY_LINK([#include <pthread.h>],[pthread_create(0,0,0,0)],
527 ac_cv_kpthread=yes,
528 ac_cv_kpthread=no)
529CC="$ac_save_cc"])
530
531# GCC does not reject -Kpthread as an illegal option, it merely complains that
532# it is unrecognized
533if test "$GCC" = "yes"
534then ac_cv_kpthread="no, we have gcc"
535fi
536AC_MSG_RESULT($ac_cv_kpthread)
537
Fred Drakece81d592000-07-09 14:39:29 +0000538dnl # check for ANSI or K&R ("traditional") preprocessor
539dnl AC_MSG_CHECKING(for C preprocessor type)
540dnl AC_TRY_COMPILE([
541dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
542dnl int foo;
543dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
544dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
545dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000546
Guido van Rossum627b2d71993-12-24 10:39:16 +0000547# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000548AC_HEADER_STDC
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000549AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000550signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000551sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000552sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000553sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
Thomas Wouterse38b2f12001-07-11 22:35:31 +0000554ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000555AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000556
557# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000558was_it_defined=no
559AC_MSG_CHECKING(for clock_t in time.h)
560AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
561AC_MSG_RESULT($was_it_defined)
562
Guido van Rossum300fda71996-08-19 21:58:16 +0000563# Add some code to confdefs.h so that the test for off_t works on SCO
564cat >> confdefs.h <<\EOF
565#if defined(SCO_DS)
566#undef _OFF_T
567#endif
568EOF
569
Guido van Rossumef2255b2000-03-10 22:30:29 +0000570# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000571AC_TYPE_MODE_T
572AC_TYPE_OFF_T
573AC_TYPE_PID_T
574AC_TYPE_SIGNAL
575AC_TYPE_SIZE_T
576AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000577
Guido van Rossumef2255b2000-03-10 22:30:29 +0000578# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000579AC_CHECK_SIZEOF(int)
580AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000581AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000582AC_CHECK_SIZEOF(char)
583AC_CHECK_SIZEOF(short)
584AC_CHECK_SIZEOF(float)
585AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000586AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000587
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000588AC_MSG_CHECKING(for long long support)
589have_long_long=no
590AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
591AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000592if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000593AC_CHECK_SIZEOF(long long)
594fi
595
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000596AC_MSG_CHECKING(for uintptr_t support)
597have_uintptr_t=no
598AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
599AC_MSG_RESULT($have_uintptr_t)
600if test "$have_uintptr_t" = yes ; then
601AC_CHECK_SIZEOF(uintptr_t)
602fi
603
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000604# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
605AC_MSG_CHECKING(size of off_t)
606AC_CACHE_VAL(ac_cv_sizeof_off_t,
607[AC_TRY_RUN([#include <stdio.h>
608#include <sys/types.h>
609main()
610{
611 FILE *f=fopen("conftestval", "w");
612 if (!f) exit(1);
613 fprintf(f, "%d\n", sizeof(off_t));
614 exit(0);
615}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
616])
617AC_MSG_RESULT($ac_cv_sizeof_off_t)
618AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
619
620AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000621if test "$have_long_long" = yes -a \
622 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
623 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000624 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
625 AC_MSG_RESULT(yes)
626else
627 AC_MSG_RESULT(no)
628fi
629
Fred Drakea3f6e912000-06-29 20:44:47 +0000630# AC_CHECK_SIZEOF() doesn't include <time.h>.
631AC_MSG_CHECKING(size of time_t)
632AC_CACHE_VAL(ac_cv_sizeof_time_t,
633[AC_TRY_RUN([#include <stdio.h>
634#include <time.h>
635main()
636{
637 FILE *f=fopen("conftestval", "w");
638 if (!f) exit(1);
639 fprintf(f, "%d\n", sizeof(time_t));
640 exit(0);
641}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
642])
643AC_MSG_RESULT($ac_cv_sizeof_time_t)
644AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
645
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000646
Trent Mick635f6fb2000-08-23 21:33:05 +0000647# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000648ac_save_cc="$CC"
649if test "$ac_cv_kpthread" = "yes"
650then CC="$CC -Kpthread"
651fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000652AC_MSG_CHECKING(for pthread_t)
653have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000654AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000655AC_MSG_RESULT($have_pthread_t)
656if test "$have_pthread_t" = yes ; then
657 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
658 AC_MSG_CHECKING(size of pthread_t)
659 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
660 [AC_TRY_RUN([#include <stdio.h>
661 #include <pthread.h>
662 main()
663 {
664 FILE *f=fopen("conftestval", "w");
665 if (!f) exit(1);
666 fprintf(f, "%d\n", sizeof(pthread_t));
667 exit(0);
668 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
669 ])
670 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
671 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
672fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000673CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000674
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000675# Minor variations in building a framework between NextStep versions 4 and 5
676AC_SUBST(LIBTOOL_CRUFT)
677case $ac_sys_system/$ac_sys_release in
Guido van Rossum5839e582000-10-09 19:52:35 +0000678 Darwin/*)
679 ns_undef_sym='_environ'
680 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000681 next/4*)
682 ns_undef_sym='__environ'
683 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
684 next/5*)
685 ns_undef_sym='_environ'
686 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
687esac
688
689AC_MSG_CHECKING(for --with-next-framework)
690if test "$with_next_framework"
691then
692 OPT="$OPT -fno-common"
693 # -U __environ is needed since bundles don't have access
694 # to crt0 when built but will always be linked against it
695 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
696 AC_DEFINE(WITH_NEXT_FRAMEWORK)
697 AC_MSG_RESULT(yes)
698else
699 AC_MSG_RESULT(no)
700fi
701
702AC_MSG_CHECKING(for --with-dyld)
703if test "$with_next_framework" -o "$with_dyld"
704then
705 if test "$with_dyld"
706 then
707 AC_MSG_RESULT(yes)
708 else
709 AC_MSG_RESULT(required for framework build)
710 fi
711 AC_DEFINE(WITH_DYLD)
712 ns_dyld='set'
713else
714 AC_MSG_RESULT(no)
715fi
716
Guido van Rossumac405f61994-09-12 10:56:06 +0000717# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000718AC_SUBST(SO)
719AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000720AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000721AC_SUBST(CCSHARED)
722AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000723# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000724# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000725AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000726if test -z "$SO"
727then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000728 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000729 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000730 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000731 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000732 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000733fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000734AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000735# LDSHARED is the ld *command* used to create shared library
736# -- "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 +0000737# (Shared libraries in this instance are shared modules to be loaded into
738# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000739AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000740if test -z "$LDSHARED"
741then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000742 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000743 AIX*)
744 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
745 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
746 ;;
747 BeOS*)
748 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
749 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
750 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000751 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000752 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000753 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +0000754 SunOS/5*)
755 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000756 then LDSHARED='$(CC) -shared'
Greg Ward57c9a6632000-05-26 12:22:54 +0000757 else LDSHARED="ld -G";
758 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000759 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000760 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000761 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000762 Darwin/*|next/*)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000763 if test "$ns_dyld"
Guido van Rossumacb14c72001-01-10 21:41:16 +0000764 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000765 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
766 fi
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000767 if test "$with_next_framework" ; then
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000768 LDSHARED="$LDSHARED \$(LDLIBRARY)"
769 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000770 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000771 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000772 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000773 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000774 NetBSD*)
775 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
776 then
777 LDSHARED="cc -shared"
778 else
779 LDSHARED="ld -Bshareable"
780 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000781 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000782 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000783 then
784 LDSHARED="cc -shared ${LDFLAGS}"
785 else
786 LDSHARED="ld -Bshareable ${LDFLAGS}"
787 fi;;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000788 UnixWare*)
789 if test "$GCC" = "yes"
790 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000791 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000792 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000793 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000794 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000795 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000796 *) LDSHARED="ld";;
797 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000798fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000799AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000800BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000801# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000802# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000803AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000804if test -z "$CCSHARED"
805then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000806 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000807 SunOS*) if test "$GCC" = yes;
808 then CCSHARED="-fPIC";
809 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000810 hp*|HP*) if test "$GCC" = yes;
811 then CCSHARED="-fpic";
812 else CCSHARED="+z";
813 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000814 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000815 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000816 OpenBSD*) CCSHARED="-fpic";;
817 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000818 UnixWare*)
819 if test "$GCC" = "yes"
820 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000821 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000822 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000823 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000824 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000825 IRIX*/6*) case $CC in
826 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000827 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000828 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000829 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000830 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000831fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000832AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000833# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000834# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000835AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000836if test -z "$LINKFORSHARED"
837then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000838 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000839 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000840 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000841 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000842 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000843 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000844 # -u libsys_s pulls in all symbols in libsys
845 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
846 # -u __dummy makes the linker aware of the objc runtime
847 # in System.framework; otherwise, __objcInit (referenced in
848 # crt1.o) gets erroneously defined as common, which breaks dynamic
849 # loading of any modules which reference it in System.framework
850 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Jack Jansenc49e5b72001-06-19 15:00:23 +0000851 Darwin/*) LINKFORSHARED="-u __dummy -u _PyMac_Error -framework System -framework Foundation -framework Carbon" ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000852 UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000853 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000854 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000855 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000856 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
857 then
858 LINKFORSHARED="-Wl,--export-dynamic"
859 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000860 SunOS/5*) case $CC in
861 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000862 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000863 then
864 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000865 fi;;
866 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000867 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000868fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000869AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000870
Neil Schemenauer61c51152001-01-26 16:18:16 +0000871AC_SUBST(CFLAGSFORSHARED)
872AC_MSG_CHECKING(CFLAGSFORSHARED)
873if test ! "$LIBRARY" = "$LDLIBRARY"
874then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000875 case $ac_sys_system in
876 CYGWIN*)
877 # Cygwin needs CCSHARED when building extension DLLs
878 # but not when building the interpreter DLL.
879 CFLAGSFORSHARED='';;
880 *)
881 CFLAGSFORSHARED='$(CCSHARED)'
882 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000883fi
884AC_MSG_RESULT($CFLAGSFORSHARED)
885
Guido van Rossum627b2d71993-12-24 10:39:16 +0000886# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000887AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
888AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000889
890# checks for system dependent C++ extensions support
891case "$ac_sys_system" in
892 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
893 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
894 [loadAndInit("", 0, "")],
895 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
896 AC_MSG_RESULT(yes)],
897 [AC_MSG_RESULT(no)]);;
898 *) ;;
899esac
900
Guido van Rossum70c7f481998-03-26 18:44:10 +0000901# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
902# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000903# BeOS' sockets are stashed in libnet.
904case "$ac_sys_system" in
905IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000906*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000907AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000908AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000909;;
910esac
911case "$ac_sys_system" in
912BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000913AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
914;;
915esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000916
Guido van Rossumc5a39031996-07-31 17:35:03 +0000917AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000918AC_ARG_WITH(libs,
919[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000920AC_MSG_RESULT($withval)
921LIBS="$withval $LIBS"
922], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000923
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000924# Determine if signalmodule should be used.
925AC_SUBST(USE_SIGNAL_MODULE)
926AC_SUBST(SIGNAL_OBJS)
927AC_MSG_CHECKING(for --with-signal-module)
928AC_ARG_WITH(signal-module,
929[ --with-signal-module disable/enable signal module])
930
931if test -z "$with_signal_module"
932then with_signal_module="yes"
933fi
934AC_MSG_RESULT($with_signal_module)
935
936if test "${with_signal_module}" = "yes"; then
937 USE_SIGNAL_MODULE=""
938 SIGNAL_OBJS=""
939else
940 USE_SIGNAL_MODULE="#"
941 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
942fi
943
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000944# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000945AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000946USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000947
Guido van Rossum54d93d41997-01-22 20:51:58 +0000948AC_MSG_CHECKING(for --with-dec-threads)
949AC_SUBST(LDLAST)
950AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000951[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
952AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000953LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000954if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000955 with_thread="$withval";
956fi],
957AC_MSG_RESULT(no))
958
959AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000960AC_ARG_WITH(threads,
961[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000962
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000963# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000964AC_ARG_WITH(thread,
965[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
966with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000967
968if test -z "$with_threads"
969then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000970fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000971AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000972
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000973if test "$with_threads" = "no"
974then
975 USE_THREAD_MODULE="#"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000976elif test "$ac_cv_kpthread" = "yes"
977then
978 CC="$CC -Kpthread"
979 AC_DEFINE(WITH_THREAD)
980 AC_DEFINE(_POSIX_THREADS)
981 LIBOBJS="$LIBOBJS thread.o"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000982else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000983 if test ! -z "$with_threads" -a -d "$with_threads"
984 then LDFLAGS="$LDFLAGS -L$with_threads"
985 fi
986 if test ! -z "$withval" -a -d "$withval"
987 then LDFLAGS="$LDFLAGS -L$withval"
988 fi
989 AC_DEFINE(_REENTRANT)
990 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
991 AC_DEFINE(C_THREADS)
992 LIBOBJS="$LIBOBJS thread.o"],[
993 AC_MSG_CHECKING(for --with-pth)
994 AC_ARG_WITH(pth,
995 [ --with-pth use GNU pth threading libraries], [
996 AC_MSG_RESULT($withval)
997 AC_DEFINE(WITH_THREAD)
998 AC_DEFINE(HAVE_PTH)
999 LIBS="-lpth $LIBS"
1000 LIBOBJS="$LIBOBJS thread.o"],[
1001 AC_MSG_RESULT(no)
1002 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
1003 AC_DEFINE(_POSIX_THREADS)
1004 LIBS="-lpthread $LIBS"
1005 LIBOBJS="$LIBOBJS thread.o"],[
1006 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1007 case $ac_sys_system in
1008 Darwin*) ;;
1009 *) AC_DEFINE(_POSIX_THREADS);;
1010 esac
1011 LIBOBJS="$LIBOBJS thread.o"],[
1012 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1013 AC_DEFINE(BEOS_THREADS)
1014 LIBOBJS="$LIBOBJS thread.o"],[
1015 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1016 AC_DEFINE(_POSIX_THREADS)
1017 LIBS="$LIBS -lpthreads"
1018 LIBOBJS="$LIBOBJS thread.o"], [
1019 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1020 AC_DEFINE(_POSIX_THREADS)
1021 LIBS="$LIBS -lc_r"
1022 LIBOBJS="$LIBOBJS thread.o"], [
1023 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
1024 AC_DEFINE(_POSIX_THREADS)
1025 LIBS="$LIBS -lthread"
1026 LIBOBJS="$LIBOBJS thread.o"], [
1027 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1028 AC_DEFINE(_POSIX_THREADS)
1029 LIBS="$LIBS -lpthread"
1030 LIBOBJS="$LIBOBJS thread.o"], [
1031 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1032 AC_DEFINE(_POSIX_THREADS)
1033 LIBS="$LIBS -lcma"
1034 LIBOBJS="$LIBOBJS thread.o"],[
1035 USE_THREAD_MODULE="#"])
1036 ])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001037
Martin v. Löwis130fb172001-07-19 11:00:41 +00001038 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1039 LIBS="$LIBS -lmpc"
1040 LIBOBJS="$LIBOBJS thread.o"
1041 USE_THREAD_MODULE=""])
1042 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1043 LIBS="$LIBS -lthread"
1044 LIBOBJS="$LIBOBJS thread.o"
1045 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001046
Martin v. Löwis130fb172001-07-19 11:00:41 +00001047 if test "$USE_THREAD_MODULE" != "#"
1048 then
1049 # If the above checks didn't disable threads, (at least) OSF1
1050 # needs this '-threads' argument during linking.
1051 case $ac_sys_system in
1052 OSF1) LDLAST=-threads;;
1053 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001054 fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001055fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001056
Barry Warsawef82cd72000-06-30 16:21:01 +00001057# Check for GC support
1058AC_SUBST(USE_GC_MODULE)
1059USE_GC_MODULE=""
1060AC_MSG_CHECKING(for --with-cycle-gc)
1061AC_ARG_WITH(cycle-gc,
1062[ --with(out)-cycle-gc disable/enable garbage collection])
1063
1064if test -z "$with_cycle_gc"
1065then with_cycle_gc="yes"
1066fi
1067if test "$with_cycle_gc" = "no"
1068then
1069 USE_GC_MODULE="#"
1070else
1071 AC_DEFINE(WITH_CYCLE_GC)
1072fi
1073AC_MSG_RESULT($with_cycle_gc)
1074
Neil Schemenauera35c6882001-02-27 04:45:05 +00001075# Check for Python-specific malloc support
1076AC_MSG_CHECKING(for --with-pymalloc)
1077AC_ARG_WITH(pymalloc,
1078[ --with(out)-pymalloc disable/enable specialized mallocs], [
1079if test "$withval" != no
1080then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1081else AC_MSG_RESULT(no)
1082fi],
1083[AC_MSG_RESULT(no)])
1084
Barry Warsawef82cd72000-06-30 16:21:01 +00001085# Check for --with-wctype-functions
1086AC_MSG_CHECKING(for --with-wctype-functions)
1087AC_ARG_WITH(wctype-functions,
1088[ --with-wctype-functions use wctype.h functions], [
1089if test "$withval" != no
1090then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1091else AC_MSG_RESULT(no)
1092fi],
1093[AC_MSG_RESULT(no)])
1094
Guido van Rossum68242b51996-05-28 22:53:03 +00001095# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001096AC_SUBST(DLINCLDIR)
1097DLINCLDIR=/
1098
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001099AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001100AC_ARG_WITH(sgi-dl,
1101[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001102AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001103AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +00001104DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001105dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001106if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001107then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001108else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1109fi
1110DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001111LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001112
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001113AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001114AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001115AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001116AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001117DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001118dldir=`echo "$withval" | sed 's/,.*//'`
1119dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001120if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001121then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001122else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1123fi
1124DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001125LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001126
Guido van Rossume97ee181999-12-20 21:27:22 +00001127# the dlopen() function means we might want to use dynload_shlib.o. some
1128# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001129AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001130
1131# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1132# loading of modules.
1133AC_SUBST(DYNLOADFILE)
1134AC_MSG_CHECKING(DYNLOADFILE)
1135if test -z "$DYNLOADFILE"
1136then
1137 case $ac_sys_system/$ac_sys_release in
1138 AIX*) DYNLOADFILE="dynload_aix.o";;
1139 BeOS*) DYNLOADFILE="dynload_beos.o";;
1140 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Guido van Rossum5839e582000-10-09 19:52:35 +00001141 Darwin/*|next/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001142 *)
1143 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1144 # out any dynamic loading
1145 if test "$ac_cv_func_dlopen" = yes
1146 then DYNLOADFILE="dynload_shlib.o"
1147 else DYNLOADFILE="dynload_stub.o"
1148 fi
1149 ;;
1150 esac
1151fi
1152AC_MSG_RESULT($DYNLOADFILE)
1153if test "$DYNLOADFILE" != "dynload_stub.o"
1154then
1155 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1156fi
1157
Jack Jansenc49e5b72001-06-19 15:00:23 +00001158# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1159
1160AC_SUBST(MACHDEP_OBJS)
1161AC_MSG_CHECKING(MACHDEP_OBJS)
1162if test -z "$MACHDEP_OBJS"
1163then
1164 case $ac_sys_system/$ac_sys_release in
1165 Darwin/*)
1166 MACHDEP_OBJS="Mac/Python/macglue.o"
1167 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
1168 ;;
1169 *) MACHDEP_OBJS="";;
1170 esac
1171fi
1172AC_MSG_RESULT($DYNLOADFILE)
1173
Guido van Rossum627b2d71993-12-24 10:39:16 +00001174# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001175AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001176 flock fork fsync fdatasync fpathconf ftime ftruncate \
Andrew M. Kuchlinga9586c72001-01-08 17:58:56 +00001177 getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwisb9ab1592001-06-24 21:18:26 +00001178 inet_pton kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001179 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001180 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001181 select setegid seteuid setgid \
Thomas Wouters3a584202000-08-05 23:28:51 +00001182 setlocale setregid setreuid setsid setpgid setuid setvbuf \
Fred Drake35a092f1999-12-13 16:23:35 +00001183 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001184 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Woutersc2c12dc2001-07-11 14:45:34 +00001185 truncate uname waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001186
Fred Drake8cef4cf2000-06-28 16:40:38 +00001187# check for openpty and forkpty
1188
1189AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1190AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1191
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001192# check for long file support functions
1193AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1194
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001195AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001196AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1197AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1198AC_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 +00001199
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001200AC_CHECK_FUNCS(getaddrinfo, [dnl
1201AC_MSG_CHECKING(getaddrinfo bug)
1202AC_TRY_RUN([
1203#include <sys/types.h>
1204#include <netdb.h>
1205#include <string.h>
1206#include <sys/socket.h>
1207#include <netinet/in.h>
1208
1209main()
1210{
1211 int passive, gaierr, inet4 = 0, inet6 = 0;
1212 struct addrinfo hints, *ai, *aitop;
1213 char straddr[INET6_ADDRSTRLEN], strport[16];
1214
1215 for (passive = 0; passive <= 1; passive++) {
1216 memset(&hints, 0, sizeof(hints));
1217 hints.ai_family = AF_UNSPEC;
1218 hints.ai_flags = passive ? AI_PASSIVE : 0;
1219 hints.ai_socktype = SOCK_STREAM;
1220 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1221 (void)gai_strerror(gaierr);
1222 goto bad;
1223 }
1224 for (ai = aitop; ai; ai = ai->ai_next) {
1225 if (ai->ai_addr == NULL ||
1226 ai->ai_addrlen == 0 ||
1227 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1228 straddr, sizeof(straddr), strport, sizeof(strport),
1229 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1230 goto bad;
1231 }
1232 switch (ai->ai_family) {
1233 case AF_INET:
1234 if (strcmp(strport, "54321") != 0) {
1235 goto bad;
1236 }
1237 if (passive) {
1238 if (strcmp(straddr, "0.0.0.0") != 0) {
1239 goto bad;
1240 }
1241 } else {
1242 if (strcmp(straddr, "127.0.0.1") != 0) {
1243 goto bad;
1244 }
1245 }
1246 inet4++;
1247 break;
1248 case AF_INET6:
1249 if (strcmp(strport, "54321") != 0) {
1250 goto bad;
1251 }
1252 if (passive) {
1253 if (strcmp(straddr, "::") != 0) {
1254 goto bad;
1255 }
1256 } else {
1257 if (strcmp(straddr, "::1") != 0) {
1258 goto bad;
1259 }
1260 }
1261 inet6++;
1262 break;
1263 case AF_UNSPEC:
1264 goto bad;
1265 break;
1266 default:
1267 /* another family support? */
1268 break;
1269 }
1270 }
1271 }
1272
1273 if (!(inet4 == 0 || inet4 == 2))
1274 goto bad;
1275 if (!(inet6 == 0 || inet6 == 2))
1276 goto bad;
1277
1278 if (aitop)
1279 freeaddrinfo(aitop);
1280 exit(0);
1281
1282 bad:
1283 if (aitop)
1284 freeaddrinfo(aitop);
1285 exit(1);
1286}
1287],
1288AC_MSG_RESULT(good)
1289buggygetaddrinfo=no,
1290AC_MSG_RESULT(buggy)
1291buggygetaddrinfo=yes,
1292AC_MSG_RESULT(buggy)
1293buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
1294
1295if test "$buggygetaddrinfo" = "yes"; then
1296 if test "$ipv6" = "yes"; then
1297 echo 'Fatal: You must get working getaddrinfo() function.'
1298 echo ' or you can specify "--disable-ipv6"'.
1299 exit 1
1300 fi
1301fi
1302AC_CHECK_FUNCS(getaddrinfo getnameinfo)
1303
Guido van Rossum627b2d71993-12-24 10:39:16 +00001304# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001305AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001306AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001307AC_STRUCT_TIMEZONE
1308
1309AC_MSG_CHECKING(for time.h that defines altzone)
1310AC_CACHE_VAL(ac_cv_header_time_altzone,
1311[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1312 ac_cv_header_time_altzone=yes,
1313 ac_cv_header_time_altzone=no)])
1314AC_MSG_RESULT($ac_cv_header_time_altzone)
1315if test $ac_cv_header_time_altzone = yes; then
1316 AC_DEFINE(HAVE_ALTZONE)
1317fi
1318
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001319was_it_defined=no
1320AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001321AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001322#include <sys/types.h>
1323#include <sys/select.h>
1324#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001325], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1326AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001327
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001328AC_MSG_CHECKING(for addrinfo)
1329AC_CACHE_VAL(ac_cv_struct_addrinfo,
1330AC_TRY_COMPILE([
1331# include <netdb.h>],
1332 [struct addrinfo a],
1333 ac_cv_struct_addrinfo=yes,
1334 ac_cv_struct_addrinfo=no))
1335AC_MSG_RESULT($ac_cv_struct_addrinfo)
1336if test $ac_cv_struct_addrinfo = yes; then
1337 AC_DEFINE(HAVE_ADDRINFO)
1338fi
1339
1340AC_MSG_CHECKING(for sockaddr_storage)
1341AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1342AC_TRY_COMPILE([
1343# include <sys/types.h>
1344# include <sys/socket.h>],
1345 [struct sockaddr_storage s],
1346 ac_cv_struct_sockaddr_storage=yes,
1347 ac_cv_struct_sockaddr_storage=no))
1348AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1349if test $ac_cv_struct_sockaddr_storage = yes; then
1350 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1351fi
1352
Guido van Rossum627b2d71993-12-24 10:39:16 +00001353# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001354
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001355AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001356AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001357
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001358works=no
1359AC_MSG_CHECKING(for working volatile)
1360AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1361AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001362
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001363works=no
1364AC_MSG_CHECKING(for working signed char)
1365AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1366AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001367
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001368have_prototypes=no
1369AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001370AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1371AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001372AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001373
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001374works=no
1375AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001376AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001377#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001378int foo(int x, ...) {
1379 va_list va;
1380 va_start(va, x);
1381 va_arg(va, int);
1382 va_arg(va, char *);
1383 va_arg(va, double);
1384 return 0;
1385}
1386], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001387AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1388AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001389
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001390if test "$have_prototypes" = yes; then
1391bad_prototypes=no
1392AC_MSG_CHECKING(for bad exec* prototypes)
1393AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1394 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1395AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001396fi
1397
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001398# check if sockaddr has sa_len member
1399AC_MSG_CHECKING(if sockaddr has sa_len member)
1400AC_TRY_COMPILE([#include <sys/types.h>
1401#include <sys/socket.h>],
1402[struct sockaddr x;
1403x.sa_len = 0;],
1404 AC_MSG_RESULT(yes)
1405 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1406 AC_MSG_RESULT(no))
1407
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001408bad_forward=no
1409AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001410AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001411struct s { int a; int b; };
1412static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001413int foobar() {
1414 static int random;
1415 random = (int) &foo;
1416 return random;
1417}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001418static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001419main() {
1420 exit(!((int)&foo == foobar()));
1421}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001422], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
1423AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001424
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001425va_list_is_array=no
1426AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001427AC_TRY_COMPILE([
1428#ifdef HAVE_STDARG_PROTOTYPES
1429#include <stdarg.h>
1430#else
1431#include <varargs.h>
1432#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001433], [va_list list1, list2; list1 = list2;], ,
1434AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1435AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001436
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001437# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1438AC_CHECK_FUNC(gethostbyname_r, [
1439 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1440 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1441 OLD_CFLAGS=$CFLAGS
1442 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1443 AC_TRY_COMPILE([
1444# include <netdb.h>
1445 ], [
1446 char *name;
1447 struct hostent *he, *res;
1448 char buffer[2048];
1449 int buflen = 2048;
1450 int h_errnop;
1451
1452 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1453 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001454 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001455 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1456 AC_MSG_RESULT(yes)
1457 ], [
1458 AC_MSG_RESULT(no)
1459 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1460 AC_TRY_COMPILE([
1461# include <netdb.h>
1462 ], [
1463 char *name;
1464 struct hostent *he;
1465 char buffer[2048];
1466 int buflen = 2048;
1467 int h_errnop;
1468
1469 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1470 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001471 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001472 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1473 AC_MSG_RESULT(yes)
1474 ], [
1475 AC_MSG_RESULT(no)
1476 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1477 AC_TRY_COMPILE([
1478# include <netdb.h>
1479 ], [
1480 char *name;
1481 struct hostent *he;
1482 struct hostent_data data;
1483
1484 (void) gethostbyname_r(name, he, &data);
1485 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001486 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001487 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1488 AC_MSG_RESULT(yes)
1489 ], [
1490 AC_MSG_RESULT(no)
1491 ])
1492 ])
1493 ])
1494 CFLAGS=$OLD_CFLAGS
1495], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001496 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001497])
1498AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1499AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1500AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001501AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001502AC_SUBST(HAVE_GETHOSTBYNAME)
1503
Guido van Rossum627b2d71993-12-24 10:39:16 +00001504# checks for system services
1505# (none yet)
1506
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001507# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001508AC_CHECK_FUNC(__fpu_control,
1509 [],
1510 [AC_CHECK_LIB(ieee, __fpu_control)
1511])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001512
Guido van Rossum93274221997-05-09 02:42:00 +00001513# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001514AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001515AC_ARG_WITH(fpectl,
1516[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001517if test "$withval" != no
1518then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1519else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001520fi],
1521[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001522
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001523# check for --with-libm=...
1524AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001525case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001526Darwin) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001527next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001528BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001529*) LIBM=-lm
1530esac
Guido van Rossum93274221997-05-09 02:42:00 +00001531AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001532AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001533if test "$withval" = no
1534then LIBM=
1535 AC_MSG_RESULT(force LIBM empty)
1536elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001537then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001538 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001539else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001540fi],
1541[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001542
1543# check for --with-libc=...
1544AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001545AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001546AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001547if test "$withval" = no
1548then LIBC=
1549 AC_MSG_RESULT(force LIBC empty)
1550elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001551then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001552 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001553else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001554fi],
1555[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001556
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001557# check for hypot() in math library
1558LIBS_SAVE=$LIBS
1559LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001560AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001561LIBS=$LIBS_SAVE
1562
Guido van Rossumad713701997-07-10 22:42:38 +00001563# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001564AC_MSG_CHECKING(what malloc(0) returns)
1565AC_CACHE_VAL(ac_cv_malloc_zero,
1566[AC_TRY_RUN([#include <stdio.h>
1567#ifdef HAVE_STDLIB
1568#include <stdlib.h>
1569#else
1570char *malloc(), *realloc();
1571int *free();
1572#endif
1573main() {
1574 char *p;
1575 p = malloc(0);
1576 if (p == NULL) exit(1);
1577 p = realloc(p, 0);
1578 if (p == NULL) exit(1);
1579 free(p);
1580 exit(0);
1581}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1582AC_MSG_RESULT($ac_cv_malloc_zero)
1583if test "$ac_cv_malloc_zero" = null
1584then
1585 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1586fi
1587
Guido van Rossumef2255b2000-03-10 22:30:29 +00001588# check for wchar.h
1589AC_CHECK_HEADER(wchar.h,
1590AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1591wchar_h="no"
1592)
1593
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001594# determine wchar_t size
1595if test "$wchar_h" = yes
1596then
1597 AC_CHECK_SIZEOF(wchar_t)
1598fi
1599
1600AC_MSG_CHECKING(what type to use for unicode)
1601AC_ARG_ENABLE(unicode,
1602[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1603
1604if test $enable_unicode = yes
1605then
Martin v. Löwisfd917792001-06-27 20:22:04 +00001606 # Without any arguments, Py_UNICODE defaults to two-byte mode
1607 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001608fi
1609
1610case "$enable_unicode" in
1611ucs2) unicode_size="2"
1612 AC_DEFINE(Py_UNICODE_SIZE,2)
1613 ;;
1614ucs4) unicode_size="4"
1615 AC_DEFINE(Py_UNICODE_SIZE,4)
1616 ;;
1617esac
1618
1619if test "$enable_unicode" = "no"
1620then
1621 AC_MSG_RESULT(not used)
1622else
1623 AC_DEFINE(Py_USING_UNICODE)
1624 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1625 then
1626 PY_UNICODE_TYPE="wchar_t"
1627 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1628 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1629 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1630 then
1631 PY_UNICODE_TYPE="unsigned short"
1632 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1633 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1634 then
1635 PY_UNICODE_TYPE="unsigned long"
1636 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1637 else
1638 PY_UNICODE_TYPE="no type found"
1639 fi
1640 AC_MSG_RESULT($PY_UNICODE_TYPE)
1641fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00001642
1643# check for endianness
1644AC_C_BIGENDIAN
1645
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001646# Check whether right shifting a negative integer extends the sign bit
1647# or fills with zeros (like the Cray J90, according to Tim Peters).
1648AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001649AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001650AC_TRY_RUN([
1651int main()
1652{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001653 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001654}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001655], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1656AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1657if test "$ac_cv_rshift_extends_sign" = no
1658then
1659 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1660fi
1661
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001662# check for getc_unlocked and related locking functions
1663AC_MSG_CHECKING(for getc_unlocked() and friends)
1664AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1665AC_TRY_LINK([#include <stdio.h>],[
1666 FILE *f = fopen("/dev/null", "r");
1667 flockfile(f);
1668 getc_unlocked(f);
1669 funlockfile(f);
1670], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1671AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1672if test "$ac_cv_have_getc_unlocked" = yes
1673then
1674 AC_DEFINE(HAVE_GETC_UNLOCKED)
1675fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001676
Guido van Rossum353ae582001-07-10 16:45:32 +00001677# check for readline 4.2
1678AC_CHECK_LIB(readline, rl_completion_matches,
1679 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1680
Thomas Wouterse38b2f12001-07-11 22:35:31 +00001681AC_MSG_CHECKING(for broken nice())
1682AC_CACHE_VAL(ac_cv_broken_nice, [
1683AC_TRY_RUN([
1684int main()
1685{
1686 int val1 = nice(1);
1687 if (val1 != -1 && val1 == nice(2))
1688 exit(0);
1689 exit(1);
1690}
1691],ac_cv_broken_nice=yes, ac_cv_broken_nice=no)])
1692AC_MSG_RESULT($ac_cv_broken_nice)
1693if test "$ac_cv_broken_nice" = yes
1694then
1695 AC_DEFINE(HAVE_BROKEN_NICE)
1696fi
1697
Guido van Rossum95713eb2000-05-18 20:53:31 +00001698# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1699# Add sys/socket.h to confdefs.h
1700cat >> confdefs.h <<\EOF
1701#ifdef HAVE_SYS_SOCKET_H
1702#include <sys/socket.h>
1703#endif
1704EOF
1705AC_CHECK_TYPE(socklen_t, int)
1706
Neil Schemenauerf25cf6c2001-03-04 06:39:33 +00001707# Add Python/ prefix to LIBOBJS
1708libobjs=$LIBOBJS
1709LIBOBJS=
1710for obj in $libobjs; do
1711 LIBOBJS="$LIBOBJS Python/$obj"
1712done
1713
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001714#AC_MSG_CHECKING(for Modules/Setup)
1715#if test ! -f Modules/Setup ; then
1716# if test ! -d Modules ; then
1717# mkdir Modules
1718# fi
1719# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1720# AC_MSG_RESULT(creating)
1721#else
1722# AC_MSG_RESULT(already exists)
1723#fi
1724
1725AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00001726SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001727AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001728for dir in $SRCDIRS; do
1729 if test ! -d $dir; then
1730 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001731 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001732done
1733AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001734
Guido van Rossum627b2d71993-12-24 10:39:16 +00001735# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001736AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001737
1738echo "creating Setup"
1739if test ! -f Modules/Setup
1740then
1741 cp $srcdir/Modules/Setup.dist Modules/Setup
1742fi
1743
1744echo "creating Setup.local"
1745if test ! -f Modules/Setup.local
1746then
1747 echo "# Edit this file for local setup changes" >Modules/Setup.local
1748fi
1749
1750echo "creating Makefile"
1751$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1752 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00001753 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00001754mv config.c Modules