blob: 55f1f5522ce5bc5a723348ed10254334a1917c73 [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$)
Martin v. Löwis97017322002-04-12 17:25:21 +00003AC_PREREQ(2.53)
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
Martin v. Löwis11437992002-04-12 09:54:03 +00007# This is for stuff that absolutely must end up in pyconfig.h.
8# Please use pyport.h instead, if possible.
9AH_BOTTOM([
Martin v. Löwis11437992002-04-12 09:54:03 +000010/* Define the macros needed if on a UnixWare 7.x system. */
11#if defined(__USLC__) && defined(__SCO_VERSION__)
12#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
13#endif
14])
15
Guido van Rossum642b6781997-07-19 19:35:41 +000016# Set VERSION so we only need to edit in one place (i.e., here)
17AC_SUBST(VERSION)
Andrew M. Kuchling54a39412002-02-11 16:30:54 +000018VERSION=2.3
Guido van Rossum642b6781997-07-19 19:35:41 +000019
Martin v. Löwis1142de32002-03-29 16:28:31 +000020AC_SUBST(SOVERSION)
21SOVERSION=1.0
22
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +000023# Arguments passed to configure.
24AC_SUBST(CONFIG_ARGS)
25CONFIG_ARGS="$ac_configure_args"
26
Guido van Rossum4b6b5791996-09-09 20:09:34 +000027
Jack Jansenb6e9cad2001-08-15 01:26:28 +000028AC_ARG_ENABLE(framework,
29[ --enable-framework[=INSTALLDIR] Build (MacOSX|Darwin) framework],[
Jack Jansenb6e9cad2001-08-15 01:26:28 +000030 case $enableval in
31 yes)
32 enableval=/Library/Frameworks
Jack Jansen127e56e2001-09-11 14:41:54 +000033 esac
34 case $enableval in
35 no)
36 PYTHONFRAMEWORK=
37 PYTHONFRAMEWORKDIR=no-framework
38 PYTHONFRAMEWORKPREFIX=
39 PYTHONFRAMEWORKINSTALLDIR=
40 enable_framework=
Jack Jansenb6e9cad2001-08-15 01:26:28 +000041 ;;
42 *)
Jack Jansen127e56e2001-09-11 14:41:54 +000043 PYTHONFRAMEWORK=Python
44 PYTHONFRAMEWORKDIR=Python.framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +000045 PYTHONFRAMEWORKPREFIX=$enableval
Jack Jansen127e56e2001-09-11 14:41:54 +000046 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
47 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
Jack Jansenb6e9cad2001-08-15 01:26:28 +000048 esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +000049 ],[
50 PYTHONFRAMEWORK=
Jack Jansen127e56e2001-09-11 14:41:54 +000051 PYTHONFRAMEWORKDIR=no-framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +000052 PYTHONFRAMEWORKPREFIX=
53 PYTHONFRAMEWORKINSTALLDIR=
54 enable_framework=
55])
56AC_SUBST(PYTHONFRAMEWORK)
57AC_SUBST(PYTHONFRAMEWORKDIR)
58AC_SUBST(PYTHONFRAMEWORKPREFIX)
59AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
Guido van Rossum4b6b5791996-09-09 20:09:34 +000060
Jack Jansenb6e9cad2001-08-15 01:26:28 +000061##AC_ARG_WITH(dyld,
62##[ --with-dyld Use (OpenStep|Rhapsody) dynamic linker],,)
63##
Guido van Rossumb418f891996-07-30 18:06:02 +000064# Set name for machine-dependent library files
65AC_SUBST(MACHDEP)
66AC_MSG_CHECKING(MACHDEP)
67if test -z "$MACHDEP"
68then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000069 ac_sys_system=`uname -s`
Martin v. Löwis130fb172001-07-19 11:00:41 +000070 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000071 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000072 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000073 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000074 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000075 ac_md_system=`echo $ac_sys_system |
76 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
77 ac_md_release=`echo $ac_sys_release |
Guido van Rossum67b26592001-10-20 14:21:45 +000078 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000079 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000080
Guido van Rossumbcd91e01997-03-20 20:46:29 +000081 case $MACHDEP in
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +000082 cygwin*) MACHDEP="cygwin";;
Jack Jansen8a97f4a2001-12-05 23:27:32 +000083 darwin*) MACHDEP="darwin";;
Guido van Rossumb97ef171997-09-28 05:44:03 +000084 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000085 esac
86fi
Guido van Rossum91922671997-10-09 20:24:13 +000087
88#
89# SGI compilers allow the specification of the both the ABI and the
90# ISA on the command line. Depending on the values of these switches,
91# different and often incompatable code will be generated.
92#
93# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
94# thus supply support for various ABI/ISA combinations. The MACHDEP
95# variable is also adjusted.
96#
97AC_SUBST(SGI_ABI)
98if test ! -z "$SGI_ABI"
99then
100 CC="cc $SGI_ABI"
101 LDFLAGS="$SGI_ABI $LDFLAGS"
102 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
103fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000104AC_MSG_RESULT($MACHDEP)
105
Guido van Rossum627b2d71993-12-24 10:39:16 +0000106# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000107AC_MSG_CHECKING(for --without-gcc)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000108AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000109 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000110 no) CC=cc
111 without_gcc=yes;;
112 yes) CC=gcc
113 without_gcc=no;;
114 *) CC=$withval
115 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000116 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000117 case $ac_sys_system in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000118 AIX*) CC=cc_r
119 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000120 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000121 case $BE_HOST_CPU in
122 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000123 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000124 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000125 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 +0000126 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000127 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000128 ;;
129 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000130 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000131 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000132 OPT=-O
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000133 ;;
134 *)
Fred Drake5790be12000-10-09 17:06:13 +0000135 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000136 ;;
137 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000138 AR="\$(srcdir)/Modules/ar_beos"
139 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000140 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000141 Monterey*)
142 RANLIB=:
Martin v. Löwis130fb172001-07-19 11:00:41 +0000143 without_gcc=;;
144 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000145 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000146AC_MSG_RESULT($without_gcc)
147
Guido van Rossum27552902001-01-23 01:52:26 +0000148AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000149AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000150MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000151AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000152AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000153 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000154 case $withval in
155 no) CXX=
156 with_cxx=no;;
157 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000158 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000159 with_cxx=$withval;;
160 esac], [
161 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000162 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000163])
164AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000165
Michael W. Hudson54241132001-12-07 15:38:26 +0000166if test "$with_cxx" = "yes"
167then
168 AC_ERROR(must supply a compiler when using --with-cxx)
169fi
170
Martin v. Löwis537970f2000-12-13 17:37:02 +0000171dnl The following fragment works similar to AC_PROG_CXX.
172dnl It does not fail if CXX is not found, and it is not executed if
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000173dnl --without-cxx was given.
Martin v. Löwis537970f2000-12-13 17:37:02 +0000174dnl Finally, it does not test whether CXX is g++.
175
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000176dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
177ifdef([AC_PROG_CXX_WORKS],[],
178 [AC_DEFUN([AC_PROG_CXX_WORKS],
179 [AC_LANG_PUSH(C++)dnl
180 _AC_COMPILER_EXEEXT
181 AC_LANG_POP()
182 ]
183)])
184
Martin v. Löwis537970f2000-12-13 17:37:02 +0000185if test "$check_cxx" = "yes"
186then
187 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
188 if test "$CXX" = "notfound"
189 then
190 CXX=
191 else
192 AC_PROG_CXX_WORKS
193 fi
194fi
195
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000196# If the user switches compilers, we can't believe the cache
197if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
198then
199 AC_ERROR(cached CC is different -- throw away $cache_file
200(it is also a good idea to do 'make clean' before compiling))
201fi
202
Guido van Rossum627b2d71993-12-24 10:39:16 +0000203AC_PROG_CC
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000204
205# checks for UNIX variants that set C preprocessor variables
206AC_AIX
207AC_MINIX
208
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000209AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000210AC_MSG_CHECKING(for --with-suffix)
211AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
212 case $withval in
213 no) EXEEXT=;;
214 yes) EXEEXT=.exe;;
215 *) EXEEXT=$withval;;
216 esac])
217AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000218
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000219# Test whether we're running on a non-case-sensitive system, in which
220# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000221AC_SUBST(BUILDEXEEXT)
222AC_MSG_CHECKING(for case-insensitive build directory)
223if test -d "python"
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000224then
Jack Jansen1999ef42001-12-06 21:47:20 +0000225 AC_MSG_RESULT(yes)
226 BUILDEXEEXT=.exe
227else
228 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000229 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000230fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000231
Guido van Rossumdd997f71998-10-07 19:58:26 +0000232case $MACHDEP in
233bsdos*)
234 case $CC in
235 gcc) CC="$CC -D_HAVE_BSDI";;
236 esac;;
237esac
238
Guido van Rossum84561611997-08-21 00:08:11 +0000239case $ac_sys_system in
240hp*|HP*)
241 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000242 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000243 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000244Monterey*)
245 case $CC in
246 cc) CC="$CC -Wl,-Bexport";;
247 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000248SunOS*)
249 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000250 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000251 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000252esac
253
Martin v. Löwise8964d42001-03-06 12:09:07 +0000254
Neil Schemenauer61c51152001-01-26 16:18:16 +0000255AC_SUBST(LIBRARY)
256AC_MSG_CHECKING(LIBRARY)
257if test -z "$LIBRARY"
258then
259 LIBRARY='libpython$(VERSION).a'
260fi
261AC_MSG_RESULT($LIBRARY)
262
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000263# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000264# name of the library into which to insert object files). BLDLIBRARY is also
265# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
266# is blank as the main program is not linked directly against LDLIBRARY.
267# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
268# systems without shared libraries, LDLIBRARY is the same as LIBRARY
269# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
270# DLLLIBRARY is the shared (i.e., DLL) library.
271#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000272# RUNSHARED is used to run shared python without installed libraries
273#
274# INSTSONAME is the name of the shared library that will be use to install
275# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000276AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000277AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000278AC_SUBST(BLDLIBRARY)
279AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000280AC_SUBST(INSTSONAME)
281AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000282LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000283BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis09bdf722002-05-08 08:51:29 +0000284INSTSONAME='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000285DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000286LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000287RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000288
Guido van Rossumfb842551997-08-06 23:42:07 +0000289# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000290# If CXX is set, and if it is needed to link a main function that was
291# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
292# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000293# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000294# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000295AC_SUBST(LINKCC)
296AC_MSG_CHECKING(LINKCC)
297if test -z "$LINKCC"
298then
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000299 if test -z "$CXX"; then
300 LINKCC="\$(PURIFY) \$(CC)"
301 else
Martin v. Löwis1931ca72002-06-01 21:39:58 +0000302 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000303 $CXX -c conftest.$ac_ext 2>&5
304 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
305 && test -s conftest$ac_exeext && ./conftest$ac_exeext
306 then
307 LINKCC="\$(PURIFY) \$(CC)"
308 else
309 LINKCC="\$(PURIFY) \$(CXX)"
310 fi
311 rm -fr conftest*
312 fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000313 case $ac_sys_system in
314 AIX*)
Jeremy Hylton90d10062002-03-08 21:43:51 +0000315 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); $LINKCC";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000316 dgux*)
Martin v. Löwis4e732dc2002-03-19 15:15:32 +0000317 LINKCC="LD_RUN_PATH=$libdir $LINKCC";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000318 Monterey64*)
Martin v. Löwis4e732dc2002-03-19 15:15:32 +0000319 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000320 esac
321fi
322AC_MSG_RESULT($LINKCC)
323
Martin v. Löwis1142de32002-03-29 16:28:31 +0000324AC_MSG_CHECKING(for --enable-shared)
325AC_ARG_ENABLE(shared,
326[ --enable-shared disable/enable building shared python library])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000327
Martin v. Löwis1142de32002-03-29 16:28:31 +0000328if test -z "$enable_shared"
329then
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000330 case $ac_sys_system in
331 CYGWIN*)
332 enable_shared="yes";;
333 *)
334 enable_shared="no";;
335 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000336fi
337AC_MSG_RESULT($enable_shared)
338
339
340AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000341
Guido van Rossumb8552162001-09-05 14:58:11 +0000342# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
343# library that we build, but we do not want to link against it (we
344# will find it with a -framework option). For this reason there is an
345# extra variable BLDLIBRARY against which Python and the extension
346# modules are linked, BLDLIBRARY. This is normally the same as
347# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000348if test "$enable_framework"
349then
350 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
351 LDLIBRARYDIR='$(PYTHONFRAMEWORKDIR)'
352 BLDLIBRARY=''
353else
354 BLDLIBRARY='$(LDLIBRARY)'
355fi
356
Martin v. Löwis1142de32002-03-29 16:28:31 +0000357# Other platforms follow
358if test $enable_shared = "yes"; then
359 case $ac_sys_system in
360 BeOS*)
361 LDLIBRARY='libpython$(VERSION).so'
362 ;;
363 CYGWIN*)
364 LDLIBRARY='libpython$(VERSION).dll.a'
365 DLLLIBRARY='libpython$(VERSION).dll'
366 ;;
367 SunOS*)
368 LDLIBRARY='libpython$(VERSION).so'
369 BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(VERSION)'
370 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
371 ;;
372 Linux*)
373 LDLIBRARY='libpython$(VERSION).so'
374 BLDLIBRARY='-L. -lpython$(VERSION)'
375 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
376 INSTSONAME="$LDLIBRARY".$SOVERSION
377 ;;
378 hp*|HP*)
379 LDLIBRARY='libpython$(VERSION).sl'
380 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
381 RUNSHARED=SHLIB_PATH=`pwd`:$SHLIB_PATH
382 ;;
383 OSF*)
384 LDLIBRARY='libpython$(VERSION).so'
385 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
386 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
387 ;;
388 esac
389 # DG/UX requires some fancy ld contortions to produce a .so from an .a
390 case $MACHDEP in
391 dguxR4)
392 LDLIBRARY='libpython$(VERSION).so'
393 OPT="$OPT -pic"
394 ;;
395 esac
396fi
397
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000398AC_MSG_RESULT($LDLIBRARY)
399
Guido van Rossum627b2d71993-12-24 10:39:16 +0000400AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000401AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000402AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000403
404case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +0000405bsdos*|hp*|HP*)
406 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +0000407 if test -z "$INSTALL"
408 then
409 INSTALL="${srcdir}/install-sh -c"
410 fi
411esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000412AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000413
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000414# Not every filesystem supports hard links
415AC_SUBST(LN)
416if test -z "$LN" ; then
417 case $ac_sys_system in
418 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000419 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000420 *) LN=ln;;
421 esac
422fi
423
Fred Drake9f715822001-07-11 06:27:00 +0000424# Check for --with-pydebug
425AC_MSG_CHECKING(for --with-pydebug)
426AC_ARG_WITH(pydebug,
427[ --with-pydebug build with Py_DEBUG defined], [
428if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000429then
430 AC_DEFINE(Py_DEBUG, 1,
431 [Define if you want to build an interpreter with many run-time checks.])
432 AC_MSG_RESULT(yes);
433 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +0000434else AC_MSG_RESULT(no); Py_DEBUG='false'
435fi],
436[AC_MSG_RESULT(no)])
437
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000438# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000439AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000440if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000441then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000442 case $GCC in
443 yes)
444 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000445 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000446 if test "$Py_DEBUG" = 'true' ; then
447 # Optimization messes up debuggers, so turn it off for
448 # debug builds.
449 OPT="-g -Wall -Wstrict-prototypes"
450 else
451 OPT="-g -O3 -Wall -Wstrict-prototypes"
452 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000453 *)
Fred Drake9f715822001-07-11 06:27:00 +0000454 OPT="-O3 -Wall -Wstrict-prototypes";;
455 esac
456 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000457 *)
458 case $ac_sys_system in
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000459 OpenUNIX*|UnixWare*)
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000460 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
461 *)
462 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000463 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000464 esac
Jack Jansenca06bc62001-08-03 15:32:23 +0000465 case $ac_sys_system in
466 Darwin*)
Jack Jansen524a0982002-03-12 15:25:52 +0000467 OPT="$OPT -Wno-long-double -no-cpp-precomp";;
Jack Jansenca06bc62001-08-03 15:32:23 +0000468 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000469fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000470
Fred Drakee1ceaa02001-12-04 20:55:47 +0000471if test "$Py_DEBUG" = 'true'; then
472 :
473else
474 OPT="-DNDEBUG $OPT"
475fi
476
Trent Mick635f6fb2000-08-23 21:33:05 +0000477# The current (beta) Monterey compiler dies with optimizations
478case $ac_sys_system in
479Monterey*) OPT="";;
480esac
481
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000482if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000483then
484 OPT="$OPT $ac_arch_flags"
485fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000486
Guido van Rossum91922671997-10-09 20:24:13 +0000487AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
488AC_CACHE_VAL(ac_cv_opt_olimit_ok,
489[ac_save_cc="$CC"
490CC="$CC -OPT:Olimit=0"
491AC_TRY_RUN([int main() { return 0; }],
492 ac_cv_opt_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000493 ac_cv_opt_olimit_ok=no,
Guido van Rossum91922671997-10-09 20:24:13 +0000494 ac_cv_opt_olimit_ok=no)
495CC="$ac_save_cc"])
496AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000497if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000498 case $ac_sys_system in
499 Darwin*) OPT="$OPT" ;;
500 *) OPT="$OPT -OPT:Olimit=0";;
501 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000502else
503 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
504 AC_CACHE_VAL(ac_cv_olimit_ok,
505 [ac_save_cc="$CC"
506 CC="$CC -Olimit 1500"
507 AC_TRY_RUN([int main() { return 0; }],
508 ac_cv_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000509 ac_cv_olimit_ok=no,
Guido van Rossumf8678121998-07-07 21:05:09 +0000510 ac_cv_olimit_ok=no)
511 CC="$ac_save_cc"])
512 AC_MSG_RESULT($ac_cv_olimit_ok)
513 if test $ac_cv_olimit_ok = yes; then
514 OPT="$OPT -Olimit 1500"
515 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000516fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000517
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000518# On some compilers, pthreads are available without further options
519# (e.g. MacOS X). On some of these systems, the compiler will not
520# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
521# So we have to see first whether pthreads are available without
522# options before we can check whether -Kpthread improves anything.
523AC_MSG_CHECKING(whether pthreads are available without options)
524AC_CACHE_VAL(ac_cv_pthread_is_default,
525[AC_TRY_RUN([
526#include <pthread.h>
527
528void* routine(void* p){return NULL;}
529
530int main(){
531 pthread_t p;
532 if(pthread_create(&p,NULL,routine,NULL)!=0)
533 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +0000534 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000535 return 0;
536}
537],
538 ac_cv_pthread_is_default=yes,
539 ac_cv_pthread_is_default=no,
540 ac_cv_pthread_is_default=no)
541])
542AC_MSG_RESULT($ac_cv_pthread_is_default)
543
544
545if test $ac_cv_pthread_is_default = yes
546then
547 ac_cv_kpthread=no
548else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000549# -Kpthread, if available, provides the right #defines
550# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000551# Some compilers won't report that they do not support -Kpthread,
552# so we need to run a program to see whether it really made the
553# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +0000554AC_MSG_CHECKING(whether $CC accepts -Kpthread)
555AC_CACHE_VAL(ac_cv_kpthread,
556[ac_save_cc="$CC"
557CC="$CC -Kpthread"
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000558AC_TRY_RUN([
559#include <pthread.h>
560
561void* routine(void* p){return NULL;}
562
563int main(){
564 pthread_t p;
565 if(pthread_create(&p,NULL,routine,NULL)!=0)
566 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +0000567 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000568 return 0;
569}
570],
Martin v. Löwis130fb172001-07-19 11:00:41 +0000571 ac_cv_kpthread=yes,
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000572 ac_cv_kpthread=no,
Martin v. Löwis130fb172001-07-19 11:00:41 +0000573 ac_cv_kpthread=no)
574CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +0000575AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000576fi
Martin v. Löwis130fb172001-07-19 11:00:41 +0000577
Fred Drakece81d592000-07-09 14:39:29 +0000578dnl # check for ANSI or K&R ("traditional") preprocessor
579dnl AC_MSG_CHECKING(for C preprocessor type)
580dnl AC_TRY_COMPILE([
581dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
582dnl int foo;
583dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
584dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
585dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000586
Guido van Rossum627b2d71993-12-24 10:39:16 +0000587# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000588AC_HEADER_STDC
Martin v. Löwis2e64c342002-03-27 18:49:02 +0000589AC_CHECK_HEADERS(dlfcn.h fcntl.h grp.h limits.h langinfo.h \
590libintl.h locale.h ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000591signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Neal Norwitz3d949422002-04-20 13:46:43 +0000592sys/audioio.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000593sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Martin v. Löwis69532332001-10-13 09:12:41 +0000594sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \
Martin v. Löwis1ba3fd52001-08-10 20:29:40 +0000595ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h netpacket/packet.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000596AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000597
598# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000599was_it_defined=no
600AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000601AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
602 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
603])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000604AC_MSG_RESULT($was_it_defined)
605
Guido van Rossum810cc512001-09-09 23:51:39 +0000606# Two defines needed to enable largefile support on various platforms
607# These may affect some typedefs
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000608AC_DEFINE(_LARGEFILE_SOURCE, 1,
609[This must be defined on some systems to enable large file support.])
610AC_DEFINE(_FILE_OFFSET_BITS, 64,
611[This must be set to 64 on some systems to enable large file support.])
Guido van Rossum810cc512001-09-09 23:51:39 +0000612
Guido van Rossum300fda71996-08-19 21:58:16 +0000613# Add some code to confdefs.h so that the test for off_t works on SCO
614cat >> confdefs.h <<\EOF
615#if defined(SCO_DS)
616#undef _OFF_T
617#endif
618EOF
619
Guido van Rossumef2255b2000-03-10 22:30:29 +0000620# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000621AC_TYPE_MODE_T
622AC_TYPE_OFF_T
623AC_TYPE_PID_T
624AC_TYPE_SIGNAL
625AC_TYPE_SIZE_T
626AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000627
Guido van Rossumef2255b2000-03-10 22:30:29 +0000628# Sizes of various common basic types
Guido van Rossum3065c942001-09-17 04:03:14 +0000629AC_CHECK_SIZEOF(int, 4)
630AC_CHECK_SIZEOF(long, 4)
631AC_CHECK_SIZEOF(void *, 4)
632AC_CHECK_SIZEOF(char, 1)
633AC_CHECK_SIZEOF(short, 2)
634AC_CHECK_SIZEOF(float, 4)
635AC_CHECK_SIZEOF(double, 8)
636AC_CHECK_SIZEOF(fpos_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +0000637
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000638AC_MSG_CHECKING(for long long support)
639have_long_long=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000640AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
641 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
642 have_long_long=yes
643])
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000644AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000645if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000646AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000647fi
648
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000649AC_MSG_CHECKING(for uintptr_t support)
650have_uintptr_t=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000651AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
652 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
653 have_uintptr_t=yes
654])
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000655AC_MSG_RESULT($have_uintptr_t)
656if test "$have_uintptr_t" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000657AC_CHECK_SIZEOF(uintptr_t, 4)
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000658fi
659
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000660# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
661AC_MSG_CHECKING(size of off_t)
662AC_CACHE_VAL(ac_cv_sizeof_off_t,
663[AC_TRY_RUN([#include <stdio.h>
664#include <sys/types.h>
665main()
666{
667 FILE *f=fopen("conftestval", "w");
668 if (!f) exit(1);
669 fprintf(f, "%d\n", sizeof(off_t));
670 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000671}],
672ac_cv_sizeof_off_t=`cat conftestval`,
673ac_cv_sizeof_off_t=0,
674ac_cv_sizeof_off_t=4)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000675])
676AC_MSG_RESULT($ac_cv_sizeof_off_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000677AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
678[The number of bytes in an off_t.])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000679
680AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000681if test "$have_long_long" = yes -a \
682 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
683 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000684 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
685 [Defined to enable large file support when an off_t is bigger than a long
686 and long long is available and at least as big as an off_t. You may need
687 to add some flags for configuration and compilation to enable this mode.
688 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000689 AC_MSG_RESULT(yes)
690else
691 AC_MSG_RESULT(no)
692fi
693
Fred Drakea3f6e912000-06-29 20:44:47 +0000694# AC_CHECK_SIZEOF() doesn't include <time.h>.
695AC_MSG_CHECKING(size of time_t)
696AC_CACHE_VAL(ac_cv_sizeof_time_t,
697[AC_TRY_RUN([#include <stdio.h>
698#include <time.h>
699main()
700{
701 FILE *f=fopen("conftestval", "w");
702 if (!f) exit(1);
703 fprintf(f, "%d\n", sizeof(time_t));
704 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000705}],
706ac_cv_sizeof_time_t=`cat conftestval`,
707ac_cv_sizeof_time_t=0,
708ac_cv_sizeof_time_t=4)
Fred Drakea3f6e912000-06-29 20:44:47 +0000709])
710AC_MSG_RESULT($ac_cv_sizeof_time_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000711AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
712[The number of bytes in a time_t.])
Fred Drakea3f6e912000-06-29 20:44:47 +0000713
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000714
Trent Mick635f6fb2000-08-23 21:33:05 +0000715# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000716ac_save_cc="$CC"
717if test "$ac_cv_kpthread" = "yes"
718then CC="$CC -Kpthread"
719fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000720AC_MSG_CHECKING(for pthread_t)
721have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000722AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000723AC_MSG_RESULT($have_pthread_t)
724if test "$have_pthread_t" = yes ; then
725 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
726 AC_MSG_CHECKING(size of pthread_t)
727 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
728 [AC_TRY_RUN([#include <stdio.h>
729 #include <pthread.h>
730 main()
731 {
732 FILE *f=fopen("conftestval", "w");
733 if (!f) exit(1);
734 fprintf(f, "%d\n", sizeof(pthread_t));
735 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000736 }],
737 ac_cv_sizeof_pthread_t=`cat conftestval`,
738 ac_cv_sizeof_pthread_t=0,
739 ac_cv_sizeof_pthread_t=4)
Trent Mick635f6fb2000-08-23 21:33:05 +0000740 ])
741 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000742 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
743 [The number of bytes in a pthread_t.])
Trent Mick635f6fb2000-08-23 21:33:05 +0000744fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000745CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000746
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000747AC_MSG_CHECKING(for --enable-toolbox-glue)
748AC_ARG_ENABLE(toolbox-glue,
749[ --enable-toolbox-glue disable/enable MacOSX glue code for extensions])
750
751if test -z "$enable_toolbox_glue"
752then
753 case $ac_sys_system/$ac_sys_release in
754 Darwin/*)
755 enable_toolbox_glue="yes";;
756 *)
757 enable_toolbox_glue="no";;
758 esac
759fi
760case "$enable_toolbox_glue" in
761yes)
Jack Jansen666b1e72001-10-31 12:11:48 +0000762 extra_frameworks="-framework CoreServices -framework Foundation"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000763 extra_machdep_objs="Python/mactoolboxglue.o"
Jack Jansen591cbed2001-08-15 13:55:15 +0000764 extra_undefs="-u __dummy -u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000765 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
766 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000767 ;;
768*)
769 extra_frameworks=""
770 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +0000771 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000772 ;;
773esac
774AC_MSG_RESULT($enable_toolbox_glue)
775
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000776AC_SUBST(LIBTOOL_CRUFT)
777case $ac_sys_system/$ac_sys_release in
Jack Jansen418c3b12001-11-14 10:59:57 +0000778 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +0000779 ns_undef_sym='_environ'
Jack Jansen418c3b12001-11-14 10:59:57 +0000780 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym"
781 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
Jack Jansena3891ea2001-09-07 14:25:12 +0000782 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
783 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +0000784 Darwin/*)
785 ns_undef_sym='_environ'
Jack Jansen418c3b12001-11-14 10:59:57 +0000786 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym"
787 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000788 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
789 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000790esac
791
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000792AC_MSG_CHECKING(for --enable-framework)
793if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000794then
Jack Jansenca06bc62001-08-03 15:32:23 +0000795 OPT="$OPT -fno-common -dynamic"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000796 # -U __environ is needed since bundles don't have access
797 # to crt0 when built but will always be linked against it
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000798 # -F. is needed to allow linking to the framework while
799 # in the build location.
800
Jack Jansena3891ea2001-09-07 14:25:12 +0000801 case $ac_sys_system/$ac_sys_release in
Jack Jansen418c3b12001-11-14 10:59:57 +0000802 Darwin/1.3*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-U,$ns_undef_sym";;
803 Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";;
Jack Jansena3891ea2001-09-07 14:25:12 +0000804 esac
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000805 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
806 [Define if you want to produce an OpenStep/Rhapsody framework
807 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000808 AC_MSG_RESULT(yes)
809else
810 AC_MSG_RESULT(no)
811fi
812
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000813AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000814case $ac_sys_system/$ac_sys_release in
815 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000816 AC_DEFINE(WITH_DYLD, 1,
817 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
818 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
819 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000820 AC_MSG_RESULT(always on for Darwin)
821 ;;
822 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000823 AC_MSG_RESULT(no)
824 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000825esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000826
Guido van Rossumac405f61994-09-12 10:56:06 +0000827# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000828AC_SUBST(SO)
829AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000830AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000831AC_SUBST(CCSHARED)
832AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000833# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000834# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000835AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000836if test -z "$SO"
837then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000838 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000839 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000840 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000841 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000842 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000843fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000844AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000845# LDSHARED is the ld *command* used to create shared library
Martin v. Löwis5b718fc2001-09-10 15:34:42 +0000846# -- "ld" on SunOS 4.x.x, "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000847# (Shared libraries in this instance are shared modules to be loaded into
848# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000849AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000850if test -z "$LDSHARED"
851then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000852 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000853 AIX*)
854 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
Guido van Rossumce608b02001-09-28 15:59:38 +0000855 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000856 ;;
857 BeOS*)
858 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +0000859 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000860 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000861 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000862 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000863 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a662000-05-26 12:22:54 +0000864 SunOS/5*)
865 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000866 then LDSHARED='$(CC) -shared'
Martin v. Löwis5b718fc2001-09-10 15:34:42 +0000867 else LDSHARED="$(CC) -G";
Greg Ward57c9a662000-05-26 12:22:54 +0000868 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000869 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000870 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000871 DYNIX/ptx*) LDSHARED="ld -G";;
Jack Jansen418c3b12001-11-14 10:59:57 +0000872 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +0000873 LDSHARED='$(CC) $(LDFLAGS) -bundle'
874 if test "$enable_framework" ; then
875 # Link against the framework. All externals should be defined.
876 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
877 else
878 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +0000879 LDSHARED="$LDSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +0000880 fi ;;
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000881 Darwin/*)
882 LDSHARED='$(CC) $(LDFLAGS) -bundle'
883 if test "$enable_framework" ; then
884 # Link against the framework. All externals should be defined.
885 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
886 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +0000887 # No framework, use the Python app as bundle-loader
888 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
889 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000890 fi ;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +0000891 Linux*|GNU*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000892 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000893 BSD/OS*/4*) LDSHARED="gcc -shared";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000894 OpenBSD*|NetBSD*|FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000895 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000896 then
897 LDSHARED="cc -shared ${LDFLAGS}"
898 else
899 LDSHARED="ld -Bshareable ${LDFLAGS}"
900 fi;;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000901 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +0000902 if test "$GCC" = "yes"
903 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000904 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000905 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000906 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000907 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000908 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000909 *) LDSHARED="ld";;
910 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000911fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000912AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000913BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000914# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000915# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000916AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000917if test -z "$CCSHARED"
918then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000919 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000920 SunOS*) if test "$GCC" = yes;
921 then CCSHARED="-fPIC";
922 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000923 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +0000924 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +0000925 else CCSHARED="+z";
926 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +0000927 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000928 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000929 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000930 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +0000931 if test "$GCC" = "yes"
932 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000933 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000934 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000935 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000936 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000937 IRIX*/6*) case $CC in
938 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000939 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000940 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000941 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000942 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000943fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000944AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000945# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000946# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000947AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000948if test -z "$LINKFORSHARED"
949then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000950 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000951 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000952 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000953 LINKFORSHARED="-Wl,-E -Wl,+s";;
954# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000955 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +0000956 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000957 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000958 Darwin/*)
959 # -u __dummy makes the linker aware of the objc runtime
960 # in System.framework; otherwise, __objcInit (referenced in
961 # crt1.o) gets erroneously defined as common, which breaks dynamic
962 # loading of any modules which reference it in System.framework.
963 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
964 # not used by the core itself but which needs to be in the core so
965 # that dynamically loaded extension modules have access to it.
Jack Jansen591cbed2001-08-15 13:55:15 +0000966 LINKFORSHARED="$extra_undefs -framework System"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000967 if test "$enable_framework"
968 then
969 LINKFORSHARED="$LINKFORSHARED -framework Python"
970 fi
971 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000972 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000973 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000974 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000975 FreeBSD*|NetBSD*|OpenBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000976 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
977 then
978 LINKFORSHARED="-Wl,--export-dynamic"
979 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000980 SunOS/5*) case $CC in
981 *gcc*)
Martin v. Löwisa4548572002-04-18 14:51:36 +0000982 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000983 then
984 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000985 fi;;
986 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000987 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000988fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000989AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000990
Neil Schemenauer61c51152001-01-26 16:18:16 +0000991AC_SUBST(CFLAGSFORSHARED)
992AC_MSG_CHECKING(CFLAGSFORSHARED)
993if test ! "$LIBRARY" = "$LDLIBRARY"
994then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000995 case $ac_sys_system in
996 CYGWIN*)
997 # Cygwin needs CCSHARED when building extension DLLs
998 # but not when building the interpreter DLL.
999 CFLAGSFORSHARED='';;
1000 *)
1001 CFLAGSFORSHARED='$(CCSHARED)'
1002 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +00001003fi
1004AC_MSG_RESULT($CFLAGSFORSHARED)
1005
Guido van Rossum627b2d71993-12-24 10:39:16 +00001006# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001007AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1008AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Martin v. Löwis41933dd2002-03-21 15:10:58 +00001009AC_CHECK_LIB(rt, sem_init) # 'Real Time' functions on Solaris
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00001010
1011# checks for system dependent C++ extensions support
1012case "$ac_sys_system" in
1013 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1014 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1015 [loadAndInit("", 0, "")],
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001016 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1017 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1018 and you want support for AIX C++ shared extension modules.])
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00001019 AC_MSG_RESULT(yes)],
1020 [AC_MSG_RESULT(no)]);;
1021 *) ;;
1022esac
1023
Guido van Rossum70c7f481998-03-26 18:44:10 +00001024# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1025# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001026# BeOS' sockets are stashed in libnet.
1027case "$ac_sys_system" in
1028IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +00001029*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001030AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001031AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00001032;;
1033esac
1034case "$ac_sys_system" in
1035BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001036AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1037;;
1038esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00001039
Guido van Rossumc5a39031996-07-31 17:35:03 +00001040AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001041AC_ARG_WITH(libs,
1042[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +00001043AC_MSG_RESULT($withval)
1044LIBS="$withval $LIBS"
1045], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001046
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001047# Determine if signalmodule should be used.
1048AC_SUBST(USE_SIGNAL_MODULE)
1049AC_SUBST(SIGNAL_OBJS)
1050AC_MSG_CHECKING(for --with-signal-module)
1051AC_ARG_WITH(signal-module,
1052[ --with-signal-module disable/enable signal module])
1053
1054if test -z "$with_signal_module"
1055then with_signal_module="yes"
1056fi
1057AC_MSG_RESULT($with_signal_module)
1058
1059if test "${with_signal_module}" = "yes"; then
1060 USE_SIGNAL_MODULE=""
1061 SIGNAL_OBJS=""
1062else
1063 USE_SIGNAL_MODULE="#"
1064 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1065fi
1066
Guido van Rossum3d15bd82001-01-10 18:53:48 +00001067# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00001068AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001069USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00001070
Guido van Rossum54d93d41997-01-22 20:51:58 +00001071AC_MSG_CHECKING(for --with-dec-threads)
1072AC_SUBST(LDLAST)
1073AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d82000-06-29 16:12:00 +00001074[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
1075AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00001076LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00001077if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00001078 with_thread="$withval";
1079fi],
1080AC_MSG_RESULT(no))
1081
Martin v. Löwis11437992002-04-12 09:54:03 +00001082# Templates for things AC_DEFINEd more than once.
1083# For a single AC_DEFINE, no template is needed.
1084AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
1085AH_TEMPLATE(_REENTRANT,
1086 [Define to force use of thread-safe errno, h_errno, and other functions])
1087AH_TEMPLATE(WITH_THREAD,
1088 [Define if you want to compile in rudimentary thread support])
1089
Guido van Rossum54d93d41997-01-22 20:51:58 +00001090AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001091AC_ARG_WITH(threads,
1092[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +00001093
Barry Warsawc0d24d82000-06-29 16:12:00 +00001094# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00001095AC_ARG_WITH(thread,
1096[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
1097with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +00001098
1099if test -z "$with_threads"
1100then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001101fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00001102AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00001103
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001104AC_SUBST(THREADOBJ)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001105if test "$with_threads" = "no"
1106then
1107 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001108elif test "$ac_cv_pthread_is_default" = yes
1109then
1110 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001111 # Defining _REENTRANT on system with POSIX threads should not hurt.
1112 AC_DEFINE(_REENTRANT)
1113 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001114 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001115elif test "$ac_cv_kpthread" = "yes"
1116then
1117 CC="$CC -Kpthread"
1118 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001119 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001120 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +00001121else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001122 if test ! -z "$with_threads" -a -d "$with_threads"
1123 then LDFLAGS="$LDFLAGS -L$with_threads"
1124 fi
1125 if test ! -z "$withval" -a -d "$withval"
1126 then LDFLAGS="$LDFLAGS -L$withval"
1127 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001128
1129 # According to the POSIX spec, a pthreads implementation must
1130 # define _POSIX_THREADS in unistd.h. Some apparently don't (which ones?)
1131 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1132 AC_EGREP_CPP(yes,
1133 [#include <unistd.h>
1134 #ifdef _POSIX_THREADS
1135 yes
1136 #endif
1137 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1138 AC_MSG_RESULT($unistd_defines_pthreads)
1139
Martin v. Löwis130fb172001-07-19 11:00:41 +00001140 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001141 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1142 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001143 AC_DEFINE(HURD_C_THREADS, 1,
1144 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001145 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001146 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001147 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1148 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001149 AC_DEFINE(MACH_C_THREADS, 1,
1150 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001151 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001152 AC_MSG_CHECKING(for --with-pth)
1153 AC_ARG_WITH(pth,
1154 [ --with-pth use GNU pth threading libraries], [
1155 AC_MSG_RESULT($withval)
1156 AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001157 AC_DEFINE(HAVE_PTH, 1, [Define if you have GNU PTH threads.])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001158 LIBS="-lpth $LIBS"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001159 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001160 AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00001161
1162 # Just looking for pthread_create in libpthread is not enough:
1163 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1164 # So we really have to include pthread.h, and then link.
1165 _libs=$LIBS
1166 LIBS="$LIBS -lpthread"
1167 AC_MSG_CHECKING([for pthread_create in -lpthread])
1168 AC_TRY_LINK([#include <pthread.h>
1169
1170void * start_routine (void *arg) { exit (0); }], [
1171pthread_create (NULL, NULL, start_routine, NULL)], [
1172 AC_MSG_RESULT(yes)
1173 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001174 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001175 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00001176 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00001177 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001178 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001179 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001180 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001181 AC_DEFINE(BEOS_THREADS, 1,
1182 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001183 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001184 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001185 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001186 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001187 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001188 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001189 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001190 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001191 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001192 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001193 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001194 LIBS="$LIBS -lthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001195 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001196 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001197 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001198 LIBS="$LIBS -lpthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001199 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001200 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001201 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001202 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001203 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001204 USE_THREAD_MODULE="#"])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001205 ])])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00001206
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001207 if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001208 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001209 AC_DEFINE(_POSIX_THREADS, 1,
1210 [Define if you have POSIX threads,
1211 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001212 fi
1213
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001214 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1215 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1216 [AC_TRY_RUN([#include <pthread.h>
1217 void *foo(void *parm) {
1218 return NULL;
1219 }
1220 main() {
1221 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00001222 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001223 if (pthread_attr_init(&attr)) exit(-1);
1224 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00001225 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001226 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00001227 }],
1228 ac_cv_pthread_system_supported=yes,
1229 ac_cv_pthread_system_supported=no,
1230 ac_cv_pthread_system_supported=no)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001231 ])
1232 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1233 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001234 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001235 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001236 AC_CHECK_FUNCS(pthread_sigmask)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001237 fi
1238
Martin v. Löwis130fb172001-07-19 11:00:41 +00001239 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1240 LIBS="$LIBS -lmpc"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001241 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001242 USE_THREAD_MODULE=""])
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001243
1244 if test $posix_threads != "yes"; then
1245 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1246 LIBS="$LIBS -lthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001247 THREADOBJ="Python/thread.o"
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001248 USE_THREAD_MODULE=""])
1249 fi
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001250
Martin v. Löwis130fb172001-07-19 11:00:41 +00001251 if test "$USE_THREAD_MODULE" != "#"
1252 then
1253 # If the above checks didn't disable threads, (at least) OSF1
1254 # needs this '-threads' argument during linking.
1255 case $ac_sys_system in
1256 OSF1) LDLAST=-threads;;
1257 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001258 fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00001259fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001260
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001261# Check for enable-ipv6
Martin v. Löwis11437992002-04-12 09:54:03 +00001262AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001263AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001264AC_ARG_ENABLE(ipv6,
1265[ --enable-ipv6 Enable ipv6 (with ipv4) support
1266 --disable-ipv6 Disable ipv6 support],
1267[ case "$enableval" in
1268 no)
1269 AC_MSG_RESULT(no)
1270 ipv6=no
1271 ;;
1272 *) AC_MSG_RESULT(yes)
1273 AC_DEFINE(ENABLE_IPV6)
1274 ipv6=yes
1275 ;;
1276 esac ],
1277
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001278[
1279dnl the check does not work on cross compilation case...
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001280 AC_TRY_RUN([ /* AF_INET6 available check */
1281#include <sys/types.h>
1282#include <sys/socket.h>
1283main()
1284{
1285 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1286 exit(1);
1287 else
1288 exit(0);
1289}
1290],
1291 AC_MSG_RESULT(yes)
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001292 ipv6=yes,
1293 AC_MSG_RESULT(no)
1294 ipv6=no,
1295 AC_MSG_RESULT(no)
1296 ipv6=no
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001297)
1298
1299if test "$ipv6" = "yes"; then
1300 AC_MSG_CHECKING(if RFC2553 API is available)
1301 AC_TRY_COMPILE([#include <sys/types.h>
1302#include <netinet/in.h>],
1303 [struct sockaddr_in6 x;
1304x.sin6_scope_id;],
1305 AC_MSG_RESULT(yes)
1306 ipv6=yes,
1307 AC_MSG_RESULT(no, IPv6 disabled)
1308 ipv6=no)
1309fi
1310
1311if test "$ipv6" = "yes"; then
1312 AC_DEFINE(ENABLE_IPV6)
1313fi
1314])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001315
1316ipv6type=unknown
1317ipv6lib=none
1318ipv6trylibc=no
1319
1320if test "$ipv6" = "yes"; then
1321 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00001322 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1323 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001324 case $i in
1325 inria)
1326 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001327 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001328#include <netinet/in.h>
1329#ifdef IPV6_INRIA_VERSION
1330yes
1331#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001332 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001333 ;;
1334 kame)
1335 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001336 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001337#include <netinet/in.h>
1338#ifdef __KAME__
1339yes
1340#endif],
1341 [ipv6type=$i;
1342 ipv6lib=inet6
1343 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001344 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001345 ;;
1346 linux-glibc)
1347 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001348 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001349#include <features.h>
1350#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1351yes
1352#endif],
1353 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001354 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001355 ;;
1356 linux-inet6)
1357 dnl http://www.v6.linux.or.jp/
1358 if test -d /usr/inet6; then
1359 ipv6type=$i
1360 ipv6lib=inet6
1361 ipv6libdir=/usr/inet6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001362 OPT="-I/usr/inet6/include $OPT"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001363 fi
1364 ;;
1365 solaris)
1366 if test -f /etc/netconfig; then
1367 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1368 ipv6type=$i
1369 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001370 fi
1371 fi
1372 ;;
1373 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001374 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001375#include <sys/param.h>
1376#ifdef _TOSHIBA_INET6
1377yes
1378#endif],
1379 [ipv6type=$i;
1380 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001381 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001382 ;;
1383 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001384 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001385#include </usr/local/v6/include/sys/v6config.h>
1386#ifdef __V6D__
1387yes
1388#endif],
1389 [ipv6type=$i;
1390 ipv6lib=v6;
1391 ipv6libdir=/usr/local/v6/lib;
1392 OPT="-I/usr/local/v6/include $OPT"])
1393 ;;
1394 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001395 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001396#include <sys/param.h>
1397#ifdef _ZETA_MINAMI_INET6
1398yes
1399#endif],
1400 [ipv6type=$i;
1401 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001402 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001403 ;;
1404 esac
1405 if test "$ipv6type" != "unknown"; then
1406 break
1407 fi
1408 done
1409 AC_MSG_RESULT($ipv6type)
1410fi
1411
1412if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1413 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1414 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1415 echo "using lib$ipv6lib"
1416 else
1417 if test $ipv6trylibc = "yes"; then
1418 echo "using libc"
1419 else
1420 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1421 echo "You need to fetch lib$ipv6lib.a from appropriate"
1422 echo 'ipv6 kit and compile beforehand.'
1423 exit 1
1424 fi
1425 fi
1426fi
1427
Barry Warsawef82cd72000-06-30 16:21:01 +00001428# Check for GC support
Barry Warsawef82cd72000-06-30 16:21:01 +00001429AC_MSG_CHECKING(for --with-cycle-gc)
1430AC_ARG_WITH(cycle-gc,
1431[ --with(out)-cycle-gc disable/enable garbage collection])
1432
1433if test -z "$with_cycle_gc"
1434then with_cycle_gc="yes"
1435fi
Neil Schemenauer9c63e6d2001-08-29 23:44:38 +00001436if test "$with_cycle_gc" != "no"
Barry Warsawef82cd72000-06-30 16:21:01 +00001437then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001438 AC_DEFINE(WITH_CYCLE_GC, 1,
1439 [Define if you want to compile in cycle garbage collection.])
Barry Warsawef82cd72000-06-30 16:21:01 +00001440fi
1441AC_MSG_RESULT($with_cycle_gc)
1442
Jack Jansen7b8c7542002-04-14 20:12:41 +00001443# Check for universal newline support
1444AC_MSG_CHECKING(for --with-universal-newline)
1445AC_ARG_WITH(universal-newlines,
1446[ --with(out)-universal-newlines disable/enable foreign newlines])
1447
1448if test -z "$with_universal_newlines"
1449then with_universal_newlines="yes"
1450fi
1451if test "$with_universal_newlines" != "no"
1452then
Martin v. Löwise8aea582002-04-16 05:51:02 +00001453 AC_DEFINE(WITH_UNIVERSAL_NEWLINES, 1,
1454 [Define if you want to read files with foreign newlines.])
Jack Jansen7b8c7542002-04-14 20:12:41 +00001455fi
1456AC_MSG_RESULT($with_universal_newlines)
1457
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00001458# Check for --with-doc-strings
1459AC_MSG_CHECKING(for --with-doc-strings)
1460AC_ARG_WITH(doc-strings,
1461[ --with(out)-doc-strings disable/enable documentation strings])
1462
1463if test -z "$with_doc_strings"
1464then with_doc_strings="yes"
1465fi
1466if test "$with_doc_strings" != "no"
1467then
1468 AC_DEFINE(WITH_DOC_STRINGS, 1,
1469 [Define if you want documentation strings in extension modules])
1470fi
1471AC_MSG_RESULT($with_doc_strings)
1472
Neil Schemenauera35c6882001-02-27 04:45:05 +00001473# Check for Python-specific malloc support
1474AC_MSG_CHECKING(for --with-pymalloc)
1475AC_ARG_WITH(pymalloc,
Neil Schemenauer16c22972002-03-22 15:34:49 +00001476[ --with(out)-pymalloc disable/enable specialized mallocs])
1477
1478if test -z "$with_pymalloc"
1479then with_pymalloc="yes"
1480fi
1481if test "$with_pymalloc" != "no"
1482then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001483 AC_DEFINE(WITH_PYMALLOC, 1,
1484 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00001485fi
1486AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00001487
Barry Warsawef82cd72000-06-30 16:21:01 +00001488# Check for --with-wctype-functions
1489AC_MSG_CHECKING(for --with-wctype-functions)
1490AC_ARG_WITH(wctype-functions,
1491[ --with-wctype-functions use wctype.h functions], [
1492if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001493then
1494 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
1495 [Define if you want wctype.h functions to be used instead of the
1496 one supplied by Python itself. (see Include/unicodectype.h).])
1497 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00001498else AC_MSG_RESULT(no)
1499fi],
1500[AC_MSG_RESULT(no)])
1501
Guido van Rossum68242b51996-05-28 22:53:03 +00001502# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001503AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00001504DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001505
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001506AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001507AC_ARG_WITH(sgi-dl,
1508[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001509AC_MSG_RESULT($withval)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001510AC_DEFINE(WITH_SGI_DL, 1,
1511 [Define if you want to use SGI (IRIX 4) dynamic linking.
1512 This requires the "dl" library by Jack Jansen,
1513 ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
1514 Do not bother on IRIX 5, it already has dynamic linking using SunOS
1515 style shared libraries])
Guido van Rossume97ee181999-12-20 21:27:22 +00001516DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001517dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001518if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001519then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001520else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1521fi
1522DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001523LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001524
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001525AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001526AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001527AC_MSG_RESULT($withval)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001528AC_DEFINE(WITH_DL_DLD, 1,
1529 [Define if you want to emulate SGI (IRIX 4) dynamic linking.
1530 This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4),
1531 Sequent Symmetry (Dynix), and Atari ST.
1532 This requires the 'dl-dld' library,
1533 ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z,
1534 as well as the 'GNU dld' library,
1535 ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z.
1536 Do not bother on SunOS 4 or 5, they already have dynamic linking using
1537 shared libraries.])
Guido van Rossume97ee181999-12-20 21:27:22 +00001538DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001539dldir=`echo "$withval" | sed 's/,.*//'`
1540dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001541if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001542then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001543else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1544fi
1545DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001546LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001547
Guido van Rossume97ee181999-12-20 21:27:22 +00001548# the dlopen() function means we might want to use dynload_shlib.o. some
1549# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001550AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001551
1552# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1553# loading of modules.
1554AC_SUBST(DYNLOADFILE)
1555AC_MSG_CHECKING(DYNLOADFILE)
1556if test -z "$DYNLOADFILE"
1557then
1558 case $ac_sys_system/$ac_sys_release in
1559 AIX*) DYNLOADFILE="dynload_aix.o";;
1560 BeOS*) DYNLOADFILE="dynload_beos.o";;
1561 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001562 Darwin/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001563 *)
1564 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1565 # out any dynamic loading
1566 if test "$ac_cv_func_dlopen" = yes
1567 then DYNLOADFILE="dynload_shlib.o"
1568 else DYNLOADFILE="dynload_stub.o"
1569 fi
1570 ;;
1571 esac
1572fi
1573AC_MSG_RESULT($DYNLOADFILE)
1574if test "$DYNLOADFILE" != "dynload_stub.o"
1575then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001576 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
1577 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00001578fi
1579
Jack Jansenc49e5b72001-06-19 15:00:23 +00001580# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1581
1582AC_SUBST(MACHDEP_OBJS)
1583AC_MSG_CHECKING(MACHDEP_OBJS)
1584if test -z "$MACHDEP_OBJS"
1585then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001586 MACHDEP_OBJS=$extra_machdep_objs
1587else
1588 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00001589fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001590AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00001591
Guido van Rossum627b2d71993-12-24 10:39:16 +00001592# checks for library functions
Martin v. Löwis244edc82001-10-04 22:44:26 +00001593AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \
Fred Drake6b3cc522002-04-15 19:20:27 +00001594 fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \
Martin v. Löwisf95dd0a2001-08-15 17:14:33 +00001595 gai_strerror getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwis06a83e92002-04-14 10:19:44 +00001596 hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001597 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001598 putenv readlink \
Martin v. Löwis61c5edf2001-10-18 04:06:00 +00001599 select setegid seteuid setgid setgroups \
Martin v. Löwis791bfda2001-07-24 06:33:08 +00001600 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
Michael W. Hudson065c1a22002-06-06 13:03:44 +00001601 sigaction siginterrupt sigrelse strftime strptime symlink \
Michael W. Hudson34f20ea2002-05-27 15:08:24 +00001602 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Guido van Rossumc524d952001-10-19 01:31:59 +00001603 truncate uname unsetenv waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001604
Fred Drake8cef4cf2000-06-28 16:40:38 +00001605# check for openpty and forkpty
1606
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001607AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"]))
1608AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"]))
Fred Drake8cef4cf2000-06-28 16:40:38 +00001609
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001610# check for long file support functions
1611AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1612
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001613AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001614AC_CHECK_FUNCS(getpgrp,
1615 AC_TRY_COMPILE([#include <unistd.h>],
1616 [getpgrp(0);],
1617 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
1618 [Define if getpgrp() must be called as getpgrp(0).])
1619 )
1620)
1621AC_CHECK_FUNCS(setpgrp,
1622 AC_TRY_COMPILE([#include <unistd.h>],
1623 [setpgrp(0,0);],
1624 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
1625 [Define if setpgrp() must be called as setpgrp(0, 0).])
1626 )
1627)
1628AC_CHECK_FUNCS(gettimeofday,
1629 AC_TRY_COMPILE([#include <sys/time.h>],
1630 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
1631 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
1632 [Define if gettimeofday() does not have second (timezone) argument
1633 This is the case on Motorola V4 (R40V4.2)])
1634 )
1635)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001636
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001637
1638# On OSF/1 V5.1, getaddrinfo is available, but a define
1639# for [no]getaddrinfo in netdb.h.
1640AC_MSG_CHECKING(for getaddrinfo)
1641AC_TRY_LINK([
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00001642#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001643#include <sys/socket.h>
1644#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00001645#include <stdio.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001646],[
1647getaddrinfo(NULL, NULL, NULL, NULL);
1648], [
1649AC_MSG_RESULT(yes)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001650AC_MSG_CHECKING(getaddrinfo bug)
1651AC_TRY_RUN([
1652#include <sys/types.h>
1653#include <netdb.h>
1654#include <string.h>
1655#include <sys/socket.h>
1656#include <netinet/in.h>
1657
1658main()
1659{
1660 int passive, gaierr, inet4 = 0, inet6 = 0;
1661 struct addrinfo hints, *ai, *aitop;
1662 char straddr[INET6_ADDRSTRLEN], strport[16];
1663
1664 for (passive = 0; passive <= 1; passive++) {
1665 memset(&hints, 0, sizeof(hints));
1666 hints.ai_family = AF_UNSPEC;
1667 hints.ai_flags = passive ? AI_PASSIVE : 0;
1668 hints.ai_socktype = SOCK_STREAM;
1669 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1670 (void)gai_strerror(gaierr);
1671 goto bad;
1672 }
1673 for (ai = aitop; ai; ai = ai->ai_next) {
1674 if (ai->ai_addr == NULL ||
1675 ai->ai_addrlen == 0 ||
1676 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1677 straddr, sizeof(straddr), strport, sizeof(strport),
1678 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1679 goto bad;
1680 }
1681 switch (ai->ai_family) {
1682 case AF_INET:
1683 if (strcmp(strport, "54321") != 0) {
1684 goto bad;
1685 }
1686 if (passive) {
1687 if (strcmp(straddr, "0.0.0.0") != 0) {
1688 goto bad;
1689 }
1690 } else {
1691 if (strcmp(straddr, "127.0.0.1") != 0) {
1692 goto bad;
1693 }
1694 }
1695 inet4++;
1696 break;
1697 case AF_INET6:
1698 if (strcmp(strport, "54321") != 0) {
1699 goto bad;
1700 }
1701 if (passive) {
1702 if (strcmp(straddr, "::") != 0) {
1703 goto bad;
1704 }
1705 } else {
1706 if (strcmp(straddr, "::1") != 0) {
1707 goto bad;
1708 }
1709 }
1710 inet6++;
1711 break;
1712 case AF_UNSPEC:
1713 goto bad;
1714 break;
1715 default:
1716 /* another family support? */
1717 break;
1718 }
1719 }
1720 }
1721
1722 if (!(inet4 == 0 || inet4 == 2))
1723 goto bad;
1724 if (!(inet6 == 0 || inet6 == 2))
1725 goto bad;
1726
1727 if (aitop)
1728 freeaddrinfo(aitop);
1729 exit(0);
1730
1731 bad:
1732 if (aitop)
1733 freeaddrinfo(aitop);
1734 exit(1);
1735}
1736],
1737AC_MSG_RESULT(good)
1738buggygetaddrinfo=no,
1739AC_MSG_RESULT(buggy)
1740buggygetaddrinfo=yes,
1741AC_MSG_RESULT(buggy)
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001742buggygetaddrinfo=yes)], [
1743AC_MSG_RESULT(no)
1744buggygetaddrinfo=yes
1745])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001746
1747if test "$buggygetaddrinfo" = "yes"; then
1748 if test "$ipv6" = "yes"; then
1749 echo 'Fatal: You must get working getaddrinfo() function.'
1750 echo ' or you can specify "--disable-ipv6"'.
1751 exit 1
1752 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001753else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001754 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001755fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00001756AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001757
Guido van Rossum627b2d71993-12-24 10:39:16 +00001758# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001759AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001760AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001761AC_STRUCT_TIMEZONE
Guido van Rossum98bf58f2001-10-18 20:34:25 +00001762AC_STRUCT_ST_RDEV
1763AC_STRUCT_ST_BLKSIZE
1764AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001765
1766AC_MSG_CHECKING(for time.h that defines altzone)
1767AC_CACHE_VAL(ac_cv_header_time_altzone,
1768[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1769 ac_cv_header_time_altzone=yes,
1770 ac_cv_header_time_altzone=no)])
1771AC_MSG_RESULT($ac_cv_header_time_altzone)
1772if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001773 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001774fi
1775
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001776was_it_defined=no
1777AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001778AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001779#include <sys/types.h>
1780#include <sys/select.h>
1781#include <sys/time.h>
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001782], [;], [
1783 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
1784 [Define if you can safely include both <sys/select.h> and <sys/time.h>
1785 (which you can't on SCO ODT 3.0).])
1786 was_it_defined=yes
1787])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001788AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001789
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001790AC_MSG_CHECKING(for addrinfo)
1791AC_CACHE_VAL(ac_cv_struct_addrinfo,
1792AC_TRY_COMPILE([
1793# include <netdb.h>],
1794 [struct addrinfo a],
1795 ac_cv_struct_addrinfo=yes,
1796 ac_cv_struct_addrinfo=no))
1797AC_MSG_RESULT($ac_cv_struct_addrinfo)
1798if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001799 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001800fi
1801
1802AC_MSG_CHECKING(for sockaddr_storage)
1803AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1804AC_TRY_COMPILE([
1805# include <sys/types.h>
1806# include <sys/socket.h>],
1807 [struct sockaddr_storage s],
1808 ac_cv_struct_sockaddr_storage=yes,
1809 ac_cv_struct_sockaddr_storage=no))
1810AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1811if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001812 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001813fi
1814
Guido van Rossum627b2d71993-12-24 10:39:16 +00001815# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001816
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001817AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001818AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001819
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001820works=no
1821AC_MSG_CHECKING(for working volatile)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001822AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
1823 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
1824)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001825AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001826
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001827works=no
1828AC_MSG_CHECKING(for working signed char)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001829AC_TRY_COMPILE([], [signed char c;], works=yes,
1830 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
1831)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001832AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001833
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001834have_prototypes=no
1835AC_MSG_CHECKING(for prototypes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001836AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
1837 AC_DEFINE(HAVE_PROTOTYPES, 1,
1838 [Define if your compiler supports function prototype])
1839 have_prototypes=yes
1840])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001841AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001842
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001843works=no
1844AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001845AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001846#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001847int foo(int x, ...) {
1848 va_list va;
1849 va_start(va, x);
1850 va_arg(va, int);
1851 va_arg(va, char *);
1852 va_arg(va, double);
1853 return 0;
1854}
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001855], [return foo(10, "", 3.14);], [
1856 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
1857 [Define if your compiler supports variable length function prototypes
1858 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
1859 works=yes
1860])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001861AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001862
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001863if test "$have_prototypes" = yes; then
1864bad_prototypes=no
1865AC_MSG_CHECKING(for bad exec* prototypes)
1866AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001867 AC_DEFINE(BAD_EXEC_PROTOTYPES, 1,
1868 [Define if your <unistd.h> contains bad prototypes for exec*()
1869 (as it does on SGI IRIX 4.x)])
1870 bad_prototypes=yes
1871)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001872AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001873fi
1874
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001875# check if sockaddr has sa_len member
1876AC_MSG_CHECKING(if sockaddr has sa_len member)
1877AC_TRY_COMPILE([#include <sys/types.h>
1878#include <sys/socket.h>],
1879[struct sockaddr x;
1880x.sa_len = 0;],
1881 AC_MSG_RESULT(yes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001882 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001883 AC_MSG_RESULT(no))
1884
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001885AC_MSG_CHECKING(for bad static forward)
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001886AC_CACHE_VAL(ac_cv_bad_static_forward,
1887[AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001888struct s { int a; int b; };
1889static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001890int foobar() {
1891 static int random;
1892 random = (int) &foo;
1893 return random;
1894}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001895static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001896main() {
1897 exit(!((int)&foo == foobar()));
Guido van Rossum3065c942001-09-17 04:03:14 +00001898}],
1899ac_cv_bad_static_forward=no,
1900ac_cv_bad_static_forward=yes,
1901ac_cv_bad_static_forward=no)])
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001902AC_MSG_RESULT($ac_cv_bad_static_forward)
1903if test "$ac_cv_bad_static_forward" = yes
1904then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001905 AC_DEFINE(BAD_STATIC_FORWARD, 1,
1906 [Define if your compiler botches static forward declarations
1907 (as it does on SCI ODT 3.0)])
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001908fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001909
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001910va_list_is_array=no
1911AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001912AC_TRY_COMPILE([
1913#ifdef HAVE_STDARG_PROTOTYPES
1914#include <stdarg.h>
1915#else
1916#include <varargs.h>
1917#endif
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001918], [va_list list1, list2; list1 = list2;], , [
1919 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
1920 va_list_is_array=yes
1921])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001922AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001923
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001924# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
Martin v. Löwis11437992002-04-12 09:54:03 +00001925AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
1926 [Define this if you have some version of gethostbyname_r()])
1927
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001928AC_CHECK_FUNC(gethostbyname_r, [
1929 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1930 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1931 OLD_CFLAGS=$CFLAGS
1932 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1933 AC_TRY_COMPILE([
1934# include <netdb.h>
1935 ], [
1936 char *name;
1937 struct hostent *he, *res;
1938 char buffer[2048];
1939 int buflen = 2048;
1940 int h_errnop;
1941
1942 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1943 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001944 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001945 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
1946 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001947 AC_MSG_RESULT(yes)
1948 ], [
1949 AC_MSG_RESULT(no)
1950 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1951 AC_TRY_COMPILE([
1952# include <netdb.h>
1953 ], [
1954 char *name;
1955 struct hostent *he;
1956 char buffer[2048];
1957 int buflen = 2048;
1958 int h_errnop;
1959
1960 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1961 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001962 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001963 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
1964 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001965 AC_MSG_RESULT(yes)
1966 ], [
1967 AC_MSG_RESULT(no)
1968 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1969 AC_TRY_COMPILE([
1970# include <netdb.h>
1971 ], [
1972 char *name;
1973 struct hostent *he;
1974 struct hostent_data data;
1975
1976 (void) gethostbyname_r(name, he, &data);
1977 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001978 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001979 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
1980 [Define this if you have the 3-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001981 AC_MSG_RESULT(yes)
1982 ], [
1983 AC_MSG_RESULT(no)
1984 ])
1985 ])
1986 ])
1987 CFLAGS=$OLD_CFLAGS
1988], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001989 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001990])
1991AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1992AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1993AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001994AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001995AC_SUBST(HAVE_GETHOSTBYNAME)
1996
Guido van Rossum627b2d71993-12-24 10:39:16 +00001997# checks for system services
1998# (none yet)
1999
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002000# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00002001AC_CHECK_FUNC(__fpu_control,
2002 [],
2003 [AC_CHECK_LIB(ieee, __fpu_control)
2004])
Guido van Rossum627b2d71993-12-24 10:39:16 +00002005
Guido van Rossum93274221997-05-09 02:42:00 +00002006# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00002007AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002008AC_ARG_WITH(fpectl,
2009[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00002010if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002011then
2012 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
2013 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
2014 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00002015else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00002016fi],
2017[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00002018
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002019# check for --with-libm=...
2020AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00002021case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00002022Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002023BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00002024*) LIBM=-lm
2025esac
Guido van Rossum93274221997-05-09 02:42:00 +00002026AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002027AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00002028if test "$withval" = no
2029then LIBM=
2030 AC_MSG_RESULT(force LIBM empty)
2031elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002032then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00002033 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002034else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00002035fi],
2036[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002037
2038# check for --with-libc=...
2039AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00002040AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002041AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00002042if test "$withval" = no
2043then LIBC=
2044 AC_MSG_RESULT(force LIBC empty)
2045elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002046then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00002047 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002048else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00002049fi],
2050[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002051
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00002052# check for hypot() in math library
2053LIBS_SAVE=$LIBS
2054LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00002055AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00002056LIBS=$LIBS_SAVE
2057
Guido van Rossumad713701997-07-10 22:42:38 +00002058# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00002059AC_MSG_CHECKING(what malloc(0) returns)
2060AC_CACHE_VAL(ac_cv_malloc_zero,
2061[AC_TRY_RUN([#include <stdio.h>
2062#ifdef HAVE_STDLIB
2063#include <stdlib.h>
2064#else
2065char *malloc(), *realloc();
2066int *free();
2067#endif
2068main() {
2069 char *p;
2070 p = malloc(0);
2071 if (p == NULL) exit(1);
2072 p = realloc(p, 0);
2073 if (p == NULL) exit(1);
2074 free(p);
2075 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00002076}],
2077ac_cv_malloc_zero=nonnull,
2078ac_cv_malloc_zero=null,
2079ac_cv_malloc_zero=nonnull)]) # XXX arm cross-compile?
Guido van Rossumad713701997-07-10 22:42:38 +00002080AC_MSG_RESULT($ac_cv_malloc_zero)
2081if test "$ac_cv_malloc_zero" = null
2082then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002083 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL, 1,
2084 [Define if malloc(0) returns a NULL pointer.])
Guido van Rossumad713701997-07-10 22:42:38 +00002085fi
2086
Guido van Rossumef2255b2000-03-10 22:30:29 +00002087# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002088AC_CHECK_HEADER(wchar.h, [
2089 AC_DEFINE(HAVE_WCHAR_H, 1,
2090 [Define if the compiler provides a wchar.h header file.])
2091 wchar_h="yes"
2092],
Guido van Rossumef2255b2000-03-10 22:30:29 +00002093wchar_h="no"
2094)
2095
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002096# determine wchar_t size
2097if test "$wchar_h" = yes
2098then
Guido van Rossum67b26592001-10-20 14:21:45 +00002099 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002100fi
2101
2102AC_MSG_CHECKING(what type to use for unicode)
2103AC_ARG_ENABLE(unicode,
2104[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
2105
2106if test $enable_unicode = yes
2107then
Martin v. Löwisfd917792001-06-27 20:22:04 +00002108 # Without any arguments, Py_UNICODE defaults to two-byte mode
2109 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002110fi
2111
Martin v. Löwis0036cba2002-04-12 09:58:45 +00002112AH_TEMPLATE(Py_UNICODE_SIZE,
2113 [Define as the size of the unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002114case "$enable_unicode" in
2115ucs2) unicode_size="2"
2116 AC_DEFINE(Py_UNICODE_SIZE,2)
2117 ;;
2118ucs4) unicode_size="4"
2119 AC_DEFINE(Py_UNICODE_SIZE,4)
2120 ;;
2121esac
2122
Martin v. Löwis11437992002-04-12 09:54:03 +00002123AH_TEMPLATE(PY_UNICODE_TYPE,
2124 [Define as the integral type used for Unicode representation.])
Martin v. Löwis0036cba2002-04-12 09:58:45 +00002125
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002126AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002127if test "$enable_unicode" = "no"
2128then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002129 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002130 AC_MSG_RESULT(not used)
2131else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002132 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002133 AC_DEFINE(Py_USING_UNICODE, 1,
2134 [Define if you want to have a Unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002135 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
2136 then
2137 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002138 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
2139 [Define if you have a useable wchar_t type defined in wchar.h; useable
2140 means wchar_t must be 16-bit unsigned type. (see
2141 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002142 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
2143 elif test "$ac_cv_sizeof_short" = "$unicode_size"
2144 then
2145 PY_UNICODE_TYPE="unsigned short"
2146 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
2147 elif test "$ac_cv_sizeof_long" = "$unicode_size"
2148 then
2149 PY_UNICODE_TYPE="unsigned long"
2150 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
2151 else
2152 PY_UNICODE_TYPE="no type found"
2153 fi
2154 AC_MSG_RESULT($PY_UNICODE_TYPE)
2155fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00002156
2157# check for endianness
2158AC_C_BIGENDIAN
2159
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002160# Check whether right shifting a negative integer extends the sign bit
2161# or fills with zeros (like the Cray J90, according to Tim Peters).
2162AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00002163AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002164AC_TRY_RUN([
2165int main()
2166{
Vladimir Marangozova6180282000-07-12 05:05:06 +00002167 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002168}
Guido van Rossum3065c942001-09-17 04:03:14 +00002169],
2170ac_cv_rshift_extends_sign=yes,
2171ac_cv_rshift_extends_sign=no,
2172ac_cv_rshift_extends_sign=yes)])
Vladimir Marangozova6180282000-07-12 05:05:06 +00002173AC_MSG_RESULT($ac_cv_rshift_extends_sign)
2174if test "$ac_cv_rshift_extends_sign" = no
2175then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002176 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
2177 [Define if i>>j for signed int i does not extend the sign bit
2178 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00002179fi
2180
Guido van Rossumcadfaec2001-01-05 14:45:49 +00002181# check for getc_unlocked and related locking functions
2182AC_MSG_CHECKING(for getc_unlocked() and friends)
2183AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
2184AC_TRY_LINK([#include <stdio.h>],[
2185 FILE *f = fopen("/dev/null", "r");
2186 flockfile(f);
2187 getc_unlocked(f);
2188 funlockfile(f);
2189], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
2190AC_MSG_RESULT($ac_cv_have_getc_unlocked)
2191if test "$ac_cv_have_getc_unlocked" = yes
2192then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002193 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
2194 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00002195fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002196
Martin v. Löwis0daad592001-09-30 21:09:59 +00002197# check for readline 4.0
2198AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002199 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
2200 [Define if you have readline 4.0]), , -ltermcap)
Martin v. Löwis0daad592001-09-30 21:09:59 +00002201
Guido van Rossum353ae582001-07-10 16:45:32 +00002202# check for readline 4.2
2203AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002204 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
2205 [Define if you have readline 4.2]), , -ltermcap)
Guido van Rossum353ae582001-07-10 16:45:32 +00002206
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002207AC_MSG_CHECKING(for broken nice())
2208AC_CACHE_VAL(ac_cv_broken_nice, [
2209AC_TRY_RUN([
2210int main()
2211{
2212 int val1 = nice(1);
2213 if (val1 != -1 && val1 == nice(2))
2214 exit(0);
2215 exit(1);
2216}
Guido van Rossum3065c942001-09-17 04:03:14 +00002217],
2218ac_cv_broken_nice=yes,
2219ac_cv_broken_nice=no,
2220ac_cv_broken_nice=no)])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002221AC_MSG_RESULT($ac_cv_broken_nice)
2222if test "$ac_cv_broken_nice" = yes
2223then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002224 AC_DEFINE(HAVE_BROKEN_NICE, 1,
2225 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002226fi
2227
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002228# On HP/UX 11.0, mvwdelch is a block with a return statement
2229AC_MSG_CHECKING(whether mvwdelch is an expression)
2230AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
2231AC_TRY_COMPILE([#include <curses.h>], [
2232 int rtn;
2233 rtn = mvwdelch(0,0,0);
2234], ac_cv_mvwdelch_is_expression=yes,
2235 ac_cv_mvwdelch_is_expression=no,
2236 ac_cv_mvwdelch_is_expression=yes))
2237AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
2238
2239if test "$ac_cv_mvwdelch_is_expression" = yes
2240then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002241 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
2242 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002243fi
2244
2245AC_MSG_CHECKING(whether WINDOW has _flags)
2246AC_CACHE_VAL(ac_cv_window_has_flags,
2247AC_TRY_COMPILE([#include <curses.h>], [
2248 WINDOW *w;
2249 w->_flags = 0;
2250], ac_cv_window_has_flags=yes,
2251 ac_cv_window_has_flags=no,
2252 ac_cv_window_has_flags=no))
2253AC_MSG_RESULT($ac_cv_window_has_flags)
2254
2255
2256if test "$ac_cv_window_has_flags" = yes
2257then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002258 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
2259 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002260fi
2261
Guido van Rossum95713eb2000-05-18 20:53:31 +00002262# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
2263# Add sys/socket.h to confdefs.h
2264cat >> confdefs.h <<\EOF
2265#ifdef HAVE_SYS_SOCKET_H
2266#include <sys/socket.h>
2267#endif
2268EOF
2269AC_CHECK_TYPE(socklen_t, int)
2270
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002271#AC_MSG_CHECKING(for Modules/Setup)
2272#if test ! -f Modules/Setup ; then
2273# if test ! -d Modules ; then
2274# mkdir Modules
2275# fi
2276# cp "$srcdir/Modules/Setup.dist" Modules/Setup
2277# AC_MSG_RESULT(creating)
2278#else
2279# AC_MSG_RESULT(already exists)
2280#fi
2281
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00002282AC_SUBST(THREADHEADERS)
2283
2284for h in `(cd $srcdir;echo Python/thread_*.h)`
2285do
2286 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
2287done
2288
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002289AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00002290SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00002291AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002292for dir in $SRCDIRS; do
2293 if test ! -d $dir; then
2294 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00002295 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002296done
2297AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00002298
Guido van Rossum627b2d71993-12-24 10:39:16 +00002299# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00002300AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00002301
2302echo "creating Setup"
2303if test ! -f Modules/Setup
2304then
2305 cp $srcdir/Modules/Setup.dist Modules/Setup
2306fi
2307
2308echo "creating Setup.local"
2309if test ! -f Modules/Setup.local
2310then
2311 echo "# Edit this file for local setup changes" >Modules/Setup.local
2312fi
2313
2314echo "creating Makefile"
2315$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
2316 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00002317 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00002318mv config.c Modules