blob: cd6a9bcaac248bd3d42c773e8aae59c62dda8253 [file] [log] [blame]
Benjamin Petersond7c77842008-05-26 13:01:25 +00001dnl ***********************************************
2dnl * Please run autoreconf to test your changes! *
3dnl ***********************************************
Martin v. Löwis88afe662002-10-26 13:47:44 +00004
5# Set VERSION so we only need to edit in one place (i.e., here)
Martin v. Löwis174440b2008-10-03 08:59:41 +00006m4_define(PYTHON_VERSION, 2.7)
Martin v. Löwis88afe662002-10-26 13:47:44 +00007
Georg Brandl71f4fbb2011-02-25 11:04:50 +00008AC_PREREQ(2.65)
Alexandre Vassalotti130ae152009-07-18 00:31:06 +00009
Guido van Rossum76be6ed1995-01-02 18:33:54 +000010AC_REVISION($Revision$)
Georg Brandl464432d2009-05-20 18:24:08 +000011AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
Martin v. Löwis88afe662002-10-26 13:47:44 +000012AC_CONFIG_SRCDIR([Include/object.h])
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +000013AC_CONFIG_HEADER(pyconfig.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +000014
doko@python.orgd65e2ba2013-01-31 23:52:03 +010015AC_CANONICAL_HOST
16AC_SUBST(build)
17AC_SUBST(host)
18
Ned Deily983df862014-08-22 13:30:59 -070019# pybuilddir.txt will be created by --generate-posix-vars in the Makefile
20rm -f pybuilddir.txt
21
doko@python.orgd65e2ba2013-01-31 23:52:03 +010022if test "$cross_compiling" = yes; then
23 AC_MSG_CHECKING([for python interpreter for cross build])
24 if test -z "$PYTHON_FOR_BUILD"; then
25 for interp in python$PACKAGE_VERSION python2 python; do
26 which $interp >/dev/null 2>&1 || continue
27 if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then
28 break
29 fi
30 interp=
31 done
32 if test x$interp = x; then
33 AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
34 fi
35 AC_MSG_RESULT($interp)
doko@ubuntu.com9e7ece22015-04-13 21:55:08 +020036 PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
doko@python.orgd65e2ba2013-01-31 23:52:03 +010037 fi
38elif test "$cross_compiling" = maybe; then
39 AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
40else
41 PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
42fi
43AC_SUBST(PYTHON_FOR_BUILD)
44
Georg Brandlbcd64a32009-03-31 21:45:18 +000045dnl Ensure that if prefix is specified, it does not end in a slash. If
46dnl it does, we get path names containing '//' which is both ugly and
47dnl can cause trouble.
48
49dnl Last slash shouldn't be stripped if prefix=/
50if test "$prefix" != "/"; then
51 prefix=`echo "$prefix" | sed -e 's/\/$//g'`
52fi
53
Martin v. Löwis8316feb2003-06-14 07:48:07 +000054dnl This is for stuff that absolutely must end up in pyconfig.h.
55dnl Please use pyport.h instead, if possible.
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000056AH_TOP([
57#ifndef Py_PYCONFIG_H
58#define Py_PYCONFIG_H
59])
Martin v. Löwis11437992002-04-12 09:54:03 +000060AH_BOTTOM([
Martin v. Löwis11437992002-04-12 09:54:03 +000061/* Define the macros needed if on a UnixWare 7.x system. */
62#if defined(__USLC__) && defined(__SCO_VERSION__)
63#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
64#endif
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000065
66#endif /*Py_PYCONFIG_H*/
Martin v. Löwis11437992002-04-12 09:54:03 +000067])
68
Martin v. Löwis8316feb2003-06-14 07:48:07 +000069# We don't use PACKAGE_ variables, and they cause conflicts
70# with other autoconf-based packages that include Python.h
71grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
72rm confdefs.h
73mv confdefs.h.new confdefs.h
74
Guido van Rossum642b6781997-07-19 19:35:41 +000075AC_SUBST(VERSION)
Martin v. Löwis88afe662002-10-26 13:47:44 +000076VERSION=PYTHON_VERSION
Guido van Rossum642b6781997-07-19 19:35:41 +000077
Martin v. Löwis1142de32002-03-29 16:28:31 +000078AC_SUBST(SOVERSION)
79SOVERSION=1.0
80
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +000081# The later defininition of _XOPEN_SOURCE disables certain features
82# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
83AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
84
Martin v. Löwisbcd93962003-05-03 10:32:18 +000085# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
86# certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
87# them.
88AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
89
Andrew MacIntyreabccf412003-07-02 13:53:25 +000090# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
91# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
92# them.
93AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
94
Martin v. Löwisd6320502004-08-12 13:45:08 +000095# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
96# u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
97AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
98
Ronald Oussoren5640ce22008-06-05 12:58:24 +000099# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
100# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
101# them.
102AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
103
104
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000105define_xopen_source=yes
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +0000106
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +0000107# Arguments passed to configure.
108AC_SUBST(CONFIG_ARGS)
109CONFIG_ARGS="$ac_configure_args"
110
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000111AC_MSG_CHECKING([for --enable-universalsdk])
Ronald Oussoren988117f2006-04-29 11:31:35 +0000112AC_ARG_ENABLE(universalsdk,
Matthias Klose22520ea2010-05-08 10:14:46 +0000113 AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build against Mac OS X 10.4u SDK (ppc/i386)]),
Ronald Oussoren988117f2006-04-29 11:31:35 +0000114[
115 case $enableval in
116 yes)
117 enableval=/Developer/SDKs/MacOSX10.4u.sdk
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000118 if test ! -d "${enableval}"
119 then
120 enableval=/
121 fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000122 ;;
123 esac
124 case $enableval in
125 no)
126 UNIVERSALSDK=
127 enable_universalsdk=
128 ;;
129 *)
130 UNIVERSALSDK=$enableval
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000131 if test ! -d "${UNIVERSALSDK}"
132 then
133 AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
134 fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000135 ;;
136 esac
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000137
Ronald Oussoren988117f2006-04-29 11:31:35 +0000138],[
139 UNIVERSALSDK=
140 enable_universalsdk=
141])
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000142if test -n "${UNIVERSALSDK}"
143then
144 AC_MSG_RESULT(${UNIVERSALSDK})
145else
146 AC_MSG_RESULT(no)
147fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000148AC_SUBST(UNIVERSALSDK)
149
Benjamin Peterson0e6ea5d2008-07-16 20:17:04 +0000150AC_SUBST(ARCH_RUN_32BIT)
Ned Deily8e60f6e2013-05-30 00:14:29 -0700151ARCH_RUN_32BIT=""
Benjamin Peterson0e6ea5d2008-07-16 20:17:04 +0000152
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000153UNIVERSAL_ARCHS="32-bit"
Ronald Oussoren92919a62009-12-24 13:30:58 +0000154AC_SUBST(LIPO_32BIT_FLAGS)
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000155AC_MSG_CHECKING(for --with-universal-archs)
156AC_ARG_WITH(universal-archs,
Matthias Klose22520ea2010-05-08 10:14:46 +0000157 AS_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 +0000158[
159 AC_MSG_RESULT($withval)
160 UNIVERSAL_ARCHS="$withval"
Ronald Oussoren9ebd2422009-09-29 13:00:44 +0000161 if test "${enable_universalsdk}" ; then
162 :
163 else
164 AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
165 fi
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000166],
167[
168 AC_MSG_RESULT(32-bit)
169])
170
171
172
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000173AC_ARG_WITH(framework-name,
Matthias Klose22520ea2010-05-08 10:14:46 +0000174 AS_HELP_STRING([--with-framework-name=FRAMEWORK],
Matthias Klose5183ebd2010-04-24 16:38:36 +0000175 [specify an alternate name of the framework built with --enable-framework]),
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000176[
Ronald Oussoren9ebd2422009-09-29 13:00:44 +0000177 if test "${enable_framework}"; then
178 :
179 else
180 AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
181 fi
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000182 PYTHONFRAMEWORK=${withval}
183 PYTHONFRAMEWORKDIR=${withval}.framework
184 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
185 ],[
186 PYTHONFRAMEWORK=Python
187 PYTHONFRAMEWORKDIR=Python.framework
188 PYTHONFRAMEWORKIDENTIFIER=org.python.python
189])
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000190dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000191AC_ARG_ENABLE(framework,
Matthias Klose22520ea2010-05-08 10:14:46 +0000192 AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@], [Build (MacOSX|Darwin) framework]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000193[
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000194 case $enableval in
195 yes)
196 enableval=/Library/Frameworks
Jack Jansen127e56e2001-09-11 14:41:54 +0000197 esac
198 case $enableval in
199 no)
200 PYTHONFRAMEWORK=
201 PYTHONFRAMEWORKDIR=no-framework
202 PYTHONFRAMEWORKPREFIX=
203 PYTHONFRAMEWORKINSTALLDIR=
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000204 FRAMEWORKINSTALLFIRST=
205 FRAMEWORKINSTALLLAST=
Ronald Oussoren5b787322006-06-06 19:50:24 +0000206 FRAMEWORKALTINSTALLFIRST=
207 FRAMEWORKALTINSTALLLAST=
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000208 if test "x${prefix}" = "xNONE"; then
209 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
210 else
211 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
212 fi
Jack Jansen127e56e2001-09-11 14:41:54 +0000213 enable_framework=
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000214 ;;
215 *)
Ronald Oussoren01d149f2010-04-30 11:20:14 +0000216 PYTHONFRAMEWORKPREFIX="${enableval}"
Jack Jansen127e56e2001-09-11 14:41:54 +0000217 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000218 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000219 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
Ronald Oussoren92919a62009-12-24 13:30:58 +0000220 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
221 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
Ronald Oussoren01d149f2010-04-30 11:20:14 +0000222 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000223
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000224 if test "x${prefix}" = "xNONE" ; then
225 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
Ronald Oussoren01d149f2010-04-30 11:20:14 +0000226
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000227 else
228 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
229 fi
Ronald Oussoren01d149f2010-04-30 11:20:14 +0000230
231 case "${enableval}" in
232 /System*)
233 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
234 if test "${prefix}" = "NONE" ; then
235 # See below
236 FRAMEWORKUNIXTOOLSPREFIX="/usr"
237 fi
238 ;;
239
240 /Library*)
241 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
242 ;;
243
244 */Library/Frameworks)
245 MDIR="`dirname "${enableval}"`"
246 MDIR="`dirname "${MDIR}"`"
247 FRAMEWORKINSTALLAPPSPREFIX="${MDIR}/Applications"
248
249 if test "${prefix}" = "NONE"; then
250 # User hasn't specified the
251 # --prefix option, but wants to install
252 # the framework in a non-default location,
253 # ensure that the compatibility links get
254 # installed relative to that prefix as well
255 # instead of in /usr/local.
256 FRAMEWORKUNIXTOOLSPREFIX="${MDIR}"
257 fi
258 ;;
259
260 *)
261 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
262 ;;
263 esac
264
Jack Jansen127e56e2001-09-11 14:41:54 +0000265 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
Ronald Oussoren836b0392006-05-14 19:56:34 +0000266
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000267 # Add files for Mac specific code to the list of output
Ronald Oussoren836b0392006-05-14 19:56:34 +0000268 # files:
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000269 AC_CONFIG_FILES(Mac/Makefile)
270 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
271 AC_CONFIG_FILES(Mac/IDLE/Makefile)
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000272 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
273 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000274 esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000275 ],[
276 PYTHONFRAMEWORK=
Jack Jansen127e56e2001-09-11 14:41:54 +0000277 PYTHONFRAMEWORKDIR=no-framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000278 PYTHONFRAMEWORKPREFIX=
279 PYTHONFRAMEWORKINSTALLDIR=
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000280 FRAMEWORKINSTALLFIRST=
281 FRAMEWORKINSTALLLAST=
Ronald Oussoren5b787322006-06-06 19:50:24 +0000282 FRAMEWORKALTINSTALLFIRST=
283 FRAMEWORKALTINSTALLLAST=
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000284 if test "x${prefix}" = "xNONE" ; then
285 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
286 else
287 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
288 fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000289 enable_framework=
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000290
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000291])
292AC_SUBST(PYTHONFRAMEWORK)
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000293AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000294AC_SUBST(PYTHONFRAMEWORKDIR)
295AC_SUBST(PYTHONFRAMEWORKPREFIX)
296AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000297AC_SUBST(FRAMEWORKINSTALLFIRST)
298AC_SUBST(FRAMEWORKINSTALLLAST)
Ronald Oussoren5b787322006-06-06 19:50:24 +0000299AC_SUBST(FRAMEWORKALTINSTALLFIRST)
300AC_SUBST(FRAMEWORKALTINSTALLLAST)
301AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
Ronald Oussoren01d149f2010-04-30 11:20:14 +0000302AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000303
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000304##AC_ARG_WITH(dyld,
Matthias Klose22520ea2010-05-08 10:14:46 +0000305## AS_HELP_STRING([--with-dyld],
306## [Use (OpenStep|Rhapsody) dynamic linker]))
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000307##
Guido van Rossumb418f891996-07-30 18:06:02 +0000308# Set name for machine-dependent library files
309AC_SUBST(MACHDEP)
310AC_MSG_CHECKING(MACHDEP)
311if test -z "$MACHDEP"
312then
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100313 # avoid using uname for cross builds
314 if test "$cross_compiling" = yes; then
315 # ac_sys_system and ac_sys_release are only used for setting
316 # `define_xopen_source' in the case statement below. For the
317 # current supported cross builds, this macro is not adjusted.
318 case "$host" in
319 *-*-linux*)
320 ac_sys_system=Linux
321 ;;
322 *-*-cygwin*)
323 ac_sys_system=Cygwin
324 ;;
325 *)
326 # for now, limit cross builds to known configurations
327 MACHDEP="unknown"
328 AC_MSG_ERROR([cross build not supported for $host])
329 esac
330 ac_sys_release=
331 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000332 ac_sys_system=`uname -s`
Georg Brandlfe18a112009-09-04 07:55:14 +0000333 if test "$ac_sys_system" = "AIX" \
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000334 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000335 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +0000336 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000337 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +0000338 fi
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100339 fi
340 ac_md_system=`echo $ac_sys_system |
341 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
342 ac_md_release=`echo $ac_sys_release |
343 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
344 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000345
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100346 case $MACHDEP in
Victor Stinneracacbaa2011-08-20 14:02:38 +0200347 linux*) MACHDEP="linux2";;
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +0000348 cygwin*) MACHDEP="cygwin";;
Jack Jansen8a97f4a2001-12-05 23:27:32 +0000349 darwin*) MACHDEP="darwin";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000350 atheos*) MACHDEP="atheos";;
Martin v. Löwisf3322282003-07-13 09:46:13 +0000351 irix646) MACHDEP="irix6";;
Guido van Rossumb97ef171997-09-28 05:44:03 +0000352 '') MACHDEP="unknown";;
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100353 esac
354fi
355
356AC_SUBST(_PYTHON_HOST_PLATFORM)
357if test "$cross_compiling" = yes; then
358 case "$host" in
359 *-*-linux*)
360 case "$host_cpu" in
361 arm*)
362 _host_cpu=arm
363 ;;
364 *)
365 _host_cpu=$host_cpu
366 esac
367 ;;
368 *-*-cygwin*)
369 _host_cpu=
370 ;;
371 *)
372 # for now, limit cross builds to known configurations
373 MACHDEP="unknown"
374 AC_MSG_ERROR([cross build not supported for $host])
Guido van Rossumb418f891996-07-30 18:06:02 +0000375 esac
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100376 _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
Guido van Rossumb418f891996-07-30 18:06:02 +0000377fi
Jack Jansen83f898c2002-12-30 22:23:40 +0000378
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000379# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
380# disable features if it is defined, without any means to access these
381# features as extensions. For these systems, we skip the definition of
382# _XOPEN_SOURCE. Before adding a system to the list to gain access to
383# some feature, make sure there is no alternative way to access this
384# feature. Also, when using wildcards, make sure you have verified the
385# need for not defining _XOPEN_SOURCE on all systems matching the
386# wildcard, and that the wildcard does not include future systems
387# (which may remove their limitations).
388dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
389case $ac_sys_system/$ac_sys_release in
390 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
391 # even though select is a POSIX function. Reported by J. Ribbens.
Martin v. Löwis76bafc62003-10-03 13:47:44 +0000392 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
Martin v. Löwis7875ef62010-02-15 21:41:12 +0000393 # In addition, Stefan Krah confirms that issue #1244610 exists through
394 # OpenBSD 4.6, but is fixed in 4.7.
Charles-François Natali97781b02011-07-22 23:43:42 +0200395 OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@)
Martin v. Löwiscb78de62007-12-29 18:49:21 +0000396 define_xopen_source=no
397 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
398 # also defined. This can be overridden by defining _BSD_SOURCE
399 # As this has a different meaning on Linux, only define it on OpenBSD
400 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
401 ;;
Charles-François Natali97781b02011-07-22 23:43:42 +0200402 OpenBSD/*)
Martin v. Löwis5e2dd862010-02-15 08:32:00 +0000403 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
404 # also defined. This can be overridden by defining _BSD_SOURCE
405 # As this has a different meaning on Linux, only define it on OpenBSD
406 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
407 ;;
Martin v. Löwis4d542ec2006-11-25 15:39:19 +0000408 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
409 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
410 # Marc Recht
Georg Brandl4b9bcfc2008-11-16 08:00:17 +0000411 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 +0000412 define_xopen_source=no;;
Martin v. Löwisb41afb52010-05-28 15:28:47 +0000413 # From the perspective of Solaris, _XOPEN_SOURCE is not so much a
414 # request to enable features supported by the standard as a request
415 # to disable features not supported by the standard. The best way
416 # for Python to use Solaris is simply to leave _XOPEN_SOURCE out
417 # entirely and define __EXTENSIONS__ instead.
418 SunOS/*)
Martin v. Löwisa9d71422003-03-28 18:43:31 +0000419 define_xopen_source=no;;
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000420 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
421 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
Martin v. Löwis253d1f42004-05-07 19:14:14 +0000422 # Reconfirmed for 7.1.4 by Martin v. Loewis.
423 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000424 define_xopen_source=no;;
425 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000426 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000427 SCO_SV/3.2)
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000428 define_xopen_source=no;;
Martin v. Löwisbb86d832008-11-04 20:40:09 +0000429 # On FreeBSD 4, the math functions C89 does not cover are never defined
430 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
431 FreeBSD/4.*)
432 define_xopen_source=no;;
433 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
434 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
435 # identifies itself as Darwin/7.*
436 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
437 # disables platform specific features beyond repair.
438 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
439 # has no effect, don't bother defining them
440 Darwin/@<:@6789@:>@.*)
Anthony Baxter6169c6b2003-10-04 07:46:23 +0000441 define_xopen_source=no;;
Ronald Oussorena55af9a2010-01-17 16:25:57 +0000442 Darwin/1@<:@0-9@:>@.*)
443 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000444 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
445 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
446 # or has another value. By not (re)defining it, the defaults come in place.
Martin v. Löwisc19c5a62003-11-18 20:00:44 +0000447 AIX/4)
448 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000449 AIX/5)
450 if test `uname -r` -eq 1; then
451 define_xopen_source=no
452 fi
453 ;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000454 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
455 # defining NI_NUMERICHOST.
456 QNX/6.3.2)
457 define_xopen_source=no
458 ;;
Martin v. Löwisa0588362006-04-04 06:03:50 +0000459
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000460esac
461
462if test $define_xopen_source = yes
463then
Martin v. Löwisb41afb52010-05-28 15:28:47 +0000464 AC_DEFINE(_XOPEN_SOURCE, 600,
465 Define to the level of X/Open that your system supports)
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000466
467 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
468 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
469 # several APIs are not declared. Since this is also needed in some
470 # cases for HP-UX, we define it globally.
Martin v. Löwisb41afb52010-05-28 15:28:47 +0000471 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
472 Define to activate Unix95-and-earlier features)
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000473
Bob Ippolito7026a0a2005-03-28 23:23:47 +0000474 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
475
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000476fi
477
Guido van Rossum91922671997-10-09 20:24:13 +0000478#
479# SGI compilers allow the specification of the both the ABI and the
480# ISA on the command line. Depending on the values of these switches,
481# different and often incompatable code will be generated.
482#
483# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
484# thus supply support for various ABI/ISA combinations. The MACHDEP
485# variable is also adjusted.
486#
487AC_SUBST(SGI_ABI)
488if test ! -z "$SGI_ABI"
489then
490 CC="cc $SGI_ABI"
491 LDFLAGS="$SGI_ABI $LDFLAGS"
492 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
493fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000494AC_MSG_RESULT($MACHDEP)
495
doko@ubuntu.com9e7ece22015-04-13 21:55:08 +0200496AC_SUBST(PLATDIR)
497PLATDIR=plat-$MACHDEP
498
Jack Jansen83f898c2002-12-30 22:23:40 +0000499# And add extra plat-mac for darwin
500AC_SUBST(EXTRAPLATDIR)
Jack Jansen7b59b422003-03-17 15:44:10 +0000501AC_SUBST(EXTRAMACHDEPPATH)
Jack Jansen83f898c2002-12-30 22:23:40 +0000502AC_MSG_CHECKING(EXTRAPLATDIR)
503if test -z "$EXTRAPLATDIR"
504then
505 case $MACHDEP in
Jack Jansen7b59b422003-03-17 15:44:10 +0000506 darwin)
507 EXTRAPLATDIR="\$(PLATMACDIRS)"
508 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
509 ;;
510 *)
511 EXTRAPLATDIR=""
512 EXTRAMACHDEPPATH=""
513 ;;
Jack Jansen83f898c2002-12-30 22:23:40 +0000514 esac
515fi
516AC_MSG_RESULT($EXTRAPLATDIR)
517
Jack Jansen6b08a402004-06-03 12:41:45 +0000518# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
519# it may influence the way we can build extensions, so distutils
520# needs to check it
521AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
Ronald Oussoren988117f2006-04-29 11:31:35 +0000522AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
Jack Jansen6b08a402004-06-03 12:41:45 +0000523CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
Ronald Oussoren988117f2006-04-29 11:31:35 +0000524EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
Jack Jansen6b08a402004-06-03 12:41:45 +0000525
Guido van Rossum627b2d71993-12-24 10:39:16 +0000526# checks for alternative programs
Skip Montanarodecc6a42003-01-01 20:07:49 +0000527
528# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
529# for debug/optimization stuff. BASECFLAGS is for flags that are required
530# just to get things to compile and link. Users are free to override OPT
531# when running configure or make. The build should not break if they do.
532# BASECFLAGS should generally not be messed with, however.
533
534# XXX shouldn't some/most/all of this code be merged with the stuff later
535# on that fiddles with OPT and BASECFLAGS?
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000536AC_MSG_CHECKING(for --without-gcc)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000537AC_ARG_WITH(gcc,
Matthias Klose22520ea2010-05-08 10:14:46 +0000538 AS_HELP_STRING([--without-gcc], [never use gcc]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000539[
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000540 case $withval in
Skip Montanaro516144f2009-01-04 10:36:58 +0000541 no) CC=${CC:-cc}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000542 without_gcc=yes;;
543 yes) CC=gcc
544 without_gcc=no;;
545 *) CC=$withval
546 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000547 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000548 case $ac_sys_system in
Antoine Pitrou285cd162010-09-21 15:23:17 +0000549 AIX*) CC=${CC:-xlc_r}
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000550 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000551 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000552 case $BE_HOST_CPU in
553 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000554 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000555 without_gcc=yes
Skip Montanarodecc6a42003-01-01 20:07:49 +0000556 BASECFLAGS="$BASECFLAGS -export pragma"
557 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000558 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000559 ;;
560 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000561 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000562 without_gcc=no
Skip Montanarodecc6a42003-01-01 20:07:49 +0000563 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000564 ;;
565 *)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000566 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000567 ;;
568 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000569 AR="\$(srcdir)/Modules/ar_beos"
570 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000571 ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000572 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000573 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000574AC_MSG_RESULT($without_gcc)
575
Zachary Ware6ed42ea2015-12-21 11:43:03 -0600576AC_MSG_CHECKING(for --with-icc)
577AC_ARG_WITH(icc,
578 AS_HELP_STRING([--with-icc], [build with icc]),
579[
580 case $withval in
581 no) CC=${CC:-cc}
582 with_icc=no;;
583 yes) CC=icc
584 CXX=icpc
585 with_icc=yes;;
586 *) CC=$withval
587 with_icc=$withval;;
588 esac], [
589 with_icc=no])
590AC_MSG_RESULT($with_icc)
591
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000592# If the user switches compilers, we can't believe the cache
593if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
594then
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000595 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
596(it is also a good idea to do 'make clean' before compiling)])
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000597fi
598
Trent Nelson15daa352012-12-13 06:46:39 +0000599if test "$MACHDEP" = "irix6" && test "$CC" != "gcc"; then
600 # Normally, MIPSpro CC treats #error directives as warnings, which means
601 # a successful exit code is returned (0). This is a problem because IRIX
602 # has a bunch of system headers with this guard at the top:
603 #
604 # #ifndef __c99
605 # #error This header file is to be used only for c99 mode compilations
606 # #else
607 #
608 # When autoconf tests for such a header, like stdint.h, this happens:
609 #
610 # configure:4619: cc -c conftest.c >&5
611 # cc-1035 cc: WARNING File = /usr/include/stdint.h, Line = 5
612 # #error directive: This header file is to be used only for c99 mode
613 # compilations
614 #
615 # #error This header file is to be used only for c99 mode compilations
616 # ^
617 #
618 # configure:4619: $? = 0
619 # configure:4619: result: yes
620 #
621 # Therefore, we use `-diag_error 1035` to have the compiler treat the
622 # warning as an error, which causes cc to return a non-zero result,
623 # which autoconf can interpret correctly.
624 CFLAGS="$CFLAGS -diag_error 1035"
625 # Whilst we're here, we might as well make sure CXX defaults to something
626 # sensible if we're not using gcc.
627 if test -z "$CXX"; then
628 CXX="CC"
629 fi
630fi
631
Marc-André Lemburg6d5e5792010-04-30 17:20:14 +0000632# If the user set CFLAGS, use this instead of the automatically
633# determined setting
634preset_cflags="$CFLAGS"
Guido van Rossum627b2d71993-12-24 10:39:16 +0000635AC_PROG_CC
Marc-André Lemburg6d5e5792010-04-30 17:20:14 +0000636if test ! -z "$preset_cflags"
637then
638 CFLAGS=$preset_cflags
639fi
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000640
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000641AC_SUBST(CXX)
642AC_SUBST(MAINCC)
643AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
644AC_ARG_WITH(cxx_main,
Matthias Klose22520ea2010-05-08 10:14:46 +0000645 AS_HELP_STRING([--with-cxx-main=<compiler>],
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000646 [compile main() and link python executable with C++ compiler]),
647[
648
649 case $withval in
650 no) with_cxx_main=no
651 MAINCC='$(CC)';;
652 yes) with_cxx_main=yes
653 MAINCC='$(CXX)';;
654 *) with_cxx_main=yes
655 MAINCC=$withval
656 if test -z "$CXX"
657 then
658 CXX=$withval
659 fi;;
660 esac], [
661 with_cxx_main=no
662 MAINCC='$(CC)'
663])
664AC_MSG_RESULT($with_cxx_main)
665
666preset_cxx="$CXX"
667if test -z "$CXX"
668then
669 case "$CC" in
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100670 gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
671 cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000672 esac
673 if test "$CXX" = "notfound"
674 then
675 CXX=""
676 fi
677fi
678if test -z "$CXX"
679then
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100680 AC_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000681 if test "$CXX" = "notfound"
682 then
683 CXX=""
684 fi
685fi
686if test "$preset_cxx" != "$CXX"
687then
688 AC_MSG_WARN([
689
690 By default, distutils will build C++ extension modules with "$CXX".
691 If this is not intended, then set CXX on the configure command line.
692 ])
693fi
694
doko@python.org4e63fbe2013-01-25 13:08:27 +0100695MULTIARCH=$($CC --print-multiarch 2>/dev/null)
696AC_SUBST(MULTIARCH)
697
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000698
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000699# checks for UNIX variants that set C preprocessor variables
Matthias Klose9f8e0c12010-05-08 10:17:27 +0000700AC_USE_SYSTEM_EXTENSIONS
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000701
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000702# Check for unsupported systems
703case $ac_sys_system/$ac_sys_release in
Brett Cannon19fab762007-06-02 03:02:29 +0000704atheos*|Linux*/1*)
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000705 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
706 echo See README for details.
707 exit 1;;
708esac
709
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000710AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000711AC_MSG_CHECKING(for --with-suffix)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000712AC_ARG_WITH(suffix,
Matthias Klose22520ea2010-05-08 10:14:46 +0000713 AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000714[
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000715 case $withval in
716 no) EXEEXT=;;
717 yes) EXEEXT=.exe;;
718 *) EXEEXT=$withval;;
719 esac])
720AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000721
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000722# Test whether we're running on a non-case-sensitive system, in which
723# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000724AC_SUBST(BUILDEXEEXT)
725AC_MSG_CHECKING(for case-insensitive build directory)
Jack Jansen3c2c4332002-11-06 13:33:32 +0000726if test ! -d CaseSensitiveTestDir; then
727mkdir CaseSensitiveTestDir
728fi
729
730if test -d casesensitivetestdir
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000731then
Jack Jansen1999ef42001-12-06 21:47:20 +0000732 AC_MSG_RESULT(yes)
733 BUILDEXEEXT=.exe
734else
735 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000736 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000737fi
Jack Jansen3c2c4332002-11-06 13:33:32 +0000738rmdir CaseSensitiveTestDir
Guido van Rossumfb842551997-08-06 23:42:07 +0000739
Guido van Rossumdd997f71998-10-07 19:58:26 +0000740case $MACHDEP in
741bsdos*)
742 case $CC in
743 gcc) CC="$CC -D_HAVE_BSDI";;
744 esac;;
745esac
746
Guido van Rossum84561611997-08-21 00:08:11 +0000747case $ac_sys_system in
748hp*|HP*)
749 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000750 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000751 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000752SunOS*)
753 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000754 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000755 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000756esac
757
Martin v. Löwise8964d42001-03-06 12:09:07 +0000758
Neil Schemenauer61c51152001-01-26 16:18:16 +0000759AC_SUBST(LIBRARY)
760AC_MSG_CHECKING(LIBRARY)
761if test -z "$LIBRARY"
762then
763 LIBRARY='libpython$(VERSION).a'
764fi
765AC_MSG_RESULT($LIBRARY)
766
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000767# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000768# name of the library into which to insert object files). BLDLIBRARY is also
769# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
770# is blank as the main program is not linked directly against LDLIBRARY.
771# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
772# systems without shared libraries, LDLIBRARY is the same as LIBRARY
773# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
774# DLLLIBRARY is the shared (i.e., DLL) library.
775#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000776# RUNSHARED is used to run shared python without installed libraries
777#
778# INSTSONAME is the name of the shared library that will be use to install
779# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000780AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000781AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000782AC_SUBST(BLDLIBRARY)
783AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000784AC_SUBST(INSTSONAME)
785AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000786LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000787BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis09bdf722002-05-08 08:51:29 +0000788INSTSONAME='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000789DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000790LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000791RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000792
Guido van Rossumfb842551997-08-06 23:42:07 +0000793# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000794# If CXX is set, and if it is needed to link a main function that was
795# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
796# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000797# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000798# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000799AC_SUBST(LINKCC)
800AC_MSG_CHECKING(LINKCC)
801if test -z "$LINKCC"
802then
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000803 LINKCC='$(PURIFY) $(MAINCC)'
Guido van Rossumfb842551997-08-06 23:42:07 +0000804 case $ac_sys_system in
805 AIX*)
Neal Norwitz0b27ff92003-03-31 15:53:49 +0000806 exp_extra="\"\""
807 if test $ac_sys_release -ge 5 -o \
808 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
809 exp_extra="."
810 fi
811 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000812 QNX*)
813 # qcc must be used because the other compilers do not
814 # support -N.
815 LINKCC=qcc;;
Guido van Rossumfb842551997-08-06 23:42:07 +0000816 esac
817fi
818AC_MSG_RESULT($LINKCC)
819
Tarek Ziadée2be83d2009-05-09 08:28:53 +0000820# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
821# make sure we default having it set to "no": this is used by
822# distutils.unixccompiler to know if it should add --enable-new-dtags
823# to linker command lines, and failing to detect GNU ld simply results
824# in the same bahaviour as before.
825AC_SUBST(GNULD)
826AC_MSG_CHECKING(for GNU ld)
827ac_prog=ld
828if test "$GCC" = yes; then
829 ac_prog=`$CC -print-prog-name=ld`
830fi
831case `"$ac_prog" -V 2>&1 < /dev/null` in
832 *GNU*)
833 GNULD=yes;;
834 *)
835 GNULD=no;;
836esac
837AC_MSG_RESULT($GNULD)
838
Martin v. Löwis1142de32002-03-29 16:28:31 +0000839AC_MSG_CHECKING(for --enable-shared)
840AC_ARG_ENABLE(shared,
Matthias Klose22520ea2010-05-08 10:14:46 +0000841 AS_HELP_STRING([--enable-shared], [disable/enable building shared python library]))
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000842
Martin v. Löwis1142de32002-03-29 16:28:31 +0000843if test -z "$enable_shared"
844then
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000845 case $ac_sys_system in
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000846 CYGWIN* | atheos*)
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000847 enable_shared="yes";;
848 *)
849 enable_shared="no";;
850 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000851fi
852AC_MSG_RESULT($enable_shared)
853
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000854AC_MSG_CHECKING(for --enable-profiling)
855AC_ARG_ENABLE(profiling,
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100856 AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]))
857if test "x$enable_profiling" = xyes; then
858 ac_save_cc="$CC"
Benjamin Petersonb9be7bb2013-03-26 08:55:37 -0400859 CC="$CC -pg"
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100860 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
861 [],
862 [enable_profiling=no])
863 CC="$ac_save_cc"
864else
865 enable_profiling=no
866fi
867AC_MSG_RESULT($enable_profiling)
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000868
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100869if test "x$enable_profiling" = xyes; then
870 BASECFLAGS="-pg $BASECFLAGS"
871 LDFLAGS="-pg $LDFLAGS"
872fi
Martin v. Löwis1142de32002-03-29 16:28:31 +0000873
874AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000875
Guido van Rossumb8552162001-09-05 14:58:11 +0000876# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
877# library that we build, but we do not want to link against it (we
878# will find it with a -framework option). For this reason there is an
879# extra variable BLDLIBRARY against which Python and the extension
880# modules are linked, BLDLIBRARY. This is normally the same as
881# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000882if test "$enable_framework"
883then
884 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200885 RUNSHARED=DYLD_FRAMEWORK_PATH=`pwd`${DYLD_FRAMEWORK_PATH:+:${DYLD_FRAMEWORK_PATH}}
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000886 BLDLIBRARY=''
887else
888 BLDLIBRARY='$(LDLIBRARY)'
889fi
890
Martin v. Löwis1142de32002-03-29 16:28:31 +0000891# Other platforms follow
892if test $enable_shared = "yes"; then
Mark Hammond8235ea12002-07-19 06:55:41 +0000893 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
Martin v. Löwis1142de32002-03-29 16:28:31 +0000894 case $ac_sys_system in
895 BeOS*)
896 LDLIBRARY='libpython$(VERSION).so'
897 ;;
898 CYGWIN*)
899 LDLIBRARY='libpython$(VERSION).dll.a'
900 DLLLIBRARY='libpython$(VERSION).dll'
901 ;;
902 SunOS*)
903 LDLIBRARY='libpython$(VERSION).so'
Martin v. Löwisd141a8c2003-06-14 15:20:28 +0000904 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200905 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Martin v. Löwis2389c412003-10-31 15:42:07 +0000906 INSTSONAME="$LDLIBRARY".$SOVERSION
Martin v. Löwis1142de32002-03-29 16:28:31 +0000907 ;;
Charles-François Natali3de8c732011-07-24 22:33:35 +0200908 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000909 LDLIBRARY='libpython$(VERSION).so'
910 BLDLIBRARY='-L. -lpython$(VERSION)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200911 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Hye-Shik Chang33761492004-10-26 09:53:46 +0000912 case $ac_sys_system in
913 FreeBSD*)
914 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
915 ;;
916 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000917 INSTSONAME="$LDLIBRARY".$SOVERSION
918 ;;
919 hp*|HP*)
Neal Norwitz58e28882006-05-19 07:00:58 +0000920 case `uname -m` in
921 ia64)
922 LDLIBRARY='libpython$(VERSION).so'
923 ;;
924 *)
925 LDLIBRARY='libpython$(VERSION).sl'
926 ;;
927 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000928 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200929 RUNSHARED=SHLIB_PATH=`pwd`${SHLIB_PATH:+:${SHLIB_PATH}}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000930 ;;
931 OSF*)
932 LDLIBRARY='libpython$(VERSION).so'
Neal Norwitz671b9e32006-01-09 07:07:12 +0000933 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200934 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000935 ;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000936 atheos*)
937 LDLIBRARY='libpython$(VERSION).so'
938 BLDLIBRARY='-L. -lpython$(VERSION)'
939 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
940 ;;
Ronald Oussoren79f90492009-01-02 10:44:46 +0000941 Darwin*)
942 LDLIBRARY='libpython$(VERSION).dylib'
943 BLDLIBRARY='-L. -lpython$(VERSION)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200944 RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
Ronald Oussoren79f90492009-01-02 10:44:46 +0000945 ;;
Antoine Pitrouaabdceb2010-09-10 20:03:17 +0000946 AIX*)
947 LDLIBRARY='libpython$(VERSION).so'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200948 RUNSHARED=LIBPATH=`pwd`${LIBPATH:+:${LIBPATH}}
Antoine Pitrouaabdceb2010-09-10 20:03:17 +0000949 ;;
Ronald Oussoren79f90492009-01-02 10:44:46 +0000950
Martin v. Löwis1142de32002-03-29 16:28:31 +0000951 esac
Jason Tishler30765592003-09-04 11:04:06 +0000952else # shared is disabled
953 case $ac_sys_system in
954 CYGWIN*)
955 BLDLIBRARY='$(LIBRARY)'
956 LDLIBRARY='libpython$(VERSION).dll.a'
957 ;;
958 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000959fi
960
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100961if test "$cross_compiling" = yes; then
962 RUNSHARED=
963fi
964
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000965AC_MSG_RESULT($LDLIBRARY)
966
Guido van Rossum627b2d71993-12-24 10:39:16 +0000967AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000968AC_SUBST(AR)
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100969AC_CHECK_TOOLS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000970
Tarek Ziadé99f660a2009-05-07 21:20:34 +0000971# tweak ARFLAGS only if the user didn't set it on the command line
972AC_SUBST(ARFLAGS)
973if test -z "$ARFLAGS"
974then
975 ARFLAGS="rc"
976fi
977
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000978AC_SUBST(SVNVERSION)
Martin v. Löwisff600232006-04-03 19:12:32 +0000979AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000980if test $SVNVERSION = found
981then
982 SVNVERSION="svnversion \$(srcdir)"
983else
Benjamin Petersone5afa3b2009-05-23 19:24:37 +0000984 SVNVERSION="echo Unversioned directory"
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000985fi
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000986
Trent Nelsond86ceec2012-10-16 09:42:45 -0400987AC_SUBST(BASECPPFLAGS)
Trent Nelsonabf20512012-10-17 04:32:49 -0400988if test "$abs_srcdir" != "$abs_builddir"; then
Trent Nelsond86ceec2012-10-16 09:42:45 -0400989 # If we're building out-of-tree make sure Include (in the current dir)
990 # gets picked up before its $srcdir counterpart in order for Python-ast.h
991 # and graminit.h to get picked up from the correct directory.
992 # (A side effect of this is that these resources will automatically be
993 # regenerated when building out-of-tree, regardless of whether or not
994 # the $srcdir counterpart is up-to-date. This is an acceptable trade
995 # off.)
996 BASECPPFLAGS="-IInclude"
997else
998 BASECPPFLAGS=""
999fi
1000
Georg Brandl3a5508e2011-03-06 10:42:21 +01001001AC_SUBST(HGVERSION)
1002AC_SUBST(HGTAG)
1003AC_SUBST(HGBRANCH)
1004AC_CHECK_PROG(HAS_HG, hg, found, not-found)
1005if test $HAS_HG = found
1006then
1007 HGVERSION="hg id -i \$(srcdir)"
1008 HGTAG="hg id -t \$(srcdir)"
1009 HGBRANCH="hg id -b \$(srcdir)"
1010else
1011 HGVERSION=""
1012 HGTAG=""
1013 HGBRANCH=""
1014fi
1015
Neil Schemenauera42c8272001-03-31 00:01:55 +00001016case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +00001017bsdos*|hp*|HP*)
1018 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +00001019 if test -z "$INSTALL"
1020 then
1021 INSTALL="${srcdir}/install-sh -c"
1022 fi
1023esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001024AC_PROG_INSTALL
Trent Nelsonf6407a12012-08-30 14:56:13 +00001025AC_PROG_MKDIR_P
Guido van Rossumb418f891996-07-30 18:06:02 +00001026
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001027# Not every filesystem supports hard links
1028AC_SUBST(LN)
1029if test -z "$LN" ; then
1030 case $ac_sys_system in
1031 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001032 CYGWIN*) LN="ln -s";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001033 atheos*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001034 *) LN=ln;;
1035 esac
1036fi
1037
Fred Drake9f715822001-07-11 06:27:00 +00001038# Check for --with-pydebug
1039AC_MSG_CHECKING(for --with-pydebug)
1040AC_ARG_WITH(pydebug,
Matthias Klose22520ea2010-05-08 10:14:46 +00001041 AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001042[
Fred Drake9f715822001-07-11 06:27:00 +00001043if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001044then
1045 AC_DEFINE(Py_DEBUG, 1,
1046 [Define if you want to build an interpreter with many run-time checks.])
1047 AC_MSG_RESULT(yes);
1048 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +00001049else AC_MSG_RESULT(no); Py_DEBUG='false'
1050fi],
1051[AC_MSG_RESULT(no)])
1052
Skip Montanarodecc6a42003-01-01 20:07:49 +00001053# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
1054# merged with this chunk of code?
1055
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001056# Optimizer/debugger flags
Skip Montanarodecc6a42003-01-01 20:07:49 +00001057# ------------------------
1058# (The following bit of code is complicated enough - please keep things
1059# indented properly. Just pretend you're editing Python code. ;-)
1060
1061# There are two parallel sets of case statements below, one that checks to
1062# see if OPT was set and one that does BASECFLAGS setting based upon
1063# compiler and platform. BASECFLAGS tweaks need to be made even if the
1064# user set OPT.
1065
1066# tweak OPT based on compiler and platform, only if the user didn't set
1067# it on the command line
Guido van Rossumb418f891996-07-30 18:06:02 +00001068AC_SUBST(OPT)
Benjamin Petersond4b721b2010-03-23 20:58:37 +00001069if test "${OPT-unset}" = "unset"
Guido van Rossumb418f891996-07-30 18:06:02 +00001070then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001071 case $GCC in
1072 yes)
Skip Montanaro288a5be2006-04-13 02:00:56 +00001073 if test "$CC" != 'g++' ; then
1074 STRICT_PROTO="-Wstrict-prototypes"
1075 fi
Guido van Rossum7c862f82007-12-13 20:50:10 +00001076 # For gcc 4.x we need to use -fwrapv so lets check if its supported
1077 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
1078 WRAP="-fwrapv"
1079 fi
Stefan Krah503e5e12011-09-14 15:19:42 +02001080
1081 # Clang also needs -fwrapv
Stefan Krah2bc1e8f2011-12-08 22:26:06 +01001082 case $CC in
1083 *clang*) WRAP="-fwrapv"
1084 ;;
1085 esac
Stefan Krah503e5e12011-09-14 15:19:42 +02001086
Skip Montanarodecc6a42003-01-01 20:07:49 +00001087 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001088 yes)
Fred Drake9f715822001-07-11 06:27:00 +00001089 if test "$Py_DEBUG" = 'true' ; then
1090 # Optimization messes up debuggers, so turn it off for
1091 # debug builds.
Mark Dickinsond2f3e3f2010-05-05 22:23:58 +00001092 OPT="-g -O0 -Wall $STRICT_PROTO"
Fred Drake9f715822001-07-11 06:27:00 +00001093 else
Guido van Rossum7c862f82007-12-13 20:50:10 +00001094 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +00001095 fi
1096 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001097 *)
Skip Montanaro288a5be2006-04-13 02:00:56 +00001098 OPT="-O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +00001099 ;;
Fred Drake9f715822001-07-11 06:27:00 +00001100 esac
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001101 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +00001102 SCO_SV*) OPT="$OPT -m486 -DSCO5"
1103 ;;
1104 esac
Fred Drake9f715822001-07-11 06:27:00 +00001105 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001106
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001107 *)
Skip Montanarodecc6a42003-01-01 20:07:49 +00001108 OPT="-O"
1109 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001110 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +00001111fi
Guido van Rossum627b2d71993-12-24 10:39:16 +00001112
Skip Montanarodecc6a42003-01-01 20:07:49 +00001113AC_SUBST(BASECFLAGS)
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001114
1115# The -arch flags for universal builds on OSX
1116UNIVERSAL_ARCH_FLAGS=
1117AC_SUBST(UNIVERSAL_ARCH_FLAGS)
1118
Skip Montanarodecc6a42003-01-01 20:07:49 +00001119# tweak BASECFLAGS based on compiler and platform
1120case $GCC in
1121yes)
Martin v. Löwis70fedcd2003-07-07 21:26:19 +00001122 # Python violates C99 rules, by casting between incompatible
1123 # pointer types. GCC may generate bad code as a result of that,
1124 # so use -fno-strict-aliasing if supported.
1125 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
1126 ac_save_cc="$CC"
1127 CC="$CC -fno-strict-aliasing"
Alexandre Vassalotti00900892009-07-17 05:26:39 +00001128 AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
Matthias Klosec511b472010-05-08 11:01:39 +00001129 AC_COMPILE_IFELSE(
Mark Dickinson5e13e292010-05-11 08:55:06 +00001130 [AC_LANG_PROGRAM([[]], [[]])],
Matthias Klosec511b472010-05-08 11:01:39 +00001131 [ac_cv_no_strict_aliasing_ok=yes],
1132 [ac_cv_no_strict_aliasing_ok=no]))
Martin v. Löwis70fedcd2003-07-07 21:26:19 +00001133 CC="$ac_save_cc"
1134 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
1135 if test $ac_cv_no_strict_aliasing_ok = yes
1136 then
1137 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
1138 fi
Mark Dickinson65134662008-04-25 16:11:04 +00001139
1140 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
1141 # support. Without this, treatment of subnormals doesn't follow
1142 # the standard.
doko@python.orgd65e2ba2013-01-31 23:52:03 +01001143 case $host in
Mark Dickinson65134662008-04-25 16:11:04 +00001144 alpha*)
1145 BASECFLAGS="$BASECFLAGS -mieee"
1146 ;;
1147 esac
1148
Skip Montanarodecc6a42003-01-01 20:07:49 +00001149 case $ac_sys_system in
1150 SCO_SV*)
1151 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
1152 ;;
1153 # is there any other compiler on Darwin besides gcc?
1154 Darwin*)
Jeffrey Yasskin1b4e45b2008-03-17 14:40:53 +00001155 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
1156 # used to be here, but non-Apple gcc doesn't accept them.
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001157 if test "${CC}" = gcc
1158 then
1159 AC_MSG_CHECKING(which compiler should be used)
1160 case "${UNIVERSALSDK}" in
1161 */MacOSX10.4u.sdk)
1162 # Build using 10.4 SDK, force usage of gcc when the
1163 # compiler is gcc, otherwise the user will get very
1164 # confusing error messages when building on OSX 10.6
1165 CC=gcc-4.0
1166 CPP=cpp-4.0
1167 ;;
1168 esac
1169 AC_MSG_RESULT($CC)
Ronald Oussoren988117f2006-04-29 11:31:35 +00001170 fi
1171
Benjamin Peterson4347c442008-07-17 15:59:24 +00001172 # Calculate the right deployment target for this build.
1173 #
Ned Deilyc40b9032014-06-25 13:48:46 -07001174 cur_target_major=`sw_vers -productVersion | \
1175 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
1176 cur_target_minor=`sw_vers -productVersion | \
1177 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
1178 cur_target="${cur_target_major}.${cur_target_minor}"
1179 if test ${cur_target_major} -eq 10 && \
1180 test ${cur_target_minor} -ge 3
1181 then
Benjamin Peterson4347c442008-07-17 15:59:24 +00001182 cur_target=10.3
Ronald Oussoren25967582009-09-06 10:00:26 +00001183 if test ${enable_universalsdk}; then
1184 if test "${UNIVERSAL_ARCHS}" = "all"; then
1185 # Ensure that the default platform for a
1186 # 4-way universal build is OSX 10.5,
1187 # that's the first OS release where
1188 # 4-way builds make sense.
1189 cur_target='10.5'
Ronald Oussoren23d92532009-09-07 06:12:00 +00001190
1191 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
1192 cur_target='10.5'
1193
1194 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
1195 cur_target='10.5'
1196
1197 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
1198 cur_target='10.5'
Ronald Oussoren25967582009-09-06 10:00:26 +00001199 fi
1200 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001201 if test `/usr/bin/arch` = "i386"; then
Ronald Oussoren25967582009-09-06 10:00:26 +00001202 # On Intel macs default to a deployment
1203 # target of 10.4, that's the first OSX
1204 # release with Intel support.
1205 cur_target="10.4"
1206 fi
1207 fi
Benjamin Peterson4347c442008-07-17 15:59:24 +00001208 fi
1209 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1210
1211 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1212 # environment with a value that is the same as what we'll use
1213 # in the Makefile to ensure that we'll get the same compiler
1214 # environment during configure and build time.
1215 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1216 export MACOSX_DEPLOYMENT_TARGET
1217 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1218
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001219 if test "${enable_universalsdk}"; then
1220 UNIVERSAL_ARCH_FLAGS=""
1221 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
1222 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
1223 ARCH_RUN_32BIT=""
Ronald Oussoren75912852010-04-08 08:13:31 +00001224 LIPO_32BIT_FLAGS=""
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001225
1226 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
1227 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
1228 LIPO_32BIT_FLAGS=""
1229 ARCH_RUN_32BIT="true"
1230
1231 elif test "$UNIVERSAL_ARCHS" = "all" ; then
1232 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
1233 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001234 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001235
1236 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
1237 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
1238 LIPO_32BIT_FLAGS="-extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001239 ARCH_RUN_32BIT="/usr/bin/arch -i386"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001240
1241 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
1242 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
1243 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren9922f172010-02-11 13:19:34 +00001244 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001245
1246 else
1247 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
1248
1249 fi
1250
1251
Ronald Oussoren974eb5e2010-04-18 17:59:37 +00001252 CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
1253 if test "${UNIVERSALSDK}" != "/"
1254 then
1255 CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
1256 LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1257 CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001258 fi
1259
1260 fi
1261
1262
Skip Montanarodecc6a42003-01-01 20:07:49 +00001263 ;;
Neal Norwitzdedeeaa2006-03-31 06:54:45 +00001264 OSF*)
1265 BASECFLAGS="$BASECFLAGS -mieee"
1266 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001267 esac
1268 ;;
1269
1270*)
1271 case $ac_sys_system in
1272 OpenUNIX*|UnixWare*)
1273 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1274 ;;
Neal Norwitzb44f1652003-05-26 14:11:55 +00001275 OSF*)
1276 BASECFLAGS="$BASECFLAGS -ieee -std"
1277 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001278 SCO_SV*)
1279 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1280 ;;
1281 esac
1282 ;;
1283esac
1284
Zachary Ware6ed42ea2015-12-21 11:43:03 -06001285# ICC needs -fp-model strict or floats behave badly
1286case "$CC" in
1287*icc*)
1288 BASECFLAGS="$BASECFLAGS -fp-model strict"
1289 ;;
1290esac
1291
Fred Drakee1ceaa02001-12-04 20:55:47 +00001292if test "$Py_DEBUG" = 'true'; then
1293 :
1294else
1295 OPT="-DNDEBUG $OPT"
1296fi
1297
Guido van Rossum6f2260e1996-09-09 16:21:03 +00001298if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001299then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001300 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001301fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001302
Neal Norwitz020c46a2006-01-07 21:39:28 +00001303# disable check for icc since it seems to pass, but generates a warning
1304if test "$CC" = icc
1305then
1306 ac_cv_opt_olimit_ok=no
1307fi
1308
Guido van Rossum91922671997-10-09 20:24:13 +00001309AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1310AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1311[ac_save_cc="$CC"
1312CC="$CC -OPT:Olimit=0"
Matthias Klosec511b472010-05-08 11:01:39 +00001313AC_COMPILE_IFELSE(
Mark Dickinson5e13e292010-05-11 08:55:06 +00001314 [AC_LANG_PROGRAM([[]], [[]])],
Matthias Klosec511b472010-05-08 11:01:39 +00001315 [ac_cv_opt_olimit_ok=yes],
1316 [ac_cv_opt_olimit_ok=no]
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001317 )
Guido van Rossum91922671997-10-09 20:24:13 +00001318CC="$ac_save_cc"])
1319AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +00001320if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +00001321 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +00001322 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1323 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1324 # environment?
1325 Darwin*)
1326 ;;
Trent Nelson34562e12012-10-17 18:01:12 -04001327 # XXX thankfully this useless troublemaker of a flag has been
1328 # eradicated in the 3.x line. For now, make sure it isn't picked
1329 # up by any of our other platforms that use CC.
1330 AIX*|SunOS*|HP-UX*|IRIX*)
1331 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001332 *)
1333 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1334 ;;
Guido van Rossum5839e582000-10-09 19:52:35 +00001335 esac
Guido van Rossumf8678121998-07-07 21:05:09 +00001336else
1337 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1338 AC_CACHE_VAL(ac_cv_olimit_ok,
1339 [ac_save_cc="$CC"
1340 CC="$CC -Olimit 1500"
Matthias Klosec511b472010-05-08 11:01:39 +00001341 AC_COMPILE_IFELSE(
Mark Dickinson5e13e292010-05-11 08:55:06 +00001342 [AC_LANG_PROGRAM([[]], [[]])],
Matthias Klosec511b472010-05-08 11:01:39 +00001343 [ac_cv_olimit_ok=yes],
1344 [ac_cv_olimit_ok=no]
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001345 )
Guido van Rossumf8678121998-07-07 21:05:09 +00001346 CC="$ac_save_cc"])
1347 AC_MSG_RESULT($ac_cv_olimit_ok)
1348 if test $ac_cv_olimit_ok = yes; then
Stefan Krah67473262012-11-29 00:17:05 +01001349 case $ac_sys_system in
1350 # Issue #16534: On HP-UX ac_cv_olimit_ok=yes is a false positive.
1351 HP-UX*)
1352 ;;
1353 *)
1354 BASECFLAGS="$BASECFLAGS -Olimit 1500"
1355 ;;
1356 esac
Guido van Rossumf8678121998-07-07 21:05:09 +00001357 fi
Guido van Rossum201afe51997-05-14 21:14:44 +00001358fi
Guido van Rossumf8678121998-07-07 21:05:09 +00001359
Martin v. Löwisaac13162006-10-19 10:58:46 +00001360# Check whether GCC supports PyArg_ParseTuple format
1361if test "$GCC" = "yes"
1362then
1363 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1364 save_CFLAGS=$CFLAGS
Benjamin Petersonc8759662013-05-11 13:00:05 -05001365 CFLAGS="$CFLAGS -Werror -Wformat"
Matthias Klosec511b472010-05-08 11:01:39 +00001366 AC_COMPILE_IFELSE([
1367 AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
1368 ],[
1369 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1,
1370 [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1371 AC_MSG_RESULT(yes)
1372 ],[
1373 AC_MSG_RESULT(no)
1374 ])
Martin v. Löwisc1d75972006-10-19 16:01:37 +00001375 CFLAGS=$save_CFLAGS
Martin v. Löwisaac13162006-10-19 10:58:46 +00001376fi
1377
Brett Cannon4ff151a2015-09-18 15:09:42 -07001378
1379# Enable PGO flags.
1380AC_SUBST(PGO_PROF_GEN_FLAG)
1381AC_SUBST(PGO_PROF_USE_FLAG)
1382AC_SUBST(LLVM_PROF_MERGER)
1383AC_SUBST(LLVM_PROF_FILE)
1384AC_SUBST(LLVM_PROF_ERR)
1385AC_SUBST(LLVM_PROF_FOUND)
1386AC_CHECK_PROG(LLVM_PROF_FOUND, llvm-profdata, found, not-found)
1387LLVM_PROF_ERR=no
1388case $CC in
1389 *clang*)
1390 # Any changes made here should be reflected in the GCC+Darwin case below
1391 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
1392 PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
1393 LLVM_PROF_MERGER="llvm-profdata merge -output=code.profclangd *.profclangr"
1394 LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
1395 if test $LLVM_PROF_FOUND = not-found
1396 then
1397 LLVM_PROF_ERR=yes
1398 fi
1399 ;;
1400 *gcc*)
1401 case $ac_sys_system in
1402 Darwin*)
1403 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
1404 PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
1405 LLVM_PROF_MERGER="llvm-profdata merge -output=code.profclangd *.profclangr"
1406 LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
1407 if test $LLVM_PROF_FOUND = not-found
1408 then
1409 LLVM_PROF_ERR=yes
1410 fi
1411 ;;
1412 *)
1413 PGO_PROF_GEN_FLAG="-fprofile-generate"
1414 PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
1415 LLVM_PROF_MERGER="true"
1416 LLVM_PROF_FILE=""
1417 ;;
1418 esac
1419 ;;
Zachary Ware6ed42ea2015-12-21 11:43:03 -06001420 *icc*)
1421 PGO_PROF_GEN_FLAG="-prof-gen"
1422 PGO_PROF_USE_FLAG="-prof-use"
1423 LLVM_PROF_MERGER="true"
1424 LLVM_PROF_FILE=""
1425 ;;
Brett Cannon4ff151a2015-09-18 15:09:42 -07001426esac
1427
1428
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001429# On some compilers, pthreads are available without further options
1430# (e.g. MacOS X). On some of these systems, the compiler will not
1431# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1432# So we have to see first whether pthreads are available without
1433# options before we can check whether -Kpthread improves anything.
1434AC_MSG_CHECKING(whether pthreads are available without options)
1435AC_CACHE_VAL(ac_cv_pthread_is_default,
Matthias Klosec511b472010-05-08 11:01:39 +00001436[AC_RUN_IFELSE([AC_LANG_SOURCE([[
Stefan Krahae66ca62012-11-22 22:36:57 +01001437#include <stdio.h>
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001438#include <pthread.h>
1439
1440void* routine(void* p){return NULL;}
1441
1442int main(){
1443 pthread_t p;
1444 if(pthread_create(&p,NULL,routine,NULL)!=0)
1445 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001446 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001447 return 0;
1448}
Matthias Klosec511b472010-05-08 11:01:39 +00001449]])],[
Skip Montanarod8d39a02003-07-10 20:44:10 +00001450 ac_cv_pthread_is_default=yes
1451 ac_cv_kthread=no
1452 ac_cv_pthread=no
Matthias Klosec511b472010-05-08 11:01:39 +00001453],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no])
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001454])
1455AC_MSG_RESULT($ac_cv_pthread_is_default)
1456
1457
1458if test $ac_cv_pthread_is_default = yes
1459then
1460 ac_cv_kpthread=no
1461else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001462# -Kpthread, if available, provides the right #defines
1463# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001464# Some compilers won't report that they do not support -Kpthread,
1465# so we need to run a program to see whether it really made the
1466# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +00001467AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1468AC_CACHE_VAL(ac_cv_kpthread,
1469[ac_save_cc="$CC"
1470CC="$CC -Kpthread"
Matthias Klosec511b472010-05-08 11:01:39 +00001471AC_RUN_IFELSE([AC_LANG_SOURCE([[
Stefan Krahae66ca62012-11-22 22:36:57 +01001472#include <stdio.h>
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001473#include <pthread.h>
1474
1475void* routine(void* p){return NULL;}
1476
1477int main(){
1478 pthread_t p;
1479 if(pthread_create(&p,NULL,routine,NULL)!=0)
1480 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001481 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001482 return 0;
1483}
Matthias Klosec511b472010-05-08 11:01:39 +00001484]])],[ac_cv_kpthread=yes],[ac_cv_kpthread=no],[ac_cv_kpthread=no])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001485CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001486AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001487fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00001488
Skip Montanarod8d39a02003-07-10 20:44:10 +00001489if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001490then
1491# -Kthread, if available, provides the right #defines
1492# and linker options to make pthread_create available
1493# Some compilers won't report that they do not support -Kthread,
1494# so we need to run a program to see whether it really made the
1495# function available.
1496AC_MSG_CHECKING(whether $CC accepts -Kthread)
1497AC_CACHE_VAL(ac_cv_kthread,
1498[ac_save_cc="$CC"
1499CC="$CC -Kthread"
Matthias Klosec511b472010-05-08 11:01:39 +00001500AC_RUN_IFELSE([AC_LANG_SOURCE([[
Stefan Krahae66ca62012-11-22 22:36:57 +01001501#include <stdio.h>
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001502#include <pthread.h>
1503
1504void* routine(void* p){return NULL;}
1505
1506int main(){
1507 pthread_t p;
1508 if(pthread_create(&p,NULL,routine,NULL)!=0)
1509 return 1;
1510 (void)pthread_detach(p);
1511 return 0;
1512}
Matthias Klosec511b472010-05-08 11:01:39 +00001513]])],[ac_cv_kthread=yes],[ac_cv_kthread=no],[ac_cv_kthread=no])
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001514CC="$ac_save_cc"])
1515AC_MSG_RESULT($ac_cv_kthread)
1516fi
1517
Skip Montanarod8d39a02003-07-10 20:44:10 +00001518if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001519then
1520# -pthread, if available, provides the right #defines
1521# and linker options to make pthread_create available
1522# Some compilers won't report that they do not support -pthread,
1523# so we need to run a program to see whether it really made the
1524# function available.
1525AC_MSG_CHECKING(whether $CC accepts -pthread)
doko@python.orgfa3f9a32013-01-25 15:32:31 +01001526AC_CACHE_VAL(ac_cv_pthread,
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001527[ac_save_cc="$CC"
1528CC="$CC -pthread"
Matthias Klosec511b472010-05-08 11:01:39 +00001529AC_RUN_IFELSE([AC_LANG_SOURCE([[
Stefan Krahae66ca62012-11-22 22:36:57 +01001530#include <stdio.h>
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001531#include <pthread.h>
1532
1533void* routine(void* p){return NULL;}
1534
1535int main(){
1536 pthread_t p;
1537 if(pthread_create(&p,NULL,routine,NULL)!=0)
1538 return 1;
1539 (void)pthread_detach(p);
1540 return 0;
1541}
Matthias Klosec511b472010-05-08 11:01:39 +00001542]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001543CC="$ac_save_cc"])
1544AC_MSG_RESULT($ac_cv_pthread)
1545fi
1546
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001547# If we have set a CC compiler flag for thread support then
1548# check if it works for CXX, too.
1549ac_cv_cxx_thread=no
1550if test ! -z "$CXX"
1551then
1552AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1553ac_save_cxx="$CXX"
1554
1555if test "$ac_cv_kpthread" = "yes"
1556then
Martin v. Löwis519adae2003-09-20 10:47:47 +00001557 CXX="$CXX -Kpthread"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001558 ac_cv_cxx_thread=yes
1559elif test "$ac_cv_kthread" = "yes"
1560then
1561 CXX="$CXX -Kthread"
1562 ac_cv_cxx_thread=yes
1563elif test "$ac_cv_pthread" = "yes"
1564then
1565 CXX="$CXX -pthread"
1566 ac_cv_cxx_thread=yes
1567fi
1568
1569if test $ac_cv_cxx_thread = yes
1570then
1571 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1572 $CXX -c conftest.$ac_ext 2>&5
1573 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1574 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1575 then
1576 ac_cv_cxx_thread=yes
1577 else
1578 ac_cv_cxx_thread=no
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001579 fi
1580 rm -fr conftest*
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001581fi
Brett Cannonc601e0f2004-11-07 01:24:12 +00001582AC_MSG_RESULT($ac_cv_cxx_thread)
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001583fi
Martin v. Löwis519adae2003-09-20 10:47:47 +00001584CXX="$ac_save_cxx"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001585
Fred Drakece81d592000-07-09 14:39:29 +00001586dnl # check for ANSI or K&R ("traditional") preprocessor
1587dnl AC_MSG_CHECKING(for C preprocessor type)
Matthias Klosec511b472010-05-08 11:01:39 +00001588dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Fred Drakece81d592000-07-09 14:39:29 +00001589dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1590dnl int foo;
1591dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
Matthias Klosec511b472010-05-08 11:01:39 +00001592dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional])
Fred Drakece81d592000-07-09 14:39:29 +00001593dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +00001594
Guido van Rossum627b2d71993-12-24 10:39:16 +00001595# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001596AC_HEADER_STDC
doko@ubuntu.comf27ec3e2014-04-17 20:11:19 +02001597AC_CHECK_HEADERS(asm/types.h conio.h direct.h dlfcn.h errno.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001598fcntl.h grp.h \
doko@ubuntu.comf27ec3e2014-04-17 20:11:19 +02001599ieeefp.h io.h langinfo.h libintl.h poll.h process.h pthread.h \
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001600shadow.h signal.h stdint.h stropts.h termios.h thread.h \
Martin v. Löwis14e73b12003-01-01 09:51:12 +00001601unistd.h utime.h \
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00001602sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1603sys/lock.h sys/mkdev.h sys/modem.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001604sys/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 +00001605sys/termio.h sys/time.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001606sys/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 +00001607sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
Christian Heimes3aa138f2013-06-18 13:25:24 +02001608bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001609AC_HEADER_DIRENT
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00001610AC_HEADER_MAJOR
Guido van Rossum627b2d71993-12-24 10:39:16 +00001611
Martin v. Löwis11017b12006-01-14 18:12:57 +00001612# On Linux, netlink.h requires asm/types.h
1613AC_CHECK_HEADERS(linux/netlink.h,,,[
1614#ifdef HAVE_ASM_TYPES_H
1615#include <asm/types.h>
1616#endif
1617#ifdef HAVE_SYS_SOCKET_H
1618#include <sys/socket.h>
1619#endif
1620])
1621
Guido van Rossum627b2d71993-12-24 10:39:16 +00001622# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001623was_it_defined=no
1624AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001625AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1626 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1627])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001628AC_MSG_RESULT($was_it_defined)
1629
Neal Norwitz11690112002-07-30 01:08:28 +00001630# Check whether using makedev requires defining _OSF_SOURCE
1631AC_MSG_CHECKING(for makedev)
Matthias Klosec511b472010-05-08 11:01:39 +00001632AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Jesus Cea616de772010-04-28 10:32:30 +00001633#if defined(MAJOR_IN_MKDEV)
1634#include <sys/mkdev.h>
1635#elif defined(MAJOR_IN_SYSMACROS)
1636#include <sys/sysmacros.h>
1637#else
1638#include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001639#endif ]], [[ makedev(0, 0) ]])],
1640[ac_cv_has_makedev=yes],
1641[ac_cv_has_makedev=no])
Neal Norwitz11690112002-07-30 01:08:28 +00001642if test "$ac_cv_has_makedev" = "no"; then
1643 # we didn't link, try if _OSF_SOURCE will allow us to link
Matthias Klosec511b472010-05-08 11:01:39 +00001644 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001645#define _OSF_SOURCE 1
1646#include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001647 ]], [[ makedev(0, 0) ]])],
1648[ac_cv_has_makedev=yes],
1649[ac_cv_has_makedev=no])
Neal Norwitz11690112002-07-30 01:08:28 +00001650 if test "$ac_cv_has_makedev" = "yes"; then
1651 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1652 fi
1653fi
1654AC_MSG_RESULT($ac_cv_has_makedev)
1655if test "$ac_cv_has_makedev" = "yes"; then
1656 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1657fi
1658
Martin v. Löwis399a6892002-10-04 10:22:02 +00001659# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1660# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1661# defined, but the compiler does not support pragma redefine_extname,
1662# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1663# structures (such as rlimit64) without declaring them. As a
1664# work-around, disable LFS on such configurations
1665
1666use_lfs=yes
1667AC_MSG_CHECKING(Solaris LFS bug)
Matthias Klosec511b472010-05-08 11:01:39 +00001668AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwis399a6892002-10-04 10:22:02 +00001669#define _LARGEFILE_SOURCE 1
1670#define _FILE_OFFSET_BITS 64
1671#include <sys/resource.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001672]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes])
Martin v. Löwis399a6892002-10-04 10:22:02 +00001673AC_MSG_RESULT($sol_lfs_bug)
1674if test "$sol_lfs_bug" = "yes"; then
1675 use_lfs=no
1676fi
1677
1678if test "$use_lfs" = "yes"; then
Guido van Rossum810cc512001-09-09 23:51:39 +00001679# Two defines needed to enable largefile support on various platforms
1680# These may affect some typedefs
Georg Brandl94800df2011-02-25 11:09:02 +00001681case $ac_sys_system/$ac_sys_release in
1682AIX*)
1683 AC_DEFINE(_LARGE_FILES, 1,
1684 [This must be defined on AIX systems to enable large file support.])
1685 ;;
1686esac
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001687AC_DEFINE(_LARGEFILE_SOURCE, 1,
1688[This must be defined on some systems to enable large file support.])
1689AC_DEFINE(_FILE_OFFSET_BITS, 64,
1690[This must be set to 64 on some systems to enable large file support.])
Martin v. Löwis399a6892002-10-04 10:22:02 +00001691fi
Guido van Rossum810cc512001-09-09 23:51:39 +00001692
Guido van Rossum300fda71996-08-19 21:58:16 +00001693# Add some code to confdefs.h so that the test for off_t works on SCO
1694cat >> confdefs.h <<\EOF
1695#if defined(SCO_DS)
1696#undef _OFF_T
1697#endif
1698EOF
1699
Guido van Rossumef2255b2000-03-10 22:30:29 +00001700# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001701AC_TYPE_MODE_T
1702AC_TYPE_OFF_T
1703AC_TYPE_PID_T
Matthias Klosecbf54b12010-05-08 11:04:18 +00001704AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001705AC_TYPE_SIZE_T
1706AC_TYPE_UID_T
Mark Dickinson17c50cd2012-12-02 13:13:56 +00001707
1708# There are two separate checks for each of the exact-width integer types we
1709# need. First we check whether the type is available using the usual
1710# AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h>
1711# and <stdint.h> where available). We then also use the special type checks of
1712# the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available
1713# directly, #define's uint32_t to be a suitable type.
1714
1715AC_CHECK_TYPE(uint32_t,
1716 AC_DEFINE(HAVE_UINT32_T, 1, [Define if your compiler provides uint32_t.]),,)
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001717AC_TYPE_UINT32_T
Mark Dickinson17c50cd2012-12-02 13:13:56 +00001718
1719AC_CHECK_TYPE(uint64_t,
1720 AC_DEFINE(HAVE_UINT64_T, 1, [Define if your compiler provides uint64_t.]),,)
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001721AC_TYPE_UINT64_T
Mark Dickinson17c50cd2012-12-02 13:13:56 +00001722
1723AC_CHECK_TYPE(int32_t,
1724 AC_DEFINE(HAVE_INT32_T, 1, [Define if your compiler provides int32_t.]),,)
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001725AC_TYPE_INT32_T
Mark Dickinson17c50cd2012-12-02 13:13:56 +00001726
1727AC_CHECK_TYPE(int64_t,
1728 AC_DEFINE(HAVE_INT64_T, 1, [Define if your compiler provides int64_t.]),,)
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001729AC_TYPE_INT64_T
Mark Dickinson17c50cd2012-12-02 13:13:56 +00001730
Christian Heimes951cc0f2008-01-31 23:08:23 +00001731AC_CHECK_TYPE(ssize_t,
Matthias Klose5183ebd2010-04-24 16:38:36 +00001732 AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001733
Guido van Rossumef2255b2000-03-10 22:30:29 +00001734# Sizes of various common basic types
Skip Montanarob9820a32004-01-17 00:16:12 +00001735# ANSI C requires sizeof(char) == 1, so no need to check it
Guido van Rossum3065c942001-09-17 04:03:14 +00001736AC_CHECK_SIZEOF(int, 4)
1737AC_CHECK_SIZEOF(long, 4)
1738AC_CHECK_SIZEOF(void *, 4)
Guido van Rossum3065c942001-09-17 04:03:14 +00001739AC_CHECK_SIZEOF(short, 2)
1740AC_CHECK_SIZEOF(float, 4)
1741AC_CHECK_SIZEOF(double, 8)
1742AC_CHECK_SIZEOF(fpos_t, 4)
Martin v. Löwis18e16552006-02-15 17:27:45 +00001743AC_CHECK_SIZEOF(size_t, 4)
Christian Heimes951cc0f2008-01-31 23:08:23 +00001744AC_CHECK_SIZEOF(pid_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +00001745
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001746AC_MSG_CHECKING(for long long support)
1747have_long_long=no
Matthias Klosec511b472010-05-08 11:01:39 +00001748AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001749 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1750 have_long_long=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001751],[])
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001752AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001753if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +00001754AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001755fi
1756
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001757AC_MSG_CHECKING(for long double support)
1758have_long_double=no
Matthias Klosec511b472010-05-08 11:01:39 +00001759AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001760 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1761 have_long_double=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001762],[])
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001763AC_MSG_RESULT($have_long_double)
Mark Dickinsondc1688a2008-06-27 22:20:14 +00001764if test "$have_long_double" = yes ; then
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001765AC_CHECK_SIZEOF(long double, 12)
1766fi
1767
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001768AC_MSG_CHECKING(for _Bool support)
1769have_c99_bool=no
Matthias Klosec511b472010-05-08 11:01:39 +00001770AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Bool x; x = (_Bool)0;]])],[
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001771 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1772 have_c99_bool=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001773],[])
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001774AC_MSG_RESULT($have_c99_bool)
1775if test "$have_c99_bool" = yes ; then
1776AC_CHECK_SIZEOF(_Bool, 1)
1777fi
1778
Martin v. Löwisebe26702006-10-02 14:55:51 +00001779AC_CHECK_TYPES(uintptr_t,
1780 [AC_CHECK_SIZEOF(uintptr_t, 4)],
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001781 [], [#ifdef HAVE_STDINT_H
1782 #include <stdint.h>
Antoine Pitrou7be5a652010-10-10 08:14:41 +00001783 #endif
1784 #ifdef HAVE_INTTYPES_H
1785 #include <inttypes.h>
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001786 #endif])
Martin v. Löwisebe26702006-10-02 14:55:51 +00001787
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001788AC_CHECK_SIZEOF(off_t, [], [
1789#ifdef HAVE_SYS_TYPES_H
1790#include <sys/types.h>
1791#endif
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001792])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001793
1794AC_MSG_CHECKING(whether to enable large file support)
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001795if test "$have_long_long" = yes
1796then
1797if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001798 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001799 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1800 [Defined to enable large file support when an off_t is bigger than a long
1801 and long long is available and at least as big as an off_t. You may need
1802 to add some flags for configuration and compilation to enable this mode.
1803 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001804 AC_MSG_RESULT(yes)
1805else
1806 AC_MSG_RESULT(no)
1807fi
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001808else
1809 AC_MSG_RESULT(no)
1810fi
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001811
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001812AC_CHECK_SIZEOF(time_t, [], [
1813#ifdef HAVE_SYS_TYPES_H
1814#include <sys/types.h>
1815#endif
1816#ifdef HAVE_TIME_H
1817#include <time.h>
1818#endif
Fred Drakea3f6e912000-06-29 20:44:47 +00001819])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001820
Trent Mick635f6fb2000-08-23 21:33:05 +00001821# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001822ac_save_cc="$CC"
1823if test "$ac_cv_kpthread" = "yes"
1824then CC="$CC -Kpthread"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001825elif test "$ac_cv_kthread" = "yes"
1826then CC="$CC -Kthread"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001827elif test "$ac_cv_pthread" = "yes"
1828then CC="$CC -pthread"
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001829fi
Trent Mick635f6fb2000-08-23 21:33:05 +00001830AC_MSG_CHECKING(for pthread_t)
1831have_pthread_t=no
Matthias Klosec511b472010-05-08 11:01:39 +00001832AC_COMPILE_IFELSE([
1833 AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
1834],[have_pthread_t=yes],[])
Trent Mick635f6fb2000-08-23 21:33:05 +00001835AC_MSG_RESULT($have_pthread_t)
1836if test "$have_pthread_t" = yes ; then
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001837 AC_CHECK_SIZEOF(pthread_t, [], [
1838#ifdef HAVE_PTHREAD_H
1839#include <pthread.h>
1840#endif
Trent Mick635f6fb2000-08-23 21:33:05 +00001841 ])
Trent Mick635f6fb2000-08-23 21:33:05 +00001842fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001843CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +00001844
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001845AC_MSG_CHECKING(for --enable-toolbox-glue)
1846AC_ARG_ENABLE(toolbox-glue,
Matthias Klose22520ea2010-05-08 10:14:46 +00001847 AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions]))
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001848
1849if test -z "$enable_toolbox_glue"
1850then
1851 case $ac_sys_system/$ac_sys_release in
1852 Darwin/*)
1853 enable_toolbox_glue="yes";;
1854 *)
1855 enable_toolbox_glue="no";;
1856 esac
1857fi
1858case "$enable_toolbox_glue" in
1859yes)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001860 extra_machdep_objs="Python/mactoolboxglue.o"
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001861 extra_undefs="-u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001862 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1863 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001864 ;;
1865*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001866 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +00001867 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001868 ;;
1869esac
1870AC_MSG_RESULT($enable_toolbox_glue)
1871
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00001872
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001873AC_SUBST(OTHER_LIBTOOL_OPT)
1874case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001875 Darwin/@<:@01567@:>@\..*)
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001876 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1877 ;;
1878 Darwin/*)
1879 OTHER_LIBTOOL_OPT=""
1880 ;;
1881esac
1882
Ronald Oussoren25967582009-09-06 10:00:26 +00001883
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001884AC_SUBST(LIBTOOL_CRUFT)
1885case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001886 Darwin/@<:@01567@:>@\..*)
Ronald Oussoren988117f2006-04-29 11:31:35 +00001887 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1888 if test "${enable_universalsdk}"; then
1889 :
1890 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001891 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001892 fi
Jack Jansenb36687a2004-07-16 08:43:47 +00001893 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001894 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +00001895 Darwin/*)
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001896 gcc_version=`gcc -dumpversion`
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001897 if test ${gcc_version} '<' 4.0
1898 then
1899 LIBTOOL_CRUFT="-lcc_dynamic"
1900 else
1901 LIBTOOL_CRUFT=""
1902 fi
Matthias Klosec511b472010-05-08 11:01:39 +00001903 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Ronald Oussoren25967582009-09-06 10:00:26 +00001904 #include <unistd.h>
1905 int main(int argc, char*argv[])
1906 {
1907 if (sizeof(long) == 4) {
1908 return 0;
1909 } else {
1910 return 1;
1911 }
Ronald Oussoren84ddd722009-09-08 07:17:10 +00001912 }
Matthias Klosec511b472010-05-08 11:01:39 +00001913 ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
Ronald Oussoren25967582009-09-06 10:00:26 +00001914
1915 if test "${ac_osx_32bit}" = "yes"; then
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001916 case `/usr/bin/arch` in
Ronald Oussoren25967582009-09-06 10:00:26 +00001917 i386)
1918 MACOSX_DEFAULT_ARCH="i386"
1919 ;;
1920 ppc)
1921 MACOSX_DEFAULT_ARCH="ppc"
1922 ;;
1923 *)
1924 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1925 ;;
1926 esac
1927 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001928 case `/usr/bin/arch` in
Ronald Oussoren25967582009-09-06 10:00:26 +00001929 i386)
1930 MACOSX_DEFAULT_ARCH="x86_64"
1931 ;;
1932 ppc)
1933 MACOSX_DEFAULT_ARCH="ppc64"
1934 ;;
1935 *)
1936 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1937 ;;
1938 esac
1939
1940 #ARCH_RUN_32BIT="true"
1941 fi
1942
1943 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
Jack Jansenb36687a2004-07-16 08:43:47 +00001944 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001945 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001946esac
1947
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001948AC_MSG_CHECKING(for --enable-framework)
1949if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001950then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001951 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001952 # -F. is needed to allow linking to the framework while
1953 # in the build location.
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001954 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1955 [Define if you want to produce an OpenStep/Rhapsody framework
1956 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001957 AC_MSG_RESULT(yes)
Ronald Oussoren450d5612009-06-08 21:12:41 +00001958 if test $enable_shared = "yes"
1959 then
Ronald Oussoren9ebd2422009-09-29 13:00:44 +00001960 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 +00001961 fi
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001962else
1963 AC_MSG_RESULT(no)
1964fi
1965
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001966AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001967case $ac_sys_system/$ac_sys_release in
1968 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001969 AC_DEFINE(WITH_DYLD, 1,
1970 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1971 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1972 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001973 AC_MSG_RESULT(always on for Darwin)
1974 ;;
1975 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001976 AC_MSG_RESULT(no)
1977 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001978esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001979
Guido van Rossumac405f61994-09-12 10:56:06 +00001980# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +00001981AC_SUBST(SO)
1982AC_SUBST(LDSHARED)
Tarek Ziadé00002952010-04-03 08:37:59 +00001983AC_SUBST(LDCXXSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001984AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001985AC_SUBST(CCSHARED)
1986AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001987# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +00001988# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001989AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +00001990if test -z "$SO"
1991then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001992 case $ac_sys_system in
Neal Norwitz58e28882006-05-19 07:00:58 +00001993 hp*|HP*)
1994 case `uname -m` in
1995 ia64) SO=.so;;
1996 *) SO=.sl;;
1997 esac
1998 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001999 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00002000 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +00002001 esac
Martin v. Löwis368de8f2003-06-14 14:46:38 +00002002else
2003 # this might also be a termcap variable, see #610332
2004 echo
2005 echo '====================================================================='
2006 echo '+ +'
2007 echo '+ WARNING: You have set SO in your environment. +'
2008 echo '+ Do you really mean to change the extension for shared libraries? +'
2009 echo '+ Continuing in 10 seconds to let you to ponder. +'
2010 echo '+ +'
2011 echo '====================================================================='
2012 sleep 10
Guido van Rossumac405f61994-09-12 10:56:06 +00002013fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002014AC_MSG_RESULT($SO)
Ronald Oussoren79f90492009-01-02 10:44:46 +00002015
Neal Norwitz58e28882006-05-19 07:00:58 +00002016AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
Guido van Rossumac405f61994-09-12 10:56:06 +00002017# LDSHARED is the ld *command* used to create shared library
Skip Montanaroce59c042004-01-17 14:19:44 +00002018# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00002019# (Shared libraries in this instance are shared modules to be loaded into
2020# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002021AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00002022if test -z "$LDSHARED"
2023then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002024 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00002025 AIX*)
Georg Brandl71f4fbb2011-02-25 11:04:50 +00002026 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
Guido van Rossumce608b02001-09-28 15:59:38 +00002027 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00002028 ;;
2029 BeOS*)
2030 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +00002031 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00002032 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +00002033 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +00002034 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Greg Ward57c9a662000-05-26 12:22:54 +00002035 SunOS/5*)
Tarek Ziadé00002952010-04-03 08:37:59 +00002036 if test "$GCC" = "yes" ; then
2037 LDSHARED='$(CC) -shared'
2038 LDCXXSHARED='$(CXX) -shared'
2039 else
2040 LDSHARED='$(CC) -G'
2041 LDCXXSHARED='$(CXX) -G'
Greg Ward57c9a662000-05-26 12:22:54 +00002042 fi ;;
Thomas Hellerdc96a772008-04-04 10:07:55 +00002043 hp*|HP*)
Tarek Ziadé00002952010-04-03 08:37:59 +00002044 if test "$GCC" = "yes" ; then
2045 LDSHARED='$(CC) -shared'
2046 LDCXXSHARED='$(CXX) -shared'
2047 else
2048 LDSHARED='ld -b'
Thomas Hellerdc96a772008-04-04 10:07:55 +00002049 fi ;;
Guido van Rossum71001e41995-01-26 00:44:03 +00002050 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Jack Jansen418c3b12001-11-14 10:59:57 +00002051 Darwin/1.3*)
Stefan Krah3a3e2032010-11-28 15:30:05 +00002052 LDSHARED='$(CC) -bundle'
2053 LDCXXSHARED='$(CXX) -bundle'
Jack Jansena3891ea2001-09-07 14:25:12 +00002054 if test "$enable_framework" ; then
2055 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00002056 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2057 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00002058 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00002059 else
2060 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +00002061 LDSHARED="$LDSHARED -undefined suppress"
Tarek Ziadé00002952010-04-03 08:37:59 +00002062 LDCXXSHARED="$LDCXXSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +00002063 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00002064 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
Stefan Krah3a3e2032010-11-28 15:30:05 +00002065 LDSHARED='$(CC) -bundle'
2066 LDCXXSHARED='$(CXX) -bundle'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002067 if test "$enable_framework" ; then
2068 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00002069 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2070 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00002071 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002072 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +00002073 # No framework, use the Python app as bundle-loader
2074 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
Jack Jansenc28fc372003-02-25 13:14:43 +00002075 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Tarek Ziadé00002952010-04-03 08:37:59 +00002076 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00002077 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00002078 Darwin/*)
2079 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
2080 # This allows an extension to be used in any Python
Ronald Oussoren38f1b982007-09-02 09:46:07 +00002081
Ned Deilyc40b9032014-06-25 13:48:46 -07002082 dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
2083 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
2084 dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
2085 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
2086 if test ${dep_target_major} -eq 10 && \
2087 test ${dep_target_minor} -le 2
Jack Jansen6b08a402004-06-03 12:41:45 +00002088 then
Ned Deilyc40b9032014-06-25 13:48:46 -07002089 # building for OS X 10.0 through 10.2
Stefan Krah3a3e2032010-11-28 15:30:05 +00002090 LDSHARED='$(CC) -bundle'
2091 LDCXXSHARED='$(CXX) -bundle'
Jack Jansen6b08a402004-06-03 12:41:45 +00002092 if test "$enable_framework" ; then
2093 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00002094 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2095 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00002096 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen6b08a402004-06-03 12:41:45 +00002097 else
2098 # No framework, use the Python app as bundle-loader
2099 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
2100 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Tarek Ziadé00002952010-04-03 08:37:59 +00002101 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Jack Jansen6b08a402004-06-03 12:41:45 +00002102 fi
Ned Deilyc40b9032014-06-25 13:48:46 -07002103 else
2104 # building for OS X 10.3 and later
2105 if test "${enable_universalsdk}"; then
2106 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
2107 fi
2108 LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
2109 LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
2110 BLDSHARED="$LDSHARED"
Jack Jansen6b08a402004-06-03 12:41:45 +00002111 fi
2112 ;;
Tarek Ziadé00002952010-04-03 08:37:59 +00002113 Linux*|GNU*|QNX*)
2114 LDSHARED='$(CC) -shared'
2115 LDCXXSHARED='$(CXX) -shared';;
2116 BSD/OS*/4*)
2117 LDSHARED="gcc -shared"
2118 LDCXXSHARED="g++ -shared";;
Martin v. Löwis222c5152006-06-03 07:37:13 +00002119 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +00002120 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +00002121 then
Stefan Krah3a3e2032010-11-28 15:30:05 +00002122 LDSHARED='$(CC) -shared'
2123 LDCXXSHARED='$(CXX) -shared'
Guido van Rossum0286ae82000-08-29 15:06:49 +00002124 else
Stefan Krah3a3e2032010-11-28 15:30:05 +00002125 LDSHARED="ld -Bshareable"
Guido van Rossum0286ae82000-08-29 15:06:49 +00002126 fi;;
Martin v. Löwis222c5152006-06-03 07:37:13 +00002127 OpenBSD*)
2128 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
2129 then
Stefan Krah3a3e2032010-11-28 15:30:05 +00002130 LDSHARED='$(CC) -shared $(CCSHARED)'
2131 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
Martin v. Löwis222c5152006-06-03 07:37:13 +00002132 else
2133 case `uname -r` in
2134 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
2135 LDSHARED="ld -Bshareable ${LDFLAGS}"
2136 ;;
2137 *)
Stefan Krah3a3e2032010-11-28 15:30:05 +00002138 LDSHARED='$(CC) -shared $(CCSHARED)'
2139 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
Martin v. Löwis222c5152006-06-03 07:37:13 +00002140 ;;
2141 esac
2142 fi;;
Tarek Ziadé00002952010-04-03 08:37:59 +00002143 NetBSD*|DragonFly*)
Antoine Pitroucb402772011-01-02 20:51:34 +00002144 LDSHARED='$(CC) -shared'
2145 LDCXXSHARED='$(CXX) -shared';;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00002146 OpenUNIX*|UnixWare*)
Tarek Ziadé00002952010-04-03 08:37:59 +00002147 if test "$GCC" = "yes" ; then
2148 LDSHARED='$(CC) -shared'
2149 LDCXXSHARED='$(CXX) -shared'
2150 else
2151 LDSHARED='$(CC) -G'
2152 LDCXXSHARED='$(CXX) -G'
Martin v. Löwisbec19582001-03-21 15:57:54 +00002153 fi;;
Tarek Ziadé00002952010-04-03 08:37:59 +00002154 SCO_SV*)
2155 LDSHARED='$(CC) -Wl,-G,-Bexport'
2156 LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
2157 CYGWIN*)
2158 LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
2159 LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
2160 atheos*)
2161 LDSHARED="gcc -shared"
2162 LDCXXSHARED="g++ -shared";;
Guido van Rossumac405f61994-09-12 10:56:06 +00002163 *) LDSHARED="ld";;
2164 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00002165fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002166AC_MSG_RESULT($LDSHARED)
Tarek Ziadé00002952010-04-03 08:37:59 +00002167LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
Neil Schemenauerb3531b82001-02-16 04:09:05 +00002168BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +00002169# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00002170# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002171AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00002172if test -z "$CCSHARED"
2173then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00002174 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +00002175 SunOS*) if test "$GCC" = yes;
Martin v. Löwiseb623572007-03-12 10:50:39 +00002176 then CCSHARED="-fPIC";
2177 elif test `uname -p` = sparc;
2178 then CCSHARED="-xcode=pic32";
2179 else CCSHARED="-Kpic";
2180 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +00002181 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +00002182 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +00002183 else CCSHARED="+z";
2184 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002185 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00002186 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00002187 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00002188 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00002189 if test "$GCC" = "yes"
2190 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +00002191 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +00002192 fi;;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00002193 SCO_SV*)
2194 if test "$GCC" = "yes"
2195 then CCSHARED="-fPIC"
2196 else CCSHARED="-Kpic -belf"
2197 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00002198 IRIX*/6*) case $CC in
2199 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +00002200 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00002201 esac;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002202 atheos*) CCSHARED="-fPIC";;
Guido van Rossumac405f61994-09-12 10:56:06 +00002203 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00002204fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002205AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00002206# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +00002207# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002208AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00002209if test -z "$LINKFORSHARED"
2210then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00002211 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00002212 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +00002213 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +00002214 LINKFORSHARED="-Wl,-E -Wl,+s";;
2215# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00002216 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002217 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00002218 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002219 Darwin/*)
Raymond Hettingerec6eb362004-11-05 07:02:59 +00002220 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
2221 # which is
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002222 # not used by the core itself but which needs to be in the core so
2223 # that dynamically loaded extension modules have access to it.
Jack Jansen97e3f002003-02-23 22:59:01 +00002224 # -prebind is no longer used, because it actually seems to give a
2225 # slowdown in stead of a speedup, maybe due to the large number of
2226 # dynamic loads Python does.
Raymond Hettingerec6eb362004-11-05 07:02:59 +00002227
2228 LINKFORSHARED="$extra_undefs"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002229 if test "$enable_framework"
2230 then
Jack Jansenda49e192005-01-07 13:08:22 +00002231 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002232 fi
Raymond Hettingerec6eb362004-11-05 07:02:59 +00002233 LINKFORSHARED="$LINKFORSHARED";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00002234 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00002235 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +00002236 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00002237 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
Guido van Rossumdf693651999-01-07 21:50:41 +00002238 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
2239 then
2240 LINKFORSHARED="-Wl,--export-dynamic"
2241 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00002242 SunOS/5*) case $CC in
2243 *gcc*)
Martin v. Löwisa4548572002-04-18 14:51:36 +00002244 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +00002245 then
2246 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +00002247 fi;;
2248 esac;;
Jason Tishler30765592003-09-04 11:04:06 +00002249 CYGWIN*)
2250 if test $enable_shared = "no"
2251 then
2252 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
2253 fi;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +00002254 QNX*)
2255 # -Wl,-E causes the symbols to be added to the dynamic
2256 # symbol table so that they can be found when a module
2257 # is loaded. -N 2048K causes the stack size to be set
2258 # to 2048 kilobytes so that the stack doesn't overflow
2259 # when running test_compile.py.
2260 LINKFORSHARED='-Wl,-E -N 2048K';;
Guido van Rossumac405f61994-09-12 10:56:06 +00002261 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00002262fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002263AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00002264
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002265
Neil Schemenauer61c51152001-01-26 16:18:16 +00002266AC_SUBST(CFLAGSFORSHARED)
2267AC_MSG_CHECKING(CFLAGSFORSHARED)
2268if test ! "$LIBRARY" = "$LDLIBRARY"
2269then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +00002270 case $ac_sys_system in
2271 CYGWIN*)
2272 # Cygwin needs CCSHARED when building extension DLLs
2273 # but not when building the interpreter DLL.
2274 CFLAGSFORSHARED='';;
2275 *)
2276 CFLAGSFORSHARED='$(CCSHARED)'
2277 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +00002278fi
2279AC_MSG_RESULT($CFLAGSFORSHARED)
2280
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002281# SHLIBS are libraries (except -lc and -lm) to link to the python shared
2282# library (with --enable-shared).
2283# For platforms on which shared libraries are not allowed to have unresolved
Martin v. Löwisd6359c52002-08-04 12:38:50 +00002284# symbols, this must be set to $(LIBS) (expanded by make). We do this even
2285# if it is not required, since it creates a dependency of the shared library
2286# to LIBS. This, in turn, means that applications linking the shared libpython
2287# don't need to link LIBS explicitly. The default should be only changed
2288# on systems where this approach causes problems.
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002289AC_SUBST(SHLIBS)
2290AC_MSG_CHECKING(SHLIBS)
2291case "$ac_sys_system" in
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002292 *)
Martin v. Löwisd6359c52002-08-04 12:38:50 +00002293 SHLIBS='$(LIBS)';;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002294esac
2295AC_MSG_RESULT($SHLIBS)
2296
2297
Guido van Rossum627b2d71993-12-24 10:39:16 +00002298# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002299AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
2300AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Victor Stinner7c906672015-01-06 13:53:37 +01002301AC_CHECK_LIB(crypto, RAND_egd,
2302 AC_DEFINE(HAVE_RAND_EGD, 1,
2303 [Define if the libcrypto has RAND_egd]))
Martin v. Löwis519adae2003-09-20 10:47:47 +00002304
Skip Montanaro4d756af2008-12-01 01:55:22 +00002305# only check for sem_init if thread support is requested
Martin v. Löwis519adae2003-09-20 10:47:47 +00002306if test "$with_threads" = "yes" -o -z "$with_threads"; then
2307 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
2308 # posix4 on Solaris 2.6
2309 # pthread (first!) on Linux
2310fi
2311
Martin v. Löwis19d17342003-06-14 21:03:05 +00002312# check if we need libintl for locale functions
2313AC_CHECK_LIB(intl, textdomain,
2314 AC_DEFINE(WITH_LIBINTL, 1,
2315 [Define to 1 if libintl is needed for locale functions.]))
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002316
2317# checks for system dependent C++ extensions support
2318case "$ac_sys_system" in
2319 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
Matthias Klosec511b472010-05-08 11:01:39 +00002320 AC_LINK_IFELSE([
Georg Brandl94800df2011-02-25 11:09:02 +00002321 AC_LANG_PROGRAM([[#include <load.h>]],
Matthias Klosec511b472010-05-08 11:01:39 +00002322 [[loadAndInit("", 0, "")]])
2323 ],[
2324 AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002325 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
2326 and you want support for AIX C++ shared extension modules.])
Matthias Klosec511b472010-05-08 11:01:39 +00002327 AC_MSG_RESULT(yes)
2328 ],[
2329 AC_MSG_RESULT(no)
2330 ]);;
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002331 *) ;;
2332esac
2333
Guido van Rossum70c7f481998-03-26 18:44:10 +00002334# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002335# BeOS' sockets are stashed in libnet.
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002336AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002337AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Skip Montanarob9949db2004-01-17 04:04:13 +00002338
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00002339case "$ac_sys_system" in
2340BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002341AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
2342;;
2343esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00002344
Guido van Rossumc5a39031996-07-31 17:35:03 +00002345AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002346AC_ARG_WITH(libs,
Matthias Klose22520ea2010-05-08 10:14:46 +00002347 AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002348[
Guido van Rossumc5a39031996-07-31 17:35:03 +00002349AC_MSG_RESULT($withval)
2350LIBS="$withval $LIBS"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002351],
2352[AC_MSG_RESULT(no)])
Guido van Rossum627b2d71993-12-24 10:39:16 +00002353
Benjamin Peterson64e8f6e2014-12-15 00:00:23 -05002354PKG_PROG_PKG_CONFIG
Benjamin Petersone9e07bf2010-03-09 21:46:54 +00002355
Benjamin Peterson2c196742009-12-31 03:17:18 +00002356# Check for use of the system expat library
2357AC_MSG_CHECKING(for --with-system-expat)
2358AC_ARG_WITH(system_expat,
Benjamin Petersonf2d1b2a2010-10-31 16:53:53 +00002359 AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
2360 [],
2361 [with_system_expat="no"])
Benjamin Peterson2c196742009-12-31 03:17:18 +00002362
2363AC_MSG_RESULT($with_system_expat)
2364
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002365# Check for use of the system libffi library
2366AC_MSG_CHECKING(for --with-system-ffi)
2367AC_ARG_WITH(system_ffi,
Benjamin Petersonf2d1b2a2010-10-31 16:53:53 +00002368 AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),
2369 [],
2370 [with_system_ffi="no"])
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002371
Benjamin Petersone9e07bf2010-03-09 21:46:54 +00002372if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
Benjamin Peterson1c335e62010-01-01 15:16:29 +00002373 LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
2374else
2375 LIBFFI_INCLUDEDIR=""
2376fi
2377AC_SUBST(LIBFFI_INCLUDEDIR)
2378
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002379AC_MSG_RESULT($with_system_ffi)
2380
Ned Deilya2a9f572013-10-25 00:30:10 -07002381# Check for --with-tcltk-includes=path and --with-tcltk-libs=path
2382AC_SUBST(TCLTK_INCLUDES)
2383AC_SUBST(TCLTK_LIBS)
2384AC_MSG_CHECKING(for --with-tcltk-includes)
2385AC_ARG_WITH(tcltk-includes,
2386 AS_HELP_STRING([--with-tcltk-includes='-I...'], [override search for Tcl and Tk include files]),
2387 [],
2388 [with_tcltk_includes="default"])
2389AC_MSG_RESULT($with_tcltk_includes)
2390AC_MSG_CHECKING(for --with-tcltk-libs)
2391AC_ARG_WITH(tcltk-libs,
2392 AS_HELP_STRING([--with-tcltk-libs='-L...'], [override search for Tcl and Tk libs]),
2393 [],
2394 [with_tcltk_libs="default"])
2395AC_MSG_RESULT($with_tcltk_libs)
2396if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault
2397then
2398 if test "x$with_tcltk_includes" != "x$with_tcltk_libs"
2399 then
2400 AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither])
2401 fi
2402 TCLTK_INCLUDES=""
2403 TCLTK_LIBS=""
2404else
2405 TCLTK_INCLUDES="$with_tcltk_includes"
2406 TCLTK_LIBS="$with_tcltk_libs"
2407fi
2408
Matthias Klose10cbe482009-04-29 17:18:19 +00002409# Check for --with-dbmliborder
2410AC_MSG_CHECKING(for --with-dbmliborder)
2411AC_ARG_WITH(dbmliborder,
Matthias Klose22520ea2010-05-08 10:14:46 +00002412 AS_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 +00002413[
2414if test x$with_dbmliborder = xyes
2415then
2416AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2417else
2418 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
2419 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
2420 then
2421 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2422 fi
2423 done
Matthias Klose61dbdb92009-04-29 20:09:50 +00002424fi])
2425AC_MSG_RESULT($with_dbmliborder)
Matthias Klose10cbe482009-04-29 17:18:19 +00002426
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002427# Determine if signalmodule should be used.
2428AC_SUBST(USE_SIGNAL_MODULE)
2429AC_SUBST(SIGNAL_OBJS)
2430AC_MSG_CHECKING(for --with-signal-module)
2431AC_ARG_WITH(signal-module,
Matthias Klose22520ea2010-05-08 10:14:46 +00002432 AS_HELP_STRING([--with-signal-module], [disable/enable signal module]))
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002433
2434if test -z "$with_signal_module"
2435then with_signal_module="yes"
2436fi
2437AC_MSG_RESULT($with_signal_module)
2438
2439if test "${with_signal_module}" = "yes"; then
2440 USE_SIGNAL_MODULE=""
2441 SIGNAL_OBJS=""
2442else
2443 USE_SIGNAL_MODULE="#"
2444 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2445fi
2446
Guido van Rossum3d15bd82001-01-10 18:53:48 +00002447# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00002448AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002449USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00002450
Guido van Rossum54d93d41997-01-22 20:51:58 +00002451AC_MSG_CHECKING(for --with-dec-threads)
2452AC_SUBST(LDLAST)
2453AC_ARG_WITH(dec-threads,
Matthias Klose22520ea2010-05-08 10:14:46 +00002454 AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002455[
Barry Warsawc0d24d82000-06-29 16:12:00 +00002456AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00002457LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00002458if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00002459 with_thread="$withval";
2460fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002461[AC_MSG_RESULT(no)])
Guido van Rossum54d93d41997-01-22 20:51:58 +00002462
Martin v. Löwis11437992002-04-12 09:54:03 +00002463# Templates for things AC_DEFINEd more than once.
2464# For a single AC_DEFINE, no template is needed.
2465AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2466AH_TEMPLATE(_REENTRANT,
2467 [Define to force use of thread-safe errno, h_errno, and other functions])
2468AH_TEMPLATE(WITH_THREAD,
2469 [Define if you want to compile in rudimentary thread support])
2470
Guido van Rossum54d93d41997-01-22 20:51:58 +00002471AC_MSG_CHECKING(for --with-threads)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002472dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawc0d24d82000-06-29 16:12:00 +00002473AC_ARG_WITH(threads,
Matthias Klose22520ea2010-05-08 10:14:46 +00002474 AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support]))
Guido van Rossum54d93d41997-01-22 20:51:58 +00002475
Barry Warsawc0d24d82000-06-29 16:12:00 +00002476# --with-thread is deprecated, but check for it anyway
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002477dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00002478AC_ARG_WITH(thread,
Matthias Klose22520ea2010-05-08 10:14:46 +00002479 AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002480 [with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002481
2482if test -z "$with_threads"
2483then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002484fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00002485AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00002486
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002487AC_SUBST(THREADOBJ)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002488if test "$with_threads" = "no"
2489then
2490 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002491elif test "$ac_cv_pthread_is_default" = yes
2492then
2493 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002494 # Defining _REENTRANT on system with POSIX threads should not hurt.
2495 AC_DEFINE(_REENTRANT)
2496 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002497 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00002498elif test "$ac_cv_kpthread" = "yes"
2499then
2500 CC="$CC -Kpthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002501 if test "$ac_cv_cxx_thread" = "yes"; then
2502 CXX="$CXX -Kpthread"
2503 fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00002504 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002505 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002506 THREADOBJ="Python/thread.o"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002507elif test "$ac_cv_kthread" = "yes"
2508then
2509 CC="$CC -Kthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002510 if test "$ac_cv_cxx_thread" = "yes"; then
2511 CXX="$CXX -Kthread"
2512 fi
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002513 AC_DEFINE(WITH_THREAD)
2514 posix_threads=yes
2515 THREADOBJ="Python/thread.o"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002516elif test "$ac_cv_pthread" = "yes"
2517then
2518 CC="$CC -pthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002519 if test "$ac_cv_cxx_thread" = "yes"; then
2520 CXX="$CXX -pthread"
2521 fi
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002522 AC_DEFINE(WITH_THREAD)
2523 posix_threads=yes
2524 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +00002525else
Martin v. Löwis130fb172001-07-19 11:00:41 +00002526 if test ! -z "$with_threads" -a -d "$with_threads"
2527 then LDFLAGS="$LDFLAGS -L$with_threads"
2528 fi
2529 if test ! -z "$withval" -a -d "$withval"
2530 then LDFLAGS="$LDFLAGS -L$withval"
2531 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002532
2533 # According to the POSIX spec, a pthreads implementation must
Matthias Klosea2542be2004-08-16 11:35:51 +00002534 # define _POSIX_THREADS in unistd.h. Some apparently don't
2535 # (e.g. gnu pth with pthread emulation)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002536 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2537 AC_EGREP_CPP(yes,
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002538 [
2539#include <unistd.h>
2540#ifdef _POSIX_THREADS
2541yes
2542#endif
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002543 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2544 AC_MSG_RESULT($unistd_defines_pthreads)
2545
Martin v. Löwis130fb172001-07-19 11:00:41 +00002546 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002547 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2548 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002549 AC_DEFINE(HURD_C_THREADS, 1,
2550 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002551 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002552 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002553 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2554 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002555 AC_DEFINE(MACH_C_THREADS, 1,
2556 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002557 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002558 AC_MSG_CHECKING(for --with-pth)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002559 AC_ARG_WITH([pth],
Matthias Klose22520ea2010-05-08 10:14:46 +00002560 AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002561 [AC_MSG_RESULT($withval)
2562 AC_DEFINE([WITH_THREAD])
2563 AC_DEFINE([HAVE_PTH], 1,
2564 [Define if you have GNU PTH threads.])
2565 LIBS="-lpth $LIBS"
2566 THREADOBJ="Python/thread.o"],
2567 [AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002568
2569 # Just looking for pthread_create in libpthread is not enough:
2570 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2571 # So we really have to include pthread.h, and then link.
2572 _libs=$LIBS
2573 LIBS="$LIBS -lpthread"
2574 AC_MSG_CHECKING([for pthread_create in -lpthread])
Stefan Krahae66ca62012-11-22 22:36:57 +01002575 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2576#include <stdio.h>
2577#include <pthread.h>
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002578
Matthias Klosec511b472010-05-08 11:01:39 +00002579void * start_routine (void *arg) { exit (0); }]], [[
2580pthread_create (NULL, NULL, start_routine, NULL)]])],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002581 AC_MSG_RESULT(yes)
2582 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002583 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002584 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002585 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00002586 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002587 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002588 THREADOBJ="Python/thread.o"],[
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002589 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2590 AC_DEFINE(ATHEOS_THREADS, 1,
2591 [Define this if you have AtheOS threads.])
2592 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002593 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002594 AC_DEFINE(BEOS_THREADS, 1,
2595 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002596 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002597 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002598 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002599 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002600 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002601 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002602 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002603 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002604 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002605 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002606 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002607 LIBS="$LIBS -lpthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002608 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002609 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002610 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002611 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002612 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002613 USE_THREAD_MODULE="#"])
Skip Montanarof8712e52004-01-17 03:04:46 +00002614 ])])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002615
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002616 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2617 LIBS="$LIBS -lmpc"
2618 THREADOBJ="Python/thread.o"
2619 USE_THREAD_MODULE=""])
2620
2621 if test "$posix_threads" != "yes"; then
2622 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2623 LIBS="$LIBS -lthread"
2624 THREADOBJ="Python/thread.o"
2625 USE_THREAD_MODULE=""])
2626 fi
2627
2628 if test "$USE_THREAD_MODULE" != "#"
2629 then
2630 # If the above checks didn't disable threads, (at least) OSF1
2631 # needs this '-threads' argument during linking.
2632 case $ac_sys_system in
2633 OSF1) LDLAST=-threads;;
2634 esac
2635 fi
2636fi
2637
2638if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002639 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002640 AC_DEFINE(_POSIX_THREADS, 1,
2641 [Define if you have POSIX threads,
2642 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002643 fi
2644
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002645 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2646 case $ac_sys_system/$ac_sys_release in
Charles-François Natali4929eb92011-07-21 19:41:04 +02002647 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002648 [Defined for Solaris 2.6 bug in pthread header.])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002649 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002650 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002651 [Define if the Posix semaphores do not work on your system])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002652 ;;
Charles-François Natali4929eb92011-07-21 19:41:04 +02002653 AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002654 [Define if the Posix semaphores do not work on your system])
Christian Heimescba36bb2008-01-30 22:54:18 +00002655 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002656 esac
2657
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002658 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2659 AC_CACHE_VAL(ac_cv_pthread_system_supported,
Stefan Krahae66ca62012-11-22 22:36:57 +01002660 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
2661 #include <stdio.h>
2662 #include <pthread.h>
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002663 void *foo(void *parm) {
2664 return NULL;
2665 }
2666 main() {
2667 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002668 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002669 if (pthread_attr_init(&attr)) exit(-1);
2670 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002671 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002672 exit(0);
Matthias Klosec511b472010-05-08 11:01:39 +00002673 }]])],
2674 [ac_cv_pthread_system_supported=yes],
2675 [ac_cv_pthread_system_supported=no],
2676 [ac_cv_pthread_system_supported=no])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002677 ])
2678 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2679 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002680 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002681 fi
Jason Tishlerfac083d2003-07-22 15:20:49 +00002682 AC_CHECK_FUNCS(pthread_sigmask,
2683 [case $ac_sys_system in
2684 CYGWIN*)
2685 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2686 [Define if pthread_sigmask() does not work on your system.])
2687 ;;
2688 esac])
Christian Heimes0d604cf2013-08-21 13:26:05 +02002689 AC_CHECK_FUNCS(pthread_atfork)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002690fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002691
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002692
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002693# Check for enable-ipv6
Martin v. Löwis11437992002-04-12 09:54:03 +00002694AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002695AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002696AC_ARG_ENABLE(ipv6,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002697[ --enable-ipv6 Enable ipv6 (with ipv4) support
2698 --disable-ipv6 Disable ipv6 support],
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002699[ case "$enableval" in
2700 no)
2701 AC_MSG_RESULT(no)
2702 ipv6=no
2703 ;;
2704 *) AC_MSG_RESULT(yes)
2705 AC_DEFINE(ENABLE_IPV6)
2706 ipv6=yes
2707 ;;
2708 esac ],
2709
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002710[
2711dnl the check does not work on cross compilation case...
Charles-François Natalibe2b9072013-01-08 19:47:00 +01002712 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* AF_INET6 available check */
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002713#include <sys/types.h>
Charles-François Natalibe2b9072013-01-08 19:47:00 +01002714#include <sys/socket.h>]],
2715[[int domain = AF_INET6;]])],[
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002716 AC_MSG_RESULT(yes)
Matthias Klosec511b472010-05-08 11:01:39 +00002717 ipv6=yes
2718],[
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002719 AC_MSG_RESULT(no)
2720 ipv6=no
Matthias Klosec511b472010-05-08 11:01:39 +00002721])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002722
2723if test "$ipv6" = "yes"; then
2724 AC_MSG_CHECKING(if RFC2553 API is available)
Matthias Klosec511b472010-05-08 11:01:39 +00002725 AC_COMPILE_IFELSE([
2726 AC_LANG_PROGRAM([[#include <sys/types.h>
2727#include <netinet/in.h>]],
2728 [[struct sockaddr_in6 x;
2729 x.sin6_scope_id;]])
2730 ],[
2731 AC_MSG_RESULT(yes)
2732 ipv6=yes
2733 ],[
2734 AC_MSG_RESULT(no, IPv6 disabled)
2735 ipv6=no
2736 ])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002737fi
2738
2739if test "$ipv6" = "yes"; then
2740 AC_DEFINE(ENABLE_IPV6)
2741fi
2742])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002743
2744ipv6type=unknown
2745ipv6lib=none
2746ipv6trylibc=no
2747
2748if test "$ipv6" = "yes"; then
2749 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00002750 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2751 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002752 case $i in
2753 inria)
2754 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002755 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002756#include <netinet/in.h>
2757#ifdef IPV6_INRIA_VERSION
2758yes
2759#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002760 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002761 ;;
2762 kame)
2763 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002764 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002765#include <netinet/in.h>
2766#ifdef __KAME__
2767yes
2768#endif],
2769 [ipv6type=$i;
2770 ipv6lib=inet6
2771 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002772 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002773 ;;
2774 linux-glibc)
2775 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002776 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002777#include <features.h>
2778#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2779yes
2780#endif],
2781 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002782 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002783 ;;
2784 linux-inet6)
2785 dnl http://www.v6.linux.or.jp/
2786 if test -d /usr/inet6; then
2787 ipv6type=$i
2788 ipv6lib=inet6
2789 ipv6libdir=/usr/inet6/lib
Skip Montanarodecc6a42003-01-01 20:07:49 +00002790 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002791 fi
2792 ;;
2793 solaris)
2794 if test -f /etc/netconfig; then
Antoine Pitrou31e85952011-01-03 18:57:14 +00002795 if $GREP -q tcp6 /etc/netconfig; then
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002796 ipv6type=$i
2797 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002798 fi
2799 fi
2800 ;;
2801 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002802 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002803#include <sys/param.h>
2804#ifdef _TOSHIBA_INET6
2805yes
2806#endif],
2807 [ipv6type=$i;
2808 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002809 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002810 ;;
2811 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002812 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002813#include </usr/local/v6/include/sys/v6config.h>
2814#ifdef __V6D__
2815yes
2816#endif],
2817 [ipv6type=$i;
2818 ipv6lib=v6;
2819 ipv6libdir=/usr/local/v6/lib;
Skip Montanarodecc6a42003-01-01 20:07:49 +00002820 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002821 ;;
2822 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002823 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002824#include <sys/param.h>
2825#ifdef _ZETA_MINAMI_INET6
2826yes
2827#endif],
2828 [ipv6type=$i;
2829 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002830 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002831 ;;
2832 esac
2833 if test "$ipv6type" != "unknown"; then
2834 break
2835 fi
2836 done
2837 AC_MSG_RESULT($ipv6type)
2838fi
2839
2840if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2841 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2842 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2843 echo "using lib$ipv6lib"
2844 else
2845 if test $ipv6trylibc = "yes"; then
2846 echo "using libc"
2847 else
2848 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2849 echo "You need to fetch lib$ipv6lib.a from appropriate"
2850 echo 'ipv6 kit and compile beforehand.'
2851 exit 1
2852 fi
2853 fi
2854fi
2855
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002856AC_MSG_CHECKING(for OSX 10.5 SDK or later)
Matthias Klosec511b472010-05-08 11:01:39 +00002857AC_COMPILE_IFELSE([
Mark Dickinson0712b562010-05-08 19:13:21 +00002858 AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
Matthias Klosec511b472010-05-08 11:01:39 +00002859],[
Matthias Klose5183ebd2010-04-24 16:38:36 +00002860 AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.])
Matthias Klosec511b472010-05-08 11:01:39 +00002861 AC_MSG_RESULT(yes)
2862],[
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002863 AC_MSG_RESULT(no)
Matthias Klosec511b472010-05-08 11:01:39 +00002864])
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002865
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002866# Check for --with-doc-strings
2867AC_MSG_CHECKING(for --with-doc-strings)
2868AC_ARG_WITH(doc-strings,
Matthias Klose22520ea2010-05-08 10:14:46 +00002869 AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings]))
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002870
2871if test -z "$with_doc_strings"
2872then with_doc_strings="yes"
2873fi
2874if test "$with_doc_strings" != "no"
2875then
2876 AC_DEFINE(WITH_DOC_STRINGS, 1,
2877 [Define if you want documentation strings in extension modules])
2878fi
2879AC_MSG_RESULT($with_doc_strings)
2880
Neil Schemenauera35c6882001-02-27 04:45:05 +00002881# Check for Python-specific malloc support
Martin v. Löwisf30d60e2004-06-08 08:17:44 +00002882AC_MSG_CHECKING(for --with-tsc)
2883AC_ARG_WITH(tsc,
Matthias Klose22520ea2010-05-08 10:14:46 +00002884 AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[
Martin v. Löwisf30d60e2004-06-08 08:17:44 +00002885if test "$withval" != no
2886then
2887 AC_DEFINE(WITH_TSC, 1,
2888 [Define to profile with the Pentium timestamp counter])
2889 AC_MSG_RESULT(yes)
2890else AC_MSG_RESULT(no)
2891fi],
2892[AC_MSG_RESULT(no)])
2893
2894# Check for Python-specific malloc support
Neil Schemenauera35c6882001-02-27 04:45:05 +00002895AC_MSG_CHECKING(for --with-pymalloc)
2896AC_ARG_WITH(pymalloc,
Matthias Klose22520ea2010-05-08 10:14:46 +00002897 AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs]))
Neil Schemenauer16c22972002-03-22 15:34:49 +00002898
2899if test -z "$with_pymalloc"
2900then with_pymalloc="yes"
2901fi
2902if test "$with_pymalloc" != "no"
2903then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002904 AC_DEFINE(WITH_PYMALLOC, 1,
2905 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00002906fi
2907AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00002908
Benjamin Peterson91c12eb2009-12-03 02:52:39 +00002909# Check for Valgrind support
2910AC_MSG_CHECKING([for --with-valgrind])
2911AC_ARG_WITH([valgrind],
Matthias Klose22520ea2010-05-08 10:14:46 +00002912 AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
Benjamin Peterson91c12eb2009-12-03 02:52:39 +00002913 with_valgrind=no)
2914AC_MSG_RESULT([$with_valgrind])
2915if test "$with_valgrind" != no; then
2916 AC_CHECK_HEADER([valgrind/valgrind.h],
2917 [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
2918 [AC_MSG_ERROR([Valgrind support requested but headers not available])]
2919 )
2920fi
2921
Barry Warsawef82cd72000-06-30 16:21:01 +00002922# Check for --with-wctype-functions
2923AC_MSG_CHECKING(for --with-wctype-functions)
2924AC_ARG_WITH(wctype-functions,
Matthias Klose22520ea2010-05-08 10:14:46 +00002925 AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002926[
Barry Warsawef82cd72000-06-30 16:21:01 +00002927if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002928then
2929 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2930 [Define if you want wctype.h functions to be used instead of the
2931 one supplied by Python itself. (see Include/unicodectype.h).])
2932 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00002933else AC_MSG_RESULT(no)
2934fi],
2935[AC_MSG_RESULT(no)])
2936
Guido van Rossum68242b51996-05-28 22:53:03 +00002937# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002938AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00002939DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002940
Guido van Rossume97ee181999-12-20 21:27:22 +00002941# the dlopen() function means we might want to use dynload_shlib.o. some
2942# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00002943AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00002944
2945# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2946# loading of modules.
2947AC_SUBST(DYNLOADFILE)
2948AC_MSG_CHECKING(DYNLOADFILE)
2949if test -z "$DYNLOADFILE"
2950then
2951 case $ac_sys_system/$ac_sys_release in
Martin v. Löwisc19c5a62003-11-18 20:00:44 +00002952 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2953 if test "$ac_cv_func_dlopen" = yes
2954 then DYNLOADFILE="dynload_shlib.o"
2955 else DYNLOADFILE="dynload_aix.o"
2956 fi
2957 ;;
Guido van Rossume97ee181999-12-20 21:27:22 +00002958 BeOS*) DYNLOADFILE="dynload_beos.o";;
2959 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Anthony Baxter82201742006-04-09 15:07:40 +00002960 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2961 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002962 atheos*) DYNLOADFILE="dynload_atheos.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00002963 *)
2964 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2965 # out any dynamic loading
2966 if test "$ac_cv_func_dlopen" = yes
2967 then DYNLOADFILE="dynload_shlib.o"
2968 else DYNLOADFILE="dynload_stub.o"
2969 fi
2970 ;;
2971 esac
2972fi
2973AC_MSG_RESULT($DYNLOADFILE)
2974if test "$DYNLOADFILE" != "dynload_stub.o"
2975then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002976 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2977 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00002978fi
2979
Jack Jansenc49e5b72001-06-19 15:00:23 +00002980# MACHDEP_OBJS can be set to platform-specific object files needed by Python
2981
2982AC_SUBST(MACHDEP_OBJS)
2983AC_MSG_CHECKING(MACHDEP_OBJS)
2984if test -z "$MACHDEP_OBJS"
2985then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002986 MACHDEP_OBJS=$extra_machdep_objs
2987else
2988 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00002989fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002990AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00002991
Guido van Rossum627b2d71993-12-24 10:39:16 +00002992# checks for library functions
Martin v. Löwisaef18b12008-03-24 13:31:16 +00002993AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2994 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
Martin v. Löwis438b5342002-12-27 10:16:42 +00002995 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
Benjamin Peterson27c269a2014-12-26 11:09:00 -06002996 getentropy \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00002997 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
Benjamin Petersond16e01c2014-02-04 10:20:26 -05002998 initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime mmap \
Martin v. Löwisa5f09072002-10-11 05:37:59 +00002999 mremap nice pathconf pause plock poll pthread_init \
Guido van Rossum162e38c2003-02-19 15:25:10 +00003000 putenv readlink realpath \
Jesse Noller355b1262009-04-02 00:03:28 +00003001 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
3002 setgid \
Martin v. Löwis4daacb12003-03-28 18:37:01 +00003003 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00003004 setlocale setregid setreuid setresuid setresgid \
3005 setsid setpgid setpgrp setuid setvbuf snprintf \
Skip Montanaro7e11a012004-02-07 12:55:46 +00003006 sigaction siginterrupt sigrelse strftime \
Michael W. Hudson34f20ea2002-05-27 15:08:24 +00003007 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Neal Norwitz05a45592006-03-20 06:30:08 +00003008 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00003009
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00003010# For some functions, having a definition is not sufficient, since
3011# we want to take their address.
3012AC_MSG_CHECKING(for chroot)
Matthias Klosec511b472010-05-08 11:01:39 +00003013AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])],
3014 [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
3015 AC_MSG_RESULT(yes)],
3016 [AC_MSG_RESULT(no)
3017])
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00003018AC_MSG_CHECKING(for link)
Matthias Klosec511b472010-05-08 11:01:39 +00003019AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])],
3020 [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
3021 AC_MSG_RESULT(yes)],
3022 [AC_MSG_RESULT(no)
3023])
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00003024AC_MSG_CHECKING(for symlink)
Matthias Klosec511b472010-05-08 11:01:39 +00003025AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])],
3026 [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
3027 AC_MSG_RESULT(yes)],
3028 [AC_MSG_RESULT(no)
3029])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00003030AC_MSG_CHECKING(for fchdir)
Matthias Klosec511b472010-05-08 11:01:39 +00003031AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])],
3032 [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
3033 AC_MSG_RESULT(yes)],
3034 [AC_MSG_RESULT(no)
3035])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00003036AC_MSG_CHECKING(for fsync)
Matthias Klosec511b472010-05-08 11:01:39 +00003037AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])],
3038 [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
3039 AC_MSG_RESULT(yes)],
3040 [AC_MSG_RESULT(no)
3041])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00003042AC_MSG_CHECKING(for fdatasync)
Matthias Klosec511b472010-05-08 11:01:39 +00003043AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])],
3044 [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
3045 AC_MSG_RESULT(yes)],
3046 [AC_MSG_RESULT(no)
3047])
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00003048AC_MSG_CHECKING(for epoll)
Matthias Klosec511b472010-05-08 11:01:39 +00003049AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])],
3050 [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
3051 AC_MSG_RESULT(yes)],
3052 [AC_MSG_RESULT(no)
3053])
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00003054AC_MSG_CHECKING(for kqueue)
Matthias Klosec511b472010-05-08 11:01:39 +00003055AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00003056#include <sys/types.h>
3057#include <sys/event.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003058 ]], [[int x=kqueue()]])],
3059 [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
3060 AC_MSG_RESULT(yes)],
3061 [AC_MSG_RESULT(no)
3062])
Martin v. Löwisd5843682002-11-21 20:41:28 +00003063# On some systems (eg. FreeBSD 5), we would find a definition of the
3064# functions ctermid_r, setgroups in the library, but no prototype
3065# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
3066# address to avoid compiler warnings and potential miscompilations
3067# because of the missing prototypes.
3068
3069AC_MSG_CHECKING(for ctermid_r)
Matthias Klosec511b472010-05-08 11:01:39 +00003070AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisd5843682002-11-21 20:41:28 +00003071#include <stdio.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003072]], [[void* p = ctermid_r]])],
3073 [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
3074 AC_MSG_RESULT(yes)],
3075 [AC_MSG_RESULT(no)
3076])
Martin v. Löwisd5843682002-11-21 20:41:28 +00003077
Antoine Pitroub170f172010-09-10 18:47:36 +00003078AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl],
3079 [AC_COMPILE_IFELSE(
3080 [AC_LANG_PROGRAM(
3081 [#include <sys/file.h>],
3082 [void* p = flock]
3083 )],
3084 [ac_cv_flock_decl=yes],
3085 [ac_cv_flock_decl=no]
3086 )
Matthias Klosec511b472010-05-08 11:01:39 +00003087])
Antoine Pitroub170f172010-09-10 18:47:36 +00003088if test "x${ac_cv_flock_decl}" = xyes; then
3089 AC_CHECK_FUNCS(flock,,
3090 AC_CHECK_LIB(bsd,flock,
3091 [AC_DEFINE(HAVE_FLOCK)
3092 AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
3093 ])
3094 )
Antoine Pitrou85729812010-09-07 14:55:24 +00003095fi
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00003096
3097AC_MSG_CHECKING(for getpagesize)
Matthias Klosec511b472010-05-08 11:01:39 +00003098AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00003099#include <unistd.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003100]], [[void* p = getpagesize]])],
3101 [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
3102 AC_MSG_RESULT(yes)],
3103 [AC_MSG_RESULT(no)
3104])
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00003105
Charles-François Natali93a11752011-11-27 13:01:35 +01003106AC_MSG_CHECKING(for broken unsetenv)
3107AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3108#include <stdlib.h>
3109]], [[int res = unsetenv("DUMMY")]])],
3110 [AC_MSG_RESULT(no)],
3111 [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.)
3112 AC_MSG_RESULT(yes)
3113])
3114
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00003115dnl check for true
3116AC_CHECK_PROGS(TRUE, true, /bin/true)
3117
Martin v. Löwis95c419b2003-05-03 12:10:48 +00003118dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
3119dnl On others, they are in the C library, so we to take no action
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00003120AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
Martin v. Löwis95c419b2003-05-03 12:10:48 +00003121 AC_CHECK_LIB(resolv, inet_aton)
3122)
3123
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00003124# On Tru64, chflags seems to be present, but calling it will
3125# exit Python
Gregory P. Smithbb213892009-11-02 01:37:37 +00003126AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
Ned Deily43e10542011-06-27 23:41:53 -07003127AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00003128#include <sys/stat.h>
3129#include <unistd.h>
3130int main(int argc, char*argv[])
3131{
3132 if(chflags(argv[0], 0) != 0)
3133 return 1;
3134 return 0;
3135}
Ned Deily43e10542011-06-27 23:41:53 -07003136]])],
Matthias Klosec511b472010-05-08 11:01:39 +00003137[ac_cv_have_chflags=yes],
3138[ac_cv_have_chflags=no],
3139[ac_cv_have_chflags=cross])
Gregory P. Smithbb213892009-11-02 01:37:37 +00003140])
3141if test "$ac_cv_have_chflags" = cross ; then
3142 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
3143fi
3144if test "$ac_cv_have_chflags" = yes ; then
Ned Deily43e10542011-06-27 23:41:53 -07003145 AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the 'chflags' function.])
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003146fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00003147
Gregory P. Smithbb213892009-11-02 01:37:37 +00003148AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
Ned Deily43e10542011-06-27 23:41:53 -07003149AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00003150#include <sys/stat.h>
3151#include <unistd.h>
3152int main(int argc, char*argv[])
3153{
3154 if(lchflags(argv[0], 0) != 0)
3155 return 1;
3156 return 0;
3157}
Ned Deily43e10542011-06-27 23:41:53 -07003158]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross])
Gregory P. Smithbb213892009-11-02 01:37:37 +00003159])
3160if test "$ac_cv_have_lchflags" = cross ; then
3161 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
3162fi
3163if test "$ac_cv_have_lchflags" = yes ; then
Ned Deily43e10542011-06-27 23:41:53 -07003164 AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.])
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003165fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00003166
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00003167dnl Check if system zlib has *Copy() functions
Ronald Oussorenf8752642006-07-06 10:13:35 +00003168dnl
3169dnl On MacOSX the linker will search for dylibs on the entire linker path
3170dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
3171dnl to revert to a more traditional unix behaviour and make it possible to
3172dnl override the system libz with a local static library of libz. Temporarily
3173dnl add that flag to our CFLAGS as well to ensure that we check the version
3174dnl of libz that will be used by setup.py.
3175dnl The -L/usr/local/lib is needed as wel to get the same compilation
3176dnl environment as setup.py (and leaving it out can cause configure to use the
3177dnl wrong version of the library)
3178case $ac_sys_system/$ac_sys_release in
3179Darwin/*)
3180 _CUR_CFLAGS="${CFLAGS}"
3181 _CUR_LDFLAGS="${LDFLAGS}"
3182 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
3183 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
3184 ;;
3185esac
3186
Matthias Klose5183ebd2010-04-24 16:38:36 +00003187AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00003188
Ronald Oussorenf8752642006-07-06 10:13:35 +00003189case $ac_sys_system/$ac_sys_release in
3190Darwin/*)
3191 CFLAGS="${_CUR_CFLAGS}"
3192 LDFLAGS="${_CUR_LDFLAGS}"
3193 ;;
3194esac
3195
Martin v. Löwise9416172003-05-03 10:12:45 +00003196AC_MSG_CHECKING(for hstrerror)
Matthias Klosec511b472010-05-08 11:01:39 +00003197AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwise9416172003-05-03 10:12:45 +00003198#include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003199]], [[void* p = hstrerror; hstrerror(0)]])],
3200 [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
3201 AC_MSG_RESULT(yes)],
3202 [AC_MSG_RESULT(no)
3203])
Martin v. Löwise9416172003-05-03 10:12:45 +00003204
3205AC_MSG_CHECKING(for inet_aton)
Matthias Klosec511b472010-05-08 11:01:39 +00003206AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwis86d66262006-02-17 08:40:11 +00003207#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00003208#include <sys/socket.h>
3209#include <netinet/in.h>
3210#include <arpa/inet.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003211]], [[void* p = inet_aton;inet_aton(0,0)]])],
3212 [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
3213 AC_MSG_RESULT(yes)],
3214 [AC_MSG_RESULT(no)
3215])
Martin v. Löwise9416172003-05-03 10:12:45 +00003216
3217AC_MSG_CHECKING(for inet_pton)
Matthias Klosec511b472010-05-08 11:01:39 +00003218AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00003219#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00003220#include <sys/socket.h>
3221#include <netinet/in.h>
3222#include <arpa/inet.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003223]], [[void* p = inet_pton]])],
3224 [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
3225 AC_MSG_RESULT(yes)],
3226 [AC_MSG_RESULT(no)
3227])
Martin v. Löwise9416172003-05-03 10:12:45 +00003228
Martin v. Löwisd6640d42003-07-06 09:29:52 +00003229# On some systems, setgroups is in unistd.h, on others, in grp.h
Martin v. Löwisd5843682002-11-21 20:41:28 +00003230AC_MSG_CHECKING(for setgroups)
Matthias Klosec511b472010-05-08 11:01:39 +00003231AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00003232#include <unistd.h>
Martin v. Löwisd6640d42003-07-06 09:29:52 +00003233#ifdef HAVE_GRP_H
3234#include <grp.h>
3235#endif
Matthias Klosec511b472010-05-08 11:01:39 +00003236]], [[void* p = setgroups]])],
3237 [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
3238 AC_MSG_RESULT(yes)],
3239 [AC_MSG_RESULT(no)
3240])
Martin v. Löwisd5843682002-11-21 20:41:28 +00003241
Fred Drake8cef4cf2000-06-28 16:40:38 +00003242# check for openpty and forkpty
3243
Martin v. Löwisfd9a72a2006-01-08 10:07:33 +00003244AC_CHECK_FUNCS(openpty,,
3245 AC_CHECK_LIB(util,openpty,
3246 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
3247 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
3248 )
3249)
3250AC_CHECK_FUNCS(forkpty,,
3251 AC_CHECK_LIB(util,forkpty,
3252 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
3253 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
3254 )
3255)
Fred Drake8cef4cf2000-06-28 16:40:38 +00003256
Brett Cannonaa5778d2008-03-18 04:09:00 +00003257# Stuff for expat.
3258AC_CHECK_FUNCS(memmove)
3259
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00003260# check for long file support functions
3261AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
3262
Brett Cannonaa5778d2008-03-18 04:09:00 +00003263AC_REPLACE_FUNCS(dup2 getcwd strdup)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003264AC_CHECK_FUNCS(getpgrp,
Matthias Klosec511b472010-05-08 11:01:39 +00003265 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
3266 [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
3267 [])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003268)
Jack Jansen150753c2003-03-29 22:07:47 +00003269AC_CHECK_FUNCS(setpgrp,
Matthias Klosec511b472010-05-08 11:01:39 +00003270 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])],
3271 [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])],
3272 [])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003273)
3274AC_CHECK_FUNCS(gettimeofday,
Matthias Klosec511b472010-05-08 11:01:39 +00003275 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]],
3276 [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])],
3277 [],
3278 [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
3279 [Define if gettimeofday() does not have second (timezone) argument
3280 This is the case on Motorola V4 (R40V4.2)])
3281 ])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003282)
Guido van Rossum627b2d71993-12-24 10:39:16 +00003283
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00003284AC_MSG_CHECKING(for major, minor, and makedev)
Matthias Klosec511b472010-05-08 11:01:39 +00003285AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Neal Norwitz6eb37f02003-02-23 23:28:15 +00003286#if defined(MAJOR_IN_MKDEV)
3287#include <sys/mkdev.h>
3288#elif defined(MAJOR_IN_SYSMACROS)
3289#include <sys/sysmacros.h>
3290#else
3291#include <sys/types.h>
3292#endif
Matthias Klosec511b472010-05-08 11:01:39 +00003293]], [[
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00003294 makedev(major(0),minor(0));
Matthias Klosec511b472010-05-08 11:01:39 +00003295]])],[
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00003296 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
3297 [Define to 1 if you have the device macros.])
3298 AC_MSG_RESULT(yes)
3299],[
3300 AC_MSG_RESULT(no)
3301])
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003302
3303# On OSF/1 V5.1, getaddrinfo is available, but a define
3304# for [no]getaddrinfo in netdb.h.
3305AC_MSG_CHECKING(for getaddrinfo)
Matthias Klosec511b472010-05-08 11:01:39 +00003306AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00003307#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003308#include <sys/socket.h>
3309#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00003310#include <stdio.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003311]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],
3312[have_getaddrinfo=yes],
3313[have_getaddrinfo=no])
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003314AC_MSG_RESULT($have_getaddrinfo)
3315if test $have_getaddrinfo = yes
3316then
3317 AC_MSG_CHECKING(getaddrinfo bug)
3318 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
Matthias Klosec511b472010-05-08 11:01:39 +00003319 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
Stefan Krah0afe4e42012-11-22 23:56:51 +01003320#include <stdio.h>
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003321#include <sys/types.h>
3322#include <netdb.h>
3323#include <string.h>
3324#include <sys/socket.h>
3325#include <netinet/in.h>
3326
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003327int main()
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003328{
3329 int passive, gaierr, inet4 = 0, inet6 = 0;
3330 struct addrinfo hints, *ai, *aitop;
3331 char straddr[INET6_ADDRSTRLEN], strport[16];
3332
3333 for (passive = 0; passive <= 1; passive++) {
3334 memset(&hints, 0, sizeof(hints));
3335 hints.ai_family = AF_UNSPEC;
3336 hints.ai_flags = passive ? AI_PASSIVE : 0;
3337 hints.ai_socktype = SOCK_STREAM;
Hye-Shik Chang54f94392004-04-14 07:55:31 +00003338 hints.ai_protocol = IPPROTO_TCP;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003339 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
3340 (void)gai_strerror(gaierr);
3341 goto bad;
3342 }
3343 for (ai = aitop; ai; ai = ai->ai_next) {
3344 if (ai->ai_addr == NULL ||
3345 ai->ai_addrlen == 0 ||
3346 getnameinfo(ai->ai_addr, ai->ai_addrlen,
3347 straddr, sizeof(straddr), strport, sizeof(strport),
3348 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
3349 goto bad;
3350 }
3351 switch (ai->ai_family) {
3352 case AF_INET:
3353 if (strcmp(strport, "54321") != 0) {
3354 goto bad;
3355 }
3356 if (passive) {
3357 if (strcmp(straddr, "0.0.0.0") != 0) {
3358 goto bad;
3359 }
3360 } else {
3361 if (strcmp(straddr, "127.0.0.1") != 0) {
3362 goto bad;
3363 }
3364 }
3365 inet4++;
3366 break;
3367 case AF_INET6:
3368 if (strcmp(strport, "54321") != 0) {
3369 goto bad;
3370 }
3371 if (passive) {
3372 if (strcmp(straddr, "::") != 0) {
3373 goto bad;
3374 }
3375 } else {
3376 if (strcmp(straddr, "::1") != 0) {
3377 goto bad;
3378 }
3379 }
3380 inet6++;
3381 break;
3382 case AF_UNSPEC:
3383 goto bad;
3384 break;
3385 default:
3386 /* another family support? */
3387 break;
3388 }
3389 }
3390 }
3391
3392 if (!(inet4 == 0 || inet4 == 2))
3393 goto bad;
3394 if (!(inet6 == 0 || inet6 == 2))
3395 goto bad;
3396
3397 if (aitop)
3398 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003399 return 0;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003400
3401 bad:
3402 if (aitop)
3403 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003404 return 1;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003405}
Matthias Klosec511b472010-05-08 11:01:39 +00003406]]])],
3407[ac_cv_buggy_getaddrinfo=no],
3408[ac_cv_buggy_getaddrinfo=yes],
doko@python.orgd65e2ba2013-01-31 23:52:03 +01003409[
3410if test "${enable_ipv6+set}" = set; then
3411 ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6"
3412else
3413 ac_cv_buggy_getaddrinfo=yes
3414fi]))
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003415fi
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003416
Benjamin Peterson75fed812010-11-01 01:47:19 +00003417AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
3418
Mark Dickinson0ef0b912009-12-31 21:11:48 +00003419if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003420then
3421 if test $ipv6 = yes
3422 then
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003423 echo 'Fatal: You must get working getaddrinfo() function.'
3424 echo ' or you can specify "--disable-ipv6"'.
3425 exit 1
3426 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003427else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003428 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003429fi
Benjamin Peterson75fed812010-11-01 01:47:19 +00003430
Thomas Woutersb0db85a2001-08-08 10:39:03 +00003431AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003432
Guido van Rossum627b2d71993-12-24 10:39:16 +00003433# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003434AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00003435AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003436AC_STRUCT_TIMEZONE
Martin v. Löwis60a5d722002-10-16 20:28:25 +00003437AC_CHECK_MEMBERS([struct stat.st_rdev])
3438AC_CHECK_MEMBERS([struct stat.st_blksize])
Hye-Shik Chang5f937a72005-06-02 13:09:30 +00003439AC_CHECK_MEMBERS([struct stat.st_flags])
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00003440AC_CHECK_MEMBERS([struct stat.st_gen])
3441AC_CHECK_MEMBERS([struct stat.st_birthtime])
Guido van Rossum98bf58f2001-10-18 20:34:25 +00003442AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003443
3444AC_MSG_CHECKING(for time.h that defines altzone)
Matthias Klosec511b472010-05-08 11:01:39 +00003445AC_CACHE_VAL(ac_cv_header_time_altzone,[
3446 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])],
3447 [ac_cv_header_time_altzone=yes],
3448 [ac_cv_header_time_altzone=no])
3449 ])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003450AC_MSG_RESULT($ac_cv_header_time_altzone)
3451if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003452 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003453fi
3454
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003455was_it_defined=no
3456AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Matthias Klosec511b472010-05-08 11:01:39 +00003457AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003458#include <sys/types.h>
3459#include <sys/select.h>
3460#include <sys/time.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003461]], [[;]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003462 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
3463 [Define if you can safely include both <sys/select.h> and <sys/time.h>
3464 (which you can't on SCO ODT 3.0).])
3465 was_it_defined=yes
Matthias Klosec511b472010-05-08 11:01:39 +00003466],[])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003467AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00003468
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003469AC_MSG_CHECKING(for addrinfo)
3470AC_CACHE_VAL(ac_cv_struct_addrinfo,
Matthias Klosec511b472010-05-08 11:01:39 +00003471AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
3472 [ac_cv_struct_addrinfo=yes],
3473 [ac_cv_struct_addrinfo=no]))
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003474AC_MSG_RESULT($ac_cv_struct_addrinfo)
3475if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003476 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003477fi
3478
3479AC_MSG_CHECKING(for sockaddr_storage)
3480AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
Matthias Klosec511b472010-05-08 11:01:39 +00003481AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003482# include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003483# include <sys/socket.h>]], [[struct sockaddr_storage s]])],
3484 [ac_cv_struct_sockaddr_storage=yes],
3485 [ac_cv_struct_sockaddr_storage=no]))
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003486AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3487if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003488 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003489fi
3490
Guido van Rossum627b2d71993-12-24 10:39:16 +00003491# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003492
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003493AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003494AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003495
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003496works=no
3497AC_MSG_CHECKING(for working volatile)
Matthias Klosec511b472010-05-08 11:01:39 +00003498AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])],
3499 [works=yes],
3500 [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])]
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003501)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003502AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00003503
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003504works=no
3505AC_MSG_CHECKING(for working signed char)
Matthias Klosec511b472010-05-08 11:01:39 +00003506AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])],
3507 [works=yes],
3508 [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])]
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003509)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003510AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003511
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003512have_prototypes=no
3513AC_MSG_CHECKING(for prototypes)
Matthias Klosec511b472010-05-08 11:01:39 +00003514AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])],
3515 [AC_DEFINE(HAVE_PROTOTYPES, 1,
3516 [Define if your compiler supports function prototype])
3517 have_prototypes=yes],
3518 []
3519)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003520AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003521
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003522works=no
3523AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Matthias Klosec511b472010-05-08 11:01:39 +00003524AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003525#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00003526int foo(int x, ...) {
3527 va_list va;
3528 va_start(va, x);
3529 va_arg(va, int);
3530 va_arg(va, char *);
3531 va_arg(va, double);
3532 return 0;
3533}
Matthias Klosec511b472010-05-08 11:01:39 +00003534]], [[return foo(10, "", 3.14);]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003535 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3536 [Define if your compiler supports variable length function prototypes
3537 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3538 works=yes
Matthias Klosec511b472010-05-08 11:01:39 +00003539],[])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003540AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003541
Dave Cole331708b2004-08-09 04:51:41 +00003542# check for socketpair
3543AC_MSG_CHECKING(for socketpair)
Matthias Klosec511b472010-05-08 11:01:39 +00003544AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Dave Cole331708b2004-08-09 04:51:41 +00003545#include <sys/types.h>
3546#include <sys/socket.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003547]], [[void *x=socketpair]])],
3548 [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.])
3549 AC_MSG_RESULT(yes)],
3550 [AC_MSG_RESULT(no)]
Dave Cole331708b2004-08-09 04:51:41 +00003551)
3552
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003553# check if sockaddr has sa_len member
3554AC_MSG_CHECKING(if sockaddr has sa_len member)
Matthias Klosec511b472010-05-08 11:01:39 +00003555AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3556#include <sys/socket.h>]], [[struct sockaddr x;
3557x.sa_len = 0;]])],
3558 [AC_MSG_RESULT(yes)
3559 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])],
3560 [AC_MSG_RESULT(no)]
3561)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003562
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003563va_list_is_array=no
3564AC_MSG_CHECKING(whether va_list is an array)
Matthias Klosec511b472010-05-08 11:01:39 +00003565AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003566#ifdef HAVE_STDARG_PROTOTYPES
3567#include <stdarg.h>
3568#else
3569#include <varargs.h>
3570#endif
Matthias Klosec511b472010-05-08 11:01:39 +00003571]], [[va_list list1, list2; list1 = list2;]])],[],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003572 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3573 va_list_is_array=yes
3574])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003575AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003576
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003577# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
Martin v. Löwis11437992002-04-12 09:54:03 +00003578AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3579 [Define this if you have some version of gethostbyname_r()])
3580
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003581AC_CHECK_FUNC(gethostbyname_r, [
3582 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3583 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3584 OLD_CFLAGS=$CFLAGS
3585 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
Matthias Klosec511b472010-05-08 11:01:39 +00003586 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003587# include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003588 ]], [[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003589 char *name;
3590 struct hostent *he, *res;
3591 char buffer[2048];
3592 int buflen = 2048;
3593 int h_errnop;
3594
3595 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
Matthias Klosec511b472010-05-08 11:01:39 +00003596 ]])],[
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003597 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003598 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3599 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003600 AC_MSG_RESULT(yes)
Matthias Klosec511b472010-05-08 11:01:39 +00003601 ],[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003602 AC_MSG_RESULT(no)
3603 AC_MSG_CHECKING([gethostbyname_r with 5 args])
Matthias Klosec511b472010-05-08 11:01:39 +00003604 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003605# include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003606 ]], [[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003607 char *name;
3608 struct hostent *he;
Matthias Klosec511b472010-05-08 11:01:39 +00003609 char buffer[2048];
3610 int buflen = 2048;
3611 int h_errnop;
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003612
Matthias Klosec511b472010-05-08 11:01:39 +00003613 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3614 ]])],
3615 [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003616 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Matthias Klosec511b472010-05-08 11:01:39 +00003617 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3618 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003619 AC_MSG_RESULT(yes)
3620 ], [
3621 AC_MSG_RESULT(no)
Matthias Klosec511b472010-05-08 11:01:39 +00003622 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3623 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3624# include <netdb.h>
3625 ]], [[
3626 char *name;
3627 struct hostent *he;
3628 struct hostent_data data;
3629
3630 (void) gethostbyname_r(name, he, &data);
3631 ]])],
3632 [
3633 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3634 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3635 [Define this if you have the 3-arg version of gethostbyname_r().])
3636 AC_MSG_RESULT(yes)
3637 ], [
3638 AC_MSG_RESULT(no)
3639 ])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003640 ])
3641 ])
3642 CFLAGS=$OLD_CFLAGS
3643], [
Thomas Wouters3a584202000-08-05 23:28:51 +00003644 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003645])
3646AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3647AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3648AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003649AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003650AC_SUBST(HAVE_GETHOSTBYNAME)
3651
Guido van Rossum627b2d71993-12-24 10:39:16 +00003652# checks for system services
3653# (none yet)
3654
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003655# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00003656AC_CHECK_FUNC(__fpu_control,
3657 [],
3658 [AC_CHECK_LIB(ieee, __fpu_control)
3659])
Guido van Rossum627b2d71993-12-24 10:39:16 +00003660
Guido van Rossum93274221997-05-09 02:42:00 +00003661# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00003662AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00003663AC_ARG_WITH(fpectl,
Matthias Klose22520ea2010-05-08 10:14:46 +00003664 AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003665[
Guido van Rossum93274221997-05-09 02:42:00 +00003666if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003667then
3668 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3669 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3670 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00003671else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00003672fi],
3673[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00003674
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003675# check for --with-libm=...
3676AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003677case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00003678Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00003679BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003680*) LIBM=-lm
3681esac
Guido van Rossum93274221997-05-09 02:42:00 +00003682AC_MSG_CHECKING(for --with-libm=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003683AC_ARG_WITH(libm,
Matthias Klose22520ea2010-05-08 10:14:46 +00003684 AS_HELP_STRING([--with-libm=STRING], [math library]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003685[
Guido van Rossum93274221997-05-09 02:42:00 +00003686if test "$withval" = no
3687then LIBM=
3688 AC_MSG_RESULT(force LIBM empty)
3689elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003690then LIBM=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003691 AC_MSG_RESULT(set LIBM="$withval")
3692else AC_MSG_ERROR([proper usage is --with-libm=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003693fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003694[AC_MSG_RESULT(default LIBM="$LIBM")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003695
3696# check for --with-libc=...
3697AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00003698AC_MSG_CHECKING(for --with-libc=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003699AC_ARG_WITH(libc,
Matthias Klose22520ea2010-05-08 10:14:46 +00003700 AS_HELP_STRING([--with-libc=STRING], [C library]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003701[
Guido van Rossum93274221997-05-09 02:42:00 +00003702if test "$withval" = no
3703then LIBC=
3704 AC_MSG_RESULT(force LIBC empty)
3705elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003706then LIBC=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003707 AC_MSG_RESULT(set LIBC="$withval")
3708else AC_MSG_ERROR([proper usage is --with-libc=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003709fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003710[AC_MSG_RESULT(default LIBC="$LIBC")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003711
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003712# **************************************************
3713# * Check for various properties of floating point *
3714# **************************************************
Mark Dickinson265d7382008-04-21 22:32:24 +00003715
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003716AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3717AC_CACHE_VAL(ac_cv_little_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003718AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003719#include <string.h>
3720int main() {
3721 double x = 9006104071832581.0;
3722 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3723 return 0;
3724 else
3725 return 1;
3726}
Matthias Klosec511b472010-05-08 11:01:39 +00003727]])],
3728[ac_cv_little_endian_double=yes],
3729[ac_cv_little_endian_double=no],
3730[ac_cv_little_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003731AC_MSG_RESULT($ac_cv_little_endian_double)
3732if test "$ac_cv_little_endian_double" = yes
3733then
3734 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3735 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3736 with the least significant byte first])
3737fi
3738
3739AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3740AC_CACHE_VAL(ac_cv_big_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003741AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003742#include <string.h>
3743int main() {
3744 double x = 9006104071832581.0;
3745 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3746 return 0;
3747 else
3748 return 1;
3749}
Matthias Klosec511b472010-05-08 11:01:39 +00003750]])],
3751[ac_cv_big_endian_double=yes],
3752[ac_cv_big_endian_double=no],
3753[ac_cv_big_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003754AC_MSG_RESULT($ac_cv_big_endian_double)
3755if test "$ac_cv_big_endian_double" = yes
3756then
3757 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3758 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3759 with the most significant byte first])
3760fi
3761
3762# Some ARM platforms use a mixed-endian representation for doubles.
3763# While Python doesn't currently have full support for these platforms
3764# (see e.g., issue 1762561), we can at least make sure that float <-> string
3765# conversions work.
3766AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3767AC_CACHE_VAL(ac_cv_mixed_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003768AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003769#include <string.h>
3770int main() {
3771 double x = 9006104071832581.0;
3772 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3773 return 0;
3774 else
3775 return 1;
3776}
Matthias Klosec511b472010-05-08 11:01:39 +00003777]])],
3778[ac_cv_mixed_endian_double=yes],
3779[ac_cv_mixed_endian_double=no],
3780[ac_cv_mixed_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003781AC_MSG_RESULT($ac_cv_mixed_endian_double)
3782if test "$ac_cv_mixed_endian_double" = yes
3783then
3784 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3785 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3786 in ARM mixed-endian order (byte order 45670123)])
3787fi
3788
3789# The short float repr introduced in Python 3.1 requires the
3790# correctly-rounded string <-> double conversion functions from
3791# Python/dtoa.c, which in turn require that the FPU uses 53-bit
3792# rounding; this is a problem on x86, where the x87 FPU has a default
Mark Dickinsona548dee2009-11-15 13:12:43 +00003793# rounding precision of 64 bits. For gcc/x86, we can fix this by
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003794# using inline assembler to get and set the x87 FPU control word.
Mark Dickinsona548dee2009-11-15 13:12:43 +00003795
3796# This inline assembler syntax may also work for suncc and icc,
3797# so we try it on all platforms.
3798
3799AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
Stefan Krah99e36b92015-07-03 15:30:54 +02003800AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
Mark Dickinsona548dee2009-11-15 13:12:43 +00003801 unsigned short cw;
3802 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3803 __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
Matthias Klosec511b472010-05-08 11:01:39 +00003804]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no])
Mark Dickinsona548dee2009-11-15 13:12:43 +00003805AC_MSG_RESULT($have_gcc_asm_for_x87)
3806if test "$have_gcc_asm_for_x87" = yes
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003807then
Mark Dickinsona548dee2009-11-15 13:12:43 +00003808 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3809 [Define if we can use gcc inline assembler to get and set x87 control word])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003810fi
Mark Dickinson7a3d8642008-04-22 00:54:27 +00003811
Mark Dickinson04b27232009-01-04 12:29:36 +00003812# Detect whether system arithmetic is subject to x87-style double
3813# rounding issues. The result of this test has little meaning on non
3814# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3815# mode is round-to-nearest and double rounding issues are present, and
3816# 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3817AC_MSG_CHECKING(for x87-style double rounding)
Mark Dickinson99abd142009-10-24 13:44:16 +00003818# $BASECFLAGS may affect the result
3819ac_save_cc="$CC"
3820CC="$CC $BASECFLAGS"
Matthias Klosec511b472010-05-08 11:01:39 +00003821AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson04b27232009-01-04 12:29:36 +00003822#include <stdlib.h>
3823#include <math.h>
3824int main() {
3825 volatile double x, y, z;
3826 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3827 x = 0.99999999999999989; /* 1-2**-53 */
3828 y = 1./x;
3829 if (y != 1.)
3830 exit(0);
3831 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3832 x = 1e16;
3833 y = 2.99999;
3834 z = x + y;
3835 if (z != 1e16+4.)
3836 exit(0);
3837 /* both tests show evidence of double rounding */
3838 exit(1);
3839}
Matthias Klosec511b472010-05-08 11:01:39 +00003840]])],
3841[ac_cv_x87_double_rounding=no],
3842[ac_cv_x87_double_rounding=yes],
3843[ac_cv_x87_double_rounding=no])
Mark Dickinson99abd142009-10-24 13:44:16 +00003844CC="$ac_save_cc"
Mark Dickinson04b27232009-01-04 12:29:36 +00003845AC_MSG_RESULT($ac_cv_x87_double_rounding)
3846if test "$ac_cv_x87_double_rounding" = yes
3847then
3848 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3849 [Define if arithmetic is subject to x87-style double rounding issue])
3850fi
3851
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003852# ************************************
3853# * Check for mathematical functions *
3854# ************************************
3855
3856LIBS_SAVE=$LIBS
3857LIBS="$LIBS $LIBM"
3858
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003859# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3860# -0. on some architectures.
3861AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3862AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
Matthias Klosec511b472010-05-08 11:01:39 +00003863AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003864#include <math.h>
3865#include <stdlib.h>
3866int main() {
3867 /* return 0 if either negative zeros don't exist
3868 on this platform or if negative zeros exist
3869 and tanh(-0.) == -0. */
3870 if (atan2(0., -1.) == atan2(-0., -1.) ||
3871 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3872 else exit(1);
3873}
Matthias Klosec511b472010-05-08 11:01:39 +00003874]])],
3875[ac_cv_tanh_preserves_zero_sign=yes],
3876[ac_cv_tanh_preserves_zero_sign=no],
3877[ac_cv_tanh_preserves_zero_sign=no])])
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003878AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3879if test "$ac_cv_tanh_preserves_zero_sign" = yes
3880then
3881 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3882 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3883fi
3884
3885AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
3886AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
3887AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3888
3889LIBS=$LIBS_SAVE
3890
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003891# For multiprocessing module, check that sem_open
3892# actually works. For FreeBSD versions <= 7.2,
3893# the kernel module that provides POSIX semaphores
3894# isn't loaded by default, so an attempt to call
3895# sem_open results in a 'Signal 12' error.
3896AC_MSG_CHECKING(whether POSIX semaphores are enabled)
3897AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
Matthias Klosec511b472010-05-08 11:01:39 +00003898AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003899#include <unistd.h>
3900#include <fcntl.h>
3901#include <stdio.h>
3902#include <semaphore.h>
3903#include <sys/stat.h>
3904
3905int main(void) {
3906 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3907 if (a == SEM_FAILED) {
3908 perror("sem_open");
3909 return 1;
3910 }
3911 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003912 sem_unlink("/autoconf");
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003913 return 0;
3914}
Matthias Klosec511b472010-05-08 11:01:39 +00003915]])],
3916[ac_cv_posix_semaphores_enabled=yes],
3917[ac_cv_posix_semaphores_enabled=no],
3918[ac_cv_posix_semaphores_enabled=yes])
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003919)
3920AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
3921if test $ac_cv_posix_semaphores_enabled = no
3922then
Mark Dickinson5afa6d42009-11-28 10:44:20 +00003923 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
3924 [Define if POSIX semaphores aren't enabled on your system])
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003925fi
3926
Jesse Noller355b1262009-04-02 00:03:28 +00003927# Multiprocessing check for broken sem_getvalue
3928AC_MSG_CHECKING(for broken sem_getvalue)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003929AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
Matthias Klosec511b472010-05-08 11:01:39 +00003930AC_RUN_IFELSE([AC_LANG_SOURCE([[
Jesse Noller355b1262009-04-02 00:03:28 +00003931#include <unistd.h>
3932#include <fcntl.h>
3933#include <stdio.h>
3934#include <semaphore.h>
3935#include <sys/stat.h>
3936
3937int main(void){
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003938 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
Jesse Noller355b1262009-04-02 00:03:28 +00003939 int count;
3940 int res;
3941 if(a==SEM_FAILED){
3942 perror("sem_open");
3943 return 1;
3944
3945 }
3946 res = sem_getvalue(a, &count);
3947 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003948 sem_unlink("/autocftw");
Jesse Noller355b1262009-04-02 00:03:28 +00003949 return res==-1 ? 1 : 0;
3950}
Matthias Klosec511b472010-05-08 11:01:39 +00003951]])],
3952[ac_cv_broken_sem_getvalue=no],
3953[ac_cv_broken_sem_getvalue=yes],
3954[ac_cv_broken_sem_getvalue=yes])
Jesse Noller355b1262009-04-02 00:03:28 +00003955)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003956AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
3957if test $ac_cv_broken_sem_getvalue = yes
3958then
3959 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
3960 [define to 1 if your sem_getvalue is broken.])
3961fi
Mark Dickinson04b27232009-01-04 12:29:36 +00003962
Mark Dickinsonefc82f72009-03-20 15:51:55 +00003963# determine what size digit to use for Python's longs
3964AC_MSG_CHECKING([digit size for Python's longs])
3965AC_ARG_ENABLE(big-digits,
Matthias Klose22520ea2010-05-08 10:14:46 +00003966AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
Mark Dickinsonefc82f72009-03-20 15:51:55 +00003967[case $enable_big_digits in
3968yes)
3969 enable_big_digits=30 ;;
3970no)
3971 enable_big_digits=15 ;;
3972[15|30])
3973 ;;
3974*)
3975 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3976esac
3977AC_MSG_RESULT($enable_big_digits)
3978AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3979],
3980[AC_MSG_RESULT(no value specified)])
3981
Guido van Rossumef2255b2000-03-10 22:30:29 +00003982# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003983AC_CHECK_HEADER(wchar.h, [
3984 AC_DEFINE(HAVE_WCHAR_H, 1,
3985 [Define if the compiler provides a wchar.h header file.])
3986 wchar_h="yes"
3987],
Guido van Rossumef2255b2000-03-10 22:30:29 +00003988wchar_h="no"
3989)
3990
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003991# determine wchar_t size
3992if test "$wchar_h" = yes
3993then
Guido van Rossum67b26592001-10-20 14:21:45 +00003994 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003995fi
3996
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003997AC_MSG_CHECKING(for UCS-4 tcl)
3998have_ucs4_tcl=no
Matthias Klosec511b472010-05-08 11:01:39 +00003999AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00004000#include <tcl.h>
4001#if TCL_UTF_MAX != 6
4002# error "NOT UCS4_TCL"
Matthias Klosec511b472010-05-08 11:01:39 +00004003#endif]], [[]])],[
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00004004 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
4005 have_ucs4_tcl=yes
Matthias Klosec511b472010-05-08 11:01:39 +00004006],[])
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00004007AC_MSG_RESULT($have_ucs4_tcl)
4008
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00004009# check whether wchar_t is signed or not
4010if test "$wchar_h" = yes
4011then
4012 # check whether wchar_t is signed or not
4013 AC_MSG_CHECKING(whether wchar_t is signed)
4014 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
Matthias Klosec511b472010-05-08 11:01:39 +00004015 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00004016 #include <wchar.h>
4017 int main()
4018 {
Martin v. Löwis44fe0e42006-04-11 07:15:30 +00004019 /* Success: exit code 0 */
4020 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00004021 }
Matthias Klosec511b472010-05-08 11:01:39 +00004022 ]])],
4023 [ac_cv_wchar_t_signed=yes],
4024 [ac_cv_wchar_t_signed=no],
4025 [ac_cv_wchar_t_signed=yes])])
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00004026 AC_MSG_RESULT($ac_cv_wchar_t_signed)
4027fi
4028
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004029AC_MSG_CHECKING(what type to use for unicode)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00004030dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004031AC_ARG_ENABLE(unicode,
Benjamin Peterson66556b02010-05-25 02:23:32 +00004032 AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is ucs2)]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00004033 [],
4034 [enable_unicode=yes])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004035
4036if test $enable_unicode = yes
4037then
Martin v. Löwisfd917792001-06-27 20:22:04 +00004038 # Without any arguments, Py_UNICODE defaults to two-byte mode
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00004039 case "$have_ucs4_tcl" in
4040 yes) enable_unicode="ucs4"
4041 ;;
4042 *) enable_unicode="ucs2"
4043 ;;
4044 esac
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004045fi
4046
Martin v. Löwis0036cba2002-04-12 09:58:45 +00004047AH_TEMPLATE(Py_UNICODE_SIZE,
4048 [Define as the size of the unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004049case "$enable_unicode" in
4050ucs2) unicode_size="2"
4051 AC_DEFINE(Py_UNICODE_SIZE,2)
4052 ;;
4053ucs4) unicode_size="4"
4054 AC_DEFINE(Py_UNICODE_SIZE,4)
4055 ;;
Martin v. Löwised11a5d2012-05-20 10:42:17 +02004056no) ;; # To allow --disable-unicode
Ezio Melotti5820efb2010-02-27 00:05:42 +00004057*) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004058esac
4059
Martin v. Löwis11437992002-04-12 09:54:03 +00004060AH_TEMPLATE(PY_UNICODE_TYPE,
4061 [Define as the integral type used for Unicode representation.])
Martin v. Löwis0036cba2002-04-12 09:58:45 +00004062
Martin v. Löwis339d0f72001-08-17 18:39:25 +00004063AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004064if test "$enable_unicode" = "no"
4065then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00004066 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004067 AC_MSG_RESULT(not used)
4068else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00004069 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004070 AC_DEFINE(Py_USING_UNICODE, 1,
4071 [Define if you want to have a Unicode type.])
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00004072
4073 # wchar_t is only usable if it maps to an unsigned type
4074 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
Matthias Klose7dbeed72004-12-24 08:22:17 +00004075 -a "$ac_cv_wchar_t_signed" = "no"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004076 then
4077 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004078 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
4079 [Define if you have a useable wchar_t type defined in wchar.h; useable
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00004080 means wchar_t must be an unsigned type with at least 16 bits. (see
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004081 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004082 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
4083 elif test "$ac_cv_sizeof_short" = "$unicode_size"
4084 then
4085 PY_UNICODE_TYPE="unsigned short"
4086 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
4087 elif test "$ac_cv_sizeof_long" = "$unicode_size"
4088 then
4089 PY_UNICODE_TYPE="unsigned long"
4090 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
4091 else
4092 PY_UNICODE_TYPE="no type found"
4093 fi
4094 AC_MSG_RESULT($PY_UNICODE_TYPE)
4095fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00004096
4097# check for endianness
4098AC_C_BIGENDIAN
4099
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00004100# Check whether right shifting a negative integer extends the sign bit
4101# or fills with zeros (like the Cray J90, according to Tim Peters).
4102AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00004103AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Matthias Klosec511b472010-05-08 11:01:39 +00004104AC_RUN_IFELSE([AC_LANG_SOURCE([[
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00004105int main()
4106{
Vladimir Marangozova6180282000-07-12 05:05:06 +00004107 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00004108}
Matthias Klosec511b472010-05-08 11:01:39 +00004109]])],
4110[ac_cv_rshift_extends_sign=yes],
4111[ac_cv_rshift_extends_sign=no],
4112[ac_cv_rshift_extends_sign=yes])])
Vladimir Marangozova6180282000-07-12 05:05:06 +00004113AC_MSG_RESULT($ac_cv_rshift_extends_sign)
4114if test "$ac_cv_rshift_extends_sign" = no
4115then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004116 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
4117 [Define if i>>j for signed int i does not extend the sign bit
4118 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00004119fi
4120
Guido van Rossumcadfaec2001-01-05 14:45:49 +00004121# check for getc_unlocked and related locking functions
4122AC_MSG_CHECKING(for getc_unlocked() and friends)
4123AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
Matthias Klosec511b472010-05-08 11:01:39 +00004124AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
Guido van Rossumcadfaec2001-01-05 14:45:49 +00004125 FILE *f = fopen("/dev/null", "r");
4126 flockfile(f);
4127 getc_unlocked(f);
4128 funlockfile(f);
Matthias Klosec511b472010-05-08 11:01:39 +00004129]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00004130AC_MSG_RESULT($ac_cv_have_getc_unlocked)
4131if test "$ac_cv_have_getc_unlocked" = yes
4132then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004133 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
4134 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00004135fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00004136
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00004137# check where readline lives
Martin v. Löwis82bca632006-02-10 20:49:30 +00004138# save the value of LIBS so we don't actually link Python with readline
4139LIBS_no_readline=$LIBS
Gregory P. Smith980b99b2008-09-07 05:15:18 +00004140
4141# On some systems we need to link readline to a termcap compatible
4142# library. NOTE: Keep the precedence of listed libraries synchronised
4143# with setup.py.
4144py_cv_lib_readline=no
4145AC_MSG_CHECKING([how to link readline libs])
4146for py_libtermcap in "" ncursesw ncurses curses termcap; do
4147 if test -z "$py_libtermcap"; then
4148 READLINE_LIBS="-lreadline"
4149 else
4150 READLINE_LIBS="-lreadline -l$py_libtermcap"
4151 fi
4152 LIBS="$READLINE_LIBS $LIBS_no_readline"
4153 AC_LINK_IFELSE(
4154 [AC_LANG_CALL([],[readline])],
4155 [py_cv_lib_readline=yes])
4156 if test $py_cv_lib_readline = yes; then
4157 break
4158 fi
4159done
4160# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
4161#AC_SUBST([READLINE_LIBS])
Gregory P. Smith29ec7502008-09-07 19:18:16 +00004162if test $py_cv_lib_readline = no; then
Gregory P. Smith980b99b2008-09-07 05:15:18 +00004163 AC_MSG_RESULT([none])
4164else
4165 AC_MSG_RESULT([$READLINE_LIBS])
4166 AC_DEFINE(HAVE_LIBREADLINE, 1,
4167 [Define if you have the readline library (-lreadline).])
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00004168fi
4169
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00004170# check for readline 2.1
4171AC_CHECK_LIB(readline, rl_callback_handler_install,
4172 AC_DEFINE(HAVE_RL_CALLBACK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00004173 [Define if you have readline 2.1]), ,$READLINE_LIBS)
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00004174
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00004175# check for readline 2.2
Matthias Klosec511b472010-05-08 11:01:39 +00004176AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
4177 [have_readline=yes],
4178 [have_readline=no]
4179)
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00004180if test $have_readline = yes
4181then
4182 AC_EGREP_HEADER([extern int rl_completion_append_character;],
4183 [readline/readline.h],
4184 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
4185 [Define if you have readline 2.2]), )
Antoine Pitroud9ff74e2009-10-26 19:16:46 +00004186 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
4187 [readline/readline.h],
4188 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
4189 [Define if you have rl_completion_suppress_append]), )
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00004190fi
4191
Martin v. Löwis0daad592001-09-30 21:09:59 +00004192# check for readline 4.0
4193AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004194 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00004195 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis0daad592001-09-30 21:09:59 +00004196
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00004197# also in 4.0
4198AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
4199 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00004200 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00004201
Guido van Rossum353ae582001-07-10 16:45:32 +00004202# check for readline 4.2
4203AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004204 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00004205 [Define if you have readline 4.2]), ,$READLINE_LIBS)
Guido van Rossum353ae582001-07-10 16:45:32 +00004206
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00004207# also in readline 4.2
Matthias Klosec511b472010-05-08 11:01:39 +00004208AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
4209 [have_readline=yes],
4210 [have_readline=no]
4211)
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00004212if test $have_readline = yes
4213then
4214 AC_EGREP_HEADER([extern int rl_catch_signals;],
4215 [readline/readline.h],
4216 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
4217 [Define if you can turn off readline's signal handling.]), )
4218fi
4219
Martin v. Löwis82bca632006-02-10 20:49:30 +00004220# End of readline checks: restore LIBS
4221LIBS=$LIBS_no_readline
4222
Thomas Wouterse38b2f12001-07-11 22:35:31 +00004223AC_MSG_CHECKING(for broken nice())
4224AC_CACHE_VAL(ac_cv_broken_nice, [
Matthias Klosec511b472010-05-08 11:01:39 +00004225AC_RUN_IFELSE([AC_LANG_SOURCE([[
Thomas Wouterse38b2f12001-07-11 22:35:31 +00004226int main()
4227{
4228 int val1 = nice(1);
4229 if (val1 != -1 && val1 == nice(2))
4230 exit(0);
4231 exit(1);
4232}
Matthias Klosec511b472010-05-08 11:01:39 +00004233]])],
4234[ac_cv_broken_nice=yes],
4235[ac_cv_broken_nice=no],
4236[ac_cv_broken_nice=no])])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00004237AC_MSG_RESULT($ac_cv_broken_nice)
4238if test "$ac_cv_broken_nice" = yes
4239then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004240 AC_DEFINE(HAVE_BROKEN_NICE, 1,
4241 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00004242fi
4243
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004244AC_MSG_CHECKING(for broken poll())
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004245AC_CACHE_VAL(ac_cv_broken_poll,
Matthias Klosec511b472010-05-08 11:01:39 +00004246AC_RUN_IFELSE([AC_LANG_SOURCE([[
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004247#include <poll.h>
4248
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004249int main()
4250{
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004251 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004252 int poll_test;
4253
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004254 close (42);
4255
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004256 poll_test = poll(&poll_struct, 1, 0);
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004257 if (poll_test < 0)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004258 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004259 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004260 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004261 else
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004262 return 1;
4263}
Matthias Klosec511b472010-05-08 11:01:39 +00004264]])],
4265[ac_cv_broken_poll=yes],
4266[ac_cv_broken_poll=no],
4267[ac_cv_broken_poll=no]))
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004268AC_MSG_RESULT($ac_cv_broken_poll)
4269if test "$ac_cv_broken_poll" = yes
4270then
4271 AC_DEFINE(HAVE_BROKEN_POLL, 1,
4272 [Define if poll() sets errno on invalid file descriptors.])
4273fi
4274
Brett Cannon43802422005-02-10 20:48:03 +00004275# Before we can test tzset, we need to check if struct tm has a tm_zone
4276# (which is not required by ISO C or UNIX spec) and/or if we support
4277# tzname[]
4278AC_STRUCT_TIMEZONE
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004279
Brett Cannon43802422005-02-10 20:48:03 +00004280# check tzset(3) exists and works like we expect it to
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004281AC_MSG_CHECKING(for working tzset())
4282AC_CACHE_VAL(ac_cv_working_tzset, [
Matthias Klosec511b472010-05-08 11:01:39 +00004283AC_RUN_IFELSE([AC_LANG_SOURCE([[
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004284#include <stdlib.h>
4285#include <time.h>
Brett Cannon18367812003-09-19 00:59:16 +00004286#include <string.h>
Brett Cannon43802422005-02-10 20:48:03 +00004287
4288#if HAVE_TZNAME
4289extern char *tzname[];
4290#endif
4291
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004292int main()
4293{
Brett Cannon18367812003-09-19 00:59:16 +00004294 /* Note that we need to ensure that not only does tzset(3)
4295 do 'something' with localtime, but it works as documented
4296 in the library reference and as expected by the test suite.
Brett Cannon43802422005-02-10 20:48:03 +00004297 This includes making sure that tzname is set properly if
4298 tm->tm_zone does not exist since it is the alternative way
4299 of getting timezone info.
Brett Cannon18367812003-09-19 00:59:16 +00004300
4301 Red Hat 6.2 doesn't understand the southern hemisphere
Brett Cannon43802422005-02-10 20:48:03 +00004302 after New Year's Day.
Brett Cannon18367812003-09-19 00:59:16 +00004303 */
4304
Brett Cannon43802422005-02-10 20:48:03 +00004305 time_t groundhogday = 1044144000; /* GMT-based */
Brett Cannon18367812003-09-19 00:59:16 +00004306 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
4307
Neal Norwitz7f2588c2003-04-11 15:35:53 +00004308 putenv("TZ=UTC+0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004309 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00004310 if (localtime(&groundhogday)->tm_hour != 0)
4311 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004312#if HAVE_TZNAME
4313 /* For UTC, tzname[1] is sometimes "", sometimes " " */
4314 if (strcmp(tzname[0], "UTC") ||
4315 (tzname[1][0] != 0 && tzname[1][0] != ' '))
4316 exit(1);
4317#endif
Brett Cannon18367812003-09-19 00:59:16 +00004318
Neal Norwitz7f2588c2003-04-11 15:35:53 +00004319 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004320 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00004321 if (localtime(&groundhogday)->tm_hour != 19)
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004322 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004323#if HAVE_TZNAME
4324 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
4325 exit(1);
4326#endif
Brett Cannon18367812003-09-19 00:59:16 +00004327
4328 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
4329 tzset();
4330 if (localtime(&groundhogday)->tm_hour != 11)
4331 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004332#if HAVE_TZNAME
4333 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
4334 exit(1);
4335#endif
4336
4337#if HAVE_STRUCT_TM_TM_ZONE
Brett Cannon18367812003-09-19 00:59:16 +00004338 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
4339 exit(1);
4340 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
4341 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004342#endif
Brett Cannon18367812003-09-19 00:59:16 +00004343
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004344 exit(0);
4345}
Matthias Klosec511b472010-05-08 11:01:39 +00004346]])],
4347[ac_cv_working_tzset=yes],
4348[ac_cv_working_tzset=no],
4349[ac_cv_working_tzset=no])])
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004350AC_MSG_RESULT($ac_cv_working_tzset)
4351if test "$ac_cv_working_tzset" = yes
4352then
4353 AC_DEFINE(HAVE_WORKING_TZSET, 1,
4354 [Define if tzset() actually switches the local timezone in a meaningful way.])
4355fi
4356
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004357# Look for subsecond timestamps in struct stat
4358AC_MSG_CHECKING(for tv_nsec in struct stat)
4359AC_CACHE_VAL(ac_cv_stat_tv_nsec,
Matthias Klosec511b472010-05-08 11:01:39 +00004360AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004361struct stat st;
4362st.st_mtim.tv_nsec = 1;
Matthias Klosec511b472010-05-08 11:01:39 +00004363]])],
4364[ac_cv_stat_tv_nsec=yes],
4365[ac_cv_stat_tv_nsec=no]))
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004366AC_MSG_RESULT($ac_cv_stat_tv_nsec)
4367if test "$ac_cv_stat_tv_nsec" = yes
4368then
4369 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
4370 [Define if you have struct stat.st_mtim.tv_nsec])
4371fi
4372
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004373# Look for BSD style subsecond timestamps in struct stat
4374AC_MSG_CHECKING(for tv_nsec2 in struct stat)
4375AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
Matthias Klosec511b472010-05-08 11:01:39 +00004376AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004377struct stat st;
4378st.st_mtimespec.tv_nsec = 1;
Matthias Klosec511b472010-05-08 11:01:39 +00004379]])],
4380[ac_cv_stat_tv_nsec2=yes],
4381[ac_cv_stat_tv_nsec2=no]))
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004382AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
4383if test "$ac_cv_stat_tv_nsec2" = yes
4384then
4385 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
4386 [Define if you have struct stat.st_mtimensec])
4387fi
4388
doko@ubuntu.comf27ec3e2014-04-17 20:11:19 +02004389# first curses configure check
4390ac_save_cppflags="$CPPFLAGS"
4391CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
4392
4393AC_CHECK_HEADERS(curses.h ncurses.h)
4394
4395# On Solaris, term.h requires curses.h
4396AC_CHECK_HEADERS(term.h,,,[
4397#ifdef HAVE_CURSES_H
4398#include <curses.h>
4399#endif
4400])
4401
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004402# On HP/UX 11.0, mvwdelch is a block with a return statement
4403AC_MSG_CHECKING(whether mvwdelch is an expression)
4404AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
Matthias Klosec511b472010-05-08 11:01:39 +00004405AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004406 int rtn;
4407 rtn = mvwdelch(0,0,0);
Matthias Klosec511b472010-05-08 11:01:39 +00004408]])],
4409[ac_cv_mvwdelch_is_expression=yes],
4410[ac_cv_mvwdelch_is_expression=no]))
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004411AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
4412
4413if test "$ac_cv_mvwdelch_is_expression" = yes
4414then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004415 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
4416 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004417fi
4418
4419AC_MSG_CHECKING(whether WINDOW has _flags)
4420AC_CACHE_VAL(ac_cv_window_has_flags,
Matthias Klosec511b472010-05-08 11:01:39 +00004421AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004422 WINDOW *w;
4423 w->_flags = 0;
Matthias Klosec511b472010-05-08 11:01:39 +00004424]])],
4425[ac_cv_window_has_flags=yes],
4426[ac_cv_window_has_flags=no]))
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004427AC_MSG_RESULT($ac_cv_window_has_flags)
4428
4429
4430if test "$ac_cv_window_has_flags" = yes
4431then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004432 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
4433 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004434fi
4435
Walter Dörwald4994d952006-06-19 08:07:50 +00004436AC_MSG_CHECKING(for is_term_resized)
Matthias Klosec511b472010-05-08 11:01:39 +00004437AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])],
4438 [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
4439 AC_MSG_RESULT(yes)],
4440 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004441)
4442
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004443AC_MSG_CHECKING(for resize_term)
Matthias Klosec511b472010-05-08 11:01:39 +00004444AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])],
4445 [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
4446 AC_MSG_RESULT(yes)],
4447 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004448)
4449
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004450AC_MSG_CHECKING(for resizeterm)
Matthias Klosec511b472010-05-08 11:01:39 +00004451AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])],
4452 [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
4453 AC_MSG_RESULT(yes)],
4454 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004455)
doko@ubuntu.comf27ec3e2014-04-17 20:11:19 +02004456# last curses configure check
4457CPPFLAGS=$ac_save_cppflags
Walter Dörwald4994d952006-06-19 08:07:50 +00004458
doko@python.orgd65e2ba2013-01-31 23:52:03 +01004459AC_MSG_NOTICE([checking for device files])
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004460
doko@python.orgd65e2ba2013-01-31 23:52:03 +01004461dnl NOTE: Inform user how to proceed with files when cross compiling.
4462if test "x$cross_compiling" = xyes; then
4463 if test "${ac_cv_file__dev_ptmx+set}" != set; then
4464 AC_MSG_CHECKING([for /dev/ptmx])
4465 AC_MSG_RESULT([not set])
4466 AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
4467 fi
4468 if test "${ac_cv_file__dev_ptc+set}" != set; then
4469 AC_MSG_CHECKING([for /dev/ptc])
4470 AC_MSG_RESULT([not set])
4471 AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling])
4472 fi
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004473fi
4474
doko@python.orgd65e2ba2013-01-31 23:52:03 +01004475AC_CHECK_FILE(/dev/ptmx, [], [])
4476if test "x$ac_cv_file__dev_ptmx" = xyes; then
4477 AC_DEFINE(HAVE_DEV_PTMX, 1,
4478 [Define to 1 if you have the /dev/ptmx device file.])
4479fi
4480AC_CHECK_FILE(/dev/ptc, [], [])
4481if test "x$ac_cv_file__dev_ptc" = xyes; then
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004482 AC_DEFINE(HAVE_DEV_PTC, 1,
doko@python.orgd65e2ba2013-01-31 23:52:03 +01004483 [Define to 1 if you have the /dev/ptc device file.])
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004484fi
Neal Norwitz865400f2003-03-21 01:42:58 +00004485
Mark Dickinson82864d12009-11-15 16:18:58 +00004486if test "$have_long_long" = yes
4487then
4488 AC_MSG_CHECKING(for %lld and %llu printf() format support)
4489 AC_CACHE_VAL(ac_cv_have_long_long_format,
Matthias Klosec511b472010-05-08 11:01:39 +00004490 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
Mark Dickinson82864d12009-11-15 16:18:58 +00004491 #include <stdio.h>
4492 #include <stddef.h>
4493 #include <string.h>
4494
4495 #ifdef HAVE_SYS_TYPES_H
4496 #include <sys/types.h>
4497 #endif
4498
4499 int main()
4500 {
4501 char buffer[256];
4502
4503 if (sprintf(buffer, "%lld", (long long)123) < 0)
4504 return 1;
4505 if (strcmp(buffer, "123"))
4506 return 1;
4507
4508 if (sprintf(buffer, "%lld", (long long)-123) < 0)
4509 return 1;
4510 if (strcmp(buffer, "-123"))
4511 return 1;
4512
4513 if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
4514 return 1;
4515 if (strcmp(buffer, "123"))
4516 return 1;
4517
4518 return 0;
4519 }
Matthias Klosec511b472010-05-08 11:01:39 +00004520 ]]])],
4521 [ac_cv_have_long_long_format=yes],
4522 [ac_cv_have_long_long_format=no],
doko@python.orgd65e2ba2013-01-31 23:52:03 +01004523 [ac_cv_have_long_long_format="cross -- assuming no"
4524 if test x$GCC = xyes; then
4525 save_CFLAGS=$CFLAGS
4526 CFLAGS="$CFLAGS -Werror -Wformat"
4527 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4528 #include <stdio.h>
4529 #include <stddef.h>
4530 ]], [[
4531 char *buffer;
4532 sprintf(buffer, "%lld", (long long)123);
4533 sprintf(buffer, "%lld", (long long)-123);
4534 sprintf(buffer, "%llu", (unsigned long long)123);
4535 ]])],
4536 ac_cv_have_long_long_format=yes
4537 )
4538 CFLAGS=$save_CFLAGS
4539 fi])
Mark Dickinson82864d12009-11-15 16:18:58 +00004540 )
4541 AC_MSG_RESULT($ac_cv_have_long_long_format)
4542fi
4543
Mark Dickinson5ce84742009-12-31 20:48:04 +00004544if test "$ac_cv_have_long_long_format" = yes
Mark Dickinson82864d12009-11-15 16:18:58 +00004545then
4546 AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
4547 [Define to printf format modifier for long long type])
4548fi
4549
Ronald Oussoren315cd0c2009-11-19 16:25:21 +00004550if test $ac_sys_system = Darwin
4551then
4552 LIBS="$LIBS -framework CoreFoundation"
4553fi
4554
Mark Dickinson82864d12009-11-15 16:18:58 +00004555
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004556AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
Matthias Klosec511b472010-05-08 11:01:39 +00004557AC_RUN_IFELSE([AC_LANG_SOURCE([[
Alexandre Vassalottie7cf1182009-07-17 06:33:51 +00004558#include <stdio.h>
Brett Cannon09d12362006-05-11 05:11:33 +00004559#include <stddef.h>
4560#include <string.h>
4561
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004562#ifdef HAVE_SYS_TYPES_H
4563#include <sys/types.h>
4564#endif
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004565
4566#ifdef HAVE_SSIZE_T
4567typedef ssize_t Py_ssize_t;
4568#elif SIZEOF_VOID_P == SIZEOF_LONG
4569typedef long Py_ssize_t;
4570#else
4571typedef int Py_ssize_t;
4572#endif
Brett Cannon09d12362006-05-11 05:11:33 +00004573
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004574int main()
4575{
4576 char buffer[256];
4577
Brett Cannon09d12362006-05-11 05:11:33 +00004578 if(sprintf(buffer, "%zd", (size_t)123) < 0)
4579 return 1;
4580
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004581 if (strcmp(buffer, "123"))
Brett Cannon09d12362006-05-11 05:11:33 +00004582 return 1;
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004583
4584 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
4585 return 1;
4586
4587 if (strcmp(buffer, "-123"))
4588 return 1;
4589
Brett Cannon09d12362006-05-11 05:11:33 +00004590 return 0;
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004591}
Matthias Klosec511b472010-05-08 11:01:39 +00004592]])],
4593[ac_cv_have_size_t_format=yes],
4594[ac_cv_have_size_t_format=no],
4595[ac_cv_have_size_t_format="cross -- assuming yes"
4596])])
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004597if test "$ac_cv_have_size_t_format" != no ; then
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004598 AC_DEFINE(PY_FORMAT_SIZE_T, "z",
4599 [Define to printf format modifier for Py_ssize_t])
4600fi
Brett Cannon09d12362006-05-11 05:11:33 +00004601
Martin v. Löwis01c04012002-11-11 14:58:44 +00004602AC_CHECK_TYPE(socklen_t,,
4603 AC_DEFINE(socklen_t,int,
Matthias Klose5183ebd2010-04-24 16:38:36 +00004604 [Define to `int' if <sys/socket.h> does not define.]),[
Martin v. Löwis01c04012002-11-11 14:58:44 +00004605#ifdef HAVE_SYS_TYPES_H
4606#include <sys/types.h>
4607#endif
Guido van Rossum95713eb2000-05-18 20:53:31 +00004608#ifdef HAVE_SYS_SOCKET_H
4609#include <sys/socket.h>
4610#endif
Martin v. Löwis01c04012002-11-11 14:58:44 +00004611])
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004612
R. David Murray1d9d16e2010-10-16 00:43:13 +00004613case $ac_sys_system in
4614AIX*)
4615 AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;;
4616esac
4617
4618
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00004619AC_SUBST(THREADHEADERS)
4620
4621for h in `(cd $srcdir;echo Python/thread_*.h)`
4622do
4623 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4624done
4625
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004626AC_SUBST(SRCDIRS)
Neal Norwitzd24499d2005-12-18 21:36:39 +00004627SRCDIRS="Parser Grammar Objects Python Modules Mac"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00004628AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004629for dir in $SRCDIRS; do
4630 if test ! -d $dir; then
4631 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00004632 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004633done
Benjamin Peterson2c992a02015-05-28 12:45:31 -05004634
4635# BEGIN_COMPUTED_GOTO
4636# Check for --with-computed-gotos
4637AC_MSG_CHECKING(for --with-computed-gotos)
4638AC_ARG_WITH(computed-gotos,
4639 AS_HELP_STRING([--with(out)-computed-gotos],
4640 [Use computed gotos in evaluation loop (enabled by default on supported compilers)]),
4641[
4642if test "$withval" = yes
4643then
4644 AC_DEFINE(USE_COMPUTED_GOTOS, 1,
4645 [Define if you want to use computed gotos in ceval.c.])
4646 AC_MSG_RESULT(yes)
4647fi
4648if test "$withval" = no
4649then
4650 AC_DEFINE(USE_COMPUTED_GOTOS, 0,
4651 [Define if you want to use computed gotos in ceval.c.])
4652 AC_MSG_RESULT(no)
4653fi
4654],
4655[AC_MSG_RESULT(no value specified)])
4656
4657AC_MSG_CHECKING(whether $CC supports computed gotos)
4658AC_CACHE_VAL(ac_cv_computed_gotos,
4659AC_RUN_IFELSE([AC_LANG_SOURCE([[[
4660int main(int argc, char **argv)
4661{
4662 static void *targets[1] = { &&LABEL1 };
4663 goto LABEL2;
4664LABEL1:
4665 return 0;
4666LABEL2:
4667 goto *targets[0];
4668 return 1;
4669}
4670]]])],
4671[ac_cv_computed_gotos=yes],
4672[ac_cv_computed_gotos=no],
4673[if test "${with_computed_gotos+set}" = set; then
4674 ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos"
4675 else
4676 ac_cv_computed_gotos=no
4677 fi]))
4678AC_MSG_RESULT($ac_cv_computed_gotos)
4679case "$ac_cv_computed_gotos" in yes*)
4680 AC_DEFINE(HAVE_COMPUTED_GOTOS, 1,
4681 [Define if the C compiler supports computed gotos.])
4682esac
4683# END_COMPUTED_GOTO
4684
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004685AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00004686
Ned Deily3f1d0b32014-11-20 02:11:03 -08004687# ensurepip option
4688AC_MSG_CHECKING(for ensurepip)
4689AC_ARG_WITH(ensurepip,
4690 [AS_HELP_STRING([--with(out)-ensurepip=@<:@=OPTION@:>@],
4691 ["install" or "upgrade" using bundled pip, default is "no"])],
4692 [],
4693 [with_ensurepip=no])
4694AS_CASE($with_ensurepip,
4695 [yes|upgrade],[ENSUREPIP=upgrade],
4696 [install],[ENSUREPIP=install],
4697 [no],[ENSUREPIP=no],
4698 [AC_MSG_ERROR([--with-ensurepip=upgrade|install|no])])
4699AC_MSG_RESULT($ENSUREPIP)
4700AC_SUBST(ENSUREPIP)
4701
Guido van Rossum627b2d71993-12-24 10:39:16 +00004702# generate output files
Antoine Pitrouf2caeed2009-05-24 20:23:57 +00004703AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
Antoine Pitrouaabdceb2010-09-10 20:03:17 +00004704AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
Martin v. Löwis88afe662002-10-26 13:47:44 +00004705AC_OUTPUT
Neil Schemenauer61c51152001-01-26 16:18:16 +00004706
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004707echo "creating Modules/Setup"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004708if test ! -f Modules/Setup
4709then
4710 cp $srcdir/Modules/Setup.dist Modules/Setup
4711fi
4712
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004713echo "creating Modules/Setup.local"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004714if test ! -f Modules/Setup.local
4715then
4716 echo "# Edit this file for local setup changes" >Modules/Setup.local
4717fi
4718
4719echo "creating Makefile"
4720$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4721 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00004722 Modules/Setup.local Modules/Setup
Skip Montanaro7221d932007-08-22 19:02:16 +00004723
4724case $ac_sys_system in
4725BeOS)
4726 AC_MSG_WARN([
4727
4728 Support for BeOS is deprecated as of Python 2.6.
4729 See PEP 11 for the gory details.
4730 ])
4731 ;;
4732*) ;;
4733esac
4734
Neil Schemenauer66252162001-02-19 04:47:42 +00004735mv config.c Modules