blob: 586e60ad83b268dd2bba7ef7a0a7dc23028aa8d7 [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)
Jack Jansen7b59b422003-03-17 15:44:10 +0000160AC_SUBST(EXTRAMACHDEPPATH)
Jack Jansen83f898c2002-12-30 22:23:40 +0000161AC_MSG_CHECKING(EXTRAPLATDIR)
162if test -z "$EXTRAPLATDIR"
163then
164 case $MACHDEP in
Jack Jansen7b59b422003-03-17 15:44:10 +0000165 darwin)
166 EXTRAPLATDIR="\$(PLATMACDIRS)"
167 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
168 ;;
169 *)
170 EXTRAPLATDIR=""
171 EXTRAMACHDEPPATH=""
172 ;;
Jack Jansen83f898c2002-12-30 22:23:40 +0000173 esac
174fi
175AC_MSG_RESULT($EXTRAPLATDIR)
176
Guido van Rossum627b2d71993-12-24 10:39:16 +0000177# checks for alternative programs
Skip Montanarodecc6a42003-01-01 20:07:49 +0000178
179# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
180# for debug/optimization stuff. BASECFLAGS is for flags that are required
181# just to get things to compile and link. Users are free to override OPT
182# when running configure or make. The build should not break if they do.
183# BASECFLAGS should generally not be messed with, however.
184
185# XXX shouldn't some/most/all of this code be merged with the stuff later
186# on that fiddles with OPT and BASECFLAGS?
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000187AC_MSG_CHECKING(for --without-gcc)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000188AC_ARG_WITH(gcc,
189 AC_HELP_STRING(--without-gcc,never use gcc),
190[
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000191 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000192 no) CC=cc
193 without_gcc=yes;;
194 yes) CC=gcc
195 without_gcc=no;;
196 *) CC=$withval
197 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000198 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000199 case $ac_sys_system in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000200 AIX*) CC=cc_r
201 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000202 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000203 case $BE_HOST_CPU in
204 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000205 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000206 without_gcc=yes
Skip Montanarodecc6a42003-01-01 20:07:49 +0000207 BASECFLAGS="$BASECFLAGS -export pragma"
208 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000209 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000210 ;;
211 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000212 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000213 without_gcc=no
Skip Montanarodecc6a42003-01-01 20:07:49 +0000214 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000215 ;;
216 *)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000217 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000218 ;;
219 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000220 AR="\$(srcdir)/Modules/ar_beos"
221 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000222 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000223 Monterey*)
224 RANLIB=:
Martin v. Löwis130fb172001-07-19 11:00:41 +0000225 without_gcc=;;
226 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000227 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000228AC_MSG_RESULT($without_gcc)
229
Guido van Rossum27552902001-01-23 01:52:26 +0000230AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000231AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000232MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000233AC_MSG_CHECKING(for --with-cxx=<compiler>)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000234AC_ARG_WITH(cxx,
235 AC_HELP_STRING(--with-cxx=<compiler>, enable C++ support),
236[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000237 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000238 case $withval in
239 no) CXX=
240 with_cxx=no;;
241 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000242 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000243 with_cxx=$withval;;
244 esac], [
245 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000246 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000247])
248AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000249
Michael W. Hudson54241132001-12-07 15:38:26 +0000250if test "$with_cxx" = "yes"
251then
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000252 AC_MSG_ERROR([must supply a compiler when using --with-cxx])
Michael W. Hudson54241132001-12-07 15:38:26 +0000253fi
254
Martin v. Löwis537970f2000-12-13 17:37:02 +0000255dnl The following fragment works similar to AC_PROG_CXX.
256dnl It does not fail if CXX is not found, and it is not executed if
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000257dnl --without-cxx was given.
Martin v. Löwis537970f2000-12-13 17:37:02 +0000258dnl Finally, it does not test whether CXX is g++.
259
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000260dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
261ifdef([AC_PROG_CXX_WORKS],[],
262 [AC_DEFUN([AC_PROG_CXX_WORKS],
263 [AC_LANG_PUSH(C++)dnl
264 _AC_COMPILER_EXEEXT
265 AC_LANG_POP()
266 ]
267)])
268
Martin v. Löwis537970f2000-12-13 17:37:02 +0000269if test "$check_cxx" = "yes"
270then
271 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
272 if test "$CXX" = "notfound"
273 then
274 CXX=
275 else
276 AC_PROG_CXX_WORKS
277 fi
278fi
279
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000280# If the user switches compilers, we can't believe the cache
281if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
282then
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000283 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
284(it is also a good idea to do 'make clean' before compiling)])
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000285fi
286
Guido van Rossum627b2d71993-12-24 10:39:16 +0000287AC_PROG_CC
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000288
289# checks for UNIX variants that set C preprocessor variables
290AC_AIX
291AC_MINIX
292
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000293# Check for unsupported systems
294case $ac_sys_system/$ac_sys_release in
295SunOS/4*|DYNIX/*|dgux*/*|IRIX/4*|Linux*/1*)
296 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
297 echo See README for details.
298 exit 1;;
299esac
300
301if test "$MINIX" = yes; then
302 echo This system \(MINIX\) is no longer supported.
303 echo Read README for details.
304 exit 1
305fi
306
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000307AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000308AC_MSG_CHECKING(for --with-suffix)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000309AC_ARG_WITH(suffix,
310 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
311[
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000312 case $withval in
313 no) EXEEXT=;;
314 yes) EXEEXT=.exe;;
315 *) EXEEXT=$withval;;
316 esac])
317AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000318
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000319# Test whether we're running on a non-case-sensitive system, in which
320# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000321AC_SUBST(BUILDEXEEXT)
322AC_MSG_CHECKING(for case-insensitive build directory)
Jack Jansen3c2c4332002-11-06 13:33:32 +0000323if test ! -d CaseSensitiveTestDir; then
324mkdir CaseSensitiveTestDir
325fi
326
327if test -d casesensitivetestdir
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000328then
Jack Jansen1999ef42001-12-06 21:47:20 +0000329 AC_MSG_RESULT(yes)
330 BUILDEXEEXT=.exe
331else
332 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000333 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000334fi
Jack Jansen3c2c4332002-11-06 13:33:32 +0000335rmdir CaseSensitiveTestDir
Guido van Rossumfb842551997-08-06 23:42:07 +0000336
Guido van Rossumdd997f71998-10-07 19:58:26 +0000337case $MACHDEP in
338bsdos*)
339 case $CC in
340 gcc) CC="$CC -D_HAVE_BSDI";;
341 esac;;
342esac
343
Guido van Rossum84561611997-08-21 00:08:11 +0000344case $ac_sys_system in
345hp*|HP*)
346 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000347 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000348 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000349Monterey*)
350 case $CC in
351 cc) CC="$CC -Wl,-Bexport";;
352 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000353SunOS*)
354 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000355 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000356 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000357esac
358
Martin v. Löwise8964d42001-03-06 12:09:07 +0000359
Neil Schemenauer61c51152001-01-26 16:18:16 +0000360AC_SUBST(LIBRARY)
361AC_MSG_CHECKING(LIBRARY)
362if test -z "$LIBRARY"
363then
364 LIBRARY='libpython$(VERSION).a'
365fi
366AC_MSG_RESULT($LIBRARY)
367
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000368# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000369# name of the library into which to insert object files). BLDLIBRARY is also
370# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
371# is blank as the main program is not linked directly against LDLIBRARY.
372# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
373# systems without shared libraries, LDLIBRARY is the same as LIBRARY
374# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
375# DLLLIBRARY is the shared (i.e., DLL) library.
376#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000377# RUNSHARED is used to run shared python without installed libraries
378#
379# INSTSONAME is the name of the shared library that will be use to install
380# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000381AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000382AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000383AC_SUBST(BLDLIBRARY)
384AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000385AC_SUBST(INSTSONAME)
386AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000387LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000388BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis09bdf722002-05-08 08:51:29 +0000389INSTSONAME='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000390DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000391LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000392RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000393
Guido van Rossumfb842551997-08-06 23:42:07 +0000394# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000395# If CXX is set, and if it is needed to link a main function that was
396# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
397# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000398# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000399# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000400AC_SUBST(LINKCC)
401AC_MSG_CHECKING(LINKCC)
402if test -z "$LINKCC"
403then
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000404 if test -z "$CXX"; then
405 LINKCC="\$(PURIFY) \$(CC)"
406 else
Martin v. Löwis1931ca72002-06-01 21:39:58 +0000407 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000408 $CXX -c conftest.$ac_ext 2>&5
409 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
410 && test -s conftest$ac_exeext && ./conftest$ac_exeext
411 then
412 LINKCC="\$(PURIFY) \$(CC)"
413 else
414 LINKCC="\$(PURIFY) \$(CXX)"
415 fi
416 rm -fr conftest*
417 fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000418 case $ac_sys_system in
419 AIX*)
Jeremy Hylton90d10062002-03-08 21:43:51 +0000420 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); $LINKCC";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000421 dgux*)
Martin v. Löwis4e732dc2002-03-19 15:15:32 +0000422 LINKCC="LD_RUN_PATH=$libdir $LINKCC";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000423 Monterey64*)
Martin v. Löwis4e732dc2002-03-19 15:15:32 +0000424 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000425 esac
426fi
427AC_MSG_RESULT($LINKCC)
428
Martin v. Löwis1142de32002-03-29 16:28:31 +0000429AC_MSG_CHECKING(for --enable-shared)
430AC_ARG_ENABLE(shared,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000431 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000432
Martin v. Löwis1142de32002-03-29 16:28:31 +0000433if test -z "$enable_shared"
434then
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000435 case $ac_sys_system in
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000436 CYGWIN* | atheos*)
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000437 enable_shared="yes";;
438 *)
439 enable_shared="no";;
440 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000441fi
442AC_MSG_RESULT($enable_shared)
443
444
445AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000446
Guido van Rossumb8552162001-09-05 14:58:11 +0000447# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
448# library that we build, but we do not want to link against it (we
449# will find it with a -framework option). For this reason there is an
450# extra variable BLDLIBRARY against which Python and the extension
451# modules are linked, BLDLIBRARY. This is normally the same as
452# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000453if test "$enable_framework"
454then
455 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
456 LDLIBRARYDIR='$(PYTHONFRAMEWORKDIR)'
457 BLDLIBRARY=''
458else
459 BLDLIBRARY='$(LDLIBRARY)'
460fi
461
Martin v. Löwis1142de32002-03-29 16:28:31 +0000462# Other platforms follow
463if test $enable_shared = "yes"; then
Mark Hammond8235ea12002-07-19 06:55:41 +0000464 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
Martin v. Löwis1142de32002-03-29 16:28:31 +0000465 case $ac_sys_system in
466 BeOS*)
467 LDLIBRARY='libpython$(VERSION).so'
468 ;;
469 CYGWIN*)
470 LDLIBRARY='libpython$(VERSION).dll.a'
471 DLLLIBRARY='libpython$(VERSION).dll'
472 ;;
473 SunOS*)
474 LDLIBRARY='libpython$(VERSION).so'
475 BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(VERSION)'
476 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
477 ;;
Martin v. Löwis1bc894b2002-07-30 20:19:58 +0000478 Linux*|GNU*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000479 LDLIBRARY='libpython$(VERSION).so'
480 BLDLIBRARY='-L. -lpython$(VERSION)'
481 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
482 INSTSONAME="$LDLIBRARY".$SOVERSION
483 ;;
484 hp*|HP*)
485 LDLIBRARY='libpython$(VERSION).sl'
486 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
487 RUNSHARED=SHLIB_PATH=`pwd`:$SHLIB_PATH
488 ;;
489 OSF*)
490 LDLIBRARY='libpython$(VERSION).so'
491 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
492 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
493 ;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000494 atheos*)
495 LDLIBRARY='libpython$(VERSION).so'
496 BLDLIBRARY='-L. -lpython$(VERSION)'
497 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
498 ;;
Martin v. Löwis1142de32002-03-29 16:28:31 +0000499 esac
500 # DG/UX requires some fancy ld contortions to produce a .so from an .a
501 case $MACHDEP in
502 dguxR4)
503 LDLIBRARY='libpython$(VERSION).so'
Skip Montanarodecc6a42003-01-01 20:07:49 +0000504 BASECFLAGS="$BASECFLAGS -pic"
Martin v. Löwis1142de32002-03-29 16:28:31 +0000505 ;;
506 esac
507fi
508
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000509AC_MSG_RESULT($LDLIBRARY)
510
Guido van Rossum627b2d71993-12-24 10:39:16 +0000511AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000512AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000513AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000514
515case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +0000516bsdos*|hp*|HP*)
517 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +0000518 if test -z "$INSTALL"
519 then
520 INSTALL="${srcdir}/install-sh -c"
521 fi
522esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000523AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000524
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000525# Not every filesystem supports hard links
526AC_SUBST(LN)
527if test -z "$LN" ; then
528 case $ac_sys_system in
529 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000530 CYGWIN*) LN="ln -s";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000531 atheos*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000532 *) LN=ln;;
533 esac
534fi
535
Fred Drake9f715822001-07-11 06:27:00 +0000536# Check for --with-pydebug
537AC_MSG_CHECKING(for --with-pydebug)
538AC_ARG_WITH(pydebug,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000539 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
540[
Fred Drake9f715822001-07-11 06:27:00 +0000541if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000542then
543 AC_DEFINE(Py_DEBUG, 1,
544 [Define if you want to build an interpreter with many run-time checks.])
545 AC_MSG_RESULT(yes);
546 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +0000547else AC_MSG_RESULT(no); Py_DEBUG='false'
548fi],
549[AC_MSG_RESULT(no)])
550
Skip Montanarodecc6a42003-01-01 20:07:49 +0000551# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
552# merged with this chunk of code?
553
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000554# Optimizer/debugger flags
Skip Montanarodecc6a42003-01-01 20:07:49 +0000555# ------------------------
556# (The following bit of code is complicated enough - please keep things
557# indented properly. Just pretend you're editing Python code. ;-)
558
559# There are two parallel sets of case statements below, one that checks to
560# see if OPT was set and one that does BASECFLAGS setting based upon
561# compiler and platform. BASECFLAGS tweaks need to be made even if the
562# user set OPT.
563
564# tweak OPT based on compiler and platform, only if the user didn't set
565# it on the command line
Guido van Rossumb418f891996-07-30 18:06:02 +0000566AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000567if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000568then
Skip Montanarodecc6a42003-01-01 20:07:49 +0000569 case $GCC in
570 yes)
571 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000572 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000573 if test "$Py_DEBUG" = 'true' ; then
574 # Optimization messes up debuggers, so turn it off for
575 # debug builds.
576 OPT="-g -Wall -Wstrict-prototypes"
577 else
578 OPT="-g -O3 -Wall -Wstrict-prototypes"
Skip Montanarodecc6a42003-01-01 20:07:49 +0000579 fi
580 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000581 *)
Skip Montanarodecc6a42003-01-01 20:07:49 +0000582 OPT="-O3 -Wall -Wstrict-prototypes"
583 ;;
Fred Drake9f715822001-07-11 06:27:00 +0000584 esac
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000585 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +0000586 SCO_SV*) OPT="$OPT -m486 -DSCO5"
587 ;;
588 esac
Fred Drake9f715822001-07-11 06:27:00 +0000589 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +0000590
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000591 *)
Skip Montanarodecc6a42003-01-01 20:07:49 +0000592 OPT="-O"
593 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000594 esac
Skip Montanarodecc6a42003-01-01 20:07:49 +0000595
596 # The current (beta) Monterey compiler dies with optimizations
597 # XXX what is Monterey? Does it still die w/ -O? Can we get rid of this?
Jack Jansenca06bc62001-08-03 15:32:23 +0000598 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +0000599 Monterey*)
600 OPT=""
601 ;;
Jack Jansenca06bc62001-08-03 15:32:23 +0000602 esac
Skip Montanarodecc6a42003-01-01 20:07:49 +0000603
Guido van Rossum4e8af441994-08-19 15:33:54 +0000604fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000605
Skip Montanarodecc6a42003-01-01 20:07:49 +0000606AC_SUBST(BASECFLAGS)
607# tweak BASECFLAGS based on compiler and platform
608case $GCC in
609yes)
610 case $ac_sys_system in
611 SCO_SV*)
612 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
613 ;;
614 # is there any other compiler on Darwin besides gcc?
615 Darwin*)
616 BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp"
617 ;;
618 esac
619 ;;
620
621*)
622 case $ac_sys_system in
623 OpenUNIX*|UnixWare*)
624 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
625 ;;
626 SCO_SV*)
627 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
628 ;;
629 esac
630 ;;
631esac
632
Fred Drakee1ceaa02001-12-04 20:55:47 +0000633if test "$Py_DEBUG" = 'true'; then
634 :
635else
636 OPT="-DNDEBUG $OPT"
637fi
638
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000639if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000640then
Skip Montanarodecc6a42003-01-01 20:07:49 +0000641 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000642fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000643
Guido van Rossum91922671997-10-09 20:24:13 +0000644AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
645AC_CACHE_VAL(ac_cv_opt_olimit_ok,
646[ac_save_cc="$CC"
647CC="$CC -OPT:Olimit=0"
648AC_TRY_RUN([int main() { return 0; }],
649 ac_cv_opt_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000650 ac_cv_opt_olimit_ok=no,
Guido van Rossum91922671997-10-09 20:24:13 +0000651 ac_cv_opt_olimit_ok=no)
652CC="$ac_save_cc"])
653AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000654if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000655 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +0000656 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
657 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
658 # environment?
659 Darwin*)
660 ;;
661 *)
662 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
663 ;;
Guido van Rossum5839e582000-10-09 19:52:35 +0000664 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000665else
666 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
667 AC_CACHE_VAL(ac_cv_olimit_ok,
668 [ac_save_cc="$CC"
669 CC="$CC -Olimit 1500"
670 AC_TRY_RUN([int main() { return 0; }],
671 ac_cv_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +0000672 ac_cv_olimit_ok=no,
Guido van Rossumf8678121998-07-07 21:05:09 +0000673 ac_cv_olimit_ok=no)
674 CC="$ac_save_cc"])
675 AC_MSG_RESULT($ac_cv_olimit_ok)
676 if test $ac_cv_olimit_ok = yes; then
Skip Montanarodecc6a42003-01-01 20:07:49 +0000677 BASECFLAGS="$BASECFLAGS -Olimit 1500"
Guido van Rossumf8678121998-07-07 21:05:09 +0000678 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000679fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000680
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000681# On some compilers, pthreads are available without further options
682# (e.g. MacOS X). On some of these systems, the compiler will not
683# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
684# So we have to see first whether pthreads are available without
685# options before we can check whether -Kpthread improves anything.
686AC_MSG_CHECKING(whether pthreads are available without options)
687AC_CACHE_VAL(ac_cv_pthread_is_default,
688[AC_TRY_RUN([
689#include <pthread.h>
690
691void* routine(void* p){return NULL;}
692
693int main(){
694 pthread_t p;
695 if(pthread_create(&p,NULL,routine,NULL)!=0)
696 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +0000697 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000698 return 0;
699}
700],
701 ac_cv_pthread_is_default=yes,
702 ac_cv_pthread_is_default=no,
703 ac_cv_pthread_is_default=no)
704])
705AC_MSG_RESULT($ac_cv_pthread_is_default)
706
707
708if test $ac_cv_pthread_is_default = yes
709then
710 ac_cv_kpthread=no
711else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000712# -Kpthread, if available, provides the right #defines
713# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000714# Some compilers won't report that they do not support -Kpthread,
715# so we need to run a program to see whether it really made the
716# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +0000717AC_MSG_CHECKING(whether $CC accepts -Kpthread)
718AC_CACHE_VAL(ac_cv_kpthread,
719[ac_save_cc="$CC"
720CC="$CC -Kpthread"
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000721AC_TRY_RUN([
722#include <pthread.h>
723
724void* routine(void* p){return NULL;}
725
726int main(){
727 pthread_t p;
728 if(pthread_create(&p,NULL,routine,NULL)!=0)
729 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +0000730 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000731 return 0;
732}
733],
Martin v. Löwis130fb172001-07-19 11:00:41 +0000734 ac_cv_kpthread=yes,
Martin v. Löwis260aecc2001-10-07 08:14:41 +0000735 ac_cv_kpthread=no,
Martin v. Löwis130fb172001-07-19 11:00:41 +0000736 ac_cv_kpthread=no)
737CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +0000738AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +0000739fi
Martin v. Löwis130fb172001-07-19 11:00:41 +0000740
Fred Drakece81d592000-07-09 14:39:29 +0000741dnl # check for ANSI or K&R ("traditional") preprocessor
742dnl AC_MSG_CHECKING(for C preprocessor type)
743dnl AC_TRY_COMPILE([
744dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
745dnl int foo;
746dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
747dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
748dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000749
Guido van Rossum627b2d71993-12-24 10:39:16 +0000750# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000751AC_HEADER_STDC
Martin v. Löwis2e64c342002-03-27 18:49:02 +0000752AC_CHECK_HEADERS(dlfcn.h fcntl.h grp.h limits.h langinfo.h \
753libintl.h locale.h ncurses.h poll.h pthread.h \
Martin v. Löwis14e73b12003-01-01 09:51:12 +0000754signal.h stdarg.h stddef.h stdlib.h stropts.h termios.h thread.h \
755unistd.h utime.h \
Skip Montanaro57454e52002-06-14 20:30:31 +0000756sys/audioio.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000757sys/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 +0000758sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \
Barry Warsawfe33b792003-01-07 22:42:49 +0000759sys/resource.h netpacket/packet.h sysexits.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000760AC_HEADER_DIRENT
Martin v. Löwisdbe3f762002-10-10 14:27:30 +0000761AC_HEADER_MAJOR
Guido van Rossum627b2d71993-12-24 10:39:16 +0000762
763# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000764was_it_defined=no
765AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000766AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
767 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
768])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000769AC_MSG_RESULT($was_it_defined)
770
Neal Norwitz11690112002-07-30 01:08:28 +0000771# Check whether using makedev requires defining _OSF_SOURCE
772AC_MSG_CHECKING(for makedev)
Neal Norwitz6eb37f02003-02-23 23:28:15 +0000773AC_TRY_LINK([#include <sys/types.h> ],
Neal Norwitz11690112002-07-30 01:08:28 +0000774 [ makedev(0, 0) ],
775 ac_cv_has_makedev=yes,
776 ac_cv_has_makedev=no)
777if test "$ac_cv_has_makedev" = "no"; then
778 # we didn't link, try if _OSF_SOURCE will allow us to link
779 AC_TRY_LINK([
Neal Norwitz6eb37f02003-02-23 23:28:15 +0000780#define _OSF_SOURCE 1
781#include <sys/types.h>
Neal Norwitz11690112002-07-30 01:08:28 +0000782 ],
783 [ makedev(0, 0) ],
784 ac_cv_has_makedev=yes,
785 ac_cv_has_makedev=no)
786 if test "$ac_cv_has_makedev" = "yes"; then
787 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
788 fi
789fi
790AC_MSG_RESULT($ac_cv_has_makedev)
791if test "$ac_cv_has_makedev" = "yes"; then
792 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
793fi
794
Martin v. Löwis399a6892002-10-04 10:22:02 +0000795# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
796# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
797# defined, but the compiler does not support pragma redefine_extname,
798# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
799# structures (such as rlimit64) without declaring them. As a
800# work-around, disable LFS on such configurations
801
802use_lfs=yes
803AC_MSG_CHECKING(Solaris LFS bug)
804AC_TRY_COMPILE([
805#define _LARGEFILE_SOURCE 1
806#define _FILE_OFFSET_BITS 64
807#include <sys/resource.h>
808],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
809AC_MSG_RESULT($sol_lfs_bug)
810if test "$sol_lfs_bug" = "yes"; then
811 use_lfs=no
812fi
813
814if test "$use_lfs" = "yes"; then
Guido van Rossum810cc512001-09-09 23:51:39 +0000815# Two defines needed to enable largefile support on various platforms
816# These may affect some typedefs
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000817AC_DEFINE(_LARGEFILE_SOURCE, 1,
818[This must be defined on some systems to enable large file support.])
819AC_DEFINE(_FILE_OFFSET_BITS, 64,
820[This must be set to 64 on some systems to enable large file support.])
Martin v. Löwis399a6892002-10-04 10:22:02 +0000821fi
Guido van Rossum810cc512001-09-09 23:51:39 +0000822
Guido van Rossum300fda71996-08-19 21:58:16 +0000823# Add some code to confdefs.h so that the test for off_t works on SCO
824cat >> confdefs.h <<\EOF
825#if defined(SCO_DS)
826#undef _OFF_T
827#endif
828EOF
829
Guido van Rossumef2255b2000-03-10 22:30:29 +0000830# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000831AC_TYPE_MODE_T
832AC_TYPE_OFF_T
833AC_TYPE_PID_T
834AC_TYPE_SIGNAL
835AC_TYPE_SIZE_T
836AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000837
Guido van Rossumef2255b2000-03-10 22:30:29 +0000838# Sizes of various common basic types
Guido van Rossum3065c942001-09-17 04:03:14 +0000839AC_CHECK_SIZEOF(int, 4)
840AC_CHECK_SIZEOF(long, 4)
841AC_CHECK_SIZEOF(void *, 4)
842AC_CHECK_SIZEOF(char, 1)
843AC_CHECK_SIZEOF(short, 2)
844AC_CHECK_SIZEOF(float, 4)
845AC_CHECK_SIZEOF(double, 8)
846AC_CHECK_SIZEOF(fpos_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +0000847
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000848AC_MSG_CHECKING(for long long support)
849have_long_long=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000850AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
851 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
852 have_long_long=yes
853])
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000854AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000855if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000856AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000857fi
858
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000859AC_MSG_CHECKING(for uintptr_t support)
860have_uintptr_t=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000861AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
862 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
863 have_uintptr_t=yes
864])
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000865AC_MSG_RESULT($have_uintptr_t)
866if test "$have_uintptr_t" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +0000867AC_CHECK_SIZEOF(uintptr_t, 4)
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000868fi
869
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000870# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
871AC_MSG_CHECKING(size of off_t)
872AC_CACHE_VAL(ac_cv_sizeof_off_t,
873[AC_TRY_RUN([#include <stdio.h>
874#include <sys/types.h>
875main()
876{
877 FILE *f=fopen("conftestval", "w");
878 if (!f) exit(1);
879 fprintf(f, "%d\n", sizeof(off_t));
880 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000881}],
882ac_cv_sizeof_off_t=`cat conftestval`,
883ac_cv_sizeof_off_t=0,
884ac_cv_sizeof_off_t=4)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000885])
886AC_MSG_RESULT($ac_cv_sizeof_off_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000887AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
888[The number of bytes in an off_t.])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000889
890AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000891if test "$have_long_long" = yes -a \
892 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
893 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000894 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
895 [Defined to enable large file support when an off_t is bigger than a long
896 and long long is available and at least as big as an off_t. You may need
897 to add some flags for configuration and compilation to enable this mode.
898 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000899 AC_MSG_RESULT(yes)
900else
901 AC_MSG_RESULT(no)
902fi
903
Fred Drakea3f6e912000-06-29 20:44:47 +0000904# AC_CHECK_SIZEOF() doesn't include <time.h>.
905AC_MSG_CHECKING(size of time_t)
906AC_CACHE_VAL(ac_cv_sizeof_time_t,
907[AC_TRY_RUN([#include <stdio.h>
908#include <time.h>
909main()
910{
911 FILE *f=fopen("conftestval", "w");
912 if (!f) exit(1);
913 fprintf(f, "%d\n", sizeof(time_t));
914 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000915}],
916ac_cv_sizeof_time_t=`cat conftestval`,
917ac_cv_sizeof_time_t=0,
918ac_cv_sizeof_time_t=4)
Fred Drakea3f6e912000-06-29 20:44:47 +0000919])
920AC_MSG_RESULT($ac_cv_sizeof_time_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000921AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
922[The number of bytes in a time_t.])
Fred Drakea3f6e912000-06-29 20:44:47 +0000923
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000924
Trent Mick635f6fb2000-08-23 21:33:05 +0000925# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000926ac_save_cc="$CC"
927if test "$ac_cv_kpthread" = "yes"
928then CC="$CC -Kpthread"
929fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000930AC_MSG_CHECKING(for pthread_t)
931have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000932AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000933AC_MSG_RESULT($have_pthread_t)
934if test "$have_pthread_t" = yes ; then
935 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
936 AC_MSG_CHECKING(size of pthread_t)
937 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
938 [AC_TRY_RUN([#include <stdio.h>
Neal Norwitz6eb37f02003-02-23 23:28:15 +0000939#include <pthread.h>
Trent Mick635f6fb2000-08-23 21:33:05 +0000940 main()
941 {
942 FILE *f=fopen("conftestval", "w");
943 if (!f) exit(1);
944 fprintf(f, "%d\n", sizeof(pthread_t));
945 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +0000946 }],
947 ac_cv_sizeof_pthread_t=`cat conftestval`,
948 ac_cv_sizeof_pthread_t=0,
949 ac_cv_sizeof_pthread_t=4)
Trent Mick635f6fb2000-08-23 21:33:05 +0000950 ])
951 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000952 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
953 [The number of bytes in a pthread_t.])
Trent Mick635f6fb2000-08-23 21:33:05 +0000954fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000955CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000956
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000957AC_MSG_CHECKING(for --enable-toolbox-glue)
958AC_ARG_ENABLE(toolbox-glue,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000959 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000960
961if test -z "$enable_toolbox_glue"
962then
963 case $ac_sys_system/$ac_sys_release in
964 Darwin/*)
965 enable_toolbox_glue="yes";;
966 *)
967 enable_toolbox_glue="no";;
968 esac
969fi
970case "$enable_toolbox_glue" in
971yes)
Jack Jansen666b1e72001-10-31 12:11:48 +0000972 extra_frameworks="-framework CoreServices -framework Foundation"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000973 extra_machdep_objs="Python/mactoolboxglue.o"
Jack Jansen591cbed2001-08-15 13:55:15 +0000974 extra_undefs="-u __dummy -u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000975 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
976 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000977 ;;
978*)
979 extra_frameworks=""
980 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +0000981 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000982 ;;
983esac
984AC_MSG_RESULT($enable_toolbox_glue)
985
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000986AC_SUBST(LIBTOOL_CRUFT)
987case $ac_sys_system/$ac_sys_release in
Jack Jansen418c3b12001-11-14 10:59:57 +0000988 Darwin/1.3*)
Jack Jansenea0c3822002-08-01 21:57:49 +0000989 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
Jack Jansen418c3b12001-11-14 10:59:57 +0000990 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
Jack Jansena3891ea2001-09-07 14:25:12 +0000991 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
992 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +0000993 Darwin/*)
Jack Jansenea0c3822002-08-01 21:57:49 +0000994 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
Jack Jansen418c3b12001-11-14 10:59:57 +0000995 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000996 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
997 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000998esac
999
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001000AC_MSG_CHECKING(for --enable-framework)
1001if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001002then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001003 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001004 # -F. is needed to allow linking to the framework while
1005 # in the build location.
Jack Jansenea0c3822002-08-01 21:57:49 +00001006 LDFLAGS="$LDFLAGS -Wl,-F."
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001007 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1008 [Define if you want to produce an OpenStep/Rhapsody framework
1009 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001010 AC_MSG_RESULT(yes)
1011else
1012 AC_MSG_RESULT(no)
1013fi
1014
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001015AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001016case $ac_sys_system/$ac_sys_release in
1017 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001018 AC_DEFINE(WITH_DYLD, 1,
1019 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1020 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1021 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001022 AC_MSG_RESULT(always on for Darwin)
1023 ;;
1024 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001025 AC_MSG_RESULT(no)
1026 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001027esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001028
Guido van Rossumac405f61994-09-12 10:56:06 +00001029# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +00001030AC_SUBST(SO)
1031AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001032AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001033AC_SUBST(CCSHARED)
1034AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001035# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +00001036# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001037AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +00001038if test -z "$SO"
1039then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001040 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001041 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001042 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001043 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +00001044 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001045fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001046AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +00001047# LDSHARED is the ld *command* used to create shared library
Martin v. Löwis5b718fc2001-09-10 15:34:42 +00001048# -- "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 +00001049# (Shared libraries in this instance are shared modules to be loaded into
1050# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001051AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001052if test -z "$LDSHARED"
1053then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001054 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001055 AIX*)
1056 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
Guido van Rossumce608b02001-09-28 15:59:38 +00001057 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001058 ;;
1059 BeOS*)
1060 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +00001061 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001062 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001063 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +00001064 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001065 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a662000-05-26 12:22:54 +00001066 SunOS/5*)
1067 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +00001068 then LDSHARED='$(CC) -shared'
Martin v. Löwisaa5afe12002-10-07 06:21:41 +00001069 else LDSHARED='$(CC) -G';
Greg Ward57c9a662000-05-26 12:22:54 +00001070 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +00001071 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +00001072 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +00001073 DYNIX/ptx*) LDSHARED="ld -G";;
Jack Jansen418c3b12001-11-14 10:59:57 +00001074 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +00001075 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1076 if test "$enable_framework" ; then
1077 # Link against the framework. All externals should be defined.
1078 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
1079 else
1080 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +00001081 LDSHARED="$LDSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +00001082 fi ;;
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001083 Darwin/*)
1084 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1085 if test "$enable_framework" ; then
1086 # Link against the framework. All externals should be defined.
1087 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
1088 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +00001089 # No framework, use the Python app as bundle-loader
1090 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
Jack Jansenc28fc372003-02-25 13:14:43 +00001091 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001092 fi ;;
Martin v. Löwis3cba5c02002-09-16 17:50:59 +00001093 Linux*|GNU*) LDSHARED='$(CC) -shared';;
Guido van Rossum3c4bb801997-12-18 23:55:32 +00001094 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +00001095 BSD/OS*/4*) LDSHARED="gcc -shared";;
Martin v. Löwisd61888b2002-09-30 11:17:27 +00001096 OpenBSD*|FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +00001097 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +00001098 then
1099 LDSHARED="cc -shared ${LDFLAGS}"
1100 else
1101 LDSHARED="ld -Bshareable ${LDFLAGS}"
1102 fi;;
Martin v. Löwisd61888b2002-09-30 11:17:27 +00001103 NetBSD*) LDSHARED="cc -shared ${LDFLAGS}";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001104 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001105 if test "$GCC" = "yes"
Martin v. Löwis79f3c532002-12-11 12:51:58 +00001106 then LDSHARED='$(CC) -shared'
1107 else LDSHARED='$(CC) -G'
Martin v. Löwisbec19582001-03-21 15:57:54 +00001108 fi;;
Martin v. Löwis79f3c532002-12-11 12:51:58 +00001109 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
Trent Mick635f6fb2000-08-23 21:33:05 +00001110 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001111 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001112 atheos*) LDSHARED="gcc -shared";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001113 *) LDSHARED="ld";;
1114 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001115fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001116AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001117BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +00001118# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001119# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001120AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001121if test -z "$CCSHARED"
1122then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001123 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +00001124 SunOS*) if test "$GCC" = yes;
1125 then CCSHARED="-fPIC";
1126 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +00001127 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +00001128 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +00001129 else CCSHARED="+z";
1130 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001131 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001132 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis36546db2001-09-05 14:24:43 +00001133 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001134 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001135 if test "$GCC" = "yes"
1136 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001137 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +00001138 fi;;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001139 SCO_SV*)
1140 if test "$GCC" = "yes"
1141 then CCSHARED="-fPIC"
1142 else CCSHARED="-Kpic -belf"
1143 fi;;
Trent Mick635f6fb2000-08-23 21:33:05 +00001144 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001145 IRIX*/6*) case $CC in
1146 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +00001147 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001148 esac;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001149 atheos*) CCSHARED="-fPIC";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001150 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001151fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001152AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001153# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +00001154# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001155AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001156if test -z "$LINKFORSHARED"
1157then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001158 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001159 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +00001160 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +00001161 LINKFORSHARED="-Wl,-E -Wl,+s";;
1162# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001163 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001164 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001165 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001166 Darwin/*)
1167 # -u __dummy makes the linker aware of the objc runtime
1168 # in System.framework; otherwise, __objcInit (referenced in
1169 # crt1.o) gets erroneously defined as common, which breaks dynamic
1170 # loading of any modules which reference it in System.framework.
1171 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
1172 # not used by the core itself but which needs to be in the core so
1173 # that dynamically loaded extension modules have access to it.
Jack Jansen97e3f002003-02-23 22:59:01 +00001174 # -prebind is no longer used, because it actually seems to give a
1175 # slowdown in stead of a speedup, maybe due to the large number of
1176 # dynamic loads Python does.
1177 LINKFORSHARED="$extra_undefs -framework System"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001178 if test "$enable_framework"
1179 then
1180 LINKFORSHARED="$LINKFORSHARED -framework Python"
1181 fi
1182 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001183 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001184 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +00001185 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis36546db2001-09-05 14:24:43 +00001186 FreeBSD*|NetBSD*|OpenBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +00001187 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1188 then
1189 LINKFORSHARED="-Wl,--export-dynamic"
1190 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001191 SunOS/5*) case $CC in
1192 *gcc*)
Martin v. Löwisa4548572002-04-18 14:51:36 +00001193 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +00001194 then
1195 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001196 fi;;
1197 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +00001198 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001199fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001200AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001201
Neil Schemenauer61c51152001-01-26 16:18:16 +00001202AC_SUBST(CFLAGSFORSHARED)
1203AC_MSG_CHECKING(CFLAGSFORSHARED)
1204if test ! "$LIBRARY" = "$LDLIBRARY"
1205then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +00001206 case $ac_sys_system in
1207 CYGWIN*)
1208 # Cygwin needs CCSHARED when building extension DLLs
1209 # but not when building the interpreter DLL.
1210 CFLAGSFORSHARED='';;
1211 *)
1212 CFLAGSFORSHARED='$(CCSHARED)'
1213 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +00001214fi
1215AC_MSG_RESULT($CFLAGSFORSHARED)
1216
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001217# SHLIBS are libraries (except -lc and -lm) to link to the python shared
1218# library (with --enable-shared).
1219# For platforms on which shared libraries are not allowed to have unresolved
Martin v. Löwisd6359c52002-08-04 12:38:50 +00001220# symbols, this must be set to $(LIBS) (expanded by make). We do this even
1221# if it is not required, since it creates a dependency of the shared library
1222# to LIBS. This, in turn, means that applications linking the shared libpython
1223# don't need to link LIBS explicitly. The default should be only changed
1224# on systems where this approach causes problems.
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001225AC_SUBST(SHLIBS)
1226AC_MSG_CHECKING(SHLIBS)
1227case "$ac_sys_system" in
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001228 *)
Martin v. Löwisd6359c52002-08-04 12:38:50 +00001229 SHLIBS='$(LIBS)';;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001230esac
1231AC_MSG_RESULT($SHLIBS)
1232
1233
Guido van Rossum627b2d71993-12-24 10:39:16 +00001234# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001235AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1236AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Martin v. Löwis82c19a72002-10-06 11:48:09 +00001237AC_SEARCH_LIBS(sem_init, rt posix4) # 'Real Time' functions on Solaris,
1238 # posix4 on Solaris 2.6
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00001239
1240# checks for system dependent C++ extensions support
1241case "$ac_sys_system" in
1242 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1243 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1244 [loadAndInit("", 0, "")],
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001245 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1246 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1247 and you want support for AIX C++ shared extension modules.])
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00001248 AC_MSG_RESULT(yes)],
1249 [AC_MSG_RESULT(no)]);;
1250 *) ;;
1251esac
1252
Guido van Rossum70c7f481998-03-26 18:44:10 +00001253# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
Martin v. Löwise1172582002-11-13 08:51:19 +00001254# However on SGI IRIX 4, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001255# BeOS' sockets are stashed in libnet.
1256case "$ac_sys_system" in
1257IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +00001258*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001259AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001260AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00001261;;
1262esac
1263case "$ac_sys_system" in
1264BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001265AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1266;;
1267esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00001268
Guido van Rossumc5a39031996-07-31 17:35:03 +00001269AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001270AC_ARG_WITH(libs,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001271 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1272[
Guido van Rossumc5a39031996-07-31 17:35:03 +00001273AC_MSG_RESULT($withval)
1274LIBS="$withval $LIBS"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001275],
1276[AC_MSG_RESULT(no)])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001277
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001278# Determine if signalmodule should be used.
1279AC_SUBST(USE_SIGNAL_MODULE)
1280AC_SUBST(SIGNAL_OBJS)
1281AC_MSG_CHECKING(for --with-signal-module)
1282AC_ARG_WITH(signal-module,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001283 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001284
1285if test -z "$with_signal_module"
1286then with_signal_module="yes"
1287fi
1288AC_MSG_RESULT($with_signal_module)
1289
1290if test "${with_signal_module}" = "yes"; then
1291 USE_SIGNAL_MODULE=""
1292 SIGNAL_OBJS=""
1293else
1294 USE_SIGNAL_MODULE="#"
1295 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1296fi
1297
Guido van Rossum3d15bd82001-01-10 18:53:48 +00001298# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00001299AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001300USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00001301
Guido van Rossum54d93d41997-01-22 20:51:58 +00001302AC_MSG_CHECKING(for --with-dec-threads)
1303AC_SUBST(LDLAST)
1304AC_ARG_WITH(dec-threads,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001305 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
1306[
Barry Warsawc0d24d82000-06-29 16:12:00 +00001307AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00001308LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00001309if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00001310 with_thread="$withval";
1311fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001312[AC_MSG_RESULT(no)])
Guido van Rossum54d93d41997-01-22 20:51:58 +00001313
Martin v. Löwis11437992002-04-12 09:54:03 +00001314# Templates for things AC_DEFINEd more than once.
1315# For a single AC_DEFINE, no template is needed.
1316AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
1317AH_TEMPLATE(_REENTRANT,
1318 [Define to force use of thread-safe errno, h_errno, and other functions])
1319AH_TEMPLATE(WITH_THREAD,
1320 [Define if you want to compile in rudimentary thread support])
1321
Guido van Rossum54d93d41997-01-22 20:51:58 +00001322AC_MSG_CHECKING(for --with-threads)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001323dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawc0d24d82000-06-29 16:12:00 +00001324AC_ARG_WITH(threads,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001325 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
Guido van Rossum54d93d41997-01-22 20:51:58 +00001326
Barry Warsawc0d24d82000-06-29 16:12:00 +00001327# --with-thread is deprecated, but check for it anyway
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001328dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00001329AC_ARG_WITH(thread,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001330 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
1331 [with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +00001332
1333if test -z "$with_threads"
1334then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001335fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00001336AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00001337
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001338AC_SUBST(THREADOBJ)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001339if test "$with_threads" = "no"
1340then
1341 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001342elif test "$ac_cv_pthread_is_default" = yes
1343then
1344 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001345 # Defining _REENTRANT on system with POSIX threads should not hurt.
1346 AC_DEFINE(_REENTRANT)
1347 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001348 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001349elif test "$ac_cv_kpthread" = "yes"
1350then
1351 CC="$CC -Kpthread"
1352 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001353 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001354 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +00001355else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001356 if test ! -z "$with_threads" -a -d "$with_threads"
1357 then LDFLAGS="$LDFLAGS -L$with_threads"
1358 fi
1359 if test ! -z "$withval" -a -d "$withval"
1360 then LDFLAGS="$LDFLAGS -L$withval"
1361 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001362
1363 # According to the POSIX spec, a pthreads implementation must
1364 # define _POSIX_THREADS in unistd.h. Some apparently don't (which ones?)
1365 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1366 AC_EGREP_CPP(yes,
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001367 [
1368#include <unistd.h>
1369#ifdef _POSIX_THREADS
1370yes
1371#endif
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001372 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1373 AC_MSG_RESULT($unistd_defines_pthreads)
1374
Martin v. Löwis130fb172001-07-19 11:00:41 +00001375 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001376 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1377 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001378 AC_DEFINE(HURD_C_THREADS, 1,
1379 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001380 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001381 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001382 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1383 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001384 AC_DEFINE(MACH_C_THREADS, 1,
1385 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001386 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001387 AC_MSG_CHECKING(for --with-pth)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001388 AC_ARG_WITH([pth],
1389 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
1390 [AC_MSG_RESULT($withval)
1391 AC_DEFINE([WITH_THREAD])
1392 AC_DEFINE([HAVE_PTH], 1,
1393 [Define if you have GNU PTH threads.])
1394 LIBS="-lpth $LIBS"
1395 THREADOBJ="Python/thread.o"],
1396 [AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00001397
1398 # Just looking for pthread_create in libpthread is not enough:
1399 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1400 # So we really have to include pthread.h, and then link.
1401 _libs=$LIBS
1402 LIBS="$LIBS -lpthread"
1403 AC_MSG_CHECKING([for pthread_create in -lpthread])
1404 AC_TRY_LINK([#include <pthread.h>
1405
1406void * start_routine (void *arg) { exit (0); }], [
1407pthread_create (NULL, NULL, start_routine, NULL)], [
1408 AC_MSG_RESULT(yes)
1409 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001410 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001411 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00001412 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00001413 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001414 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001415 THREADOBJ="Python/thread.o"],[
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001416 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
1417 AC_DEFINE(ATHEOS_THREADS, 1,
1418 [Define this if you have AtheOS threads.])
1419 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001420 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001421 AC_DEFINE(BEOS_THREADS, 1,
1422 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001423 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001424 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001425 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001426 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001427 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001428 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001429 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001430 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001431 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001432 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis779ffc02002-12-02 22:17:01 +00001433 echo Systems with __d6_pthread_create are not supported anymore.
1434 echo See README
1435 exit 1
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001436 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001437 LIBS="$LIBS -lthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001438 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001439 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001440 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001441 LIBS="$LIBS -lpthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001442 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00001443 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001444 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00001445 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001446 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00001447 USE_THREAD_MODULE="#"])
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001448 ])])])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00001449
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001450 if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001451 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001452 AC_DEFINE(_POSIX_THREADS, 1,
1453 [Define if you have POSIX threads,
1454 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001455 fi
1456
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00001457 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
1458 case $ac_sys_system/$ac_sys_release in
1459 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
1460 Define if the Posix semaphores do not work on your system);;
1461 esac
1462
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001463 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1464 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1465 [AC_TRY_RUN([#include <pthread.h>
1466 void *foo(void *parm) {
1467 return NULL;
1468 }
1469 main() {
1470 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00001471 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001472 if (pthread_attr_init(&attr)) exit(-1);
1473 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00001474 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001475 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00001476 }],
1477 ac_cv_pthread_system_supported=yes,
1478 ac_cv_pthread_system_supported=no,
1479 ac_cv_pthread_system_supported=no)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001480 ])
1481 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1482 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001483 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001484 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00001485 AC_CHECK_FUNCS(pthread_sigmask)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00001486 fi
1487
Martin v. Löwis130fb172001-07-19 11:00:41 +00001488 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1489 LIBS="$LIBS -lmpc"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001490 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001491 USE_THREAD_MODULE=""])
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001492
Neal Norwitza978ab02002-11-02 16:58:05 +00001493 if test "$posix_threads" != "yes"; then
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001494 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1495 LIBS="$LIBS -lthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00001496 THREADOBJ="Python/thread.o"
Martin v. Löwis3d2b5492002-03-15 13:48:21 +00001497 USE_THREAD_MODULE=""])
1498 fi
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001499
Martin v. Löwis130fb172001-07-19 11:00:41 +00001500 if test "$USE_THREAD_MODULE" != "#"
1501 then
1502 # If the above checks didn't disable threads, (at least) OSF1
1503 # needs this '-threads' argument during linking.
1504 case $ac_sys_system in
1505 OSF1) LDLAST=-threads;;
1506 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001507 fi
Martin v. Löwisa7a76d32002-10-04 07:21:24 +00001508
1509 if test "$posix_threads" = yes -a \
1510 "$ac_sys_system" = "SunOS" -a \
1511 "$ac_sys_release" = "5.6"; then
1512 AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
1513 [Defined for Solaris 2.6 bug in pthread header.])
1514 fi
1515
Barry Warsawc0d24d82000-06-29 16:12:00 +00001516fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001517
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001518# Check for enable-ipv6
Martin v. Löwis11437992002-04-12 09:54:03 +00001519AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001520AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001521AC_ARG_ENABLE(ipv6,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001522[ --enable-ipv6 Enable ipv6 (with ipv4) support
1523 --disable-ipv6 Disable ipv6 support],
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001524[ case "$enableval" in
1525 no)
1526 AC_MSG_RESULT(no)
1527 ipv6=no
1528 ;;
1529 *) AC_MSG_RESULT(yes)
1530 AC_DEFINE(ENABLE_IPV6)
1531 ipv6=yes
1532 ;;
1533 esac ],
1534
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001535[
1536dnl the check does not work on cross compilation case...
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001537 AC_TRY_RUN([ /* AF_INET6 available check */
1538#include <sys/types.h>
1539#include <sys/socket.h>
1540main()
1541{
1542 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1543 exit(1);
1544 else
1545 exit(0);
1546}
1547],
1548 AC_MSG_RESULT(yes)
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001549 ipv6=yes,
1550 AC_MSG_RESULT(no)
1551 ipv6=no,
1552 AC_MSG_RESULT(no)
1553 ipv6=no
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00001554)
1555
1556if test "$ipv6" = "yes"; then
1557 AC_MSG_CHECKING(if RFC2553 API is available)
1558 AC_TRY_COMPILE([#include <sys/types.h>
1559#include <netinet/in.h>],
1560 [struct sockaddr_in6 x;
1561x.sin6_scope_id;],
1562 AC_MSG_RESULT(yes)
1563 ipv6=yes,
1564 AC_MSG_RESULT(no, IPv6 disabled)
1565 ipv6=no)
1566fi
1567
1568if test "$ipv6" = "yes"; then
1569 AC_DEFINE(ENABLE_IPV6)
1570fi
1571])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001572
1573ipv6type=unknown
1574ipv6lib=none
1575ipv6trylibc=no
1576
1577if test "$ipv6" = "yes"; then
1578 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00001579 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1580 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001581 case $i in
1582 inria)
1583 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001584 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001585#include <netinet/in.h>
1586#ifdef IPV6_INRIA_VERSION
1587yes
1588#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001589 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001590 ;;
1591 kame)
1592 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001593 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001594#include <netinet/in.h>
1595#ifdef __KAME__
1596yes
1597#endif],
1598 [ipv6type=$i;
1599 ipv6lib=inet6
1600 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001601 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001602 ;;
1603 linux-glibc)
1604 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001605 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001606#include <features.h>
1607#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1608yes
1609#endif],
1610 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001611 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001612 ;;
1613 linux-inet6)
1614 dnl http://www.v6.linux.or.jp/
1615 if test -d /usr/inet6; then
1616 ipv6type=$i
1617 ipv6lib=inet6
1618 ipv6libdir=/usr/inet6/lib
Skip Montanarodecc6a42003-01-01 20:07:49 +00001619 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001620 fi
1621 ;;
1622 solaris)
1623 if test -f /etc/netconfig; then
1624 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1625 ipv6type=$i
1626 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001627 fi
1628 fi
1629 ;;
1630 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001631 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001632#include <sys/param.h>
1633#ifdef _TOSHIBA_INET6
1634yes
1635#endif],
1636 [ipv6type=$i;
1637 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001638 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001639 ;;
1640 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001641 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001642#include </usr/local/v6/include/sys/v6config.h>
1643#ifdef __V6D__
1644yes
1645#endif],
1646 [ipv6type=$i;
1647 ipv6lib=v6;
1648 ipv6libdir=/usr/local/v6/lib;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001649 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001650 ;;
1651 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001652 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001653#include <sys/param.h>
1654#ifdef _ZETA_MINAMI_INET6
1655yes
1656#endif],
1657 [ipv6type=$i;
1658 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00001659 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00001660 ;;
1661 esac
1662 if test "$ipv6type" != "unknown"; then
1663 break
1664 fi
1665 done
1666 AC_MSG_RESULT($ipv6type)
1667fi
1668
1669if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1670 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1671 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1672 echo "using lib$ipv6lib"
1673 else
1674 if test $ipv6trylibc = "yes"; then
1675 echo "using libc"
1676 else
1677 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1678 echo "You need to fetch lib$ipv6lib.a from appropriate"
1679 echo 'ipv6 kit and compile beforehand.'
1680 exit 1
1681 fi
1682 fi
1683fi
1684
Jack Jansen7b8c7542002-04-14 20:12:41 +00001685# Check for universal newline support
Guido van Rossum402905e2002-08-15 13:56:35 +00001686AC_MSG_CHECKING(for --with-universal-newlines)
Jack Jansen7b8c7542002-04-14 20:12:41 +00001687AC_ARG_WITH(universal-newlines,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001688 AC_HELP_STRING(--with(out)-universal-newlines, disable/enable foreign newlines))
Jack Jansen7b8c7542002-04-14 20:12:41 +00001689
1690if test -z "$with_universal_newlines"
1691then with_universal_newlines="yes"
1692fi
Martin v. Löwis7e4cfcb2002-12-19 16:21:49 +00001693if test "$with_universal_newlines" = "no"
Martin v. Löwis03d00d52002-12-19 19:03:31 +00001694then
Martin v. Löwis7e4cfcb2002-12-19 16:21:49 +00001695 echo --without-universal-newlines is unsupported, see README
1696 exit 1
Martin v. Löwis03d00d52002-12-19 19:03:31 +00001697else
Martin v. Löwise8aea582002-04-16 05:51:02 +00001698 AC_DEFINE(WITH_UNIVERSAL_NEWLINES, 1,
1699 [Define if you want to read files with foreign newlines.])
Jack Jansen7b8c7542002-04-14 20:12:41 +00001700fi
1701AC_MSG_RESULT($with_universal_newlines)
1702
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00001703# Check for --with-doc-strings
1704AC_MSG_CHECKING(for --with-doc-strings)
1705AC_ARG_WITH(doc-strings,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001706 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00001707
1708if test -z "$with_doc_strings"
1709then with_doc_strings="yes"
1710fi
1711if test "$with_doc_strings" != "no"
1712then
1713 AC_DEFINE(WITH_DOC_STRINGS, 1,
1714 [Define if you want documentation strings in extension modules])
1715fi
1716AC_MSG_RESULT($with_doc_strings)
1717
Neil Schemenauera35c6882001-02-27 04:45:05 +00001718# Check for Python-specific malloc support
1719AC_MSG_CHECKING(for --with-pymalloc)
1720AC_ARG_WITH(pymalloc,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001721 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
Neil Schemenauer16c22972002-03-22 15:34:49 +00001722
1723if test -z "$with_pymalloc"
1724then with_pymalloc="yes"
1725fi
1726if test "$with_pymalloc" != "no"
1727then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001728 AC_DEFINE(WITH_PYMALLOC, 1,
1729 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00001730fi
1731AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00001732
Barry Warsawef82cd72000-06-30 16:21:01 +00001733# Check for --with-wctype-functions
1734AC_MSG_CHECKING(for --with-wctype-functions)
1735AC_ARG_WITH(wctype-functions,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001736 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
1737[
Barry Warsawef82cd72000-06-30 16:21:01 +00001738if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001739then
1740 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
1741 [Define if you want wctype.h functions to be used instead of the
1742 one supplied by Python itself. (see Include/unicodectype.h).])
1743 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00001744else AC_MSG_RESULT(no)
1745fi],
1746[AC_MSG_RESULT(no)])
1747
Guido van Rossum68242b51996-05-28 22:53:03 +00001748# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001749AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00001750DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001751
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001752AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00001753AC_ARG_WITH(sgi-dl,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001754 AC_HELP_STRING(--with-sgi-dl=DIRECTORY, IRIX 4 dynamic linking),
1755[
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001756AC_MSG_RESULT($withval)
Martin v. Löwis9ef33762002-12-02 22:23:56 +00001757echo --with-sgi-dl is unsupported, see README
Martin v. Löwis779ffc02002-12-02 22:17:01 +00001758exit 1
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001759AC_DEFINE(WITH_SGI_DL, 1,
1760 [Define if you want to use SGI (IRIX 4) dynamic linking.
1761 This requires the "dl" library by Jack Jansen,
1762 ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
1763 Do not bother on IRIX 5, it already has dynamic linking using SunOS
1764 style shared libraries])
Guido van Rossume97ee181999-12-20 21:27:22 +00001765DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001766dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001767if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001768then LDFLAGS="$LDFLAGS -L$dldir"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001769else AC_MSG_ERROR([proper usage is --with-sgi-dl=DIRECTORY])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001770fi
1771DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001772LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001773
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001774AC_MSG_CHECKING(for --with-dl-dld)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001775AC_ARG_WITH(dl-dld,
1776 AC_HELP_STRING(--with-dl-dld=DL_DIR, GNU dynamic linking),
1777[
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001778AC_MSG_RESULT($withval)
Martin v. Löwis9ef33762002-12-02 22:23:56 +00001779echo --with-dl-dld is unsupported, see README
Martin v. Löwis779ffc02002-12-02 22:17:01 +00001780exit 1
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001781AC_DEFINE(WITH_DL_DLD, 1,
1782 [Define if you want to emulate SGI (IRIX 4) dynamic linking.
1783 This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4),
1784 Sequent Symmetry (Dynix), and Atari ST.
1785 This requires the 'dl-dld' library,
1786 ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z,
1787 as well as the 'GNU dld' library,
1788 ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z.
1789 Do not bother on SunOS 4 or 5, they already have dynamic linking using
1790 shared libraries.])
Guido van Rossume97ee181999-12-20 21:27:22 +00001791DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001792dldir=`echo "$withval" | sed 's/,.*//'`
1793dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001794if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001795then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001796else AC_MSG_ERROR([proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001797fi
1798DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001799LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001800
Guido van Rossume97ee181999-12-20 21:27:22 +00001801# the dlopen() function means we might want to use dynload_shlib.o. some
1802# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001803AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001804
1805# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1806# loading of modules.
1807AC_SUBST(DYNLOADFILE)
1808AC_MSG_CHECKING(DYNLOADFILE)
1809if test -z "$DYNLOADFILE"
1810then
1811 case $ac_sys_system/$ac_sys_release in
1812 AIX*) DYNLOADFILE="dynload_aix.o";;
1813 BeOS*) DYNLOADFILE="dynload_beos.o";;
1814 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001815 Darwin/*) DYNLOADFILE="dynload_next.o";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001816 atheos*) DYNLOADFILE="dynload_atheos.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001817 *)
1818 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1819 # out any dynamic loading
1820 if test "$ac_cv_func_dlopen" = yes
1821 then DYNLOADFILE="dynload_shlib.o"
1822 else DYNLOADFILE="dynload_stub.o"
1823 fi
1824 ;;
1825 esac
1826fi
1827AC_MSG_RESULT($DYNLOADFILE)
1828if test "$DYNLOADFILE" != "dynload_stub.o"
1829then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001830 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
1831 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00001832fi
1833
Jack Jansenc49e5b72001-06-19 15:00:23 +00001834# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1835
1836AC_SUBST(MACHDEP_OBJS)
1837AC_MSG_CHECKING(MACHDEP_OBJS)
1838if test -z "$MACHDEP_OBJS"
1839then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001840 MACHDEP_OBJS=$extra_machdep_objs
1841else
1842 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00001843fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001844AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00001845
Guido van Rossum627b2d71993-12-24 10:39:16 +00001846# checks for library functions
Martin v. Löwisd5843682002-11-21 20:41:28 +00001847AC_CHECK_FUNCS(alarm chown clock confstr ctermid execv \
Fred Drake6b3cc522002-04-15 19:20:27 +00001848 fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \
Martin v. Löwis438b5342002-12-27 10:16:42 +00001849 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
1850 getpriority getpwent getwd \
Neal Norwitz10b214c2003-02-13 02:11:10 +00001851 hstrerror inet_aton inet_pton kill killpg lchown lstat mkfifo mknod mktime \
Martin v. Löwisa5f09072002-10-11 05:37:59 +00001852 mremap nice pathconf pause plock poll pthread_init \
Guido van Rossum162e38c2003-02-19 15:25:10 +00001853 putenv readlink realpath \
Martin v. Löwisd5843682002-11-21 20:41:28 +00001854 select setegid seteuid setgid \
Martin v. Löwis4daacb12003-03-28 18:37:01 +00001855 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00001856 sigaction siginterrupt sigrelse strftime strptime \
Michael W. Hudson34f20ea2002-05-27 15:08:24 +00001857 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Martin v. Löwis438b5342002-12-27 10:16:42 +00001858 truncate uname unsetenv utimes waitpid wcscoll _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001859
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00001860# For some functions, having a definition is not sufficient, since
1861# we want to take their address.
1862AC_MSG_CHECKING(for chroot)
1863AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
1864 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
1865 AC_MSG_RESULT(yes),
1866 AC_MSG_RESULT(no)
1867)
1868AC_MSG_CHECKING(for link)
1869AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
1870 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
1871 AC_MSG_RESULT(yes),
1872 AC_MSG_RESULT(no)
1873)
1874AC_MSG_CHECKING(for symlink)
1875AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
1876 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
1877 AC_MSG_RESULT(yes),
1878 AC_MSG_RESULT(no)
1879)
1880
Martin v. Löwisd5843682002-11-21 20:41:28 +00001881# On some systems (eg. FreeBSD 5), we would find a definition of the
1882# functions ctermid_r, setgroups in the library, but no prototype
1883# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
1884# address to avoid compiler warnings and potential miscompilations
1885# because of the missing prototypes.
1886
1887AC_MSG_CHECKING(for ctermid_r)
1888AC_TRY_COMPILE([
1889#include "confdefs.h"
1890#include <stdio.h>
1891], void* p = ctermid_r,
1892 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
1893 AC_MSG_RESULT(yes),
1894 AC_MSG_RESULT(no)
1895)
1896
1897AC_MSG_CHECKING(for setgroups)
1898AC_TRY_COMPILE([
1899#include "confdefs.h"
1900#include <unistd.h.h>
1901],
1902void* p = setgroups,
1903 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
1904 AC_MSG_RESULT(yes),
1905 AC_MSG_RESULT(no)
1906)
1907
Fred Drake8cef4cf2000-06-28 16:40:38 +00001908# check for openpty and forkpty
1909
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001910AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"]))
1911AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"]))
Fred Drake8cef4cf2000-06-28 16:40:38 +00001912
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001913# check for long file support functions
1914AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1915
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001916AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001917AC_CHECK_FUNCS(getpgrp,
1918 AC_TRY_COMPILE([#include <unistd.h>],
1919 [getpgrp(0);],
1920 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
1921 [Define if getpgrp() must be called as getpgrp(0).])
1922 )
1923)
Jeremy Hyltonaf4c12f2002-07-18 20:25:46 +00001924AC_FUNC_SETPGRP(AC_DEFINE(SETPGRP_HAVE_ARG, 1,
1925 [Define if setpgrp() must be called as setpgrp(0, 0).])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001926)
1927AC_CHECK_FUNCS(gettimeofday,
1928 AC_TRY_COMPILE([#include <sys/time.h>],
1929 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
1930 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
1931 [Define if gettimeofday() does not have second (timezone) argument
1932 This is the case on Motorola V4 (R40V4.2)])
1933 )
1934)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001935
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00001936AC_MSG_CHECKING(for major, minor, and makedev)
Martin v. Löwise3271202002-11-07 07:42:30 +00001937AC_TRY_LINK([
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001938#if defined(MAJOR_IN_MKDEV)
1939#include <sys/mkdev.h>
1940#elif defined(MAJOR_IN_SYSMACROS)
1941#include <sys/sysmacros.h>
1942#else
1943#include <sys/types.h>
1944#endif
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00001945],[
1946 makedev(major(0),minor(0));
1947],[
1948 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
1949 [Define to 1 if you have the device macros.])
1950 AC_MSG_RESULT(yes)
1951],[
1952 AC_MSG_RESULT(no)
1953])
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001954
1955# On OSF/1 V5.1, getaddrinfo is available, but a define
1956# for [no]getaddrinfo in netdb.h.
1957AC_MSG_CHECKING(for getaddrinfo)
1958AC_TRY_LINK([
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00001959#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001960#include <sys/socket.h>
1961#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00001962#include <stdio.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00001963],[
1964getaddrinfo(NULL, NULL, NULL, NULL);
1965], [
1966AC_MSG_RESULT(yes)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001967AC_MSG_CHECKING(getaddrinfo bug)
1968AC_TRY_RUN([
1969#include <sys/types.h>
1970#include <netdb.h>
1971#include <string.h>
1972#include <sys/socket.h>
1973#include <netinet/in.h>
1974
1975main()
1976{
1977 int passive, gaierr, inet4 = 0, inet6 = 0;
1978 struct addrinfo hints, *ai, *aitop;
1979 char straddr[INET6_ADDRSTRLEN], strport[16];
1980
1981 for (passive = 0; passive <= 1; passive++) {
1982 memset(&hints, 0, sizeof(hints));
1983 hints.ai_family = AF_UNSPEC;
1984 hints.ai_flags = passive ? AI_PASSIVE : 0;
1985 hints.ai_socktype = SOCK_STREAM;
1986 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1987 (void)gai_strerror(gaierr);
1988 goto bad;
1989 }
1990 for (ai = aitop; ai; ai = ai->ai_next) {
1991 if (ai->ai_addr == NULL ||
1992 ai->ai_addrlen == 0 ||
1993 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1994 straddr, sizeof(straddr), strport, sizeof(strport),
1995 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1996 goto bad;
1997 }
1998 switch (ai->ai_family) {
1999 case AF_INET:
2000 if (strcmp(strport, "54321") != 0) {
2001 goto bad;
2002 }
2003 if (passive) {
2004 if (strcmp(straddr, "0.0.0.0") != 0) {
2005 goto bad;
2006 }
2007 } else {
2008 if (strcmp(straddr, "127.0.0.1") != 0) {
2009 goto bad;
2010 }
2011 }
2012 inet4++;
2013 break;
2014 case AF_INET6:
2015 if (strcmp(strport, "54321") != 0) {
2016 goto bad;
2017 }
2018 if (passive) {
2019 if (strcmp(straddr, "::") != 0) {
2020 goto bad;
2021 }
2022 } else {
2023 if (strcmp(straddr, "::1") != 0) {
2024 goto bad;
2025 }
2026 }
2027 inet6++;
2028 break;
2029 case AF_UNSPEC:
2030 goto bad;
2031 break;
2032 default:
2033 /* another family support? */
2034 break;
2035 }
2036 }
2037 }
2038
2039 if (!(inet4 == 0 || inet4 == 2))
2040 goto bad;
2041 if (!(inet6 == 0 || inet6 == 2))
2042 goto bad;
2043
2044 if (aitop)
2045 freeaddrinfo(aitop);
2046 exit(0);
2047
2048 bad:
2049 if (aitop)
2050 freeaddrinfo(aitop);
2051 exit(1);
2052}
2053],
2054AC_MSG_RESULT(good)
2055buggygetaddrinfo=no,
2056AC_MSG_RESULT(buggy)
2057buggygetaddrinfo=yes,
2058AC_MSG_RESULT(buggy)
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002059buggygetaddrinfo=yes)], [
2060AC_MSG_RESULT(no)
2061buggygetaddrinfo=yes
2062])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002063
2064if test "$buggygetaddrinfo" = "yes"; then
2065 if test "$ipv6" = "yes"; then
2066 echo 'Fatal: You must get working getaddrinfo() function.'
2067 echo ' or you can specify "--disable-ipv6"'.
2068 exit 1
2069 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002070else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002071 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002072fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00002073AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002074
Guido van Rossum627b2d71993-12-24 10:39:16 +00002075# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002076AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00002077AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002078AC_STRUCT_TIMEZONE
Martin v. Löwis60a5d722002-10-16 20:28:25 +00002079AC_CHECK_MEMBERS([struct stat.st_rdev])
2080AC_CHECK_MEMBERS([struct stat.st_blksize])
Guido van Rossum98bf58f2001-10-18 20:34:25 +00002081AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002082
2083AC_MSG_CHECKING(for time.h that defines altzone)
2084AC_CACHE_VAL(ac_cv_header_time_altzone,
2085[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2086 ac_cv_header_time_altzone=yes,
2087 ac_cv_header_time_altzone=no)])
2088AC_MSG_RESULT($ac_cv_header_time_altzone)
2089if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002090 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002091fi
2092
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002093was_it_defined=no
2094AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002095AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002096#include <sys/types.h>
2097#include <sys/select.h>
2098#include <sys/time.h>
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002099], [;], [
2100 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
2101 [Define if you can safely include both <sys/select.h> and <sys/time.h>
2102 (which you can't on SCO ODT 3.0).])
2103 was_it_defined=yes
2104])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002105AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00002106
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002107AC_MSG_CHECKING(for addrinfo)
2108AC_CACHE_VAL(ac_cv_struct_addrinfo,
2109AC_TRY_COMPILE([
2110# include <netdb.h>],
2111 [struct addrinfo a],
2112 ac_cv_struct_addrinfo=yes,
2113 ac_cv_struct_addrinfo=no))
2114AC_MSG_RESULT($ac_cv_struct_addrinfo)
2115if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002116 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002117fi
2118
2119AC_MSG_CHECKING(for sockaddr_storage)
2120AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
2121AC_TRY_COMPILE([
2122# include <sys/types.h>
2123# include <sys/socket.h>],
2124 [struct sockaddr_storage s],
2125 ac_cv_struct_sockaddr_storage=yes,
2126 ac_cv_struct_sockaddr_storage=no))
2127AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
2128if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002129 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002130fi
2131
Guido van Rossum627b2d71993-12-24 10:39:16 +00002132# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002133
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002134AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002135AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002136
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002137works=no
2138AC_MSG_CHECKING(for working volatile)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002139AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
2140 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
2141)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002142AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00002143
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002144works=no
2145AC_MSG_CHECKING(for working signed char)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002146AC_TRY_COMPILE([], [signed char c;], works=yes,
2147 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
2148)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002149AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002150
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002151have_prototypes=no
2152AC_MSG_CHECKING(for prototypes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002153AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
2154 AC_DEFINE(HAVE_PROTOTYPES, 1,
2155 [Define if your compiler supports function prototype])
2156 have_prototypes=yes
2157])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002158AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002159
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002160works=no
2161AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002162AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002163#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00002164int foo(int x, ...) {
2165 va_list va;
2166 va_start(va, x);
2167 va_arg(va, int);
2168 va_arg(va, char *);
2169 va_arg(va, double);
2170 return 0;
2171}
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002172], [return foo(10, "", 3.14);], [
2173 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
2174 [Define if your compiler supports variable length function prototypes
2175 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
2176 works=yes
2177])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002178AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002179
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002180if test "$have_prototypes" = yes; then
2181bad_prototypes=no
2182AC_MSG_CHECKING(for bad exec* prototypes)
2183AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002184 AC_DEFINE(BAD_EXEC_PROTOTYPES, 1,
2185 [Define if your <unistd.h> contains bad prototypes for exec*()
2186 (as it does on SGI IRIX 4.x)])
2187 bad_prototypes=yes
2188)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002189AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00002190fi
2191
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002192# check if sockaddr has sa_len member
2193AC_MSG_CHECKING(if sockaddr has sa_len member)
2194AC_TRY_COMPILE([#include <sys/types.h>
2195#include <sys/socket.h>],
2196[struct sockaddr x;
2197x.sa_len = 0;],
2198 AC_MSG_RESULT(yes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002199 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002200 AC_MSG_RESULT(no))
2201
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002202va_list_is_array=no
2203AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002204AC_TRY_COMPILE([
2205#ifdef HAVE_STDARG_PROTOTYPES
2206#include <stdarg.h>
2207#else
2208#include <varargs.h>
2209#endif
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002210], [va_list list1, list2; list1 = list2;], , [
2211 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
2212 va_list_is_array=yes
2213])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00002214AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002215
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002216# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
Martin v. Löwis11437992002-04-12 09:54:03 +00002217AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
2218 [Define this if you have some version of gethostbyname_r()])
2219
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002220AC_CHECK_FUNC(gethostbyname_r, [
2221 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2222 AC_MSG_CHECKING([gethostbyname_r with 6 args])
2223 OLD_CFLAGS=$CFLAGS
2224 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
2225 AC_TRY_COMPILE([
2226# include <netdb.h>
2227 ], [
2228 char *name;
2229 struct hostent *he, *res;
2230 char buffer[2048];
2231 int buflen = 2048;
2232 int h_errnop;
2233
2234 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
2235 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00002236 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002237 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
2238 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002239 AC_MSG_RESULT(yes)
2240 ], [
2241 AC_MSG_RESULT(no)
2242 AC_MSG_CHECKING([gethostbyname_r with 5 args])
2243 AC_TRY_COMPILE([
2244# include <netdb.h>
2245 ], [
2246 char *name;
2247 struct hostent *he;
2248 char buffer[2048];
2249 int buflen = 2048;
2250 int h_errnop;
2251
2252 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
2253 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00002254 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002255 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
2256 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002257 AC_MSG_RESULT(yes)
2258 ], [
2259 AC_MSG_RESULT(no)
2260 AC_MSG_CHECKING([gethostbyname_r with 3 args])
2261 AC_TRY_COMPILE([
2262# include <netdb.h>
2263 ], [
2264 char *name;
2265 struct hostent *he;
2266 struct hostent_data data;
2267
2268 (void) gethostbyname_r(name, he, &data);
2269 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00002270 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002271 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
2272 [Define this if you have the 3-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002273 AC_MSG_RESULT(yes)
2274 ], [
2275 AC_MSG_RESULT(no)
2276 ])
2277 ])
2278 ])
2279 CFLAGS=$OLD_CFLAGS
2280], [
Thomas Wouters3a584202000-08-05 23:28:51 +00002281 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002282])
2283AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
2284AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
2285AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00002286AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00002287AC_SUBST(HAVE_GETHOSTBYNAME)
2288
Guido van Rossum627b2d71993-12-24 10:39:16 +00002289# checks for system services
2290# (none yet)
2291
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002292# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00002293AC_CHECK_FUNC(__fpu_control,
2294 [],
2295 [AC_CHECK_LIB(ieee, __fpu_control)
2296])
Guido van Rossum627b2d71993-12-24 10:39:16 +00002297
Guido van Rossum93274221997-05-09 02:42:00 +00002298# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00002299AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002300AC_ARG_WITH(fpectl,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002301 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
2302[
Guido van Rossum93274221997-05-09 02:42:00 +00002303if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002304then
2305 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
2306 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
2307 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00002308else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00002309fi],
2310[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00002311
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002312# check for --with-libm=...
2313AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00002314case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00002315Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002316BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00002317*) LIBM=-lm
2318esac
Guido van Rossum93274221997-05-09 02:42:00 +00002319AC_MSG_CHECKING(for --with-libm=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002320AC_ARG_WITH(libm,
2321 AC_HELP_STRING(--with-libm=STRING, math library),
2322[
Guido van Rossum93274221997-05-09 02:42:00 +00002323if test "$withval" = no
2324then LIBM=
2325 AC_MSG_RESULT(force LIBM empty)
2326elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002327then LIBM=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002328 AC_MSG_RESULT(set LIBM="$withval")
2329else AC_MSG_ERROR([proper usage is --with-libm=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00002330fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002331[AC_MSG_RESULT(default LIBM="$LIBM")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002332
2333# check for --with-libc=...
2334AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00002335AC_MSG_CHECKING(for --with-libc=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002336AC_ARG_WITH(libc,
2337 AC_HELP_STRING(--with-libc=STRING, C library),
2338[
Guido van Rossum93274221997-05-09 02:42:00 +00002339if test "$withval" = no
2340then LIBC=
2341 AC_MSG_RESULT(force LIBC empty)
2342elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002343then LIBC=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002344 AC_MSG_RESULT(set LIBC="$withval")
2345else AC_MSG_ERROR([proper usage is --with-libc=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00002346fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002347[AC_MSG_RESULT(default LIBC="$LIBC")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002348
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00002349# check for hypot() in math library
2350LIBS_SAVE=$LIBS
2351LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00002352AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00002353LIBS=$LIBS_SAVE
2354
Guido van Rossumef2255b2000-03-10 22:30:29 +00002355# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002356AC_CHECK_HEADER(wchar.h, [
2357 AC_DEFINE(HAVE_WCHAR_H, 1,
2358 [Define if the compiler provides a wchar.h header file.])
2359 wchar_h="yes"
2360],
Guido van Rossumef2255b2000-03-10 22:30:29 +00002361wchar_h="no"
2362)
2363
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002364# determine wchar_t size
2365if test "$wchar_h" = yes
2366then
Guido van Rossum67b26592001-10-20 14:21:45 +00002367 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002368fi
2369
2370AC_MSG_CHECKING(what type to use for unicode)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002371dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002372AC_ARG_ENABLE(unicode,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002373 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
2374 [],
2375 [enable_unicode=yes])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002376
2377if test $enable_unicode = yes
2378then
Martin v. Löwisfd917792001-06-27 20:22:04 +00002379 # Without any arguments, Py_UNICODE defaults to two-byte mode
2380 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002381fi
2382
Martin v. Löwis0036cba2002-04-12 09:58:45 +00002383AH_TEMPLATE(Py_UNICODE_SIZE,
2384 [Define as the size of the unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002385case "$enable_unicode" in
2386ucs2) unicode_size="2"
2387 AC_DEFINE(Py_UNICODE_SIZE,2)
2388 ;;
2389ucs4) unicode_size="4"
2390 AC_DEFINE(Py_UNICODE_SIZE,4)
2391 ;;
2392esac
2393
Martin v. Löwis11437992002-04-12 09:54:03 +00002394AH_TEMPLATE(PY_UNICODE_TYPE,
2395 [Define as the integral type used for Unicode representation.])
Martin v. Löwis0036cba2002-04-12 09:58:45 +00002396
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002397AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002398if test "$enable_unicode" = "no"
2399then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002400 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002401 AC_MSG_RESULT(not used)
2402else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00002403 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002404 AC_DEFINE(Py_USING_UNICODE, 1,
2405 [Define if you want to have a Unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002406 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
2407 then
2408 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002409 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
2410 [Define if you have a useable wchar_t type defined in wchar.h; useable
2411 means wchar_t must be 16-bit unsigned type. (see
2412 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00002413 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
2414 elif test "$ac_cv_sizeof_short" = "$unicode_size"
2415 then
2416 PY_UNICODE_TYPE="unsigned short"
2417 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
2418 elif test "$ac_cv_sizeof_long" = "$unicode_size"
2419 then
2420 PY_UNICODE_TYPE="unsigned long"
2421 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
2422 else
2423 PY_UNICODE_TYPE="no type found"
2424 fi
2425 AC_MSG_RESULT($PY_UNICODE_TYPE)
2426fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00002427
2428# check for endianness
2429AC_C_BIGENDIAN
2430
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002431# Check whether right shifting a negative integer extends the sign bit
2432# or fills with zeros (like the Cray J90, according to Tim Peters).
2433AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00002434AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002435AC_TRY_RUN([
2436int main()
2437{
Vladimir Marangozova6180282000-07-12 05:05:06 +00002438 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002439}
Guido van Rossum3065c942001-09-17 04:03:14 +00002440],
2441ac_cv_rshift_extends_sign=yes,
2442ac_cv_rshift_extends_sign=no,
2443ac_cv_rshift_extends_sign=yes)])
Vladimir Marangozova6180282000-07-12 05:05:06 +00002444AC_MSG_RESULT($ac_cv_rshift_extends_sign)
2445if test "$ac_cv_rshift_extends_sign" = no
2446then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002447 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
2448 [Define if i>>j for signed int i does not extend the sign bit
2449 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00002450fi
2451
Guido van Rossumcadfaec2001-01-05 14:45:49 +00002452# check for getc_unlocked and related locking functions
2453AC_MSG_CHECKING(for getc_unlocked() and friends)
2454AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
2455AC_TRY_LINK([#include <stdio.h>],[
2456 FILE *f = fopen("/dev/null", "r");
2457 flockfile(f);
2458 getc_unlocked(f);
2459 funlockfile(f);
2460], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
2461AC_MSG_RESULT($ac_cv_have_getc_unlocked)
2462if test "$ac_cv_have_getc_unlocked" = yes
2463then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002464 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
2465 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00002466fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00002467
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00002468# check for readline 2.2
2469AC_TRY_CPP([#include <readline/readline.h>],
2470have_readline=yes, have_readline=no)
2471if test $have_readline = yes
2472then
2473 AC_EGREP_HEADER([extern int rl_completion_append_character;],
2474 [readline/readline.h],
2475 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
2476 [Define if you have readline 2.2]), )
2477fi
2478
Martin v. Löwis0daad592001-09-30 21:09:59 +00002479# check for readline 4.0
2480AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002481 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
2482 [Define if you have readline 4.0]), , -ltermcap)
Martin v. Löwis0daad592001-09-30 21:09:59 +00002483
Guido van Rossum353ae582001-07-10 16:45:32 +00002484# check for readline 4.2
2485AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002486 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
2487 [Define if you have readline 4.2]), , -ltermcap)
Guido van Rossum353ae582001-07-10 16:45:32 +00002488
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002489AC_MSG_CHECKING(for broken nice())
2490AC_CACHE_VAL(ac_cv_broken_nice, [
2491AC_TRY_RUN([
2492int main()
2493{
2494 int val1 = nice(1);
2495 if (val1 != -1 && val1 == nice(2))
2496 exit(0);
2497 exit(1);
2498}
Guido van Rossum3065c942001-09-17 04:03:14 +00002499],
2500ac_cv_broken_nice=yes,
2501ac_cv_broken_nice=no,
2502ac_cv_broken_nice=no)])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002503AC_MSG_RESULT($ac_cv_broken_nice)
2504if test "$ac_cv_broken_nice" = yes
2505then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002506 AC_DEFINE(HAVE_BROKEN_NICE, 1,
2507 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00002508fi
2509
Guido van Rossumd11b62e2003-03-14 21:51:36 +00002510# tzset(3) exists and works like we expect it to
2511AC_MSG_CHECKING(for working tzset())
2512AC_CACHE_VAL(ac_cv_working_tzset, [
2513AC_TRY_RUN([
2514#include <stdlib.h>
2515#include <time.h>
2516int main()
2517{
2518 int gmt_hour;
2519 int eastern_hour;
2520 time_t now;
2521 now = time((time_t*)NULL);
2522 putenv("TZ=GMT");
2523 tzset();
2524 gmt_hour = localtime(&now)->tm_hour;
2525 putenv("TZ=US/Eastern");
2526 tzset();
2527 eastern_hour = localtime(&now)->tm_hour;
2528 if (eastern_hour == gmt_hour)
2529 exit(1);
2530 exit(0);
2531}
2532],
2533ac_cv_working_tzset=yes,
2534ac_cv_working_tzset=no,
2535ac_cv_working_tzset=no)])
2536AC_MSG_RESULT($ac_cv_working_tzset)
2537if test "$ac_cv_working_tzset" = yes
2538then
2539 AC_DEFINE(HAVE_WORKING_TZSET, 1,
2540 [Define if tzset() actually switches the local timezone in a meaningful way.])
2541fi
2542
Martin v. Löwis94717ed2002-09-09 14:24:16 +00002543# Look for subsecond timestamps in struct stat
2544AC_MSG_CHECKING(for tv_nsec in struct stat)
2545AC_CACHE_VAL(ac_cv_stat_tv_nsec,
2546AC_TRY_COMPILE([#include <sys/stat.h>], [
2547struct stat st;
2548st.st_mtim.tv_nsec = 1;
2549],
Martin v. Löwisa32c9942002-09-09 16:17:47 +00002550ac_cv_stat_tv_nsec=yes,
Martin v. Löwis94717ed2002-09-09 14:24:16 +00002551ac_cv_stat_tv_nsec=no,
2552ac_cv_stat_tv_nsec=no))
2553AC_MSG_RESULT($ac_cv_stat_tv_nsec)
2554if test "$ac_cv_stat_tv_nsec" = yes
2555then
2556 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
2557 [Define if you have struct stat.st_mtim.tv_nsec])
2558fi
2559
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002560# On HP/UX 11.0, mvwdelch is a block with a return statement
2561AC_MSG_CHECKING(whether mvwdelch is an expression)
2562AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
2563AC_TRY_COMPILE([#include <curses.h>], [
2564 int rtn;
2565 rtn = mvwdelch(0,0,0);
2566], ac_cv_mvwdelch_is_expression=yes,
2567 ac_cv_mvwdelch_is_expression=no,
2568 ac_cv_mvwdelch_is_expression=yes))
2569AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
2570
2571if test "$ac_cv_mvwdelch_is_expression" = yes
2572then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002573 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
2574 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002575fi
2576
2577AC_MSG_CHECKING(whether WINDOW has _flags)
2578AC_CACHE_VAL(ac_cv_window_has_flags,
2579AC_TRY_COMPILE([#include <curses.h>], [
2580 WINDOW *w;
2581 w->_flags = 0;
2582], ac_cv_window_has_flags=yes,
2583 ac_cv_window_has_flags=no,
2584 ac_cv_window_has_flags=no))
2585AC_MSG_RESULT($ac_cv_window_has_flags)
2586
2587
2588if test "$ac_cv_window_has_flags" = yes
2589then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002590 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
2591 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00002592fi
2593
Martin v. Löwis24a880b2002-12-31 12:55:15 +00002594AC_MSG_CHECKING(for /dev/ptmx)
2595
2596if test -e /dev/ptmx
2597then
2598 AC_MSG_RESULT(yes)
2599 AC_DEFINE(HAVE_DEV_PTMX, 1,
2600 [Define if we have /dev/ptmx.])
2601else
2602 AC_MSG_RESULT(no)
2603fi
2604
Neal Norwitz865400f2003-03-21 01:42:58 +00002605AC_MSG_CHECKING(for /dev/ptc)
2606
2607if test -e /dev/ptc
2608then
2609 AC_MSG_RESULT(yes)
2610 AC_DEFINE(HAVE_DEV_PTC, 1,
2611 [Define if we have /dev/ptc.])
2612else
2613 AC_MSG_RESULT(no)
2614fi
2615
Martin v. Löwis01c04012002-11-11 14:58:44 +00002616AC_CHECK_TYPE(socklen_t,,
2617 AC_DEFINE(socklen_t,int,
2618 Define to `int' if <sys/socket.h> does not define.),[
2619#ifdef HAVE_SYS_TYPES_H
2620#include <sys/types.h>
2621#endif
Guido van Rossum95713eb2000-05-18 20:53:31 +00002622#ifdef HAVE_SYS_SOCKET_H
2623#include <sys/socket.h>
2624#endif
Martin v. Löwis01c04012002-11-11 14:58:44 +00002625])
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002626
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00002627AC_SUBST(THREADHEADERS)
2628
2629for h in `(cd $srcdir;echo Python/thread_*.h)`
2630do
2631 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
2632done
2633
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002634AC_SUBST(SRCDIRS)
Jack Jansen0b06be72002-06-21 14:48:38 +00002635SRCDIRS="Parser Grammar Objects Python Modules Mac Mac/Python"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00002636AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002637for dir in $SRCDIRS; do
2638 if test ! -d $dir; then
2639 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00002640 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002641done
2642AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00002643
Guido van Rossum627b2d71993-12-24 10:39:16 +00002644# generate output files
Martin v. Löwis88afe662002-10-26 13:47:44 +00002645AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
2646AC_OUTPUT
Neil Schemenauer61c51152001-01-26 16:18:16 +00002647
2648echo "creating Setup"
2649if test ! -f Modules/Setup
2650then
2651 cp $srcdir/Modules/Setup.dist Modules/Setup
2652fi
2653
2654echo "creating Setup.local"
2655if test ! -f Modules/Setup.local
2656then
2657 echo "# Edit this file for local setup changes" >Modules/Setup.local
2658fi
2659
2660echo "creating Makefile"
2661$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
2662 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00002663 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00002664mv config.c Modules