blob: 560942c971466f976036d8296a101923bba66521 [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.
Martin v. Löwis88afe662002-10-26 13:47:44 +00002
3# Set VERSION so we only need to edit in one place (i.e., here)
4m4_define(PYTHON_VERSION, 2.3)
5
Guido van Rossum76be6ed1995-01-02 18:33:54 +00006AC_REVISION($Revision$)
Martin v. Löwis97017322002-04-12 17:25:21 +00007AC_PREREQ(2.53)
Martin v. Löwis88afe662002-10-26 13:47:44 +00008AC_INIT(python, PYTHON_VERSION)
9AC_CONFIG_SRCDIR([Include/object.h])
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +000010AC_CONFIG_HEADER(pyconfig.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +000011
Martin v. Löwis11437992002-04-12 09:54:03 +000012# This is for stuff that absolutely must end up in pyconfig.h.
13# Please use pyport.h instead, if possible.
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000014AH_TOP([
15#ifndef Py_PYCONFIG_H
16#define Py_PYCONFIG_H
17])
Martin v. Löwis11437992002-04-12 09:54:03 +000018AH_BOTTOM([
Martin v. Löwis11437992002-04-12 09:54:03 +000019/* Define the macros needed if on a UnixWare 7.x system. */
20#if defined(__USLC__) && defined(__SCO_VERSION__)
21#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
22#endif
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000023
24#endif /*Py_PYCONFIG_H*/
Martin v. Löwis11437992002-04-12 09:54:03 +000025])
26
Guido van Rossum642b6781997-07-19 19:35:41 +000027AC_SUBST(VERSION)
Martin v. Löwis88afe662002-10-26 13:47:44 +000028VERSION=PYTHON_VERSION
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
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +000033# The later defininition of _XOPEN_SOURCE disables certain features
34# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
35AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
36
Martin v. Löwise981a4e2002-11-11 13:26:51 +000037define_xopen_source=yes
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +000038
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +000039# Arguments passed to configure.
40AC_SUBST(CONFIG_ARGS)
41CONFIG_ARGS="$ac_configure_args"
42
Martin v. Löwis3e2c6322002-10-29 10:07:43 +000043dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Jack Jansenb6e9cad2001-08-15 01:26:28 +000044AC_ARG_ENABLE(framework,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +000045 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
46[
Jack Jansenb6e9cad2001-08-15 01:26:28 +000047 case $enableval in
48 yes)
49 enableval=/Library/Frameworks
Jack Jansen127e56e2001-09-11 14:41:54 +000050 esac
51 case $enableval in
52 no)
53 PYTHONFRAMEWORK=
54 PYTHONFRAMEWORKDIR=no-framework
55 PYTHONFRAMEWORKPREFIX=
56 PYTHONFRAMEWORKINSTALLDIR=
57 enable_framework=
Jack Jansenb6e9cad2001-08-15 01:26:28 +000058 ;;
59 *)
Jack Jansen127e56e2001-09-11 14:41:54 +000060 PYTHONFRAMEWORK=Python
61 PYTHONFRAMEWORKDIR=Python.framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +000062 PYTHONFRAMEWORKPREFIX=$enableval
Jack Jansen127e56e2001-09-11 14:41:54 +000063 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
64 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
Jack Jansenb6e9cad2001-08-15 01:26:28 +000065 esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +000066 ],[
67 PYTHONFRAMEWORK=
Jack Jansen127e56e2001-09-11 14:41:54 +000068 PYTHONFRAMEWORKDIR=no-framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +000069 PYTHONFRAMEWORKPREFIX=
70 PYTHONFRAMEWORKINSTALLDIR=
71 enable_framework=
72])
73AC_SUBST(PYTHONFRAMEWORK)
74AC_SUBST(PYTHONFRAMEWORKDIR)
75AC_SUBST(PYTHONFRAMEWORKPREFIX)
76AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
Guido van Rossum4b6b5791996-09-09 20:09:34 +000077
Jack Jansenb6e9cad2001-08-15 01:26:28 +000078##AC_ARG_WITH(dyld,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +000079## AC_HELP_STRING(--with-dyld,
80## Use (OpenStep|Rhapsody) dynamic linker))
Jack Jansenb6e9cad2001-08-15 01:26:28 +000081##
Guido van Rossumb418f891996-07-30 18:06:02 +000082# Set name for machine-dependent library files
83AC_SUBST(MACHDEP)
84AC_MSG_CHECKING(MACHDEP)
85if test -z "$MACHDEP"
86then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000087 ac_sys_system=`uname -s`
Martin v. Löwis21ee4092002-09-30 16:19:48 +000088 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
89 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000090 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000091 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000092 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000093 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000094 ac_md_system=`echo $ac_sys_system |
95 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
96 ac_md_release=`echo $ac_sys_release |
Guido van Rossum67b26592001-10-20 14:21:45 +000097 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000098 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000099
Guido van Rossumbcd91e01997-03-20 20:46:29 +0000100 case $MACHDEP in
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +0000101 cygwin*) MACHDEP="cygwin";;
Jack Jansen8a97f4a2001-12-05 23:27:32 +0000102 darwin*) MACHDEP="darwin";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000103 atheos*) MACHDEP="atheos";;
Guido van Rossumb97ef171997-09-28 05:44:03 +0000104 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000105 esac
106fi
Jack Jansen83f898c2002-12-30 22:23:40 +0000107
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000108# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
109# disable features if it is defined, without any means to access these
110# features as extensions. For these systems, we skip the definition of
111# _XOPEN_SOURCE. Before adding a system to the list to gain access to
112# some feature, make sure there is no alternative way to access this
113# feature. Also, when using wildcards, make sure you have verified the
114# need for not defining _XOPEN_SOURCE on all systems matching the
115# wildcard, and that the wildcard does not include future systems
116# (which may remove their limitations).
117dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
118case $ac_sys_system/$ac_sys_release in
119 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
120 # even though select is a POSIX function. Reported by J. Ribbens.
121 OpenBSD/2.* | OpenBSD/3.@<:@012@:>@)
122 define_xopen_source=no;;
123esac
124
125if test $define_xopen_source = yes
126then
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000127 AC_DEFINE(_XOPEN_SOURCE, 600,
128 Define to the level of X/Open that your system supports)
129
130 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
131 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
132 # several APIs are not declared. Since this is also needed in some
133 # cases for HP-UX, we define it globally.
134
135 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Define to activate Unix95-and-earlier features)
136 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
137
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000138fi
139
Guido van Rossum91922671997-10-09 20:24:13 +0000140#
141# SGI compilers allow the specification of the both the ABI and the
142# ISA on the command line. Depending on the values of these switches,
143# different and often incompatable code will be generated.
144#
145# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
146# thus supply support for various ABI/ISA combinations. The MACHDEP
147# variable is also adjusted.
148#
149AC_SUBST(SGI_ABI)
150if test ! -z "$SGI_ABI"
151then
152 CC="cc $SGI_ABI"
153 LDFLAGS="$SGI_ABI $LDFLAGS"
154 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
155fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000156AC_MSG_RESULT($MACHDEP)
157
Jack Jansen83f898c2002-12-30 22:23:40 +0000158# And add extra plat-mac for darwin
159AC_SUBST(EXTRAPLATDIR)
160AC_MSG_CHECKING(EXTRAPLATDIR)
161if test -z "$EXTRAPLATDIR"
162then
163 case $MACHDEP in
164 darwin) EXTRAPLATDIR="\$(PLATMACDIRS)";;
165 *) EXTRAPLATDIR="";;
166 esac
167fi
168AC_MSG_RESULT($EXTRAPLATDIR)
169
Guido van Rossum627b2d71993-12-24 10:39:16 +0000170# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000171AC_MSG_CHECKING(for --without-gcc)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000172AC_ARG_WITH(gcc,
173 AC_HELP_STRING(--without-gcc,never use gcc),
174[
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000175 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000176 no) CC=cc
177 without_gcc=yes;;
178 yes) CC=gcc
179 without_gcc=no;;
180 *) CC=$withval
181 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000182 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000183 case $ac_sys_system in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000184 AIX*) CC=cc_r
185 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000186 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000187 case $BE_HOST_CPU in
188 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000189 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000190 without_gcc=yes
Mark Hammond8235ea12002-07-19 06:55:41 +0000191 OPT="-O -export pragma"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000192 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000193 ;;
194 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000195 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000196 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000197 OPT=-O
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000198 ;;
199 *)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000200 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000201 ;;
202 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000203 AR="\$(srcdir)/Modules/ar_beos"
204 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000205 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000206 Monterey*)
207 RANLIB=:
Martin v. Löwis130fb172001-07-19 11:00:41 +0000208 without_gcc=;;
209 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000210 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000211AC_MSG_RESULT($without_gcc)
212
Guido van Rossum27552902001-01-23 01:52:26 +0000213AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000214AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000215MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000216AC_MSG_CHECKING(for --with-cxx=<compiler>)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000217AC_ARG_WITH(cxx,
218 AC_HELP_STRING(--with-cxx=<compiler>, enable C++ support),
219[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000220 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000221 case $withval in
222 no) CXX=
223 with_cxx=no;;
224 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000225 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000226 with_cxx=$withval;;
227 esac], [
228 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000229 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000230])
231AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000232
Michael W. Hudson54241132001-12-07 15:38:26 +0000233if test "$with_cxx" = "yes"
234then
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000235 AC_MSG_ERROR([must supply a compiler when using --with-cxx])
Michael W. Hudson54241132001-12-07 15:38:26 +0000236fi
237
Martin v. Löwis537970f2000-12-13 17:37:02 +0000238dnl The following fragment works similar to AC_PROG_CXX.
239dnl It does not fail if CXX is not found, and it is not executed if
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000240dnl --without-cxx was given.
Martin v. Löwis537970f2000-12-13 17:37:02 +0000241dnl Finally, it does not test whether CXX is g++.
242
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000243dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
244ifdef([AC_PROG_CXX_WORKS],[],
245 [AC_DEFUN([AC_PROG_CXX_WORKS],
246 [AC_LANG_PUSH(C++)dnl
247 _AC_COMPILER_EXEEXT
248 AC_LANG_POP()
249 ]
250)])
251
Martin v. Löwis537970f2000-12-13 17:37:02 +0000252if test "$check_cxx" = "yes"
253then
254 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
255 if test "$CXX" = "notfound"
256 then
257 CXX=
258 else
259 AC_PROG_CXX_WORKS
260 fi
261fi
262
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000263# If the user switches compilers, we can't believe the cache
264if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
265then
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000266 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
267(it is also a good idea to do 'make clean' before compiling)])
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000268fi
269
Guido van Rossum627b2d71993-12-24 10:39:16 +0000270AC_PROG_CC
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000271
272# checks for UNIX variants that set C preprocessor variables
273AC_AIX
274AC_MINIX
275
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000276# Check for unsupported systems
277case $ac_sys_system/$ac_sys_release in
278SunOS/4*|DYNIX/*|dgux*/*|IRIX/4*|Linux*/1*)
279 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
280 echo See README for details.
281 exit 1;;
282esac
283
284if test "$MINIX" = yes; then
285 echo This system \(MINIX\) is no longer supported.
286 echo Read README for details.
287 exit 1
288fi
289
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000290AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000291AC_MSG_CHECKING(for --with-suffix)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000292AC_ARG_WITH(suffix,
293 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
294[
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000295 case $withval in
296 no) EXEEXT=;;
297 yes) EXEEXT=.exe;;
298 *) EXEEXT=$withval;;
299 esac])
300AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000301
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000302# Test whether we're running on a non-case-sensitive system, in which
303# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000304AC_SUBST(BUILDEXEEXT)
305AC_MSG_CHECKING(for case-insensitive build directory)
Jack Jansen3c2c4332002-11-06 13:33:32 +0000306if test ! -d CaseSensitiveTestDir; then
307mkdir CaseSensitiveTestDir
308fi
309
310if test -d casesensitivetestdir
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000311then
Jack Jansen1999ef42001-12-06 21:47:20 +0000312 AC_MSG_RESULT(yes)
313 BUILDEXEEXT=.exe
314else
315 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000316 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000317fi
Jack Jansen3c2c4332002-11-06 13:33:32 +0000318rmdir CaseSensitiveTestDir
Guido van Rossumfb842551997-08-06 23:42:07 +0000319
Guido van Rossumdd997f71998-10-07 19:58:26 +0000320case $MACHDEP in
321bsdos*)
322 case $CC in
323 gcc) CC="$CC -D_HAVE_BSDI";;
324 esac;;
325esac
326
Guido van Rossum84561611997-08-21 00:08:11 +0000327case $ac_sys_system in
328hp*|HP*)
329 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000330 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000331 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000332Monterey*)
333 case $CC in
334 cc) CC="$CC -Wl,-Bexport";;
335 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000336SunOS*)
337 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000338 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000339 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000340esac
341
Martin v. Löwise8964d42001-03-06 12:09:07 +0000342
Neil Schemenauer61c51152001-01-26 16:18:16 +0000343AC_SUBST(LIBRARY)
344AC_MSG_CHECKING(LIBRARY)
345if test -z "$LIBRARY"
346then
347 LIBRARY='libpython$(VERSION).a'
348fi
349AC_MSG_RESULT($LIBRARY)
350
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000351# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000352# name of the library into which to insert object files). BLDLIBRARY is also
353# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
354# is blank as the main program is not linked directly against LDLIBRARY.
355# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
356# systems without shared libraries, LDLIBRARY is the same as LIBRARY
357# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
358# DLLLIBRARY is the shared (i.e., DLL) library.
359#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000360# RUNSHARED is used to run shared python without installed libraries
361#
362# INSTSONAME is the name of the shared library that will be use to install
363# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000364AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000365AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000366AC_SUBST(BLDLIBRARY)
367AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000368AC_SUBST(INSTSONAME)
369AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000370LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000371BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis09bdf722002-05-08 08:51:29 +0000372INSTSONAME='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000373DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000374LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000375RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000376
Guido van Rossumfb842551997-08-06 23:42:07 +0000377# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000378# If CXX is set, and if it is needed to link a main function that was
379# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
380# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000381# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000382# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000383AC_SUBST(LINKCC)
384AC_MSG_CHECKING(LINKCC)
385if test -z "$LINKCC"
386then
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000387 if test -z "$CXX"; then
388 LINKCC="\$(PURIFY) \$(CC)"
389 else
Martin v. Löwis1931ca72002-06-01 21:39:58 +0000390 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000391 $CXX -c conftest.$ac_ext 2>&5
392 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
393 && test -s conftest$ac_exeext && ./conftest$ac_exeext
394 then
395 LINKCC="\$(PURIFY) \$(CC)"
396 else
397 LINKCC="\$(PURIFY) \$(CXX)"
398 fi
399 rm -fr conftest*
400 fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000401 case $ac_sys_system in
402 AIX*)
Jeremy Hylton90d10062002-03-08 21:43:51 +0000403 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); $LINKCC";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000404 dgux*)
Martin v. Löwis4e732dc2002-03-19 15:15:32 +0000405 LINKCC="LD_RUN_PATH=$libdir $LINKCC";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000406 Monterey64*)
Martin v. Löwis4e732dc2002-03-19 15:15:32 +0000407 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000408 esac
409fi
410AC_MSG_RESULT($LINKCC)
411
Martin v. Löwis1142de32002-03-29 16:28:31 +0000412AC_MSG_CHECKING(for --enable-shared)
413AC_ARG_ENABLE(shared,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000414 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000415
Martin v. Löwis1142de32002-03-29 16:28:31 +0000416if test -z "$enable_shared"
417then
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000418 case $ac_sys_system in
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000419 CYGWIN* | atheos*)
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000420 enable_shared="yes";;
421 *)
422 enable_shared="no";;
423 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000424fi
425AC_MSG_RESULT($enable_shared)
426
427
428AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000429
Guido van Rossumb8552162001-09-05 14:58:11 +0000430# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
431# library that we build, but we do not want to link against it (we
432# will find it with a -framework option). For this reason there is an
433# extra variable BLDLIBRARY against which Python and the extension
434# modules are linked, BLDLIBRARY. This is normally the same as
435# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000436if test "$enable_framework"
437then
438 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
439 LDLIBRARYDIR='$(PYTHONFRAMEWORKDIR)'
440 BLDLIBRARY=''
441else
442 BLDLIBRARY='$(LDLIBRARY)'
443fi
444
Martin v. Löwis1142de32002-03-29 16:28:31 +0000445# Other platforms follow
446if test $enable_shared = "yes"; then
Mark Hammond8235ea12002-07-19 06:55:41 +0000447 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
Martin v. Löwis1142de32002-03-29 16:28:31 +0000448 case $ac_sys_system in
449 BeOS*)
450 LDLIBRARY='libpython$(VERSION).so'
451 ;;
452 CYGWIN*)
453 LDLIBRARY='libpython$(VERSION).dll.a'
454 DLLLIBRARY='libpython$(VERSION).dll'
455 ;;
456 SunOS*)
457 LDLIBRARY='libpython$(VERSION).so'
458 BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(VERSION)'
459 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
460 ;;
Martin v. Löwis1bc894b2002-07-30 20:19:58 +0000461 Linux*|GNU*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000462 LDLIBRARY='libpython$(VERSION).so'
463 BLDLIBRARY='-L. -lpython$(VERSION)'
464 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
465 INSTSONAME="$LDLIBRARY".$SOVERSION
466 ;;
467 hp*|HP*)
468 LDLIBRARY='libpython$(VERSION).sl'
469 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
470 RUNSHARED=SHLIB_PATH=`pwd`:$SHLIB_PATH
471 ;;
472 OSF*)
473 LDLIBRARY='libpython$(VERSION).so'
474 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
475 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
476 ;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000477 atheos*)
478 LDLIBRARY='libpython$(VERSION).so'
479 BLDLIBRARY='-L. -lpython$(VERSION)'
480 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
481 ;;
Martin v. Löwis1142de32002-03-29 16:28:31 +0000482 esac
483 # DG/UX requires some fancy ld contortions to produce a .so from an .a
484 case $MACHDEP in
485 dguxR4)
486 LDLIBRARY='libpython$(VERSION).so'
487 OPT="$OPT -pic"
488 ;;
489 esac
490fi
491
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000492AC_MSG_RESULT($LDLIBRARY)
493
Guido van Rossum627b2d71993-12-24 10:39:16 +0000494AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000495AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000496AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000497
498case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +0000499bsdos*|hp*|HP*)
500 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +0000501 if test -z "$INSTALL"
502 then
503 INSTALL="${srcdir}/install-sh -c"
504 fi
505esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000506AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000507
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000508# Not every filesystem supports hard links
509AC_SUBST(LN)
510if test -z "$LN" ; then
511 case $ac_sys_system in
512 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000513 CYGWIN*) LN="ln -s";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000514 atheos*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000515 *) LN=ln;;
516 esac
517fi
518
Fred Drake9f715822001-07-11 06:27:00 +0000519# Check for --with-pydebug
520AC_MSG_CHECKING(for --with-pydebug)
521AC_ARG_WITH(pydebug,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000522 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
523[
Fred Drake9f715822001-07-11 06:27:00 +0000524if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000525then
526 AC_DEFINE(Py_DEBUG, 1,
527 [Define if you want to build an interpreter with many run-time checks.])
528 AC_MSG_RESULT(yes);
529 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +0000530else AC_MSG_RESULT(no); Py_DEBUG='false'
531fi],
532[AC_MSG_RESULT(no)])
533
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000534# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000535AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000536if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000537then
Neal Norwitzd957f392002-09-25 21:26:19 +0000538 case $GCC in
Guido van Rossumb5875b61997-07-18 23:29:09 +0000539 yes)
540 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000541 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000542 if test "$Py_DEBUG" = 'true' ; then
543 # Optimization messes up debuggers, so turn it off for
544 # debug builds.
545 OPT="-g -Wall -Wstrict-prototypes"
546 else
547 OPT="-g -O3 -Wall -Wstrict-prototypes"
548 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000549 *)
Fred Drake9f715822001-07-11 06:27:00 +0000550 OPT="-O3 -Wall -Wstrict-prototypes";;
551 esac
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000552 case $ac_sys_system in
553 SCO_SV*) OPT="$OPT -m486 -DSCO5";;
554 esac
Fred Drake9f715822001-07-11 06:27:00 +0000555 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000556 *)
557 case $ac_sys_system in
Martin v. Löwis25ae43b2001-10-07 08:39:18 +0000558 OpenUNIX*|UnixWare*)
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000559 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000560 SCO_SV*)
561 CFLAGS="$CFLAGS -belf"
562 OPT="-belf -O -Ki486 -DSCO5";;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000563 *)
564 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000565 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000566 esac
Jack Jansenca06bc62001-08-03 15:32:23 +0000567 case $ac_sys_system in
568 Darwin*)
Jack Jansen524a0982002-03-12 15:25:52 +0000569 OPT="$OPT -Wno-long-double -no-cpp-precomp";;
Jack Jansenca06bc62001-08-03 15:32:23 +0000570 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000571fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000572
Fred Drakee1ceaa02001-12-04 20:55:47 +0000573if test "$Py_DEBUG" = 'true'; then
574 :
575else
576 OPT="-DNDEBUG $OPT"
577fi
578
Trent Mick635f6fb2000-08-23 21:33:05 +0000579# The current (beta) Monterey compiler dies with optimizations
580case $ac_sys_system in
581Monterey*) OPT="";;
582esac
583
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000584if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000585then
586 OPT="$OPT $ac_arch_flags"
587fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000588
Guido van Rossum91922671997-10-09 20:24:13 +0000589AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
590AC_CACHE_VAL(ac_cv_opt_olimit_ok,
591[ac_save_cc="$CC"
592CC="$CC -OPT:Olimit=0"
593AC_TRY_RUN([int main() { return 0; }],
594 ac_cv_opt_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000595 ac_cv_opt_olimit_ok=no,
Guido van Rossum91922671997-10-09 20:24:13 +0000596 ac_cv_opt_olimit_ok=no)
597CC="$ac_save_cc"])
598AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000599if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000600 case $ac_sys_system in
601 Darwin*) OPT="$OPT" ;;
602 *) OPT="$OPT -OPT:Olimit=0";;
603 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000604else
605 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
606 AC_CACHE_VAL(ac_cv_olimit_ok,
607 [ac_save_cc="$CC"
608 CC="$CC -Olimit 1500"
609 AC_TRY_RUN([int main() { return 0; }],
610 ac_cv_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000611 ac_cv_olimit_ok=no,
Guido van Rossumf8678121998-07-07 21:05:09 +0000612 ac_cv_olimit_ok=no)
613 CC="$ac_save_cc"])
614 AC_MSG_RESULT($ac_cv_olimit_ok)
615 if test $ac_cv_olimit_ok = yes; then
616 OPT="$OPT -Olimit 1500"
617 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000618fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000619
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000620# On some compilers, pthreads are available without further options
621# (e.g. MacOS X). On some of these systems, the compiler will not
622# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
623# So we have to see first whether pthreads are available without
624# options before we can check whether -Kpthread improves anything.
625AC_MSG_CHECKING(whether pthreads are available without options)
626AC_CACHE_VAL(ac_cv_pthread_is_default,
627[AC_TRY_RUN([
628#include <pthread.h>
629
630void* routine(void* p){return NULL;}
631
632int main(){
633 pthread_t p;
634 if(pthread_create(&p,NULL,routine,NULL)!=0)
635 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +0000636 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000637 return 0;
638}
639],
640 ac_cv_pthread_is_default=yes,
641 ac_cv_pthread_is_default=no,
642 ac_cv_pthread_is_default=no)
643])
644AC_MSG_RESULT($ac_cv_pthread_is_default)
645
646
647if test $ac_cv_pthread_is_default = yes
648then
649 ac_cv_kpthread=no
650else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000651# -Kpthread, if available, provides the right #defines
652# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000653# Some compilers won't report that they do not support -Kpthread,
654# so we need to run a program to see whether it really made the
655# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +0000656AC_MSG_CHECKING(whether $CC accepts -Kpthread)
657AC_CACHE_VAL(ac_cv_kpthread,
658[ac_save_cc="$CC"
659CC="$CC -Kpthread"
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000660AC_TRY_RUN([
661#include <pthread.h>
662
663void* routine(void* p){return NULL;}
664
665int main(){
666 pthread_t p;
667 if(pthread_create(&p,NULL,routine,NULL)!=0)
668 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +0000669 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000670 return 0;
671}
672],
Martin v. Löwis130fb172001-07-19 11:00:41 +0000673 ac_cv_kpthread=yes,
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000674 ac_cv_kpthread=no,
Martin v. Löwis130fb172001-07-19 11:00:41 +0000675 ac_cv_kpthread=no)
676CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +0000677AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000678fi
Martin v. Löwis130fb172001-07-19 11:00:41 +0000679
Fred Drakece81d592000-07-09 14:39:29 +0000680dnl # check for ANSI or K&R ("traditional") preprocessor
681dnl AC_MSG_CHECKING(for C preprocessor type)
682dnl AC_TRY_COMPILE([
683dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
684dnl int foo;
685dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
686dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
687dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000688
Guido van Rossum627b2d71993-12-24 10:39:16 +0000689# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000690AC_HEADER_STDC
Martin v. Löwis2e64c342002-03-27 18:49:02 +0000691AC_CHECK_HEADERS(dlfcn.h fcntl.h grp.h limits.h langinfo.h \
692libintl.h locale.h ncurses.h poll.h pthread.h \
Martin v. Löwis14e73b12003-01-01 09:51:12 +0000693signal.h stdarg.h stddef.h stdlib.h stropts.h termios.h thread.h \
694unistd.h utime.h \
Skip Montanaro57454e52002-06-14 20:30:31 +0000695sys/audioio.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000696sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Martin v. Löwisa5f09072002-10-11 05:37:59 +0000697sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \
Skip Montanaro8345f712002-06-25 05:53:48 +0000698sys/resource.h netpacket/packet.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000699AC_HEADER_DIRENT
Martin v. Löwisdbe3f762002-10-10 14:27:30 +0000700AC_HEADER_MAJOR
Guido van Rossum627b2d71993-12-24 10:39:16 +0000701
702# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000703was_it_defined=no
704AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000705AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
706 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
707])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000708AC_MSG_RESULT($was_it_defined)
709
Neal Norwitz11690112002-07-30 01:08:28 +0000710# Check whether using makedev requires defining _OSF_SOURCE
711AC_MSG_CHECKING(for makedev)
712AC_TRY_LINK([ #include <sys/types.h> ],
713 [ makedev(0, 0) ],
714 ac_cv_has_makedev=yes,
715 ac_cv_has_makedev=no)
716if test "$ac_cv_has_makedev" = "no"; then
717 # we didn't link, try if _OSF_SOURCE will allow us to link
718 AC_TRY_LINK([
719 #define _OSF_SOURCE 1
720 #include <sys/types.h>
721 ],
722 [ makedev(0, 0) ],
723 ac_cv_has_makedev=yes,
724 ac_cv_has_makedev=no)
725 if test "$ac_cv_has_makedev" = "yes"; then
726 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
727 fi
728fi
729AC_MSG_RESULT($ac_cv_has_makedev)
730if test "$ac_cv_has_makedev" = "yes"; then
731 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
732fi
733
Martin v. Löwis399a6892002-10-04 10:22:02 +0000734# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
735# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
736# defined, but the compiler does not support pragma redefine_extname,
737# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
738# structures (such as rlimit64) without declaring them. As a
739# work-around, disable LFS on such configurations
740
741use_lfs=yes
742AC_MSG_CHECKING(Solaris LFS bug)
743AC_TRY_COMPILE([
744#define _LARGEFILE_SOURCE 1
745#define _FILE_OFFSET_BITS 64
746#include <sys/resource.h>
747],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
748AC_MSG_RESULT($sol_lfs_bug)
749if test "$sol_lfs_bug" = "yes"; then
750 use_lfs=no
751fi
752
753if test "$use_lfs" = "yes"; then
Guido van Rossum810cc512001-09-09 23:51:39 +0000754# Two defines needed to enable largefile support on various platforms
755# These may affect some typedefs
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000756AC_DEFINE(_LARGEFILE_SOURCE, 1,
757[This must be defined on some systems to enable large file support.])
758AC_DEFINE(_FILE_OFFSET_BITS, 64,
759[This must be set to 64 on some systems to enable large file support.])
Martin v. Löwis399a6892002-10-04 10:22:02 +0000760fi
Guido van Rossum810cc512001-09-09 23:51:39 +0000761
Guido van Rossum300fda71996-08-19 21:58:16 +0000762# Add some code to confdefs.h so that the test for off_t works on SCO
763cat >> confdefs.h <<\EOF
764#if defined(SCO_DS)
765#undef _OFF_T
766#endif
767EOF
768
Guido van Rossumef2255b2000-03-10 22:30:29 +0000769# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000770AC_TYPE_MODE_T
771AC_TYPE_OFF_T
772AC_TYPE_PID_T
773AC_TYPE_SIGNAL
774AC_TYPE_SIZE_T
775AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000776
Guido van Rossumef2255b2000-03-10 22:30:29 +0000777# Sizes of various common basic types
Guido van Rossum3065c942001-09-17 04:03:14 +0000778AC_CHECK_SIZEOF(int, 4)
779AC_CHECK_SIZEOF(long, 4)
780AC_CHECK_SIZEOF(void *, 4)
781AC_CHECK_SIZEOF(char, 1)
782AC_CHECK_SIZEOF(short, 2)
783AC_CHECK_SIZEOF(float, 4)
784AC_CHECK_SIZEOF(double, 8)
785AC_CHECK_SIZEOF(fpos_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +0000786
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000787AC_MSG_CHECKING(for long long support)
788have_long_long=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000789AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
790 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
791 have_long_long=yes
792])
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000793AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000794if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000795AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000796fi
797
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000798AC_MSG_CHECKING(for uintptr_t support)
799have_uintptr_t=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000800AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
801 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
802 have_uintptr_t=yes
803])
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000804AC_MSG_RESULT($have_uintptr_t)
805if test "$have_uintptr_t" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000806AC_CHECK_SIZEOF(uintptr_t, 4)
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000807fi
808
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000809# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
810AC_MSG_CHECKING(size of off_t)
811AC_CACHE_VAL(ac_cv_sizeof_off_t,
812[AC_TRY_RUN([#include <stdio.h>
813#include <sys/types.h>
814main()
815{
816 FILE *f=fopen("conftestval", "w");
817 if (!f) exit(1);
818 fprintf(f, "%d\n", sizeof(off_t));
819 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000820}],
821ac_cv_sizeof_off_t=`cat conftestval`,
822ac_cv_sizeof_off_t=0,
823ac_cv_sizeof_off_t=4)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000824])
825AC_MSG_RESULT($ac_cv_sizeof_off_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000826AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
827[The number of bytes in an off_t.])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000828
829AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000830if test "$have_long_long" = yes -a \
831 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
832 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000833 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
834 [Defined to enable large file support when an off_t is bigger than a long
835 and long long is available and at least as big as an off_t. You may need
836 to add some flags for configuration and compilation to enable this mode.
837 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000838 AC_MSG_RESULT(yes)
839else
840 AC_MSG_RESULT(no)
841fi
842
Fred Drakea3f6e912000-06-29 20:44:47 +0000843# AC_CHECK_SIZEOF() doesn't include <time.h>.
844AC_MSG_CHECKING(size of time_t)
845AC_CACHE_VAL(ac_cv_sizeof_time_t,
846[AC_TRY_RUN([#include <stdio.h>
847#include <time.h>
848main()
849{
850 FILE *f=fopen("conftestval", "w");
851 if (!f) exit(1);
852 fprintf(f, "%d\n", sizeof(time_t));
853 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000854}],
855ac_cv_sizeof_time_t=`cat conftestval`,
856ac_cv_sizeof_time_t=0,
857ac_cv_sizeof_time_t=4)
Fred Drakea3f6e912000-06-29 20:44:47 +0000858])
859AC_MSG_RESULT($ac_cv_sizeof_time_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000860AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
861[The number of bytes in a time_t.])
Fred Drakea3f6e912000-06-29 20:44:47 +0000862
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000863
Trent Mick635f6fb2000-08-23 21:33:05 +0000864# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000865ac_save_cc="$CC"
866if test "$ac_cv_kpthread" = "yes"
867then CC="$CC -Kpthread"
868fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000869AC_MSG_CHECKING(for pthread_t)
870have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000871AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000872AC_MSG_RESULT($have_pthread_t)
873if test "$have_pthread_t" = yes ; then
874 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
875 AC_MSG_CHECKING(size of pthread_t)
876 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
877 [AC_TRY_RUN([#include <stdio.h>
878 #include <pthread.h>
879 main()
880 {
881 FILE *f=fopen("conftestval", "w");
882 if (!f) exit(1);
883 fprintf(f, "%d\n", sizeof(pthread_t));
884 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000885 }],
886 ac_cv_sizeof_pthread_t=`cat conftestval`,
887 ac_cv_sizeof_pthread_t=0,
888 ac_cv_sizeof_pthread_t=4)
Trent Mick635f6fb2000-08-23 21:33:05 +0000889 ])
890 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000891 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
892 [The number of bytes in a pthread_t.])
Trent Mick635f6fb2000-08-23 21:33:05 +0000893fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000894CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000895
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000896AC_MSG_CHECKING(for --enable-toolbox-glue)
897AC_ARG_ENABLE(toolbox-glue,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000898 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000899
900if test -z "$enable_toolbox_glue"
901then
902 case $ac_sys_system/$ac_sys_release in
903 Darwin/*)
904 enable_toolbox_glue="yes";;
905 *)
906 enable_toolbox_glue="no";;
907 esac
908fi
909case "$enable_toolbox_glue" in
910yes)
Jack Jansen666b1e72001-10-31 12:11:48 +0000911 extra_frameworks="-framework CoreServices -framework Foundation"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000912 extra_machdep_objs="Python/mactoolboxglue.o"
Jack Jansen591cbed2001-08-15 13:55:15 +0000913 extra_undefs="-u __dummy -u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000914 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
915 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000916 ;;
917*)
918 extra_frameworks=""
919 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +0000920 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000921 ;;
922esac
923AC_MSG_RESULT($enable_toolbox_glue)
924
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000925AC_SUBST(LIBTOOL_CRUFT)
926case $ac_sys_system/$ac_sys_release in
Jack Jansen418c3b12001-11-14 10:59:57 +0000927 Darwin/1.3*)
Jack Jansenea0c3822002-08-01 21:57:49 +0000928 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
Jack Jansen418c3b12001-11-14 10:59:57 +0000929 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
Jack Jansena3891ea2001-09-07 14:25:12 +0000930 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
931 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +0000932 Darwin/*)
Jack Jansenea0c3822002-08-01 21:57:49 +0000933 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
Jack Jansen418c3b12001-11-14 10:59:57 +0000934 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000935 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
936 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000937esac
938
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000939AC_MSG_CHECKING(for --enable-framework)
940if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000941then
Jack Jansenca06bc62001-08-03 15:32:23 +0000942 OPT="$OPT -fno-common -dynamic"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000943 # -F. is needed to allow linking to the framework while
944 # in the build location.
Jack Jansenea0c3822002-08-01 21:57:49 +0000945 LDFLAGS="$LDFLAGS -Wl,-F."
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000946 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
947 [Define if you want to produce an OpenStep/Rhapsody framework
948 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000949 AC_MSG_RESULT(yes)
950else
951 AC_MSG_RESULT(no)
952fi
953
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000954AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000955case $ac_sys_system/$ac_sys_release in
956 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000957 AC_DEFINE(WITH_DYLD, 1,
958 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
959 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
960 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000961 AC_MSG_RESULT(always on for Darwin)
962 ;;
963 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000964 AC_MSG_RESULT(no)
965 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000966esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000967
Guido van Rossumac405f61994-09-12 10:56:06 +0000968# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000969AC_SUBST(SO)
970AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000971AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000972AC_SUBST(CCSHARED)
973AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000974# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000975# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000976AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000977if test -z "$SO"
978then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000979 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000980 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000981 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000982 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000983 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000984fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000985AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000986# LDSHARED is the ld *command* used to create shared library
Martin v. Löwis5b718fc2001-09-10 15:34:42 +0000987# -- "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 +0000988# (Shared libraries in this instance are shared modules to be loaded into
989# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000990AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000991if test -z "$LDSHARED"
992then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000993 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000994 AIX*)
995 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
Guido van Rossumce608b02001-09-28 15:59:38 +0000996 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000997 ;;
998 BeOS*)
999 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +00001000 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001001 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001002 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +00001003 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001004 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +00001005 SunOS/5*)
1006 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +00001007 then LDSHARED='$(CC) -shared'
Martin v. Löwisaa5afe12002-10-07 06:21:41 +00001008 else LDSHARED='$(CC) -G';
Greg Ward57c9a6632000-05-26 12:22:54 +00001009 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +00001010 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +00001011 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +00001012 DYNIX/ptx*) LDSHARED="ld -G";;
Jack Jansen418c3b12001-11-14 10:59:57 +00001013 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +00001014 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1015 if test "$enable_framework" ; then
1016 # Link against the framework. All externals should be defined.
1017 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
1018 else
1019 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +00001020 LDSHARED="$LDSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +00001021 fi ;;
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001022 Darwin/*)
1023 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1024 if test "$enable_framework" ; then
1025 # Link against the framework. All externals should be defined.
1026 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
1027 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +00001028 # No framework, use the Python app as bundle-loader
1029 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1030 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001031 fi ;;
Martin v. Löwis3cba5c02002-09-16 17:50:59 +00001032 Linux*|GNU*) LDSHARED='$(CC) -shared';;
Guido van Rossum3c4bb801997-12-18 23:55:32 +00001033 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +00001034 BSD/OS*/4*) LDSHARED="gcc -shared";;
Martin v. Löwisd61888b2002-09-30 11:17:27 +00001035 OpenBSD*|FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +00001036 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +00001037 then
1038 LDSHARED="cc -shared ${LDFLAGS}"
1039 else
1040 LDSHARED="ld -Bshareable ${LDFLAGS}"
1041 fi;;
Martin v. Löwisd61888b2002-09-30 11:17:27 +00001042 NetBSD*) LDSHARED="cc -shared ${LDFLAGS}";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001043 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001044 if test "$GCC" = "yes"
Martin v. Löwis79f3c532002-12-11 12:51:58 +00001045 then LDSHARED='$(CC) -shared'
1046 else LDSHARED='$(CC) -G'
Martin v. Löwisbec19582001-03-21 15:57:54 +00001047 fi;;
Martin v. Löwis79f3c532002-12-11 12:51:58 +00001048 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
Trent Mick635f6fb2000-08-23 21:33:05 +00001049 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001050 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001051 atheos*) LDSHARED="gcc -shared";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001052 *) LDSHARED="ld";;
1053 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001054fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001055AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001056BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +00001057# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001058# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001059AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001060if test -z "$CCSHARED"
1061then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001062 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +00001063 SunOS*) if test "$GCC" = yes;
1064 then CCSHARED="-fPIC";
1065 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +00001066 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +00001067 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +00001068 else CCSHARED="+z";
1069 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001070 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001071 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis36546db2001-09-05 14:24:43 +00001072 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001073 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001074 if test "$GCC" = "yes"
1075 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001076 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +00001077 fi;;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001078 SCO_SV*)
1079 if test "$GCC" = "yes"
1080 then CCSHARED="-fPIC"
1081 else CCSHARED="-Kpic -belf"
1082 fi;;
Trent Mick635f6fb2000-08-23 21:33:05 +00001083 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001084 IRIX*/6*) case $CC in
1085 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +00001086 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001087 esac;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001088 atheos*) CCSHARED="-fPIC";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001089 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001090fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001091AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001092# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +00001093# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001094AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001095if test -z "$LINKFORSHARED"
1096then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001097 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001098 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +00001099 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +00001100 LINKFORSHARED="-Wl,-E -Wl,+s";;
1101# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001102 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001103 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001104 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001105 Darwin/*)
1106 # -u __dummy makes the linker aware of the objc runtime
1107 # in System.framework; otherwise, __objcInit (referenced in
1108 # crt1.o) gets erroneously defined as common, which breaks dynamic
1109 # loading of any modules which reference it in System.framework.
1110 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
1111 # not used by the core itself but which needs to be in the core so
1112 # that dynamically loaded extension modules have access to it.
Jack Jansen591cbed2001-08-15 13:55:15 +00001113 LINKFORSHARED="$extra_undefs -framework System"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001114 if test "$enable_framework"
1115 then
1116 LINKFORSHARED="$LINKFORSHARED -framework Python"
1117 fi
1118 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001119 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001120 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +00001121 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis36546db2001-09-05 14:24:43 +00001122 FreeBSD*|NetBSD*|OpenBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +00001123 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1124 then
1125 LINKFORSHARED="-Wl,--export-dynamic"
1126 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001127 SunOS/5*) case $CC in
1128 *gcc*)
Martin v. Löwisa4548572002-04-18 14:51:36 +00001129 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +00001130 then
1131 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001132 fi;;
1133 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +00001134 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001135fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001136AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001137
Neil Schemenauer61c51152001-01-26 16:18:16 +00001138AC_SUBST(CFLAGSFORSHARED)
1139AC_MSG_CHECKING(CFLAGSFORSHARED)
1140if test ! "$LIBRARY" = "$LDLIBRARY"
1141then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +00001142 case $ac_sys_system in
1143 CYGWIN*)
1144 # Cygwin needs CCSHARED when building extension DLLs
1145 # but not when building the interpreter DLL.
1146 CFLAGSFORSHARED='';;
1147 *)
1148 CFLAGSFORSHARED='$(CCSHARED)'
1149 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +00001150fi
1151AC_MSG_RESULT($CFLAGSFORSHARED)
1152
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001153# SHLIBS are libraries (except -lc and -lm) to link to the python shared
1154# library (with --enable-shared).
1155# For platforms on which shared libraries are not allowed to have unresolved
Martin v. Löwisd6359c52002-08-04 12:38:50 +00001156# symbols, this must be set to $(LIBS) (expanded by make). We do this even
1157# if it is not required, since it creates a dependency of the shared library
1158# to LIBS. This, in turn, means that applications linking the shared libpython
1159# don't need to link LIBS explicitly. The default should be only changed
1160# on systems where this approach causes problems.
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001161AC_SUBST(SHLIBS)
1162AC_MSG_CHECKING(SHLIBS)
1163case "$ac_sys_system" in
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001164 *)
Martin v. Löwisd6359c52002-08-04 12:38:50 +00001165 SHLIBS='$(LIBS)';;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001166esac
1167AC_MSG_RESULT($SHLIBS)
1168
1169
Guido van Rossum627b2d71993-12-24 10:39:16 +00001170# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001171AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1172AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Martin v. Löwis82c19a72002-10-06 11:48:09 +00001173AC_SEARCH_LIBS(sem_init, rt posix4) # 'Real Time' functions on Solaris,
1174 # posix4 on Solaris 2.6
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00001175
1176# checks for system dependent C++ extensions support
1177case "$ac_sys_system" in
1178 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1179 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1180 [loadAndInit("", 0, "")],
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001181 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1182 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1183 and you want support for AIX C++ shared extension modules.])
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00001184 AC_MSG_RESULT(yes)],
1185 [AC_MSG_RESULT(no)]);;
1186 *) ;;
1187esac
1188
Guido van Rossum70c7f481998-03-26 18:44:10 +00001189# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
Martin v. Löwise1172582002-11-13 08:51:19 +00001190# However on SGI IRIX 4, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001191# BeOS' sockets are stashed in libnet.
1192case "$ac_sys_system" in
1193IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +00001194*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001195AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001196AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00001197;;
1198esac
1199case "$ac_sys_system" in
1200BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001201AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1202;;
1203esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00001204
Guido van Rossumc5a39031996-07-31 17:35:03 +00001205AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001206AC_ARG_WITH(libs,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001207 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1208[
Guido van Rossumc5a39031996-07-31 17:35:03 +00001209AC_MSG_RESULT($withval)
1210LIBS="$withval $LIBS"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001211],
1212[AC_MSG_RESULT(no)])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001213
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001214# Determine if signalmodule should be used.
1215AC_SUBST(USE_SIGNAL_MODULE)
1216AC_SUBST(SIGNAL_OBJS)
1217AC_MSG_CHECKING(for --with-signal-module)
1218AC_ARG_WITH(signal-module,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001219 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001220
1221if test -z "$with_signal_module"
1222then with_signal_module="yes"
1223fi
1224AC_MSG_RESULT($with_signal_module)
1225
1226if test "${with_signal_module}" = "yes"; then
1227 USE_SIGNAL_MODULE=""
1228 SIGNAL_OBJS=""
1229else
1230 USE_SIGNAL_MODULE="#"
1231 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1232fi
1233
Guido van Rossum3d15bd82001-01-10 18:53:48 +00001234# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00001235AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001236USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00001237
Guido van Rossum54d93d41997-01-22 20:51:58 +00001238AC_MSG_CHECKING(for --with-dec-threads)
1239AC_SUBST(LDLAST)
1240AC_ARG_WITH(dec-threads,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001241 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
1242[
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001243AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00001244LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00001245if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00001246 with_thread="$withval";
1247fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001248[AC_MSG_RESULT(no)])
Guido van Rossum54d93d41997-01-22 20:51:58 +00001249
Martin v. Löwis11437992002-04-12 09:54:03 +00001250# Templates for things AC_DEFINEd more than once.
1251# For a single AC_DEFINE, no template is needed.
1252AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
1253AH_TEMPLATE(_REENTRANT,
1254 [Define to force use of thread-safe errno, h_errno, and other functions])
1255AH_TEMPLATE(WITH_THREAD,
1256 [Define if you want to compile in rudimentary thread support])
1257
Guido van Rossum54d93d41997-01-22 20:51:58 +00001258AC_MSG_CHECKING(for --with-threads)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001259dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001260AC_ARG_WITH(threads,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001261 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
Guido van Rossum54d93d41997-01-22 20:51:58 +00001262
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001263# --with-thread is deprecated, but check for it anyway
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001264dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00001265AC_ARG_WITH(thread,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001266 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
1267 [with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001268
1269if test -z "$with_threads"
1270then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001271fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001272AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00001273
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001274AC_SUBST(THREADOBJ)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001275if test "$with_threads" = "no"
1276then
1277 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001278elif test "$ac_cv_pthread_is_default" = yes
1279then
1280 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001281 # Defining _REENTRANT on system with POSIX threads should not hurt.
1282 AC_DEFINE(_REENTRANT)
1283 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001284 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001285elif test "$ac_cv_kpthread" = "yes"
1286then
1287 CC="$CC -Kpthread"
1288 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001289 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001290 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001291else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001292 if test ! -z "$with_threads" -a -d "$with_threads"
1293 then LDFLAGS="$LDFLAGS -L$with_threads"
1294 fi
1295 if test ! -z "$withval" -a -d "$withval"
1296 then LDFLAGS="$LDFLAGS -L$withval"
1297 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001298
1299 # According to the POSIX spec, a pthreads implementation must
1300 # define _POSIX_THREADS in unistd.h. Some apparently don't (which ones?)
1301 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1302 AC_EGREP_CPP(yes,
1303 [#include <unistd.h>
1304 #ifdef _POSIX_THREADS
1305 yes
1306 #endif
1307 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1308 AC_MSG_RESULT($unistd_defines_pthreads)
1309
Martin v. Löwis130fb172001-07-19 11:00:41 +00001310 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001311 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1312 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001313 AC_DEFINE(HURD_C_THREADS, 1,
1314 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001315 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001316 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001317 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1318 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001319 AC_DEFINE(MACH_C_THREADS, 1,
1320 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001321 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001322 AC_MSG_CHECKING(for --with-pth)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001323 AC_ARG_WITH([pth],
1324 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
1325 [AC_MSG_RESULT($withval)
1326 AC_DEFINE([WITH_THREAD])
1327 AC_DEFINE([HAVE_PTH], 1,
1328 [Define if you have GNU PTH threads.])
1329 LIBS="-lpth $LIBS"
1330 THREADOBJ="Python/thread.o"],
1331 [AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00001332
1333 # Just looking for pthread_create in libpthread is not enough:
1334 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1335 # So we really have to include pthread.h, and then link.
1336 _libs=$LIBS
1337 LIBS="$LIBS -lpthread"
1338 AC_MSG_CHECKING([for pthread_create in -lpthread])
1339 AC_TRY_LINK([#include <pthread.h>
1340
1341void * start_routine (void *arg) { exit (0); }], [
1342pthread_create (NULL, NULL, start_routine, NULL)], [
1343 AC_MSG_RESULT(yes)
1344 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001345 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001346 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00001347 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00001348 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001349 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001350 THREADOBJ="Python/thread.o"],[
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001351 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
1352 AC_DEFINE(ATHEOS_THREADS, 1,
1353 [Define this if you have AtheOS threads.])
1354 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001355 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001356 AC_DEFINE(BEOS_THREADS, 1,
1357 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001358 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001359 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001360 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001361 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001362 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001363 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001364 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001365 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001366 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001367 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis779ffc02002-12-02 22:17:01 +00001368 echo Systems with __d6_pthread_create are not supported anymore.
1369 echo See README
1370 exit 1
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001371 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001372 LIBS="$LIBS -lthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001373 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001374 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001375 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001376 LIBS="$LIBS -lpthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001377 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001378 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001379 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001380 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001381 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001382 USE_THREAD_MODULE="#"])
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001383 ])])])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001384
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001385 if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001386 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001387 AC_DEFINE(_POSIX_THREADS, 1,
1388 [Define if you have POSIX threads,
1389 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001390 fi
1391
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001392 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1393 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1394 [AC_TRY_RUN([#include <pthread.h>
1395 void *foo(void *parm) {
1396 return NULL;
1397 }
1398 main() {
1399 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00001400 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001401 if (pthread_attr_init(&attr)) exit(-1);
1402 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00001403 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001404 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00001405 }],
1406 ac_cv_pthread_system_supported=yes,
1407 ac_cv_pthread_system_supported=no,
1408 ac_cv_pthread_system_supported=no)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001409 ])
1410 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1411 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001412 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001413 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001414 AC_CHECK_FUNCS(pthread_sigmask)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001415 fi
1416
Martin v. Löwis130fb172001-07-19 11:00:41 +00001417 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1418 LIBS="$LIBS -lmpc"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001419 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001420 USE_THREAD_MODULE=""])
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001421
Neal Norwitza978ab02002-11-02 16:58:05 +00001422 if test "$posix_threads" != "yes"; then
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001423 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1424 LIBS="$LIBS -lthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001425 THREADOBJ="Python/thread.o"
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001426 USE_THREAD_MODULE=""])
1427 fi
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001428
Martin v. Löwis130fb172001-07-19 11:00:41 +00001429 if test "$USE_THREAD_MODULE" != "#"
1430 then
1431 # If the above checks didn't disable threads, (at least) OSF1
1432 # needs this '-threads' argument during linking.
1433 case $ac_sys_system in
1434 OSF1) LDLAST=-threads;;
1435 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001436 fi
Martin v. Löwisa7a76d32002-10-04 07:21:24 +00001437
1438 if test "$posix_threads" = yes -a \
1439 "$ac_sys_system" = "SunOS" -a \
1440 "$ac_sys_release" = "5.6"; then
1441 AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
1442 [Defined for Solaris 2.6 bug in pthread header.])
1443 fi
1444
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001445fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001446
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001447# Check for enable-ipv6
Martin v. Löwis11437992002-04-12 09:54:03 +00001448AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001449AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001450AC_ARG_ENABLE(ipv6,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001451[ --enable-ipv6 Enable ipv6 (with ipv4) support
1452 --disable-ipv6 Disable ipv6 support],
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001453[ case "$enableval" in
1454 no)
1455 AC_MSG_RESULT(no)
1456 ipv6=no
1457 ;;
1458 *) AC_MSG_RESULT(yes)
1459 AC_DEFINE(ENABLE_IPV6)
1460 ipv6=yes
1461 ;;
1462 esac ],
1463
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001464[
1465dnl the check does not work on cross compilation case...
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001466 AC_TRY_RUN([ /* AF_INET6 available check */
1467#include <sys/types.h>
1468#include <sys/socket.h>
1469main()
1470{
1471 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1472 exit(1);
1473 else
1474 exit(0);
1475}
1476],
1477 AC_MSG_RESULT(yes)
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001478 ipv6=yes,
1479 AC_MSG_RESULT(no)
1480 ipv6=no,
1481 AC_MSG_RESULT(no)
1482 ipv6=no
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001483)
1484
1485if test "$ipv6" = "yes"; then
1486 AC_MSG_CHECKING(if RFC2553 API is available)
1487 AC_TRY_COMPILE([#include <sys/types.h>
1488#include <netinet/in.h>],
1489 [struct sockaddr_in6 x;
1490x.sin6_scope_id;],
1491 AC_MSG_RESULT(yes)
1492 ipv6=yes,
1493 AC_MSG_RESULT(no, IPv6 disabled)
1494 ipv6=no)
1495fi
1496
1497if test "$ipv6" = "yes"; then
1498 AC_DEFINE(ENABLE_IPV6)
1499fi
1500])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001501
1502ipv6type=unknown
1503ipv6lib=none
1504ipv6trylibc=no
1505
1506if test "$ipv6" = "yes"; then
1507 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00001508 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1509 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001510 case $i in
1511 inria)
1512 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001513 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001514#include <netinet/in.h>
1515#ifdef IPV6_INRIA_VERSION
1516yes
1517#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001518 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001519 ;;
1520 kame)
1521 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001522 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001523#include <netinet/in.h>
1524#ifdef __KAME__
1525yes
1526#endif],
1527 [ipv6type=$i;
1528 ipv6lib=inet6
1529 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001530 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001531 ;;
1532 linux-glibc)
1533 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001534 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001535#include <features.h>
1536#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1537yes
1538#endif],
1539 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001540 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001541 ;;
1542 linux-inet6)
1543 dnl http://www.v6.linux.or.jp/
1544 if test -d /usr/inet6; then
1545 ipv6type=$i
1546 ipv6lib=inet6
1547 ipv6libdir=/usr/inet6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001548 OPT="-I/usr/inet6/include $OPT"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001549 fi
1550 ;;
1551 solaris)
1552 if test -f /etc/netconfig; then
1553 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1554 ipv6type=$i
1555 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001556 fi
1557 fi
1558 ;;
1559 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001560 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001561#include <sys/param.h>
1562#ifdef _TOSHIBA_INET6
1563yes
1564#endif],
1565 [ipv6type=$i;
1566 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001567 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001568 ;;
1569 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001570 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001571#include </usr/local/v6/include/sys/v6config.h>
1572#ifdef __V6D__
1573yes
1574#endif],
1575 [ipv6type=$i;
1576 ipv6lib=v6;
1577 ipv6libdir=/usr/local/v6/lib;
1578 OPT="-I/usr/local/v6/include $OPT"])
1579 ;;
1580 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001581 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001582#include <sys/param.h>
1583#ifdef _ZETA_MINAMI_INET6
1584yes
1585#endif],
1586 [ipv6type=$i;
1587 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001588 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001589 ;;
1590 esac
1591 if test "$ipv6type" != "unknown"; then
1592 break
1593 fi
1594 done
1595 AC_MSG_RESULT($ipv6type)
1596fi
1597
1598if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1599 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1600 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1601 echo "using lib$ipv6lib"
1602 else
1603 if test $ipv6trylibc = "yes"; then
1604 echo "using libc"
1605 else
1606 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1607 echo "You need to fetch lib$ipv6lib.a from appropriate"
1608 echo 'ipv6 kit and compile beforehand.'
1609 exit 1
1610 fi
1611 fi
1612fi
1613
Jack Jansen7b8c7542002-04-14 20:12:41 +00001614# Check for universal newline support
Guido van Rossum402905e2002-08-15 13:56:35 +00001615AC_MSG_CHECKING(for --with-universal-newlines)
Jack Jansen7b8c7542002-04-14 20:12:41 +00001616AC_ARG_WITH(universal-newlines,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001617 AC_HELP_STRING(--with(out)-universal-newlines, disable/enable foreign newlines))
Jack Jansen7b8c7542002-04-14 20:12:41 +00001618
1619if test -z "$with_universal_newlines"
1620then with_universal_newlines="yes"
1621fi
Martin v. Löwis7e4cfcb2002-12-19 16:21:49 +00001622if test "$with_universal_newlines" = "no"
Martin v. Löwis03d00d52002-12-19 19:03:31 +00001623then
Martin v. Löwis7e4cfcb2002-12-19 16:21:49 +00001624 echo --without-universal-newlines is unsupported, see README
1625 exit 1
Martin v. Löwis03d00d52002-12-19 19:03:31 +00001626else
Martin v. Löwise8aea582002-04-16 05:51:02 +00001627 AC_DEFINE(WITH_UNIVERSAL_NEWLINES, 1,
1628 [Define if you want to read files with foreign newlines.])
Jack Jansen7b8c7542002-04-14 20:12:41 +00001629fi
1630AC_MSG_RESULT($with_universal_newlines)
1631
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00001632# Check for --with-doc-strings
1633AC_MSG_CHECKING(for --with-doc-strings)
1634AC_ARG_WITH(doc-strings,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001635 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00001636
1637if test -z "$with_doc_strings"
1638then with_doc_strings="yes"
1639fi
1640if test "$with_doc_strings" != "no"
1641then
1642 AC_DEFINE(WITH_DOC_STRINGS, 1,
1643 [Define if you want documentation strings in extension modules])
1644fi
1645AC_MSG_RESULT($with_doc_strings)
1646
Neil Schemenauera35c6882001-02-27 04:45:05 +00001647# Check for Python-specific malloc support
1648AC_MSG_CHECKING(for --with-pymalloc)
1649AC_ARG_WITH(pymalloc,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001650 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
Neil Schemenauer16c22972002-03-22 15:34:49 +00001651
1652if test -z "$with_pymalloc"
1653then with_pymalloc="yes"
1654fi
1655if test "$with_pymalloc" != "no"
1656then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001657 AC_DEFINE(WITH_PYMALLOC, 1,
1658 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00001659fi
1660AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00001661
Barry Warsawef82cd72000-06-30 16:21:01 +00001662# Check for --with-wctype-functions
1663AC_MSG_CHECKING(for --with-wctype-functions)
1664AC_ARG_WITH(wctype-functions,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001665 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
1666[
Barry Warsawef82cd72000-06-30 16:21:01 +00001667if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001668then
1669 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
1670 [Define if you want wctype.h functions to be used instead of the
1671 one supplied by Python itself. (see Include/unicodectype.h).])
1672 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00001673else AC_MSG_RESULT(no)
1674fi],
1675[AC_MSG_RESULT(no)])
1676
Guido van Rossum68242b51996-05-28 22:53:03 +00001677# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001678AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00001679DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001680
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001681AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001682AC_ARG_WITH(sgi-dl,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001683 AC_HELP_STRING(--with-sgi-dl=DIRECTORY, IRIX 4 dynamic linking),
1684[
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001685AC_MSG_RESULT($withval)
Martin v. Löwis9ef33762002-12-02 22:23:56 +00001686echo --with-sgi-dl is unsupported, see README
Martin v. Löwis779ffc02002-12-02 22:17:01 +00001687exit 1
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001688AC_DEFINE(WITH_SGI_DL, 1,
1689 [Define if you want to use SGI (IRIX 4) dynamic linking.
1690 This requires the "dl" library by Jack Jansen,
1691 ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
1692 Do not bother on IRIX 5, it already has dynamic linking using SunOS
1693 style shared libraries])
Guido van Rossume97ee181999-12-20 21:27:22 +00001694DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001695dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001696if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001697then LDFLAGS="$LDFLAGS -L$dldir"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001698else AC_MSG_ERROR([proper usage is --with-sgi-dl=DIRECTORY])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001699fi
1700DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001701LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001702
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001703AC_MSG_CHECKING(for --with-dl-dld)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001704AC_ARG_WITH(dl-dld,
1705 AC_HELP_STRING(--with-dl-dld=DL_DIR, GNU dynamic linking),
1706[
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001707AC_MSG_RESULT($withval)
Martin v. Löwis9ef33762002-12-02 22:23:56 +00001708echo --with-dl-dld is unsupported, see README
Martin v. Löwis779ffc02002-12-02 22:17:01 +00001709exit 1
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001710AC_DEFINE(WITH_DL_DLD, 1,
1711 [Define if you want to emulate SGI (IRIX 4) dynamic linking.
1712 This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4),
1713 Sequent Symmetry (Dynix), and Atari ST.
1714 This requires the 'dl-dld' library,
1715 ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z,
1716 as well as the 'GNU dld' library,
1717 ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z.
1718 Do not bother on SunOS 4 or 5, they already have dynamic linking using
1719 shared libraries.])
Guido van Rossume97ee181999-12-20 21:27:22 +00001720DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001721dldir=`echo "$withval" | sed 's/,.*//'`
1722dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001723if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001724then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001725else AC_MSG_ERROR([proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001726fi
1727DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001728LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001729
Guido van Rossume97ee181999-12-20 21:27:22 +00001730# the dlopen() function means we might want to use dynload_shlib.o. some
1731# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001732AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001733
1734# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1735# loading of modules.
1736AC_SUBST(DYNLOADFILE)
1737AC_MSG_CHECKING(DYNLOADFILE)
1738if test -z "$DYNLOADFILE"
1739then
1740 case $ac_sys_system/$ac_sys_release in
1741 AIX*) DYNLOADFILE="dynload_aix.o";;
1742 BeOS*) DYNLOADFILE="dynload_beos.o";;
1743 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001744 Darwin/*) DYNLOADFILE="dynload_next.o";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001745 atheos*) DYNLOADFILE="dynload_atheos.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001746 *)
1747 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1748 # out any dynamic loading
1749 if test "$ac_cv_func_dlopen" = yes
1750 then DYNLOADFILE="dynload_shlib.o"
1751 else DYNLOADFILE="dynload_stub.o"
1752 fi
1753 ;;
1754 esac
1755fi
1756AC_MSG_RESULT($DYNLOADFILE)
1757if test "$DYNLOADFILE" != "dynload_stub.o"
1758then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001759 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
1760 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00001761fi
1762
Jack Jansenc49e5b72001-06-19 15:00:23 +00001763# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1764
1765AC_SUBST(MACHDEP_OBJS)
1766AC_MSG_CHECKING(MACHDEP_OBJS)
1767if test -z "$MACHDEP_OBJS"
1768then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001769 MACHDEP_OBJS=$extra_machdep_objs
1770else
1771 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00001772fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001773AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00001774
Guido van Rossum627b2d71993-12-24 10:39:16 +00001775# checks for library functions
Martin v. Löwisd5843682002-11-21 20:41:28 +00001776AC_CHECK_FUNCS(alarm chown clock confstr ctermid execv \
Fred Drake6b3cc522002-04-15 19:20:27 +00001777 fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \
Martin v. Löwis438b5342002-12-27 10:16:42 +00001778 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
1779 getpriority getpwent getwd \
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00001780 hstrerror inet_pton kill killpg lchown lstat mkfifo mknod mktime \
Martin v. Löwisa5f09072002-10-11 05:37:59 +00001781 mremap nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001782 putenv readlink \
Martin v. Löwisd5843682002-11-21 20:41:28 +00001783 select setegid seteuid setgid \
Martin v. Löwis791bfda2001-07-24 06:33:08 +00001784 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00001785 sigaction siginterrupt sigrelse strftime strptime \
Michael W. Hudson34f20ea2002-05-27 15:08:24 +00001786 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Martin v. Löwis438b5342002-12-27 10:16:42 +00001787 truncate uname unsetenv utimes waitpid wcscoll _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001788
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00001789# For some functions, having a definition is not sufficient, since
1790# we want to take their address.
1791AC_MSG_CHECKING(for chroot)
1792AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
1793 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
1794 AC_MSG_RESULT(yes),
1795 AC_MSG_RESULT(no)
1796)
1797AC_MSG_CHECKING(for link)
1798AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
1799 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
1800 AC_MSG_RESULT(yes),
1801 AC_MSG_RESULT(no)
1802)
1803AC_MSG_CHECKING(for symlink)
1804AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
1805 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
1806 AC_MSG_RESULT(yes),
1807 AC_MSG_RESULT(no)
1808)
1809
Martin v. Löwisd5843682002-11-21 20:41:28 +00001810# On some systems (eg. FreeBSD 5), we would find a definition of the
1811# functions ctermid_r, setgroups in the library, but no prototype
1812# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
1813# address to avoid compiler warnings and potential miscompilations
1814# because of the missing prototypes.
1815
1816AC_MSG_CHECKING(for ctermid_r)
1817AC_TRY_COMPILE([
1818#include "confdefs.h"
1819#include <stdio.h>
1820], void* p = ctermid_r,
1821 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
1822 AC_MSG_RESULT(yes),
1823 AC_MSG_RESULT(no)
1824)
1825
1826AC_MSG_CHECKING(for setgroups)
1827AC_TRY_COMPILE([
1828#include "confdefs.h"
1829#include <unistd.h.h>
1830],
1831void* p = setgroups,
1832 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
1833 AC_MSG_RESULT(yes),
1834 AC_MSG_RESULT(no)
1835)
1836
Fred Drake8cef4cf2000-06-28 16:40:38 +00001837# check for openpty and forkpty
1838
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001839AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"]))
1840AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"]))
Fred Drake8cef4cf2000-06-28 16:40:38 +00001841
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001842# check for long file support functions
1843AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1844
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001845AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001846AC_CHECK_FUNCS(getpgrp,
1847 AC_TRY_COMPILE([#include <unistd.h>],
1848 [getpgrp(0);],
1849 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
1850 [Define if getpgrp() must be called as getpgrp(0).])
1851 )
1852)
Jeremy Hyltonaf4c12f2002-07-18 20:25:46 +00001853AC_FUNC_SETPGRP(AC_DEFINE(SETPGRP_HAVE_ARG, 1,
1854 [Define if setpgrp() must be called as setpgrp(0, 0).])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001855)
1856AC_CHECK_FUNCS(gettimeofday,
1857 AC_TRY_COMPILE([#include <sys/time.h>],
1858 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
1859 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
1860 [Define if gettimeofday() does not have second (timezone) argument
1861 This is the case on Motorola V4 (R40V4.2)])
1862 )
1863)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001864
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00001865AC_MSG_CHECKING(for major, minor, and makedev)
Martin v. Löwise3271202002-11-07 07:42:30 +00001866AC_TRY_LINK([
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00001867 #if defined(MAJOR_IN_MKDEV)
1868 #include <sys/mkdev.h>
1869 #elif defined(MAJOR_IN_SYSMACROS)
1870 #include <sys/sysmacros.h>
1871 #else
1872 #include <sys/types.h>
1873 #endif
1874],[
1875 makedev(major(0),minor(0));
1876],[
1877 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
1878 [Define to 1 if you have the device macros.])
1879 AC_MSG_RESULT(yes)
1880],[
1881 AC_MSG_RESULT(no)
1882])
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001883
1884# On OSF/1 V5.1, getaddrinfo is available, but a define
1885# for [no]getaddrinfo in netdb.h.
1886AC_MSG_CHECKING(for getaddrinfo)
1887AC_TRY_LINK([
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00001888#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001889#include <sys/socket.h>
1890#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00001891#include <stdio.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001892],[
1893getaddrinfo(NULL, NULL, NULL, NULL);
1894], [
1895AC_MSG_RESULT(yes)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001896AC_MSG_CHECKING(getaddrinfo bug)
1897AC_TRY_RUN([
1898#include <sys/types.h>
1899#include <netdb.h>
1900#include <string.h>
1901#include <sys/socket.h>
1902#include <netinet/in.h>
1903
1904main()
1905{
1906 int passive, gaierr, inet4 = 0, inet6 = 0;
1907 struct addrinfo hints, *ai, *aitop;
1908 char straddr[INET6_ADDRSTRLEN], strport[16];
1909
1910 for (passive = 0; passive <= 1; passive++) {
1911 memset(&hints, 0, sizeof(hints));
1912 hints.ai_family = AF_UNSPEC;
1913 hints.ai_flags = passive ? AI_PASSIVE : 0;
1914 hints.ai_socktype = SOCK_STREAM;
1915 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1916 (void)gai_strerror(gaierr);
1917 goto bad;
1918 }
1919 for (ai = aitop; ai; ai = ai->ai_next) {
1920 if (ai->ai_addr == NULL ||
1921 ai->ai_addrlen == 0 ||
1922 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1923 straddr, sizeof(straddr), strport, sizeof(strport),
1924 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1925 goto bad;
1926 }
1927 switch (ai->ai_family) {
1928 case AF_INET:
1929 if (strcmp(strport, "54321") != 0) {
1930 goto bad;
1931 }
1932 if (passive) {
1933 if (strcmp(straddr, "0.0.0.0") != 0) {
1934 goto bad;
1935 }
1936 } else {
1937 if (strcmp(straddr, "127.0.0.1") != 0) {
1938 goto bad;
1939 }
1940 }
1941 inet4++;
1942 break;
1943 case AF_INET6:
1944 if (strcmp(strport, "54321") != 0) {
1945 goto bad;
1946 }
1947 if (passive) {
1948 if (strcmp(straddr, "::") != 0) {
1949 goto bad;
1950 }
1951 } else {
1952 if (strcmp(straddr, "::1") != 0) {
1953 goto bad;
1954 }
1955 }
1956 inet6++;
1957 break;
1958 case AF_UNSPEC:
1959 goto bad;
1960 break;
1961 default:
1962 /* another family support? */
1963 break;
1964 }
1965 }
1966 }
1967
1968 if (!(inet4 == 0 || inet4 == 2))
1969 goto bad;
1970 if (!(inet6 == 0 || inet6 == 2))
1971 goto bad;
1972
1973 if (aitop)
1974 freeaddrinfo(aitop);
1975 exit(0);
1976
1977 bad:
1978 if (aitop)
1979 freeaddrinfo(aitop);
1980 exit(1);
1981}
1982],
1983AC_MSG_RESULT(good)
1984buggygetaddrinfo=no,
1985AC_MSG_RESULT(buggy)
1986buggygetaddrinfo=yes,
1987AC_MSG_RESULT(buggy)
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001988buggygetaddrinfo=yes)], [
1989AC_MSG_RESULT(no)
1990buggygetaddrinfo=yes
1991])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001992
1993if test "$buggygetaddrinfo" = "yes"; then
1994 if test "$ipv6" = "yes"; then
1995 echo 'Fatal: You must get working getaddrinfo() function.'
1996 echo ' or you can specify "--disable-ipv6"'.
1997 exit 1
1998 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001999else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002000 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002001fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00002002AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002003
Guido van Rossum627b2d71993-12-24 10:39:16 +00002004# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002005AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00002006AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002007AC_STRUCT_TIMEZONE
Martin v. Löwis60a5d722002-10-16 20:28:25 +00002008AC_CHECK_MEMBERS([struct stat.st_rdev])
2009AC_CHECK_MEMBERS([struct stat.st_blksize])
Guido van Rossum98bf58f2001-10-18 20:34:25 +00002010AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002011
2012AC_MSG_CHECKING(for time.h that defines altzone)
2013AC_CACHE_VAL(ac_cv_header_time_altzone,
2014[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2015 ac_cv_header_time_altzone=yes,
2016 ac_cv_header_time_altzone=no)])
2017AC_MSG_RESULT($ac_cv_header_time_altzone)
2018if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002019 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002020fi
2021
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002022was_it_defined=no
2023AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002024AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002025#include <sys/types.h>
2026#include <sys/select.h>
2027#include <sys/time.h>
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002028], [;], [
2029 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
2030 [Define if you can safely include both <sys/select.h> and <sys/time.h>
2031 (which you can't on SCO ODT 3.0).])
2032 was_it_defined=yes
2033])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002034AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00002035
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002036AC_MSG_CHECKING(for addrinfo)
2037AC_CACHE_VAL(ac_cv_struct_addrinfo,
2038AC_TRY_COMPILE([
2039# include <netdb.h>],
2040 [struct addrinfo a],
2041 ac_cv_struct_addrinfo=yes,
2042 ac_cv_struct_addrinfo=no))
2043AC_MSG_RESULT($ac_cv_struct_addrinfo)
2044if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002045 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002046fi
2047
2048AC_MSG_CHECKING(for sockaddr_storage)
2049AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
2050AC_TRY_COMPILE([
2051# include <sys/types.h>
2052# include <sys/socket.h>],
2053 [struct sockaddr_storage s],
2054 ac_cv_struct_sockaddr_storage=yes,
2055 ac_cv_struct_sockaddr_storage=no))
2056AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
2057if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002058 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002059fi
2060
Guido van Rossum627b2d71993-12-24 10:39:16 +00002061# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002062
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002063AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002064AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002065
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002066works=no
2067AC_MSG_CHECKING(for working volatile)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002068AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
2069 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
2070)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002071AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00002072
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002073works=no
2074AC_MSG_CHECKING(for working signed char)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002075AC_TRY_COMPILE([], [signed char c;], works=yes,
2076 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
2077)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002078AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002079
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002080have_prototypes=no
2081AC_MSG_CHECKING(for prototypes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002082AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
2083 AC_DEFINE(HAVE_PROTOTYPES, 1,
2084 [Define if your compiler supports function prototype])
2085 have_prototypes=yes
2086])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002087AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002088
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002089works=no
2090AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002091AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002092#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00002093int foo(int x, ...) {
2094 va_list va;
2095 va_start(va, x);
2096 va_arg(va, int);
2097 va_arg(va, char *);
2098 va_arg(va, double);
2099 return 0;
2100}
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002101], [return foo(10, "", 3.14);], [
2102 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
2103 [Define if your compiler supports variable length function prototypes
2104 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
2105 works=yes
2106])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002107AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002108
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002109if test "$have_prototypes" = yes; then
2110bad_prototypes=no
2111AC_MSG_CHECKING(for bad exec* prototypes)
2112AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002113 AC_DEFINE(BAD_EXEC_PROTOTYPES, 1,
2114 [Define if your <unistd.h> contains bad prototypes for exec*()
2115 (as it does on SGI IRIX 4.x)])
2116 bad_prototypes=yes
2117)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002118AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00002119fi
2120
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002121# check if sockaddr has sa_len member
2122AC_MSG_CHECKING(if sockaddr has sa_len member)
2123AC_TRY_COMPILE([#include <sys/types.h>
2124#include <sys/socket.h>],
2125[struct sockaddr x;
2126x.sa_len = 0;],
2127 AC_MSG_RESULT(yes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002128 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002129 AC_MSG_RESULT(no))
2130
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002131va_list_is_array=no
2132AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002133AC_TRY_COMPILE([
2134#ifdef HAVE_STDARG_PROTOTYPES
2135#include <stdarg.h>
2136#else
2137#include <varargs.h>
2138#endif
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002139], [va_list list1, list2; list1 = list2;], , [
2140 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
2141 va_list_is_array=yes
2142])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002143AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002144
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002145# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
Martin v. Löwis11437992002-04-12 09:54:03 +00002146AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
2147 [Define this if you have some version of gethostbyname_r()])
2148
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002149AC_CHECK_FUNC(gethostbyname_r, [
2150 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2151 AC_MSG_CHECKING([gethostbyname_r with 6 args])
2152 OLD_CFLAGS=$CFLAGS
2153 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
2154 AC_TRY_COMPILE([
2155# include <netdb.h>
2156 ], [
2157 char *name;
2158 struct hostent *he, *res;
2159 char buffer[2048];
2160 int buflen = 2048;
2161 int h_errnop;
2162
2163 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
2164 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00002165 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002166 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
2167 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002168 AC_MSG_RESULT(yes)
2169 ], [
2170 AC_MSG_RESULT(no)
2171 AC_MSG_CHECKING([gethostbyname_r with 5 args])
2172 AC_TRY_COMPILE([
2173# include <netdb.h>
2174 ], [
2175 char *name;
2176 struct hostent *he;
2177 char buffer[2048];
2178 int buflen = 2048;
2179 int h_errnop;
2180
2181 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
2182 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00002183 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002184 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
2185 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002186 AC_MSG_RESULT(yes)
2187 ], [
2188 AC_MSG_RESULT(no)
2189 AC_MSG_CHECKING([gethostbyname_r with 3 args])
2190 AC_TRY_COMPILE([
2191# include <netdb.h>
2192 ], [
2193 char *name;
2194 struct hostent *he;
2195 struct hostent_data data;
2196
2197 (void) gethostbyname_r(name, he, &data);
2198 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00002199 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002200 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
2201 [Define this if you have the 3-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002202 AC_MSG_RESULT(yes)
2203 ], [
2204 AC_MSG_RESULT(no)
2205 ])
2206 ])
2207 ])
2208 CFLAGS=$OLD_CFLAGS
2209], [
Thomas Wouters3a584202000-08-05 23:28:51 +00002210 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002211])
2212AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
2213AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
2214AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00002215AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002216AC_SUBST(HAVE_GETHOSTBYNAME)
2217
Guido van Rossum627b2d71993-12-24 10:39:16 +00002218# checks for system services
2219# (none yet)
2220
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002221# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00002222AC_CHECK_FUNC(__fpu_control,
2223 [],
2224 [AC_CHECK_LIB(ieee, __fpu_control)
2225])
Guido van Rossum627b2d71993-12-24 10:39:16 +00002226
Guido van Rossum93274221997-05-09 02:42:00 +00002227# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00002228AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002229AC_ARG_WITH(fpectl,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002230 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
2231[
Guido van Rossum93274221997-05-09 02:42:00 +00002232if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002233then
2234 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
2235 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
2236 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00002237else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00002238fi],
2239[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00002240
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002241# check for --with-libm=...
2242AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00002243case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00002244Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002245BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00002246*) LIBM=-lm
2247esac
Guido van Rossum93274221997-05-09 02:42:00 +00002248AC_MSG_CHECKING(for --with-libm=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002249AC_ARG_WITH(libm,
2250 AC_HELP_STRING(--with-libm=STRING, math library),
2251[
Guido van Rossum93274221997-05-09 02:42:00 +00002252if test "$withval" = no
2253then LIBM=
2254 AC_MSG_RESULT(force LIBM empty)
2255elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002256then LIBM=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002257 AC_MSG_RESULT(set LIBM="$withval")
2258else AC_MSG_ERROR([proper usage is --with-libm=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00002259fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002260[AC_MSG_RESULT(default LIBM="$LIBM")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002261
2262# check for --with-libc=...
2263AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00002264AC_MSG_CHECKING(for --with-libc=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002265AC_ARG_WITH(libc,
2266 AC_HELP_STRING(--with-libc=STRING, C library),
2267[
Guido van Rossum93274221997-05-09 02:42:00 +00002268if test "$withval" = no
2269then LIBC=
2270 AC_MSG_RESULT(force LIBC empty)
2271elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002272then LIBC=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002273 AC_MSG_RESULT(set LIBC="$withval")
2274else AC_MSG_ERROR([proper usage is --with-libc=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00002275fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002276[AC_MSG_RESULT(default LIBC="$LIBC")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002277
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00002278# check for hypot() in math library
2279LIBS_SAVE=$LIBS
2280LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00002281AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00002282LIBS=$LIBS_SAVE
2283
Guido van Rossumef2255b2000-03-10 22:30:29 +00002284# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002285AC_CHECK_HEADER(wchar.h, [
2286 AC_DEFINE(HAVE_WCHAR_H, 1,
2287 [Define if the compiler provides a wchar.h header file.])
2288 wchar_h="yes"
2289],
Guido van Rossumef2255b2000-03-10 22:30:29 +00002290wchar_h="no"
2291)
2292
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002293# determine wchar_t size
2294if test "$wchar_h" = yes
2295then
Guido van Rossum67b26592001-10-20 14:21:45 +00002296 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002297fi
2298
2299AC_MSG_CHECKING(what type to use for unicode)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002300dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002301AC_ARG_ENABLE(unicode,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002302 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
2303 [],
2304 [enable_unicode=yes])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002305
2306if test $enable_unicode = yes
2307then
Martin v. Löwisfd917792001-06-27 20:22:04 +00002308 # Without any arguments, Py_UNICODE defaults to two-byte mode
2309 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002310fi
2311
Martin v. Löwis0036cba2002-04-12 09:58:45 +00002312AH_TEMPLATE(Py_UNICODE_SIZE,
2313 [Define as the size of the unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002314case "$enable_unicode" in
2315ucs2) unicode_size="2"
2316 AC_DEFINE(Py_UNICODE_SIZE,2)
2317 ;;
2318ucs4) unicode_size="4"
2319 AC_DEFINE(Py_UNICODE_SIZE,4)
2320 ;;
2321esac
2322
Martin v. Löwis11437992002-04-12 09:54:03 +00002323AH_TEMPLATE(PY_UNICODE_TYPE,
2324 [Define as the integral type used for Unicode representation.])
Martin v. Löwis0036cba2002-04-12 09:58:45 +00002325
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002326AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002327if test "$enable_unicode" = "no"
2328then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002329 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002330 AC_MSG_RESULT(not used)
2331else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002332 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002333 AC_DEFINE(Py_USING_UNICODE, 1,
2334 [Define if you want to have a Unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002335 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
2336 then
2337 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002338 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
2339 [Define if you have a useable wchar_t type defined in wchar.h; useable
2340 means wchar_t must be 16-bit unsigned type. (see
2341 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002342 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
2343 elif test "$ac_cv_sizeof_short" = "$unicode_size"
2344 then
2345 PY_UNICODE_TYPE="unsigned short"
2346 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
2347 elif test "$ac_cv_sizeof_long" = "$unicode_size"
2348 then
2349 PY_UNICODE_TYPE="unsigned long"
2350 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
2351 else
2352 PY_UNICODE_TYPE="no type found"
2353 fi
2354 AC_MSG_RESULT($PY_UNICODE_TYPE)
2355fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00002356
2357# check for endianness
2358AC_C_BIGENDIAN
2359
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002360# Check whether right shifting a negative integer extends the sign bit
2361# or fills with zeros (like the Cray J90, according to Tim Peters).
2362AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00002363AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002364AC_TRY_RUN([
2365int main()
2366{
Vladimir Marangozova6180282000-07-12 05:05:06 +00002367 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002368}
Guido van Rossum3065c942001-09-17 04:03:14 +00002369],
2370ac_cv_rshift_extends_sign=yes,
2371ac_cv_rshift_extends_sign=no,
2372ac_cv_rshift_extends_sign=yes)])
Vladimir Marangozova6180282000-07-12 05:05:06 +00002373AC_MSG_RESULT($ac_cv_rshift_extends_sign)
2374if test "$ac_cv_rshift_extends_sign" = no
2375then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002376 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
2377 [Define if i>>j for signed int i does not extend the sign bit
2378 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00002379fi
2380
Guido van Rossumcadfaec2001-01-05 14:45:49 +00002381# check for getc_unlocked and related locking functions
2382AC_MSG_CHECKING(for getc_unlocked() and friends)
2383AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
2384AC_TRY_LINK([#include <stdio.h>],[
2385 FILE *f = fopen("/dev/null", "r");
2386 flockfile(f);
2387 getc_unlocked(f);
2388 funlockfile(f);
2389], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
2390AC_MSG_RESULT($ac_cv_have_getc_unlocked)
2391if test "$ac_cv_have_getc_unlocked" = yes
2392then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002393 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
2394 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00002395fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002396
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00002397# check for readline 2.2
2398AC_TRY_CPP([#include <readline/readline.h>],
2399have_readline=yes, have_readline=no)
2400if test $have_readline = yes
2401then
2402 AC_EGREP_HEADER([extern int rl_completion_append_character;],
2403 [readline/readline.h],
2404 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
2405 [Define if you have readline 2.2]), )
2406fi
2407
Martin v. Löwis0daad592001-09-30 21:09:59 +00002408# check for readline 4.0
2409AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002410 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
2411 [Define if you have readline 4.0]), , -ltermcap)
Martin v. Löwis0daad592001-09-30 21:09:59 +00002412
Guido van Rossum353ae582001-07-10 16:45:32 +00002413# check for readline 4.2
2414AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002415 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
2416 [Define if you have readline 4.2]), , -ltermcap)
Guido van Rossum353ae582001-07-10 16:45:32 +00002417
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002418AC_MSG_CHECKING(for broken nice())
2419AC_CACHE_VAL(ac_cv_broken_nice, [
2420AC_TRY_RUN([
2421int main()
2422{
2423 int val1 = nice(1);
2424 if (val1 != -1 && val1 == nice(2))
2425 exit(0);
2426 exit(1);
2427}
Guido van Rossum3065c942001-09-17 04:03:14 +00002428],
2429ac_cv_broken_nice=yes,
2430ac_cv_broken_nice=no,
2431ac_cv_broken_nice=no)])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002432AC_MSG_RESULT($ac_cv_broken_nice)
2433if test "$ac_cv_broken_nice" = yes
2434then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002435 AC_DEFINE(HAVE_BROKEN_NICE, 1,
2436 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002437fi
2438
Martin v. Löwis94717ed2002-09-09 14:24:16 +00002439# Look for subsecond timestamps in struct stat
2440AC_MSG_CHECKING(for tv_nsec in struct stat)
2441AC_CACHE_VAL(ac_cv_stat_tv_nsec,
2442AC_TRY_COMPILE([#include <sys/stat.h>], [
2443struct stat st;
2444st.st_mtim.tv_nsec = 1;
2445],
Martin v. Löwisa32c9942002-09-09 16:17:47 +00002446ac_cv_stat_tv_nsec=yes,
Martin v. Löwis94717ed2002-09-09 14:24:16 +00002447ac_cv_stat_tv_nsec=no,
2448ac_cv_stat_tv_nsec=no))
2449AC_MSG_RESULT($ac_cv_stat_tv_nsec)
2450if test "$ac_cv_stat_tv_nsec" = yes
2451then
2452 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
2453 [Define if you have struct stat.st_mtim.tv_nsec])
2454fi
2455
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002456# On HP/UX 11.0, mvwdelch is a block with a return statement
2457AC_MSG_CHECKING(whether mvwdelch is an expression)
2458AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
2459AC_TRY_COMPILE([#include <curses.h>], [
2460 int rtn;
2461 rtn = mvwdelch(0,0,0);
2462], ac_cv_mvwdelch_is_expression=yes,
2463 ac_cv_mvwdelch_is_expression=no,
2464 ac_cv_mvwdelch_is_expression=yes))
2465AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
2466
2467if test "$ac_cv_mvwdelch_is_expression" = yes
2468then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002469 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
2470 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002471fi
2472
2473AC_MSG_CHECKING(whether WINDOW has _flags)
2474AC_CACHE_VAL(ac_cv_window_has_flags,
2475AC_TRY_COMPILE([#include <curses.h>], [
2476 WINDOW *w;
2477 w->_flags = 0;
2478], ac_cv_window_has_flags=yes,
2479 ac_cv_window_has_flags=no,
2480 ac_cv_window_has_flags=no))
2481AC_MSG_RESULT($ac_cv_window_has_flags)
2482
2483
2484if test "$ac_cv_window_has_flags" = yes
2485then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002486 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
2487 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002488fi
2489
Martin v. Löwis24a880b2002-12-31 12:55:15 +00002490AC_MSG_CHECKING(for /dev/ptmx)
2491
2492if test -e /dev/ptmx
2493then
2494 AC_MSG_RESULT(yes)
2495 AC_DEFINE(HAVE_DEV_PTMX, 1,
2496 [Define if we have /dev/ptmx.])
2497else
2498 AC_MSG_RESULT(no)
2499fi
2500
Martin v. Löwis01c04012002-11-11 14:58:44 +00002501AC_CHECK_TYPE(socklen_t,,
2502 AC_DEFINE(socklen_t,int,
2503 Define to `int' if <sys/socket.h> does not define.),[
2504#ifdef HAVE_SYS_TYPES_H
2505#include <sys/types.h>
2506#endif
Guido van Rossum95713eb2000-05-18 20:53:31 +00002507#ifdef HAVE_SYS_SOCKET_H
2508#include <sys/socket.h>
2509#endif
Martin v. Löwis01c04012002-11-11 14:58:44 +00002510])
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002511
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00002512AC_SUBST(THREADHEADERS)
2513
2514for h in `(cd $srcdir;echo Python/thread_*.h)`
2515do
2516 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
2517done
2518
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002519AC_SUBST(SRCDIRS)
Jack Jansen0b06be72002-06-21 14:48:38 +00002520SRCDIRS="Parser Grammar Objects Python Modules Mac Mac/Python"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00002521AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002522for dir in $SRCDIRS; do
2523 if test ! -d $dir; then
2524 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00002525 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002526done
2527AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00002528
Guido van Rossum627b2d71993-12-24 10:39:16 +00002529# generate output files
Martin v. Löwis88afe662002-10-26 13:47:44 +00002530AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
2531AC_OUTPUT
Neil Schemenauer61c51152001-01-26 16:18:16 +00002532
2533echo "creating Setup"
2534if test ! -f Modules/Setup
2535then
2536 cp $srcdir/Modules/Setup.dist Modules/Setup
2537fi
2538
2539echo "creating Setup.local"
2540if test ! -f Modules/Setup.local
2541then
2542 echo "# Edit this file for local setup changes" >Modules/Setup.local
2543fi
2544
2545echo "creating Makefile"
2546$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
2547 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00002548 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00002549mv config.c Modules