blob: 6f317c87bfbc8276c5df19df4800538327952db5 [file] [log] [blame]
Benjamin Petersond7c77842008-05-26 13:01:25 +00001dnl ***********************************************
2dnl * Please run autoreconf to test your changes! *
3dnl ***********************************************
Benjamin Peterson98b1b022008-11-30 14:43:23 +00004dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.61).
Martin v. Löwis88afe662002-10-26 13:47:44 +00005
6# Set VERSION so we only need to edit in one place (i.e., here)
Martin v. Löwis174440b2008-10-03 08:59:41 +00007m4_define(PYTHON_VERSION, 2.7)
Martin v. Löwis88afe662002-10-26 13:47:44 +00008
Alexandre Vassalotti130ae152009-07-18 00:31:06 +00009dnl Some m4 magic to ensure that the configure script is generated
10dnl by the correct autoconf version.
11m4_define([version_required],
12[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), 0,
13 [],
14 [m4_fatal([Autoconf version $1 is required for Python], 63)])
15])
16version_required(2.61)
17
Guido van Rossum76be6ed1995-01-02 18:33:54 +000018AC_REVISION($Revision$)
Georg Brandl464432d2009-05-20 18:24:08 +000019AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
Martin v. Löwis88afe662002-10-26 13:47:44 +000020AC_CONFIG_SRCDIR([Include/object.h])
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +000021AC_CONFIG_HEADER(pyconfig.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +000022
Georg Brandlbcd64a32009-03-31 21:45:18 +000023dnl Ensure that if prefix is specified, it does not end in a slash. If
24dnl it does, we get path names containing '//' which is both ugly and
25dnl can cause trouble.
26
27dnl Last slash shouldn't be stripped if prefix=/
28if test "$prefix" != "/"; then
29 prefix=`echo "$prefix" | sed -e 's/\/$//g'`
30fi
31
Martin v. Löwis8316feb2003-06-14 07:48:07 +000032dnl This is for stuff that absolutely must end up in pyconfig.h.
33dnl Please use pyport.h instead, if possible.
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000034AH_TOP([
35#ifndef Py_PYCONFIG_H
36#define Py_PYCONFIG_H
37])
Martin v. Löwis11437992002-04-12 09:54:03 +000038AH_BOTTOM([
Martin v. Löwis11437992002-04-12 09:54:03 +000039/* Define the macros needed if on a UnixWare 7.x system. */
40#if defined(__USLC__) && defined(__SCO_VERSION__)
41#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
42#endif
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000043
44#endif /*Py_PYCONFIG_H*/
Martin v. Löwis11437992002-04-12 09:54:03 +000045])
46
Martin v. Löwis8316feb2003-06-14 07:48:07 +000047# We don't use PACKAGE_ variables, and they cause conflicts
48# with other autoconf-based packages that include Python.h
49grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
50rm confdefs.h
51mv confdefs.h.new confdefs.h
52
Guido van Rossum642b6781997-07-19 19:35:41 +000053AC_SUBST(VERSION)
Martin v. Löwis88afe662002-10-26 13:47:44 +000054VERSION=PYTHON_VERSION
Guido van Rossum642b6781997-07-19 19:35:41 +000055
Martin v. Löwis1142de32002-03-29 16:28:31 +000056AC_SUBST(SOVERSION)
57SOVERSION=1.0
58
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +000059# The later defininition of _XOPEN_SOURCE disables certain features
60# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
61AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
62
Martin v. Löwisbcd93962003-05-03 10:32:18 +000063# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
64# certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
65# them.
66AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
67
Andrew MacIntyreabccf412003-07-02 13:53:25 +000068# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
69# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
70# them.
71AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
72
Martin v. Löwisd6320502004-08-12 13:45:08 +000073# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
74# u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
75AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
76
Ronald Oussoren5640ce22008-06-05 12:58:24 +000077# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
78# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
79# them.
80AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
81
82
Martin v. Löwise981a4e2002-11-11 13:26:51 +000083define_xopen_source=yes
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +000084
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +000085# Arguments passed to configure.
86AC_SUBST(CONFIG_ARGS)
87CONFIG_ARGS="$ac_configure_args"
88
Ronald Oussoren3c0a1262010-01-17 19:27:57 +000089AC_MSG_CHECKING([for --enable-universalsdk])
Ronald Oussoren988117f2006-04-29 11:31:35 +000090AC_ARG_ENABLE(universalsdk,
Brett Cannon91a1dec2008-02-13 19:15:44 +000091 AC_HELP_STRING(--enable-universalsdk@<:@=SDKDIR@:>@, Build against Mac OS X 10.4u SDK (ppc/i386)),
Ronald Oussoren988117f2006-04-29 11:31:35 +000092[
93 case $enableval in
94 yes)
95 enableval=/Developer/SDKs/MacOSX10.4u.sdk
Ronald Oussoren3c0a1262010-01-17 19:27:57 +000096 if test ! -d "${enableval}"
97 then
98 enableval=/
99 fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000100 ;;
101 esac
102 case $enableval in
103 no)
104 UNIVERSALSDK=
105 enable_universalsdk=
106 ;;
107 *)
108 UNIVERSALSDK=$enableval
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000109 if test ! -d "${UNIVERSALSDK}"
110 then
111 AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
112 fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000113 ;;
114 esac
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000115
Ronald Oussoren988117f2006-04-29 11:31:35 +0000116],[
117 UNIVERSALSDK=
118 enable_universalsdk=
119])
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000120if test -n "${UNIVERSALSDK}"
121then
122 AC_MSG_RESULT(${UNIVERSALSDK})
123else
124 AC_MSG_RESULT(no)
125fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000126AC_SUBST(UNIVERSALSDK)
127
Benjamin Peterson0e6ea5d2008-07-16 20:17:04 +0000128AC_SUBST(ARCH_RUN_32BIT)
129
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000130UNIVERSAL_ARCHS="32-bit"
Ronald Oussoren92919a62009-12-24 13:30:58 +0000131AC_SUBST(LIPO_32BIT_FLAGS)
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000132AC_MSG_CHECKING(for --with-universal-archs)
133AC_ARG_WITH(universal-archs,
Ronald Oussoren23d92532009-09-07 06:12:00 +0000134 AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")),
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000135[
136 AC_MSG_RESULT($withval)
137 UNIVERSAL_ARCHS="$withval"
Ronald Oussoren9ebd2422009-09-29 13:00:44 +0000138 if test "${enable_universalsdk}" ; then
139 :
140 else
141 AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
142 fi
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000143],
144[
145 AC_MSG_RESULT(32-bit)
146])
147
148
149
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000150AC_ARG_WITH(framework-name,
151 AC_HELP_STRING(--with-framework-name=FRAMEWORK,
152 specify an alternate name of the framework built with --enable-framework),
153[
Ronald Oussoren9ebd2422009-09-29 13:00:44 +0000154 if test "${enable_framework}"; then
155 :
156 else
157 AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
158 fi
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000159 PYTHONFRAMEWORK=${withval}
160 PYTHONFRAMEWORKDIR=${withval}.framework
161 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
162 ],[
163 PYTHONFRAMEWORK=Python
164 PYTHONFRAMEWORKDIR=Python.framework
165 PYTHONFRAMEWORKIDENTIFIER=org.python.python
166])
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000167dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000168AC_ARG_ENABLE(framework,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000169 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
170[
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000171 case $enableval in
172 yes)
173 enableval=/Library/Frameworks
Jack Jansen127e56e2001-09-11 14:41:54 +0000174 esac
175 case $enableval in
176 no)
177 PYTHONFRAMEWORK=
178 PYTHONFRAMEWORKDIR=no-framework
179 PYTHONFRAMEWORKPREFIX=
180 PYTHONFRAMEWORKINSTALLDIR=
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000181 FRAMEWORKINSTALLFIRST=
182 FRAMEWORKINSTALLLAST=
Ronald Oussoren5b787322006-06-06 19:50:24 +0000183 FRAMEWORKALTINSTALLFIRST=
184 FRAMEWORKALTINSTALLLAST=
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000185 if test "x${prefix}" = "xNONE"; then
186 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
187 else
188 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
189 fi
Jack Jansen127e56e2001-09-11 14:41:54 +0000190 enable_framework=
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000191 ;;
192 *)
193 PYTHONFRAMEWORKPREFIX=$enableval
Jack Jansen127e56e2001-09-11 14:41:54 +0000194 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000195 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000196 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
Ronald Oussoren92919a62009-12-24 13:30:58 +0000197 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
198 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000199
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000200 if test "x${prefix}" = "xNONE" ; then
201 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
202 else
203 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
204 fi
Jack Jansen127e56e2001-09-11 14:41:54 +0000205 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
Ronald Oussoren836b0392006-05-14 19:56:34 +0000206
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000207 # Add files for Mac specific code to the list of output
Ronald Oussoren836b0392006-05-14 19:56:34 +0000208 # files:
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000209 AC_CONFIG_FILES(Mac/Makefile)
210 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
211 AC_CONFIG_FILES(Mac/IDLE/Makefile)
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000212 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
213 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000214 esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000215 ],[
216 PYTHONFRAMEWORK=
Jack Jansen127e56e2001-09-11 14:41:54 +0000217 PYTHONFRAMEWORKDIR=no-framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000218 PYTHONFRAMEWORKPREFIX=
219 PYTHONFRAMEWORKINSTALLDIR=
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000220 FRAMEWORKINSTALLFIRST=
221 FRAMEWORKINSTALLLAST=
Ronald Oussoren5b787322006-06-06 19:50:24 +0000222 FRAMEWORKALTINSTALLFIRST=
223 FRAMEWORKALTINSTALLLAST=
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000224 if test "x${prefix}" = "xNONE" ; then
225 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
226 else
227 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
228 fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000229 enable_framework=
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000230
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000231])
232AC_SUBST(PYTHONFRAMEWORK)
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000233AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000234AC_SUBST(PYTHONFRAMEWORKDIR)
235AC_SUBST(PYTHONFRAMEWORKPREFIX)
236AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000237AC_SUBST(FRAMEWORKINSTALLFIRST)
238AC_SUBST(FRAMEWORKINSTALLLAST)
Ronald Oussoren5b787322006-06-06 19:50:24 +0000239AC_SUBST(FRAMEWORKALTINSTALLFIRST)
240AC_SUBST(FRAMEWORKALTINSTALLLAST)
241AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000242
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000243##AC_ARG_WITH(dyld,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000244## AC_HELP_STRING(--with-dyld,
245## Use (OpenStep|Rhapsody) dynamic linker))
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000246##
Guido van Rossumb418f891996-07-30 18:06:02 +0000247# Set name for machine-dependent library files
248AC_SUBST(MACHDEP)
249AC_MSG_CHECKING(MACHDEP)
250if test -z "$MACHDEP"
251then
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000252 ac_sys_system=`uname -s`
Georg Brandlfe18a112009-09-04 07:55:14 +0000253 if test "$ac_sys_system" = "AIX" \
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000254 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000255 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +0000256 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000257 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +0000258 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000259 ac_md_system=`echo $ac_sys_system |
260 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
261 ac_md_release=`echo $ac_sys_release |
Guido van Rossum67b26592001-10-20 14:21:45 +0000262 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +0000263 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000264
Guido van Rossumbcd91e01997-03-20 20:46:29 +0000265 case $MACHDEP in
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +0000266 cygwin*) MACHDEP="cygwin";;
Jack Jansen8a97f4a2001-12-05 23:27:32 +0000267 darwin*) MACHDEP="darwin";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000268 atheos*) MACHDEP="atheos";;
Martin v. Löwisf3322282003-07-13 09:46:13 +0000269 irix646) MACHDEP="irix6";;
Guido van Rossumb97ef171997-09-28 05:44:03 +0000270 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000271 esac
272fi
Jack Jansen83f898c2002-12-30 22:23:40 +0000273
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000274# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
275# disable features if it is defined, without any means to access these
276# features as extensions. For these systems, we skip the definition of
277# _XOPEN_SOURCE. Before adding a system to the list to gain access to
278# some feature, make sure there is no alternative way to access this
279# feature. Also, when using wildcards, make sure you have verified the
280# need for not defining _XOPEN_SOURCE on all systems matching the
281# wildcard, and that the wildcard does not include future systems
282# (which may remove their limitations).
283dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
284case $ac_sys_system/$ac_sys_release in
285 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
286 # even though select is a POSIX function. Reported by J. Ribbens.
Martin v. Löwis76bafc62003-10-03 13:47:44 +0000287 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
Gregory P. Smith980b99b2008-09-07 05:15:18 +0000288 OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123@:>@)
Martin v. Löwiscb78de62007-12-29 18:49:21 +0000289 define_xopen_source=no
290 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
291 # also defined. This can be overridden by defining _BSD_SOURCE
292 # As this has a different meaning on Linux, only define it on OpenBSD
293 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
294 ;;
Martin v. Löwis4d542ec2006-11-25 15:39:19 +0000295 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
296 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
297 # Marc Recht
Georg Brandl4b9bcfc2008-11-16 08:00:17 +0000298 NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
Martin v. Löwis4d542ec2006-11-25 15:39:19 +0000299 define_xopen_source=no;;
Martin v. Löwisa9d71422003-03-28 18:43:31 +0000300 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
301 # of union __?sigval. Reported by Stuart Bishop.
302 SunOS/5.6)
303 define_xopen_source=no;;
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000304 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
305 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
Martin v. Löwis253d1f42004-05-07 19:14:14 +0000306 # Reconfirmed for 7.1.4 by Martin v. Loewis.
307 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000308 define_xopen_source=no;;
309 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000310 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000311 SCO_SV/3.2)
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000312 define_xopen_source=no;;
Martin v. Löwisbb86d832008-11-04 20:40:09 +0000313 # On FreeBSD 4, the math functions C89 does not cover are never defined
314 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
315 FreeBSD/4.*)
316 define_xopen_source=no;;
317 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
318 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
319 # identifies itself as Darwin/7.*
320 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
321 # disables platform specific features beyond repair.
322 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
323 # has no effect, don't bother defining them
324 Darwin/@<:@6789@:>@.*)
Anthony Baxter6169c6b2003-10-04 07:46:23 +0000325 define_xopen_source=no;;
Ronald Oussorena55af9a2010-01-17 16:25:57 +0000326 Darwin/1@<:@0-9@:>@.*)
327 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000328 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
329 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
330 # or has another value. By not (re)defining it, the defaults come in place.
Martin v. Löwisc19c5a62003-11-18 20:00:44 +0000331 AIX/4)
332 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000333 AIX/5)
334 if test `uname -r` -eq 1; then
335 define_xopen_source=no
336 fi
337 ;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000338 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
339 # defining NI_NUMERICHOST.
340 QNX/6.3.2)
341 define_xopen_source=no
342 ;;
Martin v. Löwisa0588362006-04-04 06:03:50 +0000343
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000344esac
345
346if test $define_xopen_source = yes
347then
Skip Montanarof0d5f792004-08-15 14:08:23 +0000348 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
349 # defined precisely as g++ defines it
Martin v. Löwis7dece662005-11-26 11:38:24 +0000350 # Furthermore, on Solaris 10, XPG6 requires the use of a C99
351 # compiler
Skip Montanarof0d5f792004-08-15 14:08:23 +0000352 case $ac_sys_system/$ac_sys_release in
Martin v. Löwis7dece662005-11-26 11:38:24 +0000353 SunOS/5.8|SunOS/5.9|SunOS/5.10)
Skip Montanarof0d5f792004-08-15 14:08:23 +0000354 AC_DEFINE(_XOPEN_SOURCE, 500,
355 Define to the level of X/Open that your system supports)
356 ;;
357 *)
358 AC_DEFINE(_XOPEN_SOURCE, 600,
359 Define to the level of X/Open that your system supports)
360 ;;
361 esac
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000362
363 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
364 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
365 # several APIs are not declared. Since this is also needed in some
366 # cases for HP-UX, we define it globally.
Martin v. Löwis7dece662005-11-26 11:38:24 +0000367 # except for Solaris 10, where it must not be defined,
368 # as it implies XPG4.2
369 case $ac_sys_system/$ac_sys_release in
370 SunOS/5.10)
371 ;;
372 *)
373 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
374 Define to activate Unix95-and-earlier features)
375 ;;
376 esac
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000377
Bob Ippolito7026a0a2005-03-28 23:23:47 +0000378 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
379
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000380fi
381
Guido van Rossum91922671997-10-09 20:24:13 +0000382#
383# SGI compilers allow the specification of the both the ABI and the
384# ISA on the command line. Depending on the values of these switches,
385# different and often incompatable code will be generated.
386#
387# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
388# thus supply support for various ABI/ISA combinations. The MACHDEP
389# variable is also adjusted.
390#
391AC_SUBST(SGI_ABI)
392if test ! -z "$SGI_ABI"
393then
394 CC="cc $SGI_ABI"
395 LDFLAGS="$SGI_ABI $LDFLAGS"
396 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
397fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000398AC_MSG_RESULT($MACHDEP)
399
Jack Jansen83f898c2002-12-30 22:23:40 +0000400# And add extra plat-mac for darwin
401AC_SUBST(EXTRAPLATDIR)
Jack Jansen7b59b422003-03-17 15:44:10 +0000402AC_SUBST(EXTRAMACHDEPPATH)
Jack Jansen83f898c2002-12-30 22:23:40 +0000403AC_MSG_CHECKING(EXTRAPLATDIR)
404if test -z "$EXTRAPLATDIR"
405then
406 case $MACHDEP in
Jack Jansen7b59b422003-03-17 15:44:10 +0000407 darwin)
408 EXTRAPLATDIR="\$(PLATMACDIRS)"
409 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
410 ;;
411 *)
412 EXTRAPLATDIR=""
413 EXTRAMACHDEPPATH=""
414 ;;
Jack Jansen83f898c2002-12-30 22:23:40 +0000415 esac
416fi
417AC_MSG_RESULT($EXTRAPLATDIR)
418
Jack Jansen6b08a402004-06-03 12:41:45 +0000419# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
420# it may influence the way we can build extensions, so distutils
421# needs to check it
422AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
Ronald Oussoren988117f2006-04-29 11:31:35 +0000423AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
Jack Jansen6b08a402004-06-03 12:41:45 +0000424CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
Ronald Oussoren988117f2006-04-29 11:31:35 +0000425EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
Jack Jansen6b08a402004-06-03 12:41:45 +0000426
Mark Dickinson65134662008-04-25 16:11:04 +0000427AC_MSG_CHECKING(machine type as reported by uname -m)
428ac_sys_machine=`uname -m`
429AC_MSG_RESULT($ac_sys_machine)
430
Guido van Rossum627b2d71993-12-24 10:39:16 +0000431# checks for alternative programs
Skip Montanarodecc6a42003-01-01 20:07:49 +0000432
433# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
434# for debug/optimization stuff. BASECFLAGS is for flags that are required
435# just to get things to compile and link. Users are free to override OPT
436# when running configure or make. The build should not break if they do.
437# BASECFLAGS should generally not be messed with, however.
438
439# XXX shouldn't some/most/all of this code be merged with the stuff later
440# on that fiddles with OPT and BASECFLAGS?
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000441AC_MSG_CHECKING(for --without-gcc)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000442AC_ARG_WITH(gcc,
443 AC_HELP_STRING(--without-gcc,never use gcc),
444[
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000445 case $withval in
Skip Montanaro516144f2009-01-04 10:36:58 +0000446 no) CC=${CC:-cc}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000447 without_gcc=yes;;
448 yes) CC=gcc
449 without_gcc=no;;
450 *) CC=$withval
451 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000452 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000453 case $ac_sys_system in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000454 AIX*) CC=cc_r
455 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000456 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000457 case $BE_HOST_CPU in
458 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000459 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000460 without_gcc=yes
Skip Montanarodecc6a42003-01-01 20:07:49 +0000461 BASECFLAGS="$BASECFLAGS -export pragma"
462 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000463 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000464 ;;
465 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000466 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000467 without_gcc=no
Skip Montanarodecc6a42003-01-01 20:07:49 +0000468 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000469 ;;
470 *)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000471 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000472 ;;
473 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000474 AR="\$(srcdir)/Modules/ar_beos"
475 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000476 ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000477 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000478 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000479AC_MSG_RESULT($without_gcc)
480
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000481# If the user switches compilers, we can't believe the cache
482if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
483then
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000484 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
485(it is also a good idea to do 'make clean' before compiling)])
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000486fi
487
Guido van Rossum627b2d71993-12-24 10:39:16 +0000488AC_PROG_CC
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000489
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000490AC_SUBST(CXX)
491AC_SUBST(MAINCC)
492AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
493AC_ARG_WITH(cxx_main,
494 AC_HELP_STRING([--with-cxx-main=<compiler>],
495 [compile main() and link python executable with C++ compiler]),
496[
497
498 case $withval in
499 no) with_cxx_main=no
500 MAINCC='$(CC)';;
501 yes) with_cxx_main=yes
502 MAINCC='$(CXX)';;
503 *) with_cxx_main=yes
504 MAINCC=$withval
505 if test -z "$CXX"
506 then
507 CXX=$withval
508 fi;;
509 esac], [
510 with_cxx_main=no
511 MAINCC='$(CC)'
512])
513AC_MSG_RESULT($with_cxx_main)
514
515preset_cxx="$CXX"
516if test -z "$CXX"
517then
518 case "$CC" in
519 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
520 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
521 esac
522 if test "$CXX" = "notfound"
523 then
524 CXX=""
525 fi
526fi
527if test -z "$CXX"
528then
529 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
530 if test "$CXX" = "notfound"
531 then
532 CXX=""
533 fi
534fi
535if test "$preset_cxx" != "$CXX"
536then
537 AC_MSG_WARN([
538
539 By default, distutils will build C++ extension modules with "$CXX".
540 If this is not intended, then set CXX on the configure command line.
541 ])
542fi
543
544
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000545# checks for UNIX variants that set C preprocessor variables
546AC_AIX
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000547
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000548# Check for unsupported systems
549case $ac_sys_system/$ac_sys_release in
Brett Cannon19fab762007-06-02 03:02:29 +0000550atheos*|Linux*/1*)
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000551 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
552 echo See README for details.
553 exit 1;;
554esac
555
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000556AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000557AC_MSG_CHECKING(for --with-suffix)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000558AC_ARG_WITH(suffix,
559 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
560[
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000561 case $withval in
562 no) EXEEXT=;;
563 yes) EXEEXT=.exe;;
564 *) EXEEXT=$withval;;
565 esac])
566AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000567
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000568# Test whether we're running on a non-case-sensitive system, in which
569# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000570AC_SUBST(BUILDEXEEXT)
571AC_MSG_CHECKING(for case-insensitive build directory)
Jack Jansen3c2c4332002-11-06 13:33:32 +0000572if test ! -d CaseSensitiveTestDir; then
573mkdir CaseSensitiveTestDir
574fi
575
576if test -d casesensitivetestdir
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000577then
Jack Jansen1999ef42001-12-06 21:47:20 +0000578 AC_MSG_RESULT(yes)
579 BUILDEXEEXT=.exe
580else
581 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000582 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000583fi
Jack Jansen3c2c4332002-11-06 13:33:32 +0000584rmdir CaseSensitiveTestDir
Guido van Rossumfb842551997-08-06 23:42:07 +0000585
Guido van Rossumdd997f71998-10-07 19:58:26 +0000586case $MACHDEP in
587bsdos*)
588 case $CC in
589 gcc) CC="$CC -D_HAVE_BSDI";;
590 esac;;
591esac
592
Guido van Rossum84561611997-08-21 00:08:11 +0000593case $ac_sys_system in
594hp*|HP*)
595 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000596 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000597 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000598SunOS*)
599 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000600 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000601 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000602esac
603
Martin v. Löwise8964d42001-03-06 12:09:07 +0000604
Neil Schemenauer61c51152001-01-26 16:18:16 +0000605AC_SUBST(LIBRARY)
606AC_MSG_CHECKING(LIBRARY)
607if test -z "$LIBRARY"
608then
609 LIBRARY='libpython$(VERSION).a'
610fi
611AC_MSG_RESULT($LIBRARY)
612
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000613# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000614# name of the library into which to insert object files). BLDLIBRARY is also
615# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
616# is blank as the main program is not linked directly against LDLIBRARY.
617# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
618# systems without shared libraries, LDLIBRARY is the same as LIBRARY
619# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
620# DLLLIBRARY is the shared (i.e., DLL) library.
621#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000622# RUNSHARED is used to run shared python without installed libraries
623#
624# INSTSONAME is the name of the shared library that will be use to install
625# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000626AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000627AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000628AC_SUBST(BLDLIBRARY)
629AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000630AC_SUBST(INSTSONAME)
631AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000632LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000633BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis09bdf722002-05-08 08:51:29 +0000634INSTSONAME='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000635DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000636LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000637RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000638
Guido van Rossumfb842551997-08-06 23:42:07 +0000639# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000640# If CXX is set, and if it is needed to link a main function that was
641# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
642# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000643# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000644# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000645AC_SUBST(LINKCC)
646AC_MSG_CHECKING(LINKCC)
647if test -z "$LINKCC"
648then
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000649 LINKCC='$(PURIFY) $(MAINCC)'
Guido van Rossumfb842551997-08-06 23:42:07 +0000650 case $ac_sys_system in
651 AIX*)
Neal Norwitz0b27ff92003-03-31 15:53:49 +0000652 exp_extra="\"\""
653 if test $ac_sys_release -ge 5 -o \
654 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
655 exp_extra="."
656 fi
657 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000658 QNX*)
659 # qcc must be used because the other compilers do not
660 # support -N.
661 LINKCC=qcc;;
Guido van Rossumfb842551997-08-06 23:42:07 +0000662 esac
663fi
664AC_MSG_RESULT($LINKCC)
665
Tarek Ziadée2be83d2009-05-09 08:28:53 +0000666# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
667# make sure we default having it set to "no": this is used by
668# distutils.unixccompiler to know if it should add --enable-new-dtags
669# to linker command lines, and failing to detect GNU ld simply results
670# in the same bahaviour as before.
671AC_SUBST(GNULD)
672AC_MSG_CHECKING(for GNU ld)
673ac_prog=ld
674if test "$GCC" = yes; then
675 ac_prog=`$CC -print-prog-name=ld`
676fi
677case `"$ac_prog" -V 2>&1 < /dev/null` in
678 *GNU*)
679 GNULD=yes;;
680 *)
681 GNULD=no;;
682esac
683AC_MSG_RESULT($GNULD)
684
Martin v. Löwis1142de32002-03-29 16:28:31 +0000685AC_MSG_CHECKING(for --enable-shared)
686AC_ARG_ENABLE(shared,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000687 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000688
Martin v. Löwis1142de32002-03-29 16:28:31 +0000689if test -z "$enable_shared"
690then
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000691 case $ac_sys_system in
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000692 CYGWIN* | atheos*)
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000693 enable_shared="yes";;
694 *)
695 enable_shared="no";;
696 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000697fi
698AC_MSG_RESULT($enable_shared)
699
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000700AC_MSG_CHECKING(for --enable-profiling)
701AC_ARG_ENABLE(profiling,
702 AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
703[ac_save_cc="$CC"
704 CC="$CC -pg"
705 AC_TRY_RUN([int main() { return 0; }],
706 ac_enable_profiling="yes",
707 ac_enable_profiling="no",
708 ac_enable_profiling="no")
709 CC="$ac_save_cc"])
710AC_MSG_RESULT($ac_enable_profiling)
711
712case "$ac_enable_profiling" in
713 "yes")
714 BASECFLAGS="-pg $BASECFLAGS"
715 LDFLAGS="-pg $LDFLAGS"
716 ;;
717esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000718
719AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000720
Guido van Rossumb8552162001-09-05 14:58:11 +0000721# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
722# library that we build, but we do not want to link against it (we
723# will find it with a -framework option). For this reason there is an
724# extra variable BLDLIBRARY against which Python and the extension
725# modules are linked, BLDLIBRARY. This is normally the same as
726# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000727if test "$enable_framework"
728then
729 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen66b84832003-07-04 12:14:39 +0000730 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000731 BLDLIBRARY=''
732else
733 BLDLIBRARY='$(LDLIBRARY)'
734fi
735
Martin v. Löwis1142de32002-03-29 16:28:31 +0000736# Other platforms follow
737if test $enable_shared = "yes"; then
Mark Hammond8235ea12002-07-19 06:55:41 +0000738 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
Martin v. Löwis1142de32002-03-29 16:28:31 +0000739 case $ac_sys_system in
740 BeOS*)
741 LDLIBRARY='libpython$(VERSION).so'
742 ;;
743 CYGWIN*)
744 LDLIBRARY='libpython$(VERSION).dll.a'
745 DLLLIBRARY='libpython$(VERSION).dll'
746 ;;
747 SunOS*)
748 LDLIBRARY='libpython$(VERSION).so'
Martin v. Löwisd141a8c2003-06-14 15:20:28 +0000749 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000750 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Martin v. Löwis2389c412003-10-31 15:42:07 +0000751 INSTSONAME="$LDLIBRARY".$SOVERSION
Martin v. Löwis1142de32002-03-29 16:28:31 +0000752 ;;
Martin v. Löwis86d66262006-02-17 08:40:11 +0000753 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000754 LDLIBRARY='libpython$(VERSION).so'
755 BLDLIBRARY='-L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000756 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Hye-Shik Chang33761492004-10-26 09:53:46 +0000757 case $ac_sys_system in
758 FreeBSD*)
759 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
760 ;;
761 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000762 INSTSONAME="$LDLIBRARY".$SOVERSION
763 ;;
764 hp*|HP*)
Neal Norwitz58e28882006-05-19 07:00:58 +0000765 case `uname -m` in
766 ia64)
767 LDLIBRARY='libpython$(VERSION).so'
768 ;;
769 *)
770 LDLIBRARY='libpython$(VERSION).sl'
771 ;;
772 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000773 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000774 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000775 ;;
776 OSF*)
777 LDLIBRARY='libpython$(VERSION).so'
Neal Norwitz671b9e32006-01-09 07:07:12 +0000778 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000779 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000780 ;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000781 atheos*)
782 LDLIBRARY='libpython$(VERSION).so'
783 BLDLIBRARY='-L. -lpython$(VERSION)'
784 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
785 ;;
Ronald Oussoren79f90492009-01-02 10:44:46 +0000786 Darwin*)
787 LDLIBRARY='libpython$(VERSION).dylib'
788 BLDLIBRARY='-L. -lpython$(VERSION)'
789 RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
790 ;;
791
Martin v. Löwis1142de32002-03-29 16:28:31 +0000792 esac
Jason Tishler30765592003-09-04 11:04:06 +0000793else # shared is disabled
794 case $ac_sys_system in
795 CYGWIN*)
796 BLDLIBRARY='$(LIBRARY)'
797 LDLIBRARY='libpython$(VERSION).dll.a'
798 ;;
799 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000800fi
801
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000802AC_MSG_RESULT($LDLIBRARY)
803
Guido van Rossum627b2d71993-12-24 10:39:16 +0000804AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000805AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000806AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000807
Tarek Ziadé99f660a2009-05-07 21:20:34 +0000808# tweak ARFLAGS only if the user didn't set it on the command line
809AC_SUBST(ARFLAGS)
810if test -z "$ARFLAGS"
811then
812 ARFLAGS="rc"
813fi
814
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000815AC_SUBST(SVNVERSION)
Martin v. Löwisff600232006-04-03 19:12:32 +0000816AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000817if test $SVNVERSION = found
818then
819 SVNVERSION="svnversion \$(srcdir)"
820else
Benjamin Petersone5afa3b2009-05-23 19:24:37 +0000821 SVNVERSION="echo Unversioned directory"
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000822fi
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000823
Neil Schemenauera42c8272001-03-31 00:01:55 +0000824case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +0000825bsdos*|hp*|HP*)
826 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +0000827 if test -z "$INSTALL"
828 then
829 INSTALL="${srcdir}/install-sh -c"
830 fi
831esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000832AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000833
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000834# Not every filesystem supports hard links
835AC_SUBST(LN)
836if test -z "$LN" ; then
837 case $ac_sys_system in
838 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000839 CYGWIN*) LN="ln -s";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000840 atheos*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000841 *) LN=ln;;
842 esac
843fi
844
Fred Drake9f715822001-07-11 06:27:00 +0000845# Check for --with-pydebug
846AC_MSG_CHECKING(for --with-pydebug)
847AC_ARG_WITH(pydebug,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000848 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
849[
Fred Drake9f715822001-07-11 06:27:00 +0000850if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000851then
852 AC_DEFINE(Py_DEBUG, 1,
853 [Define if you want to build an interpreter with many run-time checks.])
854 AC_MSG_RESULT(yes);
855 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +0000856else AC_MSG_RESULT(no); Py_DEBUG='false'
857fi],
858[AC_MSG_RESULT(no)])
859
Skip Montanarodecc6a42003-01-01 20:07:49 +0000860# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
861# merged with this chunk of code?
862
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000863# Optimizer/debugger flags
Skip Montanarodecc6a42003-01-01 20:07:49 +0000864# ------------------------
865# (The following bit of code is complicated enough - please keep things
866# indented properly. Just pretend you're editing Python code. ;-)
867
868# There are two parallel sets of case statements below, one that checks to
869# see if OPT was set and one that does BASECFLAGS setting based upon
870# compiler and platform. BASECFLAGS tweaks need to be made even if the
871# user set OPT.
872
873# tweak OPT based on compiler and platform, only if the user didn't set
874# it on the command line
Guido van Rossumb418f891996-07-30 18:06:02 +0000875AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000876if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000877then
Skip Montanarodecc6a42003-01-01 20:07:49 +0000878 case $GCC in
879 yes)
Skip Montanaro288a5be2006-04-13 02:00:56 +0000880 if test "$CC" != 'g++' ; then
881 STRICT_PROTO="-Wstrict-prototypes"
882 fi
Guido van Rossum7c862f82007-12-13 20:50:10 +0000883 # For gcc 4.x we need to use -fwrapv so lets check if its supported
884 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
885 WRAP="-fwrapv"
886 fi
Skip Montanarodecc6a42003-01-01 20:07:49 +0000887 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000888 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000889 if test "$Py_DEBUG" = 'true' ; then
890 # Optimization messes up debuggers, so turn it off for
891 # debug builds.
Skip Montanaro288a5be2006-04-13 02:00:56 +0000892 OPT="-g -Wall $STRICT_PROTO"
Fred Drake9f715822001-07-11 06:27:00 +0000893 else
Guido van Rossum7c862f82007-12-13 20:50:10 +0000894 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +0000895 fi
896 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000897 *)
Skip Montanaro288a5be2006-04-13 02:00:56 +0000898 OPT="-O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +0000899 ;;
Fred Drake9f715822001-07-11 06:27:00 +0000900 esac
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000901 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +0000902 SCO_SV*) OPT="$OPT -m486 -DSCO5"
903 ;;
904 esac
Fred Drake9f715822001-07-11 06:27:00 +0000905 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +0000906
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000907 *)
Skip Montanarodecc6a42003-01-01 20:07:49 +0000908 OPT="-O"
909 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000910 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000911fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000912
Skip Montanarodecc6a42003-01-01 20:07:49 +0000913AC_SUBST(BASECFLAGS)
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000914
915# The -arch flags for universal builds on OSX
916UNIVERSAL_ARCH_FLAGS=
917AC_SUBST(UNIVERSAL_ARCH_FLAGS)
918
Skip Montanarodecc6a42003-01-01 20:07:49 +0000919# tweak BASECFLAGS based on compiler and platform
920case $GCC in
921yes)
Martin v. Löwis70fedcd2003-07-07 21:26:19 +0000922 # Python violates C99 rules, by casting between incompatible
923 # pointer types. GCC may generate bad code as a result of that,
924 # so use -fno-strict-aliasing if supported.
925 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
926 ac_save_cc="$CC"
927 CC="$CC -fno-strict-aliasing"
Alexandre Vassalotti00900892009-07-17 05:26:39 +0000928 AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +0000929 AC_TRY_COMPILE([],[int main() { return 0; }],
Martin v. Löwis70fedcd2003-07-07 21:26:19 +0000930 ac_cv_no_strict_aliasing_ok=yes,
Alexandre Vassalotti00900892009-07-17 05:26:39 +0000931 ac_cv_no_strict_aliasing_ok=no))
Martin v. Löwis70fedcd2003-07-07 21:26:19 +0000932 CC="$ac_save_cc"
933 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
934 if test $ac_cv_no_strict_aliasing_ok = yes
935 then
936 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
937 fi
Mark Dickinson65134662008-04-25 16:11:04 +0000938
939 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
940 # support. Without this, treatment of subnormals doesn't follow
941 # the standard.
942 case $ac_sys_machine in
943 alpha*)
944 BASECFLAGS="$BASECFLAGS -mieee"
945 ;;
946 esac
947
Skip Montanarodecc6a42003-01-01 20:07:49 +0000948 case $ac_sys_system in
949 SCO_SV*)
950 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
951 ;;
952 # is there any other compiler on Darwin besides gcc?
953 Darwin*)
Jeffrey Yasskin1b4e45b2008-03-17 14:40:53 +0000954 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
955 # used to be here, but non-Apple gcc doesn't accept them.
Ronald Oussorena55af9a2010-01-17 16:25:57 +0000956 if test "${CC}" = gcc
957 then
958 AC_MSG_CHECKING(which compiler should be used)
959 case "${UNIVERSALSDK}" in
960 */MacOSX10.4u.sdk)
961 # Build using 10.4 SDK, force usage of gcc when the
962 # compiler is gcc, otherwise the user will get very
963 # confusing error messages when building on OSX 10.6
964 CC=gcc-4.0
965 CPP=cpp-4.0
966 ;;
967 esac
968 AC_MSG_RESULT($CC)
Ronald Oussoren988117f2006-04-29 11:31:35 +0000969 fi
970
Benjamin Peterson4347c442008-07-17 15:59:24 +0000971 # Calculate the right deployment target for this build.
972 #
973 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
974 if test ${cur_target} '>' 10.2; then
975 cur_target=10.3
Ronald Oussoren25967582009-09-06 10:00:26 +0000976 if test ${enable_universalsdk}; then
977 if test "${UNIVERSAL_ARCHS}" = "all"; then
978 # Ensure that the default platform for a
979 # 4-way universal build is OSX 10.5,
980 # that's the first OS release where
981 # 4-way builds make sense.
982 cur_target='10.5'
Ronald Oussoren23d92532009-09-07 06:12:00 +0000983
984 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
985 cur_target='10.5'
986
987 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
988 cur_target='10.5'
989
990 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
991 cur_target='10.5'
Ronald Oussoren25967582009-09-06 10:00:26 +0000992 fi
993 else
994 if test `arch` = "i386"; then
995 # On Intel macs default to a deployment
996 # target of 10.4, that's the first OSX
997 # release with Intel support.
998 cur_target="10.4"
999 fi
1000 fi
Benjamin Peterson4347c442008-07-17 15:59:24 +00001001 fi
1002 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1003
1004 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1005 # environment with a value that is the same as what we'll use
1006 # in the Makefile to ensure that we'll get the same compiler
1007 # environment during configure and build time.
1008 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1009 export MACOSX_DEPLOYMENT_TARGET
1010 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1011
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001012 if test "${enable_universalsdk}"; then
1013 UNIVERSAL_ARCH_FLAGS=""
1014 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
1015 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
1016 ARCH_RUN_32BIT=""
1017 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
1018
1019
1020 # You have to use different flags on various versions of
1021 # OSX to extract PPC code from an universal binary, basically
1022 # '-arch ppc' on OSX 10.4 and '-arch ppc7400' on anything
1023 # newer.
1024 # Because '-arch pp7400' works on OSX 10.5 or higher this
1025 # test is only present in the '32-bit' branch, all other
1026 # branches require OSX 10.5 to compile.
1027
1028 AC_MSG_CHECKING(lipo flag for extracting ppc code)
1029 FN="test.$$"
1030 cat >${FN}.c <<-EOF
1031 int main() { return 0; }
1032EOF
1033 ${CC} ${CFLAGS} -arch ppc -arch i386 -o ${FN} ${FN}.c -isysroot ${UNIVERSALSDK}
1034 if test $? != 0 ; then
1035 rm ${FN} ${FN}.c
1036 AC_MSG_RESULT([failed, assumee -extract ppc7400])
1037 else
1038 lipo -extract -output "${FN}.out" -arch ppc7400 "${FN}" 2>/dev/null
1039 if test $? != 0 ; then
1040 LIPO_32BIT_FLAGS="-extract ppc -extract i386"
1041 AC_MSG_RESULT("'-extract ppc'")
1042 else
1043 AC_MSG_RESULT("'-extract ppc7400'")
1044 fi
1045 rm -f ${FN} ${FN}.c ${FN}.out
1046 fi
1047
1048 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
1049 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
1050 LIPO_32BIT_FLAGS=""
1051 ARCH_RUN_32BIT="true"
1052
1053 elif test "$UNIVERSAL_ARCHS" = "all" ; then
1054 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
1055 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001056 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001057
1058 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
1059 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
1060 LIPO_32BIT_FLAGS="-extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001061 ARCH_RUN_32BIT="/usr/bin/arch -i386"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001062
1063 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
1064 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
1065 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren9922f172010-02-11 13:19:34 +00001066 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001067
1068 else
1069 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
1070
1071 fi
1072
1073
1074 BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
1075 tgt=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
1076 if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
1077 CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
1078 CPPFLAGS="-isysroot ${UNIVERSALSDK}"
1079 fi
1080
1081 fi
1082
1083
Skip Montanarodecc6a42003-01-01 20:07:49 +00001084 ;;
Neal Norwitzdedeeaa2006-03-31 06:54:45 +00001085 OSF*)
1086 BASECFLAGS="$BASECFLAGS -mieee"
1087 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001088 esac
1089 ;;
1090
1091*)
1092 case $ac_sys_system in
1093 OpenUNIX*|UnixWare*)
1094 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1095 ;;
Neal Norwitzb44f1652003-05-26 14:11:55 +00001096 OSF*)
1097 BASECFLAGS="$BASECFLAGS -ieee -std"
1098 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001099 SCO_SV*)
1100 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1101 ;;
1102 esac
1103 ;;
1104esac
1105
Fred Drakee1ceaa02001-12-04 20:55:47 +00001106if test "$Py_DEBUG" = 'true'; then
1107 :
1108else
1109 OPT="-DNDEBUG $OPT"
1110fi
1111
Guido van Rossum6f2260e1996-09-09 16:21:03 +00001112if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001113then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001114 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001115fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001116
Neal Norwitz020c46a2006-01-07 21:39:28 +00001117# disable check for icc since it seems to pass, but generates a warning
1118if test "$CC" = icc
1119then
1120 ac_cv_opt_olimit_ok=no
1121fi
1122
Guido van Rossum91922671997-10-09 20:24:13 +00001123AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1124AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1125[ac_save_cc="$CC"
1126CC="$CC -OPT:Olimit=0"
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001127AC_TRY_COMPILE([],[int main() { return 0; }],
Guido van Rossum91922671997-10-09 20:24:13 +00001128 ac_cv_opt_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +00001129 ac_cv_opt_olimit_ok=no,
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001130 )
Guido van Rossum91922671997-10-09 20:24:13 +00001131CC="$ac_save_cc"])
1132AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +00001133if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +00001134 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +00001135 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1136 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1137 # environment?
1138 Darwin*)
1139 ;;
1140 *)
1141 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1142 ;;
Guido van Rossum5839e582000-10-09 19:52:35 +00001143 esac
Guido van Rossumf8678121998-07-07 21:05:09 +00001144else
1145 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1146 AC_CACHE_VAL(ac_cv_olimit_ok,
1147 [ac_save_cc="$CC"
1148 CC="$CC -Olimit 1500"
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001149 AC_TRY_COMPILE([],[int main() { return 0; }],
Guido van Rossumf8678121998-07-07 21:05:09 +00001150 ac_cv_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +00001151 ac_cv_olimit_ok=no,
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001152 )
Guido van Rossumf8678121998-07-07 21:05:09 +00001153 CC="$ac_save_cc"])
1154 AC_MSG_RESULT($ac_cv_olimit_ok)
1155 if test $ac_cv_olimit_ok = yes; then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001156 BASECFLAGS="$BASECFLAGS -Olimit 1500"
Guido van Rossumf8678121998-07-07 21:05:09 +00001157 fi
Guido van Rossum201afe51997-05-14 21:14:44 +00001158fi
Guido van Rossumf8678121998-07-07 21:05:09 +00001159
Martin v. Löwisaac13162006-10-19 10:58:46 +00001160# Check whether GCC supports PyArg_ParseTuple format
1161if test "$GCC" = "yes"
1162then
1163 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1164 save_CFLAGS=$CFLAGS
1165 CFLAGS="$CFLAGS -Werror"
1166 AC_TRY_COMPILE([
1167 void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
1168 ],,
1169 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1170 AC_MSG_RESULT(yes),
1171 AC_MSG_RESULT(no)
1172 )
Martin v. Löwisc1d75972006-10-19 16:01:37 +00001173 CFLAGS=$save_CFLAGS
Martin v. Löwisaac13162006-10-19 10:58:46 +00001174fi
1175
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001176# On some compilers, pthreads are available without further options
1177# (e.g. MacOS X). On some of these systems, the compiler will not
1178# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1179# So we have to see first whether pthreads are available without
1180# options before we can check whether -Kpthread improves anything.
1181AC_MSG_CHECKING(whether pthreads are available without options)
1182AC_CACHE_VAL(ac_cv_pthread_is_default,
1183[AC_TRY_RUN([
1184#include <pthread.h>
1185
1186void* routine(void* p){return NULL;}
1187
1188int main(){
1189 pthread_t p;
1190 if(pthread_create(&p,NULL,routine,NULL)!=0)
1191 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001192 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001193 return 0;
1194}
1195],
Skip Montanarod8d39a02003-07-10 20:44:10 +00001196[
1197 ac_cv_pthread_is_default=yes
1198 ac_cv_kthread=no
1199 ac_cv_pthread=no
1200],
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001201 ac_cv_pthread_is_default=no,
1202 ac_cv_pthread_is_default=no)
1203])
1204AC_MSG_RESULT($ac_cv_pthread_is_default)
1205
1206
1207if test $ac_cv_pthread_is_default = yes
1208then
1209 ac_cv_kpthread=no
1210else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001211# -Kpthread, if available, provides the right #defines
1212# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001213# Some compilers won't report that they do not support -Kpthread,
1214# so we need to run a program to see whether it really made the
1215# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +00001216AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1217AC_CACHE_VAL(ac_cv_kpthread,
1218[ac_save_cc="$CC"
1219CC="$CC -Kpthread"
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001220AC_TRY_RUN([
1221#include <pthread.h>
1222
1223void* routine(void* p){return NULL;}
1224
1225int main(){
1226 pthread_t p;
1227 if(pthread_create(&p,NULL,routine,NULL)!=0)
1228 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001229 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001230 return 0;
1231}
1232],
Martin v. Löwis130fb172001-07-19 11:00:41 +00001233 ac_cv_kpthread=yes,
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001234 ac_cv_kpthread=no,
Martin v. Löwis130fb172001-07-19 11:00:41 +00001235 ac_cv_kpthread=no)
1236CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001237AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001238fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00001239
Skip Montanarod8d39a02003-07-10 20:44:10 +00001240if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001241then
1242# -Kthread, if available, provides the right #defines
1243# and linker options to make pthread_create available
1244# Some compilers won't report that they do not support -Kthread,
1245# so we need to run a program to see whether it really made the
1246# function available.
1247AC_MSG_CHECKING(whether $CC accepts -Kthread)
1248AC_CACHE_VAL(ac_cv_kthread,
1249[ac_save_cc="$CC"
1250CC="$CC -Kthread"
1251AC_TRY_RUN([
1252#include <pthread.h>
1253
1254void* routine(void* p){return NULL;}
1255
1256int main(){
1257 pthread_t p;
1258 if(pthread_create(&p,NULL,routine,NULL)!=0)
1259 return 1;
1260 (void)pthread_detach(p);
1261 return 0;
1262}
1263],
1264 ac_cv_kthread=yes,
1265 ac_cv_kthread=no,
1266 ac_cv_kthread=no)
1267CC="$ac_save_cc"])
1268AC_MSG_RESULT($ac_cv_kthread)
1269fi
1270
Skip Montanarod8d39a02003-07-10 20:44:10 +00001271if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001272then
1273# -pthread, if available, provides the right #defines
1274# and linker options to make pthread_create available
1275# Some compilers won't report that they do not support -pthread,
1276# so we need to run a program to see whether it really made the
1277# function available.
1278AC_MSG_CHECKING(whether $CC accepts -pthread)
1279AC_CACHE_VAL(ac_cv_thread,
1280[ac_save_cc="$CC"
1281CC="$CC -pthread"
1282AC_TRY_RUN([
1283#include <pthread.h>
1284
1285void* routine(void* p){return NULL;}
1286
1287int main(){
1288 pthread_t p;
1289 if(pthread_create(&p,NULL,routine,NULL)!=0)
1290 return 1;
1291 (void)pthread_detach(p);
1292 return 0;
1293}
1294],
1295 ac_cv_pthread=yes,
1296 ac_cv_pthread=no,
1297 ac_cv_pthread=no)
1298CC="$ac_save_cc"])
1299AC_MSG_RESULT($ac_cv_pthread)
1300fi
1301
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001302# If we have set a CC compiler flag for thread support then
1303# check if it works for CXX, too.
1304ac_cv_cxx_thread=no
1305if test ! -z "$CXX"
1306then
1307AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1308ac_save_cxx="$CXX"
1309
1310if test "$ac_cv_kpthread" = "yes"
1311then
Martin v. Löwis519adae2003-09-20 10:47:47 +00001312 CXX="$CXX -Kpthread"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001313 ac_cv_cxx_thread=yes
1314elif test "$ac_cv_kthread" = "yes"
1315then
1316 CXX="$CXX -Kthread"
1317 ac_cv_cxx_thread=yes
1318elif test "$ac_cv_pthread" = "yes"
1319then
1320 CXX="$CXX -pthread"
1321 ac_cv_cxx_thread=yes
1322fi
1323
1324if test $ac_cv_cxx_thread = yes
1325then
1326 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1327 $CXX -c conftest.$ac_ext 2>&5
1328 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1329 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1330 then
1331 ac_cv_cxx_thread=yes
1332 else
1333 ac_cv_cxx_thread=no
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001334 fi
1335 rm -fr conftest*
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001336fi
Brett Cannonc601e0f2004-11-07 01:24:12 +00001337AC_MSG_RESULT($ac_cv_cxx_thread)
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001338fi
Martin v. Löwis519adae2003-09-20 10:47:47 +00001339CXX="$ac_save_cxx"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001340
Fred Drakece81d592000-07-09 14:39:29 +00001341dnl # check for ANSI or K&R ("traditional") preprocessor
1342dnl AC_MSG_CHECKING(for C preprocessor type)
1343dnl AC_TRY_COMPILE([
1344dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1345dnl int foo;
1346dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1347dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
1348dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +00001349
Guido van Rossum627b2d71993-12-24 10:39:16 +00001350# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001351AC_HEADER_STDC
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001352AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1353fcntl.h grp.h \
Neal Norwitz9fdfaaf2008-03-28 05:34:59 +00001354ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001355shadow.h signal.h stdint.h stropts.h termios.h thread.h \
Martin v. Löwis14e73b12003-01-01 09:51:12 +00001356unistd.h utime.h \
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00001357sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1358sys/lock.h sys/mkdev.h sys/modem.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001359sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
Martin v. Löwis8c255e42008-05-23 15:06:50 +00001360sys/termio.h sys/time.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001361sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
Martin v. Löwis0347a9a2006-10-27 07:06:52 +00001362sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001363bluetooth/bluetooth.h linux/tipc.h spawn.h util.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001364AC_HEADER_DIRENT
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00001365AC_HEADER_MAJOR
Guido van Rossum627b2d71993-12-24 10:39:16 +00001366
Martin v. Löwisae2830c2004-09-18 09:54:52 +00001367# On Solaris, term.h requires curses.h
Martin v. Löwisfd1c69e2004-11-30 22:09:37 +00001368AC_CHECK_HEADERS(term.h,,,[
Martin v. Löwis5d52e782004-09-18 10:07:03 +00001369#ifdef HAVE_CURSES_H
1370#include <curses.h>
1371#endif
1372])
Martin v. Löwisae2830c2004-09-18 09:54:52 +00001373
Martin v. Löwis11017b12006-01-14 18:12:57 +00001374# On Linux, netlink.h requires asm/types.h
1375AC_CHECK_HEADERS(linux/netlink.h,,,[
1376#ifdef HAVE_ASM_TYPES_H
1377#include <asm/types.h>
1378#endif
1379#ifdef HAVE_SYS_SOCKET_H
1380#include <sys/socket.h>
1381#endif
1382])
1383
Guido van Rossum627b2d71993-12-24 10:39:16 +00001384# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001385was_it_defined=no
1386AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001387AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1388 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1389])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001390AC_MSG_RESULT($was_it_defined)
1391
Neal Norwitz11690112002-07-30 01:08:28 +00001392# Check whether using makedev requires defining _OSF_SOURCE
1393AC_MSG_CHECKING(for makedev)
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001394AC_TRY_LINK([#include <sys/types.h> ],
Neal Norwitz11690112002-07-30 01:08:28 +00001395 [ makedev(0, 0) ],
1396 ac_cv_has_makedev=yes,
1397 ac_cv_has_makedev=no)
1398if test "$ac_cv_has_makedev" = "no"; then
1399 # we didn't link, try if _OSF_SOURCE will allow us to link
1400 AC_TRY_LINK([
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001401#define _OSF_SOURCE 1
1402#include <sys/types.h>
Neal Norwitz11690112002-07-30 01:08:28 +00001403 ],
1404 [ makedev(0, 0) ],
1405 ac_cv_has_makedev=yes,
1406 ac_cv_has_makedev=no)
1407 if test "$ac_cv_has_makedev" = "yes"; then
1408 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1409 fi
1410fi
1411AC_MSG_RESULT($ac_cv_has_makedev)
1412if test "$ac_cv_has_makedev" = "yes"; then
1413 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1414fi
1415
Martin v. Löwis399a6892002-10-04 10:22:02 +00001416# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1417# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1418# defined, but the compiler does not support pragma redefine_extname,
1419# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1420# structures (such as rlimit64) without declaring them. As a
1421# work-around, disable LFS on such configurations
1422
1423use_lfs=yes
1424AC_MSG_CHECKING(Solaris LFS bug)
1425AC_TRY_COMPILE([
1426#define _LARGEFILE_SOURCE 1
1427#define _FILE_OFFSET_BITS 64
1428#include <sys/resource.h>
1429],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1430AC_MSG_RESULT($sol_lfs_bug)
1431if test "$sol_lfs_bug" = "yes"; then
1432 use_lfs=no
1433fi
1434
1435if test "$use_lfs" = "yes"; then
Guido van Rossum810cc512001-09-09 23:51:39 +00001436# Two defines needed to enable largefile support on various platforms
1437# These may affect some typedefs
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001438AC_DEFINE(_LARGEFILE_SOURCE, 1,
1439[This must be defined on some systems to enable large file support.])
1440AC_DEFINE(_FILE_OFFSET_BITS, 64,
1441[This must be set to 64 on some systems to enable large file support.])
Martin v. Löwis399a6892002-10-04 10:22:02 +00001442fi
Guido van Rossum810cc512001-09-09 23:51:39 +00001443
Guido van Rossum300fda71996-08-19 21:58:16 +00001444# Add some code to confdefs.h so that the test for off_t works on SCO
1445cat >> confdefs.h <<\EOF
1446#if defined(SCO_DS)
1447#undef _OFF_T
1448#endif
1449EOF
1450
Guido van Rossumef2255b2000-03-10 22:30:29 +00001451# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001452AC_TYPE_MODE_T
1453AC_TYPE_OFF_T
1454AC_TYPE_PID_T
1455AC_TYPE_SIGNAL
1456AC_TYPE_SIZE_T
1457AC_TYPE_UID_T
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001458AC_TYPE_UINT32_T
1459AC_TYPE_UINT64_T
1460AC_TYPE_INT32_T
1461AC_TYPE_INT64_T
Christian Heimes951cc0f2008-01-31 23:08:23 +00001462AC_CHECK_TYPE(ssize_t,
Martin v. Löwis18e16552006-02-15 17:27:45 +00001463 AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001464
Guido van Rossumef2255b2000-03-10 22:30:29 +00001465# Sizes of various common basic types
Skip Montanarob9820a32004-01-17 00:16:12 +00001466# ANSI C requires sizeof(char) == 1, so no need to check it
Guido van Rossum3065c942001-09-17 04:03:14 +00001467AC_CHECK_SIZEOF(int, 4)
1468AC_CHECK_SIZEOF(long, 4)
1469AC_CHECK_SIZEOF(void *, 4)
Guido van Rossum3065c942001-09-17 04:03:14 +00001470AC_CHECK_SIZEOF(short, 2)
1471AC_CHECK_SIZEOF(float, 4)
1472AC_CHECK_SIZEOF(double, 8)
1473AC_CHECK_SIZEOF(fpos_t, 4)
Martin v. Löwis18e16552006-02-15 17:27:45 +00001474AC_CHECK_SIZEOF(size_t, 4)
Christian Heimes951cc0f2008-01-31 23:08:23 +00001475AC_CHECK_SIZEOF(pid_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +00001476
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001477AC_MSG_CHECKING(for long long support)
1478have_long_long=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001479AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1480 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1481 have_long_long=yes
1482])
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001483AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001484if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +00001485AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001486fi
1487
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001488AC_MSG_CHECKING(for long double support)
1489have_long_double=no
1490AC_TRY_COMPILE([], [long double x; x = (long double)0.;], [
1491 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1492 have_long_double=yes
1493])
1494AC_MSG_RESULT($have_long_double)
Mark Dickinsondc1688a2008-06-27 22:20:14 +00001495if test "$have_long_double" = yes ; then
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001496AC_CHECK_SIZEOF(long double, 12)
1497fi
1498
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001499AC_MSG_CHECKING(for _Bool support)
1500have_c99_bool=no
1501AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [
1502 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1503 have_c99_bool=yes
1504])
1505AC_MSG_RESULT($have_c99_bool)
1506if test "$have_c99_bool" = yes ; then
1507AC_CHECK_SIZEOF(_Bool, 1)
1508fi
1509
Martin v. Löwisebe26702006-10-02 14:55:51 +00001510AC_CHECK_TYPES(uintptr_t,
1511 [AC_CHECK_SIZEOF(uintptr_t, 4)],
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001512 [], [#ifdef HAVE_STDINT_H
1513 #include <stdint.h>
1514 #endif])
Martin v. Löwisebe26702006-10-02 14:55:51 +00001515
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001516AC_CHECK_SIZEOF(off_t, [], [
1517#ifdef HAVE_SYS_TYPES_H
1518#include <sys/types.h>
1519#endif
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001520])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001521
1522AC_MSG_CHECKING(whether to enable large file support)
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001523if test "$have_long_long" = yes
1524then
1525if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001526 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001527 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1528 [Defined to enable large file support when an off_t is bigger than a long
1529 and long long is available and at least as big as an off_t. You may need
1530 to add some flags for configuration and compilation to enable this mode.
1531 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001532 AC_MSG_RESULT(yes)
1533else
1534 AC_MSG_RESULT(no)
1535fi
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001536else
1537 AC_MSG_RESULT(no)
1538fi
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001539
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001540AC_CHECK_SIZEOF(time_t, [], [
1541#ifdef HAVE_SYS_TYPES_H
1542#include <sys/types.h>
1543#endif
1544#ifdef HAVE_TIME_H
1545#include <time.h>
1546#endif
Fred Drakea3f6e912000-06-29 20:44:47 +00001547])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001548
Trent Mick635f6fb2000-08-23 21:33:05 +00001549# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001550ac_save_cc="$CC"
1551if test "$ac_cv_kpthread" = "yes"
1552then CC="$CC -Kpthread"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001553elif test "$ac_cv_kthread" = "yes"
1554then CC="$CC -Kthread"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001555elif test "$ac_cv_pthread" = "yes"
1556then CC="$CC -pthread"
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001557fi
Trent Mick635f6fb2000-08-23 21:33:05 +00001558AC_MSG_CHECKING(for pthread_t)
1559have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +00001560AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +00001561AC_MSG_RESULT($have_pthread_t)
1562if test "$have_pthread_t" = yes ; then
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001563 AC_CHECK_SIZEOF(pthread_t, [], [
1564#ifdef HAVE_PTHREAD_H
1565#include <pthread.h>
1566#endif
Trent Mick635f6fb2000-08-23 21:33:05 +00001567 ])
Trent Mick635f6fb2000-08-23 21:33:05 +00001568fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001569CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +00001570
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001571AC_MSG_CHECKING(for --enable-toolbox-glue)
1572AC_ARG_ENABLE(toolbox-glue,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001573 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001574
1575if test -z "$enable_toolbox_glue"
1576then
1577 case $ac_sys_system/$ac_sys_release in
1578 Darwin/*)
1579 enable_toolbox_glue="yes";;
1580 *)
1581 enable_toolbox_glue="no";;
1582 esac
1583fi
1584case "$enable_toolbox_glue" in
1585yes)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001586 extra_machdep_objs="Python/mactoolboxglue.o"
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001587 extra_undefs="-u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001588 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1589 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001590 ;;
1591*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001592 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +00001593 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001594 ;;
1595esac
1596AC_MSG_RESULT($enable_toolbox_glue)
1597
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00001598
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001599AC_SUBST(OTHER_LIBTOOL_OPT)
1600case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001601 Darwin/@<:@01567@:>@\..*)
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001602 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1603 ;;
1604 Darwin/*)
1605 OTHER_LIBTOOL_OPT=""
1606 ;;
1607esac
1608
Ronald Oussoren25967582009-09-06 10:00:26 +00001609
1610ARCH_RUN_32BIT=""
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001611AC_SUBST(LIBTOOL_CRUFT)
1612case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001613 Darwin/@<:@01567@:>@\..*)
Ronald Oussoren988117f2006-04-29 11:31:35 +00001614 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1615 if test "${enable_universalsdk}"; then
1616 :
1617 else
Ronald Oussoren25967582009-09-06 10:00:26 +00001618 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001619 fi
Jack Jansenb36687a2004-07-16 08:43:47 +00001620 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001621 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +00001622 Darwin/*)
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001623 gcc_version=`gcc -dumpversion`
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001624 if test ${gcc_version} '<' 4.0
1625 then
1626 LIBTOOL_CRUFT="-lcc_dynamic"
1627 else
1628 LIBTOOL_CRUFT=""
1629 fi
Ronald Oussoren23d92532009-09-07 06:12:00 +00001630 AC_TRY_RUN([
Ronald Oussoren25967582009-09-06 10:00:26 +00001631 #include <unistd.h>
1632 int main(int argc, char*argv[])
1633 {
1634 if (sizeof(long) == 4) {
1635 return 0;
1636 } else {
1637 return 1;
1638 }
Ronald Oussoren84ddd722009-09-08 07:17:10 +00001639 }
Ronald Oussoren23d92532009-09-07 06:12:00 +00001640 ], ac_osx_32bit=yes,
Ronald Oussoren25967582009-09-06 10:00:26 +00001641 ac_osx_32bit=no,
Ronald Oussoren23d92532009-09-07 06:12:00 +00001642 ac_osx_32bit=yes)
Ronald Oussoren25967582009-09-06 10:00:26 +00001643
1644 if test "${ac_osx_32bit}" = "yes"; then
1645 case `arch` in
1646 i386)
1647 MACOSX_DEFAULT_ARCH="i386"
1648 ;;
1649 ppc)
1650 MACOSX_DEFAULT_ARCH="ppc"
1651 ;;
1652 *)
1653 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1654 ;;
1655 esac
1656 else
1657 case `arch` in
1658 i386)
1659 MACOSX_DEFAULT_ARCH="x86_64"
1660 ;;
1661 ppc)
1662 MACOSX_DEFAULT_ARCH="ppc64"
1663 ;;
1664 *)
1665 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1666 ;;
1667 esac
1668
1669 #ARCH_RUN_32BIT="true"
1670 fi
1671
1672 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
Jack Jansenb36687a2004-07-16 08:43:47 +00001673 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001674 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001675esac
1676
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001677AC_MSG_CHECKING(for --enable-framework)
1678if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001679then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001680 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001681 # -F. is needed to allow linking to the framework while
1682 # in the build location.
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001683 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1684 [Define if you want to produce an OpenStep/Rhapsody framework
1685 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001686 AC_MSG_RESULT(yes)
Ronald Oussoren450d5612009-06-08 21:12:41 +00001687 if test $enable_shared = "yes"
1688 then
Ronald Oussoren9ebd2422009-09-29 13:00:44 +00001689 AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.])
Ronald Oussoren450d5612009-06-08 21:12:41 +00001690 fi
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001691else
1692 AC_MSG_RESULT(no)
1693fi
1694
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001695AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001696case $ac_sys_system/$ac_sys_release in
1697 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001698 AC_DEFINE(WITH_DYLD, 1,
1699 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1700 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1701 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001702 AC_MSG_RESULT(always on for Darwin)
1703 ;;
1704 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001705 AC_MSG_RESULT(no)
1706 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001707esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001708
Guido van Rossumac405f61994-09-12 10:56:06 +00001709# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +00001710AC_SUBST(SO)
1711AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001712AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001713AC_SUBST(CCSHARED)
1714AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001715# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +00001716# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001717AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +00001718if test -z "$SO"
1719then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001720 case $ac_sys_system in
Neal Norwitz58e28882006-05-19 07:00:58 +00001721 hp*|HP*)
1722 case `uname -m` in
1723 ia64) SO=.so;;
1724 *) SO=.sl;;
1725 esac
1726 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001727 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001728 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +00001729 esac
Martin v. Löwis368de8f2003-06-14 14:46:38 +00001730else
1731 # this might also be a termcap variable, see #610332
1732 echo
1733 echo '====================================================================='
1734 echo '+ +'
1735 echo '+ WARNING: You have set SO in your environment. +'
1736 echo '+ Do you really mean to change the extension for shared libraries? +'
1737 echo '+ Continuing in 10 seconds to let you to ponder. +'
1738 echo '+ +'
1739 echo '====================================================================='
1740 sleep 10
Guido van Rossumac405f61994-09-12 10:56:06 +00001741fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001742AC_MSG_RESULT($SO)
Ronald Oussoren79f90492009-01-02 10:44:46 +00001743
Neal Norwitz58e28882006-05-19 07:00:58 +00001744AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
Guido van Rossumac405f61994-09-12 10:56:06 +00001745# LDSHARED is the ld *command* used to create shared library
Skip Montanaroce59c042004-01-17 14:19:44 +00001746# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001747# (Shared libraries in this instance are shared modules to be loaded into
1748# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001749AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001750if test -z "$LDSHARED"
1751then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001752 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001753 AIX*)
1754 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
Guido van Rossumce608b02001-09-28 15:59:38 +00001755 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001756 ;;
1757 BeOS*)
1758 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +00001759 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001760 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001761 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +00001762 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Greg Ward57c9a662000-05-26 12:22:54 +00001763 SunOS/5*)
1764 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +00001765 then LDSHARED='$(CC) -shared'
Martin v. Löwisaa5afe12002-10-07 06:21:41 +00001766 else LDSHARED='$(CC) -G';
Greg Ward57c9a662000-05-26 12:22:54 +00001767 fi ;;
Thomas Hellerdc96a772008-04-04 10:07:55 +00001768 hp*|HP*)
1769 if test "$GCC" = "yes"
1770 then LDSHARED='$(CC) -shared'
1771 else LDSHARED='ld -b';
1772 fi ;;
Guido van Rossum71001e41995-01-26 00:44:03 +00001773 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Jack Jansen418c3b12001-11-14 10:59:57 +00001774 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +00001775 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1776 if test "$enable_framework" ; then
1777 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001778 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1779 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001780 else
1781 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +00001782 LDSHARED="$LDSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +00001783 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00001784 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001785 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1786 if test "$enable_framework" ; then
1787 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001788 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1789 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001790 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +00001791 # No framework, use the Python app as bundle-loader
1792 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
Jack Jansenc28fc372003-02-25 13:14:43 +00001793 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001794 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00001795 Darwin/*)
1796 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1797 # This allows an extension to be used in any Python
Ronald Oussoren38f1b982007-09-02 09:46:07 +00001798
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001799 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
Jack Jansen6b08a402004-06-03 12:41:45 +00001800 then
Ronald Oussoren988117f2006-04-29 11:31:35 +00001801 if test "${enable_universalsdk}"; then
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001802 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001803 fi
Jack Jansen6b08a402004-06-03 12:41:45 +00001804 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1805 BLDSHARED="$LDSHARED"
Jack Jansen6b08a402004-06-03 12:41:45 +00001806 else
1807 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1808 if test "$enable_framework" ; then
1809 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001810 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1811 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen6b08a402004-06-03 12:41:45 +00001812 else
1813 # No framework, use the Python app as bundle-loader
1814 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1815 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1816 fi
1817 fi
1818 ;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +00001819 Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';;
Guido van Rossum458e7fa1999-09-17 15:40:40 +00001820 BSD/OS*/4*) LDSHARED="gcc -shared";;
Martin v. Löwis222c5152006-06-03 07:37:13 +00001821 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +00001822 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +00001823 then
Hye-Shik Chang33761492004-10-26 09:53:46 +00001824 LDSHARED="$CC -shared ${LDFLAGS}"
Guido van Rossum0286ae82000-08-29 15:06:49 +00001825 else
1826 LDSHARED="ld -Bshareable ${LDFLAGS}"
1827 fi;;
Martin v. Löwis222c5152006-06-03 07:37:13 +00001828 OpenBSD*)
1829 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1830 then
1831 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1832 else
1833 case `uname -r` in
1834 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
1835 LDSHARED="ld -Bshareable ${LDFLAGS}"
1836 ;;
1837 *)
1838 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1839 ;;
1840 esac
1841 fi;;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001842 NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001843 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001844 if test "$GCC" = "yes"
Martin v. Löwis79f3c532002-12-11 12:51:58 +00001845 then LDSHARED='$(CC) -shared'
1846 else LDSHARED='$(CC) -G'
Martin v. Löwisbec19582001-03-21 15:57:54 +00001847 fi;;
Martin v. Löwis79f3c532002-12-11 12:51:58 +00001848 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001849 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001850 atheos*) LDSHARED="gcc -shared";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001851 *) LDSHARED="ld";;
1852 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001853fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001854AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001855BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +00001856# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001857# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001858AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001859if test -z "$CCSHARED"
1860then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001861 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +00001862 SunOS*) if test "$GCC" = yes;
Martin v. Löwiseb623572007-03-12 10:50:39 +00001863 then CCSHARED="-fPIC";
1864 elif test `uname -p` = sparc;
1865 then CCSHARED="-xcode=pic32";
1866 else CCSHARED="-Kpic";
1867 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +00001868 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +00001869 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +00001870 else CCSHARED="+z";
1871 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001872 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001873 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001874 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001875 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001876 if test "$GCC" = "yes"
1877 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001878 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +00001879 fi;;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001880 SCO_SV*)
1881 if test "$GCC" = "yes"
1882 then CCSHARED="-fPIC"
1883 else CCSHARED="-Kpic -belf"
1884 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001885 IRIX*/6*) case $CC in
1886 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +00001887 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001888 esac;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001889 atheos*) CCSHARED="-fPIC";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001890 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001891fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001892AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001893# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +00001894# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001895AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001896if test -z "$LINKFORSHARED"
1897then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001898 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001899 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +00001900 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +00001901 LINKFORSHARED="-Wl,-E -Wl,+s";;
1902# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001903 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001904 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001905 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001906 Darwin/*)
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001907 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1908 # which is
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001909 # not used by the core itself but which needs to be in the core so
1910 # that dynamically loaded extension modules have access to it.
Jack Jansen97e3f002003-02-23 22:59:01 +00001911 # -prebind is no longer used, because it actually seems to give a
1912 # slowdown in stead of a speedup, maybe due to the large number of
1913 # dynamic loads Python does.
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001914
1915 LINKFORSHARED="$extra_undefs"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001916 if test "$enable_framework"
1917 then
Jack Jansenda49e192005-01-07 13:08:22 +00001918 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001919 fi
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001920 LINKFORSHARED="$LINKFORSHARED";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001921 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001922 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +00001923 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001924 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
Guido van Rossumdf693651999-01-07 21:50:41 +00001925 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1926 then
1927 LINKFORSHARED="-Wl,--export-dynamic"
1928 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001929 SunOS/5*) case $CC in
1930 *gcc*)
Martin v. Löwisa4548572002-04-18 14:51:36 +00001931 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +00001932 then
1933 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001934 fi;;
1935 esac;;
Jason Tishler30765592003-09-04 11:04:06 +00001936 CYGWIN*)
1937 if test $enable_shared = "no"
1938 then
1939 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1940 fi;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +00001941 QNX*)
1942 # -Wl,-E causes the symbols to be added to the dynamic
1943 # symbol table so that they can be found when a module
1944 # is loaded. -N 2048K causes the stack size to be set
1945 # to 2048 kilobytes so that the stack doesn't overflow
1946 # when running test_compile.py.
1947 LINKFORSHARED='-Wl,-E -N 2048K';;
Guido van Rossumac405f61994-09-12 10:56:06 +00001948 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001949fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001950AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001951
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00001952
Neil Schemenauer61c51152001-01-26 16:18:16 +00001953AC_SUBST(CFLAGSFORSHARED)
1954AC_MSG_CHECKING(CFLAGSFORSHARED)
1955if test ! "$LIBRARY" = "$LDLIBRARY"
1956then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +00001957 case $ac_sys_system in
1958 CYGWIN*)
1959 # Cygwin needs CCSHARED when building extension DLLs
1960 # but not when building the interpreter DLL.
1961 CFLAGSFORSHARED='';;
1962 *)
1963 CFLAGSFORSHARED='$(CCSHARED)'
1964 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +00001965fi
1966AC_MSG_RESULT($CFLAGSFORSHARED)
1967
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001968# SHLIBS are libraries (except -lc and -lm) to link to the python shared
1969# library (with --enable-shared).
1970# For platforms on which shared libraries are not allowed to have unresolved
Martin v. Löwisd6359c52002-08-04 12:38:50 +00001971# symbols, this must be set to $(LIBS) (expanded by make). We do this even
1972# if it is not required, since it creates a dependency of the shared library
1973# to LIBS. This, in turn, means that applications linking the shared libpython
1974# don't need to link LIBS explicitly. The default should be only changed
1975# on systems where this approach causes problems.
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001976AC_SUBST(SHLIBS)
1977AC_MSG_CHECKING(SHLIBS)
1978case "$ac_sys_system" in
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001979 *)
Martin v. Löwisd6359c52002-08-04 12:38:50 +00001980 SHLIBS='$(LIBS)';;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001981esac
1982AC_MSG_RESULT($SHLIBS)
1983
1984
Guido van Rossum627b2d71993-12-24 10:39:16 +00001985# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001986AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1987AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Martin v. Löwis519adae2003-09-20 10:47:47 +00001988
Skip Montanaro4d756af2008-12-01 01:55:22 +00001989# only check for sem_init if thread support is requested
Martin v. Löwis519adae2003-09-20 10:47:47 +00001990if test "$with_threads" = "yes" -o -z "$with_threads"; then
1991 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
1992 # posix4 on Solaris 2.6
1993 # pthread (first!) on Linux
1994fi
1995
Martin v. Löwis19d17342003-06-14 21:03:05 +00001996# check if we need libintl for locale functions
1997AC_CHECK_LIB(intl, textdomain,
1998 AC_DEFINE(WITH_LIBINTL, 1,
1999 [Define to 1 if libintl is needed for locale functions.]))
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002000
2001# checks for system dependent C++ extensions support
2002case "$ac_sys_system" in
2003 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
2004 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
2005 [loadAndInit("", 0, "")],
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002006 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
2007 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
2008 and you want support for AIX C++ shared extension modules.])
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002009 AC_MSG_RESULT(yes)],
2010 [AC_MSG_RESULT(no)]);;
2011 *) ;;
2012esac
2013
Guido van Rossum70c7f481998-03-26 18:44:10 +00002014# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002015# BeOS' sockets are stashed in libnet.
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002016AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002017AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Skip Montanarob9949db2004-01-17 04:04:13 +00002018
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00002019case "$ac_sys_system" in
2020BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002021AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
2022;;
2023esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00002024
Guido van Rossumc5a39031996-07-31 17:35:03 +00002025AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002026AC_ARG_WITH(libs,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002027 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
2028[
Guido van Rossumc5a39031996-07-31 17:35:03 +00002029AC_MSG_RESULT($withval)
2030LIBS="$withval $LIBS"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002031],
2032[AC_MSG_RESULT(no)])
Guido van Rossum627b2d71993-12-24 10:39:16 +00002033
Benjamin Peterson2c196742009-12-31 03:17:18 +00002034# Check for use of the system expat library
2035AC_MSG_CHECKING(for --with-system-expat)
2036AC_ARG_WITH(system_expat,
2037 AC_HELP_STRING(--with-system-expat, build pyexpat module using an installed expat library))
2038
2039AC_MSG_RESULT($with_system_expat)
2040
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002041# Check for use of the system libffi library
2042AC_MSG_CHECKING(for --with-system-ffi)
2043AC_ARG_WITH(system_ffi,
2044 AC_HELP_STRING(--with-system-ffi, build _ctypes module using an installed ffi library))
2045
Benjamin Peterson1c335e62010-01-01 15:16:29 +00002046if test "$with_system_ffi" = "yes"; then
2047 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2048 LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
2049else
2050 LIBFFI_INCLUDEDIR=""
2051fi
2052AC_SUBST(LIBFFI_INCLUDEDIR)
2053
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002054AC_MSG_RESULT($with_system_ffi)
2055
Matthias Klose10cbe482009-04-29 17:18:19 +00002056# Check for --with-dbmliborder
2057AC_MSG_CHECKING(for --with-dbmliborder)
2058AC_ARG_WITH(dbmliborder,
Matthias Klose51c614e2009-04-29 19:52:49 +00002059 AC_HELP_STRING([--with-dbmliborder=db1:db2:...], [order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]),
Matthias Klose10cbe482009-04-29 17:18:19 +00002060[
2061if test x$with_dbmliborder = xyes
2062then
2063AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2064else
2065 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
2066 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
2067 then
2068 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2069 fi
2070 done
Matthias Klose61dbdb92009-04-29 20:09:50 +00002071fi])
2072AC_MSG_RESULT($with_dbmliborder)
Matthias Klose10cbe482009-04-29 17:18:19 +00002073
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002074# Determine if signalmodule should be used.
2075AC_SUBST(USE_SIGNAL_MODULE)
2076AC_SUBST(SIGNAL_OBJS)
2077AC_MSG_CHECKING(for --with-signal-module)
2078AC_ARG_WITH(signal-module,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002079 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002080
2081if test -z "$with_signal_module"
2082then with_signal_module="yes"
2083fi
2084AC_MSG_RESULT($with_signal_module)
2085
2086if test "${with_signal_module}" = "yes"; then
2087 USE_SIGNAL_MODULE=""
2088 SIGNAL_OBJS=""
2089else
2090 USE_SIGNAL_MODULE="#"
2091 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2092fi
2093
Guido van Rossum3d15bd82001-01-10 18:53:48 +00002094# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00002095AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002096USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00002097
Guido van Rossum54d93d41997-01-22 20:51:58 +00002098AC_MSG_CHECKING(for --with-dec-threads)
2099AC_SUBST(LDLAST)
2100AC_ARG_WITH(dec-threads,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002101 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
2102[
Barry Warsawc0d24d82000-06-29 16:12:00 +00002103AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00002104LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00002105if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00002106 with_thread="$withval";
2107fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002108[AC_MSG_RESULT(no)])
Guido van Rossum54d93d41997-01-22 20:51:58 +00002109
Martin v. Löwis11437992002-04-12 09:54:03 +00002110# Templates for things AC_DEFINEd more than once.
2111# For a single AC_DEFINE, no template is needed.
2112AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2113AH_TEMPLATE(_REENTRANT,
2114 [Define to force use of thread-safe errno, h_errno, and other functions])
2115AH_TEMPLATE(WITH_THREAD,
2116 [Define if you want to compile in rudimentary thread support])
2117
Guido van Rossum54d93d41997-01-22 20:51:58 +00002118AC_MSG_CHECKING(for --with-threads)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002119dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawc0d24d82000-06-29 16:12:00 +00002120AC_ARG_WITH(threads,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002121 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
Guido van Rossum54d93d41997-01-22 20:51:58 +00002122
Barry Warsawc0d24d82000-06-29 16:12:00 +00002123# --with-thread is deprecated, but check for it anyway
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002124dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00002125AC_ARG_WITH(thread,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002126 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
2127 [with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002128
2129if test -z "$with_threads"
2130then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002131fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00002132AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00002133
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002134AC_SUBST(THREADOBJ)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002135if test "$with_threads" = "no"
2136then
2137 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002138elif test "$ac_cv_pthread_is_default" = yes
2139then
2140 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002141 # Defining _REENTRANT on system with POSIX threads should not hurt.
2142 AC_DEFINE(_REENTRANT)
2143 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002144 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00002145elif test "$ac_cv_kpthread" = "yes"
2146then
2147 CC="$CC -Kpthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002148 if test "$ac_cv_cxx_thread" = "yes"; then
2149 CXX="$CXX -Kpthread"
2150 fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00002151 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002152 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002153 THREADOBJ="Python/thread.o"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002154elif test "$ac_cv_kthread" = "yes"
2155then
2156 CC="$CC -Kthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002157 if test "$ac_cv_cxx_thread" = "yes"; then
2158 CXX="$CXX -Kthread"
2159 fi
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002160 AC_DEFINE(WITH_THREAD)
2161 posix_threads=yes
2162 THREADOBJ="Python/thread.o"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002163elif test "$ac_cv_pthread" = "yes"
2164then
2165 CC="$CC -pthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002166 if test "$ac_cv_cxx_thread" = "yes"; then
2167 CXX="$CXX -pthread"
2168 fi
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002169 AC_DEFINE(WITH_THREAD)
2170 posix_threads=yes
2171 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +00002172else
Martin v. Löwis130fb172001-07-19 11:00:41 +00002173 if test ! -z "$with_threads" -a -d "$with_threads"
2174 then LDFLAGS="$LDFLAGS -L$with_threads"
2175 fi
2176 if test ! -z "$withval" -a -d "$withval"
2177 then LDFLAGS="$LDFLAGS -L$withval"
2178 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002179
2180 # According to the POSIX spec, a pthreads implementation must
Matthias Klosea2542be2004-08-16 11:35:51 +00002181 # define _POSIX_THREADS in unistd.h. Some apparently don't
2182 # (e.g. gnu pth with pthread emulation)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002183 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2184 AC_EGREP_CPP(yes,
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002185 [
2186#include <unistd.h>
2187#ifdef _POSIX_THREADS
2188yes
2189#endif
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002190 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2191 AC_MSG_RESULT($unistd_defines_pthreads)
2192
Martin v. Löwis130fb172001-07-19 11:00:41 +00002193 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002194 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2195 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002196 AC_DEFINE(HURD_C_THREADS, 1,
2197 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002198 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002199 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002200 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2201 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002202 AC_DEFINE(MACH_C_THREADS, 1,
2203 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002204 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002205 AC_MSG_CHECKING(for --with-pth)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002206 AC_ARG_WITH([pth],
2207 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
2208 [AC_MSG_RESULT($withval)
2209 AC_DEFINE([WITH_THREAD])
2210 AC_DEFINE([HAVE_PTH], 1,
2211 [Define if you have GNU PTH threads.])
2212 LIBS="-lpth $LIBS"
2213 THREADOBJ="Python/thread.o"],
2214 [AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002215
2216 # Just looking for pthread_create in libpthread is not enough:
2217 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2218 # So we really have to include pthread.h, and then link.
2219 _libs=$LIBS
2220 LIBS="$LIBS -lpthread"
2221 AC_MSG_CHECKING([for pthread_create in -lpthread])
2222 AC_TRY_LINK([#include <pthread.h>
2223
2224void * start_routine (void *arg) { exit (0); }], [
2225pthread_create (NULL, NULL, start_routine, NULL)], [
2226 AC_MSG_RESULT(yes)
2227 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002228 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002229 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002230 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00002231 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002232 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002233 THREADOBJ="Python/thread.o"],[
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002234 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2235 AC_DEFINE(ATHEOS_THREADS, 1,
2236 [Define this if you have AtheOS threads.])
2237 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002238 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002239 AC_DEFINE(BEOS_THREADS, 1,
2240 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002241 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002242 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002243 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002244 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002245 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002246 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002247 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002248 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002249 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002250 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002251 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002252 LIBS="$LIBS -lpthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002253 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002254 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002255 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002256 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002257 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002258 USE_THREAD_MODULE="#"])
Skip Montanarof8712e52004-01-17 03:04:46 +00002259 ])])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002260
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002261 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2262 LIBS="$LIBS -lmpc"
2263 THREADOBJ="Python/thread.o"
2264 USE_THREAD_MODULE=""])
2265
2266 if test "$posix_threads" != "yes"; then
2267 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2268 LIBS="$LIBS -lthread"
2269 THREADOBJ="Python/thread.o"
2270 USE_THREAD_MODULE=""])
2271 fi
2272
2273 if test "$USE_THREAD_MODULE" != "#"
2274 then
2275 # If the above checks didn't disable threads, (at least) OSF1
2276 # needs this '-threads' argument during linking.
2277 case $ac_sys_system in
2278 OSF1) LDLAST=-threads;;
2279 esac
2280 fi
2281fi
2282
2283if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002284 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002285 AC_DEFINE(_POSIX_THREADS, 1,
2286 [Define if you have POSIX threads,
2287 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002288 fi
2289
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002290 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2291 case $ac_sys_system/$ac_sys_release in
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002292 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
2293 Defined for Solaris 2.6 bug in pthread header.)
2294 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002295 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002296 Define if the Posix semaphores do not work on your system)
2297 ;;
Christian Heimescba36bb2008-01-30 22:54:18 +00002298 AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2299 Define if the Posix semaphores do not work on your system)
2300 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002301 esac
2302
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002303 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2304 AC_CACHE_VAL(ac_cv_pthread_system_supported,
2305 [AC_TRY_RUN([#include <pthread.h>
2306 void *foo(void *parm) {
2307 return NULL;
2308 }
2309 main() {
2310 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002311 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002312 if (pthread_attr_init(&attr)) exit(-1);
2313 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002314 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002315 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00002316 }],
2317 ac_cv_pthread_system_supported=yes,
2318 ac_cv_pthread_system_supported=no,
2319 ac_cv_pthread_system_supported=no)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002320 ])
2321 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2322 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002323 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002324 fi
Jason Tishlerfac083d2003-07-22 15:20:49 +00002325 AC_CHECK_FUNCS(pthread_sigmask,
2326 [case $ac_sys_system in
2327 CYGWIN*)
2328 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2329 [Define if pthread_sigmask() does not work on your system.])
2330 ;;
2331 esac])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002332fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002333
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002334
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002335# Check for enable-ipv6
Martin v. Löwis11437992002-04-12 09:54:03 +00002336AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002337AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002338AC_ARG_ENABLE(ipv6,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002339[ --enable-ipv6 Enable ipv6 (with ipv4) support
2340 --disable-ipv6 Disable ipv6 support],
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002341[ case "$enableval" in
2342 no)
2343 AC_MSG_RESULT(no)
2344 ipv6=no
2345 ;;
2346 *) AC_MSG_RESULT(yes)
2347 AC_DEFINE(ENABLE_IPV6)
2348 ipv6=yes
2349 ;;
2350 esac ],
2351
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002352[
2353dnl the check does not work on cross compilation case...
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002354 AC_TRY_RUN([ /* AF_INET6 available check */
2355#include <sys/types.h>
2356#include <sys/socket.h>
2357main()
2358{
2359 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
2360 exit(1);
2361 else
2362 exit(0);
2363}
2364],
2365 AC_MSG_RESULT(yes)
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002366 ipv6=yes,
2367 AC_MSG_RESULT(no)
2368 ipv6=no,
2369 AC_MSG_RESULT(no)
2370 ipv6=no
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002371)
2372
2373if test "$ipv6" = "yes"; then
2374 AC_MSG_CHECKING(if RFC2553 API is available)
2375 AC_TRY_COMPILE([#include <sys/types.h>
2376#include <netinet/in.h>],
2377 [struct sockaddr_in6 x;
2378x.sin6_scope_id;],
2379 AC_MSG_RESULT(yes)
2380 ipv6=yes,
2381 AC_MSG_RESULT(no, IPv6 disabled)
2382 ipv6=no)
2383fi
2384
2385if test "$ipv6" = "yes"; then
2386 AC_DEFINE(ENABLE_IPV6)
2387fi
2388])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002389
2390ipv6type=unknown
2391ipv6lib=none
2392ipv6trylibc=no
2393
2394if test "$ipv6" = "yes"; then
2395 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00002396 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2397 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002398 case $i in
2399 inria)
2400 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002401 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002402#include <netinet/in.h>
2403#ifdef IPV6_INRIA_VERSION
2404yes
2405#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002406 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002407 ;;
2408 kame)
2409 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002410 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002411#include <netinet/in.h>
2412#ifdef __KAME__
2413yes
2414#endif],
2415 [ipv6type=$i;
2416 ipv6lib=inet6
2417 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002418 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002419 ;;
2420 linux-glibc)
2421 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002422 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002423#include <features.h>
2424#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2425yes
2426#endif],
2427 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002428 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002429 ;;
2430 linux-inet6)
2431 dnl http://www.v6.linux.or.jp/
2432 if test -d /usr/inet6; then
2433 ipv6type=$i
2434 ipv6lib=inet6
2435 ipv6libdir=/usr/inet6/lib
Skip Montanarodecc6a42003-01-01 20:07:49 +00002436 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002437 fi
2438 ;;
2439 solaris)
2440 if test -f /etc/netconfig; then
2441 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
2442 ipv6type=$i
2443 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002444 fi
2445 fi
2446 ;;
2447 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002448 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002449#include <sys/param.h>
2450#ifdef _TOSHIBA_INET6
2451yes
2452#endif],
2453 [ipv6type=$i;
2454 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002455 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002456 ;;
2457 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002458 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002459#include </usr/local/v6/include/sys/v6config.h>
2460#ifdef __V6D__
2461yes
2462#endif],
2463 [ipv6type=$i;
2464 ipv6lib=v6;
2465 ipv6libdir=/usr/local/v6/lib;
Skip Montanarodecc6a42003-01-01 20:07:49 +00002466 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002467 ;;
2468 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002469 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002470#include <sys/param.h>
2471#ifdef _ZETA_MINAMI_INET6
2472yes
2473#endif],
2474 [ipv6type=$i;
2475 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002476 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002477 ;;
2478 esac
2479 if test "$ipv6type" != "unknown"; then
2480 break
2481 fi
2482 done
2483 AC_MSG_RESULT($ipv6type)
2484fi
2485
2486if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2487 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2488 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2489 echo "using lib$ipv6lib"
2490 else
2491 if test $ipv6trylibc = "yes"; then
2492 echo "using libc"
2493 else
2494 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2495 echo "You need to fetch lib$ipv6lib.a from appropriate"
2496 echo 'ipv6 kit and compile beforehand.'
2497 exit 1
2498 fi
2499 fi
2500fi
2501
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002502AC_MSG_CHECKING(for OSX 10.5 SDK or later)
2503AC_TRY_COMPILE([#include <Carbon/Carbon.h>], FSIORefNum fRef = 0,
2504 AC_DEFINE(HAVE_OSX105_SDK, 1, Define if compiling using MacOS X 10.5 SDK or later.)
2505 AC_MSG_RESULT(yes),
2506 AC_MSG_RESULT(no)
2507)
2508
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002509# Check for --with-doc-strings
2510AC_MSG_CHECKING(for --with-doc-strings)
2511AC_ARG_WITH(doc-strings,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002512 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002513
2514if test -z "$with_doc_strings"
2515then with_doc_strings="yes"
2516fi
2517if test "$with_doc_strings" != "no"
2518then
2519 AC_DEFINE(WITH_DOC_STRINGS, 1,
2520 [Define if you want documentation strings in extension modules])
2521fi
2522AC_MSG_RESULT($with_doc_strings)
2523
Neil Schemenauera35c6882001-02-27 04:45:05 +00002524# Check for Python-specific malloc support
Martin v. Löwisf30d60e2004-06-08 08:17:44 +00002525AC_MSG_CHECKING(for --with-tsc)
2526AC_ARG_WITH(tsc,
2527[ --with(out)-tsc enable/disable timestamp counter profile], [
2528if test "$withval" != no
2529then
2530 AC_DEFINE(WITH_TSC, 1,
2531 [Define to profile with the Pentium timestamp counter])
2532 AC_MSG_RESULT(yes)
2533else AC_MSG_RESULT(no)
2534fi],
2535[AC_MSG_RESULT(no)])
2536
2537# Check for Python-specific malloc support
Neil Schemenauera35c6882001-02-27 04:45:05 +00002538AC_MSG_CHECKING(for --with-pymalloc)
2539AC_ARG_WITH(pymalloc,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002540 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
Neil Schemenauer16c22972002-03-22 15:34:49 +00002541
2542if test -z "$with_pymalloc"
2543then with_pymalloc="yes"
2544fi
2545if test "$with_pymalloc" != "no"
2546then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002547 AC_DEFINE(WITH_PYMALLOC, 1,
2548 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00002549fi
2550AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00002551
Benjamin Peterson91c12eb2009-12-03 02:52:39 +00002552# Check for Valgrind support
2553AC_MSG_CHECKING([for --with-valgrind])
2554AC_ARG_WITH([valgrind],
2555 AC_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
2556 with_valgrind=no)
2557AC_MSG_RESULT([$with_valgrind])
2558if test "$with_valgrind" != no; then
2559 AC_CHECK_HEADER([valgrind/valgrind.h],
2560 [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
2561 [AC_MSG_ERROR([Valgrind support requested but headers not available])]
2562 )
2563fi
2564
Barry Warsawef82cd72000-06-30 16:21:01 +00002565# Check for --with-wctype-functions
2566AC_MSG_CHECKING(for --with-wctype-functions)
2567AC_ARG_WITH(wctype-functions,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002568 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
2569[
Barry Warsawef82cd72000-06-30 16:21:01 +00002570if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002571then
2572 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2573 [Define if you want wctype.h functions to be used instead of the
2574 one supplied by Python itself. (see Include/unicodectype.h).])
2575 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00002576else AC_MSG_RESULT(no)
2577fi],
2578[AC_MSG_RESULT(no)])
2579
Guido van Rossum68242b51996-05-28 22:53:03 +00002580# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002581AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00002582DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002583
Guido van Rossume97ee181999-12-20 21:27:22 +00002584# the dlopen() function means we might want to use dynload_shlib.o. some
2585# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00002586AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00002587
2588# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2589# loading of modules.
2590AC_SUBST(DYNLOADFILE)
2591AC_MSG_CHECKING(DYNLOADFILE)
2592if test -z "$DYNLOADFILE"
2593then
2594 case $ac_sys_system/$ac_sys_release in
Martin v. Löwisc19c5a62003-11-18 20:00:44 +00002595 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2596 if test "$ac_cv_func_dlopen" = yes
2597 then DYNLOADFILE="dynload_shlib.o"
2598 else DYNLOADFILE="dynload_aix.o"
2599 fi
2600 ;;
Guido van Rossume97ee181999-12-20 21:27:22 +00002601 BeOS*) DYNLOADFILE="dynload_beos.o";;
2602 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Anthony Baxter82201742006-04-09 15:07:40 +00002603 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2604 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002605 atheos*) DYNLOADFILE="dynload_atheos.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00002606 *)
2607 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2608 # out any dynamic loading
2609 if test "$ac_cv_func_dlopen" = yes
2610 then DYNLOADFILE="dynload_shlib.o"
2611 else DYNLOADFILE="dynload_stub.o"
2612 fi
2613 ;;
2614 esac
2615fi
2616AC_MSG_RESULT($DYNLOADFILE)
2617if test "$DYNLOADFILE" != "dynload_stub.o"
2618then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002619 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2620 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00002621fi
2622
Jack Jansenc49e5b72001-06-19 15:00:23 +00002623# MACHDEP_OBJS can be set to platform-specific object files needed by Python
2624
2625AC_SUBST(MACHDEP_OBJS)
2626AC_MSG_CHECKING(MACHDEP_OBJS)
2627if test -z "$MACHDEP_OBJS"
2628then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002629 MACHDEP_OBJS=$extra_machdep_objs
2630else
2631 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00002632fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002633AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00002634
Guido van Rossum627b2d71993-12-24 10:39:16 +00002635# checks for library functions
Martin v. Löwisaef18b12008-03-24 13:31:16 +00002636AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2637 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
Martin v. Löwis438b5342002-12-27 10:16:42 +00002638 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00002639 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
Antoine Pitrou30b3b352009-12-02 20:37:54 +00002640 initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime \
Martin v. Löwisa5f09072002-10-11 05:37:59 +00002641 mremap nice pathconf pause plock poll pthread_init \
Guido van Rossum162e38c2003-02-19 15:25:10 +00002642 putenv readlink realpath \
Jesse Noller355b1262009-04-02 00:03:28 +00002643 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
2644 setgid \
Martin v. Löwis4daacb12003-03-28 18:37:01 +00002645 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00002646 setlocale setregid setreuid setresuid setresgid \
2647 setsid setpgid setpgrp setuid setvbuf snprintf \
Skip Montanaro7e11a012004-02-07 12:55:46 +00002648 sigaction siginterrupt sigrelse strftime \
Michael W. Hudson34f20ea2002-05-27 15:08:24 +00002649 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Neal Norwitz05a45592006-03-20 06:30:08 +00002650 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00002651
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002652# For some functions, having a definition is not sufficient, since
2653# we want to take their address.
2654AC_MSG_CHECKING(for chroot)
2655AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2656 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2657 AC_MSG_RESULT(yes),
2658 AC_MSG_RESULT(no)
2659)
2660AC_MSG_CHECKING(for link)
2661AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2662 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2663 AC_MSG_RESULT(yes),
2664 AC_MSG_RESULT(no)
2665)
2666AC_MSG_CHECKING(for symlink)
2667AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2668 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2669 AC_MSG_RESULT(yes),
2670 AC_MSG_RESULT(no)
2671)
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002672AC_MSG_CHECKING(for fchdir)
2673AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2674 AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2675 AC_MSG_RESULT(yes),
2676 AC_MSG_RESULT(no)
2677)
2678AC_MSG_CHECKING(for fsync)
2679AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
Skip Montanarod4fa8072003-09-25 14:49:15 +00002680 AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002681 AC_MSG_RESULT(yes),
2682 AC_MSG_RESULT(no)
2683)
2684AC_MSG_CHECKING(for fdatasync)
2685AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2686 AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2687 AC_MSG_RESULT(yes),
2688 AC_MSG_RESULT(no)
2689)
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00002690AC_MSG_CHECKING(for epoll)
2691AC_TRY_COMPILE([#include <sys/epoll.h>], void *x=epoll_create,
2692 AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2693 AC_MSG_RESULT(yes),
2694 AC_MSG_RESULT(no)
2695)
2696AC_MSG_CHECKING(for kqueue)
2697AC_TRY_COMPILE([
2698#include <sys/types.h>
2699#include <sys/event.h>
2700 ], int x=kqueue(),
2701 AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2702 AC_MSG_RESULT(yes),
2703 AC_MSG_RESULT(no)
2704)
Martin v. Löwisd5843682002-11-21 20:41:28 +00002705# On some systems (eg. FreeBSD 5), we would find a definition of the
2706# functions ctermid_r, setgroups in the library, but no prototype
2707# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2708# address to avoid compiler warnings and potential miscompilations
2709# because of the missing prototypes.
2710
2711AC_MSG_CHECKING(for ctermid_r)
2712AC_TRY_COMPILE([
2713#include "confdefs.h"
2714#include <stdio.h>
2715], void* p = ctermid_r,
2716 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2717 AC_MSG_RESULT(yes),
2718 AC_MSG_RESULT(no)
2719)
2720
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00002721AC_MSG_CHECKING(for flock)
2722AC_TRY_COMPILE([
2723#include "confdefs.h"
2724#include <sys/file.h>
2725], void* p = flock,
2726 AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2727 AC_MSG_RESULT(yes),
2728 AC_MSG_RESULT(no)
2729)
2730
2731AC_MSG_CHECKING(for getpagesize)
2732AC_TRY_COMPILE([
2733#include "confdefs.h"
2734#include <unistd.h>
2735], void* p = getpagesize,
2736 AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2737 AC_MSG_RESULT(yes),
2738 AC_MSG_RESULT(no)
2739)
2740
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002741dnl check for true
2742AC_CHECK_PROGS(TRUE, true, /bin/true)
2743
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002744dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2745dnl On others, they are in the C library, so we to take no action
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002746AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002747 AC_CHECK_LIB(resolv, inet_aton)
2748)
2749
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002750# On Tru64, chflags seems to be present, but calling it will
2751# exit Python
Gregory P. Smithbb213892009-11-02 01:37:37 +00002752AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
Alexandre Vassalotti30267d62009-07-17 06:10:06 +00002753AC_TRY_RUN([[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002754#include <sys/stat.h>
2755#include <unistd.h>
2756int main(int argc, char*argv[])
2757{
2758 if(chflags(argv[0], 0) != 0)
2759 return 1;
2760 return 0;
2761}
Alexandre Vassalotti30267d62009-07-17 06:10:06 +00002762]], ac_cv_have_chflags=yes,
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002763 ac_cv_have_chflags=no,
Gregory P. Smithbb213892009-11-02 01:37:37 +00002764 ac_cv_have_chflags=cross)
2765])
2766if test "$ac_cv_have_chflags" = cross ; then
2767 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
2768fi
2769if test "$ac_cv_have_chflags" = yes ; then
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002770 AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
2771fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002772
Gregory P. Smithbb213892009-11-02 01:37:37 +00002773AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
Alexandre Vassalotti30267d62009-07-17 06:10:06 +00002774AC_TRY_RUN([[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002775#include <sys/stat.h>
2776#include <unistd.h>
2777int main(int argc, char*argv[])
2778{
2779 if(lchflags(argv[0], 0) != 0)
2780 return 1;
2781 return 0;
2782}
Alexandre Vassalotti30267d62009-07-17 06:10:06 +00002783]], ac_cv_have_lchflags=yes,
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002784 ac_cv_have_lchflags=no,
Gregory P. Smithbb213892009-11-02 01:37:37 +00002785 ac_cv_have_lchflags=cross)
2786])
2787if test "$ac_cv_have_lchflags" = cross ; then
2788 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
2789fi
2790if test "$ac_cv_have_lchflags" = yes ; then
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002791 AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
2792fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002793
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00002794dnl Check if system zlib has *Copy() functions
Ronald Oussorenf8752642006-07-06 10:13:35 +00002795dnl
2796dnl On MacOSX the linker will search for dylibs on the entire linker path
2797dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
2798dnl to revert to a more traditional unix behaviour and make it possible to
2799dnl override the system libz with a local static library of libz. Temporarily
2800dnl add that flag to our CFLAGS as well to ensure that we check the version
2801dnl of libz that will be used by setup.py.
2802dnl The -L/usr/local/lib is needed as wel to get the same compilation
2803dnl environment as setup.py (and leaving it out can cause configure to use the
2804dnl wrong version of the library)
2805case $ac_sys_system/$ac_sys_release in
2806Darwin/*)
2807 _CUR_CFLAGS="${CFLAGS}"
2808 _CUR_LDFLAGS="${LDFLAGS}"
2809 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
2810 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
2811 ;;
2812esac
2813
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00002814AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, Define if the zlib library has inflateCopy))
2815
Ronald Oussorenf8752642006-07-06 10:13:35 +00002816case $ac_sys_system/$ac_sys_release in
2817Darwin/*)
2818 CFLAGS="${_CUR_CFLAGS}"
2819 LDFLAGS="${_CUR_LDFLAGS}"
2820 ;;
2821esac
2822
Martin v. Löwise9416172003-05-03 10:12:45 +00002823AC_MSG_CHECKING(for hstrerror)
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002824AC_TRY_LINK([
Martin v. Löwise9416172003-05-03 10:12:45 +00002825#include "confdefs.h"
2826#include <netdb.h>
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002827], void* p = hstrerror; hstrerror(0),
Martin v. Löwise9416172003-05-03 10:12:45 +00002828 AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2829 AC_MSG_RESULT(yes),
2830 AC_MSG_RESULT(no)
2831)
2832
2833AC_MSG_CHECKING(for inet_aton)
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002834AC_TRY_LINK([
Martin v. Löwise9416172003-05-03 10:12:45 +00002835#include "confdefs.h"
Martin v. Löwis86d66262006-02-17 08:40:11 +00002836#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00002837#include <sys/socket.h>
2838#include <netinet/in.h>
2839#include <arpa/inet.h>
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002840], void* p = inet_aton;inet_aton(0,0),
Martin v. Löwise9416172003-05-03 10:12:45 +00002841 AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2842 AC_MSG_RESULT(yes),
2843 AC_MSG_RESULT(no)
2844)
2845
2846AC_MSG_CHECKING(for inet_pton)
2847AC_TRY_COMPILE([
2848#include "confdefs.h"
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00002849#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00002850#include <sys/socket.h>
2851#include <netinet/in.h>
2852#include <arpa/inet.h>
2853], void* p = inet_pton,
2854 AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2855 AC_MSG_RESULT(yes),
2856 AC_MSG_RESULT(no)
2857)
2858
Martin v. Löwisd6640d42003-07-06 09:29:52 +00002859# On some systems, setgroups is in unistd.h, on others, in grp.h
Martin v. Löwisd5843682002-11-21 20:41:28 +00002860AC_MSG_CHECKING(for setgroups)
2861AC_TRY_COMPILE([
2862#include "confdefs.h"
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00002863#include <unistd.h>
Martin v. Löwisd6640d42003-07-06 09:29:52 +00002864#ifdef HAVE_GRP_H
2865#include <grp.h>
2866#endif
Martin v. Löwisd5843682002-11-21 20:41:28 +00002867],
2868void* p = setgroups,
2869 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2870 AC_MSG_RESULT(yes),
2871 AC_MSG_RESULT(no)
2872)
2873
Fred Drake8cef4cf2000-06-28 16:40:38 +00002874# check for openpty and forkpty
2875
Martin v. Löwisfd9a72a2006-01-08 10:07:33 +00002876AC_CHECK_FUNCS(openpty,,
2877 AC_CHECK_LIB(util,openpty,
2878 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2879 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2880 )
2881)
2882AC_CHECK_FUNCS(forkpty,,
2883 AC_CHECK_LIB(util,forkpty,
2884 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2885 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2886 )
2887)
Fred Drake8cef4cf2000-06-28 16:40:38 +00002888
Brett Cannonaa5778d2008-03-18 04:09:00 +00002889# Stuff for expat.
2890AC_CHECK_FUNCS(memmove)
2891
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00002892# check for long file support functions
2893AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2894
Brett Cannonaa5778d2008-03-18 04:09:00 +00002895AC_REPLACE_FUNCS(dup2 getcwd strdup)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002896AC_CHECK_FUNCS(getpgrp,
2897 AC_TRY_COMPILE([#include <unistd.h>],
2898 [getpgrp(0);],
2899 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2900 [Define if getpgrp() must be called as getpgrp(0).])
2901 )
2902)
Jack Jansen150753c2003-03-29 22:07:47 +00002903AC_CHECK_FUNCS(setpgrp,
2904 AC_TRY_COMPILE([#include <unistd.h>],
2905 [setpgrp(0,0);],
2906 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2907 [Define if setpgrp() must be called as setpgrp(0, 0).])
2908 )
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002909)
2910AC_CHECK_FUNCS(gettimeofday,
2911 AC_TRY_COMPILE([#include <sys/time.h>],
2912 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2913 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2914 [Define if gettimeofday() does not have second (timezone) argument
2915 This is the case on Motorola V4 (R40V4.2)])
2916 )
2917)
Guido van Rossum627b2d71993-12-24 10:39:16 +00002918
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002919AC_MSG_CHECKING(for major, minor, and makedev)
Martin v. Löwise3271202002-11-07 07:42:30 +00002920AC_TRY_LINK([
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002921#if defined(MAJOR_IN_MKDEV)
2922#include <sys/mkdev.h>
2923#elif defined(MAJOR_IN_SYSMACROS)
2924#include <sys/sysmacros.h>
2925#else
2926#include <sys/types.h>
2927#endif
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002928],[
2929 makedev(major(0),minor(0));
2930],[
2931 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2932 [Define to 1 if you have the device macros.])
2933 AC_MSG_RESULT(yes)
2934],[
2935 AC_MSG_RESULT(no)
2936])
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002937
2938# On OSF/1 V5.1, getaddrinfo is available, but a define
2939# for [no]getaddrinfo in netdb.h.
2940AC_MSG_CHECKING(for getaddrinfo)
2941AC_TRY_LINK([
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00002942#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002943#include <sys/socket.h>
2944#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00002945#include <stdio.h>
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002946], [getaddrinfo(NULL, NULL, NULL, NULL);],
2947have_getaddrinfo=yes,
2948have_getaddrinfo=no)
2949AC_MSG_RESULT($have_getaddrinfo)
2950if test $have_getaddrinfo = yes
2951then
2952 AC_MSG_CHECKING(getaddrinfo bug)
2953 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
2954 AC_TRY_RUN([[
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002955#include <sys/types.h>
2956#include <netdb.h>
2957#include <string.h>
2958#include <sys/socket.h>
2959#include <netinet/in.h>
2960
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002961int main()
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002962{
2963 int passive, gaierr, inet4 = 0, inet6 = 0;
2964 struct addrinfo hints, *ai, *aitop;
2965 char straddr[INET6_ADDRSTRLEN], strport[16];
2966
2967 for (passive = 0; passive <= 1; passive++) {
2968 memset(&hints, 0, sizeof(hints));
2969 hints.ai_family = AF_UNSPEC;
2970 hints.ai_flags = passive ? AI_PASSIVE : 0;
2971 hints.ai_socktype = SOCK_STREAM;
Hye-Shik Chang54f94392004-04-14 07:55:31 +00002972 hints.ai_protocol = IPPROTO_TCP;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002973 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2974 (void)gai_strerror(gaierr);
2975 goto bad;
2976 }
2977 for (ai = aitop; ai; ai = ai->ai_next) {
2978 if (ai->ai_addr == NULL ||
2979 ai->ai_addrlen == 0 ||
2980 getnameinfo(ai->ai_addr, ai->ai_addrlen,
2981 straddr, sizeof(straddr), strport, sizeof(strport),
2982 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2983 goto bad;
2984 }
2985 switch (ai->ai_family) {
2986 case AF_INET:
2987 if (strcmp(strport, "54321") != 0) {
2988 goto bad;
2989 }
2990 if (passive) {
2991 if (strcmp(straddr, "0.0.0.0") != 0) {
2992 goto bad;
2993 }
2994 } else {
2995 if (strcmp(straddr, "127.0.0.1") != 0) {
2996 goto bad;
2997 }
2998 }
2999 inet4++;
3000 break;
3001 case AF_INET6:
3002 if (strcmp(strport, "54321") != 0) {
3003 goto bad;
3004 }
3005 if (passive) {
3006 if (strcmp(straddr, "::") != 0) {
3007 goto bad;
3008 }
3009 } else {
3010 if (strcmp(straddr, "::1") != 0) {
3011 goto bad;
3012 }
3013 }
3014 inet6++;
3015 break;
3016 case AF_UNSPEC:
3017 goto bad;
3018 break;
3019 default:
3020 /* another family support? */
3021 break;
3022 }
3023 }
3024 }
3025
3026 if (!(inet4 == 0 || inet4 == 2))
3027 goto bad;
3028 if (!(inet6 == 0 || inet6 == 2))
3029 goto bad;
3030
3031 if (aitop)
3032 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003033 return 0;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003034
3035 bad:
3036 if (aitop)
3037 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003038 return 1;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003039}
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003040]], ac_cv_buggy_getaddrinfo=no,
3041 ac_cv_buggy_getaddrinfo=yes,
3042 ac_cv_buggy_getaddrinfo=yes))
3043fi
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003044
Mark Dickinson0ef0b912009-12-31 21:11:48 +00003045if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003046then
3047 if test $ipv6 = yes
3048 then
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003049 echo 'Fatal: You must get working getaddrinfo() function.'
3050 echo ' or you can specify "--disable-ipv6"'.
3051 exit 1
3052 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003053else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003054 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003055fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00003056AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003057
Guido van Rossum627b2d71993-12-24 10:39:16 +00003058# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003059AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00003060AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003061AC_STRUCT_TIMEZONE
Martin v. Löwis60a5d722002-10-16 20:28:25 +00003062AC_CHECK_MEMBERS([struct stat.st_rdev])
3063AC_CHECK_MEMBERS([struct stat.st_blksize])
Hye-Shik Chang5f937a72005-06-02 13:09:30 +00003064AC_CHECK_MEMBERS([struct stat.st_flags])
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00003065AC_CHECK_MEMBERS([struct stat.st_gen])
3066AC_CHECK_MEMBERS([struct stat.st_birthtime])
Guido van Rossum98bf58f2001-10-18 20:34:25 +00003067AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003068
3069AC_MSG_CHECKING(for time.h that defines altzone)
3070AC_CACHE_VAL(ac_cv_header_time_altzone,
3071[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
3072 ac_cv_header_time_altzone=yes,
3073 ac_cv_header_time_altzone=no)])
3074AC_MSG_RESULT($ac_cv_header_time_altzone)
3075if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003076 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003077fi
3078
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003079was_it_defined=no
3080AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003081AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003082#include <sys/types.h>
3083#include <sys/select.h>
3084#include <sys/time.h>
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003085], [;], [
3086 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
3087 [Define if you can safely include both <sys/select.h> and <sys/time.h>
3088 (which you can't on SCO ODT 3.0).])
3089 was_it_defined=yes
3090])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003091AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00003092
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003093AC_MSG_CHECKING(for addrinfo)
3094AC_CACHE_VAL(ac_cv_struct_addrinfo,
3095AC_TRY_COMPILE([
3096# include <netdb.h>],
3097 [struct addrinfo a],
3098 ac_cv_struct_addrinfo=yes,
3099 ac_cv_struct_addrinfo=no))
3100AC_MSG_RESULT($ac_cv_struct_addrinfo)
3101if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003102 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003103fi
3104
3105AC_MSG_CHECKING(for sockaddr_storage)
3106AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
3107AC_TRY_COMPILE([
3108# include <sys/types.h>
3109# include <sys/socket.h>],
3110 [struct sockaddr_storage s],
3111 ac_cv_struct_sockaddr_storage=yes,
3112 ac_cv_struct_sockaddr_storage=no))
3113AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3114if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003115 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003116fi
3117
Guido van Rossum627b2d71993-12-24 10:39:16 +00003118# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003119
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003120AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003121AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003122
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003123works=no
3124AC_MSG_CHECKING(for working volatile)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003125AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
3126 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
3127)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003128AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00003129
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003130works=no
3131AC_MSG_CHECKING(for working signed char)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003132AC_TRY_COMPILE([], [signed char c;], works=yes,
3133 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
3134)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003135AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003136
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003137have_prototypes=no
3138AC_MSG_CHECKING(for prototypes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003139AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
3140 AC_DEFINE(HAVE_PROTOTYPES, 1,
3141 [Define if your compiler supports function prototype])
3142 have_prototypes=yes
3143])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003144AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003145
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003146works=no
3147AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003148AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003149#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00003150int foo(int x, ...) {
3151 va_list va;
3152 va_start(va, x);
3153 va_arg(va, int);
3154 va_arg(va, char *);
3155 va_arg(va, double);
3156 return 0;
3157}
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003158], [return foo(10, "", 3.14);], [
3159 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3160 [Define if your compiler supports variable length function prototypes
3161 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3162 works=yes
3163])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003164AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003165
Dave Cole331708b2004-08-09 04:51:41 +00003166# check for socketpair
3167AC_MSG_CHECKING(for socketpair)
3168AC_TRY_COMPILE([
3169#include <sys/types.h>
3170#include <sys/socket.h>
3171], void *x=socketpair,
3172 AC_DEFINE(HAVE_SOCKETPAIR, 1, Define if you have the 'socketpair' function.)
3173 AC_MSG_RESULT(yes),
3174 AC_MSG_RESULT(no)
3175)
3176
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003177# check if sockaddr has sa_len member
3178AC_MSG_CHECKING(if sockaddr has sa_len member)
3179AC_TRY_COMPILE([#include <sys/types.h>
3180#include <sys/socket.h>],
3181[struct sockaddr x;
3182x.sa_len = 0;],
3183 AC_MSG_RESULT(yes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003184 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003185 AC_MSG_RESULT(no))
3186
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003187va_list_is_array=no
3188AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003189AC_TRY_COMPILE([
3190#ifdef HAVE_STDARG_PROTOTYPES
3191#include <stdarg.h>
3192#else
3193#include <varargs.h>
3194#endif
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003195], [va_list list1, list2; list1 = list2;], , [
3196 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3197 va_list_is_array=yes
3198])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003199AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003200
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003201# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
Martin v. Löwis11437992002-04-12 09:54:03 +00003202AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3203 [Define this if you have some version of gethostbyname_r()])
3204
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003205AC_CHECK_FUNC(gethostbyname_r, [
3206 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3207 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3208 OLD_CFLAGS=$CFLAGS
3209 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
3210 AC_TRY_COMPILE([
3211# include <netdb.h>
3212 ], [
3213 char *name;
3214 struct hostent *he, *res;
3215 char buffer[2048];
3216 int buflen = 2048;
3217 int h_errnop;
3218
3219 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
3220 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003221 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003222 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3223 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003224 AC_MSG_RESULT(yes)
3225 ], [
3226 AC_MSG_RESULT(no)
3227 AC_MSG_CHECKING([gethostbyname_r with 5 args])
3228 AC_TRY_COMPILE([
3229# include <netdb.h>
3230 ], [
3231 char *name;
3232 struct hostent *he;
3233 char buffer[2048];
3234 int buflen = 2048;
3235 int h_errnop;
3236
3237 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3238 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003239 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003240 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3241 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003242 AC_MSG_RESULT(yes)
3243 ], [
3244 AC_MSG_RESULT(no)
3245 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3246 AC_TRY_COMPILE([
3247# include <netdb.h>
3248 ], [
3249 char *name;
3250 struct hostent *he;
3251 struct hostent_data data;
3252
3253 (void) gethostbyname_r(name, he, &data);
3254 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003255 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003256 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3257 [Define this if you have the 3-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003258 AC_MSG_RESULT(yes)
3259 ], [
3260 AC_MSG_RESULT(no)
3261 ])
3262 ])
3263 ])
3264 CFLAGS=$OLD_CFLAGS
3265], [
Thomas Wouters3a584202000-08-05 23:28:51 +00003266 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003267])
3268AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3269AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3270AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003271AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003272AC_SUBST(HAVE_GETHOSTBYNAME)
3273
Guido van Rossum627b2d71993-12-24 10:39:16 +00003274# checks for system services
3275# (none yet)
3276
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003277# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00003278AC_CHECK_FUNC(__fpu_control,
3279 [],
3280 [AC_CHECK_LIB(ieee, __fpu_control)
3281])
Guido van Rossum627b2d71993-12-24 10:39:16 +00003282
Guido van Rossum93274221997-05-09 02:42:00 +00003283# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00003284AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00003285AC_ARG_WITH(fpectl,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003286 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
3287[
Guido van Rossum93274221997-05-09 02:42:00 +00003288if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003289then
3290 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3291 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3292 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00003293else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00003294fi],
3295[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00003296
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003297# check for --with-libm=...
3298AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003299case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00003300Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00003301BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003302*) LIBM=-lm
3303esac
Guido van Rossum93274221997-05-09 02:42:00 +00003304AC_MSG_CHECKING(for --with-libm=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003305AC_ARG_WITH(libm,
3306 AC_HELP_STRING(--with-libm=STRING, math library),
3307[
Guido van Rossum93274221997-05-09 02:42:00 +00003308if test "$withval" = no
3309then LIBM=
3310 AC_MSG_RESULT(force LIBM empty)
3311elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003312then LIBM=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003313 AC_MSG_RESULT(set LIBM="$withval")
3314else AC_MSG_ERROR([proper usage is --with-libm=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003315fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003316[AC_MSG_RESULT(default LIBM="$LIBM")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003317
3318# check for --with-libc=...
3319AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00003320AC_MSG_CHECKING(for --with-libc=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003321AC_ARG_WITH(libc,
3322 AC_HELP_STRING(--with-libc=STRING, C library),
3323[
Guido van Rossum93274221997-05-09 02:42:00 +00003324if test "$withval" = no
3325then LIBC=
3326 AC_MSG_RESULT(force LIBC empty)
3327elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003328then LIBC=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003329 AC_MSG_RESULT(set LIBC="$withval")
3330else AC_MSG_ERROR([proper usage is --with-libc=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003331fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003332[AC_MSG_RESULT(default LIBC="$LIBC")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003333
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003334# **************************************************
3335# * Check for various properties of floating point *
3336# **************************************************
Mark Dickinson265d7382008-04-21 22:32:24 +00003337
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003338AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3339AC_CACHE_VAL(ac_cv_little_endian_double, [
3340AC_TRY_RUN([
3341#include <string.h>
3342int main() {
3343 double x = 9006104071832581.0;
3344 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3345 return 0;
3346 else
3347 return 1;
3348}
3349],
3350ac_cv_little_endian_double=yes,
3351ac_cv_little_endian_double=no,
3352ac_cv_little_endian_double=no)])
3353AC_MSG_RESULT($ac_cv_little_endian_double)
3354if test "$ac_cv_little_endian_double" = yes
3355then
3356 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3357 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3358 with the least significant byte first])
3359fi
3360
3361AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3362AC_CACHE_VAL(ac_cv_big_endian_double, [
3363AC_TRY_RUN([
3364#include <string.h>
3365int main() {
3366 double x = 9006104071832581.0;
3367 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3368 return 0;
3369 else
3370 return 1;
3371}
3372],
3373ac_cv_big_endian_double=yes,
3374ac_cv_big_endian_double=no,
3375ac_cv_big_endian_double=no)])
3376AC_MSG_RESULT($ac_cv_big_endian_double)
3377if test "$ac_cv_big_endian_double" = yes
3378then
3379 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3380 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3381 with the most significant byte first])
3382fi
3383
3384# Some ARM platforms use a mixed-endian representation for doubles.
3385# While Python doesn't currently have full support for these platforms
3386# (see e.g., issue 1762561), we can at least make sure that float <-> string
3387# conversions work.
3388AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3389AC_CACHE_VAL(ac_cv_mixed_endian_double, [
3390AC_TRY_RUN([
3391#include <string.h>
3392int main() {
3393 double x = 9006104071832581.0;
3394 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3395 return 0;
3396 else
3397 return 1;
3398}
3399],
3400ac_cv_mixed_endian_double=yes,
3401ac_cv_mixed_endian_double=no,
3402ac_cv_mixed_endian_double=no)])
3403AC_MSG_RESULT($ac_cv_mixed_endian_double)
3404if test "$ac_cv_mixed_endian_double" = yes
3405then
3406 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3407 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3408 in ARM mixed-endian order (byte order 45670123)])
3409fi
3410
3411# The short float repr introduced in Python 3.1 requires the
3412# correctly-rounded string <-> double conversion functions from
3413# Python/dtoa.c, which in turn require that the FPU uses 53-bit
3414# rounding; this is a problem on x86, where the x87 FPU has a default
Mark Dickinsona548dee2009-11-15 13:12:43 +00003415# rounding precision of 64 bits. For gcc/x86, we can fix this by
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003416# using inline assembler to get and set the x87 FPU control word.
Mark Dickinsona548dee2009-11-15 13:12:43 +00003417
3418# This inline assembler syntax may also work for suncc and icc,
3419# so we try it on all platforms.
3420
3421AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
3422AC_TRY_COMPILE([], [
3423 unsigned short cw;
3424 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3425 __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
3426],
3427[have_gcc_asm_for_x87=yes], [have_gcc_asm_for_x87=no])
3428AC_MSG_RESULT($have_gcc_asm_for_x87)
3429if test "$have_gcc_asm_for_x87" = yes
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003430then
Mark Dickinsona548dee2009-11-15 13:12:43 +00003431 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3432 [Define if we can use gcc inline assembler to get and set x87 control word])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003433fi
Mark Dickinson7a3d8642008-04-22 00:54:27 +00003434
Mark Dickinson04b27232009-01-04 12:29:36 +00003435# Detect whether system arithmetic is subject to x87-style double
3436# rounding issues. The result of this test has little meaning on non
3437# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3438# mode is round-to-nearest and double rounding issues are present, and
3439# 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3440AC_MSG_CHECKING(for x87-style double rounding)
Mark Dickinson99abd142009-10-24 13:44:16 +00003441# $BASECFLAGS may affect the result
3442ac_save_cc="$CC"
3443CC="$CC $BASECFLAGS"
Mark Dickinson04b27232009-01-04 12:29:36 +00003444AC_TRY_RUN([
3445#include <stdlib.h>
3446#include <math.h>
3447int main() {
3448 volatile double x, y, z;
3449 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3450 x = 0.99999999999999989; /* 1-2**-53 */
3451 y = 1./x;
3452 if (y != 1.)
3453 exit(0);
3454 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3455 x = 1e16;
3456 y = 2.99999;
3457 z = x + y;
3458 if (z != 1e16+4.)
3459 exit(0);
3460 /* both tests show evidence of double rounding */
3461 exit(1);
3462}
3463],
3464ac_cv_x87_double_rounding=no,
3465ac_cv_x87_double_rounding=yes,
Mark Dickinson99abd142009-10-24 13:44:16 +00003466ac_cv_x87_double_rounding=no)
3467CC="$ac_save_cc"
Mark Dickinson04b27232009-01-04 12:29:36 +00003468AC_MSG_RESULT($ac_cv_x87_double_rounding)
3469if test "$ac_cv_x87_double_rounding" = yes
3470then
3471 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3472 [Define if arithmetic is subject to x87-style double rounding issue])
3473fi
3474
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003475# ************************************
3476# * Check for mathematical functions *
3477# ************************************
3478
3479LIBS_SAVE=$LIBS
3480LIBS="$LIBS $LIBM"
3481
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003482# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3483# -0. on some architectures.
3484AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3485AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
3486AC_TRY_RUN([
3487#include <math.h>
3488#include <stdlib.h>
3489int main() {
3490 /* return 0 if either negative zeros don't exist
3491 on this platform or if negative zeros exist
3492 and tanh(-0.) == -0. */
3493 if (atan2(0., -1.) == atan2(-0., -1.) ||
3494 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3495 else exit(1);
3496}
3497],
3498ac_cv_tanh_preserves_zero_sign=yes,
3499ac_cv_tanh_preserves_zero_sign=no,
3500ac_cv_tanh_preserves_zero_sign=no)])
3501AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3502if test "$ac_cv_tanh_preserves_zero_sign" = yes
3503then
3504 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3505 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3506fi
3507
3508AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
3509AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
3510AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3511
3512LIBS=$LIBS_SAVE
3513
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003514# For multiprocessing module, check that sem_open
3515# actually works. For FreeBSD versions <= 7.2,
3516# the kernel module that provides POSIX semaphores
3517# isn't loaded by default, so an attempt to call
3518# sem_open results in a 'Signal 12' error.
3519AC_MSG_CHECKING(whether POSIX semaphores are enabled)
3520AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
3521AC_TRY_RUN([
3522#include <unistd.h>
3523#include <fcntl.h>
3524#include <stdio.h>
3525#include <semaphore.h>
3526#include <sys/stat.h>
3527
3528int main(void) {
3529 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3530 if (a == SEM_FAILED) {
3531 perror("sem_open");
3532 return 1;
3533 }
3534 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003535 sem_unlink("/autoconf");
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003536 return 0;
3537}
3538], ac_cv_posix_semaphores_enabled=yes,
3539 ac_cv_posix_semaphores_enabled=no,
3540 ac_cv_posix_semaphores_enabled=yes)
3541)
3542AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
3543if test $ac_cv_posix_semaphores_enabled = no
3544then
Mark Dickinson5afa6d42009-11-28 10:44:20 +00003545 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
3546 [Define if POSIX semaphores aren't enabled on your system])
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003547fi
3548
Jesse Noller355b1262009-04-02 00:03:28 +00003549# Multiprocessing check for broken sem_getvalue
3550AC_MSG_CHECKING(for broken sem_getvalue)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003551AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
Jesse Noller355b1262009-04-02 00:03:28 +00003552AC_TRY_RUN([
3553#include <unistd.h>
3554#include <fcntl.h>
3555#include <stdio.h>
3556#include <semaphore.h>
3557#include <sys/stat.h>
3558
3559int main(void){
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003560 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
Jesse Noller355b1262009-04-02 00:03:28 +00003561 int count;
3562 int res;
3563 if(a==SEM_FAILED){
3564 perror("sem_open");
3565 return 1;
3566
3567 }
3568 res = sem_getvalue(a, &count);
3569 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003570 sem_unlink("/autocftw");
Jesse Noller355b1262009-04-02 00:03:28 +00003571 return res==-1 ? 1 : 0;
3572}
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003573], ac_cv_broken_sem_getvalue=no,
3574 ac_cv_broken_sem_getvalue=yes,
3575 ac_cv_broken_sem_getvalue=yes)
Jesse Noller355b1262009-04-02 00:03:28 +00003576)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003577AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
3578if test $ac_cv_broken_sem_getvalue = yes
3579then
3580 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
3581 [define to 1 if your sem_getvalue is broken.])
3582fi
Mark Dickinson04b27232009-01-04 12:29:36 +00003583
Mark Dickinsonefc82f72009-03-20 15:51:55 +00003584# determine what size digit to use for Python's longs
3585AC_MSG_CHECKING([digit size for Python's longs])
3586AC_ARG_ENABLE(big-digits,
3587AC_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
3588[case $enable_big_digits in
3589yes)
3590 enable_big_digits=30 ;;
3591no)
3592 enable_big_digits=15 ;;
3593[15|30])
3594 ;;
3595*)
3596 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3597esac
3598AC_MSG_RESULT($enable_big_digits)
3599AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3600],
3601[AC_MSG_RESULT(no value specified)])
3602
Guido van Rossumef2255b2000-03-10 22:30:29 +00003603# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003604AC_CHECK_HEADER(wchar.h, [
3605 AC_DEFINE(HAVE_WCHAR_H, 1,
3606 [Define if the compiler provides a wchar.h header file.])
3607 wchar_h="yes"
3608],
Guido van Rossumef2255b2000-03-10 22:30:29 +00003609wchar_h="no"
3610)
3611
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003612# determine wchar_t size
3613if test "$wchar_h" = yes
3614then
Guido van Rossum67b26592001-10-20 14:21:45 +00003615 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003616fi
3617
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003618AC_MSG_CHECKING(for UCS-4 tcl)
3619have_ucs4_tcl=no
3620AC_TRY_COMPILE([
3621#include <tcl.h>
3622#if TCL_UTF_MAX != 6
3623# error "NOT UCS4_TCL"
3624#endif], [], [
3625 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3626 have_ucs4_tcl=yes
3627])
3628AC_MSG_RESULT($have_ucs4_tcl)
3629
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003630# check whether wchar_t is signed or not
3631if test "$wchar_h" = yes
3632then
3633 # check whether wchar_t is signed or not
3634 AC_MSG_CHECKING(whether wchar_t is signed)
3635 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
3636 AC_TRY_RUN([
3637 #include <wchar.h>
3638 int main()
3639 {
Martin v. Löwis44fe0e42006-04-11 07:15:30 +00003640 /* Success: exit code 0 */
3641 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003642 }
3643 ],
3644 ac_cv_wchar_t_signed=yes,
3645 ac_cv_wchar_t_signed=no,
3646 ac_cv_wchar_t_signed=yes)])
3647 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3648fi
3649
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003650AC_MSG_CHECKING(what type to use for unicode)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003651dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003652AC_ARG_ENABLE(unicode,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003653 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
3654 [],
3655 [enable_unicode=yes])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003656
3657if test $enable_unicode = yes
3658then
Martin v. Löwisfd917792001-06-27 20:22:04 +00003659 # Without any arguments, Py_UNICODE defaults to two-byte mode
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003660 case "$have_ucs4_tcl" in
3661 yes) enable_unicode="ucs4"
3662 ;;
3663 *) enable_unicode="ucs2"
3664 ;;
3665 esac
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003666fi
3667
Martin v. Löwis0036cba2002-04-12 09:58:45 +00003668AH_TEMPLATE(Py_UNICODE_SIZE,
3669 [Define as the size of the unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003670case "$enable_unicode" in
3671ucs2) unicode_size="2"
3672 AC_DEFINE(Py_UNICODE_SIZE,2)
3673 ;;
3674ucs4) unicode_size="4"
3675 AC_DEFINE(Py_UNICODE_SIZE,4)
3676 ;;
3677esac
3678
Martin v. Löwis11437992002-04-12 09:54:03 +00003679AH_TEMPLATE(PY_UNICODE_TYPE,
3680 [Define as the integral type used for Unicode representation.])
Martin v. Löwis0036cba2002-04-12 09:58:45 +00003681
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003682AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003683if test "$enable_unicode" = "no"
3684then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003685 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003686 AC_MSG_RESULT(not used)
3687else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003688 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003689 AC_DEFINE(Py_USING_UNICODE, 1,
3690 [Define if you want to have a Unicode type.])
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003691
3692 # wchar_t is only usable if it maps to an unsigned type
3693 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
Matthias Klose7dbeed72004-12-24 08:22:17 +00003694 -a "$ac_cv_wchar_t_signed" = "no"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003695 then
3696 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003697 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3698 [Define if you have a useable wchar_t type defined in wchar.h; useable
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003699 means wchar_t must be an unsigned type with at least 16 bits. (see
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003700 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003701 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3702 elif test "$ac_cv_sizeof_short" = "$unicode_size"
3703 then
3704 PY_UNICODE_TYPE="unsigned short"
3705 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3706 elif test "$ac_cv_sizeof_long" = "$unicode_size"
3707 then
3708 PY_UNICODE_TYPE="unsigned long"
3709 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3710 else
3711 PY_UNICODE_TYPE="no type found"
3712 fi
3713 AC_MSG_RESULT($PY_UNICODE_TYPE)
3714fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00003715
3716# check for endianness
3717AC_C_BIGENDIAN
3718
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003719# Check whether right shifting a negative integer extends the sign bit
3720# or fills with zeros (like the Cray J90, according to Tim Peters).
3721AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00003722AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003723AC_TRY_RUN([
3724int main()
3725{
Vladimir Marangozova6180282000-07-12 05:05:06 +00003726 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003727}
Guido van Rossum3065c942001-09-17 04:03:14 +00003728],
3729ac_cv_rshift_extends_sign=yes,
3730ac_cv_rshift_extends_sign=no,
3731ac_cv_rshift_extends_sign=yes)])
Vladimir Marangozova6180282000-07-12 05:05:06 +00003732AC_MSG_RESULT($ac_cv_rshift_extends_sign)
3733if test "$ac_cv_rshift_extends_sign" = no
3734then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003735 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
3736 [Define if i>>j for signed int i does not extend the sign bit
3737 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00003738fi
3739
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003740# check for getc_unlocked and related locking functions
3741AC_MSG_CHECKING(for getc_unlocked() and friends)
3742AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
3743AC_TRY_LINK([#include <stdio.h>],[
3744 FILE *f = fopen("/dev/null", "r");
3745 flockfile(f);
3746 getc_unlocked(f);
3747 funlockfile(f);
3748], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
3749AC_MSG_RESULT($ac_cv_have_getc_unlocked)
3750if test "$ac_cv_have_getc_unlocked" = yes
3751then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003752 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
3753 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003754fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003755
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00003756# check where readline lives
Martin v. Löwis82bca632006-02-10 20:49:30 +00003757# save the value of LIBS so we don't actually link Python with readline
3758LIBS_no_readline=$LIBS
Gregory P. Smith980b99b2008-09-07 05:15:18 +00003759
3760# On some systems we need to link readline to a termcap compatible
3761# library. NOTE: Keep the precedence of listed libraries synchronised
3762# with setup.py.
3763py_cv_lib_readline=no
3764AC_MSG_CHECKING([how to link readline libs])
3765for py_libtermcap in "" ncursesw ncurses curses termcap; do
3766 if test -z "$py_libtermcap"; then
3767 READLINE_LIBS="-lreadline"
3768 else
3769 READLINE_LIBS="-lreadline -l$py_libtermcap"
3770 fi
3771 LIBS="$READLINE_LIBS $LIBS_no_readline"
3772 AC_LINK_IFELSE(
3773 [AC_LANG_CALL([],[readline])],
3774 [py_cv_lib_readline=yes])
3775 if test $py_cv_lib_readline = yes; then
3776 break
3777 fi
3778done
3779# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3780#AC_SUBST([READLINE_LIBS])
Gregory P. Smith29ec7502008-09-07 19:18:16 +00003781if test $py_cv_lib_readline = no; then
Gregory P. Smith980b99b2008-09-07 05:15:18 +00003782 AC_MSG_RESULT([none])
3783else
3784 AC_MSG_RESULT([$READLINE_LIBS])
3785 AC_DEFINE(HAVE_LIBREADLINE, 1,
3786 [Define if you have the readline library (-lreadline).])
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00003787fi
3788
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003789# check for readline 2.1
3790AC_CHECK_LIB(readline, rl_callback_handler_install,
3791 AC_DEFINE(HAVE_RL_CALLBACK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003792 [Define if you have readline 2.1]), ,$READLINE_LIBS)
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003793
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003794# check for readline 2.2
3795AC_TRY_CPP([#include <readline/readline.h>],
3796have_readline=yes, have_readline=no)
3797if test $have_readline = yes
3798then
3799 AC_EGREP_HEADER([extern int rl_completion_append_character;],
3800 [readline/readline.h],
3801 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
3802 [Define if you have readline 2.2]), )
Antoine Pitroud9ff74e2009-10-26 19:16:46 +00003803 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
3804 [readline/readline.h],
3805 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
3806 [Define if you have rl_completion_suppress_append]), )
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003807fi
3808
Martin v. Löwis0daad592001-09-30 21:09:59 +00003809# check for readline 4.0
3810AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003811 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003812 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis0daad592001-09-30 21:09:59 +00003813
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00003814# also in 4.0
3815AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
3816 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003817 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00003818
Guido van Rossum353ae582001-07-10 16:45:32 +00003819# check for readline 4.2
3820AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003821 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003822 [Define if you have readline 4.2]), ,$READLINE_LIBS)
Guido van Rossum353ae582001-07-10 16:45:32 +00003823
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003824# also in readline 4.2
3825AC_TRY_CPP([#include <readline/readline.h>],
3826have_readline=yes, have_readline=no)
3827if test $have_readline = yes
3828then
3829 AC_EGREP_HEADER([extern int rl_catch_signals;],
3830 [readline/readline.h],
3831 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3832 [Define if you can turn off readline's signal handling.]), )
3833fi
3834
Martin v. Löwis82bca632006-02-10 20:49:30 +00003835# End of readline checks: restore LIBS
3836LIBS=$LIBS_no_readline
3837
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003838AC_MSG_CHECKING(for broken nice())
3839AC_CACHE_VAL(ac_cv_broken_nice, [
3840AC_TRY_RUN([
3841int main()
3842{
3843 int val1 = nice(1);
3844 if (val1 != -1 && val1 == nice(2))
3845 exit(0);
3846 exit(1);
3847}
Guido van Rossum3065c942001-09-17 04:03:14 +00003848],
3849ac_cv_broken_nice=yes,
3850ac_cv_broken_nice=no,
3851ac_cv_broken_nice=no)])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003852AC_MSG_RESULT($ac_cv_broken_nice)
3853if test "$ac_cv_broken_nice" = yes
3854then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003855 AC_DEFINE(HAVE_BROKEN_NICE, 1,
3856 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003857fi
3858
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003859AC_MSG_CHECKING(for broken poll())
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003860AC_CACHE_VAL(ac_cv_broken_poll,
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003861AC_TRY_RUN([
3862#include <poll.h>
3863
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003864int main()
3865{
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003866 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003867 int poll_test;
3868
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003869 close (42);
3870
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003871 poll_test = poll(&poll_struct, 1, 0);
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003872 if (poll_test < 0)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003873 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003874 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003875 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003876 else
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003877 return 1;
3878}
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003879],
3880ac_cv_broken_poll=yes,
3881ac_cv_broken_poll=no,
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003882ac_cv_broken_poll=no))
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003883AC_MSG_RESULT($ac_cv_broken_poll)
3884if test "$ac_cv_broken_poll" = yes
3885then
3886 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3887 [Define if poll() sets errno on invalid file descriptors.])
3888fi
3889
Brett Cannon43802422005-02-10 20:48:03 +00003890# Before we can test tzset, we need to check if struct tm has a tm_zone
3891# (which is not required by ISO C or UNIX spec) and/or if we support
3892# tzname[]
3893AC_STRUCT_TIMEZONE
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003894
Brett Cannon43802422005-02-10 20:48:03 +00003895# check tzset(3) exists and works like we expect it to
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003896AC_MSG_CHECKING(for working tzset())
3897AC_CACHE_VAL(ac_cv_working_tzset, [
3898AC_TRY_RUN([
3899#include <stdlib.h>
3900#include <time.h>
Brett Cannon18367812003-09-19 00:59:16 +00003901#include <string.h>
Brett Cannon43802422005-02-10 20:48:03 +00003902
3903#if HAVE_TZNAME
3904extern char *tzname[];
3905#endif
3906
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003907int main()
3908{
Brett Cannon18367812003-09-19 00:59:16 +00003909 /* Note that we need to ensure that not only does tzset(3)
3910 do 'something' with localtime, but it works as documented
3911 in the library reference and as expected by the test suite.
Brett Cannon43802422005-02-10 20:48:03 +00003912 This includes making sure that tzname is set properly if
3913 tm->tm_zone does not exist since it is the alternative way
3914 of getting timezone info.
Brett Cannon18367812003-09-19 00:59:16 +00003915
3916 Red Hat 6.2 doesn't understand the southern hemisphere
Brett Cannon43802422005-02-10 20:48:03 +00003917 after New Year's Day.
Brett Cannon18367812003-09-19 00:59:16 +00003918 */
3919
Brett Cannon43802422005-02-10 20:48:03 +00003920 time_t groundhogday = 1044144000; /* GMT-based */
Brett Cannon18367812003-09-19 00:59:16 +00003921 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3922
Neal Norwitz7f2588c2003-04-11 15:35:53 +00003923 putenv("TZ=UTC+0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003924 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00003925 if (localtime(&groundhogday)->tm_hour != 0)
3926 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003927#if HAVE_TZNAME
3928 /* For UTC, tzname[1] is sometimes "", sometimes " " */
3929 if (strcmp(tzname[0], "UTC") ||
3930 (tzname[1][0] != 0 && tzname[1][0] != ' '))
3931 exit(1);
3932#endif
Brett Cannon18367812003-09-19 00:59:16 +00003933
Neal Norwitz7f2588c2003-04-11 15:35:53 +00003934 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003935 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00003936 if (localtime(&groundhogday)->tm_hour != 19)
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003937 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003938#if HAVE_TZNAME
3939 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
3940 exit(1);
3941#endif
Brett Cannon18367812003-09-19 00:59:16 +00003942
3943 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
3944 tzset();
3945 if (localtime(&groundhogday)->tm_hour != 11)
3946 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003947#if HAVE_TZNAME
3948 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
3949 exit(1);
3950#endif
3951
3952#if HAVE_STRUCT_TM_TM_ZONE
Brett Cannon18367812003-09-19 00:59:16 +00003953 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
3954 exit(1);
3955 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
3956 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003957#endif
Brett Cannon18367812003-09-19 00:59:16 +00003958
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003959 exit(0);
3960}
3961],
3962ac_cv_working_tzset=yes,
3963ac_cv_working_tzset=no,
3964ac_cv_working_tzset=no)])
3965AC_MSG_RESULT($ac_cv_working_tzset)
3966if test "$ac_cv_working_tzset" = yes
3967then
3968 AC_DEFINE(HAVE_WORKING_TZSET, 1,
3969 [Define if tzset() actually switches the local timezone in a meaningful way.])
3970fi
3971
Martin v. Löwis94717ed2002-09-09 14:24:16 +00003972# Look for subsecond timestamps in struct stat
3973AC_MSG_CHECKING(for tv_nsec in struct stat)
3974AC_CACHE_VAL(ac_cv_stat_tv_nsec,
3975AC_TRY_COMPILE([#include <sys/stat.h>], [
3976struct stat st;
3977st.st_mtim.tv_nsec = 1;
3978],
Martin v. Löwisa32c9942002-09-09 16:17:47 +00003979ac_cv_stat_tv_nsec=yes,
Martin v. Löwis94717ed2002-09-09 14:24:16 +00003980ac_cv_stat_tv_nsec=no,
3981ac_cv_stat_tv_nsec=no))
3982AC_MSG_RESULT($ac_cv_stat_tv_nsec)
3983if test "$ac_cv_stat_tv_nsec" = yes
3984then
3985 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
3986 [Define if you have struct stat.st_mtim.tv_nsec])
3987fi
3988
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00003989# Look for BSD style subsecond timestamps in struct stat
3990AC_MSG_CHECKING(for tv_nsec2 in struct stat)
3991AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
3992AC_TRY_COMPILE([#include <sys/stat.h>], [
3993struct stat st;
3994st.st_mtimespec.tv_nsec = 1;
3995],
3996ac_cv_stat_tv_nsec2=yes,
3997ac_cv_stat_tv_nsec2=no,
3998ac_cv_stat_tv_nsec2=no))
3999AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
4000if test "$ac_cv_stat_tv_nsec2" = yes
4001then
4002 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
4003 [Define if you have struct stat.st_mtimensec])
4004fi
4005
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004006# On HP/UX 11.0, mvwdelch is a block with a return statement
4007AC_MSG_CHECKING(whether mvwdelch is an expression)
4008AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
4009AC_TRY_COMPILE([#include <curses.h>], [
4010 int rtn;
4011 rtn = mvwdelch(0,0,0);
4012], ac_cv_mvwdelch_is_expression=yes,
4013 ac_cv_mvwdelch_is_expression=no,
4014 ac_cv_mvwdelch_is_expression=yes))
4015AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
4016
4017if test "$ac_cv_mvwdelch_is_expression" = yes
4018then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004019 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
4020 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004021fi
4022
4023AC_MSG_CHECKING(whether WINDOW has _flags)
4024AC_CACHE_VAL(ac_cv_window_has_flags,
4025AC_TRY_COMPILE([#include <curses.h>], [
4026 WINDOW *w;
4027 w->_flags = 0;
4028], ac_cv_window_has_flags=yes,
4029 ac_cv_window_has_flags=no,
4030 ac_cv_window_has_flags=no))
4031AC_MSG_RESULT($ac_cv_window_has_flags)
4032
4033
4034if test "$ac_cv_window_has_flags" = yes
4035then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004036 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
4037 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004038fi
4039
Walter Dörwald4994d952006-06-19 08:07:50 +00004040AC_MSG_CHECKING(for is_term_resized)
4041AC_TRY_COMPILE([#include <curses.h>], void *x=is_term_resized,
4042 AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
4043 AC_MSG_RESULT(yes),
4044 AC_MSG_RESULT(no)
4045)
4046
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004047AC_MSG_CHECKING(for resize_term)
4048AC_TRY_COMPILE([#include <curses.h>], void *x=resize_term,
4049 AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
Walter Dörwald4994d952006-06-19 08:07:50 +00004050 AC_MSG_RESULT(yes),
4051 AC_MSG_RESULT(no)
4052)
4053
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004054AC_MSG_CHECKING(for resizeterm)
4055AC_TRY_COMPILE([#include <curses.h>], void *x=resizeterm,
4056 AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
Walter Dörwald4994d952006-06-19 08:07:50 +00004057 AC_MSG_RESULT(yes),
4058 AC_MSG_RESULT(no)
4059)
4060
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004061AC_MSG_CHECKING(for /dev/ptmx)
4062
4063if test -r /dev/ptmx
4064then
4065 AC_MSG_RESULT(yes)
4066 AC_DEFINE(HAVE_DEV_PTMX, 1,
4067 [Define if we have /dev/ptmx.])
4068else
4069 AC_MSG_RESULT(no)
4070fi
4071
4072AC_MSG_CHECKING(for /dev/ptc)
4073
4074if test -r /dev/ptc
4075then
4076 AC_MSG_RESULT(yes)
4077 AC_DEFINE(HAVE_DEV_PTC, 1,
4078 [Define if we have /dev/ptc.])
4079else
4080 AC_MSG_RESULT(no)
4081fi
Neal Norwitz865400f2003-03-21 01:42:58 +00004082
Mark Dickinson82864d12009-11-15 16:18:58 +00004083if test "$have_long_long" = yes
4084then
4085 AC_MSG_CHECKING(for %lld and %llu printf() format support)
4086 AC_CACHE_VAL(ac_cv_have_long_long_format,
4087 AC_TRY_RUN([[
4088 #include <stdio.h>
4089 #include <stddef.h>
4090 #include <string.h>
4091
4092 #ifdef HAVE_SYS_TYPES_H
4093 #include <sys/types.h>
4094 #endif
4095
4096 int main()
4097 {
4098 char buffer[256];
4099
4100 if (sprintf(buffer, "%lld", (long long)123) < 0)
4101 return 1;
4102 if (strcmp(buffer, "123"))
4103 return 1;
4104
4105 if (sprintf(buffer, "%lld", (long long)-123) < 0)
4106 return 1;
4107 if (strcmp(buffer, "-123"))
4108 return 1;
4109
4110 if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
4111 return 1;
4112 if (strcmp(buffer, "123"))
4113 return 1;
4114
4115 return 0;
4116 }
4117 ]], ac_cv_have_long_long_format=yes,
4118 ac_cv_have_long_long_format=no,
4119 ac_cv_have_long_long_format=no)
4120 )
4121 AC_MSG_RESULT($ac_cv_have_long_long_format)
4122fi
4123
Mark Dickinson5ce84742009-12-31 20:48:04 +00004124if test "$ac_cv_have_long_long_format" = yes
Mark Dickinson82864d12009-11-15 16:18:58 +00004125then
4126 AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
4127 [Define to printf format modifier for long long type])
4128fi
4129
Ronald Oussoren315cd0c2009-11-19 16:25:21 +00004130if test $ac_sys_system = Darwin
4131then
4132 LIBS="$LIBS -framework CoreFoundation"
4133fi
4134
Mark Dickinson82864d12009-11-15 16:18:58 +00004135
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004136AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
4137AC_TRY_RUN([
Alexandre Vassalottie7cf1182009-07-17 06:33:51 +00004138#include <stdio.h>
Brett Cannon09d12362006-05-11 05:11:33 +00004139#include <stddef.h>
4140#include <string.h>
4141
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004142#ifdef HAVE_SYS_TYPES_H
4143#include <sys/types.h>
4144#endif
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004145
4146#ifdef HAVE_SSIZE_T
4147typedef ssize_t Py_ssize_t;
4148#elif SIZEOF_VOID_P == SIZEOF_LONG
4149typedef long Py_ssize_t;
4150#else
4151typedef int Py_ssize_t;
4152#endif
Brett Cannon09d12362006-05-11 05:11:33 +00004153
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004154int main()
4155{
4156 char buffer[256];
4157
Brett Cannon09d12362006-05-11 05:11:33 +00004158 if(sprintf(buffer, "%zd", (size_t)123) < 0)
4159 return 1;
4160
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004161 if (strcmp(buffer, "123"))
Brett Cannon09d12362006-05-11 05:11:33 +00004162 return 1;
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004163
4164 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
4165 return 1;
4166
4167 if (strcmp(buffer, "-123"))
4168 return 1;
4169
Brett Cannon09d12362006-05-11 05:11:33 +00004170 return 0;
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004171}
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004172], ac_cv_have_size_t_format=yes,
Alexandre Vassalottie7cf1182009-07-17 06:33:51 +00004173 ac_cv_have_size_t_format=no,
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004174 [ac_cv_have_size_t_format="cross -- assuming yes"]
4175)])
4176if test "$ac_cv_have_size_t_format" != no ; then
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004177 AC_DEFINE(PY_FORMAT_SIZE_T, "z",
4178 [Define to printf format modifier for Py_ssize_t])
4179fi
Brett Cannon09d12362006-05-11 05:11:33 +00004180
Martin v. Löwis01c04012002-11-11 14:58:44 +00004181AC_CHECK_TYPE(socklen_t,,
4182 AC_DEFINE(socklen_t,int,
4183 Define to `int' if <sys/socket.h> does not define.),[
4184#ifdef HAVE_SYS_TYPES_H
4185#include <sys/types.h>
4186#endif
Guido van Rossum95713eb2000-05-18 20:53:31 +00004187#ifdef HAVE_SYS_SOCKET_H
4188#include <sys/socket.h>
4189#endif
Martin v. Löwis01c04012002-11-11 14:58:44 +00004190])
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004191
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00004192AC_SUBST(THREADHEADERS)
4193
4194for h in `(cd $srcdir;echo Python/thread_*.h)`
4195do
4196 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4197done
4198
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004199AC_SUBST(SRCDIRS)
Neal Norwitzd24499d2005-12-18 21:36:39 +00004200SRCDIRS="Parser Grammar Objects Python Modules Mac"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00004201AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004202for dir in $SRCDIRS; do
4203 if test ! -d $dir; then
4204 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00004205 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004206done
4207AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00004208
Guido van Rossum627b2d71993-12-24 10:39:16 +00004209# generate output files
Antoine Pitrouf2caeed2009-05-24 20:23:57 +00004210AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
Martin v. Löwis88afe662002-10-26 13:47:44 +00004211AC_OUTPUT
Neil Schemenauer61c51152001-01-26 16:18:16 +00004212
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004213echo "creating Modules/Setup"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004214if test ! -f Modules/Setup
4215then
4216 cp $srcdir/Modules/Setup.dist Modules/Setup
4217fi
4218
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004219echo "creating Modules/Setup.local"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004220if test ! -f Modules/Setup.local
4221then
4222 echo "# Edit this file for local setup changes" >Modules/Setup.local
4223fi
4224
4225echo "creating Makefile"
4226$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4227 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00004228 Modules/Setup.local Modules/Setup
Skip Montanaro7221d932007-08-22 19:02:16 +00004229
4230case $ac_sys_system in
4231BeOS)
4232 AC_MSG_WARN([
4233
4234 Support for BeOS is deprecated as of Python 2.6.
4235 See PEP 11 for the gory details.
4236 ])
4237 ;;
4238*) ;;
4239esac
4240
Neil Schemenauer66252162001-02-19 04:47:42 +00004241mv config.c Modules