blob: 2192d4c91fd138bd8da6310c8f7a89b86cff9788 [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 Warsawc0d24d8b2000-06-29 16:12:00 +000020 [ --with-next-archs='arch1 arch2 ..' build MAB binary], [
Guido van Rossum4b6b5791996-09-09 20:09:34 +000021 if test -n "$withval"; then
Guido van Rossum2bb4f551996-09-10 18:19:59 +000022 ac_arch_flags=`/usr/lib/arch_tool -archify_list $withval`
23 # GCC does not currently support multi archs on the NeXT
24 with_gcc=no
Guido van Rossum4b6b5791996-09-09 20:09:34 +000025 fi
26 AC_MSG_RESULT($with_next_archs)
27 ], [AC_MSG_RESULT(none: using `arch`)])
28
29 if test -z "$MACHDEP"
30 then
Guido van Rossum3dc0a512000-10-05 18:00:06 +000031 ac_sys_system=`uname -s`
32 if test "$ac_sys_system" = "Darwin" ; then
33 ac_sys_release=`uname -r`
34 else
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000035 set X `hostinfo | egrep '(NeXT Mach|Kernel Release).*:' | \
Guido van Rossum3dc0a512000-10-05 18:00:06 +000036 sed -e 's/://' -e 's/\./_/'` && \
37 ac_sys_system=next && ac_sys_release=$4
38 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000039
Guido van Rossum3dc0a512000-10-05 18:00:06 +000040 MACHDEP="$ac_sys_system$ac_sys_release"
Guido van Rossumb418f891996-07-30 18:06:02 +000041 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000042fi
Guido van Rossumb418f891996-07-30 18:06:02 +000043
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000044AC_ARG_WITH(next-framework,
Guido van Rossum3dc0a512000-10-05 18:00:06 +000045[ --with-next-framework Build (OpenStep|Rhapsody|MacOSX|Darwin) framework],,)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000046AC_ARG_WITH(dyld,
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 Warsawc0d24d8b2000-06-29 16:12:00 +000092AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000093 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000094 no) CC=cc
95 without_gcc=yes;;
96 yes) CC=gcc
97 without_gcc=no;;
98 *) CC=$withval
99 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000100 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000101 case $ac_sys_system in
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 Warsawc0d24d8b2000-06-29 16:12:00 +0000136AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000137 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000138 case $withval in
139 no) CXX=
140 with_cxx=no;;
141 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000142 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000143 with_cxx=$withval;;
144 esac], [
145 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000146 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000147])
148AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000149
150dnl The following fragment works similar to AC_PROG_CXX.
151dnl It does not fail if CXX is not found, and it is not executed if
152dnl --with-cxx was given.
153dnl Finally, it does not test whether CXX is g++.
154
155if test "$check_cxx" = "yes"
156then
157 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
158 if test "$CXX" = "notfound"
159 then
160 CXX=
161 else
162 AC_PROG_CXX_WORKS
163 fi
164fi
165
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000166# If the user switches compilers, we can't believe the cache
167if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
168then
169 AC_ERROR(cached CC is different -- throw away $cache_file
170(it is also a good idea to do 'make clean' before compiling))
171fi
172
Guido van Rossum627b2d71993-12-24 10:39:16 +0000173AC_PROG_CC
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000174AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000175AC_MSG_CHECKING(for --with-suffix)
176AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
177 case $withval in
178 no) EXEEXT=;;
179 yes) EXEEXT=.exe;;
180 *) EXEEXT=$withval;;
181 esac])
182AC_MSG_RESULT($EXEEXT)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000183# Test whether we're running on a non-case-sensitive system, in which
184# case we give a warning if no ext is given
185if test -d "python" -a -z "$EXEEXT"
186then
187 AC_MSG_WARN(This filesystem is not case-sensitive so you should probably use --with-suffix)
188fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000189
Guido van Rossumdd997f71998-10-07 19:58:26 +0000190case $MACHDEP in
191bsdos*)
192 case $CC in
193 gcc) CC="$CC -D_HAVE_BSDI";;
194 esac;;
195esac
196
Guido van Rossum84561611997-08-21 00:08:11 +0000197case $ac_sys_system in
198hp*|HP*)
199 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000200 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000201 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000202Monterey*)
203 case $CC in
204 cc) CC="$CC -Wl,-Bexport";;
205 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000206SunOS*)
207 # Some functions have a prototype only with that define, e.g. confstr
208 AC_DEFINE(__EXTENSIONS__)
209 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000210esac
211
Martin v. Löwise8964d42001-03-06 12:09:07 +0000212
Neil Schemenauer61c51152001-01-26 16:18:16 +0000213AC_SUBST(LIBRARY)
214AC_MSG_CHECKING(LIBRARY)
215if test -z "$LIBRARY"
216then
217 LIBRARY='libpython$(VERSION).a'
218fi
219AC_MSG_RESULT($LIBRARY)
220
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000221# LDLIBRARY is the name of the library to link against (as opposed to the
222# name of the library into which to insert object files). On systems
223# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
Guido van Rossumaef734b2001-01-10 21:09:12 +0000224# the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the
225# shared (i.e., DLL) library.
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000226AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000227AC_SUBST(DLLLIBRARY)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000228LDLIBRARY="$LIBRARY"
Guido van Rossum27552902001-01-23 01:52:26 +0000229DLLLIBRARY=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000230
Guido van Rossumfb842551997-08-06 23:42:07 +0000231# LINKCC is the command that links the python executable -- default is $(CC).
Fred Drake5790be12000-10-09 17:06:13 +0000232# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000233# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000234AC_SUBST(LINKCC)
235AC_MSG_CHECKING(LINKCC)
236if test -z "$LINKCC"
237then
238 case $ac_sys_system in
239 AIX*)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000240 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000241 dgux*)
242 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000243 Monterey64*)
244 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000245 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000246 esac
247fi
248AC_MSG_RESULT($LINKCC)
249
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000250AC_MSG_CHECKING(LDLIBRARY)
251
252# NeXT framework builds require that the 'ar' library be converted into
253# a bundle using libtool.
254if test "$with_next_framework"
255then
256 LDLIBRARY='libpython$(VERSION).dylib'
Jack Jansenca06bc62001-08-03 15:32:23 +0000257 DLLLIBRARY=$LDLIBRARY
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000258fi
259
260# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000261case $MACHDEP in
262dguxR4)
263 LDLIBRARY='libpython$(VERSION).so'
264 OPT="$OPT -pic"
265 ;;
266beos*)
267 LDLIBRARY='libpython$(VERSION).so'
268 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000269cygwin*)
270 LDLIBRARY='libpython$(VERSION).dll.a'
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000271 DLLLIBRARY='libpython$(VERSION).dll'
Guido van Rossumaef734b2001-01-10 21:09:12 +0000272 ;;
Fred Drake5790be12000-10-09 17:06:13 +0000273esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000274AC_MSG_RESULT($LDLIBRARY)
275
Guido van Rossum627b2d71993-12-24 10:39:16 +0000276AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000277AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000278AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000279
280case $MACHDEP in
281bsdos*)
282 # install -d does not work on BSDI
283 if test -z "$INSTALL"
284 then
285 INSTALL="${srcdir}/install-sh -c"
286 fi
287esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000288AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000289
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000290# Not every filesystem supports hard links
291AC_SUBST(LN)
292if test -z "$LN" ; then
293 case $ac_sys_system in
294 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000295 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000296 *) LN=ln;;
297 esac
298fi
299
Fred Drake9f715822001-07-11 06:27:00 +0000300# Check for --with-pydebug
301AC_MSG_CHECKING(for --with-pydebug)
302AC_ARG_WITH(pydebug,
303[ --with-pydebug build with Py_DEBUG defined], [
304if test "$withval" != no
305then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
306else AC_MSG_RESULT(no); Py_DEBUG='false'
307fi],
308[AC_MSG_RESULT(no)])
309
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000310# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000311AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000312if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000313then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000314 case $GCC in
315 yes)
316 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000317 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000318 if test "$Py_DEBUG" = 'true' ; then
319 # Optimization messes up debuggers, so turn it off for
320 # debug builds.
321 OPT="-g -Wall -Wstrict-prototypes"
322 else
323 OPT="-g -O3 -Wall -Wstrict-prototypes"
324 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000325 *)
Fred Drake9f715822001-07-11 06:27:00 +0000326 OPT="-O3 -Wall -Wstrict-prototypes";;
327 esac
328 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000329 *)
330 case $ac_sys_system in
331 UnixWare*)
332 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
333 *)
334 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000335 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000336 esac
Jack Jansenca06bc62001-08-03 15:32:23 +0000337 case $ac_sys_system in
338 Darwin*)
339 OPT="$OPT -no-cpp-precomp";;
340 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000341fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000342
Trent Mick635f6fb2000-08-23 21:33:05 +0000343# The current (beta) Monterey compiler dies with optimizations
344case $ac_sys_system in
345Monterey*) OPT="";;
346esac
347
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000348if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000349then
350 OPT="$OPT $ac_arch_flags"
351fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000352# checks for UNIX variants that set C preprocessor variables
353AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000354AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000355
Guido van Rossum91922671997-10-09 20:24:13 +0000356AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
357AC_CACHE_VAL(ac_cv_opt_olimit_ok,
358[ac_save_cc="$CC"
359CC="$CC -OPT:Olimit=0"
360AC_TRY_RUN([int main() { return 0; }],
361 ac_cv_opt_olimit_ok=yes,
362 ac_cv_opt_olimit_ok=no)
363CC="$ac_save_cc"])
364AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000365if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000366 case $ac_sys_system in
367 Darwin*) OPT="$OPT" ;;
368 *) OPT="$OPT -OPT:Olimit=0";;
369 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000370else
371 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
372 AC_CACHE_VAL(ac_cv_olimit_ok,
373 [ac_save_cc="$CC"
374 CC="$CC -Olimit 1500"
375 AC_TRY_RUN([int main() { return 0; }],
376 ac_cv_olimit_ok=yes,
377 ac_cv_olimit_ok=no)
378 CC="$ac_save_cc"])
379 AC_MSG_RESULT($ac_cv_olimit_ok)
380 if test $ac_cv_olimit_ok = yes; then
381 OPT="$OPT -Olimit 1500"
382 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000383fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000384
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000385# Check for enable-ipv6
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000386AC_MSG_CHECKING([whether to enable ipv6])
387AC_ARG_ENABLE(ipv6,
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +0000388[ --enable-ipv6 Enable ipv6 (with ipv4) support
389 --disable-ipv6 Disable ipv6 support],
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000390[ case "$enableval" in
391 no)
392 AC_MSG_RESULT(no)
393 ipv6=no
394 ;;
395 *) AC_MSG_RESULT(yes)
396 AC_DEFINE(ENABLE_IPV6)
397 ipv6=yes
398 ;;
399 esac ],
400
Fred Drake9f715822001-07-11 06:27:00 +0000401 AC_TRY_RUN([ /* AF_INET6 available check */
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000402#include <sys/types.h>
403#include <sys/socket.h>
404main()
405{
406 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
407 exit(1);
408 else
409 exit(0);
410}
411],
412 AC_MSG_RESULT(yes)
413 AC_DEFINE(ENABLE_IPV6)
414 ipv6=yes,
415 AC_MSG_RESULT(no)
416 ipv6=no,
417 AC_MSG_RESULT(no)
418 ipv6=no
419))
420
421ipv6type=unknown
422ipv6lib=none
423ipv6trylibc=no
424
425if test "$ipv6" = "yes"; then
426 AC_MSG_CHECKING([ipv6 stack type])
427 for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do
428 case $i in
429 inria)
430 dnl http://www.kame.net/
431 AC_EGREP_CPP(yes, [dnl
432#include <netinet/in.h>
433#ifdef IPV6_INRIA_VERSION
434yes
435#endif],
436 [ipv6type=$i;
437 OPT="-DINET6 $OPT"])
438 ;;
439 kame)
440 dnl http://www.kame.net/
441 AC_EGREP_CPP(yes, [dnl
442#include <netinet/in.h>
443#ifdef __KAME__
444yes
445#endif],
446 [ipv6type=$i;
447 ipv6lib=inet6
448 ipv6libdir=/usr/local/v6/lib
449 ipv6trylibc=yes
450 OPT="-DINET6 $OPT"])
451 ;;
452 linux-glibc)
453 dnl http://www.v6.linux.or.jp/
454 AC_EGREP_CPP(yes, [dnl
455#include <features.h>
456#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
457yes
458#endif],
459 [ipv6type=$i;
460 ipv6trylibc=yes
461 OPT="-DINET6 $OPT"])
462 ;;
463 linux-inet6)
464 dnl http://www.v6.linux.or.jp/
465 if test -d /usr/inet6; then
466 ipv6type=$i
467 ipv6lib=inet6
468 ipv6libdir=/usr/inet6/lib
469 OPT="-DINET6 -I/usr/inet6/include $OPT"
470 fi
471 ;;
472 toshiba)
473 AC_EGREP_CPP(yes, [dnl
474#include <sys/param.h>
475#ifdef _TOSHIBA_INET6
476yes
477#endif],
478 [ipv6type=$i;
479 ipv6lib=inet6;
480 ipv6libdir=/usr/local/v6/lib;
481 OPT="-DINET6 $OPT"])
482 ;;
483 v6d)
484 AC_EGREP_CPP(yes, [dnl
485#include </usr/local/v6/include/sys/v6config.h>
486#ifdef __V6D__
487yes
488#endif],
489 [ipv6type=$i;
490 ipv6lib=v6;
491 ipv6libdir=/usr/local/v6/lib;
492 OPT="-I/usr/local/v6/include $OPT"])
493 ;;
494 zeta)
495 AC_EGREP_CPP(yes, [dnl
496#include <sys/param.h>
497#ifdef _ZETA_MINAMI_INET6
498yes
499#endif],
500 [ipv6type=$i;
501 ipv6lib=inet6;
502 ipv6libdir=/usr/local/v6/lib;
503 OPT="-DINET6 $OPT"])
504 ;;
505 esac
506 if test "$ipv6type" != "unknown"; then
507 break
508 fi
509 done
510 AC_MSG_RESULT($ipv6type)
511fi
512
513if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
514 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
515 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
516 echo "using lib$ipv6lib"
517 else
518 if test $ipv6trylibc = "yes"; then
519 echo "using libc"
520 else
521 echo 'Fatal: no $ipv6lib library found. cannot continue.'
522 echo "You need to fetch lib$ipv6lib.a from appropriate"
523 echo 'ipv6 kit and compile beforehand.'
524 exit 1
525 fi
526 fi
527fi
528
Martin v. Löwis130fb172001-07-19 11:00:41 +0000529# -Kpthread, if available, provides the right #defines
530# and linker options to make pthread_create available
531AC_MSG_CHECKING(whether $CC accepts -Kpthread)
532AC_CACHE_VAL(ac_cv_kpthread,
533[ac_save_cc="$CC"
534CC="$CC -Kpthread"
535AC_TRY_LINK([#include <pthread.h>],[pthread_create(0,0,0,0)],
536 ac_cv_kpthread=yes,
537 ac_cv_kpthread=no)
538CC="$ac_save_cc"])
539
540# GCC does not reject -Kpthread as an illegal option, it merely complains that
541# it is unrecognized
542if test "$GCC" = "yes"
543then ac_cv_kpthread="no, we have gcc"
544fi
545AC_MSG_RESULT($ac_cv_kpthread)
546
Fred Drakece81d592000-07-09 14:39:29 +0000547dnl # check for ANSI or K&R ("traditional") preprocessor
548dnl AC_MSG_CHECKING(for C preprocessor type)
549dnl AC_TRY_COMPILE([
550dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
551dnl int foo;
552dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
553dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
554dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000555
Guido van Rossum627b2d71993-12-24 10:39:16 +0000556# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000557AC_HEADER_STDC
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000558AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000559signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000560sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000561sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000562sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
Thomas Wouterse38b2f12001-07-11 22:35:31 +0000563ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000564AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000565
566# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000567was_it_defined=no
568AC_MSG_CHECKING(for clock_t in time.h)
569AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
570AC_MSG_RESULT($was_it_defined)
571
Guido van Rossum300fda71996-08-19 21:58:16 +0000572# Add some code to confdefs.h so that the test for off_t works on SCO
573cat >> confdefs.h <<\EOF
574#if defined(SCO_DS)
575#undef _OFF_T
576#endif
577EOF
578
Guido van Rossumef2255b2000-03-10 22:30:29 +0000579# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000580AC_TYPE_MODE_T
581AC_TYPE_OFF_T
582AC_TYPE_PID_T
583AC_TYPE_SIGNAL
584AC_TYPE_SIZE_T
585AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000586
Guido van Rossumef2255b2000-03-10 22:30:29 +0000587# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000588AC_CHECK_SIZEOF(int)
589AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000590AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000591AC_CHECK_SIZEOF(char)
592AC_CHECK_SIZEOF(short)
593AC_CHECK_SIZEOF(float)
594AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000595AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000596
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000597AC_MSG_CHECKING(for long long support)
598have_long_long=no
599AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
600AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000601if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000602AC_CHECK_SIZEOF(long long)
603fi
604
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000605AC_MSG_CHECKING(for uintptr_t support)
606have_uintptr_t=no
607AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
608AC_MSG_RESULT($have_uintptr_t)
609if test "$have_uintptr_t" = yes ; then
610AC_CHECK_SIZEOF(uintptr_t)
611fi
612
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000613# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
614AC_MSG_CHECKING(size of off_t)
615AC_CACHE_VAL(ac_cv_sizeof_off_t,
616[AC_TRY_RUN([#include <stdio.h>
617#include <sys/types.h>
618main()
619{
620 FILE *f=fopen("conftestval", "w");
621 if (!f) exit(1);
622 fprintf(f, "%d\n", sizeof(off_t));
623 exit(0);
624}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
625])
626AC_MSG_RESULT($ac_cv_sizeof_off_t)
627AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
628
629AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000630if test "$have_long_long" = yes -a \
631 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
632 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000633 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
634 AC_MSG_RESULT(yes)
635else
636 AC_MSG_RESULT(no)
637fi
638
Fred Drakea3f6e912000-06-29 20:44:47 +0000639# AC_CHECK_SIZEOF() doesn't include <time.h>.
640AC_MSG_CHECKING(size of time_t)
641AC_CACHE_VAL(ac_cv_sizeof_time_t,
642[AC_TRY_RUN([#include <stdio.h>
643#include <time.h>
644main()
645{
646 FILE *f=fopen("conftestval", "w");
647 if (!f) exit(1);
648 fprintf(f, "%d\n", sizeof(time_t));
649 exit(0);
650}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
651])
652AC_MSG_RESULT($ac_cv_sizeof_time_t)
653AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
654
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000655
Trent Mick635f6fb2000-08-23 21:33:05 +0000656# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000657ac_save_cc="$CC"
658if test "$ac_cv_kpthread" = "yes"
659then CC="$CC -Kpthread"
660fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000661AC_MSG_CHECKING(for pthread_t)
662have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000663AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000664AC_MSG_RESULT($have_pthread_t)
665if test "$have_pthread_t" = yes ; then
666 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
667 AC_MSG_CHECKING(size of pthread_t)
668 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
669 [AC_TRY_RUN([#include <stdio.h>
670 #include <pthread.h>
671 main()
672 {
673 FILE *f=fopen("conftestval", "w");
674 if (!f) exit(1);
675 fprintf(f, "%d\n", sizeof(pthread_t));
676 exit(0);
677 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
678 ])
679 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
680 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
681fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000682CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000683
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000684# Minor variations in building a framework between NextStep versions 4 and 5
685AC_SUBST(LIBTOOL_CRUFT)
686case $ac_sys_system/$ac_sys_release in
Guido van Rossum5839e582000-10-09 19:52:35 +0000687 Darwin/*)
688 ns_undef_sym='_environ'
Jack Jansenca06bc62001-08-03 15:32:23 +0000689 LIBTOOL_CRUFT="-framework Foundation -framework Carbon -lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000690 next/4*)
691 ns_undef_sym='__environ'
692 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
693 next/5*)
694 ns_undef_sym='_environ'
695 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
696esac
697
698AC_MSG_CHECKING(for --with-next-framework)
699if test "$with_next_framework"
700then
Jack Jansenca06bc62001-08-03 15:32:23 +0000701 OPT="$OPT -fno-common -dynamic"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000702 # -U __environ is needed since bundles don't have access
703 # to crt0 when built but will always be linked against it
704 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
705 AC_DEFINE(WITH_NEXT_FRAMEWORK)
706 AC_MSG_RESULT(yes)
707else
708 AC_MSG_RESULT(no)
709fi
710
711AC_MSG_CHECKING(for --with-dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000712case $ac_sys_system/$ac_sys_release in
713 Darwin/*)
714 AC_DEFINE(WITH_DYLD)
715 AC_MSG_RESULT(always on for Darwin)
716 ;;
717 *)
718 if test "$with_next_framework" -o "$with_dyld"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000719 then
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000720 if test "$with_dyld"
721 then
722 AC_MSG_RESULT(yes)
723 else
724 AC_MSG_RESULT(required for framework build)
725 fi
726 AC_DEFINE(WITH_DYLD)
727 ns_dyld='set'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000728 else
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000729 AC_MSG_RESULT(no)
730 fi ;;
731esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000732
Guido van Rossumac405f61994-09-12 10:56:06 +0000733# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000734AC_SUBST(SO)
735AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000736AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000737AC_SUBST(CCSHARED)
738AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000739# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000740# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000741AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000742if test -z "$SO"
743then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000744 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000745 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000746 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000747 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000748 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000749fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000750AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000751# LDSHARED is the ld *command* used to create shared library
752# -- "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 +0000753# (Shared libraries in this instance are shared modules to be loaded into
754# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000755AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000756if test -z "$LDSHARED"
757then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000758 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000759 AIX*)
760 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
761 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
762 ;;
763 BeOS*)
764 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
765 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
766 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000767 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000768 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000769 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +0000770 SunOS/5*)
771 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000772 then LDSHARED='$(CC) -shared'
Greg Ward57c9a6632000-05-26 12:22:54 +0000773 else LDSHARED="ld -G";
774 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000775 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000776 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000777 DYNIX/ptx*) LDSHARED="ld -G";;
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000778 Darwin/*)
779 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
780 if test "$with_next_framework" ; then
781 LDSHARED="$LDSHARED \$(LDLIBRARY)"
782 fi ;;
783 next/*)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000784 if test "$ns_dyld"
Guido van Rossumacb14c72001-01-10 21:41:16 +0000785 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000786 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
787 fi
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000788 if test "$with_next_framework" ; then
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000789 LDSHARED="$LDSHARED \$(LDLIBRARY)"
790 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000791 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000792 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000793 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000794 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000795 NetBSD*)
796 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
797 then
798 LDSHARED="cc -shared"
799 else
800 LDSHARED="ld -Bshareable"
801 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000802 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000803 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000804 then
805 LDSHARED="cc -shared ${LDFLAGS}"
806 else
807 LDSHARED="ld -Bshareable ${LDFLAGS}"
808 fi;;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000809 UnixWare*)
810 if test "$GCC" = "yes"
811 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000812 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000813 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000814 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000815 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000816 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000817 *) LDSHARED="ld";;
818 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000819fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000820AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000821BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000822# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000823# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000824AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000825if test -z "$CCSHARED"
826then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000827 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000828 SunOS*) if test "$GCC" = yes;
829 then CCSHARED="-fPIC";
830 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000831 hp*|HP*) if test "$GCC" = yes;
832 then CCSHARED="-fpic";
833 else CCSHARED="+z";
834 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000835 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000836 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000837 OpenBSD*) CCSHARED="-fpic";;
838 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000839 UnixWare*)
840 if test "$GCC" = "yes"
841 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000842 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000843 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000844 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000845 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000846 IRIX*/6*) case $CC in
847 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000848 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000849 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000850 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000851 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000852fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000853AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000854# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000855# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000856AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000857if test -z "$LINKFORSHARED"
858then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000859 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000860 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000861 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000862 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000863 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000864 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000865 # -u libsys_s pulls in all symbols in libsys
866 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
867 # -u __dummy makes the linker aware of the objc runtime
868 # in System.framework; otherwise, __objcInit (referenced in
869 # crt1.o) gets erroneously defined as common, which breaks dynamic
870 # loading of any modules which reference it in System.framework
871 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Jack Jansenc49e5b72001-06-19 15:00:23 +0000872 Darwin/*) LINKFORSHARED="-u __dummy -u _PyMac_Error -framework System -framework Foundation -framework Carbon" ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000873 UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000874 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000875 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000876 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000877 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
878 then
879 LINKFORSHARED="-Wl,--export-dynamic"
880 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000881 SunOS/5*) case $CC in
882 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000883 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000884 then
885 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000886 fi;;
887 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000888 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000889fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000890AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000891
Neil Schemenauer61c51152001-01-26 16:18:16 +0000892AC_SUBST(CFLAGSFORSHARED)
893AC_MSG_CHECKING(CFLAGSFORSHARED)
894if test ! "$LIBRARY" = "$LDLIBRARY"
895then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000896 case $ac_sys_system in
897 CYGWIN*)
898 # Cygwin needs CCSHARED when building extension DLLs
899 # but not when building the interpreter DLL.
900 CFLAGSFORSHARED='';;
901 *)
902 CFLAGSFORSHARED='$(CCSHARED)'
903 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000904fi
905AC_MSG_RESULT($CFLAGSFORSHARED)
906
Guido van Rossum627b2d71993-12-24 10:39:16 +0000907# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000908AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
909AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000910
911# checks for system dependent C++ extensions support
912case "$ac_sys_system" in
913 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
914 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
915 [loadAndInit("", 0, "")],
916 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
917 AC_MSG_RESULT(yes)],
918 [AC_MSG_RESULT(no)]);;
919 *) ;;
920esac
921
Guido van Rossum70c7f481998-03-26 18:44:10 +0000922# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
923# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000924# BeOS' sockets are stashed in libnet.
925case "$ac_sys_system" in
926IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000927*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000928AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000929AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000930;;
931esac
932case "$ac_sys_system" in
933BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000934AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
935;;
936esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000937
Guido van Rossumc5a39031996-07-31 17:35:03 +0000938AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000939AC_ARG_WITH(libs,
940[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000941AC_MSG_RESULT($withval)
942LIBS="$withval $LIBS"
943], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000944
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000945# Determine if signalmodule should be used.
946AC_SUBST(USE_SIGNAL_MODULE)
947AC_SUBST(SIGNAL_OBJS)
948AC_MSG_CHECKING(for --with-signal-module)
949AC_ARG_WITH(signal-module,
950[ --with-signal-module disable/enable signal module])
951
952if test -z "$with_signal_module"
953then with_signal_module="yes"
954fi
955AC_MSG_RESULT($with_signal_module)
956
957if test "${with_signal_module}" = "yes"; then
958 USE_SIGNAL_MODULE=""
959 SIGNAL_OBJS=""
960else
961 USE_SIGNAL_MODULE="#"
962 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
963fi
964
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000965# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000966AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000967USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000968
Guido van Rossum54d93d41997-01-22 20:51:58 +0000969AC_MSG_CHECKING(for --with-dec-threads)
970AC_SUBST(LDLAST)
971AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000972[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
973AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000974LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000975if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000976 with_thread="$withval";
977fi],
978AC_MSG_RESULT(no))
979
980AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000981AC_ARG_WITH(threads,
982[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000983
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000984# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000985AC_ARG_WITH(thread,
986[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
987with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000988
989if test -z "$with_threads"
990then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000991fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000992AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000993
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000994if test "$with_threads" = "no"
995then
996 USE_THREAD_MODULE="#"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000997elif test "$ac_cv_kpthread" = "yes"
998then
999 CC="$CC -Kpthread"
1000 AC_DEFINE(WITH_THREAD)
1001 AC_DEFINE(_POSIX_THREADS)
1002 LIBOBJS="$LIBOBJS thread.o"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001003else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001004 if test ! -z "$with_threads" -a -d "$with_threads"
1005 then LDFLAGS="$LDFLAGS -L$with_threads"
1006 fi
1007 if test ! -z "$withval" -a -d "$withval"
1008 then LDFLAGS="$LDFLAGS -L$withval"
1009 fi
1010 AC_DEFINE(_REENTRANT)
1011 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1012 AC_DEFINE(C_THREADS)
1013 LIBOBJS="$LIBOBJS thread.o"],[
1014 AC_MSG_CHECKING(for --with-pth)
1015 AC_ARG_WITH(pth,
1016 [ --with-pth use GNU pth threading libraries], [
1017 AC_MSG_RESULT($withval)
1018 AC_DEFINE(WITH_THREAD)
1019 AC_DEFINE(HAVE_PTH)
1020 LIBS="-lpth $LIBS"
1021 LIBOBJS="$LIBOBJS thread.o"],[
1022 AC_MSG_RESULT(no)
1023 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001024 case $ac_sys_system in
1025 Darwin*) ;;
1026 *) AC_DEFINE(_POSIX_THREADS);;
1027 esac
Martin v. Löwis130fb172001-07-19 11:00:41 +00001028 LIBS="-lpthread $LIBS"
1029 LIBOBJS="$LIBOBJS thread.o"],[
1030 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1031 case $ac_sys_system in
1032 Darwin*) ;;
1033 *) AC_DEFINE(_POSIX_THREADS);;
1034 esac
1035 LIBOBJS="$LIBOBJS thread.o"],[
1036 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1037 AC_DEFINE(BEOS_THREADS)
1038 LIBOBJS="$LIBOBJS thread.o"],[
1039 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1040 AC_DEFINE(_POSIX_THREADS)
1041 LIBS="$LIBS -lpthreads"
1042 LIBOBJS="$LIBOBJS thread.o"], [
1043 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1044 AC_DEFINE(_POSIX_THREADS)
1045 LIBS="$LIBS -lc_r"
1046 LIBOBJS="$LIBOBJS thread.o"], [
1047 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
1048 AC_DEFINE(_POSIX_THREADS)
1049 LIBS="$LIBS -lthread"
1050 LIBOBJS="$LIBOBJS thread.o"], [
1051 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1052 AC_DEFINE(_POSIX_THREADS)
1053 LIBS="$LIBS -lpthread"
1054 LIBOBJS="$LIBOBJS thread.o"], [
1055 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1056 AC_DEFINE(_POSIX_THREADS)
1057 LIBS="$LIBS -lcma"
1058 LIBOBJS="$LIBOBJS thread.o"],[
1059 USE_THREAD_MODULE="#"])
1060 ])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001061
Martin v. Löwis130fb172001-07-19 11:00:41 +00001062 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1063 LIBS="$LIBS -lmpc"
1064 LIBOBJS="$LIBOBJS thread.o"
1065 USE_THREAD_MODULE=""])
1066 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1067 LIBS="$LIBS -lthread"
1068 LIBOBJS="$LIBOBJS thread.o"
1069 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001070
Martin v. Löwis130fb172001-07-19 11:00:41 +00001071 if test "$USE_THREAD_MODULE" != "#"
1072 then
1073 # If the above checks didn't disable threads, (at least) OSF1
1074 # needs this '-threads' argument during linking.
1075 case $ac_sys_system in
1076 OSF1) LDLAST=-threads;;
1077 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001078 fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001079fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001080
Barry Warsawef82cd72000-06-30 16:21:01 +00001081# Check for GC support
1082AC_SUBST(USE_GC_MODULE)
1083USE_GC_MODULE=""
1084AC_MSG_CHECKING(for --with-cycle-gc)
1085AC_ARG_WITH(cycle-gc,
1086[ --with(out)-cycle-gc disable/enable garbage collection])
1087
1088if test -z "$with_cycle_gc"
1089then with_cycle_gc="yes"
1090fi
1091if test "$with_cycle_gc" = "no"
1092then
1093 USE_GC_MODULE="#"
1094else
1095 AC_DEFINE(WITH_CYCLE_GC)
1096fi
1097AC_MSG_RESULT($with_cycle_gc)
1098
Neil Schemenauera35c6882001-02-27 04:45:05 +00001099# Check for Python-specific malloc support
1100AC_MSG_CHECKING(for --with-pymalloc)
1101AC_ARG_WITH(pymalloc,
1102[ --with(out)-pymalloc disable/enable specialized mallocs], [
1103if test "$withval" != no
1104then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1105else AC_MSG_RESULT(no)
1106fi],
1107[AC_MSG_RESULT(no)])
1108
Barry Warsawef82cd72000-06-30 16:21:01 +00001109# Check for --with-wctype-functions
1110AC_MSG_CHECKING(for --with-wctype-functions)
1111AC_ARG_WITH(wctype-functions,
1112[ --with-wctype-functions use wctype.h functions], [
1113if test "$withval" != no
1114then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1115else AC_MSG_RESULT(no)
1116fi],
1117[AC_MSG_RESULT(no)])
1118
Guido van Rossum68242b51996-05-28 22:53:03 +00001119# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001120AC_SUBST(DLINCLDIR)
1121DLINCLDIR=/
1122
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001123AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001124AC_ARG_WITH(sgi-dl,
1125[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001126AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001127AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +00001128DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001129dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001130if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001131then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001132else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1133fi
1134DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001135LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001136
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001137AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001138AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001139AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001140AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001141DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001142dldir=`echo "$withval" | sed 's/,.*//'`
1143dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001144if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001145then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001146else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1147fi
1148DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001149LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001150
Guido van Rossume97ee181999-12-20 21:27:22 +00001151# the dlopen() function means we might want to use dynload_shlib.o. some
1152# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001153AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001154
1155# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1156# loading of modules.
1157AC_SUBST(DYNLOADFILE)
1158AC_MSG_CHECKING(DYNLOADFILE)
1159if test -z "$DYNLOADFILE"
1160then
1161 case $ac_sys_system/$ac_sys_release in
1162 AIX*) DYNLOADFILE="dynload_aix.o";;
1163 BeOS*) DYNLOADFILE="dynload_beos.o";;
1164 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Guido van Rossum5839e582000-10-09 19:52:35 +00001165 Darwin/*|next/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001166 *)
1167 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1168 # out any dynamic loading
1169 if test "$ac_cv_func_dlopen" = yes
1170 then DYNLOADFILE="dynload_shlib.o"
1171 else DYNLOADFILE="dynload_stub.o"
1172 fi
1173 ;;
1174 esac
1175fi
1176AC_MSG_RESULT($DYNLOADFILE)
1177if test "$DYNLOADFILE" != "dynload_stub.o"
1178then
1179 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1180fi
1181
Jack Jansenc49e5b72001-06-19 15:00:23 +00001182# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1183
1184AC_SUBST(MACHDEP_OBJS)
1185AC_MSG_CHECKING(MACHDEP_OBJS)
1186if test -z "$MACHDEP_OBJS"
1187then
1188 case $ac_sys_system/$ac_sys_release in
1189 Darwin/*)
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001190 MACHDEP_OBJS="Python/mactoolboxglue.o"
Jack Jansenc49e5b72001-06-19 15:00:23 +00001191 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
1192 ;;
1193 *) MACHDEP_OBJS="";;
1194 esac
1195fi
1196AC_MSG_RESULT($DYNLOADFILE)
1197
Guido van Rossum627b2d71993-12-24 10:39:16 +00001198# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001199AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001200 flock fork fsync fdatasync fpathconf ftime ftruncate \
Andrew M. Kuchlinga9586c72001-01-08 17:58:56 +00001201 getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwis864e9ff2001-08-04 22:32:03 +00001202 hstrerror inet_pton kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001203 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001204 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001205 select setegid seteuid setgid \
Martin v. Löwis791bfda2001-07-24 06:33:08 +00001206 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
Fred Drake35a092f1999-12-13 16:23:35 +00001207 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001208 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Woutersc2c12dc2001-07-11 14:45:34 +00001209 truncate uname waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001210
Fred Drake8cef4cf2000-06-28 16:40:38 +00001211# check for openpty and forkpty
1212
1213AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1214AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1215
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001216# check for long file support functions
1217AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1218
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001219AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001220AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1221AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1222AC_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 +00001223
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001224AC_CHECK_FUNCS(getaddrinfo, [dnl
1225AC_MSG_CHECKING(getaddrinfo bug)
1226AC_TRY_RUN([
1227#include <sys/types.h>
1228#include <netdb.h>
1229#include <string.h>
1230#include <sys/socket.h>
1231#include <netinet/in.h>
1232
1233main()
1234{
1235 int passive, gaierr, inet4 = 0, inet6 = 0;
1236 struct addrinfo hints, *ai, *aitop;
1237 char straddr[INET6_ADDRSTRLEN], strport[16];
1238
1239 for (passive = 0; passive <= 1; passive++) {
1240 memset(&hints, 0, sizeof(hints));
1241 hints.ai_family = AF_UNSPEC;
1242 hints.ai_flags = passive ? AI_PASSIVE : 0;
1243 hints.ai_socktype = SOCK_STREAM;
1244 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1245 (void)gai_strerror(gaierr);
1246 goto bad;
1247 }
1248 for (ai = aitop; ai; ai = ai->ai_next) {
1249 if (ai->ai_addr == NULL ||
1250 ai->ai_addrlen == 0 ||
1251 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1252 straddr, sizeof(straddr), strport, sizeof(strport),
1253 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1254 goto bad;
1255 }
1256 switch (ai->ai_family) {
1257 case AF_INET:
1258 if (strcmp(strport, "54321") != 0) {
1259 goto bad;
1260 }
1261 if (passive) {
1262 if (strcmp(straddr, "0.0.0.0") != 0) {
1263 goto bad;
1264 }
1265 } else {
1266 if (strcmp(straddr, "127.0.0.1") != 0) {
1267 goto bad;
1268 }
1269 }
1270 inet4++;
1271 break;
1272 case AF_INET6:
1273 if (strcmp(strport, "54321") != 0) {
1274 goto bad;
1275 }
1276 if (passive) {
1277 if (strcmp(straddr, "::") != 0) {
1278 goto bad;
1279 }
1280 } else {
1281 if (strcmp(straddr, "::1") != 0) {
1282 goto bad;
1283 }
1284 }
1285 inet6++;
1286 break;
1287 case AF_UNSPEC:
1288 goto bad;
1289 break;
1290 default:
1291 /* another family support? */
1292 break;
1293 }
1294 }
1295 }
1296
1297 if (!(inet4 == 0 || inet4 == 2))
1298 goto bad;
1299 if (!(inet6 == 0 || inet6 == 2))
1300 goto bad;
1301
1302 if (aitop)
1303 freeaddrinfo(aitop);
1304 exit(0);
1305
1306 bad:
1307 if (aitop)
1308 freeaddrinfo(aitop);
1309 exit(1);
1310}
1311],
1312AC_MSG_RESULT(good)
1313buggygetaddrinfo=no,
1314AC_MSG_RESULT(buggy)
1315buggygetaddrinfo=yes,
1316AC_MSG_RESULT(buggy)
1317buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
1318
1319if test "$buggygetaddrinfo" = "yes"; then
1320 if test "$ipv6" = "yes"; then
1321 echo 'Fatal: You must get working getaddrinfo() function.'
1322 echo ' or you can specify "--disable-ipv6"'.
1323 exit 1
1324 fi
1325fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00001326AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001327
Guido van Rossum627b2d71993-12-24 10:39:16 +00001328# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001329AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001330AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001331AC_STRUCT_TIMEZONE
1332
1333AC_MSG_CHECKING(for time.h that defines altzone)
1334AC_CACHE_VAL(ac_cv_header_time_altzone,
1335[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1336 ac_cv_header_time_altzone=yes,
1337 ac_cv_header_time_altzone=no)])
1338AC_MSG_RESULT($ac_cv_header_time_altzone)
1339if test $ac_cv_header_time_altzone = yes; then
1340 AC_DEFINE(HAVE_ALTZONE)
1341fi
1342
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001343was_it_defined=no
1344AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001345AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001346#include <sys/types.h>
1347#include <sys/select.h>
1348#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001349], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1350AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001351
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001352AC_MSG_CHECKING(for addrinfo)
1353AC_CACHE_VAL(ac_cv_struct_addrinfo,
1354AC_TRY_COMPILE([
1355# include <netdb.h>],
1356 [struct addrinfo a],
1357 ac_cv_struct_addrinfo=yes,
1358 ac_cv_struct_addrinfo=no))
1359AC_MSG_RESULT($ac_cv_struct_addrinfo)
1360if test $ac_cv_struct_addrinfo = yes; then
1361 AC_DEFINE(HAVE_ADDRINFO)
1362fi
1363
1364AC_MSG_CHECKING(for sockaddr_storage)
1365AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1366AC_TRY_COMPILE([
1367# include <sys/types.h>
1368# include <sys/socket.h>],
1369 [struct sockaddr_storage s],
1370 ac_cv_struct_sockaddr_storage=yes,
1371 ac_cv_struct_sockaddr_storage=no))
1372AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1373if test $ac_cv_struct_sockaddr_storage = yes; then
1374 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1375fi
1376
Guido van Rossum627b2d71993-12-24 10:39:16 +00001377# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001378
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001379AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001380AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001381
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001382works=no
1383AC_MSG_CHECKING(for working volatile)
1384AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1385AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001386
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001387works=no
1388AC_MSG_CHECKING(for working signed char)
1389AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1390AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001391
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001392have_prototypes=no
1393AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001394AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1395AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001396AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001397
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001398works=no
1399AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001400AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001401#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001402int foo(int x, ...) {
1403 va_list va;
1404 va_start(va, x);
1405 va_arg(va, int);
1406 va_arg(va, char *);
1407 va_arg(va, double);
1408 return 0;
1409}
1410], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001411AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1412AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001413
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001414if test "$have_prototypes" = yes; then
1415bad_prototypes=no
1416AC_MSG_CHECKING(for bad exec* prototypes)
1417AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1418 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1419AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001420fi
1421
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001422# check if sockaddr has sa_len member
1423AC_MSG_CHECKING(if sockaddr has sa_len member)
1424AC_TRY_COMPILE([#include <sys/types.h>
1425#include <sys/socket.h>],
1426[struct sockaddr x;
1427x.sa_len = 0;],
1428 AC_MSG_RESULT(yes)
1429 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1430 AC_MSG_RESULT(no))
1431
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001432bad_forward=no
1433AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001434AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001435struct s { int a; int b; };
1436static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001437int foobar() {
1438 static int random;
1439 random = (int) &foo;
1440 return random;
1441}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001442static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001443main() {
1444 exit(!((int)&foo == foobar()));
1445}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001446], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
1447AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001448
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001449va_list_is_array=no
1450AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001451AC_TRY_COMPILE([
1452#ifdef HAVE_STDARG_PROTOTYPES
1453#include <stdarg.h>
1454#else
1455#include <varargs.h>
1456#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001457], [va_list list1, list2; list1 = list2;], ,
1458AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1459AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001460
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001461# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1462AC_CHECK_FUNC(gethostbyname_r, [
1463 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1464 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1465 OLD_CFLAGS=$CFLAGS
1466 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1467 AC_TRY_COMPILE([
1468# include <netdb.h>
1469 ], [
1470 char *name;
1471 struct hostent *he, *res;
1472 char buffer[2048];
1473 int buflen = 2048;
1474 int h_errnop;
1475
1476 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1477 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001478 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001479 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1480 AC_MSG_RESULT(yes)
1481 ], [
1482 AC_MSG_RESULT(no)
1483 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1484 AC_TRY_COMPILE([
1485# include <netdb.h>
1486 ], [
1487 char *name;
1488 struct hostent *he;
1489 char buffer[2048];
1490 int buflen = 2048;
1491 int h_errnop;
1492
1493 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1494 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001495 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001496 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1497 AC_MSG_RESULT(yes)
1498 ], [
1499 AC_MSG_RESULT(no)
1500 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1501 AC_TRY_COMPILE([
1502# include <netdb.h>
1503 ], [
1504 char *name;
1505 struct hostent *he;
1506 struct hostent_data data;
1507
1508 (void) gethostbyname_r(name, he, &data);
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_3_ARG)
1512 AC_MSG_RESULT(yes)
1513 ], [
1514 AC_MSG_RESULT(no)
1515 ])
1516 ])
1517 ])
1518 CFLAGS=$OLD_CFLAGS
1519], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001520 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001521])
1522AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1523AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1524AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001525AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001526AC_SUBST(HAVE_GETHOSTBYNAME)
1527
Guido van Rossum627b2d71993-12-24 10:39:16 +00001528# checks for system services
1529# (none yet)
1530
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001531# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001532AC_CHECK_FUNC(__fpu_control,
1533 [],
1534 [AC_CHECK_LIB(ieee, __fpu_control)
1535])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001536
Guido van Rossum93274221997-05-09 02:42:00 +00001537# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001538AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001539AC_ARG_WITH(fpectl,
1540[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001541if test "$withval" != no
1542then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1543else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001544fi],
1545[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001546
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001547# check for --with-libm=...
1548AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001549case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001550Darwin) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001551next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001552BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001553*) LIBM=-lm
1554esac
Guido van Rossum93274221997-05-09 02:42:00 +00001555AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001556AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001557if test "$withval" = no
1558then LIBM=
1559 AC_MSG_RESULT(force LIBM empty)
1560elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001561then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001562 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001563else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001564fi],
1565[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001566
1567# check for --with-libc=...
1568AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001569AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001570AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001571if test "$withval" = no
1572then LIBC=
1573 AC_MSG_RESULT(force LIBC empty)
1574elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001575then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001576 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001577else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001578fi],
1579[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001580
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001581# check for hypot() in math library
1582LIBS_SAVE=$LIBS
1583LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001584AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001585LIBS=$LIBS_SAVE
1586
Guido van Rossumad713701997-07-10 22:42:38 +00001587# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001588AC_MSG_CHECKING(what malloc(0) returns)
1589AC_CACHE_VAL(ac_cv_malloc_zero,
1590[AC_TRY_RUN([#include <stdio.h>
1591#ifdef HAVE_STDLIB
1592#include <stdlib.h>
1593#else
1594char *malloc(), *realloc();
1595int *free();
1596#endif
1597main() {
1598 char *p;
1599 p = malloc(0);
1600 if (p == NULL) exit(1);
1601 p = realloc(p, 0);
1602 if (p == NULL) exit(1);
1603 free(p);
1604 exit(0);
1605}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1606AC_MSG_RESULT($ac_cv_malloc_zero)
1607if test "$ac_cv_malloc_zero" = null
1608then
1609 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1610fi
1611
Guido van Rossumef2255b2000-03-10 22:30:29 +00001612# check for wchar.h
1613AC_CHECK_HEADER(wchar.h,
1614AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1615wchar_h="no"
1616)
1617
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001618# determine wchar_t size
1619if test "$wchar_h" = yes
1620then
1621 AC_CHECK_SIZEOF(wchar_t)
1622fi
1623
1624AC_MSG_CHECKING(what type to use for unicode)
1625AC_ARG_ENABLE(unicode,
1626[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1627
1628if test $enable_unicode = yes
1629then
Martin v. Löwisfd917792001-06-27 20:22:04 +00001630 # Without any arguments, Py_UNICODE defaults to two-byte mode
1631 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001632fi
1633
1634case "$enable_unicode" in
1635ucs2) unicode_size="2"
1636 AC_DEFINE(Py_UNICODE_SIZE,2)
1637 ;;
1638ucs4) unicode_size="4"
1639 AC_DEFINE(Py_UNICODE_SIZE,4)
1640 ;;
1641esac
1642
1643if test "$enable_unicode" = "no"
1644then
1645 AC_MSG_RESULT(not used)
1646else
1647 AC_DEFINE(Py_USING_UNICODE)
1648 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1649 then
1650 PY_UNICODE_TYPE="wchar_t"
1651 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1652 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1653 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1654 then
1655 PY_UNICODE_TYPE="unsigned short"
1656 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1657 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1658 then
1659 PY_UNICODE_TYPE="unsigned long"
1660 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1661 else
1662 PY_UNICODE_TYPE="no type found"
1663 fi
1664 AC_MSG_RESULT($PY_UNICODE_TYPE)
1665fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00001666
1667# check for endianness
1668AC_C_BIGENDIAN
1669
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001670# Check whether right shifting a negative integer extends the sign bit
1671# or fills with zeros (like the Cray J90, according to Tim Peters).
1672AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001673AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001674AC_TRY_RUN([
1675int main()
1676{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001677 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001678}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001679], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1680AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1681if test "$ac_cv_rshift_extends_sign" = no
1682then
1683 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1684fi
1685
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001686# check for getc_unlocked and related locking functions
1687AC_MSG_CHECKING(for getc_unlocked() and friends)
1688AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1689AC_TRY_LINK([#include <stdio.h>],[
1690 FILE *f = fopen("/dev/null", "r");
1691 flockfile(f);
1692 getc_unlocked(f);
1693 funlockfile(f);
1694], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1695AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1696if test "$ac_cv_have_getc_unlocked" = yes
1697then
1698 AC_DEFINE(HAVE_GETC_UNLOCKED)
1699fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001700
Guido van Rossum353ae582001-07-10 16:45:32 +00001701# check for readline 4.2
1702AC_CHECK_LIB(readline, rl_completion_matches,
1703 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1704
Thomas Wouterse38b2f12001-07-11 22:35:31 +00001705AC_MSG_CHECKING(for broken nice())
1706AC_CACHE_VAL(ac_cv_broken_nice, [
1707AC_TRY_RUN([
1708int main()
1709{
1710 int val1 = nice(1);
1711 if (val1 != -1 && val1 == nice(2))
1712 exit(0);
1713 exit(1);
1714}
1715],ac_cv_broken_nice=yes, ac_cv_broken_nice=no)])
1716AC_MSG_RESULT($ac_cv_broken_nice)
1717if test "$ac_cv_broken_nice" = yes
1718then
1719 AC_DEFINE(HAVE_BROKEN_NICE)
1720fi
1721
Guido van Rossum95713eb2000-05-18 20:53:31 +00001722# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1723# Add sys/socket.h to confdefs.h
1724cat >> confdefs.h <<\EOF
1725#ifdef HAVE_SYS_SOCKET_H
1726#include <sys/socket.h>
1727#endif
1728EOF
1729AC_CHECK_TYPE(socklen_t, int)
1730
Neil Schemenauerf25cf6c2001-03-04 06:39:33 +00001731# Add Python/ prefix to LIBOBJS
1732libobjs=$LIBOBJS
1733LIBOBJS=
1734for obj in $libobjs; do
1735 LIBOBJS="$LIBOBJS Python/$obj"
1736done
1737
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001738#AC_MSG_CHECKING(for Modules/Setup)
1739#if test ! -f Modules/Setup ; then
1740# if test ! -d Modules ; then
1741# mkdir Modules
1742# fi
1743# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1744# AC_MSG_RESULT(creating)
1745#else
1746# AC_MSG_RESULT(already exists)
1747#fi
1748
1749AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00001750SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001751AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001752for dir in $SRCDIRS; do
1753 if test ! -d $dir; then
1754 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001755 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001756done
1757AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001758
Guido van Rossum627b2d71993-12-24 10:39:16 +00001759# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001760AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001761
1762echo "creating Setup"
1763if test ! -f Modules/Setup
1764then
1765 cp $srcdir/Modules/Setup.dist Modules/Setup
1766fi
1767
1768echo "creating Setup.local"
1769if test ! -f Modules/Setup.local
1770then
1771 echo "# Edit this file for local setup changes" >Modules/Setup.local
1772fi
1773
1774echo "creating Makefile"
1775$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1776 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00001777 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00001778mv config.c Modules