blob: 3ba4417ad7d7a3f418ebeb235d1d98a1026c1c56 [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'
251fi
252
253# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000254case $MACHDEP in
255dguxR4)
256 LDLIBRARY='libpython$(VERSION).so'
257 OPT="$OPT -pic"
258 ;;
259beos*)
260 LDLIBRARY='libpython$(VERSION).so'
261 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000262cygwin*)
263 LDLIBRARY='libpython$(VERSION).dll.a'
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000264 DLLLIBRARY='libpython$(VERSION).dll'
Guido van Rossumaef734b2001-01-10 21:09:12 +0000265 ;;
Fred Drake5790be12000-10-09 17:06:13 +0000266esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000267AC_MSG_RESULT($LDLIBRARY)
268
Guido van Rossum627b2d71993-12-24 10:39:16 +0000269AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000270AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000271AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000272
273case $MACHDEP in
274bsdos*)
275 # install -d does not work on BSDI
276 if test -z "$INSTALL"
277 then
278 INSTALL="${srcdir}/install-sh -c"
279 fi
280esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000281AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000282
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000283# Not every filesystem supports hard links
284AC_SUBST(LN)
285if test -z "$LN" ; then
286 case $ac_sys_system in
287 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000288 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000289 *) LN=ln;;
290 esac
291fi
292
Fred Drake9f715822001-07-11 06:27:00 +0000293# Check for --with-pydebug
294AC_MSG_CHECKING(for --with-pydebug)
295AC_ARG_WITH(pydebug,
296[ --with-pydebug build with Py_DEBUG defined], [
297if test "$withval" != no
298then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
299else AC_MSG_RESULT(no); Py_DEBUG='false'
300fi],
301[AC_MSG_RESULT(no)])
302
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000303# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000304AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000305if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000306then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000307 case $GCC in
308 yes)
309 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000310 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000311 if test "$Py_DEBUG" = 'true' ; then
312 # Optimization messes up debuggers, so turn it off for
313 # debug builds.
314 OPT="-g -Wall -Wstrict-prototypes"
315 else
316 OPT="-g -O3 -Wall -Wstrict-prototypes"
317 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000318 *)
Fred Drake9f715822001-07-11 06:27:00 +0000319 OPT="-O3 -Wall -Wstrict-prototypes";;
320 esac
321 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000322 *)
323 case $ac_sys_system in
324 UnixWare*)
325 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
326 *)
327 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000328 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000329 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000330fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000331
Trent Mick635f6fb2000-08-23 21:33:05 +0000332# The current (beta) Monterey compiler dies with optimizations
333case $ac_sys_system in
334Monterey*) OPT="";;
335esac
336
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000337if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000338then
339 OPT="$OPT $ac_arch_flags"
340fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000341# checks for UNIX variants that set C preprocessor variables
342AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000343AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000344
Guido van Rossum91922671997-10-09 20:24:13 +0000345AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
346AC_CACHE_VAL(ac_cv_opt_olimit_ok,
347[ac_save_cc="$CC"
348CC="$CC -OPT:Olimit=0"
349AC_TRY_RUN([int main() { return 0; }],
350 ac_cv_opt_olimit_ok=yes,
351 ac_cv_opt_olimit_ok=no)
352CC="$ac_save_cc"])
353AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000354if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000355 case $ac_sys_system in
356 Darwin*) OPT="$OPT" ;;
357 *) OPT="$OPT -OPT:Olimit=0";;
358 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000359else
360 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
361 AC_CACHE_VAL(ac_cv_olimit_ok,
362 [ac_save_cc="$CC"
363 CC="$CC -Olimit 1500"
364 AC_TRY_RUN([int main() { return 0; }],
365 ac_cv_olimit_ok=yes,
366 ac_cv_olimit_ok=no)
367 CC="$ac_save_cc"])
368 AC_MSG_RESULT($ac_cv_olimit_ok)
369 if test $ac_cv_olimit_ok = yes; then
370 OPT="$OPT -Olimit 1500"
371 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000372fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000373
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000374# Check for enable-ipv6
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000375AC_MSG_CHECKING([whether to enable ipv6])
376AC_ARG_ENABLE(ipv6,
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +0000377[ --enable-ipv6 Enable ipv6 (with ipv4) support
378 --disable-ipv6 Disable ipv6 support],
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000379[ case "$enableval" in
380 no)
381 AC_MSG_RESULT(no)
382 ipv6=no
383 ;;
384 *) AC_MSG_RESULT(yes)
385 AC_DEFINE(ENABLE_IPV6)
386 ipv6=yes
387 ;;
388 esac ],
389
Fred Drake9f715822001-07-11 06:27:00 +0000390 AC_TRY_RUN([ /* AF_INET6 available check */
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000391#include <sys/types.h>
392#include <sys/socket.h>
393main()
394{
395 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
396 exit(1);
397 else
398 exit(0);
399}
400],
401 AC_MSG_RESULT(yes)
402 AC_DEFINE(ENABLE_IPV6)
403 ipv6=yes,
404 AC_MSG_RESULT(no)
405 ipv6=no,
406 AC_MSG_RESULT(no)
407 ipv6=no
408))
409
410ipv6type=unknown
411ipv6lib=none
412ipv6trylibc=no
413
414if test "$ipv6" = "yes"; then
415 AC_MSG_CHECKING([ipv6 stack type])
416 for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do
417 case $i in
418 inria)
419 dnl http://www.kame.net/
420 AC_EGREP_CPP(yes, [dnl
421#include <netinet/in.h>
422#ifdef IPV6_INRIA_VERSION
423yes
424#endif],
425 [ipv6type=$i;
426 OPT="-DINET6 $OPT"])
427 ;;
428 kame)
429 dnl http://www.kame.net/
430 AC_EGREP_CPP(yes, [dnl
431#include <netinet/in.h>
432#ifdef __KAME__
433yes
434#endif],
435 [ipv6type=$i;
436 ipv6lib=inet6
437 ipv6libdir=/usr/local/v6/lib
438 ipv6trylibc=yes
439 OPT="-DINET6 $OPT"])
440 ;;
441 linux-glibc)
442 dnl http://www.v6.linux.or.jp/
443 AC_EGREP_CPP(yes, [dnl
444#include <features.h>
445#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
446yes
447#endif],
448 [ipv6type=$i;
449 ipv6trylibc=yes
450 OPT="-DINET6 $OPT"])
451 ;;
452 linux-inet6)
453 dnl http://www.v6.linux.or.jp/
454 if test -d /usr/inet6; then
455 ipv6type=$i
456 ipv6lib=inet6
457 ipv6libdir=/usr/inet6/lib
458 OPT="-DINET6 -I/usr/inet6/include $OPT"
459 fi
460 ;;
461 toshiba)
462 AC_EGREP_CPP(yes, [dnl
463#include <sys/param.h>
464#ifdef _TOSHIBA_INET6
465yes
466#endif],
467 [ipv6type=$i;
468 ipv6lib=inet6;
469 ipv6libdir=/usr/local/v6/lib;
470 OPT="-DINET6 $OPT"])
471 ;;
472 v6d)
473 AC_EGREP_CPP(yes, [dnl
474#include </usr/local/v6/include/sys/v6config.h>
475#ifdef __V6D__
476yes
477#endif],
478 [ipv6type=$i;
479 ipv6lib=v6;
480 ipv6libdir=/usr/local/v6/lib;
481 OPT="-I/usr/local/v6/include $OPT"])
482 ;;
483 zeta)
484 AC_EGREP_CPP(yes, [dnl
485#include <sys/param.h>
486#ifdef _ZETA_MINAMI_INET6
487yes
488#endif],
489 [ipv6type=$i;
490 ipv6lib=inet6;
491 ipv6libdir=/usr/local/v6/lib;
492 OPT="-DINET6 $OPT"])
493 ;;
494 esac
495 if test "$ipv6type" != "unknown"; then
496 break
497 fi
498 done
499 AC_MSG_RESULT($ipv6type)
500fi
501
502if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
503 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
504 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
505 echo "using lib$ipv6lib"
506 else
507 if test $ipv6trylibc = "yes"; then
508 echo "using libc"
509 else
510 echo 'Fatal: no $ipv6lib library found. cannot continue.'
511 echo "You need to fetch lib$ipv6lib.a from appropriate"
512 echo 'ipv6 kit and compile beforehand.'
513 exit 1
514 fi
515 fi
516fi
517
Martin v. Löwis130fb172001-07-19 11:00:41 +0000518# -Kpthread, if available, provides the right #defines
519# and linker options to make pthread_create available
520AC_MSG_CHECKING(whether $CC accepts -Kpthread)
521AC_CACHE_VAL(ac_cv_kpthread,
522[ac_save_cc="$CC"
523CC="$CC -Kpthread"
524AC_TRY_LINK([#include <pthread.h>],[pthread_create(0,0,0,0)],
525 ac_cv_kpthread=yes,
526 ac_cv_kpthread=no)
527CC="$ac_save_cc"])
528
529# GCC does not reject -Kpthread as an illegal option, it merely complains that
530# it is unrecognized
531if test "$GCC" = "yes"
532then ac_cv_kpthread="no, we have gcc"
533fi
534AC_MSG_RESULT($ac_cv_kpthread)
535
Fred Drakece81d592000-07-09 14:39:29 +0000536dnl # check for ANSI or K&R ("traditional") preprocessor
537dnl AC_MSG_CHECKING(for C preprocessor type)
538dnl AC_TRY_COMPILE([
539dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
540dnl int foo;
541dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
542dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
543dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000544
Guido van Rossum627b2d71993-12-24 10:39:16 +0000545# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000546AC_HEADER_STDC
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000547AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000548signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000549sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000550sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000551sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
Thomas Wouterse38b2f12001-07-11 22:35:31 +0000552ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000553AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000554
555# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000556was_it_defined=no
557AC_MSG_CHECKING(for clock_t in time.h)
558AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
559AC_MSG_RESULT($was_it_defined)
560
Guido van Rossum300fda71996-08-19 21:58:16 +0000561# Add some code to confdefs.h so that the test for off_t works on SCO
562cat >> confdefs.h <<\EOF
563#if defined(SCO_DS)
564#undef _OFF_T
565#endif
566EOF
567
Guido van Rossumef2255b2000-03-10 22:30:29 +0000568# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000569AC_TYPE_MODE_T
570AC_TYPE_OFF_T
571AC_TYPE_PID_T
572AC_TYPE_SIGNAL
573AC_TYPE_SIZE_T
574AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000575
Guido van Rossumef2255b2000-03-10 22:30:29 +0000576# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000577AC_CHECK_SIZEOF(int)
578AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000579AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000580AC_CHECK_SIZEOF(char)
581AC_CHECK_SIZEOF(short)
582AC_CHECK_SIZEOF(float)
583AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000584AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000585
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000586AC_MSG_CHECKING(for long long support)
587have_long_long=no
588AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
589AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000590if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000591AC_CHECK_SIZEOF(long long)
592fi
593
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000594AC_MSG_CHECKING(for uintptr_t support)
595have_uintptr_t=no
596AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
597AC_MSG_RESULT($have_uintptr_t)
598if test "$have_uintptr_t" = yes ; then
599AC_CHECK_SIZEOF(uintptr_t)
600fi
601
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000602# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
603AC_MSG_CHECKING(size of off_t)
604AC_CACHE_VAL(ac_cv_sizeof_off_t,
605[AC_TRY_RUN([#include <stdio.h>
606#include <sys/types.h>
607main()
608{
609 FILE *f=fopen("conftestval", "w");
610 if (!f) exit(1);
611 fprintf(f, "%d\n", sizeof(off_t));
612 exit(0);
613}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
614])
615AC_MSG_RESULT($ac_cv_sizeof_off_t)
616AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
617
618AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000619if test "$have_long_long" = yes -a \
620 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
621 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000622 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
623 AC_MSG_RESULT(yes)
624else
625 AC_MSG_RESULT(no)
626fi
627
Fred Drakea3f6e912000-06-29 20:44:47 +0000628# AC_CHECK_SIZEOF() doesn't include <time.h>.
629AC_MSG_CHECKING(size of time_t)
630AC_CACHE_VAL(ac_cv_sizeof_time_t,
631[AC_TRY_RUN([#include <stdio.h>
632#include <time.h>
633main()
634{
635 FILE *f=fopen("conftestval", "w");
636 if (!f) exit(1);
637 fprintf(f, "%d\n", sizeof(time_t));
638 exit(0);
639}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
640])
641AC_MSG_RESULT($ac_cv_sizeof_time_t)
642AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
643
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000644
Trent Mick635f6fb2000-08-23 21:33:05 +0000645# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000646ac_save_cc="$CC"
647if test "$ac_cv_kpthread" = "yes"
648then CC="$CC -Kpthread"
649fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000650AC_MSG_CHECKING(for pthread_t)
651have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000652AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000653AC_MSG_RESULT($have_pthread_t)
654if test "$have_pthread_t" = yes ; then
655 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
656 AC_MSG_CHECKING(size of pthread_t)
657 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
658 [AC_TRY_RUN([#include <stdio.h>
659 #include <pthread.h>
660 main()
661 {
662 FILE *f=fopen("conftestval", "w");
663 if (!f) exit(1);
664 fprintf(f, "%d\n", sizeof(pthread_t));
665 exit(0);
666 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
667 ])
668 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
669 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
670fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000671CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000672
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000673# Minor variations in building a framework between NextStep versions 4 and 5
674AC_SUBST(LIBTOOL_CRUFT)
675case $ac_sys_system/$ac_sys_release in
Guido van Rossum5839e582000-10-09 19:52:35 +0000676 Darwin/*)
677 ns_undef_sym='_environ'
678 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000679 next/4*)
680 ns_undef_sym='__environ'
681 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
682 next/5*)
683 ns_undef_sym='_environ'
684 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
685esac
686
687AC_MSG_CHECKING(for --with-next-framework)
688if test "$with_next_framework"
689then
690 OPT="$OPT -fno-common"
691 # -U __environ is needed since bundles don't have access
692 # to crt0 when built but will always be linked against it
693 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
694 AC_DEFINE(WITH_NEXT_FRAMEWORK)
695 AC_MSG_RESULT(yes)
696else
697 AC_MSG_RESULT(no)
698fi
699
700AC_MSG_CHECKING(for --with-dyld)
701if test "$with_next_framework" -o "$with_dyld"
702then
703 if test "$with_dyld"
704 then
705 AC_MSG_RESULT(yes)
706 else
707 AC_MSG_RESULT(required for framework build)
708 fi
709 AC_DEFINE(WITH_DYLD)
710 ns_dyld='set'
711else
712 AC_MSG_RESULT(no)
713fi
714
Guido van Rossumac405f61994-09-12 10:56:06 +0000715# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000716AC_SUBST(SO)
717AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000718AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000719AC_SUBST(CCSHARED)
720AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000721# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000722# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000723AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000724if test -z "$SO"
725then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000726 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000727 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000728 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000729 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000730 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000731fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000732AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000733# LDSHARED is the ld *command* used to create shared library
734# -- "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 +0000735# (Shared libraries in this instance are shared modules to be loaded into
736# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000737AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000738if test -z "$LDSHARED"
739then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000740 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000741 AIX*)
742 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
743 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
744 ;;
745 BeOS*)
746 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
747 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
748 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000749 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000750 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000751 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a662000-05-26 12:22:54 +0000752 SunOS/5*)
753 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000754 then LDSHARED='$(CC) -shared'
Greg Ward57c9a662000-05-26 12:22:54 +0000755 else LDSHARED="ld -G";
756 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000757 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000758 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000759 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000760 Darwin/*|next/*)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000761 if test "$ns_dyld"
Guido van Rossumacb14c72001-01-10 21:41:16 +0000762 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000763 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
764 fi
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000765 if test "$with_next_framework" ; then
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000766 LDSHARED="$LDSHARED \$(LDLIBRARY)"
767 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000768 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000769 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000770 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000771 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000772 NetBSD*)
773 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
774 then
775 LDSHARED="cc -shared"
776 else
777 LDSHARED="ld -Bshareable"
778 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000779 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000780 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000781 then
782 LDSHARED="cc -shared ${LDFLAGS}"
783 else
784 LDSHARED="ld -Bshareable ${LDFLAGS}"
785 fi;;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000786 UnixWare*)
787 if test "$GCC" = "yes"
788 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000789 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000790 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000791 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000792 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000793 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000794 *) LDSHARED="ld";;
795 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000796fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000797AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000798BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000799# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000800# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000801AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000802if test -z "$CCSHARED"
803then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000804 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000805 SunOS*) if test "$GCC" = yes;
806 then CCSHARED="-fPIC";
807 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000808 hp*|HP*) if test "$GCC" = yes;
809 then CCSHARED="-fpic";
810 else CCSHARED="+z";
811 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000812 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000813 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000814 OpenBSD*) CCSHARED="-fpic";;
815 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000816 UnixWare*)
817 if test "$GCC" = "yes"
818 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000819 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000820 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000821 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000822 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000823 IRIX*/6*) case $CC in
824 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000825 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000826 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000827 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000828 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000829fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000830AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000831# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000832# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000833AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000834if test -z "$LINKFORSHARED"
835then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000836 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000837 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000838 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000839 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000840 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000841 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000842 # -u libsys_s pulls in all symbols in libsys
843 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
844 # -u __dummy makes the linker aware of the objc runtime
845 # in System.framework; otherwise, __objcInit (referenced in
846 # crt1.o) gets erroneously defined as common, which breaks dynamic
847 # loading of any modules which reference it in System.framework
848 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Jack Jansenc49e5b72001-06-19 15:00:23 +0000849 Darwin/*) LINKFORSHARED="-u __dummy -u _PyMac_Error -framework System -framework Foundation -framework Carbon" ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000850 UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000851 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000852 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000853 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000854 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
855 then
856 LINKFORSHARED="-Wl,--export-dynamic"
857 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000858 SunOS/5*) case $CC in
859 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000860 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000861 then
862 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000863 fi;;
864 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000865 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000866fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000867AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000868
Neil Schemenauer61c51152001-01-26 16:18:16 +0000869AC_SUBST(CFLAGSFORSHARED)
870AC_MSG_CHECKING(CFLAGSFORSHARED)
871if test ! "$LIBRARY" = "$LDLIBRARY"
872then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000873 case $ac_sys_system in
874 CYGWIN*)
875 # Cygwin needs CCSHARED when building extension DLLs
876 # but not when building the interpreter DLL.
877 CFLAGSFORSHARED='';;
878 *)
879 CFLAGSFORSHARED='$(CCSHARED)'
880 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000881fi
882AC_MSG_RESULT($CFLAGSFORSHARED)
883
Guido van Rossum627b2d71993-12-24 10:39:16 +0000884# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000885AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
886AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000887
888# checks for system dependent C++ extensions support
889case "$ac_sys_system" in
890 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
891 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
892 [loadAndInit("", 0, "")],
893 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
894 AC_MSG_RESULT(yes)],
895 [AC_MSG_RESULT(no)]);;
896 *) ;;
897esac
898
Guido van Rossum70c7f481998-03-26 18:44:10 +0000899# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
900# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000901# BeOS' sockets are stashed in libnet.
902case "$ac_sys_system" in
903IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000904*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000905AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000906AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000907;;
908esac
909case "$ac_sys_system" in
910BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000911AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
912;;
913esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000914
Guido van Rossumc5a39031996-07-31 17:35:03 +0000915AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000916AC_ARG_WITH(libs,
917[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000918AC_MSG_RESULT($withval)
919LIBS="$withval $LIBS"
920], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000921
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000922# Determine if signalmodule should be used.
923AC_SUBST(USE_SIGNAL_MODULE)
924AC_SUBST(SIGNAL_OBJS)
925AC_MSG_CHECKING(for --with-signal-module)
926AC_ARG_WITH(signal-module,
927[ --with-signal-module disable/enable signal module])
928
929if test -z "$with_signal_module"
930then with_signal_module="yes"
931fi
932AC_MSG_RESULT($with_signal_module)
933
934if test "${with_signal_module}" = "yes"; then
935 USE_SIGNAL_MODULE=""
936 SIGNAL_OBJS=""
937else
938 USE_SIGNAL_MODULE="#"
939 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
940fi
941
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000942# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000943AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000944USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000945
Guido van Rossum54d93d41997-01-22 20:51:58 +0000946AC_MSG_CHECKING(for --with-dec-threads)
947AC_SUBST(LDLAST)
948AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d82000-06-29 16:12:00 +0000949[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
950AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000951LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000952if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000953 with_thread="$withval";
954fi],
955AC_MSG_RESULT(no))
956
957AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000958AC_ARG_WITH(threads,
959[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000960
Barry Warsawc0d24d82000-06-29 16:12:00 +0000961# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000962AC_ARG_WITH(thread,
963[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
964with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +0000965
966if test -z "$with_threads"
967then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000968fi
Barry Warsawc0d24d82000-06-29 16:12:00 +0000969AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000970
Barry Warsawc0d24d82000-06-29 16:12:00 +0000971if test "$with_threads" = "no"
972then
973 USE_THREAD_MODULE="#"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000974elif test "$ac_cv_kpthread" = "yes"
975then
976 CC="$CC -Kpthread"
977 AC_DEFINE(WITH_THREAD)
978 AC_DEFINE(_POSIX_THREADS)
979 LIBOBJS="$LIBOBJS thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +0000980else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000981 if test ! -z "$with_threads" -a -d "$with_threads"
982 then LDFLAGS="$LDFLAGS -L$with_threads"
983 fi
984 if test ! -z "$withval" -a -d "$withval"
985 then LDFLAGS="$LDFLAGS -L$withval"
986 fi
987 AC_DEFINE(_REENTRANT)
988 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
989 AC_DEFINE(C_THREADS)
990 LIBOBJS="$LIBOBJS thread.o"],[
991 AC_MSG_CHECKING(for --with-pth)
992 AC_ARG_WITH(pth,
993 [ --with-pth use GNU pth threading libraries], [
994 AC_MSG_RESULT($withval)
995 AC_DEFINE(WITH_THREAD)
996 AC_DEFINE(HAVE_PTH)
997 LIBS="-lpth $LIBS"
998 LIBOBJS="$LIBOBJS thread.o"],[
999 AC_MSG_RESULT(no)
1000 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
1001 AC_DEFINE(_POSIX_THREADS)
1002 LIBS="-lpthread $LIBS"
1003 LIBOBJS="$LIBOBJS thread.o"],[
1004 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1005 case $ac_sys_system in
1006 Darwin*) ;;
1007 *) AC_DEFINE(_POSIX_THREADS);;
1008 esac
1009 LIBOBJS="$LIBOBJS thread.o"],[
1010 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1011 AC_DEFINE(BEOS_THREADS)
1012 LIBOBJS="$LIBOBJS thread.o"],[
1013 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1014 AC_DEFINE(_POSIX_THREADS)
1015 LIBS="$LIBS -lpthreads"
1016 LIBOBJS="$LIBOBJS thread.o"], [
1017 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1018 AC_DEFINE(_POSIX_THREADS)
1019 LIBS="$LIBS -lc_r"
1020 LIBOBJS="$LIBOBJS thread.o"], [
1021 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
1022 AC_DEFINE(_POSIX_THREADS)
1023 LIBS="$LIBS -lthread"
1024 LIBOBJS="$LIBOBJS thread.o"], [
1025 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1026 AC_DEFINE(_POSIX_THREADS)
1027 LIBS="$LIBS -lpthread"
1028 LIBOBJS="$LIBOBJS thread.o"], [
1029 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1030 AC_DEFINE(_POSIX_THREADS)
1031 LIBS="$LIBS -lcma"
1032 LIBOBJS="$LIBOBJS thread.o"],[
1033 USE_THREAD_MODULE="#"])
1034 ])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00001035
Martin v. Löwis130fb172001-07-19 11:00:41 +00001036 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1037 LIBS="$LIBS -lmpc"
1038 LIBOBJS="$LIBOBJS thread.o"
1039 USE_THREAD_MODULE=""])
1040 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1041 LIBS="$LIBS -lthread"
1042 LIBOBJS="$LIBOBJS thread.o"
1043 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001044
Martin v. Löwis130fb172001-07-19 11:00:41 +00001045 if test "$USE_THREAD_MODULE" != "#"
1046 then
1047 # If the above checks didn't disable threads, (at least) OSF1
1048 # needs this '-threads' argument during linking.
1049 case $ac_sys_system in
1050 OSF1) LDLAST=-threads;;
1051 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001052 fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00001053fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001054
Barry Warsawef82cd72000-06-30 16:21:01 +00001055# Check for GC support
1056AC_SUBST(USE_GC_MODULE)
1057USE_GC_MODULE=""
1058AC_MSG_CHECKING(for --with-cycle-gc)
1059AC_ARG_WITH(cycle-gc,
1060[ --with(out)-cycle-gc disable/enable garbage collection])
1061
1062if test -z "$with_cycle_gc"
1063then with_cycle_gc="yes"
1064fi
1065if test "$with_cycle_gc" = "no"
1066then
1067 USE_GC_MODULE="#"
1068else
1069 AC_DEFINE(WITH_CYCLE_GC)
1070fi
1071AC_MSG_RESULT($with_cycle_gc)
1072
Neil Schemenauera35c6882001-02-27 04:45:05 +00001073# Check for Python-specific malloc support
1074AC_MSG_CHECKING(for --with-pymalloc)
1075AC_ARG_WITH(pymalloc,
1076[ --with(out)-pymalloc disable/enable specialized mallocs], [
1077if test "$withval" != no
1078then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1079else AC_MSG_RESULT(no)
1080fi],
1081[AC_MSG_RESULT(no)])
1082
Barry Warsawef82cd72000-06-30 16:21:01 +00001083# Check for --with-wctype-functions
1084AC_MSG_CHECKING(for --with-wctype-functions)
1085AC_ARG_WITH(wctype-functions,
1086[ --with-wctype-functions use wctype.h functions], [
1087if test "$withval" != no
1088then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1089else AC_MSG_RESULT(no)
1090fi],
1091[AC_MSG_RESULT(no)])
1092
Guido van Rossum68242b51996-05-28 22:53:03 +00001093# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001094AC_SUBST(DLINCLDIR)
1095DLINCLDIR=/
1096
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001097AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001098AC_ARG_WITH(sgi-dl,
1099[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001100AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001101AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +00001102DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001103dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001104if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001105then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001106else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1107fi
1108DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001109LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001110
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001111AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001112AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001113AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001114AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001115DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001116dldir=`echo "$withval" | sed 's/,.*//'`
1117dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001118if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001119then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001120else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1121fi
1122DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001123LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001124
Guido van Rossume97ee181999-12-20 21:27:22 +00001125# the dlopen() function means we might want to use dynload_shlib.o. some
1126# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001127AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001128
1129# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1130# loading of modules.
1131AC_SUBST(DYNLOADFILE)
1132AC_MSG_CHECKING(DYNLOADFILE)
1133if test -z "$DYNLOADFILE"
1134then
1135 case $ac_sys_system/$ac_sys_release in
1136 AIX*) DYNLOADFILE="dynload_aix.o";;
1137 BeOS*) DYNLOADFILE="dynload_beos.o";;
1138 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Guido van Rossum5839e582000-10-09 19:52:35 +00001139 Darwin/*|next/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001140 *)
1141 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1142 # out any dynamic loading
1143 if test "$ac_cv_func_dlopen" = yes
1144 then DYNLOADFILE="dynload_shlib.o"
1145 else DYNLOADFILE="dynload_stub.o"
1146 fi
1147 ;;
1148 esac
1149fi
1150AC_MSG_RESULT($DYNLOADFILE)
1151if test "$DYNLOADFILE" != "dynload_stub.o"
1152then
1153 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1154fi
1155
Jack Jansenc49e5b72001-06-19 15:00:23 +00001156# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1157
1158AC_SUBST(MACHDEP_OBJS)
1159AC_MSG_CHECKING(MACHDEP_OBJS)
1160if test -z "$MACHDEP_OBJS"
1161then
1162 case $ac_sys_system/$ac_sys_release in
1163 Darwin/*)
1164 MACHDEP_OBJS="Mac/Python/macglue.o"
1165 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
1166 ;;
1167 *) MACHDEP_OBJS="";;
1168 esac
1169fi
1170AC_MSG_RESULT($DYNLOADFILE)
1171
Guido van Rossum627b2d71993-12-24 10:39:16 +00001172# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001173AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001174 flock fork fsync fdatasync fpathconf ftime ftruncate \
Andrew M. Kuchlinga9586c72001-01-08 17:58:56 +00001175 getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwisb9ab1592001-06-24 21:18:26 +00001176 inet_pton kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001177 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001178 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001179 select setegid seteuid setgid \
Martin v. Löwis791bfda2001-07-24 06:33:08 +00001180 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
Fred Drake35a092f1999-12-13 16:23:35 +00001181 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001182 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Woutersc2c12dc2001-07-11 14:45:34 +00001183 truncate uname waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001184
Fred Drake8cef4cf2000-06-28 16:40:38 +00001185# check for openpty and forkpty
1186
1187AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1188AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1189
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001190# check for long file support functions
1191AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1192
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001193AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001194AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1195AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1196AC_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 +00001197
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001198AC_CHECK_FUNCS(getaddrinfo, [dnl
1199AC_MSG_CHECKING(getaddrinfo bug)
1200AC_TRY_RUN([
1201#include <sys/types.h>
1202#include <netdb.h>
1203#include <string.h>
1204#include <sys/socket.h>
1205#include <netinet/in.h>
1206
1207main()
1208{
1209 int passive, gaierr, inet4 = 0, inet6 = 0;
1210 struct addrinfo hints, *ai, *aitop;
1211 char straddr[INET6_ADDRSTRLEN], strport[16];
1212
1213 for (passive = 0; passive <= 1; passive++) {
1214 memset(&hints, 0, sizeof(hints));
1215 hints.ai_family = AF_UNSPEC;
1216 hints.ai_flags = passive ? AI_PASSIVE : 0;
1217 hints.ai_socktype = SOCK_STREAM;
1218 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1219 (void)gai_strerror(gaierr);
1220 goto bad;
1221 }
1222 for (ai = aitop; ai; ai = ai->ai_next) {
1223 if (ai->ai_addr == NULL ||
1224 ai->ai_addrlen == 0 ||
1225 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1226 straddr, sizeof(straddr), strport, sizeof(strport),
1227 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1228 goto bad;
1229 }
1230 switch (ai->ai_family) {
1231 case AF_INET:
1232 if (strcmp(strport, "54321") != 0) {
1233 goto bad;
1234 }
1235 if (passive) {
1236 if (strcmp(straddr, "0.0.0.0") != 0) {
1237 goto bad;
1238 }
1239 } else {
1240 if (strcmp(straddr, "127.0.0.1") != 0) {
1241 goto bad;
1242 }
1243 }
1244 inet4++;
1245 break;
1246 case AF_INET6:
1247 if (strcmp(strport, "54321") != 0) {
1248 goto bad;
1249 }
1250 if (passive) {
1251 if (strcmp(straddr, "::") != 0) {
1252 goto bad;
1253 }
1254 } else {
1255 if (strcmp(straddr, "::1") != 0) {
1256 goto bad;
1257 }
1258 }
1259 inet6++;
1260 break;
1261 case AF_UNSPEC:
1262 goto bad;
1263 break;
1264 default:
1265 /* another family support? */
1266 break;
1267 }
1268 }
1269 }
1270
1271 if (!(inet4 == 0 || inet4 == 2))
1272 goto bad;
1273 if (!(inet6 == 0 || inet6 == 2))
1274 goto bad;
1275
1276 if (aitop)
1277 freeaddrinfo(aitop);
1278 exit(0);
1279
1280 bad:
1281 if (aitop)
1282 freeaddrinfo(aitop);
1283 exit(1);
1284}
1285],
1286AC_MSG_RESULT(good)
1287buggygetaddrinfo=no,
1288AC_MSG_RESULT(buggy)
1289buggygetaddrinfo=yes,
1290AC_MSG_RESULT(buggy)
1291buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
1292
1293if test "$buggygetaddrinfo" = "yes"; then
1294 if test "$ipv6" = "yes"; then
1295 echo 'Fatal: You must get working getaddrinfo() function.'
1296 echo ' or you can specify "--disable-ipv6"'.
1297 exit 1
1298 fi
1299fi
1300AC_CHECK_FUNCS(getaddrinfo getnameinfo)
1301
Guido van Rossum627b2d71993-12-24 10:39:16 +00001302# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001303AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001304AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001305AC_STRUCT_TIMEZONE
1306
1307AC_MSG_CHECKING(for time.h that defines altzone)
1308AC_CACHE_VAL(ac_cv_header_time_altzone,
1309[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1310 ac_cv_header_time_altzone=yes,
1311 ac_cv_header_time_altzone=no)])
1312AC_MSG_RESULT($ac_cv_header_time_altzone)
1313if test $ac_cv_header_time_altzone = yes; then
1314 AC_DEFINE(HAVE_ALTZONE)
1315fi
1316
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001317was_it_defined=no
1318AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001319AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001320#include <sys/types.h>
1321#include <sys/select.h>
1322#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001323], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1324AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001325
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001326AC_MSG_CHECKING(for addrinfo)
1327AC_CACHE_VAL(ac_cv_struct_addrinfo,
1328AC_TRY_COMPILE([
1329# include <netdb.h>],
1330 [struct addrinfo a],
1331 ac_cv_struct_addrinfo=yes,
1332 ac_cv_struct_addrinfo=no))
1333AC_MSG_RESULT($ac_cv_struct_addrinfo)
1334if test $ac_cv_struct_addrinfo = yes; then
1335 AC_DEFINE(HAVE_ADDRINFO)
1336fi
1337
1338AC_MSG_CHECKING(for sockaddr_storage)
1339AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1340AC_TRY_COMPILE([
1341# include <sys/types.h>
1342# include <sys/socket.h>],
1343 [struct sockaddr_storage s],
1344 ac_cv_struct_sockaddr_storage=yes,
1345 ac_cv_struct_sockaddr_storage=no))
1346AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1347if test $ac_cv_struct_sockaddr_storage = yes; then
1348 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1349fi
1350
Guido van Rossum627b2d71993-12-24 10:39:16 +00001351# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001352
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001353AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001354AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001355
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001356works=no
1357AC_MSG_CHECKING(for working volatile)
1358AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1359AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001360
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001361works=no
1362AC_MSG_CHECKING(for working signed char)
1363AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1364AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001365
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001366have_prototypes=no
1367AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001368AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1369AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001370AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001371
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001372works=no
1373AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001374AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001375#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001376int foo(int x, ...) {
1377 va_list va;
1378 va_start(va, x);
1379 va_arg(va, int);
1380 va_arg(va, char *);
1381 va_arg(va, double);
1382 return 0;
1383}
1384], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001385AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1386AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001387
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001388if test "$have_prototypes" = yes; then
1389bad_prototypes=no
1390AC_MSG_CHECKING(for bad exec* prototypes)
1391AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1392 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1393AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001394fi
1395
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001396# check if sockaddr has sa_len member
1397AC_MSG_CHECKING(if sockaddr has sa_len member)
1398AC_TRY_COMPILE([#include <sys/types.h>
1399#include <sys/socket.h>],
1400[struct sockaddr x;
1401x.sa_len = 0;],
1402 AC_MSG_RESULT(yes)
1403 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1404 AC_MSG_RESULT(no))
1405
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001406bad_forward=no
1407AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001408AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001409struct s { int a; int b; };
1410static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001411int foobar() {
1412 static int random;
1413 random = (int) &foo;
1414 return random;
1415}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001416static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001417main() {
1418 exit(!((int)&foo == foobar()));
1419}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001420], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
1421AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001422
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001423va_list_is_array=no
1424AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001425AC_TRY_COMPILE([
1426#ifdef HAVE_STDARG_PROTOTYPES
1427#include <stdarg.h>
1428#else
1429#include <varargs.h>
1430#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001431], [va_list list1, list2; list1 = list2;], ,
1432AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1433AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001434
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001435# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1436AC_CHECK_FUNC(gethostbyname_r, [
1437 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1438 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1439 OLD_CFLAGS=$CFLAGS
1440 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1441 AC_TRY_COMPILE([
1442# include <netdb.h>
1443 ], [
1444 char *name;
1445 struct hostent *he, *res;
1446 char buffer[2048];
1447 int buflen = 2048;
1448 int h_errnop;
1449
1450 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1451 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001452 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001453 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1454 AC_MSG_RESULT(yes)
1455 ], [
1456 AC_MSG_RESULT(no)
1457 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1458 AC_TRY_COMPILE([
1459# include <netdb.h>
1460 ], [
1461 char *name;
1462 struct hostent *he;
1463 char buffer[2048];
1464 int buflen = 2048;
1465 int h_errnop;
1466
1467 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1468 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001469 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001470 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1471 AC_MSG_RESULT(yes)
1472 ], [
1473 AC_MSG_RESULT(no)
1474 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1475 AC_TRY_COMPILE([
1476# include <netdb.h>
1477 ], [
1478 char *name;
1479 struct hostent *he;
1480 struct hostent_data data;
1481
1482 (void) gethostbyname_r(name, he, &data);
1483 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001484 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001485 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1486 AC_MSG_RESULT(yes)
1487 ], [
1488 AC_MSG_RESULT(no)
1489 ])
1490 ])
1491 ])
1492 CFLAGS=$OLD_CFLAGS
1493], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001494 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001495])
1496AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1497AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1498AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001499AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001500AC_SUBST(HAVE_GETHOSTBYNAME)
1501
Guido van Rossum627b2d71993-12-24 10:39:16 +00001502# checks for system services
1503# (none yet)
1504
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001505# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001506AC_CHECK_FUNC(__fpu_control,
1507 [],
1508 [AC_CHECK_LIB(ieee, __fpu_control)
1509])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001510
Guido van Rossum93274221997-05-09 02:42:00 +00001511# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001512AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001513AC_ARG_WITH(fpectl,
1514[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001515if test "$withval" != no
1516then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1517else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001518fi],
1519[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001520
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001521# check for --with-libm=...
1522AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001523case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001524Darwin) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001525next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001526BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001527*) LIBM=-lm
1528esac
Guido van Rossum93274221997-05-09 02:42:00 +00001529AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001530AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001531if test "$withval" = no
1532then LIBM=
1533 AC_MSG_RESULT(force LIBM empty)
1534elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001535then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001536 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001537else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001538fi],
1539[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001540
1541# check for --with-libc=...
1542AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001543AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001544AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001545if test "$withval" = no
1546then LIBC=
1547 AC_MSG_RESULT(force LIBC empty)
1548elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001549then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001550 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001551else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001552fi],
1553[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001554
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001555# check for hypot() in math library
1556LIBS_SAVE=$LIBS
1557LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001558AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001559LIBS=$LIBS_SAVE
1560
Guido van Rossumad713701997-07-10 22:42:38 +00001561# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001562AC_MSG_CHECKING(what malloc(0) returns)
1563AC_CACHE_VAL(ac_cv_malloc_zero,
1564[AC_TRY_RUN([#include <stdio.h>
1565#ifdef HAVE_STDLIB
1566#include <stdlib.h>
1567#else
1568char *malloc(), *realloc();
1569int *free();
1570#endif
1571main() {
1572 char *p;
1573 p = malloc(0);
1574 if (p == NULL) exit(1);
1575 p = realloc(p, 0);
1576 if (p == NULL) exit(1);
1577 free(p);
1578 exit(0);
1579}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1580AC_MSG_RESULT($ac_cv_malloc_zero)
1581if test "$ac_cv_malloc_zero" = null
1582then
1583 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1584fi
1585
Guido van Rossumef2255b2000-03-10 22:30:29 +00001586# check for wchar.h
1587AC_CHECK_HEADER(wchar.h,
1588AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1589wchar_h="no"
1590)
1591
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001592# determine wchar_t size
1593if test "$wchar_h" = yes
1594then
1595 AC_CHECK_SIZEOF(wchar_t)
1596fi
1597
1598AC_MSG_CHECKING(what type to use for unicode)
1599AC_ARG_ENABLE(unicode,
1600[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1601
1602if test $enable_unicode = yes
1603then
Martin v. Löwisfd917792001-06-27 20:22:04 +00001604 # Without any arguments, Py_UNICODE defaults to two-byte mode
1605 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001606fi
1607
1608case "$enable_unicode" in
1609ucs2) unicode_size="2"
1610 AC_DEFINE(Py_UNICODE_SIZE,2)
1611 ;;
1612ucs4) unicode_size="4"
1613 AC_DEFINE(Py_UNICODE_SIZE,4)
1614 ;;
1615esac
1616
1617if test "$enable_unicode" = "no"
1618then
1619 AC_MSG_RESULT(not used)
1620else
1621 AC_DEFINE(Py_USING_UNICODE)
1622 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1623 then
1624 PY_UNICODE_TYPE="wchar_t"
1625 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1626 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1627 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1628 then
1629 PY_UNICODE_TYPE="unsigned short"
1630 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1631 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1632 then
1633 PY_UNICODE_TYPE="unsigned long"
1634 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1635 else
1636 PY_UNICODE_TYPE="no type found"
1637 fi
1638 AC_MSG_RESULT($PY_UNICODE_TYPE)
1639fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00001640
1641# check for endianness
1642AC_C_BIGENDIAN
1643
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001644# Check whether right shifting a negative integer extends the sign bit
1645# or fills with zeros (like the Cray J90, according to Tim Peters).
1646AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001647AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001648AC_TRY_RUN([
1649int main()
1650{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001651 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001652}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001653], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1654AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1655if test "$ac_cv_rshift_extends_sign" = no
1656then
1657 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1658fi
1659
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001660# check for getc_unlocked and related locking functions
1661AC_MSG_CHECKING(for getc_unlocked() and friends)
1662AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1663AC_TRY_LINK([#include <stdio.h>],[
1664 FILE *f = fopen("/dev/null", "r");
1665 flockfile(f);
1666 getc_unlocked(f);
1667 funlockfile(f);
1668], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1669AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1670if test "$ac_cv_have_getc_unlocked" = yes
1671then
1672 AC_DEFINE(HAVE_GETC_UNLOCKED)
1673fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001674
Guido van Rossum353ae582001-07-10 16:45:32 +00001675# check for readline 4.2
1676AC_CHECK_LIB(readline, rl_completion_matches,
1677 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1678
Thomas Wouterse38b2f12001-07-11 22:35:31 +00001679AC_MSG_CHECKING(for broken nice())
1680AC_CACHE_VAL(ac_cv_broken_nice, [
1681AC_TRY_RUN([
1682int main()
1683{
1684 int val1 = nice(1);
1685 if (val1 != -1 && val1 == nice(2))
1686 exit(0);
1687 exit(1);
1688}
1689],ac_cv_broken_nice=yes, ac_cv_broken_nice=no)])
1690AC_MSG_RESULT($ac_cv_broken_nice)
1691if test "$ac_cv_broken_nice" = yes
1692then
1693 AC_DEFINE(HAVE_BROKEN_NICE)
1694fi
1695
Guido van Rossum95713eb2000-05-18 20:53:31 +00001696# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1697# Add sys/socket.h to confdefs.h
1698cat >> confdefs.h <<\EOF
1699#ifdef HAVE_SYS_SOCKET_H
1700#include <sys/socket.h>
1701#endif
1702EOF
1703AC_CHECK_TYPE(socklen_t, int)
1704
Neil Schemenauerf25cf6c2001-03-04 06:39:33 +00001705# Add Python/ prefix to LIBOBJS
1706libobjs=$LIBOBJS
1707LIBOBJS=
1708for obj in $libobjs; do
1709 LIBOBJS="$LIBOBJS Python/$obj"
1710done
1711
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001712#AC_MSG_CHECKING(for Modules/Setup)
1713#if test ! -f Modules/Setup ; then
1714# if test ! -d Modules ; then
1715# mkdir Modules
1716# fi
1717# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1718# AC_MSG_RESULT(creating)
1719#else
1720# AC_MSG_RESULT(already exists)
1721#fi
1722
1723AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00001724SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001725AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001726for dir in $SRCDIRS; do
1727 if test ! -d $dir; then
1728 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001729 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001730done
1731AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001732
Guido van Rossum627b2d71993-12-24 10:39:16 +00001733# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001734AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001735
1736echo "creating Setup"
1737if test ! -f Modules/Setup
1738then
1739 cp $srcdir/Modules/Setup.dist Modules/Setup
1740fi
1741
1742echo "creating Setup.local"
1743if test ! -f Modules/Setup.local
1744then
1745 echo "# Edit this file for local setup changes" >Modules/Setup.local
1746fi
1747
1748echo "creating Makefile"
1749$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1750 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00001751 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00001752mv config.c Modules