blob: c6b7a5500e634a9eac6f7ad0047f8ed4c4430c24 [file] [log] [blame]
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001dnl Process this file with autoconf 2.0 or later to make a configure script.
2AC_REVISION($Revision$)
3AC_PREREQ(2.0)
Guido van Rossum6085e321993-12-26 18:24:40 +00004AC_INIT(Include/object.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00005AC_CONFIG_HEADER(config.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +00006
Guido van Rossum642b6781997-07-19 19:35:41 +00007# Set VERSION so we only need to edit in one place (i.e., here)
8AC_SUBST(VERSION)
Guido van Rossum6db412b2001-04-18 04:37:57 +00009VERSION=2.2
Guido van Rossum642b6781997-07-19 19:35:41 +000010
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +000011# Arguments passed to configure.
12AC_SUBST(CONFIG_ARGS)
13CONFIG_ARGS="$ac_configure_args"
14
Guido van Rossum3dc0a512000-10-05 18:00:06 +000015# NEXTSTEP|MacOSX|Darwin stuff
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000016if test -f /usr/lib/NextStep/software_version -o -f /System/Library/CoreServices/software_version ; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000017
18 AC_MSG_CHECKING(for --with-next-archs)
19 AC_ARG_WITH(next-archs,
Barry 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`
Guido van Rossum2242f2f2001-04-11 20:58:20 +000055 if test "$ac_sys_system" = "AIX" -o \
56 "$ac_sys_system" = "Monterey64" -o \
57 "$ac_sys_system" = "UnixWare"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000058 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000059 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000060 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000061 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000062 ac_md_system=`echo $ac_sys_system |
63 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
64 ac_md_release=`echo $ac_sys_release |
65 tr -d '[/ ]' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000066 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000067
Guido van Rossumbcd91e01997-03-20 20:46:29 +000068 case $MACHDEP in
Guido van Rossumb97ef171997-09-28 05:44:03 +000069 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000070 esac
71fi
Guido van Rossum91922671997-10-09 20:24:13 +000072
73#
74# SGI compilers allow the specification of the both the ABI and the
75# ISA on the command line. Depending on the values of these switches,
76# different and often incompatable code will be generated.
77#
78# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
79# thus supply support for various ABI/ISA combinations. The MACHDEP
80# variable is also adjusted.
81#
82AC_SUBST(SGI_ABI)
83if test ! -z "$SGI_ABI"
84then
85 CC="cc $SGI_ABI"
86 LDFLAGS="$SGI_ABI $LDFLAGS"
87 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
88fi
Guido van Rossumb418f891996-07-30 18:06:02 +000089AC_MSG_RESULT($MACHDEP)
90
Guido van Rossum627b2d71993-12-24 10:39:16 +000091# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000092AC_MSG_CHECKING(for --without-gcc)
Barry Warsawc0d24d82000-06-29 16:12:00 +000093AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000094 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000095 no) CC=cc
96 without_gcc=yes;;
97 yes) CC=gcc
98 without_gcc=no;;
99 *) CC=$withval
100 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000101 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000102 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +0000103 OSF1) CC=cc
104 without_gcc=;;
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000105 AIX*) CC=cc_r
106 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000107 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000108 case $BE_HOST_CPU in
109 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000110 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000111 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000112 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 +0000113 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000114 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000115 ;;
116 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000117 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000118 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000119 OPT=-O
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000120 ;;
121 *)
Fred Drake5790be12000-10-09 17:06:13 +0000122 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000123 ;;
124 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000125 AR="\$(srcdir)/Modules/ar_beos"
126 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000127 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000128 Monterey*)
129 RANLIB=:
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000130 without_gcc=
131 ;;
132 UnixWare*)
133 RANLIB=:
134 without_gcc=
135 ;;
136 *)
137 without_gcc=no
138 ;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000139 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000140AC_MSG_RESULT($without_gcc)
141
Guido van Rossum27552902001-01-23 01:52:26 +0000142AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000143AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000144MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000145AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000146AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000147 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000148 case $withval in
149 no) CXX=
150 with_cxx=no;;
151 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000152 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000153 with_cxx=$withval;;
154 esac], [
155 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000156 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000157])
158AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000159
160dnl The following fragment works similar to AC_PROG_CXX.
161dnl It does not fail if CXX is not found, and it is not executed if
162dnl --with-cxx was given.
163dnl Finally, it does not test whether CXX is g++.
164
165if test "$check_cxx" = "yes"
166then
167 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
168 if test "$CXX" = "notfound"
169 then
170 CXX=
171 else
172 AC_PROG_CXX_WORKS
173 fi
174fi
175
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000176# If the user switches compilers, we can't believe the cache
177if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
178then
179 AC_ERROR(cached CC is different -- throw away $cache_file
180(it is also a good idea to do 'make clean' before compiling))
181fi
182
Guido van Rossum627b2d71993-12-24 10:39:16 +0000183AC_PROG_CC
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000184AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000185AC_MSG_CHECKING(for --with-suffix)
186AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
187 case $withval in
188 no) EXEEXT=;;
189 yes) EXEEXT=.exe;;
190 *) EXEEXT=$withval;;
191 esac])
192AC_MSG_RESULT($EXEEXT)
Guido van Rossumfb842551997-08-06 23:42:07 +0000193
Guido van Rossumdd997f71998-10-07 19:58:26 +0000194case $MACHDEP in
195bsdos*)
196 case $CC in
197 gcc) CC="$CC -D_HAVE_BSDI";;
198 esac;;
199esac
200
Guido van Rossum84561611997-08-21 00:08:11 +0000201case $ac_sys_system in
202hp*|HP*)
203 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000204 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000205 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000206Monterey*)
207 case $CC in
208 cc) CC="$CC -Wl,-Bexport";;
209 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000210SunOS*)
211 # Some functions have a prototype only with that define, e.g. confstr
212 AC_DEFINE(__EXTENSIONS__)
213 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000214esac
215
Martin v. Löwise8964d42001-03-06 12:09:07 +0000216
Neil Schemenauer61c51152001-01-26 16:18:16 +0000217AC_SUBST(LIBRARY)
218AC_MSG_CHECKING(LIBRARY)
219if test -z "$LIBRARY"
220then
221 LIBRARY='libpython$(VERSION).a'
222fi
223AC_MSG_RESULT($LIBRARY)
224
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000225# LDLIBRARY is the name of the library to link against (as opposed to the
226# name of the library into which to insert object files). On systems
227# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
Guido van Rossumaef734b2001-01-10 21:09:12 +0000228# the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the
229# shared (i.e., DLL) library.
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000230AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000231AC_SUBST(DLLLIBRARY)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000232LDLIBRARY="$LIBRARY"
Guido van Rossum27552902001-01-23 01:52:26 +0000233DLLLIBRARY=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000234
Guido van Rossumfb842551997-08-06 23:42:07 +0000235# LINKCC is the command that links the python executable -- default is $(CC).
Fred Drake5790be12000-10-09 17:06:13 +0000236# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000237# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000238AC_SUBST(LINKCC)
239AC_MSG_CHECKING(LINKCC)
240if test -z "$LINKCC"
241then
242 case $ac_sys_system in
243 AIX*)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000244 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000245 dgux*)
246 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000247 Monterey64*)
248 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000249 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000250 esac
251fi
252AC_MSG_RESULT($LINKCC)
253
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000254AC_MSG_CHECKING(LDLIBRARY)
255
256# NeXT framework builds require that the 'ar' library be converted into
257# a bundle using libtool.
258if test "$with_next_framework"
259then
260 LDLIBRARY='libpython$(VERSION).dylib'
261fi
262
263# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000264case $MACHDEP in
265dguxR4)
266 LDLIBRARY='libpython$(VERSION).so'
267 OPT="$OPT -pic"
268 ;;
269beos*)
270 LDLIBRARY='libpython$(VERSION).so'
271 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000272cygwin*)
273 LDLIBRARY='libpython$(VERSION).dll.a'
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000274 DLLLIBRARY='libpython$(VERSION).dll'
Guido van Rossumaef734b2001-01-10 21:09:12 +0000275 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000276unixware*)
277 LDLIBRARY='libpython$(VERSION).so'
278 ;;
Fred Drake5790be12000-10-09 17:06:13 +0000279esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000280AC_MSG_RESULT($LDLIBRARY)
281
Guido van Rossum627b2d71993-12-24 10:39:16 +0000282AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000283AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000284AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000285
286case $MACHDEP in
287bsdos*)
288 # install -d does not work on BSDI
289 if test -z "$INSTALL"
290 then
291 INSTALL="${srcdir}/install-sh -c"
292 fi
293esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000294AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000295
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000296# Not every filesystem supports hard links
297AC_SUBST(LN)
298if test -z "$LN" ; then
299 case $ac_sys_system in
300 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000301 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000302 *) LN=ln;;
303 esac
304fi
305
Fred Drake9f715822001-07-11 06:27:00 +0000306# Check for --with-pydebug
307AC_MSG_CHECKING(for --with-pydebug)
308AC_ARG_WITH(pydebug,
309[ --with-pydebug build with Py_DEBUG defined], [
310if test "$withval" != no
311then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
312else AC_MSG_RESULT(no); Py_DEBUG='false'
313fi],
314[AC_MSG_RESULT(no)])
315
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000316# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000317AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000318if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000319then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000320 case $GCC in
321 yes)
322 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000323 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000324 if test "$Py_DEBUG" = 'true' ; then
325 # Optimization messes up debuggers, so turn it off for
326 # debug builds.
327 OPT="-g -Wall -Wstrict-prototypes"
328 else
329 OPT="-g -O3 -Wall -Wstrict-prototypes"
330 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000331 *)
Fred Drake9f715822001-07-11 06:27:00 +0000332 OPT="-O3 -Wall -Wstrict-prototypes";;
333 esac
334 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000335 *)
336 case $ac_sys_system in
337 UnixWare*)
338 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
339 *)
340 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000341 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000342 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000343fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000344
Trent Mick635f6fb2000-08-23 21:33:05 +0000345# The current (beta) Monterey compiler dies with optimizations
346case $ac_sys_system in
347Monterey*) OPT="";;
348esac
349
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000350if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000351then
352 OPT="$OPT $ac_arch_flags"
353fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000354# checks for UNIX variants that set C preprocessor variables
355AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000356AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000357
Guido van Rossum91922671997-10-09 20:24:13 +0000358AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
359AC_CACHE_VAL(ac_cv_opt_olimit_ok,
360[ac_save_cc="$CC"
361CC="$CC -OPT:Olimit=0"
362AC_TRY_RUN([int main() { return 0; }],
363 ac_cv_opt_olimit_ok=yes,
364 ac_cv_opt_olimit_ok=no)
365CC="$ac_save_cc"])
366AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000367if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000368 case $ac_sys_system in
369 Darwin*) OPT="$OPT" ;;
370 *) OPT="$OPT -OPT:Olimit=0";;
371 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000372else
373 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
374 AC_CACHE_VAL(ac_cv_olimit_ok,
375 [ac_save_cc="$CC"
376 CC="$CC -Olimit 1500"
377 AC_TRY_RUN([int main() { return 0; }],
378 ac_cv_olimit_ok=yes,
379 ac_cv_olimit_ok=no)
380 CC="$ac_save_cc"])
381 AC_MSG_RESULT($ac_cv_olimit_ok)
382 if test $ac_cv_olimit_ok = yes; then
383 OPT="$OPT -Olimit 1500"
384 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000385fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000386
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000387# Check for enable-ipv6
Martin v. Löwisb9268662001-07-18 16:24:30 +0000388# XXX definition of ss_family disabled until author clarifies rationale.
389# DEFS="$DEFS -Dss_family=__ss_family -Dss_len=__ss_len"
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000390AC_MSG_CHECKING([whether to enable ipv6])
391AC_ARG_ENABLE(ipv6,
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +0000392[ --enable-ipv6 Enable ipv6 (with ipv4) support
393 --disable-ipv6 Disable ipv6 support],
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000394[ case "$enableval" in
395 no)
396 AC_MSG_RESULT(no)
397 ipv6=no
398 ;;
399 *) AC_MSG_RESULT(yes)
400 AC_DEFINE(ENABLE_IPV6)
401 ipv6=yes
402 ;;
403 esac ],
404
Fred Drake9f715822001-07-11 06:27:00 +0000405 AC_TRY_RUN([ /* AF_INET6 available check */
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000406#include <sys/types.h>
407#include <sys/socket.h>
408main()
409{
410 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
411 exit(1);
412 else
413 exit(0);
414}
415],
416 AC_MSG_RESULT(yes)
417 AC_DEFINE(ENABLE_IPV6)
418 ipv6=yes,
419 AC_MSG_RESULT(no)
420 ipv6=no,
421 AC_MSG_RESULT(no)
422 ipv6=no
423))
424
425ipv6type=unknown
426ipv6lib=none
427ipv6trylibc=no
428
429if test "$ipv6" = "yes"; then
430 AC_MSG_CHECKING([ipv6 stack type])
431 for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do
432 case $i in
433 inria)
434 dnl http://www.kame.net/
435 AC_EGREP_CPP(yes, [dnl
436#include <netinet/in.h>
437#ifdef IPV6_INRIA_VERSION
438yes
439#endif],
440 [ipv6type=$i;
441 OPT="-DINET6 $OPT"])
442 ;;
443 kame)
444 dnl http://www.kame.net/
445 AC_EGREP_CPP(yes, [dnl
446#include <netinet/in.h>
447#ifdef __KAME__
448yes
449#endif],
450 [ipv6type=$i;
451 ipv6lib=inet6
452 ipv6libdir=/usr/local/v6/lib
453 ipv6trylibc=yes
454 OPT="-DINET6 $OPT"])
455 ;;
456 linux-glibc)
457 dnl http://www.v6.linux.or.jp/
458 AC_EGREP_CPP(yes, [dnl
459#include <features.h>
460#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
461yes
462#endif],
463 [ipv6type=$i;
464 ipv6trylibc=yes
465 OPT="-DINET6 $OPT"])
466 ;;
467 linux-inet6)
468 dnl http://www.v6.linux.or.jp/
469 if test -d /usr/inet6; then
470 ipv6type=$i
471 ipv6lib=inet6
472 ipv6libdir=/usr/inet6/lib
473 OPT="-DINET6 -I/usr/inet6/include $OPT"
474 fi
475 ;;
476 toshiba)
477 AC_EGREP_CPP(yes, [dnl
478#include <sys/param.h>
479#ifdef _TOSHIBA_INET6
480yes
481#endif],
482 [ipv6type=$i;
483 ipv6lib=inet6;
484 ipv6libdir=/usr/local/v6/lib;
485 OPT="-DINET6 $OPT"])
486 ;;
487 v6d)
488 AC_EGREP_CPP(yes, [dnl
489#include </usr/local/v6/include/sys/v6config.h>
490#ifdef __V6D__
491yes
492#endif],
493 [ipv6type=$i;
494 ipv6lib=v6;
495 ipv6libdir=/usr/local/v6/lib;
496 OPT="-I/usr/local/v6/include $OPT"])
497 ;;
498 zeta)
499 AC_EGREP_CPP(yes, [dnl
500#include <sys/param.h>
501#ifdef _ZETA_MINAMI_INET6
502yes
503#endif],
504 [ipv6type=$i;
505 ipv6lib=inet6;
506 ipv6libdir=/usr/local/v6/lib;
507 OPT="-DINET6 $OPT"])
508 ;;
509 esac
510 if test "$ipv6type" != "unknown"; then
511 break
512 fi
513 done
514 AC_MSG_RESULT($ipv6type)
515fi
516
517if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
518 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
519 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
520 echo "using lib$ipv6lib"
521 else
522 if test $ipv6trylibc = "yes"; then
523 echo "using libc"
524 else
525 echo 'Fatal: no $ipv6lib library found. cannot continue.'
526 echo "You need to fetch lib$ipv6lib.a from appropriate"
527 echo 'ipv6 kit and compile beforehand.'
528 exit 1
529 fi
530 fi
531fi
532
Fred Drakece81d592000-07-09 14:39:29 +0000533dnl # check for ANSI or K&R ("traditional") preprocessor
534dnl AC_MSG_CHECKING(for C preprocessor type)
535dnl AC_TRY_COMPILE([
536dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
537dnl int foo;
538dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
539dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
540dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000541
Guido van Rossum627b2d71993-12-24 10:39:16 +0000542# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000543AC_HEADER_STDC
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000544AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000545signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000546sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000547sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000548sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
Thomas Wouterse38b2f12001-07-11 22:35:31 +0000549ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000550AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000551
552# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000553was_it_defined=no
554AC_MSG_CHECKING(for clock_t in time.h)
555AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
556AC_MSG_RESULT($was_it_defined)
557
Guido van Rossum300fda71996-08-19 21:58:16 +0000558# Add some code to confdefs.h so that the test for off_t works on SCO
559cat >> confdefs.h <<\EOF
560#if defined(SCO_DS)
561#undef _OFF_T
562#endif
563EOF
564
Guido van Rossumef2255b2000-03-10 22:30:29 +0000565# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000566AC_TYPE_MODE_T
567AC_TYPE_OFF_T
568AC_TYPE_PID_T
569AC_TYPE_SIGNAL
570AC_TYPE_SIZE_T
571AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000572
Guido van Rossumef2255b2000-03-10 22:30:29 +0000573# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000574AC_CHECK_SIZEOF(int)
575AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000576AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000577AC_CHECK_SIZEOF(char)
578AC_CHECK_SIZEOF(short)
579AC_CHECK_SIZEOF(float)
580AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000581AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000582
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000583AC_MSG_CHECKING(for long long support)
584have_long_long=no
585AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
586AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000587if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000588AC_CHECK_SIZEOF(long long)
589fi
590
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000591AC_MSG_CHECKING(for uintptr_t support)
592have_uintptr_t=no
593AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
594AC_MSG_RESULT($have_uintptr_t)
595if test "$have_uintptr_t" = yes ; then
596AC_CHECK_SIZEOF(uintptr_t)
597fi
598
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000599# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
600AC_MSG_CHECKING(size of off_t)
601AC_CACHE_VAL(ac_cv_sizeof_off_t,
602[AC_TRY_RUN([#include <stdio.h>
603#include <sys/types.h>
604main()
605{
606 FILE *f=fopen("conftestval", "w");
607 if (!f) exit(1);
608 fprintf(f, "%d\n", sizeof(off_t));
609 exit(0);
610}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
611])
612AC_MSG_RESULT($ac_cv_sizeof_off_t)
613AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
614
615AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000616if test "$have_long_long" = yes -a \
617 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
618 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000619 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
620 AC_MSG_RESULT(yes)
621else
622 AC_MSG_RESULT(no)
623fi
624
Fred Drakea3f6e912000-06-29 20:44:47 +0000625# AC_CHECK_SIZEOF() doesn't include <time.h>.
626AC_MSG_CHECKING(size of time_t)
627AC_CACHE_VAL(ac_cv_sizeof_time_t,
628[AC_TRY_RUN([#include <stdio.h>
629#include <time.h>
630main()
631{
632 FILE *f=fopen("conftestval", "w");
633 if (!f) exit(1);
634 fprintf(f, "%d\n", sizeof(time_t));
635 exit(0);
636}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
637])
638AC_MSG_RESULT($ac_cv_sizeof_time_t)
639AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
640
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000641
Trent Mick635f6fb2000-08-23 21:33:05 +0000642# if have pthread_t then define SIZEOF_PTHREAD_T
643AC_MSG_CHECKING(for pthread_t)
644have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000645AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000646AC_MSG_RESULT($have_pthread_t)
647if test "$have_pthread_t" = yes ; then
648 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
649 AC_MSG_CHECKING(size of pthread_t)
650 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
651 [AC_TRY_RUN([#include <stdio.h>
652 #include <pthread.h>
653 main()
654 {
655 FILE *f=fopen("conftestval", "w");
656 if (!f) exit(1);
657 fprintf(f, "%d\n", sizeof(pthread_t));
658 exit(0);
659 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
660 ])
661 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
662 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
663fi
664
665
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000666# Minor variations in building a framework between NextStep versions 4 and 5
667AC_SUBST(LIBTOOL_CRUFT)
668case $ac_sys_system/$ac_sys_release in
Guido van Rossum5839e582000-10-09 19:52:35 +0000669 Darwin/*)
670 ns_undef_sym='_environ'
671 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000672 next/4*)
673 ns_undef_sym='__environ'
674 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
675 next/5*)
676 ns_undef_sym='_environ'
677 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
678esac
679
680AC_MSG_CHECKING(for --with-next-framework)
681if test "$with_next_framework"
682then
683 OPT="$OPT -fno-common"
684 # -U __environ is needed since bundles don't have access
685 # to crt0 when built but will always be linked against it
686 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
687 AC_DEFINE(WITH_NEXT_FRAMEWORK)
688 AC_MSG_RESULT(yes)
689else
690 AC_MSG_RESULT(no)
691fi
692
693AC_MSG_CHECKING(for --with-dyld)
694if test "$with_next_framework" -o "$with_dyld"
695then
696 if test "$with_dyld"
697 then
698 AC_MSG_RESULT(yes)
699 else
700 AC_MSG_RESULT(required for framework build)
701 fi
702 AC_DEFINE(WITH_DYLD)
703 ns_dyld='set'
704else
705 AC_MSG_RESULT(no)
706fi
707
Guido van Rossumac405f61994-09-12 10:56:06 +0000708# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000709AC_SUBST(SO)
710AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000711AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000712AC_SUBST(CCSHARED)
713AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000714# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000715# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000716AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000717if test -z "$SO"
718then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000719 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000720 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000721 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000722 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000723 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000724fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000725AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000726# LDSHARED is the ld *command* used to create shared library
727# -- "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 +0000728# (Shared libraries in this instance are shared modules to be loaded into
729# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000730AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000731if test -z "$LDSHARED"
732then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000733 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000734 AIX*)
735 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
736 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
737 ;;
738 BeOS*)
739 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
740 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
741 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000742 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000743 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000744 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a662000-05-26 12:22:54 +0000745 SunOS/5*)
746 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000747 then LDSHARED='$(CC) -shared'
Greg Ward57c9a662000-05-26 12:22:54 +0000748 else LDSHARED="ld -G";
749 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000750 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000751 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000752 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000753 Darwin/*|next/*)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000754 if test "$ns_dyld"
Guido van Rossumacb14c72001-01-10 21:41:16 +0000755 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000756 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
757 fi
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000758 if test "$with_next_framework" ; then
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000759 LDSHARED="$LDSHARED \$(LDLIBRARY)"
760 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000761 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000762 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000763 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000764 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000765 NetBSD*)
766 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
767 then
768 LDSHARED="cc -shared"
769 else
770 LDSHARED="ld -Bshareable"
771 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000772 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000773 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000774 then
775 LDSHARED="cc -shared ${LDFLAGS}"
776 else
777 LDSHARED="ld -Bshareable ${LDFLAGS}"
778 fi;;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000779 UnixWare*)
780 if test "$GCC" = "yes"
781 then LDSHARED="$(CC) -shared"
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000782 else LDSHARED="ld -G -dy -Bdynamic"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000783 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000784 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000785 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000786 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000787 *) LDSHARED="ld";;
788 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000789fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000790AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000791BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000792# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000793# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000794AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000795if test -z "$CCSHARED"
796then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000797 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000798 SunOS*) if test "$GCC" = yes;
799 then CCSHARED="-fPIC";
800 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000801 hp*|HP*) if test "$GCC" = yes;
802 then CCSHARED="-fpic";
803 else CCSHARED="+z";
804 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000805 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000806 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000807 OpenBSD*) CCSHARED="-fpic";;
808 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000809 UnixWare*)
810 if test "$GCC" = "yes"
811 then CCSHARED="-fPIC"
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000812 else CCSHARED="-KPIC -G -dy -Bdynamic"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000813 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000814 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000815 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000816 IRIX*/6*) case $CC in
817 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000818 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000819 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000820 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000821 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000822fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000823AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000824# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000825# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000826AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000827if test -z "$LINKFORSHARED"
828then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000829 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000830 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000831 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000832 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000833 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000834 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000835 # -u libsys_s pulls in all symbols in libsys
836 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
837 # -u __dummy makes the linker aware of the objc runtime
838 # in System.framework; otherwise, __objcInit (referenced in
839 # crt1.o) gets erroneously defined as common, which breaks dynamic
840 # loading of any modules which reference it in System.framework
841 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Jack Jansenc49e5b72001-06-19 15:00:23 +0000842 Darwin/*) LINKFORSHARED="-u __dummy -u _PyMac_Error -framework System -framework Foundation -framework Carbon" ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000843 UnixWare*) LINKFORSHARED="-dy -Bdynamic -Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000844 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000845 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000846 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000847 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
848 then
849 LINKFORSHARED="-Wl,--export-dynamic"
850 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000851 SunOS/5*) case $CC in
852 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000853 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000854 then
855 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000856 fi;;
857 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000858 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000859fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000860AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000861
Neil Schemenauer61c51152001-01-26 16:18:16 +0000862AC_SUBST(CFLAGSFORSHARED)
863AC_MSG_CHECKING(CFLAGSFORSHARED)
864if test ! "$LIBRARY" = "$LDLIBRARY"
865then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000866 case $ac_sys_system in
867 CYGWIN*)
868 # Cygwin needs CCSHARED when building extension DLLs
869 # but not when building the interpreter DLL.
870 CFLAGSFORSHARED='';;
871 *)
872 CFLAGSFORSHARED='$(CCSHARED)'
873 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000874fi
875AC_MSG_RESULT($CFLAGSFORSHARED)
876
Guido van Rossum627b2d71993-12-24 10:39:16 +0000877# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000878AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
879AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000880
881# checks for system dependent C++ extensions support
882case "$ac_sys_system" in
883 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
884 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
885 [loadAndInit("", 0, "")],
886 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
887 AC_MSG_RESULT(yes)],
888 [AC_MSG_RESULT(no)]);;
889 *) ;;
890esac
891
Guido van Rossum70c7f481998-03-26 18:44:10 +0000892# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
893# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000894# BeOS' sockets are stashed in libnet.
895case "$ac_sys_system" in
896IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000897*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000898AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000899AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000900;;
901esac
902case "$ac_sys_system" in
903BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000904AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
905;;
906esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000907
Guido van Rossumc5a39031996-07-31 17:35:03 +0000908AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000909AC_ARG_WITH(libs,
910[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000911AC_MSG_RESULT($withval)
912LIBS="$withval $LIBS"
913], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000914
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000915# Determine if signalmodule should be used.
916AC_SUBST(USE_SIGNAL_MODULE)
917AC_SUBST(SIGNAL_OBJS)
918AC_MSG_CHECKING(for --with-signal-module)
919AC_ARG_WITH(signal-module,
920[ --with-signal-module disable/enable signal module])
921
922if test -z "$with_signal_module"
923then with_signal_module="yes"
924fi
925AC_MSG_RESULT($with_signal_module)
926
927if test "${with_signal_module}" = "yes"; then
928 USE_SIGNAL_MODULE=""
929 SIGNAL_OBJS=""
930else
931 USE_SIGNAL_MODULE="#"
932 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
933fi
934
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000935# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000936AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000937USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000938
Guido van Rossum54d93d41997-01-22 20:51:58 +0000939AC_MSG_CHECKING(for --with-dec-threads)
940AC_SUBST(LDLAST)
941AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d82000-06-29 16:12:00 +0000942[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
943AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000944LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000945if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000946 with_thread="$withval";
947fi],
948AC_MSG_RESULT(no))
949
950AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000951AC_ARG_WITH(threads,
952[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000953
Barry Warsawc0d24d82000-06-29 16:12:00 +0000954# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000955AC_ARG_WITH(thread,
956[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
957with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +0000958
959if test -z "$with_threads"
960then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000961fi
Barry Warsawc0d24d82000-06-29 16:12:00 +0000962AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000963
Barry Warsawc0d24d82000-06-29 16:12:00 +0000964if test "$with_threads" = "no"
965then
966 USE_THREAD_MODULE="#"
967else
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000968 if test "$ac_sys_system" = "UnixWare"
969 then
970 CC="${CC} -Kthread"
971 LIBOBJS="$LIBOBJS thread.o"
972 AC_DEFINE(WITH_THREAD)
973 AC_DEFINE(_POSIX_THREADS)
974 USE_THREAD_MODULE=""
975 else
976 if test ! -z "$with_threads" -a -d "$with_threads"
977 then LDFLAGS="$LDFLAGS -L$with_threads"
978 fi
979 if test ! -z "$withval" -a -d "$withval"
980 then LDFLAGS="$LDFLAGS -L$withval"
981 fi
982 AC_DEFINE(_REENTRANT)
983 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
984 AC_DEFINE(C_THREADS)
985 LIBOBJS="$LIBOBJS thread.o"],[
986 AC_MSG_CHECKING(for --with-pth)
987 AC_ARG_WITH(pth,
988 [ --with-pth use GNU pth threading libraries], [
989 AC_MSG_RESULT($withval)
990 AC_DEFINE(WITH_THREAD)
991 AC_DEFINE(HAVE_PTH)
992 LIBS="-lpth $LIBS"
993 LIBOBJS="$LIBOBJS thread.o"],[
994 AC_MSG_RESULT(no)
995 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
996 AC_DEFINE(_POSIX_THREADS)
997 LIBS="-lpthread $LIBS"
998 LIBOBJS="$LIBOBJS thread.o"],[
999 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1000 case $ac_sys_system in
1001 Darwin*) ;;
1002 *) AC_DEFINE(_POSIX_THREADS);;
1003 esac
1004 LIBOBJS="$LIBOBJS thread.o"],[
1005 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1006 AC_DEFINE(BEOS_THREADS)
1007 LIBOBJS="$LIBOBJS thread.o"],[
1008 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1009 AC_DEFINE(_POSIX_THREADS)
1010 LIBS="$LIBS -lpthreads"
1011 LIBOBJS="$LIBOBJS thread.o"], [
1012 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1013 AC_DEFINE(_POSIX_THREADS)
1014 LIBS="$LIBS -lc_r"
1015 LIBOBJS="$LIBOBJS thread.o"], [
1016 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
1017 AC_DEFINE(_POSIX_THREADS)
1018 LIBS="$LIBS -lthread"
1019 LIBOBJS="$LIBOBJS thread.o"], [
1020 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1021 AC_DEFINE(_POSIX_THREADS)
1022 LIBS="$LIBS -lpthread"
1023 LIBOBJS="$LIBOBJS thread.o"], [
1024 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1025 AC_DEFINE(_POSIX_THREADS)
1026 LIBS="$LIBS -lcma"
1027 LIBOBJS="$LIBOBJS thread.o"],[
1028 USE_THREAD_MODULE="#"])
1029 ])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00001030
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001031 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1032 LIBS="$LIBS -lmpc"
1033 LIBOBJS="$LIBOBJS thread.o"
1034 USE_THREAD_MODULE=""])
1035 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1036 LIBS="$LIBS -lthread"
1037 LIBOBJS="$LIBOBJS thread.o"
1038 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001039
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001040 if test "$USE_THREAD_MODULE" != "#"
1041 then
1042 # If the above checks didn't disable threads, (at least) OSF1
1043 # needs this '-threads' argument during linking.
1044 case $ac_sys_system in
1045 OSF1) LDLAST=-threads;;
1046 esac
1047 fi
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001048 fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00001049fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001050
Barry Warsawef82cd72000-06-30 16:21:01 +00001051# Check for GC support
1052AC_SUBST(USE_GC_MODULE)
1053USE_GC_MODULE=""
1054AC_MSG_CHECKING(for --with-cycle-gc)
1055AC_ARG_WITH(cycle-gc,
1056[ --with(out)-cycle-gc disable/enable garbage collection])
1057
1058if test -z "$with_cycle_gc"
1059then with_cycle_gc="yes"
1060fi
1061if test "$with_cycle_gc" = "no"
1062then
1063 USE_GC_MODULE="#"
1064else
1065 AC_DEFINE(WITH_CYCLE_GC)
1066fi
1067AC_MSG_RESULT($with_cycle_gc)
1068
Neil Schemenauera35c6882001-02-27 04:45:05 +00001069# Check for Python-specific malloc support
1070AC_MSG_CHECKING(for --with-pymalloc)
1071AC_ARG_WITH(pymalloc,
1072[ --with(out)-pymalloc disable/enable specialized mallocs], [
1073if test "$withval" != no
1074then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1075else AC_MSG_RESULT(no)
1076fi],
1077[AC_MSG_RESULT(no)])
1078
Barry Warsawef82cd72000-06-30 16:21:01 +00001079# Check for --with-wctype-functions
1080AC_MSG_CHECKING(for --with-wctype-functions)
1081AC_ARG_WITH(wctype-functions,
1082[ --with-wctype-functions use wctype.h functions], [
1083if test "$withval" != no
1084then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1085else AC_MSG_RESULT(no)
1086fi],
1087[AC_MSG_RESULT(no)])
1088
Guido van Rossum68242b51996-05-28 22:53:03 +00001089# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001090AC_SUBST(DLINCLDIR)
1091DLINCLDIR=/
1092
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001093AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001094AC_ARG_WITH(sgi-dl,
1095[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001096AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001097AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +00001098DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001099dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001100if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001101then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001102else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1103fi
1104DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001105LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001106
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001107AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001108AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001109AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001110AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001111DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001112dldir=`echo "$withval" | sed 's/,.*//'`
1113dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001114if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001115then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001116else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1117fi
1118DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001119LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001120
Guido van Rossume97ee181999-12-20 21:27:22 +00001121# the dlopen() function means we might want to use dynload_shlib.o. some
1122# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001123AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001124
1125# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1126# loading of modules.
1127AC_SUBST(DYNLOADFILE)
1128AC_MSG_CHECKING(DYNLOADFILE)
1129if test -z "$DYNLOADFILE"
1130then
1131 case $ac_sys_system/$ac_sys_release in
1132 AIX*) DYNLOADFILE="dynload_aix.o";;
1133 BeOS*) DYNLOADFILE="dynload_beos.o";;
1134 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Guido van Rossum5839e582000-10-09 19:52:35 +00001135 Darwin/*|next/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001136 *)
1137 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1138 # out any dynamic loading
1139 if test "$ac_cv_func_dlopen" = yes
1140 then DYNLOADFILE="dynload_shlib.o"
1141 else DYNLOADFILE="dynload_stub.o"
1142 fi
1143 ;;
1144 esac
1145fi
1146AC_MSG_RESULT($DYNLOADFILE)
1147if test "$DYNLOADFILE" != "dynload_stub.o"
1148then
1149 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1150fi
1151
Jack Jansenc49e5b72001-06-19 15:00:23 +00001152# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1153
1154AC_SUBST(MACHDEP_OBJS)
1155AC_MSG_CHECKING(MACHDEP_OBJS)
1156if test -z "$MACHDEP_OBJS"
1157then
1158 case $ac_sys_system/$ac_sys_release in
1159 Darwin/*)
1160 MACHDEP_OBJS="Mac/Python/macglue.o"
1161 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
1162 ;;
1163 *) MACHDEP_OBJS="";;
1164 esac
1165fi
1166AC_MSG_RESULT($DYNLOADFILE)
1167
Guido van Rossum627b2d71993-12-24 10:39:16 +00001168# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001169AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001170 flock fork fsync fdatasync fpathconf ftime ftruncate \
Andrew M. Kuchlinga9586c72001-01-08 17:58:56 +00001171 getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwisb9ab1592001-06-24 21:18:26 +00001172 inet_pton kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001173 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001174 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001175 select setegid seteuid setgid \
Thomas Wouters3a584202000-08-05 23:28:51 +00001176 setlocale setregid setreuid setsid setpgid setuid setvbuf \
Fred Drake35a092f1999-12-13 16:23:35 +00001177 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001178 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Woutersc2c12dc2001-07-11 14:45:34 +00001179 truncate uname waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001180
Fred Drake8cef4cf2000-06-28 16:40:38 +00001181# check for openpty and forkpty
1182
1183AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1184AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1185
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001186# check for long file support functions
1187AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1188
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001189AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001190AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1191AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1192AC_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 +00001193
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001194AC_CHECK_FUNCS(getaddrinfo, [dnl
1195AC_MSG_CHECKING(getaddrinfo bug)
1196AC_TRY_RUN([
1197#include <sys/types.h>
1198#include <netdb.h>
1199#include <string.h>
1200#include <sys/socket.h>
1201#include <netinet/in.h>
1202
1203main()
1204{
1205 int passive, gaierr, inet4 = 0, inet6 = 0;
1206 struct addrinfo hints, *ai, *aitop;
1207 char straddr[INET6_ADDRSTRLEN], strport[16];
1208
1209 for (passive = 0; passive <= 1; passive++) {
1210 memset(&hints, 0, sizeof(hints));
1211 hints.ai_family = AF_UNSPEC;
1212 hints.ai_flags = passive ? AI_PASSIVE : 0;
1213 hints.ai_socktype = SOCK_STREAM;
1214 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1215 (void)gai_strerror(gaierr);
1216 goto bad;
1217 }
1218 for (ai = aitop; ai; ai = ai->ai_next) {
1219 if (ai->ai_addr == NULL ||
1220 ai->ai_addrlen == 0 ||
1221 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1222 straddr, sizeof(straddr), strport, sizeof(strport),
1223 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1224 goto bad;
1225 }
1226 switch (ai->ai_family) {
1227 case AF_INET:
1228 if (strcmp(strport, "54321") != 0) {
1229 goto bad;
1230 }
1231 if (passive) {
1232 if (strcmp(straddr, "0.0.0.0") != 0) {
1233 goto bad;
1234 }
1235 } else {
1236 if (strcmp(straddr, "127.0.0.1") != 0) {
1237 goto bad;
1238 }
1239 }
1240 inet4++;
1241 break;
1242 case AF_INET6:
1243 if (strcmp(strport, "54321") != 0) {
1244 goto bad;
1245 }
1246 if (passive) {
1247 if (strcmp(straddr, "::") != 0) {
1248 goto bad;
1249 }
1250 } else {
1251 if (strcmp(straddr, "::1") != 0) {
1252 goto bad;
1253 }
1254 }
1255 inet6++;
1256 break;
1257 case AF_UNSPEC:
1258 goto bad;
1259 break;
1260 default:
1261 /* another family support? */
1262 break;
1263 }
1264 }
1265 }
1266
1267 if (!(inet4 == 0 || inet4 == 2))
1268 goto bad;
1269 if (!(inet6 == 0 || inet6 == 2))
1270 goto bad;
1271
1272 if (aitop)
1273 freeaddrinfo(aitop);
1274 exit(0);
1275
1276 bad:
1277 if (aitop)
1278 freeaddrinfo(aitop);
1279 exit(1);
1280}
1281],
1282AC_MSG_RESULT(good)
1283buggygetaddrinfo=no,
1284AC_MSG_RESULT(buggy)
1285buggygetaddrinfo=yes,
1286AC_MSG_RESULT(buggy)
1287buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
1288
1289if test "$buggygetaddrinfo" = "yes"; then
1290 if test "$ipv6" = "yes"; then
1291 echo 'Fatal: You must get working getaddrinfo() function.'
1292 echo ' or you can specify "--disable-ipv6"'.
1293 exit 1
1294 fi
1295fi
1296AC_CHECK_FUNCS(getaddrinfo getnameinfo)
1297
Guido van Rossum627b2d71993-12-24 10:39:16 +00001298# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001299AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001300AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001301AC_STRUCT_TIMEZONE
1302
1303AC_MSG_CHECKING(for time.h that defines altzone)
1304AC_CACHE_VAL(ac_cv_header_time_altzone,
1305[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1306 ac_cv_header_time_altzone=yes,
1307 ac_cv_header_time_altzone=no)])
1308AC_MSG_RESULT($ac_cv_header_time_altzone)
1309if test $ac_cv_header_time_altzone = yes; then
1310 AC_DEFINE(HAVE_ALTZONE)
1311fi
1312
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001313was_it_defined=no
1314AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001315AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001316#include <sys/types.h>
1317#include <sys/select.h>
1318#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001319], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1320AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001321
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001322AC_MSG_CHECKING(for addrinfo)
1323AC_CACHE_VAL(ac_cv_struct_addrinfo,
1324AC_TRY_COMPILE([
1325# include <netdb.h>],
1326 [struct addrinfo a],
1327 ac_cv_struct_addrinfo=yes,
1328 ac_cv_struct_addrinfo=no))
1329AC_MSG_RESULT($ac_cv_struct_addrinfo)
1330if test $ac_cv_struct_addrinfo = yes; then
1331 AC_DEFINE(HAVE_ADDRINFO)
1332fi
1333
1334AC_MSG_CHECKING(for sockaddr_storage)
1335AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1336AC_TRY_COMPILE([
1337# include <sys/types.h>
1338# include <sys/socket.h>],
1339 [struct sockaddr_storage s],
1340 ac_cv_struct_sockaddr_storage=yes,
1341 ac_cv_struct_sockaddr_storage=no))
1342AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1343if test $ac_cv_struct_sockaddr_storage = yes; then
1344 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1345fi
1346
Guido van Rossum627b2d71993-12-24 10:39:16 +00001347# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001348
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001349AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001350AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001351
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001352works=no
1353AC_MSG_CHECKING(for working volatile)
1354AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1355AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001356
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001357works=no
1358AC_MSG_CHECKING(for working signed char)
1359AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1360AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001361
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001362have_prototypes=no
1363AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001364AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1365AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001366AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001367
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001368works=no
1369AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001370AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001371#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001372int foo(int x, ...) {
1373 va_list va;
1374 va_start(va, x);
1375 va_arg(va, int);
1376 va_arg(va, char *);
1377 va_arg(va, double);
1378 return 0;
1379}
1380], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001381AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1382AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001383
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001384if test "$have_prototypes" = yes; then
1385bad_prototypes=no
1386AC_MSG_CHECKING(for bad exec* prototypes)
1387AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1388 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1389AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001390fi
1391
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001392# check if sockaddr has sa_len member
1393AC_MSG_CHECKING(if sockaddr has sa_len member)
1394AC_TRY_COMPILE([#include <sys/types.h>
1395#include <sys/socket.h>],
1396[struct sockaddr x;
1397x.sa_len = 0;],
1398 AC_MSG_RESULT(yes)
1399 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1400 AC_MSG_RESULT(no))
1401
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001402bad_forward=no
1403AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001404AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001405struct s { int a; int b; };
1406static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001407int foobar() {
1408 static int random;
1409 random = (int) &foo;
1410 return random;
1411}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001412static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001413main() {
1414 exit(!((int)&foo == foobar()));
1415}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001416], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
1417AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001418
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001419va_list_is_array=no
1420AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001421AC_TRY_COMPILE([
1422#ifdef HAVE_STDARG_PROTOTYPES
1423#include <stdarg.h>
1424#else
1425#include <varargs.h>
1426#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001427], [va_list list1, list2; list1 = list2;], ,
1428AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1429AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001430
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001431# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1432AC_CHECK_FUNC(gethostbyname_r, [
1433 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1434 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1435 OLD_CFLAGS=$CFLAGS
1436 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1437 AC_TRY_COMPILE([
1438# include <netdb.h>
1439 ], [
1440 char *name;
1441 struct hostent *he, *res;
1442 char buffer[2048];
1443 int buflen = 2048;
1444 int h_errnop;
1445
1446 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1447 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001448 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001449 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1450 AC_MSG_RESULT(yes)
1451 ], [
1452 AC_MSG_RESULT(no)
1453 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1454 AC_TRY_COMPILE([
1455# include <netdb.h>
1456 ], [
1457 char *name;
1458 struct hostent *he;
1459 char buffer[2048];
1460 int buflen = 2048;
1461 int h_errnop;
1462
1463 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1464 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001465 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001466 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1467 AC_MSG_RESULT(yes)
1468 ], [
1469 AC_MSG_RESULT(no)
1470 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1471 AC_TRY_COMPILE([
1472# include <netdb.h>
1473 ], [
1474 char *name;
1475 struct hostent *he;
1476 struct hostent_data data;
1477
1478 (void) gethostbyname_r(name, he, &data);
1479 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001480 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001481 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1482 AC_MSG_RESULT(yes)
1483 ], [
1484 AC_MSG_RESULT(no)
1485 ])
1486 ])
1487 ])
1488 CFLAGS=$OLD_CFLAGS
1489], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001490 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001491])
1492AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1493AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1494AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001495AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001496AC_SUBST(HAVE_GETHOSTBYNAME)
1497
Guido van Rossum627b2d71993-12-24 10:39:16 +00001498# checks for system services
1499# (none yet)
1500
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001501# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001502AC_CHECK_FUNC(__fpu_control,
1503 [],
1504 [AC_CHECK_LIB(ieee, __fpu_control)
1505])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001506
Guido van Rossum93274221997-05-09 02:42:00 +00001507# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001508AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001509AC_ARG_WITH(fpectl,
1510[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001511if test "$withval" != no
1512then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1513else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001514fi],
1515[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001516
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001517# check for --with-libm=...
1518AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001519case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001520Darwin) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001521next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001522BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001523*) LIBM=-lm
1524esac
Guido van Rossum93274221997-05-09 02:42:00 +00001525AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001526AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001527if test "$withval" = no
1528then LIBM=
1529 AC_MSG_RESULT(force LIBM empty)
1530elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001531then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001532 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001533else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001534fi],
1535[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001536
1537# check for --with-libc=...
1538AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001539AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001540AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001541if test "$withval" = no
1542then LIBC=
1543 AC_MSG_RESULT(force LIBC empty)
1544elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001545then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001546 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001547else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001548fi],
1549[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001550
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001551# check for hypot() in math library
1552LIBS_SAVE=$LIBS
1553LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001554AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001555LIBS=$LIBS_SAVE
1556
Guido van Rossumad713701997-07-10 22:42:38 +00001557# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001558AC_MSG_CHECKING(what malloc(0) returns)
1559AC_CACHE_VAL(ac_cv_malloc_zero,
1560[AC_TRY_RUN([#include <stdio.h>
1561#ifdef HAVE_STDLIB
1562#include <stdlib.h>
1563#else
1564char *malloc(), *realloc();
1565int *free();
1566#endif
1567main() {
1568 char *p;
1569 p = malloc(0);
1570 if (p == NULL) exit(1);
1571 p = realloc(p, 0);
1572 if (p == NULL) exit(1);
1573 free(p);
1574 exit(0);
1575}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1576AC_MSG_RESULT($ac_cv_malloc_zero)
1577if test "$ac_cv_malloc_zero" = null
1578then
1579 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1580fi
1581
Guido van Rossumef2255b2000-03-10 22:30:29 +00001582# check for wchar.h
1583AC_CHECK_HEADER(wchar.h,
1584AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1585wchar_h="no"
1586)
1587
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001588# determine wchar_t size
1589if test "$wchar_h" = yes
1590then
1591 AC_CHECK_SIZEOF(wchar_t)
1592fi
1593
1594AC_MSG_CHECKING(what type to use for unicode)
1595AC_ARG_ENABLE(unicode,
1596[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1597
1598if test $enable_unicode = yes
1599then
Martin v. Löwisfd917792001-06-27 20:22:04 +00001600 # Without any arguments, Py_UNICODE defaults to two-byte mode
1601 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001602fi
1603
1604case "$enable_unicode" in
1605ucs2) unicode_size="2"
1606 AC_DEFINE(Py_UNICODE_SIZE,2)
1607 ;;
1608ucs4) unicode_size="4"
1609 AC_DEFINE(Py_UNICODE_SIZE,4)
1610 ;;
1611esac
1612
1613if test "$enable_unicode" = "no"
1614then
1615 AC_MSG_RESULT(not used)
1616else
1617 AC_DEFINE(Py_USING_UNICODE)
1618 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1619 then
1620 PY_UNICODE_TYPE="wchar_t"
1621 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1622 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1623 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1624 then
1625 PY_UNICODE_TYPE="unsigned short"
1626 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1627 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1628 then
1629 PY_UNICODE_TYPE="unsigned long"
1630 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1631 else
1632 PY_UNICODE_TYPE="no type found"
1633 fi
1634 AC_MSG_RESULT($PY_UNICODE_TYPE)
1635fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00001636
1637# check for endianness
1638AC_C_BIGENDIAN
1639
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001640# Check whether right shifting a negative integer extends the sign bit
1641# or fills with zeros (like the Cray J90, according to Tim Peters).
1642AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001643AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001644AC_TRY_RUN([
1645int main()
1646{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001647 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001648}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001649], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1650AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1651if test "$ac_cv_rshift_extends_sign" = no
1652then
1653 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1654fi
1655
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001656# check for getc_unlocked and related locking functions
1657AC_MSG_CHECKING(for getc_unlocked() and friends)
1658AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1659AC_TRY_LINK([#include <stdio.h>],[
1660 FILE *f = fopen("/dev/null", "r");
1661 flockfile(f);
1662 getc_unlocked(f);
1663 funlockfile(f);
1664], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1665AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1666if test "$ac_cv_have_getc_unlocked" = yes
1667then
1668 AC_DEFINE(HAVE_GETC_UNLOCKED)
1669fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001670
Guido van Rossum353ae582001-07-10 16:45:32 +00001671# check for readline 4.2
1672AC_CHECK_LIB(readline, rl_completion_matches,
1673 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1674
Thomas Wouterse38b2f12001-07-11 22:35:31 +00001675AC_MSG_CHECKING(for broken nice())
1676AC_CACHE_VAL(ac_cv_broken_nice, [
1677AC_TRY_RUN([
1678int main()
1679{
1680 int val1 = nice(1);
1681 if (val1 != -1 && val1 == nice(2))
1682 exit(0);
1683 exit(1);
1684}
1685],ac_cv_broken_nice=yes, ac_cv_broken_nice=no)])
1686AC_MSG_RESULT($ac_cv_broken_nice)
1687if test "$ac_cv_broken_nice" = yes
1688then
1689 AC_DEFINE(HAVE_BROKEN_NICE)
1690fi
1691
Guido van Rossum95713eb2000-05-18 20:53:31 +00001692# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1693# Add sys/socket.h to confdefs.h
1694cat >> confdefs.h <<\EOF
1695#ifdef HAVE_SYS_SOCKET_H
1696#include <sys/socket.h>
1697#endif
1698EOF
1699AC_CHECK_TYPE(socklen_t, int)
1700
Neil Schemenauerf25cf6c2001-03-04 06:39:33 +00001701# Add Python/ prefix to LIBOBJS
1702libobjs=$LIBOBJS
1703LIBOBJS=
1704for obj in $libobjs; do
1705 LIBOBJS="$LIBOBJS Python/$obj"
1706done
1707
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001708#AC_MSG_CHECKING(for Modules/Setup)
1709#if test ! -f Modules/Setup ; then
1710# if test ! -d Modules ; then
1711# mkdir Modules
1712# fi
1713# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1714# AC_MSG_RESULT(creating)
1715#else
1716# AC_MSG_RESULT(already exists)
1717#fi
1718
1719AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00001720SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001721AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001722for dir in $SRCDIRS; do
1723 if test ! -d $dir; then
1724 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001725 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001726done
1727AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001728
Guido van Rossum627b2d71993-12-24 10:39:16 +00001729# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001730AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001731
1732echo "creating Setup"
1733if test ! -f Modules/Setup
1734then
1735 cp $srcdir/Modules/Setup.dist Modules/Setup
1736fi
1737
1738echo "creating Setup.local"
1739if test ! -f Modules/Setup.local
1740then
1741 echo "# Edit this file for local setup changes" >Modules/Setup.local
1742fi
1743
1744echo "creating Makefile"
1745$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1746 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00001747 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00001748mv config.c Modules