blob: 07e9f097e0f0c8c99d2d5034ead13f52556665cf [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,
Jack Jansen9a66b6d2001-08-08 13:56:14 +000047[ --with-dyld Use (OpenStep|Rhapsody) 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
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000174
175# checks for UNIX variants that set C preprocessor variables
176AC_AIX
177AC_MINIX
178
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000179AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000180AC_MSG_CHECKING(for --with-suffix)
181AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
182 case $withval in
183 no) EXEEXT=;;
184 yes) EXEEXT=.exe;;
185 *) EXEEXT=$withval;;
186 esac])
187AC_MSG_RESULT($EXEEXT)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000188# Test whether we're running on a non-case-sensitive system, in which
189# case we give a warning if no ext is given
190if test -d "python" -a -z "$EXEEXT"
191then
192 AC_MSG_WARN(This filesystem is not case-sensitive so you should probably use --with-suffix)
193fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000194
Guido van Rossumdd997f71998-10-07 19:58:26 +0000195case $MACHDEP in
196bsdos*)
197 case $CC in
198 gcc) CC="$CC -D_HAVE_BSDI";;
199 esac;;
200esac
201
Guido van Rossum84561611997-08-21 00:08:11 +0000202case $ac_sys_system in
203hp*|HP*)
204 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000205 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000206 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000207Monterey*)
208 case $CC in
209 cc) CC="$CC -Wl,-Bexport";;
210 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000211SunOS*)
212 # Some functions have a prototype only with that define, e.g. confstr
213 AC_DEFINE(__EXTENSIONS__)
214 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000215esac
216
Martin v. Löwise8964d42001-03-06 12:09:07 +0000217
Neil Schemenauer61c51152001-01-26 16:18:16 +0000218AC_SUBST(LIBRARY)
219AC_MSG_CHECKING(LIBRARY)
220if test -z "$LIBRARY"
221then
222 LIBRARY='libpython$(VERSION).a'
223fi
224AC_MSG_RESULT($LIBRARY)
225
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000226# LDLIBRARY is the name of the library to link against (as opposed to the
227# name of the library into which to insert object files). On systems
228# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
Guido van Rossumaef734b2001-01-10 21:09:12 +0000229# the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the
230# shared (i.e., DLL) library.
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000231AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000232AC_SUBST(DLLLIBRARY)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000233LDLIBRARY="$LIBRARY"
Guido van Rossum27552902001-01-23 01:52:26 +0000234DLLLIBRARY=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000235
Guido van Rossumfb842551997-08-06 23:42:07 +0000236# LINKCC is the command that links the python executable -- default is $(CC).
Fred Drake5790be12000-10-09 17:06:13 +0000237# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000238# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000239AC_SUBST(LINKCC)
240AC_MSG_CHECKING(LINKCC)
241if test -z "$LINKCC"
242then
243 case $ac_sys_system in
244 AIX*)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000245 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000246 dgux*)
247 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000248 Monterey64*)
249 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000250 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000251 esac
252fi
253AC_MSG_RESULT($LINKCC)
254
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000255AC_MSG_CHECKING(LDLIBRARY)
256
257# NeXT framework builds require that the 'ar' library be converted into
258# a bundle using libtool.
259if test "$with_next_framework"
260then
261 LDLIBRARY='libpython$(VERSION).dylib'
Jack Jansenca06bc62001-08-03 15:32:23 +0000262 DLLLIBRARY=$LDLIBRARY
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000263fi
264
265# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000266case $MACHDEP in
267dguxR4)
268 LDLIBRARY='libpython$(VERSION).so'
269 OPT="$OPT -pic"
270 ;;
271beos*)
272 LDLIBRARY='libpython$(VERSION).so'
273 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000274cygwin*)
275 LDLIBRARY='libpython$(VERSION).dll.a'
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000276 DLLLIBRARY='libpython$(VERSION).dll'
Guido van Rossumaef734b2001-01-10 21:09:12 +0000277 ;;
Fred Drake5790be12000-10-09 17:06:13 +0000278esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000279AC_MSG_RESULT($LDLIBRARY)
280
Guido van Rossum627b2d71993-12-24 10:39:16 +0000281AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000282AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000283AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000284
285case $MACHDEP in
286bsdos*)
287 # install -d does not work on BSDI
288 if test -z "$INSTALL"
289 then
290 INSTALL="${srcdir}/install-sh -c"
291 fi
292esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000293AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000294
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000295# Not every filesystem supports hard links
296AC_SUBST(LN)
297if test -z "$LN" ; then
298 case $ac_sys_system in
299 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000300 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000301 *) LN=ln;;
302 esac
303fi
304
Fred Drake9f715822001-07-11 06:27:00 +0000305# Check for --with-pydebug
306AC_MSG_CHECKING(for --with-pydebug)
307AC_ARG_WITH(pydebug,
308[ --with-pydebug build with Py_DEBUG defined], [
309if test "$withval" != no
310then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
311else AC_MSG_RESULT(no); Py_DEBUG='false'
312fi],
313[AC_MSG_RESULT(no)])
314
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000315# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000316AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000317if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000318then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000319 case $GCC in
320 yes)
321 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000322 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000323 if test "$Py_DEBUG" = 'true' ; then
324 # Optimization messes up debuggers, so turn it off for
325 # debug builds.
326 OPT="-g -Wall -Wstrict-prototypes"
327 else
328 OPT="-g -O3 -Wall -Wstrict-prototypes"
329 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000330 *)
Fred Drake9f715822001-07-11 06:27:00 +0000331 OPT="-O3 -Wall -Wstrict-prototypes";;
332 esac
333 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000334 *)
335 case $ac_sys_system in
336 UnixWare*)
337 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
338 *)
339 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000340 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000341 esac
Jack Jansenca06bc62001-08-03 15:32:23 +0000342 case $ac_sys_system in
343 Darwin*)
344 OPT="$OPT -no-cpp-precomp";;
345 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000346fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000347
Trent Mick635f6fb2000-08-23 21:33:05 +0000348# The current (beta) Monterey compiler dies with optimizations
349case $ac_sys_system in
350Monterey*) OPT="";;
351esac
352
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000353if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000354then
355 OPT="$OPT $ac_arch_flags"
356fi
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öwis130fb172001-07-19 11:00:41 +0000387# -Kpthread, if available, provides the right #defines
388# and linker options to make pthread_create available
389AC_MSG_CHECKING(whether $CC accepts -Kpthread)
390AC_CACHE_VAL(ac_cv_kpthread,
391[ac_save_cc="$CC"
392CC="$CC -Kpthread"
393AC_TRY_LINK([#include <pthread.h>],[pthread_create(0,0,0,0)],
394 ac_cv_kpthread=yes,
395 ac_cv_kpthread=no)
396CC="$ac_save_cc"])
397
398# GCC does not reject -Kpthread as an illegal option, it merely complains that
399# it is unrecognized
400if test "$GCC" = "yes"
401then ac_cv_kpthread="no, we have gcc"
402fi
403AC_MSG_RESULT($ac_cv_kpthread)
404
Fred Drakece81d592000-07-09 14:39:29 +0000405dnl # check for ANSI or K&R ("traditional") preprocessor
406dnl AC_MSG_CHECKING(for C preprocessor type)
407dnl AC_TRY_COMPILE([
408dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
409dnl int foo;
410dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
411dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
412dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000413
Guido van Rossum627b2d71993-12-24 10:39:16 +0000414# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000415AC_HEADER_STDC
Martin v. Löwis9b75dca2001-08-10 13:58:50 +0000416AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h langinfo.h locale.h \
417ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000418signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000419sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000420sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000421sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
Thomas Wouterse38b2f12001-07-11 22:35:31 +0000422ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000423AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000424
425# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000426was_it_defined=no
427AC_MSG_CHECKING(for clock_t in time.h)
428AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
429AC_MSG_RESULT($was_it_defined)
430
Guido van Rossum300fda71996-08-19 21:58:16 +0000431# Add some code to confdefs.h so that the test for off_t works on SCO
432cat >> confdefs.h <<\EOF
433#if defined(SCO_DS)
434#undef _OFF_T
435#endif
436EOF
437
Guido van Rossumef2255b2000-03-10 22:30:29 +0000438# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000439AC_TYPE_MODE_T
440AC_TYPE_OFF_T
441AC_TYPE_PID_T
442AC_TYPE_SIGNAL
443AC_TYPE_SIZE_T
444AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000445
Guido van Rossumef2255b2000-03-10 22:30:29 +0000446# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000447AC_CHECK_SIZEOF(int)
448AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000449AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000450AC_CHECK_SIZEOF(char)
451AC_CHECK_SIZEOF(short)
452AC_CHECK_SIZEOF(float)
453AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000454AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000455
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000456AC_MSG_CHECKING(for long long support)
457have_long_long=no
458AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
459AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000460if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000461AC_CHECK_SIZEOF(long long)
462fi
463
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000464AC_MSG_CHECKING(for uintptr_t support)
465have_uintptr_t=no
466AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
467AC_MSG_RESULT($have_uintptr_t)
468if test "$have_uintptr_t" = yes ; then
469AC_CHECK_SIZEOF(uintptr_t)
470fi
471
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000472# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
473AC_MSG_CHECKING(size of off_t)
474AC_CACHE_VAL(ac_cv_sizeof_off_t,
475[AC_TRY_RUN([#include <stdio.h>
476#include <sys/types.h>
477main()
478{
479 FILE *f=fopen("conftestval", "w");
480 if (!f) exit(1);
481 fprintf(f, "%d\n", sizeof(off_t));
482 exit(0);
483}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
484])
485AC_MSG_RESULT($ac_cv_sizeof_off_t)
486AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
487
488AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000489if test "$have_long_long" = yes -a \
490 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
491 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000492 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
493 AC_MSG_RESULT(yes)
494else
495 AC_MSG_RESULT(no)
496fi
497
Fred Drakea3f6e912000-06-29 20:44:47 +0000498# AC_CHECK_SIZEOF() doesn't include <time.h>.
499AC_MSG_CHECKING(size of time_t)
500AC_CACHE_VAL(ac_cv_sizeof_time_t,
501[AC_TRY_RUN([#include <stdio.h>
502#include <time.h>
503main()
504{
505 FILE *f=fopen("conftestval", "w");
506 if (!f) exit(1);
507 fprintf(f, "%d\n", sizeof(time_t));
508 exit(0);
509}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
510])
511AC_MSG_RESULT($ac_cv_sizeof_time_t)
512AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
513
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000514
Trent Mick635f6fb2000-08-23 21:33:05 +0000515# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000516ac_save_cc="$CC"
517if test "$ac_cv_kpthread" = "yes"
518then CC="$CC -Kpthread"
519fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000520AC_MSG_CHECKING(for pthread_t)
521have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000522AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000523AC_MSG_RESULT($have_pthread_t)
524if test "$have_pthread_t" = yes ; then
525 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
526 AC_MSG_CHECKING(size of pthread_t)
527 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
528 [AC_TRY_RUN([#include <stdio.h>
529 #include <pthread.h>
530 main()
531 {
532 FILE *f=fopen("conftestval", "w");
533 if (!f) exit(1);
534 fprintf(f, "%d\n", sizeof(pthread_t));
535 exit(0);
536 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
537 ])
538 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
539 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
540fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000541CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000542
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000543# Minor variations in building a framework between NextStep versions 4 and 5
544AC_SUBST(LIBTOOL_CRUFT)
545case $ac_sys_system/$ac_sys_release in
Guido van Rossum5839e582000-10-09 19:52:35 +0000546 Darwin/*)
547 ns_undef_sym='_environ'
Jack Jansenca06bc62001-08-03 15:32:23 +0000548 LIBTOOL_CRUFT="-framework Foundation -framework Carbon -lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000549 next/4*)
550 ns_undef_sym='__environ'
551 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
552 next/5*)
553 ns_undef_sym='_environ'
554 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
555esac
556
557AC_MSG_CHECKING(for --with-next-framework)
558if test "$with_next_framework"
559then
Jack Jansenca06bc62001-08-03 15:32:23 +0000560 OPT="$OPT -fno-common -dynamic"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000561 # -U __environ is needed since bundles don't have access
562 # to crt0 when built but will always be linked against it
563 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
564 AC_DEFINE(WITH_NEXT_FRAMEWORK)
565 AC_MSG_RESULT(yes)
566else
567 AC_MSG_RESULT(no)
568fi
569
570AC_MSG_CHECKING(for --with-dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000571case $ac_sys_system/$ac_sys_release in
572 Darwin/*)
573 AC_DEFINE(WITH_DYLD)
574 AC_MSG_RESULT(always on for Darwin)
575 ;;
576 *)
577 if test "$with_next_framework" -o "$with_dyld"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000578 then
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000579 if test "$with_dyld"
580 then
581 AC_MSG_RESULT(yes)
582 else
583 AC_MSG_RESULT(required for framework build)
584 fi
585 AC_DEFINE(WITH_DYLD)
586 ns_dyld='set'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000587 else
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000588 AC_MSG_RESULT(no)
589 fi ;;
590esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000591
Guido van Rossumac405f61994-09-12 10:56:06 +0000592# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000593AC_SUBST(SO)
594AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000595AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000596AC_SUBST(CCSHARED)
597AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000598# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000599# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000600AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000601if test -z "$SO"
602then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000603 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000604 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000605 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000606 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000607 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000608fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000609AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000610# LDSHARED is the ld *command* used to create shared library
611# -- "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 +0000612# (Shared libraries in this instance are shared modules to be loaded into
613# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000614AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000615if test -z "$LDSHARED"
616then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000617 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000618 AIX*)
619 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
620 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
621 ;;
622 BeOS*)
623 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
624 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
625 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000626 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000627 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000628 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a662000-05-26 12:22:54 +0000629 SunOS/5*)
630 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000631 then LDSHARED='$(CC) -shared'
Greg Ward57c9a662000-05-26 12:22:54 +0000632 else LDSHARED="ld -G";
633 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000634 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000635 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000636 DYNIX/ptx*) LDSHARED="ld -G";;
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000637 Darwin/*)
638 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
639 if test "$with_next_framework" ; then
640 LDSHARED="$LDSHARED \$(LDLIBRARY)"
641 fi ;;
642 next/*)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000643 if test "$ns_dyld"
Guido van Rossumacb14c72001-01-10 21:41:16 +0000644 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000645 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
646 fi
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000647 if test "$with_next_framework" ; then
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000648 LDSHARED="$LDSHARED \$(LDLIBRARY)"
649 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000650 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000651 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000652 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000653 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000654 NetBSD*)
655 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
656 then
657 LDSHARED="cc -shared"
658 else
659 LDSHARED="ld -Bshareable"
660 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000661 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000662 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000663 then
664 LDSHARED="cc -shared ${LDFLAGS}"
665 else
666 LDSHARED="ld -Bshareable ${LDFLAGS}"
667 fi;;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000668 UnixWare*)
669 if test "$GCC" = "yes"
670 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000671 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000672 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000673 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000674 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000675 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000676 *) LDSHARED="ld";;
677 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000678fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000679AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000680BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000681# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000682# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000683AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000684if test -z "$CCSHARED"
685then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000686 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000687 SunOS*) if test "$GCC" = yes;
688 then CCSHARED="-fPIC";
689 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000690 hp*|HP*) if test "$GCC" = yes;
691 then CCSHARED="-fpic";
692 else CCSHARED="+z";
693 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000694 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000695 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000696 OpenBSD*) CCSHARED="-fpic";;
697 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000698 UnixWare*)
699 if test "$GCC" = "yes"
700 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000701 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000702 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000703 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000704 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000705 IRIX*/6*) case $CC in
706 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000707 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000708 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000709 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000710 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000711fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000712AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000713# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000714# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000715AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000716if test -z "$LINKFORSHARED"
717then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000718 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000719 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000720 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000721 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000722 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000723 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000724 # -u libsys_s pulls in all symbols in libsys
725 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
726 # -u __dummy makes the linker aware of the objc runtime
727 # in System.framework; otherwise, __objcInit (referenced in
728 # crt1.o) gets erroneously defined as common, which breaks dynamic
729 # loading of any modules which reference it in System.framework
730 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Jack Jansenc49e5b72001-06-19 15:00:23 +0000731 Darwin/*) LINKFORSHARED="-u __dummy -u _PyMac_Error -framework System -framework Foundation -framework Carbon" ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000732 UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000733 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000734 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000735 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000736 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
737 then
738 LINKFORSHARED="-Wl,--export-dynamic"
739 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000740 SunOS/5*) case $CC in
741 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000742 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000743 then
744 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000745 fi;;
746 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000747 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000748fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000749AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000750
Neil Schemenauer61c51152001-01-26 16:18:16 +0000751AC_SUBST(CFLAGSFORSHARED)
752AC_MSG_CHECKING(CFLAGSFORSHARED)
753if test ! "$LIBRARY" = "$LDLIBRARY"
754then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000755 case $ac_sys_system in
756 CYGWIN*)
757 # Cygwin needs CCSHARED when building extension DLLs
758 # but not when building the interpreter DLL.
759 CFLAGSFORSHARED='';;
760 *)
761 CFLAGSFORSHARED='$(CCSHARED)'
762 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000763fi
764AC_MSG_RESULT($CFLAGSFORSHARED)
765
Guido van Rossum627b2d71993-12-24 10:39:16 +0000766# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000767AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
768AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000769
770# checks for system dependent C++ extensions support
771case "$ac_sys_system" in
772 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
773 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
774 [loadAndInit("", 0, "")],
775 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
776 AC_MSG_RESULT(yes)],
777 [AC_MSG_RESULT(no)]);;
778 *) ;;
779esac
780
Guido van Rossum70c7f481998-03-26 18:44:10 +0000781# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
782# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000783# BeOS' sockets are stashed in libnet.
784case "$ac_sys_system" in
785IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000786*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000787AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000788AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000789;;
790esac
791case "$ac_sys_system" in
792BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000793AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
794;;
795esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000796
Guido van Rossumc5a39031996-07-31 17:35:03 +0000797AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000798AC_ARG_WITH(libs,
799[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000800AC_MSG_RESULT($withval)
801LIBS="$withval $LIBS"
802], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000803
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000804# Determine if signalmodule should be used.
805AC_SUBST(USE_SIGNAL_MODULE)
806AC_SUBST(SIGNAL_OBJS)
807AC_MSG_CHECKING(for --with-signal-module)
808AC_ARG_WITH(signal-module,
809[ --with-signal-module disable/enable signal module])
810
811if test -z "$with_signal_module"
812then with_signal_module="yes"
813fi
814AC_MSG_RESULT($with_signal_module)
815
816if test "${with_signal_module}" = "yes"; then
817 USE_SIGNAL_MODULE=""
818 SIGNAL_OBJS=""
819else
820 USE_SIGNAL_MODULE="#"
821 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
822fi
823
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000824# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000825AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000826USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000827
Guido van Rossum54d93d41997-01-22 20:51:58 +0000828AC_MSG_CHECKING(for --with-dec-threads)
829AC_SUBST(LDLAST)
830AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d82000-06-29 16:12:00 +0000831[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
832AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000833LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000834if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000835 with_thread="$withval";
836fi],
837AC_MSG_RESULT(no))
838
839AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000840AC_ARG_WITH(threads,
841[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000842
Barry Warsawc0d24d82000-06-29 16:12:00 +0000843# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000844AC_ARG_WITH(thread,
845[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
846with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +0000847
848if test -z "$with_threads"
849then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000850fi
Barry Warsawc0d24d82000-06-29 16:12:00 +0000851AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000852
Barry Warsawc0d24d82000-06-29 16:12:00 +0000853if test "$with_threads" = "no"
854then
855 USE_THREAD_MODULE="#"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000856elif test "$ac_cv_kpthread" = "yes"
857then
858 CC="$CC -Kpthread"
859 AC_DEFINE(WITH_THREAD)
860 AC_DEFINE(_POSIX_THREADS)
861 LIBOBJS="$LIBOBJS thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +0000862else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000863 if test ! -z "$with_threads" -a -d "$with_threads"
864 then LDFLAGS="$LDFLAGS -L$with_threads"
865 fi
866 if test ! -z "$withval" -a -d "$withval"
867 then LDFLAGS="$LDFLAGS -L$withval"
868 fi
869 AC_DEFINE(_REENTRANT)
870 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
871 AC_DEFINE(C_THREADS)
872 LIBOBJS="$LIBOBJS thread.o"],[
873 AC_MSG_CHECKING(for --with-pth)
874 AC_ARG_WITH(pth,
875 [ --with-pth use GNU pth threading libraries], [
876 AC_MSG_RESULT($withval)
877 AC_DEFINE(WITH_THREAD)
878 AC_DEFINE(HAVE_PTH)
879 LIBS="-lpth $LIBS"
880 LIBOBJS="$LIBOBJS thread.o"],[
881 AC_MSG_RESULT(no)
882 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000883 case $ac_sys_system in
884 Darwin*) ;;
885 *) AC_DEFINE(_POSIX_THREADS);;
886 esac
Martin v. Löwis130fb172001-07-19 11:00:41 +0000887 LIBS="-lpthread $LIBS"
888 LIBOBJS="$LIBOBJS thread.o"],[
889 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
890 case $ac_sys_system in
891 Darwin*) ;;
892 *) AC_DEFINE(_POSIX_THREADS);;
893 esac
894 LIBOBJS="$LIBOBJS thread.o"],[
895 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
896 AC_DEFINE(BEOS_THREADS)
897 LIBOBJS="$LIBOBJS thread.o"],[
898 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
899 AC_DEFINE(_POSIX_THREADS)
900 LIBS="$LIBS -lpthreads"
901 LIBOBJS="$LIBOBJS thread.o"], [
902 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
903 AC_DEFINE(_POSIX_THREADS)
904 LIBS="$LIBS -lc_r"
905 LIBOBJS="$LIBOBJS thread.o"], [
906 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
907 AC_DEFINE(_POSIX_THREADS)
908 LIBS="$LIBS -lthread"
909 LIBOBJS="$LIBOBJS thread.o"], [
910 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
911 AC_DEFINE(_POSIX_THREADS)
912 LIBS="$LIBS -lpthread"
913 LIBOBJS="$LIBOBJS thread.o"], [
914 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
915 AC_DEFINE(_POSIX_THREADS)
916 LIBS="$LIBS -lcma"
917 LIBOBJS="$LIBOBJS thread.o"],[
918 USE_THREAD_MODULE="#"])
919 ])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +0000920
Martin v. Löwis130fb172001-07-19 11:00:41 +0000921 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
922 LIBS="$LIBS -lmpc"
923 LIBOBJS="$LIBOBJS thread.o"
924 USE_THREAD_MODULE=""])
925 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
926 LIBS="$LIBS -lthread"
927 LIBOBJS="$LIBOBJS thread.o"
928 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +0000929
Martin v. Löwis130fb172001-07-19 11:00:41 +0000930 if test "$USE_THREAD_MODULE" != "#"
931 then
932 # If the above checks didn't disable threads, (at least) OSF1
933 # needs this '-threads' argument during linking.
934 case $ac_sys_system in
935 OSF1) LDLAST=-threads;;
936 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +0000937 fi
Barry Warsawc0d24d82000-06-29 16:12:00 +0000938fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000939
Martin v. Löwisa2ac6022001-08-09 11:40:14 +0000940# Check for enable-ipv6
941AC_MSG_CHECKING([whether to enable ipv6])
942AC_ARG_ENABLE(ipv6,
943[ --enable-ipv6 Enable ipv6 (with ipv4) support
944 --disable-ipv6 Disable ipv6 support],
945[ case "$enableval" in
946 no)
947 AC_MSG_RESULT(no)
948 ipv6=no
949 ;;
950 *) AC_MSG_RESULT(yes)
951 AC_DEFINE(ENABLE_IPV6)
952 ipv6=yes
953 ;;
954 esac ],
955
956 AC_TRY_RUN([ /* AF_INET6 available check */
957#include <sys/types.h>
958#include <sys/socket.h>
959main()
960{
961 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
962 exit(1);
963 else
964 exit(0);
965}
966],
967 AC_MSG_RESULT(yes)
968 AC_DEFINE(ENABLE_IPV6)
969 ipv6=yes,
970 AC_MSG_RESULT(no)
971 ipv6=no,
972 AC_MSG_RESULT(no)
973 ipv6=no
974))
975
976ipv6type=unknown
977ipv6lib=none
978ipv6trylibc=no
979
980if test "$ipv6" = "yes"; then
981 AC_MSG_CHECKING([ipv6 stack type])
982 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta; do
983 case $i in
984 inria)
985 dnl http://www.kame.net/
986 AC_EGREP_CPP(yes, [dnl
987#include <netinet/in.h>
988#ifdef IPV6_INRIA_VERSION
989yes
990#endif],
991 [ipv6type=$i;
992 OPT="-DINET6 $OPT"])
993 ;;
994 kame)
995 dnl http://www.kame.net/
996 AC_EGREP_CPP(yes, [dnl
997#include <netinet/in.h>
998#ifdef __KAME__
999yes
1000#endif],
1001 [ipv6type=$i;
1002 ipv6lib=inet6
1003 ipv6libdir=/usr/local/v6/lib
1004 ipv6trylibc=yes
1005 OPT="-DINET6 $OPT"])
1006 ;;
1007 linux-glibc)
1008 dnl http://www.v6.linux.or.jp/
1009 AC_EGREP_CPP(yes, [dnl
1010#include <features.h>
1011#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1012yes
1013#endif],
1014 [ipv6type=$i;
1015 ipv6trylibc=yes
1016 OPT="-DINET6 $OPT"])
1017 ;;
1018 linux-inet6)
1019 dnl http://www.v6.linux.or.jp/
1020 if test -d /usr/inet6; then
1021 ipv6type=$i
1022 ipv6lib=inet6
1023 ipv6libdir=/usr/inet6/lib
1024 OPT="-DINET6 -I/usr/inet6/include $OPT"
1025 fi
1026 ;;
1027 solaris)
1028 if test -f /etc/netconfig; then
1029 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1030 ipv6type=$i
1031 ipv6trylibc=yes
1032 OPT="-DINET6 $OPT"
1033 fi
1034 fi
1035 ;;
1036 toshiba)
1037 AC_EGREP_CPP(yes, [dnl
1038#include <sys/param.h>
1039#ifdef _TOSHIBA_INET6
1040yes
1041#endif],
1042 [ipv6type=$i;
1043 ipv6lib=inet6;
1044 ipv6libdir=/usr/local/v6/lib;
1045 OPT="-DINET6 $OPT"])
1046 ;;
1047 v6d)
1048 AC_EGREP_CPP(yes, [dnl
1049#include </usr/local/v6/include/sys/v6config.h>
1050#ifdef __V6D__
1051yes
1052#endif],
1053 [ipv6type=$i;
1054 ipv6lib=v6;
1055 ipv6libdir=/usr/local/v6/lib;
1056 OPT="-I/usr/local/v6/include $OPT"])
1057 ;;
1058 zeta)
1059 AC_EGREP_CPP(yes, [dnl
1060#include <sys/param.h>
1061#ifdef _ZETA_MINAMI_INET6
1062yes
1063#endif],
1064 [ipv6type=$i;
1065 ipv6lib=inet6;
1066 ipv6libdir=/usr/local/v6/lib;
1067 OPT="-DINET6 $OPT"])
1068 ;;
1069 esac
1070 if test "$ipv6type" != "unknown"; then
1071 break
1072 fi
1073 done
1074 AC_MSG_RESULT($ipv6type)
1075fi
1076
1077if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1078 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1079 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1080 echo "using lib$ipv6lib"
1081 else
1082 if test $ipv6trylibc = "yes"; then
1083 echo "using libc"
1084 else
1085 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1086 echo "You need to fetch lib$ipv6lib.a from appropriate"
1087 echo 'ipv6 kit and compile beforehand.'
1088 exit 1
1089 fi
1090 fi
1091fi
1092
Barry Warsawef82cd72000-06-30 16:21:01 +00001093# Check for GC support
1094AC_SUBST(USE_GC_MODULE)
1095USE_GC_MODULE=""
1096AC_MSG_CHECKING(for --with-cycle-gc)
1097AC_ARG_WITH(cycle-gc,
1098[ --with(out)-cycle-gc disable/enable garbage collection])
1099
1100if test -z "$with_cycle_gc"
1101then with_cycle_gc="yes"
1102fi
1103if test "$with_cycle_gc" = "no"
1104then
1105 USE_GC_MODULE="#"
1106else
1107 AC_DEFINE(WITH_CYCLE_GC)
1108fi
1109AC_MSG_RESULT($with_cycle_gc)
1110
Neil Schemenauera35c6882001-02-27 04:45:05 +00001111# Check for Python-specific malloc support
1112AC_MSG_CHECKING(for --with-pymalloc)
1113AC_ARG_WITH(pymalloc,
1114[ --with(out)-pymalloc disable/enable specialized mallocs], [
1115if test "$withval" != no
1116then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1117else AC_MSG_RESULT(no)
1118fi],
1119[AC_MSG_RESULT(no)])
1120
Barry Warsawef82cd72000-06-30 16:21:01 +00001121# Check for --with-wctype-functions
1122AC_MSG_CHECKING(for --with-wctype-functions)
1123AC_ARG_WITH(wctype-functions,
1124[ --with-wctype-functions use wctype.h functions], [
1125if test "$withval" != no
1126then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1127else AC_MSG_RESULT(no)
1128fi],
1129[AC_MSG_RESULT(no)])
1130
Guido van Rossum68242b51996-05-28 22:53:03 +00001131# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001132AC_SUBST(DLINCLDIR)
1133DLINCLDIR=/
1134
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001135AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001136AC_ARG_WITH(sgi-dl,
1137[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001138AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001139AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +00001140DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001141dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001142if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001143then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001144else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1145fi
1146DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001147LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001148
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001149AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001150AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001151AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001152AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001153DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001154dldir=`echo "$withval" | sed 's/,.*//'`
1155dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001156if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001157then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001158else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1159fi
1160DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001161LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001162
Guido van Rossume97ee181999-12-20 21:27:22 +00001163# the dlopen() function means we might want to use dynload_shlib.o. some
1164# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001165AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001166
1167# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1168# loading of modules.
1169AC_SUBST(DYNLOADFILE)
1170AC_MSG_CHECKING(DYNLOADFILE)
1171if test -z "$DYNLOADFILE"
1172then
1173 case $ac_sys_system/$ac_sys_release in
1174 AIX*) DYNLOADFILE="dynload_aix.o";;
1175 BeOS*) DYNLOADFILE="dynload_beos.o";;
1176 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Guido van Rossum5839e582000-10-09 19:52:35 +00001177 Darwin/*|next/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001178 *)
1179 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1180 # out any dynamic loading
1181 if test "$ac_cv_func_dlopen" = yes
1182 then DYNLOADFILE="dynload_shlib.o"
1183 else DYNLOADFILE="dynload_stub.o"
1184 fi
1185 ;;
1186 esac
1187fi
1188AC_MSG_RESULT($DYNLOADFILE)
1189if test "$DYNLOADFILE" != "dynload_stub.o"
1190then
1191 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1192fi
1193
Jack Jansenc49e5b72001-06-19 15:00:23 +00001194# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1195
1196AC_SUBST(MACHDEP_OBJS)
1197AC_MSG_CHECKING(MACHDEP_OBJS)
1198if test -z "$MACHDEP_OBJS"
1199then
1200 case $ac_sys_system/$ac_sys_release in
1201 Darwin/*)
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001202 MACHDEP_OBJS="Python/mactoolboxglue.o"
Jack Jansenc49e5b72001-06-19 15:00:23 +00001203 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
1204 ;;
1205 *) MACHDEP_OBJS="";;
1206 esac
1207fi
1208AC_MSG_RESULT($DYNLOADFILE)
1209
Guido van Rossum627b2d71993-12-24 10:39:16 +00001210# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001211AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001212 flock fork fsync fdatasync fpathconf ftime ftruncate \
Andrew M. Kuchlinga9586c72001-01-08 17:58:56 +00001213 getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwis864e9ff2001-08-04 22:32:03 +00001214 hstrerror inet_pton kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001215 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001216 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001217 select setegid seteuid setgid \
Martin v. Löwis791bfda2001-07-24 06:33:08 +00001218 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
Fred Drake35a092f1999-12-13 16:23:35 +00001219 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001220 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Woutersc2c12dc2001-07-11 14:45:34 +00001221 truncate uname waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001222
Fred Drake8cef4cf2000-06-28 16:40:38 +00001223# check for openpty and forkpty
1224
1225AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1226AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1227
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001228# check for long file support functions
1229AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1230
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001231AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001232AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1233AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1234AC_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 +00001235
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001236AC_CHECK_FUNCS(getaddrinfo, [dnl
1237AC_MSG_CHECKING(getaddrinfo bug)
1238AC_TRY_RUN([
1239#include <sys/types.h>
1240#include <netdb.h>
1241#include <string.h>
1242#include <sys/socket.h>
1243#include <netinet/in.h>
1244
1245main()
1246{
1247 int passive, gaierr, inet4 = 0, inet6 = 0;
1248 struct addrinfo hints, *ai, *aitop;
1249 char straddr[INET6_ADDRSTRLEN], strport[16];
1250
1251 for (passive = 0; passive <= 1; passive++) {
1252 memset(&hints, 0, sizeof(hints));
1253 hints.ai_family = AF_UNSPEC;
1254 hints.ai_flags = passive ? AI_PASSIVE : 0;
1255 hints.ai_socktype = SOCK_STREAM;
1256 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1257 (void)gai_strerror(gaierr);
1258 goto bad;
1259 }
1260 for (ai = aitop; ai; ai = ai->ai_next) {
1261 if (ai->ai_addr == NULL ||
1262 ai->ai_addrlen == 0 ||
1263 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1264 straddr, sizeof(straddr), strport, sizeof(strport),
1265 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1266 goto bad;
1267 }
1268 switch (ai->ai_family) {
1269 case AF_INET:
1270 if (strcmp(strport, "54321") != 0) {
1271 goto bad;
1272 }
1273 if (passive) {
1274 if (strcmp(straddr, "0.0.0.0") != 0) {
1275 goto bad;
1276 }
1277 } else {
1278 if (strcmp(straddr, "127.0.0.1") != 0) {
1279 goto bad;
1280 }
1281 }
1282 inet4++;
1283 break;
1284 case AF_INET6:
1285 if (strcmp(strport, "54321") != 0) {
1286 goto bad;
1287 }
1288 if (passive) {
1289 if (strcmp(straddr, "::") != 0) {
1290 goto bad;
1291 }
1292 } else {
1293 if (strcmp(straddr, "::1") != 0) {
1294 goto bad;
1295 }
1296 }
1297 inet6++;
1298 break;
1299 case AF_UNSPEC:
1300 goto bad;
1301 break;
1302 default:
1303 /* another family support? */
1304 break;
1305 }
1306 }
1307 }
1308
1309 if (!(inet4 == 0 || inet4 == 2))
1310 goto bad;
1311 if (!(inet6 == 0 || inet6 == 2))
1312 goto bad;
1313
1314 if (aitop)
1315 freeaddrinfo(aitop);
1316 exit(0);
1317
1318 bad:
1319 if (aitop)
1320 freeaddrinfo(aitop);
1321 exit(1);
1322}
1323],
1324AC_MSG_RESULT(good)
1325buggygetaddrinfo=no,
1326AC_MSG_RESULT(buggy)
1327buggygetaddrinfo=yes,
1328AC_MSG_RESULT(buggy)
1329buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
1330
1331if test "$buggygetaddrinfo" = "yes"; then
1332 if test "$ipv6" = "yes"; then
1333 echo 'Fatal: You must get working getaddrinfo() function.'
1334 echo ' or you can specify "--disable-ipv6"'.
1335 exit 1
1336 fi
1337fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00001338AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001339
Guido van Rossum627b2d71993-12-24 10:39:16 +00001340# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001341AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001342AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001343AC_STRUCT_TIMEZONE
1344
1345AC_MSG_CHECKING(for time.h that defines altzone)
1346AC_CACHE_VAL(ac_cv_header_time_altzone,
1347[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1348 ac_cv_header_time_altzone=yes,
1349 ac_cv_header_time_altzone=no)])
1350AC_MSG_RESULT($ac_cv_header_time_altzone)
1351if test $ac_cv_header_time_altzone = yes; then
1352 AC_DEFINE(HAVE_ALTZONE)
1353fi
1354
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001355was_it_defined=no
1356AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001357AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001358#include <sys/types.h>
1359#include <sys/select.h>
1360#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001361], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1362AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001363
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001364AC_MSG_CHECKING(for addrinfo)
1365AC_CACHE_VAL(ac_cv_struct_addrinfo,
1366AC_TRY_COMPILE([
1367# include <netdb.h>],
1368 [struct addrinfo a],
1369 ac_cv_struct_addrinfo=yes,
1370 ac_cv_struct_addrinfo=no))
1371AC_MSG_RESULT($ac_cv_struct_addrinfo)
1372if test $ac_cv_struct_addrinfo = yes; then
1373 AC_DEFINE(HAVE_ADDRINFO)
1374fi
1375
1376AC_MSG_CHECKING(for sockaddr_storage)
1377AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1378AC_TRY_COMPILE([
1379# include <sys/types.h>
1380# include <sys/socket.h>],
1381 [struct sockaddr_storage s],
1382 ac_cv_struct_sockaddr_storage=yes,
1383 ac_cv_struct_sockaddr_storage=no))
1384AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1385if test $ac_cv_struct_sockaddr_storage = yes; then
1386 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1387fi
1388
Guido van Rossum627b2d71993-12-24 10:39:16 +00001389# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001390
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001391AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001392AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001393
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001394works=no
1395AC_MSG_CHECKING(for working volatile)
1396AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1397AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001398
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001399works=no
1400AC_MSG_CHECKING(for working signed char)
1401AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1402AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001403
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001404have_prototypes=no
1405AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001406AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1407AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001408AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001409
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001410works=no
1411AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001412AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001413#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001414int foo(int x, ...) {
1415 va_list va;
1416 va_start(va, x);
1417 va_arg(va, int);
1418 va_arg(va, char *);
1419 va_arg(va, double);
1420 return 0;
1421}
1422], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001423AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1424AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001425
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001426if test "$have_prototypes" = yes; then
1427bad_prototypes=no
1428AC_MSG_CHECKING(for bad exec* prototypes)
1429AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1430 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1431AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001432fi
1433
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001434# check if sockaddr has sa_len member
1435AC_MSG_CHECKING(if sockaddr has sa_len member)
1436AC_TRY_COMPILE([#include <sys/types.h>
1437#include <sys/socket.h>],
1438[struct sockaddr x;
1439x.sa_len = 0;],
1440 AC_MSG_RESULT(yes)
1441 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1442 AC_MSG_RESULT(no))
1443
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001444AC_MSG_CHECKING(for bad static forward)
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001445AC_CACHE_VAL(ac_cv_bad_static_forward,
1446[AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001447struct s { int a; int b; };
1448static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001449int foobar() {
1450 static int random;
1451 random = (int) &foo;
1452 return random;
1453}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001454static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001455main() {
1456 exit(!((int)&foo == foobar()));
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001457}], ac_cv_bad_static_forward=no, ac_cv_bad_static_forward=yes)])
1458AC_MSG_RESULT($ac_cv_bad_static_forward)
1459if test "$ac_cv_bad_static_forward" = yes
1460then
1461 AC_DEFINE(BAD_STATIC_FORWARD)
1462fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001463
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001464va_list_is_array=no
1465AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001466AC_TRY_COMPILE([
1467#ifdef HAVE_STDARG_PROTOTYPES
1468#include <stdarg.h>
1469#else
1470#include <varargs.h>
1471#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001472], [va_list list1, list2; list1 = list2;], ,
1473AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1474AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001475
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001476# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1477AC_CHECK_FUNC(gethostbyname_r, [
1478 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1479 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1480 OLD_CFLAGS=$CFLAGS
1481 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1482 AC_TRY_COMPILE([
1483# include <netdb.h>
1484 ], [
1485 char *name;
1486 struct hostent *he, *res;
1487 char buffer[2048];
1488 int buflen = 2048;
1489 int h_errnop;
1490
1491 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1492 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001493 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001494 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1495 AC_MSG_RESULT(yes)
1496 ], [
1497 AC_MSG_RESULT(no)
1498 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1499 AC_TRY_COMPILE([
1500# include <netdb.h>
1501 ], [
1502 char *name;
1503 struct hostent *he;
1504 char buffer[2048];
1505 int buflen = 2048;
1506 int h_errnop;
1507
1508 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1509 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001510 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001511 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1512 AC_MSG_RESULT(yes)
1513 ], [
1514 AC_MSG_RESULT(no)
1515 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1516 AC_TRY_COMPILE([
1517# include <netdb.h>
1518 ], [
1519 char *name;
1520 struct hostent *he;
1521 struct hostent_data data;
1522
1523 (void) gethostbyname_r(name, he, &data);
1524 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001525 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001526 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1527 AC_MSG_RESULT(yes)
1528 ], [
1529 AC_MSG_RESULT(no)
1530 ])
1531 ])
1532 ])
1533 CFLAGS=$OLD_CFLAGS
1534], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001535 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001536])
1537AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1538AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1539AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001540AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001541AC_SUBST(HAVE_GETHOSTBYNAME)
1542
Guido van Rossum627b2d71993-12-24 10:39:16 +00001543# checks for system services
1544# (none yet)
1545
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001546# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001547AC_CHECK_FUNC(__fpu_control,
1548 [],
1549 [AC_CHECK_LIB(ieee, __fpu_control)
1550])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001551
Guido van Rossum93274221997-05-09 02:42:00 +00001552# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001553AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001554AC_ARG_WITH(fpectl,
1555[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001556if test "$withval" != no
1557then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1558else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001559fi],
1560[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001561
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001562# check for --with-libm=...
1563AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001564case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001565Darwin) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001566next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001567BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001568*) LIBM=-lm
1569esac
Guido van Rossum93274221997-05-09 02:42:00 +00001570AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001571AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001572if test "$withval" = no
1573then LIBM=
1574 AC_MSG_RESULT(force LIBM empty)
1575elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001576then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001577 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001578else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001579fi],
1580[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001581
1582# check for --with-libc=...
1583AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001584AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001585AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001586if test "$withval" = no
1587then LIBC=
1588 AC_MSG_RESULT(force LIBC empty)
1589elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001590then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001591 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001592else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001593fi],
1594[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001595
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001596# check for hypot() in math library
1597LIBS_SAVE=$LIBS
1598LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001599AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001600LIBS=$LIBS_SAVE
1601
Guido van Rossumad713701997-07-10 22:42:38 +00001602# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001603AC_MSG_CHECKING(what malloc(0) returns)
1604AC_CACHE_VAL(ac_cv_malloc_zero,
1605[AC_TRY_RUN([#include <stdio.h>
1606#ifdef HAVE_STDLIB
1607#include <stdlib.h>
1608#else
1609char *malloc(), *realloc();
1610int *free();
1611#endif
1612main() {
1613 char *p;
1614 p = malloc(0);
1615 if (p == NULL) exit(1);
1616 p = realloc(p, 0);
1617 if (p == NULL) exit(1);
1618 free(p);
1619 exit(0);
1620}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1621AC_MSG_RESULT($ac_cv_malloc_zero)
1622if test "$ac_cv_malloc_zero" = null
1623then
1624 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1625fi
1626
Guido van Rossumef2255b2000-03-10 22:30:29 +00001627# check for wchar.h
1628AC_CHECK_HEADER(wchar.h,
1629AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1630wchar_h="no"
1631)
1632
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001633# determine wchar_t size
1634if test "$wchar_h" = yes
1635then
1636 AC_CHECK_SIZEOF(wchar_t)
1637fi
1638
1639AC_MSG_CHECKING(what type to use for unicode)
1640AC_ARG_ENABLE(unicode,
1641[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1642
1643if test $enable_unicode = yes
1644then
Martin v. Löwisfd917792001-06-27 20:22:04 +00001645 # Without any arguments, Py_UNICODE defaults to two-byte mode
1646 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001647fi
1648
1649case "$enable_unicode" in
1650ucs2) unicode_size="2"
1651 AC_DEFINE(Py_UNICODE_SIZE,2)
1652 ;;
1653ucs4) unicode_size="4"
1654 AC_DEFINE(Py_UNICODE_SIZE,4)
1655 ;;
1656esac
1657
1658if test "$enable_unicode" = "no"
1659then
1660 AC_MSG_RESULT(not used)
1661else
1662 AC_DEFINE(Py_USING_UNICODE)
1663 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1664 then
1665 PY_UNICODE_TYPE="wchar_t"
1666 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1667 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1668 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1669 then
1670 PY_UNICODE_TYPE="unsigned short"
1671 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1672 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1673 then
1674 PY_UNICODE_TYPE="unsigned long"
1675 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1676 else
1677 PY_UNICODE_TYPE="no type found"
1678 fi
1679 AC_MSG_RESULT($PY_UNICODE_TYPE)
1680fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00001681
1682# check for endianness
1683AC_C_BIGENDIAN
1684
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001685# Check whether right shifting a negative integer extends the sign bit
1686# or fills with zeros (like the Cray J90, according to Tim Peters).
1687AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001688AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001689AC_TRY_RUN([
1690int main()
1691{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001692 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001693}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001694], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1695AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1696if test "$ac_cv_rshift_extends_sign" = no
1697then
1698 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1699fi
1700
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001701# check for getc_unlocked and related locking functions
1702AC_MSG_CHECKING(for getc_unlocked() and friends)
1703AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1704AC_TRY_LINK([#include <stdio.h>],[
1705 FILE *f = fopen("/dev/null", "r");
1706 flockfile(f);
1707 getc_unlocked(f);
1708 funlockfile(f);
1709], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1710AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1711if test "$ac_cv_have_getc_unlocked" = yes
1712then
1713 AC_DEFINE(HAVE_GETC_UNLOCKED)
1714fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001715
Guido van Rossum353ae582001-07-10 16:45:32 +00001716# check for readline 4.2
1717AC_CHECK_LIB(readline, rl_completion_matches,
1718 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1719
Thomas Wouterse38b2f12001-07-11 22:35:31 +00001720AC_MSG_CHECKING(for broken nice())
1721AC_CACHE_VAL(ac_cv_broken_nice, [
1722AC_TRY_RUN([
1723int main()
1724{
1725 int val1 = nice(1);
1726 if (val1 != -1 && val1 == nice(2))
1727 exit(0);
1728 exit(1);
1729}
1730],ac_cv_broken_nice=yes, ac_cv_broken_nice=no)])
1731AC_MSG_RESULT($ac_cv_broken_nice)
1732if test "$ac_cv_broken_nice" = yes
1733then
1734 AC_DEFINE(HAVE_BROKEN_NICE)
1735fi
1736
Guido van Rossum95713eb2000-05-18 20:53:31 +00001737# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1738# Add sys/socket.h to confdefs.h
1739cat >> confdefs.h <<\EOF
1740#ifdef HAVE_SYS_SOCKET_H
1741#include <sys/socket.h>
1742#endif
1743EOF
1744AC_CHECK_TYPE(socklen_t, int)
1745
Neil Schemenauerf25cf6c2001-03-04 06:39:33 +00001746# Add Python/ prefix to LIBOBJS
1747libobjs=$LIBOBJS
1748LIBOBJS=
1749for obj in $libobjs; do
1750 LIBOBJS="$LIBOBJS Python/$obj"
1751done
1752
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001753#AC_MSG_CHECKING(for Modules/Setup)
1754#if test ! -f Modules/Setup ; then
1755# if test ! -d Modules ; then
1756# mkdir Modules
1757# fi
1758# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1759# AC_MSG_RESULT(creating)
1760#else
1761# AC_MSG_RESULT(already exists)
1762#fi
1763
1764AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00001765SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001766AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001767for dir in $SRCDIRS; do
1768 if test ! -d $dir; then
1769 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001770 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001771done
1772AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001773
Guido van Rossum627b2d71993-12-24 10:39:16 +00001774# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001775AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001776
1777echo "creating Setup"
1778if test ! -f Modules/Setup
1779then
1780 cp $srcdir/Modules/Setup.dist Modules/Setup
1781fi
1782
1783echo "creating Setup.local"
1784if test ! -f Modules/Setup.local
1785then
1786 echo "# Edit this file for local setup changes" >Modules/Setup.local
1787fi
1788
1789echo "creating Makefile"
1790$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1791 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00001792 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00001793mv config.c Modules