blob: 8f76399fa7ffe5de9d76e1d33c56ea44e3f601a7 [file] [log] [blame]
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001dnl Process this file with autoconf 2.0 or later to make a configure script.
2AC_REVISION($Revision$)
Martin v. Löwis97017322002-04-12 17:25:21 +00003AC_PREREQ(2.53)
Guido van Rossum6085e321993-12-26 18:24:40 +00004AC_INIT(Include/object.h)
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +00005AC_CONFIG_HEADER(pyconfig.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +00006
Martin v. Löwis11437992002-04-12 09:54:03 +00007# This is for stuff that absolutely must end up in pyconfig.h.
8# Please use pyport.h instead, if possible.
9AH_BOTTOM([
10#ifdef __CYGWIN__
11#ifdef USE_DL_IMPORT
12#define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
13#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
14#else
15#define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
16#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE
17#endif
18#endif
19
20/* Define the macros needed if on a UnixWare 7.x system. */
21#if defined(__USLC__) && defined(__SCO_VERSION__)
22#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
23#endif
24])
25
Guido van Rossum642b6781997-07-19 19:35:41 +000026# Set VERSION so we only need to edit in one place (i.e., here)
27AC_SUBST(VERSION)
Andrew M. Kuchling54a39412002-02-11 16:30:54 +000028VERSION=2.3
Guido van Rossum642b6781997-07-19 19:35:41 +000029
Martin v. Löwis1142de32002-03-29 16:28:31 +000030AC_SUBST(SOVERSION)
31SOVERSION=1.0
32
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +000033# Arguments passed to configure.
34AC_SUBST(CONFIG_ARGS)
35CONFIG_ARGS="$ac_configure_args"
36
Guido van Rossum4b6b5791996-09-09 20:09:34 +000037
Jack Jansenb6e9cad2001-08-15 01:26:28 +000038AC_ARG_ENABLE(framework,
39[ --enable-framework[=INSTALLDIR] Build (MacOSX|Darwin) framework],[
Jack Jansenb6e9cad2001-08-15 01:26:28 +000040 case $enableval in
41 yes)
42 enableval=/Library/Frameworks
Jack Jansen127e56e2001-09-11 14:41:54 +000043 esac
44 case $enableval in
45 no)
46 PYTHONFRAMEWORK=
47 PYTHONFRAMEWORKDIR=no-framework
48 PYTHONFRAMEWORKPREFIX=
49 PYTHONFRAMEWORKINSTALLDIR=
50 enable_framework=
Jack Jansenb6e9cad2001-08-15 01:26:28 +000051 ;;
52 *)
Jack Jansen127e56e2001-09-11 14:41:54 +000053 PYTHONFRAMEWORK=Python
54 PYTHONFRAMEWORKDIR=Python.framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +000055 PYTHONFRAMEWORKPREFIX=$enableval
Jack Jansen127e56e2001-09-11 14:41:54 +000056 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
57 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
Jack Jansenb6e9cad2001-08-15 01:26:28 +000058 esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +000059 ],[
60 PYTHONFRAMEWORK=
Jack Jansen127e56e2001-09-11 14:41:54 +000061 PYTHONFRAMEWORKDIR=no-framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +000062 PYTHONFRAMEWORKPREFIX=
63 PYTHONFRAMEWORKINSTALLDIR=
64 enable_framework=
65])
66AC_SUBST(PYTHONFRAMEWORK)
67AC_SUBST(PYTHONFRAMEWORKDIR)
68AC_SUBST(PYTHONFRAMEWORKPREFIX)
69AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
Guido van Rossum4b6b5791996-09-09 20:09:34 +000070
Jack Jansenb6e9cad2001-08-15 01:26:28 +000071##AC_ARG_WITH(dyld,
72##[ --with-dyld Use (OpenStep|Rhapsody) dynamic linker],,)
73##
Guido van Rossumb418f891996-07-30 18:06:02 +000074# Set name for machine-dependent library files
75AC_SUBST(MACHDEP)
76AC_MSG_CHECKING(MACHDEP)
77if test -z "$MACHDEP"
78then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000079 ac_sys_system=`uname -s`
Martin v. Löwis130fb172001-07-19 11:00:41 +000080 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000081 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000082 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000083 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000084 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000085 ac_md_system=`echo $ac_sys_system |
86 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
87 ac_md_release=`echo $ac_sys_release |
Guido van Rossum67b26592001-10-20 14:21:45 +000088 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000089 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000090
Guido van Rossumbcd91e01997-03-20 20:46:29 +000091 case $MACHDEP in
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +000092 cygwin*) MACHDEP="cygwin";;
Jack Jansen8a97f4a2001-12-05 23:27:32 +000093 darwin*) MACHDEP="darwin";;
Guido van Rossumb97ef171997-09-28 05:44:03 +000094 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000095 esac
96fi
Guido van Rossum91922671997-10-09 20:24:13 +000097
98#
99# SGI compilers allow the specification of the both the ABI and the
100# ISA on the command line. Depending on the values of these switches,
101# different and often incompatable code will be generated.
102#
103# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
104# thus supply support for various ABI/ISA combinations. The MACHDEP
105# variable is also adjusted.
106#
107AC_SUBST(SGI_ABI)
108if test ! -z "$SGI_ABI"
109then
110 CC="cc $SGI_ABI"
111 LDFLAGS="$SGI_ABI $LDFLAGS"
112 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
113fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000114AC_MSG_RESULT($MACHDEP)
115
Guido van Rossum627b2d71993-12-24 10:39:16 +0000116# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000117AC_MSG_CHECKING(for --without-gcc)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000118AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000119 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000120 no) CC=cc
121 without_gcc=yes;;
122 yes) CC=gcc
123 without_gcc=no;;
124 *) CC=$withval
125 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000126 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000127 case $ac_sys_system in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000128 AIX*) CC=cc_r
129 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000130 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000131 case $BE_HOST_CPU in
132 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000133 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000134 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000135 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 +0000136 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000137 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000138 ;;
139 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000140 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000141 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000142 OPT=-O
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000143 ;;
144 *)
Fred Drake5790be12000-10-09 17:06:13 +0000145 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000146 ;;
147 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000148 AR="\$(srcdir)/Modules/ar_beos"
149 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000150 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000151 Monterey*)
152 RANLIB=:
Martin v. Löwis130fb172001-07-19 11:00:41 +0000153 without_gcc=;;
154 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000155 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000156AC_MSG_RESULT($without_gcc)
157
Guido van Rossum27552902001-01-23 01:52:26 +0000158AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000159AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000160MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000161AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000162AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000163 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000164 case $withval in
165 no) CXX=
166 with_cxx=no;;
167 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000168 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000169 with_cxx=$withval;;
170 esac], [
171 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000172 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000173])
174AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000175
Michael W. Hudson54241132001-12-07 15:38:26 +0000176if test "$with_cxx" = "yes"
177then
178 AC_ERROR(must supply a compiler when using --with-cxx)
179fi
180
Martin v. Löwis537970f2000-12-13 17:37:02 +0000181dnl The following fragment works similar to AC_PROG_CXX.
182dnl It does not fail if CXX is not found, and it is not executed if
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000183dnl --without-cxx was given.
Martin v. Löwis537970f2000-12-13 17:37:02 +0000184dnl Finally, it does not test whether CXX is g++.
185
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000186dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
187ifdef([AC_PROG_CXX_WORKS],[],
188 [AC_DEFUN([AC_PROG_CXX_WORKS],
189 [AC_LANG_PUSH(C++)dnl
190 _AC_COMPILER_EXEEXT
191 AC_LANG_POP()
192 ]
193)])
194
Martin v. Löwis537970f2000-12-13 17:37:02 +0000195if test "$check_cxx" = "yes"
196then
197 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
198 if test "$CXX" = "notfound"
199 then
200 CXX=
201 else
202 AC_PROG_CXX_WORKS
203 fi
204fi
205
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000206# If the user switches compilers, we can't believe the cache
207if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
208then
209 AC_ERROR(cached CC is different -- throw away $cache_file
210(it is also a good idea to do 'make clean' before compiling))
211fi
212
Guido van Rossum627b2d71993-12-24 10:39:16 +0000213AC_PROG_CC
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000214
215# checks for UNIX variants that set C preprocessor variables
216AC_AIX
217AC_MINIX
218
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000219AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000220AC_MSG_CHECKING(for --with-suffix)
221AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
222 case $withval in
223 no) EXEEXT=;;
224 yes) EXEEXT=.exe;;
225 *) EXEEXT=$withval;;
226 esac])
227AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000228
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000229# Test whether we're running on a non-case-sensitive system, in which
230# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000231AC_SUBST(BUILDEXEEXT)
232AC_MSG_CHECKING(for case-insensitive build directory)
233if test -d "python"
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000234then
Jack Jansen1999ef42001-12-06 21:47:20 +0000235 AC_MSG_RESULT(yes)
236 BUILDEXEEXT=.exe
237else
238 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000239 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000240fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000241
Guido van Rossumdd997f71998-10-07 19:58:26 +0000242case $MACHDEP in
243bsdos*)
244 case $CC in
245 gcc) CC="$CC -D_HAVE_BSDI";;
246 esac;;
247esac
248
Guido van Rossum84561611997-08-21 00:08:11 +0000249case $ac_sys_system in
250hp*|HP*)
251 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000252 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000253 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000254Monterey*)
255 case $CC in
256 cc) CC="$CC -Wl,-Bexport";;
257 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000258SunOS*)
259 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000260 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000261 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000262esac
263
Martin v. Löwise8964d42001-03-06 12:09:07 +0000264
Neil Schemenauer61c51152001-01-26 16:18:16 +0000265AC_SUBST(LIBRARY)
266AC_MSG_CHECKING(LIBRARY)
267if test -z "$LIBRARY"
268then
269 LIBRARY='libpython$(VERSION).a'
270fi
271AC_MSG_RESULT($LIBRARY)
272
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000273# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000274# name of the library into which to insert object files). BLDLIBRARY is also
275# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
276# is blank as the main program is not linked directly against LDLIBRARY.
277# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
278# systems without shared libraries, LDLIBRARY is the same as LIBRARY
279# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
280# DLLLIBRARY is the shared (i.e., DLL) library.
281#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000282# RUNSHARED is used to run shared python without installed libraries
283#
284# INSTSONAME is the name of the shared library that will be use to install
285# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000286AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000287AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000288AC_SUBST(BLDLIBRARY)
289AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000290AC_SUBST(INSTSONAME)
291AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000292LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000293BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis1142de32002-03-29 16:28:31 +0000294INSTSONMAE='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000295DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000296LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000297RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000298
Guido van Rossumfb842551997-08-06 23:42:07 +0000299# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000300# If CXX is set, and if it is needed to link a main function that was
301# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
302# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000303# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000304# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000305AC_SUBST(LINKCC)
306AC_MSG_CHECKING(LINKCC)
307if test -z "$LINKCC"
308then
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000309 if test -z "$CXX"; then
310 LINKCC="\$(PURIFY) \$(CC)"
311 else
312 echo 'int main(){return 0;}' > conftest.$ac_ext
313 $CXX -c conftest.$ac_ext 2>&5
314 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
315 && test -s conftest$ac_exeext && ./conftest$ac_exeext
316 then
317 LINKCC="\$(PURIFY) \$(CC)"
318 else
319 LINKCC="\$(PURIFY) \$(CXX)"
320 fi
321 rm -fr conftest*
322 fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000323 case $ac_sys_system in
324 AIX*)
Jeremy Hylton90d10062002-03-08 21:43:51 +0000325 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); $LINKCC";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000326 dgux*)
Martin v. Löwis4e732dc2002-03-19 15:15:32 +0000327 LINKCC="LD_RUN_PATH=$libdir $LINKCC";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000328 Monterey64*)
Martin v. Löwis4e732dc2002-03-19 15:15:32 +0000329 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000330 esac
331fi
332AC_MSG_RESULT($LINKCC)
333
Martin v. Löwis1142de32002-03-29 16:28:31 +0000334AC_MSG_CHECKING(for --enable-shared)
335AC_ARG_ENABLE(shared,
336[ --enable-shared disable/enable building shared python library])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000337
Martin v. Löwis1142de32002-03-29 16:28:31 +0000338if test -z "$enable_shared"
339then
340 enable_shared="no"
341fi
342AC_MSG_RESULT($enable_shared)
343
344
345AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000346
Guido van Rossumb8552162001-09-05 14:58:11 +0000347# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
348# library that we build, but we do not want to link against it (we
349# will find it with a -framework option). For this reason there is an
350# extra variable BLDLIBRARY against which Python and the extension
351# modules are linked, BLDLIBRARY. This is normally the same as
352# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000353if test "$enable_framework"
354then
355 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
356 LDLIBRARYDIR='$(PYTHONFRAMEWORKDIR)'
357 BLDLIBRARY=''
358else
359 BLDLIBRARY='$(LDLIBRARY)'
360fi
361
Martin v. Löwis1142de32002-03-29 16:28:31 +0000362# Other platforms follow
363if test $enable_shared = "yes"; then
364 case $ac_sys_system in
365 BeOS*)
366 LDLIBRARY='libpython$(VERSION).so'
367 ;;
368 CYGWIN*)
369 LDLIBRARY='libpython$(VERSION).dll.a'
370 DLLLIBRARY='libpython$(VERSION).dll'
371 ;;
372 SunOS*)
373 LDLIBRARY='libpython$(VERSION).so'
374 BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(VERSION)'
375 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
376 ;;
377 Linux*)
378 LDLIBRARY='libpython$(VERSION).so'
379 BLDLIBRARY='-L. -lpython$(VERSION)'
380 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
381 INSTSONAME="$LDLIBRARY".$SOVERSION
382 ;;
383 hp*|HP*)
384 LDLIBRARY='libpython$(VERSION).sl'
385 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
386 RUNSHARED=SHLIB_PATH=`pwd`:$SHLIB_PATH
387 ;;
388 OSF*)
389 LDLIBRARY='libpython$(VERSION).so'
390 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
391 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
392 ;;
393 esac
394 # DG/UX requires some fancy ld contortions to produce a .so from an .a
395 case $MACHDEP in
396 dguxR4)
397 LDLIBRARY='libpython$(VERSION).so'
398 OPT="$OPT -pic"
399 ;;
400 esac
401fi
402
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000403AC_MSG_RESULT($LDLIBRARY)
404
Guido van Rossum627b2d71993-12-24 10:39:16 +0000405AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000406AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000407AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000408
409case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +0000410bsdos*|hp*|HP*)
411 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +0000412 if test -z "$INSTALL"
413 then
414 INSTALL="${srcdir}/install-sh -c"
415 fi
416esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000417AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000418
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000419# Not every filesystem supports hard links
420AC_SUBST(LN)
421if test -z "$LN" ; then
422 case $ac_sys_system in
423 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000424 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000425 *) LN=ln;;
426 esac
427fi
428
Fred Drake9f715822001-07-11 06:27:00 +0000429# Check for --with-pydebug
430AC_MSG_CHECKING(for --with-pydebug)
431AC_ARG_WITH(pydebug,
432[ --with-pydebug build with Py_DEBUG defined], [
433if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000434then
435 AC_DEFINE(Py_DEBUG, 1,
436 [Define if you want to build an interpreter with many run-time checks.])
437 AC_MSG_RESULT(yes);
438 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +0000439else AC_MSG_RESULT(no); Py_DEBUG='false'
440fi],
441[AC_MSG_RESULT(no)])
442
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000443# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000444AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000445if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000446then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000447 case $GCC in
448 yes)
449 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000450 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000451 if test "$Py_DEBUG" = 'true' ; then
452 # Optimization messes up debuggers, so turn it off for
453 # debug builds.
454 OPT="-g -Wall -Wstrict-prototypes"
455 else
456 OPT="-g -O3 -Wall -Wstrict-prototypes"
457 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000458 *)
Fred Drake9f715822001-07-11 06:27:00 +0000459 OPT="-O3 -Wall -Wstrict-prototypes";;
460 esac
461 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000462 *)
463 case $ac_sys_system in
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000464 OpenUNIX*|UnixWare*)
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000465 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
466 *)
467 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000468 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000469 esac
Jack Jansenca06bc62001-08-03 15:32:23 +0000470 case $ac_sys_system in
471 Darwin*)
Jack Jansen524a0982002-03-12 15:25:52 +0000472 OPT="$OPT -Wno-long-double -no-cpp-precomp";;
Jack Jansenca06bc62001-08-03 15:32:23 +0000473 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000474fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000475
Fred Drakee1ceaa02001-12-04 20:55:47 +0000476if test "$Py_DEBUG" = 'true'; then
477 :
478else
479 OPT="-DNDEBUG $OPT"
480fi
481
Trent Mick635f6fb2000-08-23 21:33:05 +0000482# The current (beta) Monterey compiler dies with optimizations
483case $ac_sys_system in
484Monterey*) OPT="";;
485esac
486
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000487if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000488then
489 OPT="$OPT $ac_arch_flags"
490fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000491
Guido van Rossum91922671997-10-09 20:24:13 +0000492AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
493AC_CACHE_VAL(ac_cv_opt_olimit_ok,
494[ac_save_cc="$CC"
495CC="$CC -OPT:Olimit=0"
496AC_TRY_RUN([int main() { return 0; }],
497 ac_cv_opt_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000498 ac_cv_opt_olimit_ok=no,
Guido van Rossum91922671997-10-09 20:24:13 +0000499 ac_cv_opt_olimit_ok=no)
500CC="$ac_save_cc"])
501AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000502if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000503 case $ac_sys_system in
504 Darwin*) OPT="$OPT" ;;
505 *) OPT="$OPT -OPT:Olimit=0";;
506 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000507else
508 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
509 AC_CACHE_VAL(ac_cv_olimit_ok,
510 [ac_save_cc="$CC"
511 CC="$CC -Olimit 1500"
512 AC_TRY_RUN([int main() { return 0; }],
513 ac_cv_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000514 ac_cv_olimit_ok=no,
Guido van Rossumf8678121998-07-07 21:05:09 +0000515 ac_cv_olimit_ok=no)
516 CC="$ac_save_cc"])
517 AC_MSG_RESULT($ac_cv_olimit_ok)
518 if test $ac_cv_olimit_ok = yes; then
519 OPT="$OPT -Olimit 1500"
520 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000521fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000522
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000523# On some compilers, pthreads are available without further options
524# (e.g. MacOS X). On some of these systems, the compiler will not
525# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
526# So we have to see first whether pthreads are available without
527# options before we can check whether -Kpthread improves anything.
528AC_MSG_CHECKING(whether pthreads are available without options)
529AC_CACHE_VAL(ac_cv_pthread_is_default,
530[AC_TRY_RUN([
531#include <pthread.h>
532
533void* routine(void* p){return NULL;}
534
535int main(){
536 pthread_t p;
537 if(pthread_create(&p,NULL,routine,NULL)!=0)
538 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +0000539 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000540 return 0;
541}
542],
543 ac_cv_pthread_is_default=yes,
544 ac_cv_pthread_is_default=no,
545 ac_cv_pthread_is_default=no)
546])
547AC_MSG_RESULT($ac_cv_pthread_is_default)
548
549
550if test $ac_cv_pthread_is_default = yes
551then
552 ac_cv_kpthread=no
553else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000554# -Kpthread, if available, provides the right #defines
555# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000556# Some compilers won't report that they do not support -Kpthread,
557# so we need to run a program to see whether it really made the
558# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +0000559AC_MSG_CHECKING(whether $CC accepts -Kpthread)
560AC_CACHE_VAL(ac_cv_kpthread,
561[ac_save_cc="$CC"
562CC="$CC -Kpthread"
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000563AC_TRY_RUN([
564#include <pthread.h>
565
566void* routine(void* p){return NULL;}
567
568int main(){
569 pthread_t p;
570 if(pthread_create(&p,NULL,routine,NULL)!=0)
571 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +0000572 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000573 return 0;
574}
575],
Martin v. Löwis130fb172001-07-19 11:00:41 +0000576 ac_cv_kpthread=yes,
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000577 ac_cv_kpthread=no,
Martin v. Löwis130fb172001-07-19 11:00:41 +0000578 ac_cv_kpthread=no)
579CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +0000580AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000581fi
Martin v. Löwis130fb172001-07-19 11:00:41 +0000582
Fred Drakece81d592000-07-09 14:39:29 +0000583dnl # check for ANSI or K&R ("traditional") preprocessor
584dnl AC_MSG_CHECKING(for C preprocessor type)
585dnl AC_TRY_COMPILE([
586dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
587dnl int foo;
588dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
589dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
590dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000591
Guido van Rossum627b2d71993-12-24 10:39:16 +0000592# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000593AC_HEADER_STDC
Martin v. Löwis2e64c342002-03-27 18:49:02 +0000594AC_CHECK_HEADERS(dlfcn.h fcntl.h grp.h limits.h langinfo.h \
595libintl.h locale.h ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000596signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000597sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000598sys/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 +0000599sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \
Martin v. Löwis1ba3fd52001-08-10 20:29:40 +0000600ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h netpacket/packet.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000601AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000602
603# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000604was_it_defined=no
605AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000606AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
607 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
608])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000609AC_MSG_RESULT($was_it_defined)
610
Guido van Rossum810cc512001-09-09 23:51:39 +0000611# Two defines needed to enable largefile support on various platforms
612# These may affect some typedefs
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000613AC_DEFINE(_LARGEFILE_SOURCE, 1,
614[This must be defined on some systems to enable large file support.])
615AC_DEFINE(_FILE_OFFSET_BITS, 64,
616[This must be set to 64 on some systems to enable large file support.])
Guido van Rossum810cc512001-09-09 23:51:39 +0000617
Guido van Rossum300fda71996-08-19 21:58:16 +0000618# Add some code to confdefs.h so that the test for off_t works on SCO
619cat >> confdefs.h <<\EOF
620#if defined(SCO_DS)
621#undef _OFF_T
622#endif
623EOF
624
Guido van Rossumef2255b2000-03-10 22:30:29 +0000625# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000626AC_TYPE_MODE_T
627AC_TYPE_OFF_T
628AC_TYPE_PID_T
629AC_TYPE_SIGNAL
630AC_TYPE_SIZE_T
631AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000632
Guido van Rossumef2255b2000-03-10 22:30:29 +0000633# Sizes of various common basic types
Guido van Rossum3065c942001-09-17 04:03:14 +0000634AC_CHECK_SIZEOF(int, 4)
635AC_CHECK_SIZEOF(long, 4)
636AC_CHECK_SIZEOF(void *, 4)
637AC_CHECK_SIZEOF(char, 1)
638AC_CHECK_SIZEOF(short, 2)
639AC_CHECK_SIZEOF(float, 4)
640AC_CHECK_SIZEOF(double, 8)
641AC_CHECK_SIZEOF(fpos_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +0000642
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000643AC_MSG_CHECKING(for long long support)
644have_long_long=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000645AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
646 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
647 have_long_long=yes
648])
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000649AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000650if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000651AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000652fi
653
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000654AC_MSG_CHECKING(for uintptr_t support)
655have_uintptr_t=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000656AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
657 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
658 have_uintptr_t=yes
659])
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000660AC_MSG_RESULT($have_uintptr_t)
661if test "$have_uintptr_t" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000662AC_CHECK_SIZEOF(uintptr_t, 4)
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000663fi
664
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000665# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
666AC_MSG_CHECKING(size of off_t)
667AC_CACHE_VAL(ac_cv_sizeof_off_t,
668[AC_TRY_RUN([#include <stdio.h>
669#include <sys/types.h>
670main()
671{
672 FILE *f=fopen("conftestval", "w");
673 if (!f) exit(1);
674 fprintf(f, "%d\n", sizeof(off_t));
675 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000676}],
677ac_cv_sizeof_off_t=`cat conftestval`,
678ac_cv_sizeof_off_t=0,
679ac_cv_sizeof_off_t=4)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000680])
681AC_MSG_RESULT($ac_cv_sizeof_off_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000682AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
683[The number of bytes in an off_t.])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000684
685AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000686if test "$have_long_long" = yes -a \
687 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
688 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000689 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
690 [Defined to enable large file support when an off_t is bigger than a long
691 and long long is available and at least as big as an off_t. You may need
692 to add some flags for configuration and compilation to enable this mode.
693 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000694 AC_MSG_RESULT(yes)
695else
696 AC_MSG_RESULT(no)
697fi
698
Fred Drakea3f6e912000-06-29 20:44:47 +0000699# AC_CHECK_SIZEOF() doesn't include <time.h>.
700AC_MSG_CHECKING(size of time_t)
701AC_CACHE_VAL(ac_cv_sizeof_time_t,
702[AC_TRY_RUN([#include <stdio.h>
703#include <time.h>
704main()
705{
706 FILE *f=fopen("conftestval", "w");
707 if (!f) exit(1);
708 fprintf(f, "%d\n", sizeof(time_t));
709 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000710}],
711ac_cv_sizeof_time_t=`cat conftestval`,
712ac_cv_sizeof_time_t=0,
713ac_cv_sizeof_time_t=4)
Fred Drakea3f6e912000-06-29 20:44:47 +0000714])
715AC_MSG_RESULT($ac_cv_sizeof_time_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000716AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
717[The number of bytes in a time_t.])
Fred Drakea3f6e912000-06-29 20:44:47 +0000718
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000719
Trent Mick635f6fb2000-08-23 21:33:05 +0000720# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000721ac_save_cc="$CC"
722if test "$ac_cv_kpthread" = "yes"
723then CC="$CC -Kpthread"
724fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000725AC_MSG_CHECKING(for pthread_t)
726have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000727AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000728AC_MSG_RESULT($have_pthread_t)
729if test "$have_pthread_t" = yes ; then
730 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
731 AC_MSG_CHECKING(size of pthread_t)
732 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
733 [AC_TRY_RUN([#include <stdio.h>
734 #include <pthread.h>
735 main()
736 {
737 FILE *f=fopen("conftestval", "w");
738 if (!f) exit(1);
739 fprintf(f, "%d\n", sizeof(pthread_t));
740 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000741 }],
742 ac_cv_sizeof_pthread_t=`cat conftestval`,
743 ac_cv_sizeof_pthread_t=0,
744 ac_cv_sizeof_pthread_t=4)
Trent Mick635f6fb2000-08-23 21:33:05 +0000745 ])
746 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000747 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
748 [The number of bytes in a pthread_t.])
Trent Mick635f6fb2000-08-23 21:33:05 +0000749fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000750CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000751
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000752AC_MSG_CHECKING(for --enable-toolbox-glue)
753AC_ARG_ENABLE(toolbox-glue,
754[ --enable-toolbox-glue disable/enable MacOSX glue code for extensions])
755
756if test -z "$enable_toolbox_glue"
757then
758 case $ac_sys_system/$ac_sys_release in
759 Darwin/*)
760 enable_toolbox_glue="yes";;
761 *)
762 enable_toolbox_glue="no";;
763 esac
764fi
765case "$enable_toolbox_glue" in
766yes)
Jack Jansen666b1e72001-10-31 12:11:48 +0000767 extra_frameworks="-framework CoreServices -framework Foundation"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000768 extra_machdep_objs="Python/mactoolboxglue.o"
Jack Jansen591cbed2001-08-15 13:55:15 +0000769 extra_undefs="-u __dummy -u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000770 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
771 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000772 ;;
773*)
774 extra_frameworks=""
775 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +0000776 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000777 ;;
778esac
779AC_MSG_RESULT($enable_toolbox_glue)
780
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000781AC_SUBST(LIBTOOL_CRUFT)
782case $ac_sys_system/$ac_sys_release in
Jack Jansen418c3b12001-11-14 10:59:57 +0000783 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +0000784 ns_undef_sym='_environ'
Jack Jansen418c3b12001-11-14 10:59:57 +0000785 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym"
786 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
Jack Jansena3891ea2001-09-07 14:25:12 +0000787 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
788 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +0000789 Darwin/*)
790 ns_undef_sym='_environ'
Jack Jansen418c3b12001-11-14 10:59:57 +0000791 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym"
792 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000793 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
794 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000795esac
796
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000797AC_MSG_CHECKING(for --enable-framework)
798if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000799then
Jack Jansenca06bc62001-08-03 15:32:23 +0000800 OPT="$OPT -fno-common -dynamic"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000801 # -U __environ is needed since bundles don't have access
802 # to crt0 when built but will always be linked against it
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000803 # -F. is needed to allow linking to the framework while
804 # in the build location.
805
Jack Jansena3891ea2001-09-07 14:25:12 +0000806 case $ac_sys_system/$ac_sys_release in
Jack Jansen418c3b12001-11-14 10:59:57 +0000807 Darwin/1.3*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-U,$ns_undef_sym";;
808 Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";;
Jack Jansena3891ea2001-09-07 14:25:12 +0000809 esac
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000810 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
811 [Define if you want to produce an OpenStep/Rhapsody framework
812 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000813 AC_MSG_RESULT(yes)
814else
815 AC_MSG_RESULT(no)
816fi
817
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000818AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000819case $ac_sys_system/$ac_sys_release in
820 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000821 AC_DEFINE(WITH_DYLD, 1,
822 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
823 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
824 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000825 AC_MSG_RESULT(always on for Darwin)
826 ;;
827 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000828 AC_MSG_RESULT(no)
829 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000830esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000831
Guido van Rossumac405f61994-09-12 10:56:06 +0000832# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000833AC_SUBST(SO)
834AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000835AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000836AC_SUBST(CCSHARED)
837AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000838# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000839# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000840AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000841if test -z "$SO"
842then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000843 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000844 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000845 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000846 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000847 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000848fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000849AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000850# LDSHARED is the ld *command* used to create shared library
Martin v. Löwis5b718fc2001-09-10 15:34:42 +0000851# -- "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 +0000852# (Shared libraries in this instance are shared modules to be loaded into
853# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000854AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000855if test -z "$LDSHARED"
856then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000857 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000858 AIX*)
859 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
Guido van Rossumce608b02001-09-28 15:59:38 +0000860 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000861 ;;
862 BeOS*)
863 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +0000864 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000865 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000866 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000867 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000868 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +0000869 SunOS/5*)
870 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000871 then LDSHARED='$(CC) -shared'
Martin v. Löwis5b718fc2001-09-10 15:34:42 +0000872 else LDSHARED="$(CC) -G";
Greg Ward57c9a6632000-05-26 12:22:54 +0000873 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000874 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000875 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000876 DYNIX/ptx*) LDSHARED="ld -G";;
Jack Jansen418c3b12001-11-14 10:59:57 +0000877 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +0000878 LDSHARED='$(CC) $(LDFLAGS) -bundle'
879 if test "$enable_framework" ; then
880 # Link against the framework. All externals should be defined.
881 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
882 else
883 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +0000884 LDSHARED="$LDSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +0000885 fi ;;
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000886 Darwin/*)
887 LDSHARED='$(CC) $(LDFLAGS) -bundle'
888 if test "$enable_framework" ; then
889 # Link against the framework. All externals should be defined.
890 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
891 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +0000892 # No framework, use the Python app as bundle-loader
893 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
894 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000895 fi ;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +0000896 Linux*|GNU*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000897 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000898 BSD/OS*/4*) LDSHARED="gcc -shared";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000899 OpenBSD*|NetBSD*|FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000900 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000901 then
902 LDSHARED="cc -shared ${LDFLAGS}"
903 else
904 LDSHARED="ld -Bshareable ${LDFLAGS}"
905 fi;;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000906 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +0000907 if test "$GCC" = "yes"
908 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000909 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000910 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000911 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000912 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000913 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000914 *) LDSHARED="ld";;
915 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000916fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000917AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000918BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000919# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000920# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000921AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000922if test -z "$CCSHARED"
923then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000924 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000925 SunOS*) if test "$GCC" = yes;
926 then CCSHARED="-fPIC";
927 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000928 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +0000929 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +0000930 else CCSHARED="+z";
931 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +0000932 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000933 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000934 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000935 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +0000936 if test "$GCC" = "yes"
937 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000938 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000939 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000940 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000941 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000942 IRIX*/6*) case $CC in
943 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000944 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000945 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000946 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000947 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000948fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000949AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000950# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000951# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000952AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000953if test -z "$LINKFORSHARED"
954then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000955 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000956 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000957 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000958 LINKFORSHARED="-Wl,-E -Wl,+s";;
959# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000960 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +0000961 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000962 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000963 Darwin/*)
964 # -u __dummy makes the linker aware of the objc runtime
965 # in System.framework; otherwise, __objcInit (referenced in
966 # crt1.o) gets erroneously defined as common, which breaks dynamic
967 # loading of any modules which reference it in System.framework.
968 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
969 # not used by the core itself but which needs to be in the core so
970 # that dynamically loaded extension modules have access to it.
Jack Jansen591cbed2001-08-15 13:55:15 +0000971 LINKFORSHARED="$extra_undefs -framework System"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000972 if test "$enable_framework"
973 then
974 LINKFORSHARED="$LINKFORSHARED -framework Python"
975 fi
976 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000977 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000978 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000979 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis36546db2001-09-05 14:24:43 +0000980 FreeBSD*|NetBSD*|OpenBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000981 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
982 then
983 LINKFORSHARED="-Wl,--export-dynamic"
984 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000985 SunOS/5*) case $CC in
986 *gcc*)
Martin v. Löwisa4548572002-04-18 14:51:36 +0000987 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000988 then
989 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000990 fi;;
991 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000992 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000993fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000994AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000995
Neil Schemenauer61c51152001-01-26 16:18:16 +0000996AC_SUBST(CFLAGSFORSHARED)
997AC_MSG_CHECKING(CFLAGSFORSHARED)
998if test ! "$LIBRARY" = "$LDLIBRARY"
999then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +00001000 case $ac_sys_system in
1001 CYGWIN*)
1002 # Cygwin needs CCSHARED when building extension DLLs
1003 # but not when building the interpreter DLL.
1004 CFLAGSFORSHARED='';;
1005 *)
1006 CFLAGSFORSHARED='$(CCSHARED)'
1007 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +00001008fi
1009AC_MSG_RESULT($CFLAGSFORSHARED)
1010
Guido van Rossum627b2d71993-12-24 10:39:16 +00001011# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001012AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1013AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Martin v. Löwis41933dd2002-03-21 15:10:58 +00001014AC_CHECK_LIB(rt, sem_init) # 'Real Time' functions on Solaris
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00001015
1016# checks for system dependent C++ extensions support
1017case "$ac_sys_system" in
1018 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1019 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1020 [loadAndInit("", 0, "")],
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001021 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1022 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1023 and you want support for AIX C++ shared extension modules.])
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00001024 AC_MSG_RESULT(yes)],
1025 [AC_MSG_RESULT(no)]);;
1026 *) ;;
1027esac
1028
Guido van Rossum70c7f481998-03-26 18:44:10 +00001029# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1030# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001031# BeOS' sockets are stashed in libnet.
1032case "$ac_sys_system" in
1033IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +00001034*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001035AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001036AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00001037;;
1038esac
1039case "$ac_sys_system" in
1040BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001041AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1042;;
1043esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00001044
Guido van Rossumc5a39031996-07-31 17:35:03 +00001045AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001046AC_ARG_WITH(libs,
1047[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +00001048AC_MSG_RESULT($withval)
1049LIBS="$withval $LIBS"
1050], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001051
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001052# Determine if signalmodule should be used.
1053AC_SUBST(USE_SIGNAL_MODULE)
1054AC_SUBST(SIGNAL_OBJS)
1055AC_MSG_CHECKING(for --with-signal-module)
1056AC_ARG_WITH(signal-module,
1057[ --with-signal-module disable/enable signal module])
1058
1059if test -z "$with_signal_module"
1060then with_signal_module="yes"
1061fi
1062AC_MSG_RESULT($with_signal_module)
1063
1064if test "${with_signal_module}" = "yes"; then
1065 USE_SIGNAL_MODULE=""
1066 SIGNAL_OBJS=""
1067else
1068 USE_SIGNAL_MODULE="#"
1069 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1070fi
1071
Guido van Rossum3d15bd82001-01-10 18:53:48 +00001072# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00001073AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001074USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00001075
Guido van Rossum54d93d41997-01-22 20:51:58 +00001076AC_MSG_CHECKING(for --with-dec-threads)
1077AC_SUBST(LDLAST)
1078AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001079[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
1080AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00001081LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00001082if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00001083 with_thread="$withval";
1084fi],
1085AC_MSG_RESULT(no))
1086
Martin v. Löwis11437992002-04-12 09:54:03 +00001087# Templates for things AC_DEFINEd more than once.
1088# For a single AC_DEFINE, no template is needed.
1089AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
1090AH_TEMPLATE(_REENTRANT,
1091 [Define to force use of thread-safe errno, h_errno, and other functions])
1092AH_TEMPLATE(WITH_THREAD,
1093 [Define if you want to compile in rudimentary thread support])
1094
Guido van Rossum54d93d41997-01-22 20:51:58 +00001095AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001096AC_ARG_WITH(threads,
1097[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +00001098
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001099# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00001100AC_ARG_WITH(thread,
1101[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
1102with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001103
1104if test -z "$with_threads"
1105then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001106fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001107AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00001108
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001109AC_SUBST(THREADOBJ)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001110if test "$with_threads" = "no"
1111then
1112 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001113elif test "$ac_cv_pthread_is_default" = yes
1114then
1115 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001116 # Defining _REENTRANT on system with POSIX threads should not hurt.
1117 AC_DEFINE(_REENTRANT)
1118 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001119 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001120elif test "$ac_cv_kpthread" = "yes"
1121then
1122 CC="$CC -Kpthread"
1123 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001124 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001125 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001126else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001127 if test ! -z "$with_threads" -a -d "$with_threads"
1128 then LDFLAGS="$LDFLAGS -L$with_threads"
1129 fi
1130 if test ! -z "$withval" -a -d "$withval"
1131 then LDFLAGS="$LDFLAGS -L$withval"
1132 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001133
1134 # According to the POSIX spec, a pthreads implementation must
1135 # define _POSIX_THREADS in unistd.h. Some apparently don't (which ones?)
1136 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1137 AC_EGREP_CPP(yes,
1138 [#include <unistd.h>
1139 #ifdef _POSIX_THREADS
1140 yes
1141 #endif
1142 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1143 AC_MSG_RESULT($unistd_defines_pthreads)
1144
Martin v. Löwis130fb172001-07-19 11:00:41 +00001145 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001146 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1147 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001148 AC_DEFINE(HURD_C_THREADS, 1,
1149 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001150 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001151 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001152 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1153 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001154 AC_DEFINE(MACH_C_THREADS, 1,
1155 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001156 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001157 AC_MSG_CHECKING(for --with-pth)
1158 AC_ARG_WITH(pth,
1159 [ --with-pth use GNU pth threading libraries], [
1160 AC_MSG_RESULT($withval)
1161 AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001162 AC_DEFINE(HAVE_PTH, 1, [Define if you have GNU PTH threads.])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001163 LIBS="-lpth $LIBS"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001164 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001165 AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00001166
1167 # Just looking for pthread_create in libpthread is not enough:
1168 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1169 # So we really have to include pthread.h, and then link.
1170 _libs=$LIBS
1171 LIBS="$LIBS -lpthread"
1172 AC_MSG_CHECKING([for pthread_create in -lpthread])
1173 AC_TRY_LINK([#include <pthread.h>
1174
1175void * start_routine (void *arg) { exit (0); }], [
1176pthread_create (NULL, NULL, start_routine, NULL)], [
1177 AC_MSG_RESULT(yes)
1178 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001179 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001180 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00001181 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00001182 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001183 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001184 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001185 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001186 AC_DEFINE(BEOS_THREADS, 1,
1187 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001188 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001189 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001190 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001191 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001192 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001193 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001194 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001195 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001196 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001197 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001198 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001199 LIBS="$LIBS -lthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001200 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001201 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001202 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001203 LIBS="$LIBS -lpthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001204 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001205 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001206 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001207 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001208 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001209 USE_THREAD_MODULE="#"])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001210 ])])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001211
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001212 if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001213 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001214 AC_DEFINE(_POSIX_THREADS, 1,
1215 [Define if you have POSIX threads,
1216 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001217 fi
1218
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001219 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1220 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1221 [AC_TRY_RUN([#include <pthread.h>
1222 void *foo(void *parm) {
1223 return NULL;
1224 }
1225 main() {
1226 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00001227 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001228 if (pthread_attr_init(&attr)) exit(-1);
1229 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00001230 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001231 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00001232 }],
1233 ac_cv_pthread_system_supported=yes,
1234 ac_cv_pthread_system_supported=no,
1235 ac_cv_pthread_system_supported=no)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001236 ])
1237 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1238 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001239 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001240 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001241 AC_CHECK_FUNCS(pthread_sigmask)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001242 fi
1243
Martin v. Löwis130fb172001-07-19 11:00:41 +00001244 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1245 LIBS="$LIBS -lmpc"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001246 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001247 USE_THREAD_MODULE=""])
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001248
1249 if test $posix_threads != "yes"; then
1250 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1251 LIBS="$LIBS -lthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001252 THREADOBJ="Python/thread.o"
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001253 USE_THREAD_MODULE=""])
1254 fi
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001255
Martin v. Löwis130fb172001-07-19 11:00:41 +00001256 if test "$USE_THREAD_MODULE" != "#"
1257 then
1258 # If the above checks didn't disable threads, (at least) OSF1
1259 # needs this '-threads' argument during linking.
1260 case $ac_sys_system in
1261 OSF1) LDLAST=-threads;;
1262 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001263 fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001264fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001265
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001266# Check for enable-ipv6
Martin v. Löwis11437992002-04-12 09:54:03 +00001267AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001268AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001269AC_ARG_ENABLE(ipv6,
1270[ --enable-ipv6 Enable ipv6 (with ipv4) support
1271 --disable-ipv6 Disable ipv6 support],
1272[ case "$enableval" in
1273 no)
1274 AC_MSG_RESULT(no)
1275 ipv6=no
1276 ;;
1277 *) AC_MSG_RESULT(yes)
1278 AC_DEFINE(ENABLE_IPV6)
1279 ipv6=yes
1280 ;;
1281 esac ],
1282
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001283[
1284dnl the check does not work on cross compilation case...
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001285 AC_TRY_RUN([ /* AF_INET6 available check */
1286#include <sys/types.h>
1287#include <sys/socket.h>
1288main()
1289{
1290 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1291 exit(1);
1292 else
1293 exit(0);
1294}
1295],
1296 AC_MSG_RESULT(yes)
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001297 ipv6=yes,
1298 AC_MSG_RESULT(no)
1299 ipv6=no,
1300 AC_MSG_RESULT(no)
1301 ipv6=no
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001302)
1303
1304if test "$ipv6" = "yes"; then
1305 AC_MSG_CHECKING(if RFC2553 API is available)
1306 AC_TRY_COMPILE([#include <sys/types.h>
1307#include <netinet/in.h>],
1308 [struct sockaddr_in6 x;
1309x.sin6_scope_id;],
1310 AC_MSG_RESULT(yes)
1311 ipv6=yes,
1312 AC_MSG_RESULT(no, IPv6 disabled)
1313 ipv6=no)
1314fi
1315
1316if test "$ipv6" = "yes"; then
1317 AC_DEFINE(ENABLE_IPV6)
1318fi
1319])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001320
1321ipv6type=unknown
1322ipv6lib=none
1323ipv6trylibc=no
1324
1325if test "$ipv6" = "yes"; then
1326 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00001327 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1328 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001329 case $i in
1330 inria)
1331 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001332 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001333#include <netinet/in.h>
1334#ifdef IPV6_INRIA_VERSION
1335yes
1336#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001337 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001338 ;;
1339 kame)
1340 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001341 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001342#include <netinet/in.h>
1343#ifdef __KAME__
1344yes
1345#endif],
1346 [ipv6type=$i;
1347 ipv6lib=inet6
1348 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001349 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001350 ;;
1351 linux-glibc)
1352 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001353 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001354#include <features.h>
1355#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1356yes
1357#endif],
1358 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001359 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001360 ;;
1361 linux-inet6)
1362 dnl http://www.v6.linux.or.jp/
1363 if test -d /usr/inet6; then
1364 ipv6type=$i
1365 ipv6lib=inet6
1366 ipv6libdir=/usr/inet6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001367 OPT="-I/usr/inet6/include $OPT"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001368 fi
1369 ;;
1370 solaris)
1371 if test -f /etc/netconfig; then
1372 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1373 ipv6type=$i
1374 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001375 fi
1376 fi
1377 ;;
1378 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001379 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001380#include <sys/param.h>
1381#ifdef _TOSHIBA_INET6
1382yes
1383#endif],
1384 [ipv6type=$i;
1385 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001386 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001387 ;;
1388 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001389 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001390#include </usr/local/v6/include/sys/v6config.h>
1391#ifdef __V6D__
1392yes
1393#endif],
1394 [ipv6type=$i;
1395 ipv6lib=v6;
1396 ipv6libdir=/usr/local/v6/lib;
1397 OPT="-I/usr/local/v6/include $OPT"])
1398 ;;
1399 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001400 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001401#include <sys/param.h>
1402#ifdef _ZETA_MINAMI_INET6
1403yes
1404#endif],
1405 [ipv6type=$i;
1406 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001407 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001408 ;;
1409 esac
1410 if test "$ipv6type" != "unknown"; then
1411 break
1412 fi
1413 done
1414 AC_MSG_RESULT($ipv6type)
1415fi
1416
1417if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1418 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1419 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1420 echo "using lib$ipv6lib"
1421 else
1422 if test $ipv6trylibc = "yes"; then
1423 echo "using libc"
1424 else
1425 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1426 echo "You need to fetch lib$ipv6lib.a from appropriate"
1427 echo 'ipv6 kit and compile beforehand.'
1428 exit 1
1429 fi
1430 fi
1431fi
1432
Barry Warsawef82cd72000-06-30 16:21:01 +00001433# Check for GC support
Barry Warsawef82cd72000-06-30 16:21:01 +00001434AC_MSG_CHECKING(for --with-cycle-gc)
1435AC_ARG_WITH(cycle-gc,
1436[ --with(out)-cycle-gc disable/enable garbage collection])
1437
1438if test -z "$with_cycle_gc"
1439then with_cycle_gc="yes"
1440fi
Neil Schemenauer9c63e6d2001-08-29 23:44:38 +00001441if test "$with_cycle_gc" != "no"
Barry Warsawef82cd72000-06-30 16:21:01 +00001442then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001443 AC_DEFINE(WITH_CYCLE_GC, 1,
1444 [Define if you want to compile in cycle garbage collection.])
Barry Warsawef82cd72000-06-30 16:21:01 +00001445fi
1446AC_MSG_RESULT($with_cycle_gc)
1447
Jack Jansen7b8c7542002-04-14 20:12:41 +00001448# Check for universal newline support
1449AC_MSG_CHECKING(for --with-universal-newline)
1450AC_ARG_WITH(universal-newlines,
1451[ --with(out)-universal-newlines disable/enable foreign newlines])
1452
1453if test -z "$with_universal_newlines"
1454then with_universal_newlines="yes"
1455fi
1456if test "$with_universal_newlines" != "no"
1457then
Martin v. Löwise8aea582002-04-16 05:51:02 +00001458 AC_DEFINE(WITH_UNIVERSAL_NEWLINES, 1,
1459 [Define if you want to read files with foreign newlines.])
Jack Jansen7b8c7542002-04-14 20:12:41 +00001460fi
1461AC_MSG_RESULT($with_universal_newlines)
1462
Neil Schemenauera35c6882001-02-27 04:45:05 +00001463# Check for Python-specific malloc support
1464AC_MSG_CHECKING(for --with-pymalloc)
1465AC_ARG_WITH(pymalloc,
Neil Schemenauer16c22972002-03-22 15:34:49 +00001466[ --with(out)-pymalloc disable/enable specialized mallocs])
1467
1468if test -z "$with_pymalloc"
1469then with_pymalloc="yes"
1470fi
1471if test "$with_pymalloc" != "no"
1472then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001473 AC_DEFINE(WITH_PYMALLOC, 1,
1474 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00001475fi
1476AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00001477
Barry Warsawef82cd72000-06-30 16:21:01 +00001478# Check for --with-wctype-functions
1479AC_MSG_CHECKING(for --with-wctype-functions)
1480AC_ARG_WITH(wctype-functions,
1481[ --with-wctype-functions use wctype.h functions], [
1482if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001483then
1484 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
1485 [Define if you want wctype.h functions to be used instead of the
1486 one supplied by Python itself. (see Include/unicodectype.h).])
1487 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00001488else AC_MSG_RESULT(no)
1489fi],
1490[AC_MSG_RESULT(no)])
1491
Guido van Rossum68242b51996-05-28 22:53:03 +00001492# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001493AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00001494DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001495
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001496AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001497AC_ARG_WITH(sgi-dl,
1498[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001499AC_MSG_RESULT($withval)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001500AC_DEFINE(WITH_SGI_DL, 1,
1501 [Define if you want to use SGI (IRIX 4) dynamic linking.
1502 This requires the "dl" library by Jack Jansen,
1503 ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
1504 Do not bother on IRIX 5, it already has dynamic linking using SunOS
1505 style shared libraries])
Guido van Rossume97ee181999-12-20 21:27:22 +00001506DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001507dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001508if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001509then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001510else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1511fi
1512DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001513LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001514
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001515AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001516AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001517AC_MSG_RESULT($withval)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001518AC_DEFINE(WITH_DL_DLD, 1,
1519 [Define if you want to emulate SGI (IRIX 4) dynamic linking.
1520 This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4),
1521 Sequent Symmetry (Dynix), and Atari ST.
1522 This requires the 'dl-dld' library,
1523 ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z,
1524 as well as the 'GNU dld' library,
1525 ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z.
1526 Do not bother on SunOS 4 or 5, they already have dynamic linking using
1527 shared libraries.])
Guido van Rossume97ee181999-12-20 21:27:22 +00001528DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001529dldir=`echo "$withval" | sed 's/,.*//'`
1530dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001531if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001532then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001533else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1534fi
1535DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001536LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001537
Guido van Rossume97ee181999-12-20 21:27:22 +00001538# the dlopen() function means we might want to use dynload_shlib.o. some
1539# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001540AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001541
1542# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1543# loading of modules.
1544AC_SUBST(DYNLOADFILE)
1545AC_MSG_CHECKING(DYNLOADFILE)
1546if test -z "$DYNLOADFILE"
1547then
1548 case $ac_sys_system/$ac_sys_release in
1549 AIX*) DYNLOADFILE="dynload_aix.o";;
1550 BeOS*) DYNLOADFILE="dynload_beos.o";;
1551 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001552 Darwin/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001553 *)
1554 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1555 # out any dynamic loading
1556 if test "$ac_cv_func_dlopen" = yes
1557 then DYNLOADFILE="dynload_shlib.o"
1558 else DYNLOADFILE="dynload_stub.o"
1559 fi
1560 ;;
1561 esac
1562fi
1563AC_MSG_RESULT($DYNLOADFILE)
1564if test "$DYNLOADFILE" != "dynload_stub.o"
1565then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001566 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
1567 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00001568fi
1569
Jack Jansenc49e5b72001-06-19 15:00:23 +00001570# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1571
1572AC_SUBST(MACHDEP_OBJS)
1573AC_MSG_CHECKING(MACHDEP_OBJS)
1574if test -z "$MACHDEP_OBJS"
1575then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001576 MACHDEP_OBJS=$extra_machdep_objs
1577else
1578 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00001579fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001580AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00001581
Guido van Rossum627b2d71993-12-24 10:39:16 +00001582# checks for library functions
Martin v. Löwis244edc82001-10-04 22:44:26 +00001583AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \
Fred Drake6b3cc522002-04-15 19:20:27 +00001584 fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \
Martin v. Löwisf95dd0a2001-08-15 17:14:33 +00001585 gai_strerror getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwis06a83e92002-04-14 10:19:44 +00001586 hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001587 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001588 putenv readlink \
Martin v. Löwis61c5edf2001-10-18 04:06:00 +00001589 select setegid seteuid setgid setgroups \
Martin v. Löwis791bfda2001-07-24 06:33:08 +00001590 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
Fred Drake35a092f1999-12-13 16:23:35 +00001591 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001592 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Guido van Rossumc524d952001-10-19 01:31:59 +00001593 truncate uname unsetenv waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001594
Fred Drake8cef4cf2000-06-28 16:40:38 +00001595# check for openpty and forkpty
1596
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001597AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"]))
1598AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"]))
Fred Drake8cef4cf2000-06-28 16:40:38 +00001599
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001600# check for long file support functions
1601AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1602
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001603AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001604AC_CHECK_FUNCS(getpgrp,
1605 AC_TRY_COMPILE([#include <unistd.h>],
1606 [getpgrp(0);],
1607 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
1608 [Define if getpgrp() must be called as getpgrp(0).])
1609 )
1610)
1611AC_CHECK_FUNCS(setpgrp,
1612 AC_TRY_COMPILE([#include <unistd.h>],
1613 [setpgrp(0,0);],
1614 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
1615 [Define if setpgrp() must be called as setpgrp(0, 0).])
1616 )
1617)
1618AC_CHECK_FUNCS(gettimeofday,
1619 AC_TRY_COMPILE([#include <sys/time.h>],
1620 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
1621 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
1622 [Define if gettimeofday() does not have second (timezone) argument
1623 This is the case on Motorola V4 (R40V4.2)])
1624 )
1625)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001626
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001627
1628# On OSF/1 V5.1, getaddrinfo is available, but a define
1629# for [no]getaddrinfo in netdb.h.
1630AC_MSG_CHECKING(for getaddrinfo)
1631AC_TRY_LINK([
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00001632#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001633#include <sys/socket.h>
1634#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00001635#include <stdio.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001636],[
1637getaddrinfo(NULL, NULL, NULL, NULL);
1638], [
1639AC_MSG_RESULT(yes)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001640AC_MSG_CHECKING(getaddrinfo bug)
1641AC_TRY_RUN([
1642#include <sys/types.h>
1643#include <netdb.h>
1644#include <string.h>
1645#include <sys/socket.h>
1646#include <netinet/in.h>
1647
1648main()
1649{
1650 int passive, gaierr, inet4 = 0, inet6 = 0;
1651 struct addrinfo hints, *ai, *aitop;
1652 char straddr[INET6_ADDRSTRLEN], strport[16];
1653
1654 for (passive = 0; passive <= 1; passive++) {
1655 memset(&hints, 0, sizeof(hints));
1656 hints.ai_family = AF_UNSPEC;
1657 hints.ai_flags = passive ? AI_PASSIVE : 0;
1658 hints.ai_socktype = SOCK_STREAM;
1659 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1660 (void)gai_strerror(gaierr);
1661 goto bad;
1662 }
1663 for (ai = aitop; ai; ai = ai->ai_next) {
1664 if (ai->ai_addr == NULL ||
1665 ai->ai_addrlen == 0 ||
1666 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1667 straddr, sizeof(straddr), strport, sizeof(strport),
1668 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1669 goto bad;
1670 }
1671 switch (ai->ai_family) {
1672 case AF_INET:
1673 if (strcmp(strport, "54321") != 0) {
1674 goto bad;
1675 }
1676 if (passive) {
1677 if (strcmp(straddr, "0.0.0.0") != 0) {
1678 goto bad;
1679 }
1680 } else {
1681 if (strcmp(straddr, "127.0.0.1") != 0) {
1682 goto bad;
1683 }
1684 }
1685 inet4++;
1686 break;
1687 case AF_INET6:
1688 if (strcmp(strport, "54321") != 0) {
1689 goto bad;
1690 }
1691 if (passive) {
1692 if (strcmp(straddr, "::") != 0) {
1693 goto bad;
1694 }
1695 } else {
1696 if (strcmp(straddr, "::1") != 0) {
1697 goto bad;
1698 }
1699 }
1700 inet6++;
1701 break;
1702 case AF_UNSPEC:
1703 goto bad;
1704 break;
1705 default:
1706 /* another family support? */
1707 break;
1708 }
1709 }
1710 }
1711
1712 if (!(inet4 == 0 || inet4 == 2))
1713 goto bad;
1714 if (!(inet6 == 0 || inet6 == 2))
1715 goto bad;
1716
1717 if (aitop)
1718 freeaddrinfo(aitop);
1719 exit(0);
1720
1721 bad:
1722 if (aitop)
1723 freeaddrinfo(aitop);
1724 exit(1);
1725}
1726],
1727AC_MSG_RESULT(good)
1728buggygetaddrinfo=no,
1729AC_MSG_RESULT(buggy)
1730buggygetaddrinfo=yes,
1731AC_MSG_RESULT(buggy)
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001732buggygetaddrinfo=yes)], [
1733AC_MSG_RESULT(no)
1734buggygetaddrinfo=yes
1735])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001736
1737if test "$buggygetaddrinfo" = "yes"; then
1738 if test "$ipv6" = "yes"; then
1739 echo 'Fatal: You must get working getaddrinfo() function.'
1740 echo ' or you can specify "--disable-ipv6"'.
1741 exit 1
1742 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001743else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001744 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001745fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00001746AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001747
Guido van Rossum627b2d71993-12-24 10:39:16 +00001748# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001749AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001750AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001751AC_STRUCT_TIMEZONE
Guido van Rossum98bf58f2001-10-18 20:34:25 +00001752AC_STRUCT_ST_RDEV
1753AC_STRUCT_ST_BLKSIZE
1754AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001755
1756AC_MSG_CHECKING(for time.h that defines altzone)
1757AC_CACHE_VAL(ac_cv_header_time_altzone,
1758[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1759 ac_cv_header_time_altzone=yes,
1760 ac_cv_header_time_altzone=no)])
1761AC_MSG_RESULT($ac_cv_header_time_altzone)
1762if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001763 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001764fi
1765
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001766was_it_defined=no
1767AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001768AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001769#include <sys/types.h>
1770#include <sys/select.h>
1771#include <sys/time.h>
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001772], [;], [
1773 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
1774 [Define if you can safely include both <sys/select.h> and <sys/time.h>
1775 (which you can't on SCO ODT 3.0).])
1776 was_it_defined=yes
1777])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001778AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001779
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001780AC_MSG_CHECKING(for addrinfo)
1781AC_CACHE_VAL(ac_cv_struct_addrinfo,
1782AC_TRY_COMPILE([
1783# include <netdb.h>],
1784 [struct addrinfo a],
1785 ac_cv_struct_addrinfo=yes,
1786 ac_cv_struct_addrinfo=no))
1787AC_MSG_RESULT($ac_cv_struct_addrinfo)
1788if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001789 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001790fi
1791
1792AC_MSG_CHECKING(for sockaddr_storage)
1793AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1794AC_TRY_COMPILE([
1795# include <sys/types.h>
1796# include <sys/socket.h>],
1797 [struct sockaddr_storage s],
1798 ac_cv_struct_sockaddr_storage=yes,
1799 ac_cv_struct_sockaddr_storage=no))
1800AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1801if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001802 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001803fi
1804
Guido van Rossum627b2d71993-12-24 10:39:16 +00001805# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001806
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001807AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001808AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001809
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001810works=no
1811AC_MSG_CHECKING(for working volatile)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001812AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
1813 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
1814)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001815AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001816
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001817works=no
1818AC_MSG_CHECKING(for working signed char)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001819AC_TRY_COMPILE([], [signed char c;], works=yes,
1820 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
1821)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001822AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001823
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001824have_prototypes=no
1825AC_MSG_CHECKING(for prototypes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001826AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
1827 AC_DEFINE(HAVE_PROTOTYPES, 1,
1828 [Define if your compiler supports function prototype])
1829 have_prototypes=yes
1830])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001831AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001832
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001833works=no
1834AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001835AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001836#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001837int foo(int x, ...) {
1838 va_list va;
1839 va_start(va, x);
1840 va_arg(va, int);
1841 va_arg(va, char *);
1842 va_arg(va, double);
1843 return 0;
1844}
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001845], [return foo(10, "", 3.14);], [
1846 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
1847 [Define if your compiler supports variable length function prototypes
1848 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
1849 works=yes
1850])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001851AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001852
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001853if test "$have_prototypes" = yes; then
1854bad_prototypes=no
1855AC_MSG_CHECKING(for bad exec* prototypes)
1856AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001857 AC_DEFINE(BAD_EXEC_PROTOTYPES, 1,
1858 [Define if your <unistd.h> contains bad prototypes for exec*()
1859 (as it does on SGI IRIX 4.x)])
1860 bad_prototypes=yes
1861)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001862AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001863fi
1864
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001865# check if sockaddr has sa_len member
1866AC_MSG_CHECKING(if sockaddr has sa_len member)
1867AC_TRY_COMPILE([#include <sys/types.h>
1868#include <sys/socket.h>],
1869[struct sockaddr x;
1870x.sa_len = 0;],
1871 AC_MSG_RESULT(yes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001872 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001873 AC_MSG_RESULT(no))
1874
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001875AC_MSG_CHECKING(for bad static forward)
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001876AC_CACHE_VAL(ac_cv_bad_static_forward,
1877[AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001878struct s { int a; int b; };
1879static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001880int foobar() {
1881 static int random;
1882 random = (int) &foo;
1883 return random;
1884}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001885static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001886main() {
1887 exit(!((int)&foo == foobar()));
Guido van Rossum3065c942001-09-17 04:03:14 +00001888}],
1889ac_cv_bad_static_forward=no,
1890ac_cv_bad_static_forward=yes,
1891ac_cv_bad_static_forward=no)])
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001892AC_MSG_RESULT($ac_cv_bad_static_forward)
1893if test "$ac_cv_bad_static_forward" = yes
1894then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001895 AC_DEFINE(BAD_STATIC_FORWARD, 1,
1896 [Define if your compiler botches static forward declarations
1897 (as it does on SCI ODT 3.0)])
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +00001898fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001899
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001900va_list_is_array=no
1901AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001902AC_TRY_COMPILE([
1903#ifdef HAVE_STDARG_PROTOTYPES
1904#include <stdarg.h>
1905#else
1906#include <varargs.h>
1907#endif
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001908], [va_list list1, list2; list1 = list2;], , [
1909 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
1910 va_list_is_array=yes
1911])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001912AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001913
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001914# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
Martin v. Löwis11437992002-04-12 09:54:03 +00001915AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
1916 [Define this if you have some version of gethostbyname_r()])
1917
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001918AC_CHECK_FUNC(gethostbyname_r, [
1919 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1920 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1921 OLD_CFLAGS=$CFLAGS
1922 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1923 AC_TRY_COMPILE([
1924# include <netdb.h>
1925 ], [
1926 char *name;
1927 struct hostent *he, *res;
1928 char buffer[2048];
1929 int buflen = 2048;
1930 int h_errnop;
1931
1932 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1933 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001934 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001935 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
1936 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001937 AC_MSG_RESULT(yes)
1938 ], [
1939 AC_MSG_RESULT(no)
1940 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1941 AC_TRY_COMPILE([
1942# include <netdb.h>
1943 ], [
1944 char *name;
1945 struct hostent *he;
1946 char buffer[2048];
1947 int buflen = 2048;
1948 int h_errnop;
1949
1950 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1951 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001952 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001953 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
1954 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001955 AC_MSG_RESULT(yes)
1956 ], [
1957 AC_MSG_RESULT(no)
1958 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1959 AC_TRY_COMPILE([
1960# include <netdb.h>
1961 ], [
1962 char *name;
1963 struct hostent *he;
1964 struct hostent_data data;
1965
1966 (void) gethostbyname_r(name, he, &data);
1967 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001968 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001969 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
1970 [Define this if you have the 3-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001971 AC_MSG_RESULT(yes)
1972 ], [
1973 AC_MSG_RESULT(no)
1974 ])
1975 ])
1976 ])
1977 CFLAGS=$OLD_CFLAGS
1978], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001979 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001980])
1981AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1982AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1983AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001984AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001985AC_SUBST(HAVE_GETHOSTBYNAME)
1986
Guido van Rossum627b2d71993-12-24 10:39:16 +00001987# checks for system services
1988# (none yet)
1989
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001990# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001991AC_CHECK_FUNC(__fpu_control,
1992 [],
1993 [AC_CHECK_LIB(ieee, __fpu_control)
1994])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001995
Guido van Rossum93274221997-05-09 02:42:00 +00001996# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001997AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001998AC_ARG_WITH(fpectl,
1999[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00002000if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002001then
2002 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
2003 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
2004 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00002005else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00002006fi],
2007[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00002008
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002009# check for --with-libm=...
2010AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00002011case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00002012Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002013BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00002014*) LIBM=-lm
2015esac
Guido van Rossum93274221997-05-09 02:42:00 +00002016AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002017AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00002018if test "$withval" = no
2019then LIBM=
2020 AC_MSG_RESULT(force LIBM empty)
2021elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002022then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00002023 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002024else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00002025fi],
2026[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002027
2028# check for --with-libc=...
2029AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00002030AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002031AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00002032if test "$withval" = no
2033then LIBC=
2034 AC_MSG_RESULT(force LIBC empty)
2035elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002036then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00002037 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002038else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00002039fi],
2040[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002041
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00002042# check for hypot() in math library
2043LIBS_SAVE=$LIBS
2044LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00002045AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00002046LIBS=$LIBS_SAVE
2047
Guido van Rossumad713701997-07-10 22:42:38 +00002048# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00002049AC_MSG_CHECKING(what malloc(0) returns)
2050AC_CACHE_VAL(ac_cv_malloc_zero,
2051[AC_TRY_RUN([#include <stdio.h>
2052#ifdef HAVE_STDLIB
2053#include <stdlib.h>
2054#else
2055char *malloc(), *realloc();
2056int *free();
2057#endif
2058main() {
2059 char *p;
2060 p = malloc(0);
2061 if (p == NULL) exit(1);
2062 p = realloc(p, 0);
2063 if (p == NULL) exit(1);
2064 free(p);
2065 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00002066}],
2067ac_cv_malloc_zero=nonnull,
2068ac_cv_malloc_zero=null,
2069ac_cv_malloc_zero=nonnull)]) # XXX arm cross-compile?
Guido van Rossumad713701997-07-10 22:42:38 +00002070AC_MSG_RESULT($ac_cv_malloc_zero)
2071if test "$ac_cv_malloc_zero" = null
2072then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002073 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL, 1,
2074 [Define if malloc(0) returns a NULL pointer.])
Guido van Rossumad713701997-07-10 22:42:38 +00002075fi
2076
Guido van Rossumef2255b2000-03-10 22:30:29 +00002077# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002078AC_CHECK_HEADER(wchar.h, [
2079 AC_DEFINE(HAVE_WCHAR_H, 1,
2080 [Define if the compiler provides a wchar.h header file.])
2081 wchar_h="yes"
2082],
Guido van Rossumef2255b2000-03-10 22:30:29 +00002083wchar_h="no"
2084)
2085
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002086# determine wchar_t size
2087if test "$wchar_h" = yes
2088then
Guido van Rossum67b26592001-10-20 14:21:45 +00002089 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002090fi
2091
2092AC_MSG_CHECKING(what type to use for unicode)
2093AC_ARG_ENABLE(unicode,
2094[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
2095
2096if test $enable_unicode = yes
2097then
Martin v. Löwisfd917792001-06-27 20:22:04 +00002098 # Without any arguments, Py_UNICODE defaults to two-byte mode
2099 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002100fi
2101
Martin v. Löwis0036cba2002-04-12 09:58:45 +00002102AH_TEMPLATE(Py_UNICODE_SIZE,
2103 [Define as the size of the unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002104case "$enable_unicode" in
2105ucs2) unicode_size="2"
2106 AC_DEFINE(Py_UNICODE_SIZE,2)
2107 ;;
2108ucs4) unicode_size="4"
2109 AC_DEFINE(Py_UNICODE_SIZE,4)
2110 ;;
2111esac
2112
Martin v. Löwis11437992002-04-12 09:54:03 +00002113AH_TEMPLATE(PY_UNICODE_TYPE,
2114 [Define as the integral type used for Unicode representation.])
Martin v. Löwis0036cba2002-04-12 09:58:45 +00002115
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002116AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002117if test "$enable_unicode" = "no"
2118then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002119 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002120 AC_MSG_RESULT(not used)
2121else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002122 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002123 AC_DEFINE(Py_USING_UNICODE, 1,
2124 [Define if you want to have a Unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002125 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
2126 then
2127 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002128 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
2129 [Define if you have a useable wchar_t type defined in wchar.h; useable
2130 means wchar_t must be 16-bit unsigned type. (see
2131 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002132 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
2133 elif test "$ac_cv_sizeof_short" = "$unicode_size"
2134 then
2135 PY_UNICODE_TYPE="unsigned short"
2136 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
2137 elif test "$ac_cv_sizeof_long" = "$unicode_size"
2138 then
2139 PY_UNICODE_TYPE="unsigned long"
2140 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
2141 else
2142 PY_UNICODE_TYPE="no type found"
2143 fi
2144 AC_MSG_RESULT($PY_UNICODE_TYPE)
2145fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00002146
2147# check for endianness
2148AC_C_BIGENDIAN
2149
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002150# Check whether right shifting a negative integer extends the sign bit
2151# or fills with zeros (like the Cray J90, according to Tim Peters).
2152AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00002153AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002154AC_TRY_RUN([
2155int main()
2156{
Vladimir Marangozova6180282000-07-12 05:05:06 +00002157 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002158}
Guido van Rossum3065c942001-09-17 04:03:14 +00002159],
2160ac_cv_rshift_extends_sign=yes,
2161ac_cv_rshift_extends_sign=no,
2162ac_cv_rshift_extends_sign=yes)])
Vladimir Marangozova6180282000-07-12 05:05:06 +00002163AC_MSG_RESULT($ac_cv_rshift_extends_sign)
2164if test "$ac_cv_rshift_extends_sign" = no
2165then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002166 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
2167 [Define if i>>j for signed int i does not extend the sign bit
2168 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00002169fi
2170
Guido van Rossumcadfaec2001-01-05 14:45:49 +00002171# check for getc_unlocked and related locking functions
2172AC_MSG_CHECKING(for getc_unlocked() and friends)
2173AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
2174AC_TRY_LINK([#include <stdio.h>],[
2175 FILE *f = fopen("/dev/null", "r");
2176 flockfile(f);
2177 getc_unlocked(f);
2178 funlockfile(f);
2179], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
2180AC_MSG_RESULT($ac_cv_have_getc_unlocked)
2181if test "$ac_cv_have_getc_unlocked" = yes
2182then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002183 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
2184 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00002185fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002186
Martin v. Löwis0daad592001-09-30 21:09:59 +00002187# check for readline 4.0
2188AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002189 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
2190 [Define if you have readline 4.0]), , -ltermcap)
Martin v. Löwis0daad592001-09-30 21:09:59 +00002191
Guido van Rossum353ae582001-07-10 16:45:32 +00002192# check for readline 4.2
2193AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002194 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
2195 [Define if you have readline 4.2]), , -ltermcap)
Guido van Rossum353ae582001-07-10 16:45:32 +00002196
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002197AC_MSG_CHECKING(for broken nice())
2198AC_CACHE_VAL(ac_cv_broken_nice, [
2199AC_TRY_RUN([
2200int main()
2201{
2202 int val1 = nice(1);
2203 if (val1 != -1 && val1 == nice(2))
2204 exit(0);
2205 exit(1);
2206}
Guido van Rossum3065c942001-09-17 04:03:14 +00002207],
2208ac_cv_broken_nice=yes,
2209ac_cv_broken_nice=no,
2210ac_cv_broken_nice=no)])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002211AC_MSG_RESULT($ac_cv_broken_nice)
2212if test "$ac_cv_broken_nice" = yes
2213then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002214 AC_DEFINE(HAVE_BROKEN_NICE, 1,
2215 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002216fi
2217
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002218# On HP/UX 11.0, mvwdelch is a block with a return statement
2219AC_MSG_CHECKING(whether mvwdelch is an expression)
2220AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
2221AC_TRY_COMPILE([#include <curses.h>], [
2222 int rtn;
2223 rtn = mvwdelch(0,0,0);
2224], ac_cv_mvwdelch_is_expression=yes,
2225 ac_cv_mvwdelch_is_expression=no,
2226 ac_cv_mvwdelch_is_expression=yes))
2227AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
2228
2229if test "$ac_cv_mvwdelch_is_expression" = yes
2230then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002231 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
2232 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002233fi
2234
2235AC_MSG_CHECKING(whether WINDOW has _flags)
2236AC_CACHE_VAL(ac_cv_window_has_flags,
2237AC_TRY_COMPILE([#include <curses.h>], [
2238 WINDOW *w;
2239 w->_flags = 0;
2240], ac_cv_window_has_flags=yes,
2241 ac_cv_window_has_flags=no,
2242 ac_cv_window_has_flags=no))
2243AC_MSG_RESULT($ac_cv_window_has_flags)
2244
2245
2246if test "$ac_cv_window_has_flags" = yes
2247then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002248 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
2249 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002250fi
2251
Guido van Rossum95713eb2000-05-18 20:53:31 +00002252# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
2253# Add sys/socket.h to confdefs.h
2254cat >> confdefs.h <<\EOF
2255#ifdef HAVE_SYS_SOCKET_H
2256#include <sys/socket.h>
2257#endif
2258EOF
2259AC_CHECK_TYPE(socklen_t, int)
2260
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002261#AC_MSG_CHECKING(for Modules/Setup)
2262#if test ! -f Modules/Setup ; then
2263# if test ! -d Modules ; then
2264# mkdir Modules
2265# fi
2266# cp "$srcdir/Modules/Setup.dist" Modules/Setup
2267# AC_MSG_RESULT(creating)
2268#else
2269# AC_MSG_RESULT(already exists)
2270#fi
2271
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00002272AC_SUBST(THREADHEADERS)
2273
2274for h in `(cd $srcdir;echo Python/thread_*.h)`
2275do
2276 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
2277done
2278
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002279AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00002280SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00002281AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002282for dir in $SRCDIRS; do
2283 if test ! -d $dir; then
2284 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00002285 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002286done
2287AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00002288
Guido van Rossum627b2d71993-12-24 10:39:16 +00002289# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00002290AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00002291
2292echo "creating Setup"
2293if test ! -f Modules/Setup
2294then
2295 cp $srcdir/Modules/Setup.dist Modules/Setup
2296fi
2297
2298echo "creating Setup.local"
2299if test ! -f Modules/Setup.local
2300then
2301 echo "# Edit this file for local setup changes" >Modules/Setup.local
2302fi
2303
2304echo "creating Makefile"
2305$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
2306 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00002307 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00002308mv config.c Modules