blob: 0f5c354e4f9cc7087499475cab73420300762e69 [file] [log] [blame]
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001dnl Process this file with autoconf 2.0 or later to make a configure script.
2AC_REVISION($Revision$)
3AC_PREREQ(2.0)
Guido van Rossum6085e321993-12-26 18:24:40 +00004AC_INIT(Include/object.h)
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +00005AC_CONFIG_HEADER(pyconfig.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +00006
Guido van Rossum642b6781997-07-19 19:35:41 +00007# Set VERSION so we only need to edit in one place (i.e., here)
8AC_SUBST(VERSION)
Andrew M. Kuchling54a39412002-02-11 16:30:54 +00009VERSION=2.3
Guido van Rossum642b6781997-07-19 19:35:41 +000010
Martin v. Löwis1142de32002-03-29 16:28:31 +000011AC_SUBST(SOVERSION)
12SOVERSION=1.0
13
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +000014# Arguments passed to configure.
15AC_SUBST(CONFIG_ARGS)
16CONFIG_ARGS="$ac_configure_args"
17
Guido van Rossum4b6b5791996-09-09 20:09:34 +000018
Jack Jansenb6e9cad2001-08-15 01:26:28 +000019AC_ARG_ENABLE(framework,
20[ --enable-framework[=INSTALLDIR] Build (MacOSX|Darwin) framework],[
Jack Jansenb6e9cad2001-08-15 01:26:28 +000021 case $enableval in
22 yes)
23 enableval=/Library/Frameworks
Jack Jansen127e56e2001-09-11 14:41:54 +000024 esac
25 case $enableval in
26 no)
27 PYTHONFRAMEWORK=
28 PYTHONFRAMEWORKDIR=no-framework
29 PYTHONFRAMEWORKPREFIX=
30 PYTHONFRAMEWORKINSTALLDIR=
31 enable_framework=
Jack Jansenb6e9cad2001-08-15 01:26:28 +000032 ;;
33 *)
Jack Jansen127e56e2001-09-11 14:41:54 +000034 PYTHONFRAMEWORK=Python
35 PYTHONFRAMEWORKDIR=Python.framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +000036 PYTHONFRAMEWORKPREFIX=$enableval
Jack Jansen127e56e2001-09-11 14:41:54 +000037 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
38 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
Jack Jansenb6e9cad2001-08-15 01:26:28 +000039 esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +000040 ],[
41 PYTHONFRAMEWORK=
Jack Jansen127e56e2001-09-11 14:41:54 +000042 PYTHONFRAMEWORKDIR=no-framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +000043 PYTHONFRAMEWORKPREFIX=
44 PYTHONFRAMEWORKINSTALLDIR=
45 enable_framework=
46])
47AC_SUBST(PYTHONFRAMEWORK)
48AC_SUBST(PYTHONFRAMEWORKDIR)
49AC_SUBST(PYTHONFRAMEWORKPREFIX)
50AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
Guido van Rossum4b6b5791996-09-09 20:09:34 +000051
Jack Jansenb6e9cad2001-08-15 01:26:28 +000052##AC_ARG_WITH(dyld,
53##[ --with-dyld Use (OpenStep|Rhapsody) dynamic linker],,)
54##
Guido van Rossumb418f891996-07-30 18:06:02 +000055# Set name for machine-dependent library files
56AC_SUBST(MACHDEP)
57AC_MSG_CHECKING(MACHDEP)
58if test -z "$MACHDEP"
59then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000060 ac_sys_system=`uname -s`
Martin v. Löwis130fb172001-07-19 11:00:41 +000061 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000062 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000063 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000064 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000065 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000066 ac_md_system=`echo $ac_sys_system |
67 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
68 ac_md_release=`echo $ac_sys_release |
Guido van Rossum67b26592001-10-20 14:21:45 +000069 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000070 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000071
Guido van Rossumbcd91e01997-03-20 20:46:29 +000072 case $MACHDEP in
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +000073 cygwin*) MACHDEP="cygwin";;
Jack Jansen8a97f4a2001-12-05 23:27:32 +000074 darwin*) MACHDEP="darwin";;
Guido van Rossumb97ef171997-09-28 05:44:03 +000075 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000076 esac
77fi
Guido van Rossum91922671997-10-09 20:24:13 +000078
79#
80# SGI compilers allow the specification of the both the ABI and the
81# ISA on the command line. Depending on the values of these switches,
82# different and often incompatable code will be generated.
83#
84# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
85# thus supply support for various ABI/ISA combinations. The MACHDEP
86# variable is also adjusted.
87#
88AC_SUBST(SGI_ABI)
89if test ! -z "$SGI_ABI"
90then
91 CC="cc $SGI_ABI"
92 LDFLAGS="$SGI_ABI $LDFLAGS"
93 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
94fi
Guido van Rossumb418f891996-07-30 18:06:02 +000095AC_MSG_RESULT($MACHDEP)
96
Guido van Rossum627b2d71993-12-24 10:39:16 +000097# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000098AC_MSG_CHECKING(for --without-gcc)
Barry Warsawc0d24d82000-06-29 16:12:00 +000099AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000100 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000101 no) CC=cc
102 without_gcc=yes;;
103 yes) CC=gcc
104 without_gcc=no;;
105 *) CC=$withval
106 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000107 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000108 case $ac_sys_system in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000109 AIX*) CC=cc_r
110 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000111 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000112 case $BE_HOST_CPU in
113 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000114 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000115 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000116 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 +0000117 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000118 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000119 ;;
120 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000121 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000122 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000123 OPT=-O
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000124 ;;
125 *)
Fred Drake5790be12000-10-09 17:06:13 +0000126 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000127 ;;
128 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000129 AR="\$(srcdir)/Modules/ar_beos"
130 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000131 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000132 Monterey*)
133 RANLIB=:
Martin v. Löwis130fb172001-07-19 11:00:41 +0000134 without_gcc=;;
135 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000136 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000137AC_MSG_RESULT($without_gcc)
138
Guido van Rossum27552902001-01-23 01:52:26 +0000139AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000140AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000141MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000142AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d82000-06-29 16:12:00 +0000143AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000144 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000145 case $withval in
146 no) CXX=
147 with_cxx=no;;
148 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000149 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000150 with_cxx=$withval;;
151 esac], [
152 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000153 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000154])
155AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000156
Michael W. Hudson54241132001-12-07 15:38:26 +0000157if test "$with_cxx" = "yes"
158then
159 AC_ERROR(must supply a compiler when using --with-cxx)
160fi
161
Martin v. Löwis537970f2000-12-13 17:37:02 +0000162dnl The following fragment works similar to AC_PROG_CXX.
163dnl It does not fail if CXX is not found, and it is not executed if
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000164dnl --without-cxx was given.
Martin v. Löwis537970f2000-12-13 17:37:02 +0000165dnl Finally, it does not test whether CXX is g++.
166
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000167dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
168ifdef([AC_PROG_CXX_WORKS],[],
169 [AC_DEFUN([AC_PROG_CXX_WORKS],
170 [AC_LANG_PUSH(C++)dnl
171 _AC_COMPILER_EXEEXT
172 AC_LANG_POP()
173 ]
174)])
175
Martin v. Löwis537970f2000-12-13 17:37:02 +0000176if test "$check_cxx" = "yes"
177then
178 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
179 if test "$CXX" = "notfound"
180 then
181 CXX=
182 else
183 AC_PROG_CXX_WORKS
184 fi
185fi
186
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000187# If the user switches compilers, we can't believe the cache
188if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
189then
190 AC_ERROR(cached CC is different -- throw away $cache_file
191(it is also a good idea to do 'make clean' before compiling))
192fi
193
Guido van Rossum627b2d71993-12-24 10:39:16 +0000194AC_PROG_CC
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000195
196# checks for UNIX variants that set C preprocessor variables
197AC_AIX
198AC_MINIX
199
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000200AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000201AC_MSG_CHECKING(for --with-suffix)
202AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
203 case $withval in
204 no) EXEEXT=;;
205 yes) EXEEXT=.exe;;
206 *) EXEEXT=$withval;;
207 esac])
208AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000209
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000210# Test whether we're running on a non-case-sensitive system, in which
211# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000212AC_SUBST(BUILDEXEEXT)
213AC_MSG_CHECKING(for case-insensitive build directory)
214if test -d "python"
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000215then
Jack Jansen1999ef42001-12-06 21:47:20 +0000216 AC_MSG_RESULT(yes)
217 BUILDEXEEXT=.exe
218else
219 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000220 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000221fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000222
Guido van Rossumdd997f71998-10-07 19:58:26 +0000223case $MACHDEP in
224bsdos*)
225 case $CC in
226 gcc) CC="$CC -D_HAVE_BSDI";;
227 esac;;
228esac
229
Guido van Rossum84561611997-08-21 00:08:11 +0000230case $ac_sys_system in
231hp*|HP*)
232 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000233 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000234 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000235Monterey*)
236 case $CC in
237 cc) CC="$CC -Wl,-Bexport";;
238 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000239SunOS*)
240 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000241 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000242 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000243esac
244
Martin v. Löwise8964d42001-03-06 12:09:07 +0000245
Neil Schemenauer61c51152001-01-26 16:18:16 +0000246AC_SUBST(LIBRARY)
247AC_MSG_CHECKING(LIBRARY)
248if test -z "$LIBRARY"
249then
250 LIBRARY='libpython$(VERSION).a'
251fi
252AC_MSG_RESULT($LIBRARY)
253
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000254# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000255# name of the library into which to insert object files). BLDLIBRARY is also
256# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
257# is blank as the main program is not linked directly against LDLIBRARY.
258# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
259# systems without shared libraries, LDLIBRARY is the same as LIBRARY
260# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
261# DLLLIBRARY is the shared (i.e., DLL) library.
262#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000263# RUNSHARED is used to run shared python without installed libraries
264#
265# INSTSONAME is the name of the shared library that will be use to install
266# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000267AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000268AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000269AC_SUBST(BLDLIBRARY)
270AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000271AC_SUBST(INSTSONAME)
272AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000273LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000274BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis1142de32002-03-29 16:28:31 +0000275INSTSONMAE='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000276DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000277LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000278RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000279
Guido van Rossumfb842551997-08-06 23:42:07 +0000280# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000281# If CXX is set, and if it is needed to link a main function that was
282# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
283# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000284# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000285# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000286AC_SUBST(LINKCC)
287AC_MSG_CHECKING(LINKCC)
288if test -z "$LINKCC"
289then
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000290 if test -z "$CXX"; then
291 LINKCC="\$(PURIFY) \$(CC)"
292 else
293 echo 'int main(){return 0;}' > conftest.$ac_ext
294 $CXX -c conftest.$ac_ext 2>&5
295 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
296 && test -s conftest$ac_exeext && ./conftest$ac_exeext
297 then
298 LINKCC="\$(PURIFY) \$(CC)"
299 else
300 LINKCC="\$(PURIFY) \$(CXX)"
301 fi
302 rm -fr conftest*
303 fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000304 case $ac_sys_system in
305 AIX*)
Jeremy Hylton90d10062002-03-08 21:43:51 +0000306 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); $LINKCC";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000307 dgux*)
Martin v. Löwis4e732dc2002-03-19 15:15:32 +0000308 LINKCC="LD_RUN_PATH=$libdir $LINKCC";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000309 Monterey64*)
Martin v. Löwis4e732dc2002-03-19 15:15:32 +0000310 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000311 esac
312fi
313AC_MSG_RESULT($LINKCC)
314
Martin v. Löwis1142de32002-03-29 16:28:31 +0000315AC_MSG_CHECKING(for --enable-shared)
316AC_ARG_ENABLE(shared,
317[ --enable-shared disable/enable building shared python library])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000318
Martin v. Löwis1142de32002-03-29 16:28:31 +0000319if test -z "$enable_shared"
320then
321 enable_shared="no"
322fi
323AC_MSG_RESULT($enable_shared)
324
325
326AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000327
Guido van Rossumb8552162001-09-05 14:58:11 +0000328# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
329# library that we build, but we do not want to link against it (we
330# will find it with a -framework option). For this reason there is an
331# extra variable BLDLIBRARY against which Python and the extension
332# modules are linked, BLDLIBRARY. This is normally the same as
333# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000334if test "$enable_framework"
335then
336 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
337 LDLIBRARYDIR='$(PYTHONFRAMEWORKDIR)'
338 BLDLIBRARY=''
339else
340 BLDLIBRARY='$(LDLIBRARY)'
341fi
342
Martin v. Löwis1142de32002-03-29 16:28:31 +0000343# Other platforms follow
344if test $enable_shared = "yes"; then
345 case $ac_sys_system in
346 BeOS*)
347 LDLIBRARY='libpython$(VERSION).so'
348 ;;
349 CYGWIN*)
350 LDLIBRARY='libpython$(VERSION).dll.a'
351 DLLLIBRARY='libpython$(VERSION).dll'
352 ;;
353 SunOS*)
354 LDLIBRARY='libpython$(VERSION).so'
355 BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(VERSION)'
356 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
357 ;;
358 Linux*)
359 LDLIBRARY='libpython$(VERSION).so'
360 BLDLIBRARY='-L. -lpython$(VERSION)'
361 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
362 INSTSONAME="$LDLIBRARY".$SOVERSION
363 ;;
364 hp*|HP*)
365 LDLIBRARY='libpython$(VERSION).sl'
366 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
367 RUNSHARED=SHLIB_PATH=`pwd`:$SHLIB_PATH
368 ;;
369 OSF*)
370 LDLIBRARY='libpython$(VERSION).so'
371 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
372 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
373 ;;
374 esac
375 # DG/UX requires some fancy ld contortions to produce a .so from an .a
376 case $MACHDEP in
377 dguxR4)
378 LDLIBRARY='libpython$(VERSION).so'
379 OPT="$OPT -pic"
380 ;;
381 esac
382fi
383
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000384AC_MSG_RESULT($LDLIBRARY)
385
Guido van Rossum627b2d71993-12-24 10:39:16 +0000386AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000387AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000388AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000389
390case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +0000391bsdos*|hp*|HP*)
392 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +0000393 if test -z "$INSTALL"
394 then
395 INSTALL="${srcdir}/install-sh -c"
396 fi
397esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000398AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000399
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000400# Not every filesystem supports hard links
401AC_SUBST(LN)
402if test -z "$LN" ; then
403 case $ac_sys_system in
404 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000405 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000406 *) LN=ln;;
407 esac
408fi
409
Fred Drake9f715822001-07-11 06:27:00 +0000410# Check for --with-pydebug
411AC_MSG_CHECKING(for --with-pydebug)
412AC_ARG_WITH(pydebug,
413[ --with-pydebug build with Py_DEBUG defined], [
414if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000415then
416 AC_DEFINE(Py_DEBUG, 1,
417 [Define if you want to build an interpreter with many run-time checks.])
418 AC_MSG_RESULT(yes);
419 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +0000420else AC_MSG_RESULT(no); Py_DEBUG='false'
421fi],
422[AC_MSG_RESULT(no)])
423
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000424# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000425AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000426if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000427then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000428 case $GCC in
429 yes)
430 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000431 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000432 if test "$Py_DEBUG" = 'true' ; then
433 # Optimization messes up debuggers, so turn it off for
434 # debug builds.
435 OPT="-g -Wall -Wstrict-prototypes"
436 else
437 OPT="-g -O3 -Wall -Wstrict-prototypes"
438 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000439 *)
Fred Drake9f715822001-07-11 06:27:00 +0000440 OPT="-O3 -Wall -Wstrict-prototypes";;
441 esac
442 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000443 *)
444 case $ac_sys_system in
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000445 OpenUNIX*|UnixWare*)
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000446 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
447 *)
448 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000449 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000450 esac
Jack Jansenca06bc62001-08-03 15:32:23 +0000451 case $ac_sys_system in
452 Darwin*)
Jack Jansen524a0982002-03-12 15:25:52 +0000453 OPT="$OPT -Wno-long-double -no-cpp-precomp";;
Jack Jansenca06bc62001-08-03 15:32:23 +0000454 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000455fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000456
Fred Drakee1ceaa02001-12-04 20:55:47 +0000457if test "$Py_DEBUG" = 'true'; then
458 :
459else
460 OPT="-DNDEBUG $OPT"
461fi
462
Trent Mick635f6fb2000-08-23 21:33:05 +0000463# The current (beta) Monterey compiler dies with optimizations
464case $ac_sys_system in
465Monterey*) OPT="";;
466esac
467
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000468if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000469then
470 OPT="$OPT $ac_arch_flags"
471fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000472
Guido van Rossum91922671997-10-09 20:24:13 +0000473AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
474AC_CACHE_VAL(ac_cv_opt_olimit_ok,
475[ac_save_cc="$CC"
476CC="$CC -OPT:Olimit=0"
477AC_TRY_RUN([int main() { return 0; }],
478 ac_cv_opt_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000479 ac_cv_opt_olimit_ok=no,
Guido van Rossum91922671997-10-09 20:24:13 +0000480 ac_cv_opt_olimit_ok=no)
481CC="$ac_save_cc"])
482AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000483if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000484 case $ac_sys_system in
485 Darwin*) OPT="$OPT" ;;
486 *) OPT="$OPT -OPT:Olimit=0";;
487 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000488else
489 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
490 AC_CACHE_VAL(ac_cv_olimit_ok,
491 [ac_save_cc="$CC"
492 CC="$CC -Olimit 1500"
493 AC_TRY_RUN([int main() { return 0; }],
494 ac_cv_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000495 ac_cv_olimit_ok=no,
Guido van Rossumf8678121998-07-07 21:05:09 +0000496 ac_cv_olimit_ok=no)
497 CC="$ac_save_cc"])
498 AC_MSG_RESULT($ac_cv_olimit_ok)
499 if test $ac_cv_olimit_ok = yes; then
500 OPT="$OPT -Olimit 1500"
501 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000502fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000503
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000504# On some compilers, pthreads are available without further options
505# (e.g. MacOS X). On some of these systems, the compiler will not
506# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
507# So we have to see first whether pthreads are available without
508# options before we can check whether -Kpthread improves anything.
509AC_MSG_CHECKING(whether pthreads are available without options)
510AC_CACHE_VAL(ac_cv_pthread_is_default,
511[AC_TRY_RUN([
512#include <pthread.h>
513
514void* routine(void* p){return NULL;}
515
516int main(){
517 pthread_t p;
518 if(pthread_create(&p,NULL,routine,NULL)!=0)
519 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +0000520 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000521 return 0;
522}
523],
524 ac_cv_pthread_is_default=yes,
525 ac_cv_pthread_is_default=no,
526 ac_cv_pthread_is_default=no)
527])
528AC_MSG_RESULT($ac_cv_pthread_is_default)
529
530
531if test $ac_cv_pthread_is_default = yes
532then
533 ac_cv_kpthread=no
534else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000535# -Kpthread, if available, provides the right #defines
536# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000537# Some compilers won't report that they do not support -Kpthread,
538# so we need to run a program to see whether it really made the
539# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +0000540AC_MSG_CHECKING(whether $CC accepts -Kpthread)
541AC_CACHE_VAL(ac_cv_kpthread,
542[ac_save_cc="$CC"
543CC="$CC -Kpthread"
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000544AC_TRY_RUN([
545#include <pthread.h>
546
547void* routine(void* p){return NULL;}
548
549int main(){
550 pthread_t p;
551 if(pthread_create(&p,NULL,routine,NULL)!=0)
552 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +0000553 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000554 return 0;
555}
556],
Martin v. Löwis130fb172001-07-19 11:00:41 +0000557 ac_cv_kpthread=yes,
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000558 ac_cv_kpthread=no,
Martin v. Löwis130fb172001-07-19 11:00:41 +0000559 ac_cv_kpthread=no)
560CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +0000561AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000562fi
Martin v. Löwis130fb172001-07-19 11:00:41 +0000563
Fred Drakece81d592000-07-09 14:39:29 +0000564dnl # check for ANSI or K&R ("traditional") preprocessor
565dnl AC_MSG_CHECKING(for C preprocessor type)
566dnl AC_TRY_COMPILE([
567dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
568dnl int foo;
569dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
570dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
571dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000572
Guido van Rossum627b2d71993-12-24 10:39:16 +0000573# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000574AC_HEADER_STDC
Martin v. Löwis2e64c342002-03-27 18:49:02 +0000575AC_CHECK_HEADERS(dlfcn.h fcntl.h grp.h limits.h langinfo.h \
576libintl.h locale.h ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000577signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000578sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000579sys/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 +0000580sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \
Martin v. Löwis1ba3fd52001-08-10 20:29:40 +0000581ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h netpacket/packet.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000582AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000583
584# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000585was_it_defined=no
586AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000587AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
588 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
589])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000590AC_MSG_RESULT($was_it_defined)
591
Guido van Rossum810cc512001-09-09 23:51:39 +0000592# Two defines needed to enable largefile support on various platforms
593# These may affect some typedefs
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000594AC_DEFINE(_LARGEFILE_SOURCE, 1,
595[This must be defined on some systems to enable large file support.])
596AC_DEFINE(_FILE_OFFSET_BITS, 64,
597[This must be set to 64 on some systems to enable large file support.])
Guido van Rossum810cc512001-09-09 23:51:39 +0000598
Guido van Rossum300fda71996-08-19 21:58:16 +0000599# Add some code to confdefs.h so that the test for off_t works on SCO
600cat >> confdefs.h <<\EOF
601#if defined(SCO_DS)
602#undef _OFF_T
603#endif
604EOF
605
Guido van Rossumef2255b2000-03-10 22:30:29 +0000606# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000607AC_TYPE_MODE_T
608AC_TYPE_OFF_T
609AC_TYPE_PID_T
610AC_TYPE_SIGNAL
611AC_TYPE_SIZE_T
612AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000613
Guido van Rossumef2255b2000-03-10 22:30:29 +0000614# Sizes of various common basic types
Guido van Rossum3065c942001-09-17 04:03:14 +0000615AC_CHECK_SIZEOF(int, 4)
616AC_CHECK_SIZEOF(long, 4)
617AC_CHECK_SIZEOF(void *, 4)
618AC_CHECK_SIZEOF(char, 1)
619AC_CHECK_SIZEOF(short, 2)
620AC_CHECK_SIZEOF(float, 4)
621AC_CHECK_SIZEOF(double, 8)
622AC_CHECK_SIZEOF(fpos_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +0000623
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000624AC_MSG_CHECKING(for long long support)
625have_long_long=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000626AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
627 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
628 have_long_long=yes
629])
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000630AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000631if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000632AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000633fi
634
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000635AC_MSG_CHECKING(for uintptr_t support)
636have_uintptr_t=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000637AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
638 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
639 have_uintptr_t=yes
640])
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000641AC_MSG_RESULT($have_uintptr_t)
642if test "$have_uintptr_t" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000643AC_CHECK_SIZEOF(uintptr_t, 4)
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000644fi
645
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000646# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
647AC_MSG_CHECKING(size of off_t)
648AC_CACHE_VAL(ac_cv_sizeof_off_t,
649[AC_TRY_RUN([#include <stdio.h>
650#include <sys/types.h>
651main()
652{
653 FILE *f=fopen("conftestval", "w");
654 if (!f) exit(1);
655 fprintf(f, "%d\n", sizeof(off_t));
656 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000657}],
658ac_cv_sizeof_off_t=`cat conftestval`,
659ac_cv_sizeof_off_t=0,
660ac_cv_sizeof_off_t=4)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000661])
662AC_MSG_RESULT($ac_cv_sizeof_off_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000663AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
664[The number of bytes in an off_t.])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000665
666AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000667if test "$have_long_long" = yes -a \
668 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
669 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000670 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
671 [Defined to enable large file support when an off_t is bigger than a long
672 and long long is available and at least as big as an off_t. You may need
673 to add some flags for configuration and compilation to enable this mode.
674 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000675 AC_MSG_RESULT(yes)
676else
677 AC_MSG_RESULT(no)
678fi
679
Fred Drakea3f6e912000-06-29 20:44:47 +0000680# AC_CHECK_SIZEOF() doesn't include <time.h>.
681AC_MSG_CHECKING(size of time_t)
682AC_CACHE_VAL(ac_cv_sizeof_time_t,
683[AC_TRY_RUN([#include <stdio.h>
684#include <time.h>
685main()
686{
687 FILE *f=fopen("conftestval", "w");
688 if (!f) exit(1);
689 fprintf(f, "%d\n", sizeof(time_t));
690 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000691}],
692ac_cv_sizeof_time_t=`cat conftestval`,
693ac_cv_sizeof_time_t=0,
694ac_cv_sizeof_time_t=4)
Fred Drakea3f6e912000-06-29 20:44:47 +0000695])
696AC_MSG_RESULT($ac_cv_sizeof_time_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000697AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
698[The number of bytes in a time_t.])
Fred Drakea3f6e912000-06-29 20:44:47 +0000699
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000700
Trent Mick635f6fb2000-08-23 21:33:05 +0000701# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000702ac_save_cc="$CC"
703if test "$ac_cv_kpthread" = "yes"
704then CC="$CC -Kpthread"
705fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000706AC_MSG_CHECKING(for pthread_t)
707have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000708AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000709AC_MSG_RESULT($have_pthread_t)
710if test "$have_pthread_t" = yes ; then
711 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
712 AC_MSG_CHECKING(size of pthread_t)
713 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
714 [AC_TRY_RUN([#include <stdio.h>
715 #include <pthread.h>
716 main()
717 {
718 FILE *f=fopen("conftestval", "w");
719 if (!f) exit(1);
720 fprintf(f, "%d\n", sizeof(pthread_t));
721 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000722 }],
723 ac_cv_sizeof_pthread_t=`cat conftestval`,
724 ac_cv_sizeof_pthread_t=0,
725 ac_cv_sizeof_pthread_t=4)
Trent Mick635f6fb2000-08-23 21:33:05 +0000726 ])
727 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000728 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
729 [The number of bytes in a pthread_t.])
Trent Mick635f6fb2000-08-23 21:33:05 +0000730fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000731CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000732
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000733AC_MSG_CHECKING(for --enable-toolbox-glue)
734AC_ARG_ENABLE(toolbox-glue,
735[ --enable-toolbox-glue disable/enable MacOSX glue code for extensions])
736
737if test -z "$enable_toolbox_glue"
738then
739 case $ac_sys_system/$ac_sys_release in
740 Darwin/*)
741 enable_toolbox_glue="yes";;
742 *)
743 enable_toolbox_glue="no";;
744 esac
745fi
746case "$enable_toolbox_glue" in
747yes)
Jack Jansen666b1e72001-10-31 12:11:48 +0000748 extra_frameworks="-framework CoreServices -framework Foundation"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000749 extra_machdep_objs="Python/mactoolboxglue.o"
Jack Jansen591cbed2001-08-15 13:55:15 +0000750 extra_undefs="-u __dummy -u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000751 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
752 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000753 ;;
754*)
755 extra_frameworks=""
756 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +0000757 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000758 ;;
759esac
760AC_MSG_RESULT($enable_toolbox_glue)
761
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000762AC_SUBST(LIBTOOL_CRUFT)
763case $ac_sys_system/$ac_sys_release in
Jack Jansen418c3b12001-11-14 10:59:57 +0000764 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +0000765 ns_undef_sym='_environ'
Jack Jansen418c3b12001-11-14 10:59:57 +0000766 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym"
767 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
Jack Jansena3891ea2001-09-07 14:25:12 +0000768 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
769 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +0000770 Darwin/*)
771 ns_undef_sym='_environ'
Jack Jansen418c3b12001-11-14 10:59:57 +0000772 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym"
773 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000774 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
775 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000776esac
777
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000778AC_MSG_CHECKING(for --enable-framework)
779if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000780then
Jack Jansenca06bc62001-08-03 15:32:23 +0000781 OPT="$OPT -fno-common -dynamic"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000782 # -U __environ is needed since bundles don't have access
783 # to crt0 when built but will always be linked against it
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000784 # -F. is needed to allow linking to the framework while
785 # in the build location.
786
Jack Jansena3891ea2001-09-07 14:25:12 +0000787 case $ac_sys_system/$ac_sys_release in
Jack Jansen418c3b12001-11-14 10:59:57 +0000788 Darwin/1.3*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-U,$ns_undef_sym";;
789 Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";;
Jack Jansena3891ea2001-09-07 14:25:12 +0000790 esac
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000791 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
792 [Define if you want to produce an OpenStep/Rhapsody framework
793 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000794 AC_MSG_RESULT(yes)
795else
796 AC_MSG_RESULT(no)
797fi
798
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000799AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000800case $ac_sys_system/$ac_sys_release in
801 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000802 AC_DEFINE(WITH_DYLD, 1,
803 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
804 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
805 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000806 AC_MSG_RESULT(always on for Darwin)
807 ;;
808 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000809 AC_MSG_RESULT(no)
810 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000811esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000812
Guido van Rossumac405f61994-09-12 10:56:06 +0000813# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000814AC_SUBST(SO)
815AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000816AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000817AC_SUBST(CCSHARED)
818AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000819# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000820# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000821AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000822if test -z "$SO"
823then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000824 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000825 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000826 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000827 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000828 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000829fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000830AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000831# LDSHARED is the ld *command* used to create shared library
Martin v. Löwis5b718fc2001-09-10 15:34:42 +0000832# -- "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 +0000833# (Shared libraries in this instance are shared modules to be loaded into
834# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000835AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000836if test -z "$LDSHARED"
837then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000838 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000839 AIX*)
840 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
Guido van Rossumce608b02001-09-28 15:59:38 +0000841 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000842 ;;
843 BeOS*)
844 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +0000845 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000846 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000847 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000848 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000849 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a662000-05-26 12:22:54 +0000850 SunOS/5*)
851 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000852 then LDSHARED='$(CC) -shared'
Martin v. Löwis5b718fc2001-09-10 15:34:42 +0000853 else LDSHARED="$(CC) -G";
Greg Ward57c9a662000-05-26 12:22:54 +0000854 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000855 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000856 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000857 DYNIX/ptx*) LDSHARED="ld -G";;
Jack Jansen418c3b12001-11-14 10:59:57 +0000858 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +0000859 LDSHARED='$(CC) $(LDFLAGS) -bundle'
860 if test "$enable_framework" ; then
861 # Link against the framework. All externals should be defined.
862 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
863 else
864 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +0000865 LDSHARED="$LDSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +0000866 fi ;;
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000867 Darwin/*)
868 LDSHARED='$(CC) $(LDFLAGS) -bundle'
869 if test "$enable_framework" ; then
870 # Link against the framework. All externals should be defined.
871 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
872 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +0000873 # No framework, use the Python app as bundle-loader
874 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
875 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000876 fi ;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +0000877 Linux*|GNU*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000878 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000879 BSD/OS*/4*) LDSHARED="gcc -shared";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000880 OpenBSD*|NetBSD*|FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000881 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000882 then
883 LDSHARED="cc -shared ${LDFLAGS}"
884 else
885 LDSHARED="ld -Bshareable ${LDFLAGS}"
886 fi;;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000887 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +0000888 if test "$GCC" = "yes"
889 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000890 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000891 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000892 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000893 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000894 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000895 *) LDSHARED="ld";;
896 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000897fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000898AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000899BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000900# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000901# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000902AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000903if test -z "$CCSHARED"
904then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000905 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000906 SunOS*) if test "$GCC" = yes;
907 then CCSHARED="-fPIC";
908 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000909 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +0000910 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +0000911 else CCSHARED="+z";
912 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +0000913 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000914 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000915 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000916 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +0000917 if test "$GCC" = "yes"
918 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000919 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000920 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000921 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000922 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000923 IRIX*/6*) case $CC in
924 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000925 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000926 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000927 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000928 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000929fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000930AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000931# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000932# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000933AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000934if test -z "$LINKFORSHARED"
935then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000936 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000937 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000938 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000939 LINKFORSHARED="-Wl,-E -Wl,+s";;
940# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000941 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +0000942 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000943 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000944 Darwin/*)
945 # -u __dummy makes the linker aware of the objc runtime
946 # in System.framework; otherwise, __objcInit (referenced in
947 # crt1.o) gets erroneously defined as common, which breaks dynamic
948 # loading of any modules which reference it in System.framework.
949 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
950 # not used by the core itself but which needs to be in the core so
951 # that dynamically loaded extension modules have access to it.
Jack Jansen591cbed2001-08-15 13:55:15 +0000952 LINKFORSHARED="$extra_undefs -framework System"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000953 if test "$enable_framework"
954 then
955 LINKFORSHARED="$LINKFORSHARED -framework Python"
956 fi
957 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000958 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000959 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000960 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000961 FreeBSD*|NetBSD*|OpenBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000962 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
963 then
964 LINKFORSHARED="-Wl,--export-dynamic"
965 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000966 SunOS/5*) case $CC in
967 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000968 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000969 then
970 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000971 fi;;
972 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000973 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000974fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000975AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000976
Neil Schemenauer61c51152001-01-26 16:18:16 +0000977AC_SUBST(CFLAGSFORSHARED)
978AC_MSG_CHECKING(CFLAGSFORSHARED)
979if test ! "$LIBRARY" = "$LDLIBRARY"
980then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000981 case $ac_sys_system in
982 CYGWIN*)
983 # Cygwin needs CCSHARED when building extension DLLs
984 # but not when building the interpreter DLL.
985 CFLAGSFORSHARED='';;
986 *)
987 CFLAGSFORSHARED='$(CCSHARED)'
988 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000989fi
990AC_MSG_RESULT($CFLAGSFORSHARED)
991
Guido van Rossum627b2d71993-12-24 10:39:16 +0000992# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000993AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
994AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Martin v. Löwis41933dd2002-03-21 15:10:58 +0000995AC_CHECK_LIB(rt, sem_init) # 'Real Time' functions on Solaris
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000996
997# checks for system dependent C++ extensions support
998case "$ac_sys_system" in
999 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1000 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1001 [loadAndInit("", 0, "")],
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001002 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1003 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1004 and you want support for AIX C++ shared extension modules.])
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00001005 AC_MSG_RESULT(yes)],
1006 [AC_MSG_RESULT(no)]);;
1007 *) ;;
1008esac
1009
Guido van Rossum70c7f481998-03-26 18:44:10 +00001010# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1011# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001012# BeOS' sockets are stashed in libnet.
1013case "$ac_sys_system" in
1014IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +00001015*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001016AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001017AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00001018;;
1019esac
1020case "$ac_sys_system" in
1021BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001022AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1023;;
1024esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00001025
Guido van Rossumc5a39031996-07-31 17:35:03 +00001026AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001027AC_ARG_WITH(libs,
1028[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +00001029AC_MSG_RESULT($withval)
1030LIBS="$withval $LIBS"
1031], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001032
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001033# Determine if signalmodule should be used.
1034AC_SUBST(USE_SIGNAL_MODULE)
1035AC_SUBST(SIGNAL_OBJS)
1036AC_MSG_CHECKING(for --with-signal-module)
1037AC_ARG_WITH(signal-module,
1038[ --with-signal-module disable/enable signal module])
1039
1040if test -z "$with_signal_module"
1041then with_signal_module="yes"
1042fi
1043AC_MSG_RESULT($with_signal_module)
1044
1045if test "${with_signal_module}" = "yes"; then
1046 USE_SIGNAL_MODULE=""
1047 SIGNAL_OBJS=""
1048else
1049 USE_SIGNAL_MODULE="#"
1050 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1051fi
1052
Guido van Rossum3d15bd82001-01-10 18:53:48 +00001053# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00001054AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001055USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00001056
Guido van Rossum54d93d41997-01-22 20:51:58 +00001057AC_MSG_CHECKING(for --with-dec-threads)
1058AC_SUBST(LDLAST)
1059AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d82000-06-29 16:12:00 +00001060[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
1061AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00001062LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00001063if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00001064 with_thread="$withval";
1065fi],
1066AC_MSG_RESULT(no))
1067
1068AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001069AC_ARG_WITH(threads,
1070[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +00001071
Barry Warsawc0d24d82000-06-29 16:12:00 +00001072# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00001073AC_ARG_WITH(thread,
1074[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
1075with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +00001076
1077if test -z "$with_threads"
1078then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001079fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00001080AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00001081
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001082AC_SUBST(THREADOBJ)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001083if test "$with_threads" = "no"
1084then
1085 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001086elif test "$ac_cv_pthread_is_default" = yes
1087then
1088 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001089 # Defining _REENTRANT on system with POSIX threads should not hurt.
1090 AC_DEFINE(_REENTRANT)
1091 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001092 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001093elif test "$ac_cv_kpthread" = "yes"
1094then
1095 CC="$CC -Kpthread"
1096 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001097 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001098 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +00001099else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001100 if test ! -z "$with_threads" -a -d "$with_threads"
1101 then LDFLAGS="$LDFLAGS -L$with_threads"
1102 fi
1103 if test ! -z "$withval" -a -d "$withval"
1104 then LDFLAGS="$LDFLAGS -L$withval"
1105 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001106
1107 # According to the POSIX spec, a pthreads implementation must
1108 # define _POSIX_THREADS in unistd.h. Some apparently don't (which ones?)
1109 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1110 AC_EGREP_CPP(yes,
1111 [#include <unistd.h>
1112 #ifdef _POSIX_THREADS
1113 yes
1114 #endif
1115 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1116 AC_MSG_RESULT($unistd_defines_pthreads)
1117
Martin v. Löwis130fb172001-07-19 11:00:41 +00001118 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001119 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1120 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001121 AC_DEFINE(HURD_C_THREADS, 1,
1122 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001123 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001124 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001125 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1126 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001127 AC_DEFINE(MACH_C_THREADS, 1,
1128 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001129 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001130 AC_MSG_CHECKING(for --with-pth)
1131 AC_ARG_WITH(pth,
1132 [ --with-pth use GNU pth threading libraries], [
1133 AC_MSG_RESULT($withval)
1134 AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001135 AC_DEFINE(HAVE_PTH, 1, [Define if you have GNU PTH threads.])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001136 LIBS="-lpth $LIBS"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001137 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001138 AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00001139
1140 # Just looking for pthread_create in libpthread is not enough:
1141 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1142 # So we really have to include pthread.h, and then link.
1143 _libs=$LIBS
1144 LIBS="$LIBS -lpthread"
1145 AC_MSG_CHECKING([for pthread_create in -lpthread])
1146 AC_TRY_LINK([#include <pthread.h>
1147
1148void * start_routine (void *arg) { exit (0); }], [
1149pthread_create (NULL, NULL, start_routine, NULL)], [
1150 AC_MSG_RESULT(yes)
1151 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001152 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001153 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00001154 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00001155 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001156 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001157 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001158 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001159 AC_DEFINE(BEOS_THREADS, 1,
1160 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001161 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001162 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001163 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001164 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001165 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001166 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001167 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001168 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001169 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001170 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001171 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001172 LIBS="$LIBS -lthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001173 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001174 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001175 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001176 LIBS="$LIBS -lpthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001177 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001178 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001179 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001180 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001181 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001182 USE_THREAD_MODULE="#"])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001183 ])])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00001184
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001185 if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001186 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001187 AC_DEFINE(_POSIX_THREADS, 1,
1188 [Define if you have POSIX threads,
1189 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001190 fi
1191
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001192 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1193 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1194 [AC_TRY_RUN([#include <pthread.h>
1195 void *foo(void *parm) {
1196 return NULL;
1197 }
1198 main() {
1199 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00001200 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001201 if (pthread_attr_init(&attr)) exit(-1);
1202 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00001203 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001204 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00001205 }],
1206 ac_cv_pthread_system_supported=yes,
1207 ac_cv_pthread_system_supported=no,
1208 ac_cv_pthread_system_supported=no)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001209 ])
1210 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1211 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001212 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001213 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001214 AC_CHECK_FUNCS(pthread_sigmask)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001215 fi
1216
Martin v. Löwis130fb172001-07-19 11:00:41 +00001217 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1218 LIBS="$LIBS -lmpc"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001219 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001220 USE_THREAD_MODULE=""])
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001221
1222 if test $posix_threads != "yes"; then
1223 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1224 LIBS="$LIBS -lthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001225 THREADOBJ="Python/thread.o"
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001226 USE_THREAD_MODULE=""])
1227 fi
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001228
Martin v. Löwis130fb172001-07-19 11:00:41 +00001229 if test "$USE_THREAD_MODULE" != "#"
1230 then
1231 # If the above checks didn't disable threads, (at least) OSF1
1232 # needs this '-threads' argument during linking.
1233 case $ac_sys_system in
1234 OSF1) LDLAST=-threads;;
1235 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001236 fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00001237fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001238
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001239# Check for enable-ipv6
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001240AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001241AC_ARG_ENABLE(ipv6,
1242[ --enable-ipv6 Enable ipv6 (with ipv4) support
1243 --disable-ipv6 Disable ipv6 support],
1244[ case "$enableval" in
1245 no)
1246 AC_MSG_RESULT(no)
1247 ipv6=no
1248 ;;
1249 *) AC_MSG_RESULT(yes)
1250 AC_DEFINE(ENABLE_IPV6)
1251 ipv6=yes
1252 ;;
1253 esac ],
1254
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001255[
1256dnl the check does not work on cross compilation case...
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001257 AC_TRY_RUN([ /* AF_INET6 available check */
1258#include <sys/types.h>
1259#include <sys/socket.h>
1260main()
1261{
1262 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1263 exit(1);
1264 else
1265 exit(0);
1266}
1267],
1268 AC_MSG_RESULT(yes)
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001269 ipv6=yes,
1270 AC_MSG_RESULT(no)
1271 ipv6=no,
1272 AC_MSG_RESULT(no)
1273 ipv6=no
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001274)
1275
1276if test "$ipv6" = "yes"; then
1277 AC_MSG_CHECKING(if RFC2553 API is available)
1278 AC_TRY_COMPILE([#include <sys/types.h>
1279#include <netinet/in.h>],
1280 [struct sockaddr_in6 x;
1281x.sin6_scope_id;],
1282 AC_MSG_RESULT(yes)
1283 ipv6=yes,
1284 AC_MSG_RESULT(no, IPv6 disabled)
1285 ipv6=no)
1286fi
1287
1288if test "$ipv6" = "yes"; then
1289 AC_DEFINE(ENABLE_IPV6)
1290fi
1291])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001292
1293ipv6type=unknown
1294ipv6lib=none
1295ipv6trylibc=no
1296
1297if test "$ipv6" = "yes"; then
1298 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00001299 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1300 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001301 case $i in
1302 inria)
1303 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001304 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001305#include <netinet/in.h>
1306#ifdef IPV6_INRIA_VERSION
1307yes
1308#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001309 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001310 ;;
1311 kame)
1312 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001313 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001314#include <netinet/in.h>
1315#ifdef __KAME__
1316yes
1317#endif],
1318 [ipv6type=$i;
1319 ipv6lib=inet6
1320 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001321 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001322 ;;
1323 linux-glibc)
1324 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001325 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001326#include <features.h>
1327#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1328yes
1329#endif],
1330 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001331 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001332 ;;
1333 linux-inet6)
1334 dnl http://www.v6.linux.or.jp/
1335 if test -d /usr/inet6; then
1336 ipv6type=$i
1337 ipv6lib=inet6
1338 ipv6libdir=/usr/inet6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001339 OPT="-I/usr/inet6/include $OPT"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001340 fi
1341 ;;
1342 solaris)
1343 if test -f /etc/netconfig; then
1344 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1345 ipv6type=$i
1346 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001347 fi
1348 fi
1349 ;;
1350 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001351 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001352#include <sys/param.h>
1353#ifdef _TOSHIBA_INET6
1354yes
1355#endif],
1356 [ipv6type=$i;
1357 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001358 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001359 ;;
1360 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001361 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001362#include </usr/local/v6/include/sys/v6config.h>
1363#ifdef __V6D__
1364yes
1365#endif],
1366 [ipv6type=$i;
1367 ipv6lib=v6;
1368 ipv6libdir=/usr/local/v6/lib;
1369 OPT="-I/usr/local/v6/include $OPT"])
1370 ;;
1371 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001372 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001373#include <sys/param.h>
1374#ifdef _ZETA_MINAMI_INET6
1375yes
1376#endif],
1377 [ipv6type=$i;
1378 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001379 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001380 ;;
1381 esac
1382 if test "$ipv6type" != "unknown"; then
1383 break
1384 fi
1385 done
1386 AC_MSG_RESULT($ipv6type)
1387fi
1388
1389if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1390 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1391 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1392 echo "using lib$ipv6lib"
1393 else
1394 if test $ipv6trylibc = "yes"; then
1395 echo "using libc"
1396 else
1397 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1398 echo "You need to fetch lib$ipv6lib.a from appropriate"
1399 echo 'ipv6 kit and compile beforehand.'
1400 exit 1
1401 fi
1402 fi
1403fi
1404
Barry Warsawef82cd72000-06-30 16:21:01 +00001405# Check for GC support
Barry Warsawef82cd72000-06-30 16:21:01 +00001406AC_MSG_CHECKING(for --with-cycle-gc)
1407AC_ARG_WITH(cycle-gc,
1408[ --with(out)-cycle-gc disable/enable garbage collection])
1409
1410if test -z "$with_cycle_gc"
1411then with_cycle_gc="yes"
1412fi
Neil Schemenauer9c63e6d2001-08-29 23:44:38 +00001413if test "$with_cycle_gc" != "no"
Barry Warsawef82cd72000-06-30 16:21:01 +00001414then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001415 AC_DEFINE(WITH_CYCLE_GC, 1,
1416 [Define if you want to compile in cycle garbage collection.])
Barry Warsawef82cd72000-06-30 16:21:01 +00001417fi
1418AC_MSG_RESULT($with_cycle_gc)
1419
Neil Schemenauera35c6882001-02-27 04:45:05 +00001420# Check for Python-specific malloc support
1421AC_MSG_CHECKING(for --with-pymalloc)
1422AC_ARG_WITH(pymalloc,
Neil Schemenauer16c22972002-03-22 15:34:49 +00001423[ --with(out)-pymalloc disable/enable specialized mallocs])
1424
1425if test -z "$with_pymalloc"
1426then with_pymalloc="yes"
1427fi
1428if test "$with_pymalloc" != "no"
1429then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001430 AC_DEFINE(WITH_PYMALLOC, 1,
1431 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00001432fi
1433AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00001434
Barry Warsawef82cd72000-06-30 16:21:01 +00001435# Check for --with-wctype-functions
1436AC_MSG_CHECKING(for --with-wctype-functions)
1437AC_ARG_WITH(wctype-functions,
1438[ --with-wctype-functions use wctype.h functions], [
1439if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001440then
1441 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
1442 [Define if you want wctype.h functions to be used instead of the
1443 one supplied by Python itself. (see Include/unicodectype.h).])
1444 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00001445else AC_MSG_RESULT(no)
1446fi],
1447[AC_MSG_RESULT(no)])
1448
Guido van Rossum68242b51996-05-28 22:53:03 +00001449# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001450AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00001451DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001452
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001453AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001454AC_ARG_WITH(sgi-dl,
1455[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001456AC_MSG_RESULT($withval)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001457AC_DEFINE(WITH_SGI_DL, 1,
1458 [Define if you want to use SGI (IRIX 4) dynamic linking.
1459 This requires the "dl" library by Jack Jansen,
1460 ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
1461 Do not bother on IRIX 5, it already has dynamic linking using SunOS
1462 style shared libraries])
Guido van Rossume97ee181999-12-20 21:27:22 +00001463DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001464dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001465if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001466then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001467else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1468fi
1469DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001470LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001471
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001472AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001473AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001474AC_MSG_RESULT($withval)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001475AC_DEFINE(WITH_DL_DLD, 1,
1476 [Define if you want to emulate SGI (IRIX 4) dynamic linking.
1477 This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4),
1478 Sequent Symmetry (Dynix), and Atari ST.
1479 This requires the 'dl-dld' library,
1480 ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z,
1481 as well as the 'GNU dld' library,
1482 ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z.
1483 Do not bother on SunOS 4 or 5, they already have dynamic linking using
1484 shared libraries.])
Guido van Rossume97ee181999-12-20 21:27:22 +00001485DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001486dldir=`echo "$withval" | sed 's/,.*//'`
1487dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001488if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001489then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001490else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1491fi
1492DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001493LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001494
Guido van Rossume97ee181999-12-20 21:27:22 +00001495# the dlopen() function means we might want to use dynload_shlib.o. some
1496# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001497AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001498
1499# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1500# loading of modules.
1501AC_SUBST(DYNLOADFILE)
1502AC_MSG_CHECKING(DYNLOADFILE)
1503if test -z "$DYNLOADFILE"
1504then
1505 case $ac_sys_system/$ac_sys_release in
1506 AIX*) DYNLOADFILE="dynload_aix.o";;
1507 BeOS*) DYNLOADFILE="dynload_beos.o";;
1508 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001509 Darwin/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001510 *)
1511 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1512 # out any dynamic loading
1513 if test "$ac_cv_func_dlopen" = yes
1514 then DYNLOADFILE="dynload_shlib.o"
1515 else DYNLOADFILE="dynload_stub.o"
1516 fi
1517 ;;
1518 esac
1519fi
1520AC_MSG_RESULT($DYNLOADFILE)
1521if test "$DYNLOADFILE" != "dynload_stub.o"
1522then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001523 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
1524 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00001525fi
1526
Jack Jansenc49e5b72001-06-19 15:00:23 +00001527# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1528
1529AC_SUBST(MACHDEP_OBJS)
1530AC_MSG_CHECKING(MACHDEP_OBJS)
1531if test -z "$MACHDEP_OBJS"
1532then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001533 MACHDEP_OBJS=$extra_machdep_objs
1534else
1535 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00001536fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001537AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00001538
Guido van Rossum627b2d71993-12-24 10:39:16 +00001539# checks for library functions
Martin v. Löwis244edc82001-10-04 22:44:26 +00001540AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001541 flock fork fsync fdatasync fpathconf ftime ftruncate \
Martin v. Löwisf95dd0a2001-08-15 17:14:33 +00001542 gai_strerror getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwisb2c92f42002-02-16 23:35:41 +00001543 hstrerror inet_pton kill killpg link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001544 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001545 putenv readlink \
Martin v. Löwis61c5edf2001-10-18 04:06:00 +00001546 select setegid seteuid setgid setgroups \
Martin v. Löwis791bfda2001-07-24 06:33:08 +00001547 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
Fred Drake35a092f1999-12-13 16:23:35 +00001548 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001549 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Guido van Rossumc524d952001-10-19 01:31:59 +00001550 truncate uname unsetenv waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001551
Fred Drake8cef4cf2000-06-28 16:40:38 +00001552# check for openpty and forkpty
1553
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001554AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"]))
1555AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"]))
Fred Drake8cef4cf2000-06-28 16:40:38 +00001556
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001557# check for long file support functions
1558AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1559
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001560AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001561AC_CHECK_FUNCS(getpgrp,
1562 AC_TRY_COMPILE([#include <unistd.h>],
1563 [getpgrp(0);],
1564 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
1565 [Define if getpgrp() must be called as getpgrp(0).])
1566 )
1567)
1568AC_CHECK_FUNCS(setpgrp,
1569 AC_TRY_COMPILE([#include <unistd.h>],
1570 [setpgrp(0,0);],
1571 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
1572 [Define if setpgrp() must be called as setpgrp(0, 0).])
1573 )
1574)
1575AC_CHECK_FUNCS(gettimeofday,
1576 AC_TRY_COMPILE([#include <sys/time.h>],
1577 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
1578 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
1579 [Define if gettimeofday() does not have second (timezone) argument
1580 This is the case on Motorola V4 (R40V4.2)])
1581 )
1582)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001583
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001584
1585# On OSF/1 V5.1, getaddrinfo is available, but a define
1586# for [no]getaddrinfo in netdb.h.
1587AC_MSG_CHECKING(for getaddrinfo)
1588AC_TRY_LINK([
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00001589#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001590#include <sys/socket.h>
1591#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00001592#include <stdio.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001593],[
1594getaddrinfo(NULL, NULL, NULL, NULL);
1595], [
1596AC_MSG_RESULT(yes)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001597AC_MSG_CHECKING(getaddrinfo bug)
1598AC_TRY_RUN([
1599#include <sys/types.h>
1600#include <netdb.h>
1601#include <string.h>
1602#include <sys/socket.h>
1603#include <netinet/in.h>
1604
1605main()
1606{
1607 int passive, gaierr, inet4 = 0, inet6 = 0;
1608 struct addrinfo hints, *ai, *aitop;
1609 char straddr[INET6_ADDRSTRLEN], strport[16];
1610
1611 for (passive = 0; passive <= 1; passive++) {
1612 memset(&hints, 0, sizeof(hints));
1613 hints.ai_family = AF_UNSPEC;
1614 hints.ai_flags = passive ? AI_PASSIVE : 0;
1615 hints.ai_socktype = SOCK_STREAM;
1616 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1617 (void)gai_strerror(gaierr);
1618 goto bad;
1619 }
1620 for (ai = aitop; ai; ai = ai->ai_next) {
1621 if (ai->ai_addr == NULL ||
1622 ai->ai_addrlen == 0 ||
1623 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1624 straddr, sizeof(straddr), strport, sizeof(strport),
1625 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1626 goto bad;
1627 }
1628 switch (ai->ai_family) {
1629 case AF_INET:
1630 if (strcmp(strport, "54321") != 0) {
1631 goto bad;
1632 }
1633 if (passive) {
1634 if (strcmp(straddr, "0.0.0.0") != 0) {
1635 goto bad;
1636 }
1637 } else {
1638 if (strcmp(straddr, "127.0.0.1") != 0) {
1639 goto bad;
1640 }
1641 }
1642 inet4++;
1643 break;
1644 case AF_INET6:
1645 if (strcmp(strport, "54321") != 0) {
1646 goto bad;
1647 }
1648 if (passive) {
1649 if (strcmp(straddr, "::") != 0) {
1650 goto bad;
1651 }
1652 } else {
1653 if (strcmp(straddr, "::1") != 0) {
1654 goto bad;
1655 }
1656 }
1657 inet6++;
1658 break;
1659 case AF_UNSPEC:
1660 goto bad;
1661 break;
1662 default:
1663 /* another family support? */
1664 break;
1665 }
1666 }
1667 }
1668
1669 if (!(inet4 == 0 || inet4 == 2))
1670 goto bad;
1671 if (!(inet6 == 0 || inet6 == 2))
1672 goto bad;
1673
1674 if (aitop)
1675 freeaddrinfo(aitop);
1676 exit(0);
1677
1678 bad:
1679 if (aitop)
1680 freeaddrinfo(aitop);
1681 exit(1);
1682}
1683],
1684AC_MSG_RESULT(good)
1685buggygetaddrinfo=no,
1686AC_MSG_RESULT(buggy)
1687buggygetaddrinfo=yes,
1688AC_MSG_RESULT(buggy)
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001689buggygetaddrinfo=yes)], [
1690AC_MSG_RESULT(no)
1691buggygetaddrinfo=yes
1692])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001693
1694if test "$buggygetaddrinfo" = "yes"; then
1695 if test "$ipv6" = "yes"; then
1696 echo 'Fatal: You must get working getaddrinfo() function.'
1697 echo ' or you can specify "--disable-ipv6"'.
1698 exit 1
1699 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001700else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001701 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001702fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00001703AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001704
Guido van Rossum627b2d71993-12-24 10:39:16 +00001705# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001706AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001707AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001708AC_STRUCT_TIMEZONE
Guido van Rossum98bf58f2001-10-18 20:34:25 +00001709AC_STRUCT_ST_RDEV
1710AC_STRUCT_ST_BLKSIZE
1711AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001712
1713AC_MSG_CHECKING(for time.h that defines altzone)
1714AC_CACHE_VAL(ac_cv_header_time_altzone,
1715[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1716 ac_cv_header_time_altzone=yes,
1717 ac_cv_header_time_altzone=no)])
1718AC_MSG_RESULT($ac_cv_header_time_altzone)
1719if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001720 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001721fi
1722
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001723was_it_defined=no
1724AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001725AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001726#include <sys/types.h>
1727#include <sys/select.h>
1728#include <sys/time.h>
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001729], [;], [
1730 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
1731 [Define if you can safely include both <sys/select.h> and <sys/time.h>
1732 (which you can't on SCO ODT 3.0).])
1733 was_it_defined=yes
1734])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001735AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001736
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001737AC_MSG_CHECKING(for addrinfo)
1738AC_CACHE_VAL(ac_cv_struct_addrinfo,
1739AC_TRY_COMPILE([
1740# include <netdb.h>],
1741 [struct addrinfo a],
1742 ac_cv_struct_addrinfo=yes,
1743 ac_cv_struct_addrinfo=no))
1744AC_MSG_RESULT($ac_cv_struct_addrinfo)
1745if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001746 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001747fi
1748
1749AC_MSG_CHECKING(for sockaddr_storage)
1750AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1751AC_TRY_COMPILE([
1752# include <sys/types.h>
1753# include <sys/socket.h>],
1754 [struct sockaddr_storage s],
1755 ac_cv_struct_sockaddr_storage=yes,
1756 ac_cv_struct_sockaddr_storage=no))
1757AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1758if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001759 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001760fi
1761
Guido van Rossum627b2d71993-12-24 10:39:16 +00001762# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001763
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001764AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001765AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001766
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001767works=no
1768AC_MSG_CHECKING(for working volatile)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001769AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
1770 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
1771)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001772AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001773
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001774works=no
1775AC_MSG_CHECKING(for working signed char)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001776AC_TRY_COMPILE([], [signed char c;], works=yes,
1777 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
1778)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001779AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001780
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001781have_prototypes=no
1782AC_MSG_CHECKING(for prototypes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001783AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
1784 AC_DEFINE(HAVE_PROTOTYPES, 1,
1785 [Define if your compiler supports function prototype])
1786 have_prototypes=yes
1787])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001788AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001789
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001790works=no
1791AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001792AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001793#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001794int foo(int x, ...) {
1795 va_list va;
1796 va_start(va, x);
1797 va_arg(va, int);
1798 va_arg(va, char *);
1799 va_arg(va, double);
1800 return 0;
1801}
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001802], [return foo(10, "", 3.14);], [
1803 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
1804 [Define if your compiler supports variable length function prototypes
1805 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
1806 works=yes
1807])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001808AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001809
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001810if test "$have_prototypes" = yes; then
1811bad_prototypes=no
1812AC_MSG_CHECKING(for bad exec* prototypes)
1813AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001814 AC_DEFINE(BAD_EXEC_PROTOTYPES, 1,
1815 [Define if your <unistd.h> contains bad prototypes for exec*()
1816 (as it does on SGI IRIX 4.x)])
1817 bad_prototypes=yes
1818)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001819AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001820fi
1821
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001822# check if sockaddr has sa_len member
1823AC_MSG_CHECKING(if sockaddr has sa_len member)
1824AC_TRY_COMPILE([#include <sys/types.h>
1825#include <sys/socket.h>],
1826[struct sockaddr x;
1827x.sa_len = 0;],
1828 AC_MSG_RESULT(yes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001829 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001830 AC_MSG_RESULT(no))
1831
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001832AC_MSG_CHECKING(for bad static forward)
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001833AC_CACHE_VAL(ac_cv_bad_static_forward,
1834[AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001835struct s { int a; int b; };
1836static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001837int foobar() {
1838 static int random;
1839 random = (int) &foo;
1840 return random;
1841}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001842static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001843main() {
1844 exit(!((int)&foo == foobar()));
Guido van Rossum3065c942001-09-17 04:03:14 +00001845}],
1846ac_cv_bad_static_forward=no,
1847ac_cv_bad_static_forward=yes,
1848ac_cv_bad_static_forward=no)])
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001849AC_MSG_RESULT($ac_cv_bad_static_forward)
1850if test "$ac_cv_bad_static_forward" = yes
1851then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001852 AC_DEFINE(BAD_STATIC_FORWARD, 1,
1853 [Define if your compiler botches static forward declarations
1854 (as it does on SCI ODT 3.0)])
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001855fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001856
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001857va_list_is_array=no
1858AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001859AC_TRY_COMPILE([
1860#ifdef HAVE_STDARG_PROTOTYPES
1861#include <stdarg.h>
1862#else
1863#include <varargs.h>
1864#endif
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001865], [va_list list1, list2; list1 = list2;], , [
1866 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
1867 va_list_is_array=yes
1868])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001869AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001870
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001871# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1872AC_CHECK_FUNC(gethostbyname_r, [
1873 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1874 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1875 OLD_CFLAGS=$CFLAGS
1876 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1877 AC_TRY_COMPILE([
1878# include <netdb.h>
1879 ], [
1880 char *name;
1881 struct hostent *he, *res;
1882 char buffer[2048];
1883 int buflen = 2048;
1884 int h_errnop;
1885
1886 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1887 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001888 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001889 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
1890 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001891 AC_MSG_RESULT(yes)
1892 ], [
1893 AC_MSG_RESULT(no)
1894 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1895 AC_TRY_COMPILE([
1896# include <netdb.h>
1897 ], [
1898 char *name;
1899 struct hostent *he;
1900 char buffer[2048];
1901 int buflen = 2048;
1902 int h_errnop;
1903
1904 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1905 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001906 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001907 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
1908 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001909 AC_MSG_RESULT(yes)
1910 ], [
1911 AC_MSG_RESULT(no)
1912 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1913 AC_TRY_COMPILE([
1914# include <netdb.h>
1915 ], [
1916 char *name;
1917 struct hostent *he;
1918 struct hostent_data data;
1919
1920 (void) gethostbyname_r(name, he, &data);
1921 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001922 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001923 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
1924 [Define this if you have the 3-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001925 AC_MSG_RESULT(yes)
1926 ], [
1927 AC_MSG_RESULT(no)
1928 ])
1929 ])
1930 ])
1931 CFLAGS=$OLD_CFLAGS
1932], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001933 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001934])
1935AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1936AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1937AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001938AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001939AC_SUBST(HAVE_GETHOSTBYNAME)
1940
Guido van Rossum627b2d71993-12-24 10:39:16 +00001941# checks for system services
1942# (none yet)
1943
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001944# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001945AC_CHECK_FUNC(__fpu_control,
1946 [],
1947 [AC_CHECK_LIB(ieee, __fpu_control)
1948])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001949
Guido van Rossum93274221997-05-09 02:42:00 +00001950# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001951AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001952AC_ARG_WITH(fpectl,
1953[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001954if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001955then
1956 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
1957 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
1958 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00001959else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001960fi],
1961[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001962
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001963# check for --with-libm=...
1964AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001965case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001966Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001967BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001968*) LIBM=-lm
1969esac
Guido van Rossum93274221997-05-09 02:42:00 +00001970AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001971AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001972if test "$withval" = no
1973then LIBM=
1974 AC_MSG_RESULT(force LIBM empty)
1975elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001976then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001977 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001978else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001979fi],
1980[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001981
1982# check for --with-libc=...
1983AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001984AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001985AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001986if test "$withval" = no
1987then LIBC=
1988 AC_MSG_RESULT(force LIBC empty)
1989elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001990then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001991 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001992else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001993fi],
1994[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001995
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001996# check for hypot() in math library
1997LIBS_SAVE=$LIBS
1998LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001999AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00002000LIBS=$LIBS_SAVE
2001
Guido van Rossumad713701997-07-10 22:42:38 +00002002# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00002003AC_MSG_CHECKING(what malloc(0) returns)
2004AC_CACHE_VAL(ac_cv_malloc_zero,
2005[AC_TRY_RUN([#include <stdio.h>
2006#ifdef HAVE_STDLIB
2007#include <stdlib.h>
2008#else
2009char *malloc(), *realloc();
2010int *free();
2011#endif
2012main() {
2013 char *p;
2014 p = malloc(0);
2015 if (p == NULL) exit(1);
2016 p = realloc(p, 0);
2017 if (p == NULL) exit(1);
2018 free(p);
2019 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00002020}],
2021ac_cv_malloc_zero=nonnull,
2022ac_cv_malloc_zero=null,
2023ac_cv_malloc_zero=nonnull)]) # XXX arm cross-compile?
Guido van Rossumad713701997-07-10 22:42:38 +00002024AC_MSG_RESULT($ac_cv_malloc_zero)
2025if test "$ac_cv_malloc_zero" = null
2026then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002027 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL, 1,
2028 [Define if malloc(0) returns a NULL pointer.])
Guido van Rossumad713701997-07-10 22:42:38 +00002029fi
2030
Guido van Rossumef2255b2000-03-10 22:30:29 +00002031# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002032AC_CHECK_HEADER(wchar.h, [
2033 AC_DEFINE(HAVE_WCHAR_H, 1,
2034 [Define if the compiler provides a wchar.h header file.])
2035 wchar_h="yes"
2036],
Guido van Rossumef2255b2000-03-10 22:30:29 +00002037wchar_h="no"
2038)
2039
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002040# determine wchar_t size
2041if test "$wchar_h" = yes
2042then
Guido van Rossum67b26592001-10-20 14:21:45 +00002043 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002044fi
2045
2046AC_MSG_CHECKING(what type to use for unicode)
2047AC_ARG_ENABLE(unicode,
2048[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
2049
2050if test $enable_unicode = yes
2051then
Martin v. Löwisfd917792001-06-27 20:22:04 +00002052 # Without any arguments, Py_UNICODE defaults to two-byte mode
2053 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002054fi
2055
2056case "$enable_unicode" in
2057ucs2) unicode_size="2"
2058 AC_DEFINE(Py_UNICODE_SIZE,2)
2059 ;;
2060ucs4) unicode_size="4"
2061 AC_DEFINE(Py_UNICODE_SIZE,4)
2062 ;;
2063esac
2064
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002065AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002066if test "$enable_unicode" = "no"
2067then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002068 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002069 AC_MSG_RESULT(not used)
2070else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002071 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002072 AC_DEFINE(Py_USING_UNICODE, 1,
2073 [Define if you want to have a Unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002074 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
2075 then
2076 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002077 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
2078 [Define if you have a useable wchar_t type defined in wchar.h; useable
2079 means wchar_t must be 16-bit unsigned type. (see
2080 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002081 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
2082 elif test "$ac_cv_sizeof_short" = "$unicode_size"
2083 then
2084 PY_UNICODE_TYPE="unsigned short"
2085 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
2086 elif test "$ac_cv_sizeof_long" = "$unicode_size"
2087 then
2088 PY_UNICODE_TYPE="unsigned long"
2089 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
2090 else
2091 PY_UNICODE_TYPE="no type found"
2092 fi
2093 AC_MSG_RESULT($PY_UNICODE_TYPE)
2094fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00002095
2096# check for endianness
2097AC_C_BIGENDIAN
2098
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002099# Check whether right shifting a negative integer extends the sign bit
2100# or fills with zeros (like the Cray J90, according to Tim Peters).
2101AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00002102AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002103AC_TRY_RUN([
2104int main()
2105{
Vladimir Marangozova6180282000-07-12 05:05:06 +00002106 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002107}
Guido van Rossum3065c942001-09-17 04:03:14 +00002108],
2109ac_cv_rshift_extends_sign=yes,
2110ac_cv_rshift_extends_sign=no,
2111ac_cv_rshift_extends_sign=yes)])
Vladimir Marangozova6180282000-07-12 05:05:06 +00002112AC_MSG_RESULT($ac_cv_rshift_extends_sign)
2113if test "$ac_cv_rshift_extends_sign" = no
2114then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002115 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
2116 [Define if i>>j for signed int i does not extend the sign bit
2117 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00002118fi
2119
Guido van Rossumcadfaec2001-01-05 14:45:49 +00002120# check for getc_unlocked and related locking functions
2121AC_MSG_CHECKING(for getc_unlocked() and friends)
2122AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
2123AC_TRY_LINK([#include <stdio.h>],[
2124 FILE *f = fopen("/dev/null", "r");
2125 flockfile(f);
2126 getc_unlocked(f);
2127 funlockfile(f);
2128], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
2129AC_MSG_RESULT($ac_cv_have_getc_unlocked)
2130if test "$ac_cv_have_getc_unlocked" = yes
2131then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002132 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
2133 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00002134fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002135
Martin v. Löwis0daad592001-09-30 21:09:59 +00002136# check for readline 4.0
2137AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002138 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
2139 [Define if you have readline 4.0]), , -ltermcap)
Martin v. Löwis0daad592001-09-30 21:09:59 +00002140
Guido van Rossum353ae582001-07-10 16:45:32 +00002141# check for readline 4.2
2142AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002143 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
2144 [Define if you have readline 4.2]), , -ltermcap)
Guido van Rossum353ae582001-07-10 16:45:32 +00002145
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002146AC_MSG_CHECKING(for broken nice())
2147AC_CACHE_VAL(ac_cv_broken_nice, [
2148AC_TRY_RUN([
2149int main()
2150{
2151 int val1 = nice(1);
2152 if (val1 != -1 && val1 == nice(2))
2153 exit(0);
2154 exit(1);
2155}
Guido van Rossum3065c942001-09-17 04:03:14 +00002156],
2157ac_cv_broken_nice=yes,
2158ac_cv_broken_nice=no,
2159ac_cv_broken_nice=no)])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002160AC_MSG_RESULT($ac_cv_broken_nice)
2161if test "$ac_cv_broken_nice" = yes
2162then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002163 AC_DEFINE(HAVE_BROKEN_NICE, 1,
2164 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002165fi
2166
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002167# On HP/UX 11.0, mvwdelch is a block with a return statement
2168AC_MSG_CHECKING(whether mvwdelch is an expression)
2169AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
2170AC_TRY_COMPILE([#include <curses.h>], [
2171 int rtn;
2172 rtn = mvwdelch(0,0,0);
2173], ac_cv_mvwdelch_is_expression=yes,
2174 ac_cv_mvwdelch_is_expression=no,
2175 ac_cv_mvwdelch_is_expression=yes))
2176AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
2177
2178if test "$ac_cv_mvwdelch_is_expression" = yes
2179then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002180 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
2181 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002182fi
2183
2184AC_MSG_CHECKING(whether WINDOW has _flags)
2185AC_CACHE_VAL(ac_cv_window_has_flags,
2186AC_TRY_COMPILE([#include <curses.h>], [
2187 WINDOW *w;
2188 w->_flags = 0;
2189], ac_cv_window_has_flags=yes,
2190 ac_cv_window_has_flags=no,
2191 ac_cv_window_has_flags=no))
2192AC_MSG_RESULT($ac_cv_window_has_flags)
2193
2194
2195if test "$ac_cv_window_has_flags" = yes
2196then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002197 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
2198 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002199fi
2200
Guido van Rossum95713eb2000-05-18 20:53:31 +00002201# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
2202# Add sys/socket.h to confdefs.h
2203cat >> confdefs.h <<\EOF
2204#ifdef HAVE_SYS_SOCKET_H
2205#include <sys/socket.h>
2206#endif
2207EOF
2208AC_CHECK_TYPE(socklen_t, int)
2209
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002210#AC_MSG_CHECKING(for Modules/Setup)
2211#if test ! -f Modules/Setup ; then
2212# if test ! -d Modules ; then
2213# mkdir Modules
2214# fi
2215# cp "$srcdir/Modules/Setup.dist" Modules/Setup
2216# AC_MSG_RESULT(creating)
2217#else
2218# AC_MSG_RESULT(already exists)
2219#fi
2220
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00002221AC_SUBST(THREADHEADERS)
2222
2223for h in `(cd $srcdir;echo Python/thread_*.h)`
2224do
2225 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
2226done
2227
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002228AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00002229SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00002230AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002231for dir in $SRCDIRS; do
2232 if test ! -d $dir; then
2233 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00002234 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002235done
2236AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00002237
Guido van Rossum627b2d71993-12-24 10:39:16 +00002238# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00002239AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00002240
2241echo "creating Setup"
2242if test ! -f Modules/Setup
2243then
2244 cp $srcdir/Modules/Setup.dist Modules/Setup
2245fi
2246
2247echo "creating Setup.local"
2248if test ! -f Modules/Setup.local
2249then
2250 echo "# Edit this file for local setup changes" >Modules/Setup.local
2251fi
2252
2253echo "creating Makefile"
2254$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
2255 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00002256 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00002257mv config.c Modules