blob: 2d163d35722b2bffecce5660c8ee44bc3a63115a [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 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 Warsawc0d24d82000-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 Warsawc0d24d82000-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 Warsawc0d24d82000-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
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000102 AIX*) CC=cc_r
103 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000104 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000105 case $BE_HOST_CPU in
106 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000107 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000108 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000109 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 +0000110 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000111 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000112 ;;
113 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000114 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000115 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000116 OPT=-O
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000117 ;;
118 *)
Fred Drake5790be12000-10-09 17:06:13 +0000119 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000120 ;;
121 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000122 AR="\$(srcdir)/Modules/ar_beos"
123 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000124 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000125 Monterey*)
126 RANLIB=:
Martin v. Löwis130fb172001-07-19 11:00:41 +0000127 without_gcc=;;
128 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000129 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000130AC_MSG_RESULT($without_gcc)
131
Guido van Rossum27552902001-01-23 01:52:26 +0000132AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000133AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000134MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000135AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000136AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000137 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000138 case $withval in
139 no) CXX=
140 with_cxx=no;;
141 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000142 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000143 with_cxx=$withval;;
144 esac], [
145 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000146 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000147])
148AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000149
150dnl The following fragment works similar to AC_PROG_CXX.
151dnl It does not fail if CXX is not found, and it is not executed if
152dnl --with-cxx was given.
153dnl Finally, it does not test whether CXX is g++.
154
155if test "$check_cxx" = "yes"
156then
157 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
158 if test "$CXX" = "notfound"
159 then
160 CXX=
161 else
162 AC_PROG_CXX_WORKS
163 fi
164fi
165
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000166# If the user switches compilers, we can't believe the cache
167if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
168then
169 AC_ERROR(cached CC is different -- throw away $cache_file
170(it is also a good idea to do 'make clean' before compiling))
171fi
172
Guido van Rossum627b2d71993-12-24 10:39:16 +0000173AC_PROG_CC
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000174AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000175AC_MSG_CHECKING(for --with-suffix)
176AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
177 case $withval in
178 no) EXEEXT=;;
179 yes) EXEEXT=.exe;;
180 *) EXEEXT=$withval;;
181 esac])
182AC_MSG_RESULT($EXEEXT)
Guido van Rossumfb842551997-08-06 23:42:07 +0000183
Guido van Rossumdd997f71998-10-07 19:58:26 +0000184case $MACHDEP in
185bsdos*)
186 case $CC in
187 gcc) CC="$CC -D_HAVE_BSDI";;
188 esac;;
189esac
190
Guido van Rossum84561611997-08-21 00:08:11 +0000191case $ac_sys_system in
192hp*|HP*)
193 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000194 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000195 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000196Monterey*)
197 case $CC in
198 cc) CC="$CC -Wl,-Bexport";;
199 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000200SunOS*)
201 # Some functions have a prototype only with that define, e.g. confstr
202 AC_DEFINE(__EXTENSIONS__)
203 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000204esac
205
Martin v. Löwise8964d42001-03-06 12:09:07 +0000206
Neil Schemenauer61c51152001-01-26 16:18:16 +0000207AC_SUBST(LIBRARY)
208AC_MSG_CHECKING(LIBRARY)
209if test -z "$LIBRARY"
210then
211 LIBRARY='libpython$(VERSION).a'
212fi
213AC_MSG_RESULT($LIBRARY)
214
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000215# LDLIBRARY is the name of the library to link against (as opposed to the
216# name of the library into which to insert object files). On systems
217# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
Guido van Rossumaef734b2001-01-10 21:09:12 +0000218# the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the
219# shared (i.e., DLL) library.
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000220AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000221AC_SUBST(DLLLIBRARY)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000222LDLIBRARY="$LIBRARY"
Guido van Rossum27552902001-01-23 01:52:26 +0000223DLLLIBRARY=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000224
Guido van Rossumfb842551997-08-06 23:42:07 +0000225# LINKCC is the command that links the python executable -- default is $(CC).
Fred Drake5790be12000-10-09 17:06:13 +0000226# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000227# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000228AC_SUBST(LINKCC)
229AC_MSG_CHECKING(LINKCC)
230if test -z "$LINKCC"
231then
232 case $ac_sys_system in
233 AIX*)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000234 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000235 dgux*)
236 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000237 Monterey64*)
238 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000239 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000240 esac
241fi
242AC_MSG_RESULT($LINKCC)
243
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000244AC_MSG_CHECKING(LDLIBRARY)
245
246# NeXT framework builds require that the 'ar' library be converted into
247# a bundle using libtool.
248if test "$with_next_framework"
249then
250 LDLIBRARY='libpython$(VERSION).dylib'
Jack Jansenca06bc62001-08-03 15:32:23 +0000251 DLLLIBRARY=$LDLIBRARY
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000252fi
253
254# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000255case $MACHDEP in
256dguxR4)
257 LDLIBRARY='libpython$(VERSION).so'
258 OPT="$OPT -pic"
259 ;;
260beos*)
261 LDLIBRARY='libpython$(VERSION).so'
262 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000263cygwin*)
264 LDLIBRARY='libpython$(VERSION).dll.a'
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000265 DLLLIBRARY='libpython$(VERSION).dll'
Guido van Rossumaef734b2001-01-10 21:09:12 +0000266 ;;
Fred Drake5790be12000-10-09 17:06:13 +0000267esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000268AC_MSG_RESULT($LDLIBRARY)
269
Guido van Rossum627b2d71993-12-24 10:39:16 +0000270AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000271AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000272AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000273
274case $MACHDEP in
275bsdos*)
276 # install -d does not work on BSDI
277 if test -z "$INSTALL"
278 then
279 INSTALL="${srcdir}/install-sh -c"
280 fi
281esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000282AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000283
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000284# Not every filesystem supports hard links
285AC_SUBST(LN)
286if test -z "$LN" ; then
287 case $ac_sys_system in
288 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000289 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000290 *) LN=ln;;
291 esac
292fi
293
Fred Drake9f715822001-07-11 06:27:00 +0000294# Check for --with-pydebug
295AC_MSG_CHECKING(for --with-pydebug)
296AC_ARG_WITH(pydebug,
297[ --with-pydebug build with Py_DEBUG defined], [
298if test "$withval" != no
299then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
300else AC_MSG_RESULT(no); Py_DEBUG='false'
301fi],
302[AC_MSG_RESULT(no)])
303
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000304# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000305AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000306if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000307then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000308 case $GCC in
309 yes)
310 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000311 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000312 if test "$Py_DEBUG" = 'true' ; then
313 # Optimization messes up debuggers, so turn it off for
314 # debug builds.
315 OPT="-g -Wall -Wstrict-prototypes"
316 else
317 OPT="-g -O3 -Wall -Wstrict-prototypes"
318 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000319 *)
Fred Drake9f715822001-07-11 06:27:00 +0000320 OPT="-O3 -Wall -Wstrict-prototypes";;
321 esac
322 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000323 *)
324 case $ac_sys_system in
325 UnixWare*)
326 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
327 *)
328 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000329 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000330 esac
Jack Jansenca06bc62001-08-03 15:32:23 +0000331 case $ac_sys_system in
332 Darwin*)
333 OPT="$OPT -no-cpp-precomp";;
334 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000335fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000336
Trent Mick635f6fb2000-08-23 21:33:05 +0000337# The current (beta) Monterey compiler dies with optimizations
338case $ac_sys_system in
339Monterey*) OPT="";;
340esac
341
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000342if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000343then
344 OPT="$OPT $ac_arch_flags"
345fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000346# checks for UNIX variants that set C preprocessor variables
347AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000348AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000349
Guido van Rossum91922671997-10-09 20:24:13 +0000350AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
351AC_CACHE_VAL(ac_cv_opt_olimit_ok,
352[ac_save_cc="$CC"
353CC="$CC -OPT:Olimit=0"
354AC_TRY_RUN([int main() { return 0; }],
355 ac_cv_opt_olimit_ok=yes,
356 ac_cv_opt_olimit_ok=no)
357CC="$ac_save_cc"])
358AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000359if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000360 case $ac_sys_system in
361 Darwin*) OPT="$OPT" ;;
362 *) OPT="$OPT -OPT:Olimit=0";;
363 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000364else
365 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
366 AC_CACHE_VAL(ac_cv_olimit_ok,
367 [ac_save_cc="$CC"
368 CC="$CC -Olimit 1500"
369 AC_TRY_RUN([int main() { return 0; }],
370 ac_cv_olimit_ok=yes,
371 ac_cv_olimit_ok=no)
372 CC="$ac_save_cc"])
373 AC_MSG_RESULT($ac_cv_olimit_ok)
374 if test $ac_cv_olimit_ok = yes; then
375 OPT="$OPT -Olimit 1500"
376 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000377fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000378
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000379# Check for enable-ipv6
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000380AC_MSG_CHECKING([whether to enable ipv6])
381AC_ARG_ENABLE(ipv6,
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +0000382[ --enable-ipv6 Enable ipv6 (with ipv4) support
383 --disable-ipv6 Disable ipv6 support],
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000384[ case "$enableval" in
385 no)
386 AC_MSG_RESULT(no)
387 ipv6=no
388 ;;
389 *) AC_MSG_RESULT(yes)
390 AC_DEFINE(ENABLE_IPV6)
391 ipv6=yes
392 ;;
393 esac ],
394
Fred Drake9f715822001-07-11 06:27:00 +0000395 AC_TRY_RUN([ /* AF_INET6 available check */
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000396#include <sys/types.h>
397#include <sys/socket.h>
398main()
399{
400 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
401 exit(1);
402 else
403 exit(0);
404}
405],
406 AC_MSG_RESULT(yes)
407 AC_DEFINE(ENABLE_IPV6)
408 ipv6=yes,
409 AC_MSG_RESULT(no)
410 ipv6=no,
411 AC_MSG_RESULT(no)
412 ipv6=no
413))
414
415ipv6type=unknown
416ipv6lib=none
417ipv6trylibc=no
418
419if test "$ipv6" = "yes"; then
420 AC_MSG_CHECKING([ipv6 stack type])
421 for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do
422 case $i in
423 inria)
424 dnl http://www.kame.net/
425 AC_EGREP_CPP(yes, [dnl
426#include <netinet/in.h>
427#ifdef IPV6_INRIA_VERSION
428yes
429#endif],
430 [ipv6type=$i;
431 OPT="-DINET6 $OPT"])
432 ;;
433 kame)
434 dnl http://www.kame.net/
435 AC_EGREP_CPP(yes, [dnl
436#include <netinet/in.h>
437#ifdef __KAME__
438yes
439#endif],
440 [ipv6type=$i;
441 ipv6lib=inet6
442 ipv6libdir=/usr/local/v6/lib
443 ipv6trylibc=yes
444 OPT="-DINET6 $OPT"])
445 ;;
446 linux-glibc)
447 dnl http://www.v6.linux.or.jp/
448 AC_EGREP_CPP(yes, [dnl
449#include <features.h>
450#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
451yes
452#endif],
453 [ipv6type=$i;
454 ipv6trylibc=yes
455 OPT="-DINET6 $OPT"])
456 ;;
457 linux-inet6)
458 dnl http://www.v6.linux.or.jp/
459 if test -d /usr/inet6; then
460 ipv6type=$i
461 ipv6lib=inet6
462 ipv6libdir=/usr/inet6/lib
463 OPT="-DINET6 -I/usr/inet6/include $OPT"
464 fi
465 ;;
466 toshiba)
467 AC_EGREP_CPP(yes, [dnl
468#include <sys/param.h>
469#ifdef _TOSHIBA_INET6
470yes
471#endif],
472 [ipv6type=$i;
473 ipv6lib=inet6;
474 ipv6libdir=/usr/local/v6/lib;
475 OPT="-DINET6 $OPT"])
476 ;;
477 v6d)
478 AC_EGREP_CPP(yes, [dnl
479#include </usr/local/v6/include/sys/v6config.h>
480#ifdef __V6D__
481yes
482#endif],
483 [ipv6type=$i;
484 ipv6lib=v6;
485 ipv6libdir=/usr/local/v6/lib;
486 OPT="-I/usr/local/v6/include $OPT"])
487 ;;
488 zeta)
489 AC_EGREP_CPP(yes, [dnl
490#include <sys/param.h>
491#ifdef _ZETA_MINAMI_INET6
492yes
493#endif],
494 [ipv6type=$i;
495 ipv6lib=inet6;
496 ipv6libdir=/usr/local/v6/lib;
497 OPT="-DINET6 $OPT"])
498 ;;
499 esac
500 if test "$ipv6type" != "unknown"; then
501 break
502 fi
503 done
504 AC_MSG_RESULT($ipv6type)
505fi
506
507if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
508 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
509 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
510 echo "using lib$ipv6lib"
511 else
512 if test $ipv6trylibc = "yes"; then
513 echo "using libc"
514 else
515 echo 'Fatal: no $ipv6lib library found. cannot continue.'
516 echo "You need to fetch lib$ipv6lib.a from appropriate"
517 echo 'ipv6 kit and compile beforehand.'
518 exit 1
519 fi
520 fi
521fi
522
Martin v. Löwis130fb172001-07-19 11:00:41 +0000523# -Kpthread, if available, provides the right #defines
524# and linker options to make pthread_create available
525AC_MSG_CHECKING(whether $CC accepts -Kpthread)
526AC_CACHE_VAL(ac_cv_kpthread,
527[ac_save_cc="$CC"
528CC="$CC -Kpthread"
529AC_TRY_LINK([#include <pthread.h>],[pthread_create(0,0,0,0)],
530 ac_cv_kpthread=yes,
531 ac_cv_kpthread=no)
532CC="$ac_save_cc"])
533
534# GCC does not reject -Kpthread as an illegal option, it merely complains that
535# it is unrecognized
536if test "$GCC" = "yes"
537then ac_cv_kpthread="no, we have gcc"
538fi
539AC_MSG_RESULT($ac_cv_kpthread)
540
Fred Drakece81d592000-07-09 14:39:29 +0000541dnl # check for ANSI or K&R ("traditional") preprocessor
542dnl AC_MSG_CHECKING(for C preprocessor type)
543dnl AC_TRY_COMPILE([
544dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
545dnl int foo;
546dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
547dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
548dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000549
Guido van Rossum627b2d71993-12-24 10:39:16 +0000550# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000551AC_HEADER_STDC
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000552AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000553signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000554sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000555sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000556sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
Thomas Wouterse38b2f12001-07-11 22:35:31 +0000557ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000558AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000559
560# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000561was_it_defined=no
562AC_MSG_CHECKING(for clock_t in time.h)
563AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
564AC_MSG_RESULT($was_it_defined)
565
Guido van Rossum300fda71996-08-19 21:58:16 +0000566# Add some code to confdefs.h so that the test for off_t works on SCO
567cat >> confdefs.h <<\EOF
568#if defined(SCO_DS)
569#undef _OFF_T
570#endif
571EOF
572
Guido van Rossumef2255b2000-03-10 22:30:29 +0000573# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000574AC_TYPE_MODE_T
575AC_TYPE_OFF_T
576AC_TYPE_PID_T
577AC_TYPE_SIGNAL
578AC_TYPE_SIZE_T
579AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000580
Guido van Rossumef2255b2000-03-10 22:30:29 +0000581# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000582AC_CHECK_SIZEOF(int)
583AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000584AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000585AC_CHECK_SIZEOF(char)
586AC_CHECK_SIZEOF(short)
587AC_CHECK_SIZEOF(float)
588AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000589AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000590
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000591AC_MSG_CHECKING(for long long support)
592have_long_long=no
593AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
594AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000595if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000596AC_CHECK_SIZEOF(long long)
597fi
598
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000599AC_MSG_CHECKING(for uintptr_t support)
600have_uintptr_t=no
601AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
602AC_MSG_RESULT($have_uintptr_t)
603if test "$have_uintptr_t" = yes ; then
604AC_CHECK_SIZEOF(uintptr_t)
605fi
606
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000607# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
608AC_MSG_CHECKING(size of off_t)
609AC_CACHE_VAL(ac_cv_sizeof_off_t,
610[AC_TRY_RUN([#include <stdio.h>
611#include <sys/types.h>
612main()
613{
614 FILE *f=fopen("conftestval", "w");
615 if (!f) exit(1);
616 fprintf(f, "%d\n", sizeof(off_t));
617 exit(0);
618}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
619])
620AC_MSG_RESULT($ac_cv_sizeof_off_t)
621AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
622
623AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000624if test "$have_long_long" = yes -a \
625 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
626 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000627 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
628 AC_MSG_RESULT(yes)
629else
630 AC_MSG_RESULT(no)
631fi
632
Fred Drakea3f6e912000-06-29 20:44:47 +0000633# AC_CHECK_SIZEOF() doesn't include <time.h>.
634AC_MSG_CHECKING(size of time_t)
635AC_CACHE_VAL(ac_cv_sizeof_time_t,
636[AC_TRY_RUN([#include <stdio.h>
637#include <time.h>
638main()
639{
640 FILE *f=fopen("conftestval", "w");
641 if (!f) exit(1);
642 fprintf(f, "%d\n", sizeof(time_t));
643 exit(0);
644}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
645])
646AC_MSG_RESULT($ac_cv_sizeof_time_t)
647AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
648
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000649
Trent Mick635f6fb2000-08-23 21:33:05 +0000650# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000651ac_save_cc="$CC"
652if test "$ac_cv_kpthread" = "yes"
653then CC="$CC -Kpthread"
654fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000655AC_MSG_CHECKING(for pthread_t)
656have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000657AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000658AC_MSG_RESULT($have_pthread_t)
659if test "$have_pthread_t" = yes ; then
660 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
661 AC_MSG_CHECKING(size of pthread_t)
662 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
663 [AC_TRY_RUN([#include <stdio.h>
664 #include <pthread.h>
665 main()
666 {
667 FILE *f=fopen("conftestval", "w");
668 if (!f) exit(1);
669 fprintf(f, "%d\n", sizeof(pthread_t));
670 exit(0);
671 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
672 ])
673 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
674 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
675fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000676CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000677
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000678# Minor variations in building a framework between NextStep versions 4 and 5
679AC_SUBST(LIBTOOL_CRUFT)
680case $ac_sys_system/$ac_sys_release in
Guido van Rossum5839e582000-10-09 19:52:35 +0000681 Darwin/*)
682 ns_undef_sym='_environ'
Jack Jansenca06bc62001-08-03 15:32:23 +0000683 LIBTOOL_CRUFT="-framework Foundation -framework Carbon -lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000684 next/4*)
685 ns_undef_sym='__environ'
686 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
687 next/5*)
688 ns_undef_sym='_environ'
689 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
690esac
691
692AC_MSG_CHECKING(for --with-next-framework)
693if test "$with_next_framework"
694then
Jack Jansenca06bc62001-08-03 15:32:23 +0000695 OPT="$OPT -fno-common -dynamic"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000696 # -U __environ is needed since bundles don't have access
697 # to crt0 when built but will always be linked against it
698 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
699 AC_DEFINE(WITH_NEXT_FRAMEWORK)
700 AC_MSG_RESULT(yes)
701else
702 AC_MSG_RESULT(no)
703fi
704
705AC_MSG_CHECKING(for --with-dyld)
706if test "$with_next_framework" -o "$with_dyld"
707then
708 if test "$with_dyld"
709 then
710 AC_MSG_RESULT(yes)
711 else
712 AC_MSG_RESULT(required for framework build)
713 fi
714 AC_DEFINE(WITH_DYLD)
715 ns_dyld='set'
716else
717 AC_MSG_RESULT(no)
718fi
719
Guido van Rossumac405f61994-09-12 10:56:06 +0000720# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000721AC_SUBST(SO)
722AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000723AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000724AC_SUBST(CCSHARED)
725AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000726# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000727# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000728AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000729if test -z "$SO"
730then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000731 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000732 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000733 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000734 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000735 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000736fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000737AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000738# LDSHARED is the ld *command* used to create shared library
739# -- "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 +0000740# (Shared libraries in this instance are shared modules to be loaded into
741# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000742AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000743if test -z "$LDSHARED"
744then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000745 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000746 AIX*)
747 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
748 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
749 ;;
750 BeOS*)
751 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
752 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
753 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000754 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000755 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000756 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a662000-05-26 12:22:54 +0000757 SunOS/5*)
758 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000759 then LDSHARED='$(CC) -shared'
Greg Ward57c9a662000-05-26 12:22:54 +0000760 else LDSHARED="ld -G";
761 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000762 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000763 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000764 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000765 Darwin/*|next/*)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000766 if test "$ns_dyld"
Guido van Rossumacb14c72001-01-10 21:41:16 +0000767 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000768 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
769 fi
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000770 if test "$with_next_framework" ; then
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000771 LDSHARED="$LDSHARED \$(LDLIBRARY)"
772 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000773 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000774 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000775 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000776 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000777 NetBSD*)
778 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
779 then
780 LDSHARED="cc -shared"
781 else
782 LDSHARED="ld -Bshareable"
783 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000784 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000785 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000786 then
787 LDSHARED="cc -shared ${LDFLAGS}"
788 else
789 LDSHARED="ld -Bshareable ${LDFLAGS}"
790 fi;;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000791 UnixWare*)
792 if test "$GCC" = "yes"
793 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000794 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000795 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000796 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000797 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000798 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000799 *) LDSHARED="ld";;
800 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000801fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000802AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000803BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000804# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000805# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000806AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000807if test -z "$CCSHARED"
808then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000809 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000810 SunOS*) if test "$GCC" = yes;
811 then CCSHARED="-fPIC";
812 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000813 hp*|HP*) if test "$GCC" = yes;
814 then CCSHARED="-fpic";
815 else CCSHARED="+z";
816 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000817 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000818 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000819 OpenBSD*) CCSHARED="-fpic";;
820 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000821 UnixWare*)
822 if test "$GCC" = "yes"
823 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000824 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000825 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000826 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000827 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000828 IRIX*/6*) case $CC in
829 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000830 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000831 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000832 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000833 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000834fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000835AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000836# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000837# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000838AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000839if test -z "$LINKFORSHARED"
840then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000841 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000842 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000843 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000844 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000845 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000846 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000847 # -u libsys_s pulls in all symbols in libsys
848 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
849 # -u __dummy makes the linker aware of the objc runtime
850 # in System.framework; otherwise, __objcInit (referenced in
851 # crt1.o) gets erroneously defined as common, which breaks dynamic
852 # loading of any modules which reference it in System.framework
853 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Jack Jansenc49e5b72001-06-19 15:00:23 +0000854 Darwin/*) LINKFORSHARED="-u __dummy -u _PyMac_Error -framework System -framework Foundation -framework Carbon" ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000855 UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000856 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000857 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000858 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000859 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
860 then
861 LINKFORSHARED="-Wl,--export-dynamic"
862 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000863 SunOS/5*) case $CC in
864 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000865 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000866 then
867 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000868 fi;;
869 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000870 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000871fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000872AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000873
Neil Schemenauer61c51152001-01-26 16:18:16 +0000874AC_SUBST(CFLAGSFORSHARED)
875AC_MSG_CHECKING(CFLAGSFORSHARED)
876if test ! "$LIBRARY" = "$LDLIBRARY"
877then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000878 case $ac_sys_system in
879 CYGWIN*)
880 # Cygwin needs CCSHARED when building extension DLLs
881 # but not when building the interpreter DLL.
882 CFLAGSFORSHARED='';;
883 *)
884 CFLAGSFORSHARED='$(CCSHARED)'
885 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000886fi
887AC_MSG_RESULT($CFLAGSFORSHARED)
888
Guido van Rossum627b2d71993-12-24 10:39:16 +0000889# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000890AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
891AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000892
893# checks for system dependent C++ extensions support
894case "$ac_sys_system" in
895 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
896 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
897 [loadAndInit("", 0, "")],
898 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
899 AC_MSG_RESULT(yes)],
900 [AC_MSG_RESULT(no)]);;
901 *) ;;
902esac
903
Guido van Rossum70c7f481998-03-26 18:44:10 +0000904# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
905# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000906# BeOS' sockets are stashed in libnet.
907case "$ac_sys_system" in
908IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000909*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000910AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000911AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000912;;
913esac
914case "$ac_sys_system" in
915BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000916AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
917;;
918esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000919
Guido van Rossumc5a39031996-07-31 17:35:03 +0000920AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000921AC_ARG_WITH(libs,
922[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000923AC_MSG_RESULT($withval)
924LIBS="$withval $LIBS"
925], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000926
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000927# Determine if signalmodule should be used.
928AC_SUBST(USE_SIGNAL_MODULE)
929AC_SUBST(SIGNAL_OBJS)
930AC_MSG_CHECKING(for --with-signal-module)
931AC_ARG_WITH(signal-module,
932[ --with-signal-module disable/enable signal module])
933
934if test -z "$with_signal_module"
935then with_signal_module="yes"
936fi
937AC_MSG_RESULT($with_signal_module)
938
939if test "${with_signal_module}" = "yes"; then
940 USE_SIGNAL_MODULE=""
941 SIGNAL_OBJS=""
942else
943 USE_SIGNAL_MODULE="#"
944 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
945fi
946
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000947# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000948AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000949USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000950
Guido van Rossum54d93d41997-01-22 20:51:58 +0000951AC_MSG_CHECKING(for --with-dec-threads)
952AC_SUBST(LDLAST)
953AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d82000-06-29 16:12:00 +0000954[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
955AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000956LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000957if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000958 with_thread="$withval";
959fi],
960AC_MSG_RESULT(no))
961
962AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000963AC_ARG_WITH(threads,
964[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000965
Barry Warsawc0d24d82000-06-29 16:12:00 +0000966# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000967AC_ARG_WITH(thread,
968[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
969with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +0000970
971if test -z "$with_threads"
972then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000973fi
Barry Warsawc0d24d82000-06-29 16:12:00 +0000974AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000975
Barry Warsawc0d24d82000-06-29 16:12:00 +0000976if test "$with_threads" = "no"
977then
978 USE_THREAD_MODULE="#"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000979elif test "$ac_cv_kpthread" = "yes"
980then
981 CC="$CC -Kpthread"
982 AC_DEFINE(WITH_THREAD)
983 AC_DEFINE(_POSIX_THREADS)
984 LIBOBJS="$LIBOBJS thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +0000985else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000986 if test ! -z "$with_threads" -a -d "$with_threads"
987 then LDFLAGS="$LDFLAGS -L$with_threads"
988 fi
989 if test ! -z "$withval" -a -d "$withval"
990 then LDFLAGS="$LDFLAGS -L$withval"
991 fi
992 AC_DEFINE(_REENTRANT)
993 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
994 AC_DEFINE(C_THREADS)
995 LIBOBJS="$LIBOBJS thread.o"],[
996 AC_MSG_CHECKING(for --with-pth)
997 AC_ARG_WITH(pth,
998 [ --with-pth use GNU pth threading libraries], [
999 AC_MSG_RESULT($withval)
1000 AC_DEFINE(WITH_THREAD)
1001 AC_DEFINE(HAVE_PTH)
1002 LIBS="-lpth $LIBS"
1003 LIBOBJS="$LIBOBJS thread.o"],[
1004 AC_MSG_RESULT(no)
1005 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
1006 AC_DEFINE(_POSIX_THREADS)
1007 LIBS="-lpthread $LIBS"
1008 LIBOBJS="$LIBOBJS thread.o"],[
1009 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1010 case $ac_sys_system in
1011 Darwin*) ;;
1012 *) AC_DEFINE(_POSIX_THREADS);;
1013 esac
1014 LIBOBJS="$LIBOBJS thread.o"],[
1015 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1016 AC_DEFINE(BEOS_THREADS)
1017 LIBOBJS="$LIBOBJS thread.o"],[
1018 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1019 AC_DEFINE(_POSIX_THREADS)
1020 LIBS="$LIBS -lpthreads"
1021 LIBOBJS="$LIBOBJS thread.o"], [
1022 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1023 AC_DEFINE(_POSIX_THREADS)
1024 LIBS="$LIBS -lc_r"
1025 LIBOBJS="$LIBOBJS thread.o"], [
1026 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
1027 AC_DEFINE(_POSIX_THREADS)
1028 LIBS="$LIBS -lthread"
1029 LIBOBJS="$LIBOBJS thread.o"], [
1030 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1031 AC_DEFINE(_POSIX_THREADS)
1032 LIBS="$LIBS -lpthread"
1033 LIBOBJS="$LIBOBJS thread.o"], [
1034 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1035 AC_DEFINE(_POSIX_THREADS)
1036 LIBS="$LIBS -lcma"
1037 LIBOBJS="$LIBOBJS thread.o"],[
1038 USE_THREAD_MODULE="#"])
1039 ])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00001040
Martin v. Löwis130fb172001-07-19 11:00:41 +00001041 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1042 LIBS="$LIBS -lmpc"
1043 LIBOBJS="$LIBOBJS thread.o"
1044 USE_THREAD_MODULE=""])
1045 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1046 LIBS="$LIBS -lthread"
1047 LIBOBJS="$LIBOBJS thread.o"
1048 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001049
Martin v. Löwis130fb172001-07-19 11:00:41 +00001050 if test "$USE_THREAD_MODULE" != "#"
1051 then
1052 # If the above checks didn't disable threads, (at least) OSF1
1053 # needs this '-threads' argument during linking.
1054 case $ac_sys_system in
1055 OSF1) LDLAST=-threads;;
1056 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001057 fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00001058fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001059
Barry Warsawef82cd72000-06-30 16:21:01 +00001060# Check for GC support
1061AC_SUBST(USE_GC_MODULE)
1062USE_GC_MODULE=""
1063AC_MSG_CHECKING(for --with-cycle-gc)
1064AC_ARG_WITH(cycle-gc,
1065[ --with(out)-cycle-gc disable/enable garbage collection])
1066
1067if test -z "$with_cycle_gc"
1068then with_cycle_gc="yes"
1069fi
1070if test "$with_cycle_gc" = "no"
1071then
1072 USE_GC_MODULE="#"
1073else
1074 AC_DEFINE(WITH_CYCLE_GC)
1075fi
1076AC_MSG_RESULT($with_cycle_gc)
1077
Neil Schemenauera35c6882001-02-27 04:45:05 +00001078# Check for Python-specific malloc support
1079AC_MSG_CHECKING(for --with-pymalloc)
1080AC_ARG_WITH(pymalloc,
1081[ --with(out)-pymalloc disable/enable specialized mallocs], [
1082if test "$withval" != no
1083then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1084else AC_MSG_RESULT(no)
1085fi],
1086[AC_MSG_RESULT(no)])
1087
Barry Warsawef82cd72000-06-30 16:21:01 +00001088# Check for --with-wctype-functions
1089AC_MSG_CHECKING(for --with-wctype-functions)
1090AC_ARG_WITH(wctype-functions,
1091[ --with-wctype-functions use wctype.h functions], [
1092if test "$withval" != no
1093then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1094else AC_MSG_RESULT(no)
1095fi],
1096[AC_MSG_RESULT(no)])
1097
Guido van Rossum68242b51996-05-28 22:53:03 +00001098# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001099AC_SUBST(DLINCLDIR)
1100DLINCLDIR=/
1101
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001102AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001103AC_ARG_WITH(sgi-dl,
1104[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001105AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001106AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +00001107DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001108dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001109if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001110then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001111else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1112fi
1113DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001114LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001115
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001116AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001117AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001118AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001119AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001120DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001121dldir=`echo "$withval" | sed 's/,.*//'`
1122dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001123if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001124then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001125else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1126fi
1127DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001128LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001129
Guido van Rossume97ee181999-12-20 21:27:22 +00001130# the dlopen() function means we might want to use dynload_shlib.o. some
1131# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001132AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001133
1134# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1135# loading of modules.
1136AC_SUBST(DYNLOADFILE)
1137AC_MSG_CHECKING(DYNLOADFILE)
1138if test -z "$DYNLOADFILE"
1139then
1140 case $ac_sys_system/$ac_sys_release in
1141 AIX*) DYNLOADFILE="dynload_aix.o";;
1142 BeOS*) DYNLOADFILE="dynload_beos.o";;
1143 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Guido van Rossum5839e582000-10-09 19:52:35 +00001144 Darwin/*|next/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001145 *)
1146 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1147 # out any dynamic loading
1148 if test "$ac_cv_func_dlopen" = yes
1149 then DYNLOADFILE="dynload_shlib.o"
1150 else DYNLOADFILE="dynload_stub.o"
1151 fi
1152 ;;
1153 esac
1154fi
1155AC_MSG_RESULT($DYNLOADFILE)
1156if test "$DYNLOADFILE" != "dynload_stub.o"
1157then
1158 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1159fi
1160
Jack Jansenc49e5b72001-06-19 15:00:23 +00001161# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1162
1163AC_SUBST(MACHDEP_OBJS)
1164AC_MSG_CHECKING(MACHDEP_OBJS)
1165if test -z "$MACHDEP_OBJS"
1166then
1167 case $ac_sys_system/$ac_sys_release in
1168 Darwin/*)
1169 MACHDEP_OBJS="Mac/Python/macglue.o"
1170 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
1171 ;;
1172 *) MACHDEP_OBJS="";;
1173 esac
1174fi
1175AC_MSG_RESULT($DYNLOADFILE)
1176
Guido van Rossum627b2d71993-12-24 10:39:16 +00001177# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001178AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001179 flock fork fsync fdatasync fpathconf ftime ftruncate \
Andrew M. Kuchlinga9586c72001-01-08 17:58:56 +00001180 getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwisb9ab1592001-06-24 21:18:26 +00001181 inet_pton kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001182 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001183 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001184 select setegid seteuid setgid \
Martin v. Löwis791bfda2001-07-24 06:33:08 +00001185 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
Fred Drake35a092f1999-12-13 16:23:35 +00001186 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001187 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Woutersc2c12dc2001-07-11 14:45:34 +00001188 truncate uname waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001189
Fred Drake8cef4cf2000-06-28 16:40:38 +00001190# check for openpty and forkpty
1191
1192AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1193AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1194
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001195# check for long file support functions
1196AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1197
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001198AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001199AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1200AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1201AC_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 +00001202
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001203AC_CHECK_FUNCS(getaddrinfo, [dnl
1204AC_MSG_CHECKING(getaddrinfo bug)
1205AC_TRY_RUN([
1206#include <sys/types.h>
1207#include <netdb.h>
1208#include <string.h>
1209#include <sys/socket.h>
1210#include <netinet/in.h>
1211
1212main()
1213{
1214 int passive, gaierr, inet4 = 0, inet6 = 0;
1215 struct addrinfo hints, *ai, *aitop;
1216 char straddr[INET6_ADDRSTRLEN], strport[16];
1217
1218 for (passive = 0; passive <= 1; passive++) {
1219 memset(&hints, 0, sizeof(hints));
1220 hints.ai_family = AF_UNSPEC;
1221 hints.ai_flags = passive ? AI_PASSIVE : 0;
1222 hints.ai_socktype = SOCK_STREAM;
1223 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1224 (void)gai_strerror(gaierr);
1225 goto bad;
1226 }
1227 for (ai = aitop; ai; ai = ai->ai_next) {
1228 if (ai->ai_addr == NULL ||
1229 ai->ai_addrlen == 0 ||
1230 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1231 straddr, sizeof(straddr), strport, sizeof(strport),
1232 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1233 goto bad;
1234 }
1235 switch (ai->ai_family) {
1236 case AF_INET:
1237 if (strcmp(strport, "54321") != 0) {
1238 goto bad;
1239 }
1240 if (passive) {
1241 if (strcmp(straddr, "0.0.0.0") != 0) {
1242 goto bad;
1243 }
1244 } else {
1245 if (strcmp(straddr, "127.0.0.1") != 0) {
1246 goto bad;
1247 }
1248 }
1249 inet4++;
1250 break;
1251 case AF_INET6:
1252 if (strcmp(strport, "54321") != 0) {
1253 goto bad;
1254 }
1255 if (passive) {
1256 if (strcmp(straddr, "::") != 0) {
1257 goto bad;
1258 }
1259 } else {
1260 if (strcmp(straddr, "::1") != 0) {
1261 goto bad;
1262 }
1263 }
1264 inet6++;
1265 break;
1266 case AF_UNSPEC:
1267 goto bad;
1268 break;
1269 default:
1270 /* another family support? */
1271 break;
1272 }
1273 }
1274 }
1275
1276 if (!(inet4 == 0 || inet4 == 2))
1277 goto bad;
1278 if (!(inet6 == 0 || inet6 == 2))
1279 goto bad;
1280
1281 if (aitop)
1282 freeaddrinfo(aitop);
1283 exit(0);
1284
1285 bad:
1286 if (aitop)
1287 freeaddrinfo(aitop);
1288 exit(1);
1289}
1290],
1291AC_MSG_RESULT(good)
1292buggygetaddrinfo=no,
1293AC_MSG_RESULT(buggy)
1294buggygetaddrinfo=yes,
1295AC_MSG_RESULT(buggy)
1296buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
1297
1298if test "$buggygetaddrinfo" = "yes"; then
1299 if test "$ipv6" = "yes"; then
1300 echo 'Fatal: You must get working getaddrinfo() function.'
1301 echo ' or you can specify "--disable-ipv6"'.
1302 exit 1
1303 fi
1304fi
1305AC_CHECK_FUNCS(getaddrinfo getnameinfo)
1306
Guido van Rossum627b2d71993-12-24 10:39:16 +00001307# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001308AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001309AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001310AC_STRUCT_TIMEZONE
1311
1312AC_MSG_CHECKING(for time.h that defines altzone)
1313AC_CACHE_VAL(ac_cv_header_time_altzone,
1314[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1315 ac_cv_header_time_altzone=yes,
1316 ac_cv_header_time_altzone=no)])
1317AC_MSG_RESULT($ac_cv_header_time_altzone)
1318if test $ac_cv_header_time_altzone = yes; then
1319 AC_DEFINE(HAVE_ALTZONE)
1320fi
1321
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001322was_it_defined=no
1323AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001324AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001325#include <sys/types.h>
1326#include <sys/select.h>
1327#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001328], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1329AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001330
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001331AC_MSG_CHECKING(for addrinfo)
1332AC_CACHE_VAL(ac_cv_struct_addrinfo,
1333AC_TRY_COMPILE([
1334# include <netdb.h>],
1335 [struct addrinfo a],
1336 ac_cv_struct_addrinfo=yes,
1337 ac_cv_struct_addrinfo=no))
1338AC_MSG_RESULT($ac_cv_struct_addrinfo)
1339if test $ac_cv_struct_addrinfo = yes; then
1340 AC_DEFINE(HAVE_ADDRINFO)
1341fi
1342
1343AC_MSG_CHECKING(for sockaddr_storage)
1344AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1345AC_TRY_COMPILE([
1346# include <sys/types.h>
1347# include <sys/socket.h>],
1348 [struct sockaddr_storage s],
1349 ac_cv_struct_sockaddr_storage=yes,
1350 ac_cv_struct_sockaddr_storage=no))
1351AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1352if test $ac_cv_struct_sockaddr_storage = yes; then
1353 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1354fi
1355
Guido van Rossum627b2d71993-12-24 10:39:16 +00001356# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001357
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001358AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001359AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001360
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001361works=no
1362AC_MSG_CHECKING(for working volatile)
1363AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1364AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001365
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001366works=no
1367AC_MSG_CHECKING(for working signed char)
1368AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1369AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001370
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001371have_prototypes=no
1372AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001373AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1374AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001375AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001376
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001377works=no
1378AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001379AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001380#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001381int foo(int x, ...) {
1382 va_list va;
1383 va_start(va, x);
1384 va_arg(va, int);
1385 va_arg(va, char *);
1386 va_arg(va, double);
1387 return 0;
1388}
1389], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001390AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1391AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001392
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001393if test "$have_prototypes" = yes; then
1394bad_prototypes=no
1395AC_MSG_CHECKING(for bad exec* prototypes)
1396AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1397 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1398AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001399fi
1400
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001401# check if sockaddr has sa_len member
1402AC_MSG_CHECKING(if sockaddr has sa_len member)
1403AC_TRY_COMPILE([#include <sys/types.h>
1404#include <sys/socket.h>],
1405[struct sockaddr x;
1406x.sa_len = 0;],
1407 AC_MSG_RESULT(yes)
1408 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1409 AC_MSG_RESULT(no))
1410
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001411bad_forward=no
1412AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001413AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001414struct s { int a; int b; };
1415static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001416int foobar() {
1417 static int random;
1418 random = (int) &foo;
1419 return random;
1420}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001421static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001422main() {
1423 exit(!((int)&foo == foobar()));
1424}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001425], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
1426AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001427
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001428va_list_is_array=no
1429AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001430AC_TRY_COMPILE([
1431#ifdef HAVE_STDARG_PROTOTYPES
1432#include <stdarg.h>
1433#else
1434#include <varargs.h>
1435#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001436], [va_list list1, list2; list1 = list2;], ,
1437AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1438AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001439
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001440# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1441AC_CHECK_FUNC(gethostbyname_r, [
1442 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1443 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1444 OLD_CFLAGS=$CFLAGS
1445 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1446 AC_TRY_COMPILE([
1447# include <netdb.h>
1448 ], [
1449 char *name;
1450 struct hostent *he, *res;
1451 char buffer[2048];
1452 int buflen = 2048;
1453 int h_errnop;
1454
1455 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1456 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001457 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001458 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1459 AC_MSG_RESULT(yes)
1460 ], [
1461 AC_MSG_RESULT(no)
1462 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1463 AC_TRY_COMPILE([
1464# include <netdb.h>
1465 ], [
1466 char *name;
1467 struct hostent *he;
1468 char buffer[2048];
1469 int buflen = 2048;
1470 int h_errnop;
1471
1472 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1473 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001474 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001475 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1476 AC_MSG_RESULT(yes)
1477 ], [
1478 AC_MSG_RESULT(no)
1479 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1480 AC_TRY_COMPILE([
1481# include <netdb.h>
1482 ], [
1483 char *name;
1484 struct hostent *he;
1485 struct hostent_data data;
1486
1487 (void) gethostbyname_r(name, he, &data);
1488 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001489 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001490 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1491 AC_MSG_RESULT(yes)
1492 ], [
1493 AC_MSG_RESULT(no)
1494 ])
1495 ])
1496 ])
1497 CFLAGS=$OLD_CFLAGS
1498], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001499 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001500])
1501AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1502AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1503AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001504AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001505AC_SUBST(HAVE_GETHOSTBYNAME)
1506
Guido van Rossum627b2d71993-12-24 10:39:16 +00001507# checks for system services
1508# (none yet)
1509
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001510# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001511AC_CHECK_FUNC(__fpu_control,
1512 [],
1513 [AC_CHECK_LIB(ieee, __fpu_control)
1514])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001515
Guido van Rossum93274221997-05-09 02:42:00 +00001516# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001517AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001518AC_ARG_WITH(fpectl,
1519[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001520if test "$withval" != no
1521then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1522else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001523fi],
1524[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001525
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001526# check for --with-libm=...
1527AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001528case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001529Darwin) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001530next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001531BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001532*) LIBM=-lm
1533esac
Guido van Rossum93274221997-05-09 02:42:00 +00001534AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001535AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001536if test "$withval" = no
1537then LIBM=
1538 AC_MSG_RESULT(force LIBM empty)
1539elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001540then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001541 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001542else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001543fi],
1544[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001545
1546# check for --with-libc=...
1547AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001548AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001549AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001550if test "$withval" = no
1551then LIBC=
1552 AC_MSG_RESULT(force LIBC empty)
1553elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001554then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001555 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001556else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001557fi],
1558[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001559
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001560# check for hypot() in math library
1561LIBS_SAVE=$LIBS
1562LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001563AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001564LIBS=$LIBS_SAVE
1565
Guido van Rossumad713701997-07-10 22:42:38 +00001566# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001567AC_MSG_CHECKING(what malloc(0) returns)
1568AC_CACHE_VAL(ac_cv_malloc_zero,
1569[AC_TRY_RUN([#include <stdio.h>
1570#ifdef HAVE_STDLIB
1571#include <stdlib.h>
1572#else
1573char *malloc(), *realloc();
1574int *free();
1575#endif
1576main() {
1577 char *p;
1578 p = malloc(0);
1579 if (p == NULL) exit(1);
1580 p = realloc(p, 0);
1581 if (p == NULL) exit(1);
1582 free(p);
1583 exit(0);
1584}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1585AC_MSG_RESULT($ac_cv_malloc_zero)
1586if test "$ac_cv_malloc_zero" = null
1587then
1588 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1589fi
1590
Guido van Rossumef2255b2000-03-10 22:30:29 +00001591# check for wchar.h
1592AC_CHECK_HEADER(wchar.h,
1593AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1594wchar_h="no"
1595)
1596
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001597# determine wchar_t size
1598if test "$wchar_h" = yes
1599then
1600 AC_CHECK_SIZEOF(wchar_t)
1601fi
1602
1603AC_MSG_CHECKING(what type to use for unicode)
1604AC_ARG_ENABLE(unicode,
1605[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1606
1607if test $enable_unicode = yes
1608then
Martin v. Löwisfd917792001-06-27 20:22:04 +00001609 # Without any arguments, Py_UNICODE defaults to two-byte mode
1610 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001611fi
1612
1613case "$enable_unicode" in
1614ucs2) unicode_size="2"
1615 AC_DEFINE(Py_UNICODE_SIZE,2)
1616 ;;
1617ucs4) unicode_size="4"
1618 AC_DEFINE(Py_UNICODE_SIZE,4)
1619 ;;
1620esac
1621
1622if test "$enable_unicode" = "no"
1623then
1624 AC_MSG_RESULT(not used)
1625else
1626 AC_DEFINE(Py_USING_UNICODE)
1627 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1628 then
1629 PY_UNICODE_TYPE="wchar_t"
1630 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1631 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1632 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1633 then
1634 PY_UNICODE_TYPE="unsigned short"
1635 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1636 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1637 then
1638 PY_UNICODE_TYPE="unsigned long"
1639 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1640 else
1641 PY_UNICODE_TYPE="no type found"
1642 fi
1643 AC_MSG_RESULT($PY_UNICODE_TYPE)
1644fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00001645
1646# check for endianness
1647AC_C_BIGENDIAN
1648
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001649# Check whether right shifting a negative integer extends the sign bit
1650# or fills with zeros (like the Cray J90, according to Tim Peters).
1651AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001652AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001653AC_TRY_RUN([
1654int main()
1655{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001656 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001657}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001658], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1659AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1660if test "$ac_cv_rshift_extends_sign" = no
1661then
1662 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1663fi
1664
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001665# check for getc_unlocked and related locking functions
1666AC_MSG_CHECKING(for getc_unlocked() and friends)
1667AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1668AC_TRY_LINK([#include <stdio.h>],[
1669 FILE *f = fopen("/dev/null", "r");
1670 flockfile(f);
1671 getc_unlocked(f);
1672 funlockfile(f);
1673], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1674AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1675if test "$ac_cv_have_getc_unlocked" = yes
1676then
1677 AC_DEFINE(HAVE_GETC_UNLOCKED)
1678fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001679
Guido van Rossum353ae582001-07-10 16:45:32 +00001680# check for readline 4.2
1681AC_CHECK_LIB(readline, rl_completion_matches,
1682 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1683
Thomas Wouterse38b2f12001-07-11 22:35:31 +00001684AC_MSG_CHECKING(for broken nice())
1685AC_CACHE_VAL(ac_cv_broken_nice, [
1686AC_TRY_RUN([
1687int main()
1688{
1689 int val1 = nice(1);
1690 if (val1 != -1 && val1 == nice(2))
1691 exit(0);
1692 exit(1);
1693}
1694],ac_cv_broken_nice=yes, ac_cv_broken_nice=no)])
1695AC_MSG_RESULT($ac_cv_broken_nice)
1696if test "$ac_cv_broken_nice" = yes
1697then
1698 AC_DEFINE(HAVE_BROKEN_NICE)
1699fi
1700
Guido van Rossum95713eb2000-05-18 20:53:31 +00001701# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1702# Add sys/socket.h to confdefs.h
1703cat >> confdefs.h <<\EOF
1704#ifdef HAVE_SYS_SOCKET_H
1705#include <sys/socket.h>
1706#endif
1707EOF
1708AC_CHECK_TYPE(socklen_t, int)
1709
Neil Schemenauerf25cf6c2001-03-04 06:39:33 +00001710# Add Python/ prefix to LIBOBJS
1711libobjs=$LIBOBJS
1712LIBOBJS=
1713for obj in $libobjs; do
1714 LIBOBJS="$LIBOBJS Python/$obj"
1715done
1716
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001717#AC_MSG_CHECKING(for Modules/Setup)
1718#if test ! -f Modules/Setup ; then
1719# if test ! -d Modules ; then
1720# mkdir Modules
1721# fi
1722# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1723# AC_MSG_RESULT(creating)
1724#else
1725# AC_MSG_RESULT(already exists)
1726#fi
1727
1728AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00001729SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001730AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001731for dir in $SRCDIRS; do
1732 if test ! -d $dir; then
1733 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001734 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001735done
1736AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001737
Guido van Rossum627b2d71993-12-24 10:39:16 +00001738# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001739AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001740
1741echo "creating Setup"
1742if test ! -f Modules/Setup
1743then
1744 cp $srcdir/Modules/Setup.dist Modules/Setup
1745fi
1746
1747echo "creating Setup.local"
1748if test ! -f Modules/Setup.local
1749then
1750 echo "# Edit this file for local setup changes" >Modules/Setup.local
1751fi
1752
1753echo "creating Makefile"
1754$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1755 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00001756 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00001757mv config.c Modules