blob: decf0ec7424bc1fac0040e1d7e837a32823198a2 [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
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000576# If the user switches compilers, we can't believe the cache
577if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
578then
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000579 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
580(it is also a good idea to do 'make clean' before compiling)])
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000581fi
582
Trent Nelson15daa352012-12-13 06:46:39 +0000583if test "$MACHDEP" = "irix6" && test "$CC" != "gcc"; then
584 # Normally, MIPSpro CC treats #error directives as warnings, which means
585 # a successful exit code is returned (0). This is a problem because IRIX
586 # has a bunch of system headers with this guard at the top:
587 #
588 # #ifndef __c99
589 # #error This header file is to be used only for c99 mode compilations
590 # #else
591 #
592 # When autoconf tests for such a header, like stdint.h, this happens:
593 #
594 # configure:4619: cc -c conftest.c >&5
595 # cc-1035 cc: WARNING File = /usr/include/stdint.h, Line = 5
596 # #error directive: This header file is to be used only for c99 mode
597 # compilations
598 #
599 # #error This header file is to be used only for c99 mode compilations
600 # ^
601 #
602 # configure:4619: $? = 0
603 # configure:4619: result: yes
604 #
605 # Therefore, we use `-diag_error 1035` to have the compiler treat the
606 # warning as an error, which causes cc to return a non-zero result,
607 # which autoconf can interpret correctly.
608 CFLAGS="$CFLAGS -diag_error 1035"
609 # Whilst we're here, we might as well make sure CXX defaults to something
610 # sensible if we're not using gcc.
611 if test -z "$CXX"; then
612 CXX="CC"
613 fi
614fi
615
Marc-André Lemburg6d5e5792010-04-30 17:20:14 +0000616# If the user set CFLAGS, use this instead of the automatically
617# determined setting
618preset_cflags="$CFLAGS"
Guido van Rossum627b2d71993-12-24 10:39:16 +0000619AC_PROG_CC
Marc-André Lemburg6d5e5792010-04-30 17:20:14 +0000620if test ! -z "$preset_cflags"
621then
622 CFLAGS=$preset_cflags
623fi
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000624
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000625AC_SUBST(CXX)
626AC_SUBST(MAINCC)
627AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
628AC_ARG_WITH(cxx_main,
Matthias Klose22520ea2010-05-08 10:14:46 +0000629 AS_HELP_STRING([--with-cxx-main=<compiler>],
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000630 [compile main() and link python executable with C++ compiler]),
631[
632
633 case $withval in
634 no) with_cxx_main=no
635 MAINCC='$(CC)';;
636 yes) with_cxx_main=yes
637 MAINCC='$(CXX)';;
638 *) with_cxx_main=yes
639 MAINCC=$withval
640 if test -z "$CXX"
641 then
642 CXX=$withval
643 fi;;
644 esac], [
645 with_cxx_main=no
646 MAINCC='$(CC)'
647])
648AC_MSG_RESULT($with_cxx_main)
649
650preset_cxx="$CXX"
651if test -z "$CXX"
652then
653 case "$CC" in
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100654 gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
655 cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000656 esac
657 if test "$CXX" = "notfound"
658 then
659 CXX=""
660 fi
661fi
662if test -z "$CXX"
663then
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100664 AC_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000665 if test "$CXX" = "notfound"
666 then
667 CXX=""
668 fi
669fi
670if test "$preset_cxx" != "$CXX"
671then
672 AC_MSG_WARN([
673
674 By default, distutils will build C++ extension modules with "$CXX".
675 If this is not intended, then set CXX on the configure command line.
676 ])
677fi
678
doko@python.org4e63fbe2013-01-25 13:08:27 +0100679MULTIARCH=$($CC --print-multiarch 2>/dev/null)
680AC_SUBST(MULTIARCH)
681
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000682
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000683# checks for UNIX variants that set C preprocessor variables
Matthias Klose9f8e0c12010-05-08 10:17:27 +0000684AC_USE_SYSTEM_EXTENSIONS
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000685
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000686# Check for unsupported systems
687case $ac_sys_system/$ac_sys_release in
Brett Cannon19fab762007-06-02 03:02:29 +0000688atheos*|Linux*/1*)
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000689 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
690 echo See README for details.
691 exit 1;;
692esac
693
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000694AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000695AC_MSG_CHECKING(for --with-suffix)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000696AC_ARG_WITH(suffix,
Matthias Klose22520ea2010-05-08 10:14:46 +0000697 AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000698[
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000699 case $withval in
700 no) EXEEXT=;;
701 yes) EXEEXT=.exe;;
702 *) EXEEXT=$withval;;
703 esac])
704AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000705
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000706# Test whether we're running on a non-case-sensitive system, in which
707# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000708AC_SUBST(BUILDEXEEXT)
709AC_MSG_CHECKING(for case-insensitive build directory)
Jack Jansen3c2c4332002-11-06 13:33:32 +0000710if test ! -d CaseSensitiveTestDir; then
711mkdir CaseSensitiveTestDir
712fi
713
714if test -d casesensitivetestdir
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000715then
Jack Jansen1999ef42001-12-06 21:47:20 +0000716 AC_MSG_RESULT(yes)
717 BUILDEXEEXT=.exe
718else
719 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000720 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000721fi
Jack Jansen3c2c4332002-11-06 13:33:32 +0000722rmdir CaseSensitiveTestDir
Guido van Rossumfb842551997-08-06 23:42:07 +0000723
Guido van Rossumdd997f71998-10-07 19:58:26 +0000724case $MACHDEP in
725bsdos*)
726 case $CC in
727 gcc) CC="$CC -D_HAVE_BSDI";;
728 esac;;
729esac
730
Guido van Rossum84561611997-08-21 00:08:11 +0000731case $ac_sys_system in
732hp*|HP*)
733 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000734 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000735 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000736SunOS*)
737 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000738 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000739 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000740esac
741
Martin v. Löwise8964d42001-03-06 12:09:07 +0000742
Neil Schemenauer61c51152001-01-26 16:18:16 +0000743AC_SUBST(LIBRARY)
744AC_MSG_CHECKING(LIBRARY)
745if test -z "$LIBRARY"
746then
747 LIBRARY='libpython$(VERSION).a'
748fi
749AC_MSG_RESULT($LIBRARY)
750
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000751# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000752# name of the library into which to insert object files). BLDLIBRARY is also
753# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
754# is blank as the main program is not linked directly against LDLIBRARY.
755# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
756# systems without shared libraries, LDLIBRARY is the same as LIBRARY
757# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
758# DLLLIBRARY is the shared (i.e., DLL) library.
759#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000760# RUNSHARED is used to run shared python without installed libraries
761#
762# INSTSONAME is the name of the shared library that will be use to install
763# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000764AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000765AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000766AC_SUBST(BLDLIBRARY)
767AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000768AC_SUBST(INSTSONAME)
769AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000770LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000771BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis09bdf722002-05-08 08:51:29 +0000772INSTSONAME='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000773DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000774LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000775RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000776
Guido van Rossumfb842551997-08-06 23:42:07 +0000777# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000778# If CXX is set, and if it is needed to link a main function that was
779# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
780# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000781# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000782# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000783AC_SUBST(LINKCC)
784AC_MSG_CHECKING(LINKCC)
785if test -z "$LINKCC"
786then
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000787 LINKCC='$(PURIFY) $(MAINCC)'
Guido van Rossumfb842551997-08-06 23:42:07 +0000788 case $ac_sys_system in
789 AIX*)
Neal Norwitz0b27ff92003-03-31 15:53:49 +0000790 exp_extra="\"\""
791 if test $ac_sys_release -ge 5 -o \
792 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
793 exp_extra="."
794 fi
795 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000796 QNX*)
797 # qcc must be used because the other compilers do not
798 # support -N.
799 LINKCC=qcc;;
Guido van Rossumfb842551997-08-06 23:42:07 +0000800 esac
801fi
802AC_MSG_RESULT($LINKCC)
803
Tarek Ziadée2be83d2009-05-09 08:28:53 +0000804# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
805# make sure we default having it set to "no": this is used by
806# distutils.unixccompiler to know if it should add --enable-new-dtags
807# to linker command lines, and failing to detect GNU ld simply results
808# in the same bahaviour as before.
809AC_SUBST(GNULD)
810AC_MSG_CHECKING(for GNU ld)
811ac_prog=ld
812if test "$GCC" = yes; then
813 ac_prog=`$CC -print-prog-name=ld`
814fi
815case `"$ac_prog" -V 2>&1 < /dev/null` in
816 *GNU*)
817 GNULD=yes;;
818 *)
819 GNULD=no;;
820esac
821AC_MSG_RESULT($GNULD)
822
Martin v. Löwis1142de32002-03-29 16:28:31 +0000823AC_MSG_CHECKING(for --enable-shared)
824AC_ARG_ENABLE(shared,
Matthias Klose22520ea2010-05-08 10:14:46 +0000825 AS_HELP_STRING([--enable-shared], [disable/enable building shared python library]))
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000826
Martin v. Löwis1142de32002-03-29 16:28:31 +0000827if test -z "$enable_shared"
828then
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000829 case $ac_sys_system in
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000830 CYGWIN* | atheos*)
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000831 enable_shared="yes";;
832 *)
833 enable_shared="no";;
834 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000835fi
836AC_MSG_RESULT($enable_shared)
837
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000838AC_MSG_CHECKING(for --enable-profiling)
839AC_ARG_ENABLE(profiling,
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100840 AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]))
841if test "x$enable_profiling" = xyes; then
842 ac_save_cc="$CC"
Benjamin Petersonb9be7bb2013-03-26 08:55:37 -0400843 CC="$CC -pg"
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100844 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
845 [],
846 [enable_profiling=no])
847 CC="$ac_save_cc"
848else
849 enable_profiling=no
850fi
851AC_MSG_RESULT($enable_profiling)
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000852
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100853if test "x$enable_profiling" = xyes; then
854 BASECFLAGS="-pg $BASECFLAGS"
855 LDFLAGS="-pg $LDFLAGS"
856fi
Martin v. Löwis1142de32002-03-29 16:28:31 +0000857
858AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000859
Guido van Rossumb8552162001-09-05 14:58:11 +0000860# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
861# library that we build, but we do not want to link against it (we
862# will find it with a -framework option). For this reason there is an
863# extra variable BLDLIBRARY against which Python and the extension
864# modules are linked, BLDLIBRARY. This is normally the same as
865# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000866if test "$enable_framework"
867then
868 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200869 RUNSHARED=DYLD_FRAMEWORK_PATH=`pwd`${DYLD_FRAMEWORK_PATH:+:${DYLD_FRAMEWORK_PATH}}
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000870 BLDLIBRARY=''
871else
872 BLDLIBRARY='$(LDLIBRARY)'
873fi
874
Martin v. Löwis1142de32002-03-29 16:28:31 +0000875# Other platforms follow
876if test $enable_shared = "yes"; then
Mark Hammond8235ea12002-07-19 06:55:41 +0000877 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
Martin v. Löwis1142de32002-03-29 16:28:31 +0000878 case $ac_sys_system in
879 BeOS*)
880 LDLIBRARY='libpython$(VERSION).so'
881 ;;
882 CYGWIN*)
883 LDLIBRARY='libpython$(VERSION).dll.a'
884 DLLLIBRARY='libpython$(VERSION).dll'
885 ;;
886 SunOS*)
887 LDLIBRARY='libpython$(VERSION).so'
Martin v. Löwisd141a8c2003-06-14 15:20:28 +0000888 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200889 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Martin v. Löwis2389c412003-10-31 15:42:07 +0000890 INSTSONAME="$LDLIBRARY".$SOVERSION
Martin v. Löwis1142de32002-03-29 16:28:31 +0000891 ;;
Charles-François Natali3de8c732011-07-24 22:33:35 +0200892 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000893 LDLIBRARY='libpython$(VERSION).so'
894 BLDLIBRARY='-L. -lpython$(VERSION)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200895 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Hye-Shik Chang33761492004-10-26 09:53:46 +0000896 case $ac_sys_system in
897 FreeBSD*)
898 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
899 ;;
900 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000901 INSTSONAME="$LDLIBRARY".$SOVERSION
902 ;;
903 hp*|HP*)
Neal Norwitz58e28882006-05-19 07:00:58 +0000904 case `uname -m` in
905 ia64)
906 LDLIBRARY='libpython$(VERSION).so'
907 ;;
908 *)
909 LDLIBRARY='libpython$(VERSION).sl'
910 ;;
911 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000912 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200913 RUNSHARED=SHLIB_PATH=`pwd`${SHLIB_PATH:+:${SHLIB_PATH}}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000914 ;;
915 OSF*)
916 LDLIBRARY='libpython$(VERSION).so'
Neal Norwitz671b9e32006-01-09 07:07:12 +0000917 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200918 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000919 ;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000920 atheos*)
921 LDLIBRARY='libpython$(VERSION).so'
922 BLDLIBRARY='-L. -lpython$(VERSION)'
923 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
924 ;;
Ronald Oussoren79f90492009-01-02 10:44:46 +0000925 Darwin*)
926 LDLIBRARY='libpython$(VERSION).dylib'
927 BLDLIBRARY='-L. -lpython$(VERSION)'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200928 RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
Ronald Oussoren79f90492009-01-02 10:44:46 +0000929 ;;
Antoine Pitrouaabdceb2010-09-10 20:03:17 +0000930 AIX*)
931 LDLIBRARY='libpython$(VERSION).so'
doko@ubuntu.com9ba90c92014-05-07 04:41:26 +0200932 RUNSHARED=LIBPATH=`pwd`${LIBPATH:+:${LIBPATH}}
Antoine Pitrouaabdceb2010-09-10 20:03:17 +0000933 ;;
Ronald Oussoren79f90492009-01-02 10:44:46 +0000934
Martin v. Löwis1142de32002-03-29 16:28:31 +0000935 esac
Jason Tishler30765592003-09-04 11:04:06 +0000936else # shared is disabled
937 case $ac_sys_system in
938 CYGWIN*)
939 BLDLIBRARY='$(LIBRARY)'
940 LDLIBRARY='libpython$(VERSION).dll.a'
941 ;;
942 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000943fi
944
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100945if test "$cross_compiling" = yes; then
946 RUNSHARED=
947fi
948
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000949AC_MSG_RESULT($LDLIBRARY)
950
Guido van Rossum627b2d71993-12-24 10:39:16 +0000951AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000952AC_SUBST(AR)
doko@python.orgd65e2ba2013-01-31 23:52:03 +0100953AC_CHECK_TOOLS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000954
Tarek Ziadé99f660a2009-05-07 21:20:34 +0000955# tweak ARFLAGS only if the user didn't set it on the command line
956AC_SUBST(ARFLAGS)
957if test -z "$ARFLAGS"
958then
959 ARFLAGS="rc"
960fi
961
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000962AC_SUBST(SVNVERSION)
Martin v. Löwisff600232006-04-03 19:12:32 +0000963AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000964if test $SVNVERSION = found
965then
966 SVNVERSION="svnversion \$(srcdir)"
967else
Benjamin Petersone5afa3b2009-05-23 19:24:37 +0000968 SVNVERSION="echo Unversioned directory"
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000969fi
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000970
Trent Nelsond86ceec2012-10-16 09:42:45 -0400971AC_SUBST(BASECPPFLAGS)
Trent Nelsonabf20512012-10-17 04:32:49 -0400972if test "$abs_srcdir" != "$abs_builddir"; then
Trent Nelsond86ceec2012-10-16 09:42:45 -0400973 # If we're building out-of-tree make sure Include (in the current dir)
974 # gets picked up before its $srcdir counterpart in order for Python-ast.h
975 # and graminit.h to get picked up from the correct directory.
976 # (A side effect of this is that these resources will automatically be
977 # regenerated when building out-of-tree, regardless of whether or not
978 # the $srcdir counterpart is up-to-date. This is an acceptable trade
979 # off.)
980 BASECPPFLAGS="-IInclude"
981else
982 BASECPPFLAGS=""
983fi
984
Georg Brandl3a5508e2011-03-06 10:42:21 +0100985AC_SUBST(HGVERSION)
986AC_SUBST(HGTAG)
987AC_SUBST(HGBRANCH)
988AC_CHECK_PROG(HAS_HG, hg, found, not-found)
989if test $HAS_HG = found
990then
991 HGVERSION="hg id -i \$(srcdir)"
992 HGTAG="hg id -t \$(srcdir)"
993 HGBRANCH="hg id -b \$(srcdir)"
994else
995 HGVERSION=""
996 HGTAG=""
997 HGBRANCH=""
998fi
999
Neil Schemenauera42c8272001-03-31 00:01:55 +00001000case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +00001001bsdos*|hp*|HP*)
1002 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +00001003 if test -z "$INSTALL"
1004 then
1005 INSTALL="${srcdir}/install-sh -c"
1006 fi
1007esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001008AC_PROG_INSTALL
Trent Nelsonf6407a12012-08-30 14:56:13 +00001009AC_PROG_MKDIR_P
Guido van Rossumb418f891996-07-30 18:06:02 +00001010
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001011# Not every filesystem supports hard links
1012AC_SUBST(LN)
1013if test -z "$LN" ; then
1014 case $ac_sys_system in
1015 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001016 CYGWIN*) LN="ln -s";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001017 atheos*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001018 *) LN=ln;;
1019 esac
1020fi
1021
Fred Drake9f715822001-07-11 06:27:00 +00001022# Check for --with-pydebug
1023AC_MSG_CHECKING(for --with-pydebug)
1024AC_ARG_WITH(pydebug,
Matthias Klose22520ea2010-05-08 10:14:46 +00001025 AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001026[
Fred Drake9f715822001-07-11 06:27:00 +00001027if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001028then
1029 AC_DEFINE(Py_DEBUG, 1,
1030 [Define if you want to build an interpreter with many run-time checks.])
1031 AC_MSG_RESULT(yes);
1032 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +00001033else AC_MSG_RESULT(no); Py_DEBUG='false'
1034fi],
1035[AC_MSG_RESULT(no)])
1036
Skip Montanarodecc6a42003-01-01 20:07:49 +00001037# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
1038# merged with this chunk of code?
1039
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001040# Optimizer/debugger flags
Skip Montanarodecc6a42003-01-01 20:07:49 +00001041# ------------------------
1042# (The following bit of code is complicated enough - please keep things
1043# indented properly. Just pretend you're editing Python code. ;-)
1044
1045# There are two parallel sets of case statements below, one that checks to
1046# see if OPT was set and one that does BASECFLAGS setting based upon
1047# compiler and platform. BASECFLAGS tweaks need to be made even if the
1048# user set OPT.
1049
1050# tweak OPT based on compiler and platform, only if the user didn't set
1051# it on the command line
Guido van Rossumb418f891996-07-30 18:06:02 +00001052AC_SUBST(OPT)
Benjamin Petersond4b721b2010-03-23 20:58:37 +00001053if test "${OPT-unset}" = "unset"
Guido van Rossumb418f891996-07-30 18:06:02 +00001054then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001055 case $GCC in
1056 yes)
Skip Montanaro288a5be2006-04-13 02:00:56 +00001057 if test "$CC" != 'g++' ; then
1058 STRICT_PROTO="-Wstrict-prototypes"
1059 fi
Guido van Rossum7c862f82007-12-13 20:50:10 +00001060 # For gcc 4.x we need to use -fwrapv so lets check if its supported
1061 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
1062 WRAP="-fwrapv"
1063 fi
Stefan Krah503e5e12011-09-14 15:19:42 +02001064
1065 # Clang also needs -fwrapv
Stefan Krah2bc1e8f2011-12-08 22:26:06 +01001066 case $CC in
1067 *clang*) WRAP="-fwrapv"
1068 ;;
1069 esac
Stefan Krah503e5e12011-09-14 15:19:42 +02001070
Skip Montanarodecc6a42003-01-01 20:07:49 +00001071 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001072 yes)
Fred Drake9f715822001-07-11 06:27:00 +00001073 if test "$Py_DEBUG" = 'true' ; then
1074 # Optimization messes up debuggers, so turn it off for
1075 # debug builds.
Mark Dickinsond2f3e3f2010-05-05 22:23:58 +00001076 OPT="-g -O0 -Wall $STRICT_PROTO"
Fred Drake9f715822001-07-11 06:27:00 +00001077 else
Guido van Rossum7c862f82007-12-13 20:50:10 +00001078 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +00001079 fi
1080 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001081 *)
Skip Montanaro288a5be2006-04-13 02:00:56 +00001082 OPT="-O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +00001083 ;;
Fred Drake9f715822001-07-11 06:27:00 +00001084 esac
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001085 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +00001086 SCO_SV*) OPT="$OPT -m486 -DSCO5"
1087 ;;
1088 esac
Fred Drake9f715822001-07-11 06:27:00 +00001089 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001090
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001091 *)
Skip Montanarodecc6a42003-01-01 20:07:49 +00001092 OPT="-O"
1093 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001094 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +00001095fi
Guido van Rossum627b2d71993-12-24 10:39:16 +00001096
Skip Montanarodecc6a42003-01-01 20:07:49 +00001097AC_SUBST(BASECFLAGS)
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001098
1099# The -arch flags for universal builds on OSX
1100UNIVERSAL_ARCH_FLAGS=
1101AC_SUBST(UNIVERSAL_ARCH_FLAGS)
1102
Skip Montanarodecc6a42003-01-01 20:07:49 +00001103# tweak BASECFLAGS based on compiler and platform
1104case $GCC in
1105yes)
Martin v. Löwis70fedcd2003-07-07 21:26:19 +00001106 # Python violates C99 rules, by casting between incompatible
1107 # pointer types. GCC may generate bad code as a result of that,
1108 # so use -fno-strict-aliasing if supported.
1109 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
1110 ac_save_cc="$CC"
1111 CC="$CC -fno-strict-aliasing"
Alexandre Vassalotti00900892009-07-17 05:26:39 +00001112 AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
Matthias Klosec511b472010-05-08 11:01:39 +00001113 AC_COMPILE_IFELSE(
Mark Dickinson5e13e292010-05-11 08:55:06 +00001114 [AC_LANG_PROGRAM([[]], [[]])],
Matthias Klosec511b472010-05-08 11:01:39 +00001115 [ac_cv_no_strict_aliasing_ok=yes],
1116 [ac_cv_no_strict_aliasing_ok=no]))
Martin v. Löwis70fedcd2003-07-07 21:26:19 +00001117 CC="$ac_save_cc"
1118 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
1119 if test $ac_cv_no_strict_aliasing_ok = yes
1120 then
1121 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
1122 fi
Mark Dickinson65134662008-04-25 16:11:04 +00001123
1124 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
1125 # support. Without this, treatment of subnormals doesn't follow
1126 # the standard.
doko@python.orgd65e2ba2013-01-31 23:52:03 +01001127 case $host in
Mark Dickinson65134662008-04-25 16:11:04 +00001128 alpha*)
1129 BASECFLAGS="$BASECFLAGS -mieee"
1130 ;;
1131 esac
1132
Skip Montanarodecc6a42003-01-01 20:07:49 +00001133 case $ac_sys_system in
1134 SCO_SV*)
1135 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
1136 ;;
1137 # is there any other compiler on Darwin besides gcc?
1138 Darwin*)
Jeffrey Yasskin1b4e45b2008-03-17 14:40:53 +00001139 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
1140 # used to be here, but non-Apple gcc doesn't accept them.
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001141 if test "${CC}" = gcc
1142 then
1143 AC_MSG_CHECKING(which compiler should be used)
1144 case "${UNIVERSALSDK}" in
1145 */MacOSX10.4u.sdk)
1146 # Build using 10.4 SDK, force usage of gcc when the
1147 # compiler is gcc, otherwise the user will get very
1148 # confusing error messages when building on OSX 10.6
1149 CC=gcc-4.0
1150 CPP=cpp-4.0
1151 ;;
1152 esac
1153 AC_MSG_RESULT($CC)
Ronald Oussoren988117f2006-04-29 11:31:35 +00001154 fi
1155
Benjamin Peterson4347c442008-07-17 15:59:24 +00001156 # Calculate the right deployment target for this build.
1157 #
Ned Deilyc40b9032014-06-25 13:48:46 -07001158 cur_target_major=`sw_vers -productVersion | \
1159 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
1160 cur_target_minor=`sw_vers -productVersion | \
1161 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
1162 cur_target="${cur_target_major}.${cur_target_minor}"
1163 if test ${cur_target_major} -eq 10 && \
1164 test ${cur_target_minor} -ge 3
1165 then
Benjamin Peterson4347c442008-07-17 15:59:24 +00001166 cur_target=10.3
Ronald Oussoren25967582009-09-06 10:00:26 +00001167 if test ${enable_universalsdk}; then
1168 if test "${UNIVERSAL_ARCHS}" = "all"; then
1169 # Ensure that the default platform for a
1170 # 4-way universal build is OSX 10.5,
1171 # that's the first OS release where
1172 # 4-way builds make sense.
1173 cur_target='10.5'
Ronald Oussoren23d92532009-09-07 06:12:00 +00001174
1175 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
1176 cur_target='10.5'
1177
1178 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
1179 cur_target='10.5'
1180
1181 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
1182 cur_target='10.5'
Ronald Oussoren25967582009-09-06 10:00:26 +00001183 fi
1184 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001185 if test `/usr/bin/arch` = "i386"; then
Ronald Oussoren25967582009-09-06 10:00:26 +00001186 # On Intel macs default to a deployment
1187 # target of 10.4, that's the first OSX
1188 # release with Intel support.
1189 cur_target="10.4"
1190 fi
1191 fi
Benjamin Peterson4347c442008-07-17 15:59:24 +00001192 fi
1193 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1194
1195 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1196 # environment with a value that is the same as what we'll use
1197 # in the Makefile to ensure that we'll get the same compiler
1198 # environment during configure and build time.
1199 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1200 export MACOSX_DEPLOYMENT_TARGET
1201 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1202
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001203 if test "${enable_universalsdk}"; then
1204 UNIVERSAL_ARCH_FLAGS=""
1205 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
1206 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
1207 ARCH_RUN_32BIT=""
Ronald Oussoren75912852010-04-08 08:13:31 +00001208 LIPO_32BIT_FLAGS=""
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001209
1210 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
1211 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
1212 LIPO_32BIT_FLAGS=""
1213 ARCH_RUN_32BIT="true"
1214
1215 elif test "$UNIVERSAL_ARCHS" = "all" ; then
1216 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
1217 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001218 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001219
1220 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
1221 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
1222 LIPO_32BIT_FLAGS="-extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001223 ARCH_RUN_32BIT="/usr/bin/arch -i386"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001224
1225 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
1226 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
1227 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren9922f172010-02-11 13:19:34 +00001228 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001229
1230 else
1231 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
1232
1233 fi
1234
1235
Ronald Oussoren974eb5e2010-04-18 17:59:37 +00001236 CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
1237 if test "${UNIVERSALSDK}" != "/"
1238 then
1239 CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
1240 LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1241 CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001242 fi
1243
1244 fi
1245
1246
Skip Montanarodecc6a42003-01-01 20:07:49 +00001247 ;;
Neal Norwitzdedeeaa2006-03-31 06:54:45 +00001248 OSF*)
1249 BASECFLAGS="$BASECFLAGS -mieee"
1250 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001251 esac
1252 ;;
1253
1254*)
1255 case $ac_sys_system in
1256 OpenUNIX*|UnixWare*)
1257 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1258 ;;
Neal Norwitzb44f1652003-05-26 14:11:55 +00001259 OSF*)
1260 BASECFLAGS="$BASECFLAGS -ieee -std"
1261 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001262 SCO_SV*)
1263 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1264 ;;
1265 esac
1266 ;;
1267esac
1268
Fred Drakee1ceaa02001-12-04 20:55:47 +00001269if test "$Py_DEBUG" = 'true'; then
1270 :
1271else
1272 OPT="-DNDEBUG $OPT"
1273fi
1274
Guido van Rossum6f2260e1996-09-09 16:21:03 +00001275if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001276then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001277 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001278fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001279
Neal Norwitz020c46a2006-01-07 21:39:28 +00001280# disable check for icc since it seems to pass, but generates a warning
1281if test "$CC" = icc
1282then
1283 ac_cv_opt_olimit_ok=no
1284fi
1285
Guido van Rossum91922671997-10-09 20:24:13 +00001286AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1287AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1288[ac_save_cc="$CC"
1289CC="$CC -OPT:Olimit=0"
Matthias Klosec511b472010-05-08 11:01:39 +00001290AC_COMPILE_IFELSE(
Mark Dickinson5e13e292010-05-11 08:55:06 +00001291 [AC_LANG_PROGRAM([[]], [[]])],
Matthias Klosec511b472010-05-08 11:01:39 +00001292 [ac_cv_opt_olimit_ok=yes],
1293 [ac_cv_opt_olimit_ok=no]
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001294 )
Guido van Rossum91922671997-10-09 20:24:13 +00001295CC="$ac_save_cc"])
1296AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +00001297if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +00001298 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +00001299 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1300 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1301 # environment?
1302 Darwin*)
1303 ;;
Trent Nelson34562e12012-10-17 18:01:12 -04001304 # XXX thankfully this useless troublemaker of a flag has been
1305 # eradicated in the 3.x line. For now, make sure it isn't picked
1306 # up by any of our other platforms that use CC.
1307 AIX*|SunOS*|HP-UX*|IRIX*)
1308 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001309 *)
1310 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1311 ;;
Guido van Rossum5839e582000-10-09 19:52:35 +00001312 esac
Guido van Rossumf8678121998-07-07 21:05:09 +00001313else
1314 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1315 AC_CACHE_VAL(ac_cv_olimit_ok,
1316 [ac_save_cc="$CC"
1317 CC="$CC -Olimit 1500"
Matthias Klosec511b472010-05-08 11:01:39 +00001318 AC_COMPILE_IFELSE(
Mark Dickinson5e13e292010-05-11 08:55:06 +00001319 [AC_LANG_PROGRAM([[]], [[]])],
Matthias Klosec511b472010-05-08 11:01:39 +00001320 [ac_cv_olimit_ok=yes],
1321 [ac_cv_olimit_ok=no]
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001322 )
Guido van Rossumf8678121998-07-07 21:05:09 +00001323 CC="$ac_save_cc"])
1324 AC_MSG_RESULT($ac_cv_olimit_ok)
1325 if test $ac_cv_olimit_ok = yes; then
Stefan Krah67473262012-11-29 00:17:05 +01001326 case $ac_sys_system in
1327 # Issue #16534: On HP-UX ac_cv_olimit_ok=yes is a false positive.
1328 HP-UX*)
1329 ;;
1330 *)
1331 BASECFLAGS="$BASECFLAGS -Olimit 1500"
1332 ;;
1333 esac
Guido van Rossumf8678121998-07-07 21:05:09 +00001334 fi
Guido van Rossum201afe51997-05-14 21:14:44 +00001335fi
Guido van Rossumf8678121998-07-07 21:05:09 +00001336
Martin v. Löwisaac13162006-10-19 10:58:46 +00001337# Check whether GCC supports PyArg_ParseTuple format
1338if test "$GCC" = "yes"
1339then
1340 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1341 save_CFLAGS=$CFLAGS
Benjamin Petersonc8759662013-05-11 13:00:05 -05001342 CFLAGS="$CFLAGS -Werror -Wformat"
Matthias Klosec511b472010-05-08 11:01:39 +00001343 AC_COMPILE_IFELSE([
1344 AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
1345 ],[
1346 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1,
1347 [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1348 AC_MSG_RESULT(yes)
1349 ],[
1350 AC_MSG_RESULT(no)
1351 ])
Martin v. Löwisc1d75972006-10-19 16:01:37 +00001352 CFLAGS=$save_CFLAGS
Martin v. Löwisaac13162006-10-19 10:58:46 +00001353fi
1354
Brett Cannon4ff151a2015-09-18 15:09:42 -07001355
1356# Enable PGO flags.
1357AC_SUBST(PGO_PROF_GEN_FLAG)
1358AC_SUBST(PGO_PROF_USE_FLAG)
1359AC_SUBST(LLVM_PROF_MERGER)
1360AC_SUBST(LLVM_PROF_FILE)
1361AC_SUBST(LLVM_PROF_ERR)
1362AC_SUBST(LLVM_PROF_FOUND)
1363AC_CHECK_PROG(LLVM_PROF_FOUND, llvm-profdata, found, not-found)
1364LLVM_PROF_ERR=no
1365case $CC in
1366 *clang*)
1367 # Any changes made here should be reflected in the GCC+Darwin case below
1368 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
1369 PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
1370 LLVM_PROF_MERGER="llvm-profdata merge -output=code.profclangd *.profclangr"
1371 LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
1372 if test $LLVM_PROF_FOUND = not-found
1373 then
1374 LLVM_PROF_ERR=yes
1375 fi
1376 ;;
1377 *gcc*)
1378 case $ac_sys_system in
1379 Darwin*)
1380 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
1381 PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
1382 LLVM_PROF_MERGER="llvm-profdata merge -output=code.profclangd *.profclangr"
1383 LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
1384 if test $LLVM_PROF_FOUND = not-found
1385 then
1386 LLVM_PROF_ERR=yes
1387 fi
1388 ;;
1389 *)
1390 PGO_PROF_GEN_FLAG="-fprofile-generate"
1391 PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
1392 LLVM_PROF_MERGER="true"
1393 LLVM_PROF_FILE=""
1394 ;;
1395 esac
1396 ;;
1397esac
1398
1399
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001400# On some compilers, pthreads are available without further options
1401# (e.g. MacOS X). On some of these systems, the compiler will not
1402# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1403# So we have to see first whether pthreads are available without
1404# options before we can check whether -Kpthread improves anything.
1405AC_MSG_CHECKING(whether pthreads are available without options)
1406AC_CACHE_VAL(ac_cv_pthread_is_default,
Matthias Klosec511b472010-05-08 11:01:39 +00001407[AC_RUN_IFELSE([AC_LANG_SOURCE([[
Stefan Krahae66ca62012-11-22 22:36:57 +01001408#include <stdio.h>
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001409#include <pthread.h>
1410
1411void* routine(void* p){return NULL;}
1412
1413int main(){
1414 pthread_t p;
1415 if(pthread_create(&p,NULL,routine,NULL)!=0)
1416 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001417 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001418 return 0;
1419}
Matthias Klosec511b472010-05-08 11:01:39 +00001420]])],[
Skip Montanarod8d39a02003-07-10 20:44:10 +00001421 ac_cv_pthread_is_default=yes
1422 ac_cv_kthread=no
1423 ac_cv_pthread=no
Matthias Klosec511b472010-05-08 11:01:39 +00001424],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no])
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001425])
1426AC_MSG_RESULT($ac_cv_pthread_is_default)
1427
1428
1429if test $ac_cv_pthread_is_default = yes
1430then
1431 ac_cv_kpthread=no
1432else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001433# -Kpthread, if available, provides the right #defines
1434# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001435# Some compilers won't report that they do not support -Kpthread,
1436# so we need to run a program to see whether it really made the
1437# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +00001438AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1439AC_CACHE_VAL(ac_cv_kpthread,
1440[ac_save_cc="$CC"
1441CC="$CC -Kpthread"
Matthias Klosec511b472010-05-08 11:01:39 +00001442AC_RUN_IFELSE([AC_LANG_SOURCE([[
Stefan Krahae66ca62012-11-22 22:36:57 +01001443#include <stdio.h>
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001444#include <pthread.h>
1445
1446void* routine(void* p){return NULL;}
1447
1448int main(){
1449 pthread_t p;
1450 if(pthread_create(&p,NULL,routine,NULL)!=0)
1451 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001452 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001453 return 0;
1454}
Matthias Klosec511b472010-05-08 11:01:39 +00001455]])],[ac_cv_kpthread=yes],[ac_cv_kpthread=no],[ac_cv_kpthread=no])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001456CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001457AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001458fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00001459
Skip Montanarod8d39a02003-07-10 20:44:10 +00001460if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001461then
1462# -Kthread, if available, provides the right #defines
1463# and linker options to make pthread_create available
1464# Some compilers won't report that they do not support -Kthread,
1465# so we need to run a program to see whether it really made the
1466# function available.
1467AC_MSG_CHECKING(whether $CC accepts -Kthread)
1468AC_CACHE_VAL(ac_cv_kthread,
1469[ac_save_cc="$CC"
1470CC="$CC -Kthread"
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öwis5f433f02003-05-05 05:05:30 +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;
1481 (void)pthread_detach(p);
1482 return 0;
1483}
Matthias Klosec511b472010-05-08 11:01:39 +00001484]])],[ac_cv_kthread=yes],[ac_cv_kthread=no],[ac_cv_kthread=no])
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001485CC="$ac_save_cc"])
1486AC_MSG_RESULT($ac_cv_kthread)
1487fi
1488
Skip Montanarod8d39a02003-07-10 20:44:10 +00001489if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001490then
1491# -pthread, 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 -pthread,
1494# so we need to run a program to see whether it really made the
1495# function available.
1496AC_MSG_CHECKING(whether $CC accepts -pthread)
doko@python.orgfa3f9a32013-01-25 15:32:31 +01001497AC_CACHE_VAL(ac_cv_pthread,
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001498[ac_save_cc="$CC"
1499CC="$CC -pthread"
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öwis4ee6eef2003-05-26 05:37:51 +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_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001514CC="$ac_save_cc"])
1515AC_MSG_RESULT($ac_cv_pthread)
1516fi
1517
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001518# If we have set a CC compiler flag for thread support then
1519# check if it works for CXX, too.
1520ac_cv_cxx_thread=no
1521if test ! -z "$CXX"
1522then
1523AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1524ac_save_cxx="$CXX"
1525
1526if test "$ac_cv_kpthread" = "yes"
1527then
Martin v. Löwis519adae2003-09-20 10:47:47 +00001528 CXX="$CXX -Kpthread"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001529 ac_cv_cxx_thread=yes
1530elif test "$ac_cv_kthread" = "yes"
1531then
1532 CXX="$CXX -Kthread"
1533 ac_cv_cxx_thread=yes
1534elif test "$ac_cv_pthread" = "yes"
1535then
1536 CXX="$CXX -pthread"
1537 ac_cv_cxx_thread=yes
1538fi
1539
1540if test $ac_cv_cxx_thread = yes
1541then
1542 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1543 $CXX -c conftest.$ac_ext 2>&5
1544 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1545 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1546 then
1547 ac_cv_cxx_thread=yes
1548 else
1549 ac_cv_cxx_thread=no
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001550 fi
1551 rm -fr conftest*
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001552fi
Brett Cannonc601e0f2004-11-07 01:24:12 +00001553AC_MSG_RESULT($ac_cv_cxx_thread)
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001554fi
Martin v. Löwis519adae2003-09-20 10:47:47 +00001555CXX="$ac_save_cxx"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001556
Fred Drakece81d592000-07-09 14:39:29 +00001557dnl # check for ANSI or K&R ("traditional") preprocessor
1558dnl AC_MSG_CHECKING(for C preprocessor type)
Matthias Klosec511b472010-05-08 11:01:39 +00001559dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Fred Drakece81d592000-07-09 14:39:29 +00001560dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1561dnl int foo;
1562dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
Matthias Klosec511b472010-05-08 11:01:39 +00001563dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional])
Fred Drakece81d592000-07-09 14:39:29 +00001564dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +00001565
Guido van Rossum627b2d71993-12-24 10:39:16 +00001566# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001567AC_HEADER_STDC
doko@ubuntu.comf27ec3e2014-04-17 20:11:19 +02001568AC_CHECK_HEADERS(asm/types.h conio.h direct.h dlfcn.h errno.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001569fcntl.h grp.h \
doko@ubuntu.comf27ec3e2014-04-17 20:11:19 +02001570ieeefp.h io.h langinfo.h libintl.h poll.h process.h pthread.h \
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001571shadow.h signal.h stdint.h stropts.h termios.h thread.h \
Martin v. Löwis14e73b12003-01-01 09:51:12 +00001572unistd.h utime.h \
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00001573sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1574sys/lock.h sys/mkdev.h sys/modem.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001575sys/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 +00001576sys/termio.h sys/time.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001577sys/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 +00001578sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
Christian Heimes3aa138f2013-06-18 13:25:24 +02001579bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001580AC_HEADER_DIRENT
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00001581AC_HEADER_MAJOR
Guido van Rossum627b2d71993-12-24 10:39:16 +00001582
Martin v. Löwis11017b12006-01-14 18:12:57 +00001583# On Linux, netlink.h requires asm/types.h
1584AC_CHECK_HEADERS(linux/netlink.h,,,[
1585#ifdef HAVE_ASM_TYPES_H
1586#include <asm/types.h>
1587#endif
1588#ifdef HAVE_SYS_SOCKET_H
1589#include <sys/socket.h>
1590#endif
1591])
1592
Guido van Rossum627b2d71993-12-24 10:39:16 +00001593# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001594was_it_defined=no
1595AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001596AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1597 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1598])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001599AC_MSG_RESULT($was_it_defined)
1600
Neal Norwitz11690112002-07-30 01:08:28 +00001601# Check whether using makedev requires defining _OSF_SOURCE
1602AC_MSG_CHECKING(for makedev)
Matthias Klosec511b472010-05-08 11:01:39 +00001603AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Jesus Cea616de772010-04-28 10:32:30 +00001604#if defined(MAJOR_IN_MKDEV)
1605#include <sys/mkdev.h>
1606#elif defined(MAJOR_IN_SYSMACROS)
1607#include <sys/sysmacros.h>
1608#else
1609#include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001610#endif ]], [[ makedev(0, 0) ]])],
1611[ac_cv_has_makedev=yes],
1612[ac_cv_has_makedev=no])
Neal Norwitz11690112002-07-30 01:08:28 +00001613if test "$ac_cv_has_makedev" = "no"; then
1614 # we didn't link, try if _OSF_SOURCE will allow us to link
Matthias Klosec511b472010-05-08 11:01:39 +00001615 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001616#define _OSF_SOURCE 1
1617#include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001618 ]], [[ makedev(0, 0) ]])],
1619[ac_cv_has_makedev=yes],
1620[ac_cv_has_makedev=no])
Neal Norwitz11690112002-07-30 01:08:28 +00001621 if test "$ac_cv_has_makedev" = "yes"; then
1622 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1623 fi
1624fi
1625AC_MSG_RESULT($ac_cv_has_makedev)
1626if test "$ac_cv_has_makedev" = "yes"; then
1627 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1628fi
1629
Martin v. Löwis399a6892002-10-04 10:22:02 +00001630# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1631# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1632# defined, but the compiler does not support pragma redefine_extname,
1633# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1634# structures (such as rlimit64) without declaring them. As a
1635# work-around, disable LFS on such configurations
1636
1637use_lfs=yes
1638AC_MSG_CHECKING(Solaris LFS bug)
Matthias Klosec511b472010-05-08 11:01:39 +00001639AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwis399a6892002-10-04 10:22:02 +00001640#define _LARGEFILE_SOURCE 1
1641#define _FILE_OFFSET_BITS 64
1642#include <sys/resource.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001643]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes])
Martin v. Löwis399a6892002-10-04 10:22:02 +00001644AC_MSG_RESULT($sol_lfs_bug)
1645if test "$sol_lfs_bug" = "yes"; then
1646 use_lfs=no
1647fi
1648
1649if test "$use_lfs" = "yes"; then
Guido van Rossum810cc512001-09-09 23:51:39 +00001650# Two defines needed to enable largefile support on various platforms
1651# These may affect some typedefs
Georg Brandl94800df2011-02-25 11:09:02 +00001652case $ac_sys_system/$ac_sys_release in
1653AIX*)
1654 AC_DEFINE(_LARGE_FILES, 1,
1655 [This must be defined on AIX systems to enable large file support.])
1656 ;;
1657esac
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001658AC_DEFINE(_LARGEFILE_SOURCE, 1,
1659[This must be defined on some systems to enable large file support.])
1660AC_DEFINE(_FILE_OFFSET_BITS, 64,
1661[This must be set to 64 on some systems to enable large file support.])
Martin v. Löwis399a6892002-10-04 10:22:02 +00001662fi
Guido van Rossum810cc512001-09-09 23:51:39 +00001663
Guido van Rossum300fda71996-08-19 21:58:16 +00001664# Add some code to confdefs.h so that the test for off_t works on SCO
1665cat >> confdefs.h <<\EOF
1666#if defined(SCO_DS)
1667#undef _OFF_T
1668#endif
1669EOF
1670
Guido van Rossumef2255b2000-03-10 22:30:29 +00001671# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001672AC_TYPE_MODE_T
1673AC_TYPE_OFF_T
1674AC_TYPE_PID_T
Matthias Klosecbf54b12010-05-08 11:04:18 +00001675AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001676AC_TYPE_SIZE_T
1677AC_TYPE_UID_T
Mark Dickinson17c50cd2012-12-02 13:13:56 +00001678
1679# There are two separate checks for each of the exact-width integer types we
1680# need. First we check whether the type is available using the usual
1681# AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h>
1682# and <stdint.h> where available). We then also use the special type checks of
1683# the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available
1684# directly, #define's uint32_t to be a suitable type.
1685
1686AC_CHECK_TYPE(uint32_t,
1687 AC_DEFINE(HAVE_UINT32_T, 1, [Define if your compiler provides uint32_t.]),,)
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001688AC_TYPE_UINT32_T
Mark Dickinson17c50cd2012-12-02 13:13:56 +00001689
1690AC_CHECK_TYPE(uint64_t,
1691 AC_DEFINE(HAVE_UINT64_T, 1, [Define if your compiler provides uint64_t.]),,)
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001692AC_TYPE_UINT64_T
Mark Dickinson17c50cd2012-12-02 13:13:56 +00001693
1694AC_CHECK_TYPE(int32_t,
1695 AC_DEFINE(HAVE_INT32_T, 1, [Define if your compiler provides int32_t.]),,)
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001696AC_TYPE_INT32_T
Mark Dickinson17c50cd2012-12-02 13:13:56 +00001697
1698AC_CHECK_TYPE(int64_t,
1699 AC_DEFINE(HAVE_INT64_T, 1, [Define if your compiler provides int64_t.]),,)
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001700AC_TYPE_INT64_T
Mark Dickinson17c50cd2012-12-02 13:13:56 +00001701
Christian Heimes951cc0f2008-01-31 23:08:23 +00001702AC_CHECK_TYPE(ssize_t,
Matthias Klose5183ebd2010-04-24 16:38:36 +00001703 AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001704
Guido van Rossumef2255b2000-03-10 22:30:29 +00001705# Sizes of various common basic types
Skip Montanarob9820a32004-01-17 00:16:12 +00001706# ANSI C requires sizeof(char) == 1, so no need to check it
Guido van Rossum3065c942001-09-17 04:03:14 +00001707AC_CHECK_SIZEOF(int, 4)
1708AC_CHECK_SIZEOF(long, 4)
1709AC_CHECK_SIZEOF(void *, 4)
Guido van Rossum3065c942001-09-17 04:03:14 +00001710AC_CHECK_SIZEOF(short, 2)
1711AC_CHECK_SIZEOF(float, 4)
1712AC_CHECK_SIZEOF(double, 8)
1713AC_CHECK_SIZEOF(fpos_t, 4)
Martin v. Löwis18e16552006-02-15 17:27:45 +00001714AC_CHECK_SIZEOF(size_t, 4)
Christian Heimes951cc0f2008-01-31 23:08:23 +00001715AC_CHECK_SIZEOF(pid_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +00001716
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001717AC_MSG_CHECKING(for long long support)
1718have_long_long=no
Matthias Klosec511b472010-05-08 11:01:39 +00001719AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001720 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1721 have_long_long=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001722],[])
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001723AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001724if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +00001725AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001726fi
1727
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001728AC_MSG_CHECKING(for long double support)
1729have_long_double=no
Matthias Klosec511b472010-05-08 11:01:39 +00001730AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001731 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1732 have_long_double=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001733],[])
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001734AC_MSG_RESULT($have_long_double)
Mark Dickinsondc1688a2008-06-27 22:20:14 +00001735if test "$have_long_double" = yes ; then
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001736AC_CHECK_SIZEOF(long double, 12)
1737fi
1738
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001739AC_MSG_CHECKING(for _Bool support)
1740have_c99_bool=no
Matthias Klosec511b472010-05-08 11:01:39 +00001741AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Bool x; x = (_Bool)0;]])],[
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001742 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1743 have_c99_bool=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001744],[])
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001745AC_MSG_RESULT($have_c99_bool)
1746if test "$have_c99_bool" = yes ; then
1747AC_CHECK_SIZEOF(_Bool, 1)
1748fi
1749
Martin v. Löwisebe26702006-10-02 14:55:51 +00001750AC_CHECK_TYPES(uintptr_t,
1751 [AC_CHECK_SIZEOF(uintptr_t, 4)],
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001752 [], [#ifdef HAVE_STDINT_H
1753 #include <stdint.h>
Antoine Pitrou7be5a652010-10-10 08:14:41 +00001754 #endif
1755 #ifdef HAVE_INTTYPES_H
1756 #include <inttypes.h>
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001757 #endif])
Martin v. Löwisebe26702006-10-02 14:55:51 +00001758
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001759AC_CHECK_SIZEOF(off_t, [], [
1760#ifdef HAVE_SYS_TYPES_H
1761#include <sys/types.h>
1762#endif
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001763])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001764
1765AC_MSG_CHECKING(whether to enable large file support)
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001766if test "$have_long_long" = yes
1767then
1768if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001769 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001770 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1771 [Defined to enable large file support when an off_t is bigger than a long
1772 and long long is available and at least as big as an off_t. You may need
1773 to add some flags for configuration and compilation to enable this mode.
1774 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001775 AC_MSG_RESULT(yes)
1776else
1777 AC_MSG_RESULT(no)
1778fi
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001779else
1780 AC_MSG_RESULT(no)
1781fi
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001782
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001783AC_CHECK_SIZEOF(time_t, [], [
1784#ifdef HAVE_SYS_TYPES_H
1785#include <sys/types.h>
1786#endif
1787#ifdef HAVE_TIME_H
1788#include <time.h>
1789#endif
Fred Drakea3f6e912000-06-29 20:44:47 +00001790])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001791
Trent Mick635f6fb2000-08-23 21:33:05 +00001792# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001793ac_save_cc="$CC"
1794if test "$ac_cv_kpthread" = "yes"
1795then CC="$CC -Kpthread"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001796elif test "$ac_cv_kthread" = "yes"
1797then CC="$CC -Kthread"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001798elif test "$ac_cv_pthread" = "yes"
1799then CC="$CC -pthread"
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001800fi
Trent Mick635f6fb2000-08-23 21:33:05 +00001801AC_MSG_CHECKING(for pthread_t)
1802have_pthread_t=no
Matthias Klosec511b472010-05-08 11:01:39 +00001803AC_COMPILE_IFELSE([
1804 AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
1805],[have_pthread_t=yes],[])
Trent Mick635f6fb2000-08-23 21:33:05 +00001806AC_MSG_RESULT($have_pthread_t)
1807if test "$have_pthread_t" = yes ; then
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001808 AC_CHECK_SIZEOF(pthread_t, [], [
1809#ifdef HAVE_PTHREAD_H
1810#include <pthread.h>
1811#endif
Trent Mick635f6fb2000-08-23 21:33:05 +00001812 ])
Trent Mick635f6fb2000-08-23 21:33:05 +00001813fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001814CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +00001815
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001816AC_MSG_CHECKING(for --enable-toolbox-glue)
1817AC_ARG_ENABLE(toolbox-glue,
Matthias Klose22520ea2010-05-08 10:14:46 +00001818 AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions]))
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001819
1820if test -z "$enable_toolbox_glue"
1821then
1822 case $ac_sys_system/$ac_sys_release in
1823 Darwin/*)
1824 enable_toolbox_glue="yes";;
1825 *)
1826 enable_toolbox_glue="no";;
1827 esac
1828fi
1829case "$enable_toolbox_glue" in
1830yes)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001831 extra_machdep_objs="Python/mactoolboxglue.o"
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001832 extra_undefs="-u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001833 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1834 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001835 ;;
1836*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001837 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +00001838 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001839 ;;
1840esac
1841AC_MSG_RESULT($enable_toolbox_glue)
1842
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00001843
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001844AC_SUBST(OTHER_LIBTOOL_OPT)
1845case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001846 Darwin/@<:@01567@:>@\..*)
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001847 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1848 ;;
1849 Darwin/*)
1850 OTHER_LIBTOOL_OPT=""
1851 ;;
1852esac
1853
Ronald Oussoren25967582009-09-06 10:00:26 +00001854
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001855AC_SUBST(LIBTOOL_CRUFT)
1856case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001857 Darwin/@<:@01567@:>@\..*)
Ronald Oussoren988117f2006-04-29 11:31:35 +00001858 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1859 if test "${enable_universalsdk}"; then
1860 :
1861 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001862 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001863 fi
Jack Jansenb36687a2004-07-16 08:43:47 +00001864 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001865 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +00001866 Darwin/*)
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001867 gcc_version=`gcc -dumpversion`
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001868 if test ${gcc_version} '<' 4.0
1869 then
1870 LIBTOOL_CRUFT="-lcc_dynamic"
1871 else
1872 LIBTOOL_CRUFT=""
1873 fi
Matthias Klosec511b472010-05-08 11:01:39 +00001874 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Ronald Oussoren25967582009-09-06 10:00:26 +00001875 #include <unistd.h>
1876 int main(int argc, char*argv[])
1877 {
1878 if (sizeof(long) == 4) {
1879 return 0;
1880 } else {
1881 return 1;
1882 }
Ronald Oussoren84ddd722009-09-08 07:17:10 +00001883 }
Matthias Klosec511b472010-05-08 11:01:39 +00001884 ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
Ronald Oussoren25967582009-09-06 10:00:26 +00001885
1886 if test "${ac_osx_32bit}" = "yes"; then
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001887 case `/usr/bin/arch` in
Ronald Oussoren25967582009-09-06 10:00:26 +00001888 i386)
1889 MACOSX_DEFAULT_ARCH="i386"
1890 ;;
1891 ppc)
1892 MACOSX_DEFAULT_ARCH="ppc"
1893 ;;
1894 *)
1895 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1896 ;;
1897 esac
1898 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001899 case `/usr/bin/arch` in
Ronald Oussoren25967582009-09-06 10:00:26 +00001900 i386)
1901 MACOSX_DEFAULT_ARCH="x86_64"
1902 ;;
1903 ppc)
1904 MACOSX_DEFAULT_ARCH="ppc64"
1905 ;;
1906 *)
1907 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1908 ;;
1909 esac
1910
1911 #ARCH_RUN_32BIT="true"
1912 fi
1913
1914 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
Jack Jansenb36687a2004-07-16 08:43:47 +00001915 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001916 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001917esac
1918
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001919AC_MSG_CHECKING(for --enable-framework)
1920if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001921then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001922 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001923 # -F. is needed to allow linking to the framework while
1924 # in the build location.
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001925 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1926 [Define if you want to produce an OpenStep/Rhapsody framework
1927 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001928 AC_MSG_RESULT(yes)
Ronald Oussoren450d5612009-06-08 21:12:41 +00001929 if test $enable_shared = "yes"
1930 then
Ronald Oussoren9ebd2422009-09-29 13:00:44 +00001931 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 +00001932 fi
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001933else
1934 AC_MSG_RESULT(no)
1935fi
1936
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001937AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001938case $ac_sys_system/$ac_sys_release in
1939 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001940 AC_DEFINE(WITH_DYLD, 1,
1941 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1942 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1943 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001944 AC_MSG_RESULT(always on for Darwin)
1945 ;;
1946 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001947 AC_MSG_RESULT(no)
1948 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001949esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001950
Guido van Rossumac405f61994-09-12 10:56:06 +00001951# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +00001952AC_SUBST(SO)
1953AC_SUBST(LDSHARED)
Tarek Ziadé00002952010-04-03 08:37:59 +00001954AC_SUBST(LDCXXSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001955AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001956AC_SUBST(CCSHARED)
1957AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001958# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +00001959# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001960AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +00001961if test -z "$SO"
1962then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001963 case $ac_sys_system in
Neal Norwitz58e28882006-05-19 07:00:58 +00001964 hp*|HP*)
1965 case `uname -m` in
1966 ia64) SO=.so;;
1967 *) SO=.sl;;
1968 esac
1969 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001970 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001971 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +00001972 esac
Martin v. Löwis368de8f2003-06-14 14:46:38 +00001973else
1974 # this might also be a termcap variable, see #610332
1975 echo
1976 echo '====================================================================='
1977 echo '+ +'
1978 echo '+ WARNING: You have set SO in your environment. +'
1979 echo '+ Do you really mean to change the extension for shared libraries? +'
1980 echo '+ Continuing in 10 seconds to let you to ponder. +'
1981 echo '+ +'
1982 echo '====================================================================='
1983 sleep 10
Guido van Rossumac405f61994-09-12 10:56:06 +00001984fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001985AC_MSG_RESULT($SO)
Ronald Oussoren79f90492009-01-02 10:44:46 +00001986
Neal Norwitz58e28882006-05-19 07:00:58 +00001987AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
Guido van Rossumac405f61994-09-12 10:56:06 +00001988# LDSHARED is the ld *command* used to create shared library
Skip Montanaroce59c042004-01-17 14:19:44 +00001989# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001990# (Shared libraries in this instance are shared modules to be loaded into
1991# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001992AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001993if test -z "$LDSHARED"
1994then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001995 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001996 AIX*)
Georg Brandl71f4fbb2011-02-25 11:04:50 +00001997 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
Guido van Rossumce608b02001-09-28 15:59:38 +00001998 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001999 ;;
2000 BeOS*)
2001 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +00002002 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00002003 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +00002004 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +00002005 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Greg Ward57c9a662000-05-26 12:22:54 +00002006 SunOS/5*)
Tarek Ziadé00002952010-04-03 08:37:59 +00002007 if test "$GCC" = "yes" ; then
2008 LDSHARED='$(CC) -shared'
2009 LDCXXSHARED='$(CXX) -shared'
2010 else
2011 LDSHARED='$(CC) -G'
2012 LDCXXSHARED='$(CXX) -G'
Greg Ward57c9a662000-05-26 12:22:54 +00002013 fi ;;
Thomas Hellerdc96a772008-04-04 10:07:55 +00002014 hp*|HP*)
Tarek Ziadé00002952010-04-03 08:37:59 +00002015 if test "$GCC" = "yes" ; then
2016 LDSHARED='$(CC) -shared'
2017 LDCXXSHARED='$(CXX) -shared'
2018 else
2019 LDSHARED='ld -b'
Thomas Hellerdc96a772008-04-04 10:07:55 +00002020 fi ;;
Guido van Rossum71001e41995-01-26 00:44:03 +00002021 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Jack Jansen418c3b12001-11-14 10:59:57 +00002022 Darwin/1.3*)
Stefan Krah3a3e2032010-11-28 15:30:05 +00002023 LDSHARED='$(CC) -bundle'
2024 LDCXXSHARED='$(CXX) -bundle'
Jack Jansena3891ea2001-09-07 14:25:12 +00002025 if test "$enable_framework" ; then
2026 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00002027 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2028 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00002029 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00002030 else
2031 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +00002032 LDSHARED="$LDSHARED -undefined suppress"
Tarek Ziadé00002952010-04-03 08:37:59 +00002033 LDCXXSHARED="$LDCXXSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +00002034 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00002035 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
Stefan Krah3a3e2032010-11-28 15:30:05 +00002036 LDSHARED='$(CC) -bundle'
2037 LDCXXSHARED='$(CXX) -bundle'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002038 if test "$enable_framework" ; then
2039 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00002040 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2041 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00002042 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002043 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +00002044 # No framework, use the Python app as bundle-loader
2045 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
Jack Jansenc28fc372003-02-25 13:14:43 +00002046 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Tarek Ziadé00002952010-04-03 08:37:59 +00002047 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00002048 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00002049 Darwin/*)
2050 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
2051 # This allows an extension to be used in any Python
Ronald Oussoren38f1b982007-09-02 09:46:07 +00002052
Ned Deilyc40b9032014-06-25 13:48:46 -07002053 dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
2054 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
2055 dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
2056 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
2057 if test ${dep_target_major} -eq 10 && \
2058 test ${dep_target_minor} -le 2
Jack Jansen6b08a402004-06-03 12:41:45 +00002059 then
Ned Deilyc40b9032014-06-25 13:48:46 -07002060 # building for OS X 10.0 through 10.2
Stefan Krah3a3e2032010-11-28 15:30:05 +00002061 LDSHARED='$(CC) -bundle'
2062 LDCXXSHARED='$(CXX) -bundle'
Jack Jansen6b08a402004-06-03 12:41:45 +00002063 if test "$enable_framework" ; then
2064 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00002065 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2066 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00002067 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen6b08a402004-06-03 12:41:45 +00002068 else
2069 # No framework, use the Python app as bundle-loader
2070 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
2071 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Tarek Ziadé00002952010-04-03 08:37:59 +00002072 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Jack Jansen6b08a402004-06-03 12:41:45 +00002073 fi
Ned Deilyc40b9032014-06-25 13:48:46 -07002074 else
2075 # building for OS X 10.3 and later
2076 if test "${enable_universalsdk}"; then
2077 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
2078 fi
2079 LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
2080 LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
2081 BLDSHARED="$LDSHARED"
Jack Jansen6b08a402004-06-03 12:41:45 +00002082 fi
2083 ;;
Tarek Ziadé00002952010-04-03 08:37:59 +00002084 Linux*|GNU*|QNX*)
2085 LDSHARED='$(CC) -shared'
2086 LDCXXSHARED='$(CXX) -shared';;
2087 BSD/OS*/4*)
2088 LDSHARED="gcc -shared"
2089 LDCXXSHARED="g++ -shared";;
Martin v. Löwis222c5152006-06-03 07:37:13 +00002090 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +00002091 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +00002092 then
Stefan Krah3a3e2032010-11-28 15:30:05 +00002093 LDSHARED='$(CC) -shared'
2094 LDCXXSHARED='$(CXX) -shared'
Guido van Rossum0286ae82000-08-29 15:06:49 +00002095 else
Stefan Krah3a3e2032010-11-28 15:30:05 +00002096 LDSHARED="ld -Bshareable"
Guido van Rossum0286ae82000-08-29 15:06:49 +00002097 fi;;
Martin v. Löwis222c5152006-06-03 07:37:13 +00002098 OpenBSD*)
2099 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
2100 then
Stefan Krah3a3e2032010-11-28 15:30:05 +00002101 LDSHARED='$(CC) -shared $(CCSHARED)'
2102 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
Martin v. Löwis222c5152006-06-03 07:37:13 +00002103 else
2104 case `uname -r` in
2105 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
2106 LDSHARED="ld -Bshareable ${LDFLAGS}"
2107 ;;
2108 *)
Stefan Krah3a3e2032010-11-28 15:30:05 +00002109 LDSHARED='$(CC) -shared $(CCSHARED)'
2110 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
Martin v. Löwis222c5152006-06-03 07:37:13 +00002111 ;;
2112 esac
2113 fi;;
Tarek Ziadé00002952010-04-03 08:37:59 +00002114 NetBSD*|DragonFly*)
Antoine Pitroucb402772011-01-02 20:51:34 +00002115 LDSHARED='$(CC) -shared'
2116 LDCXXSHARED='$(CXX) -shared';;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00002117 OpenUNIX*|UnixWare*)
Tarek Ziadé00002952010-04-03 08:37:59 +00002118 if test "$GCC" = "yes" ; then
2119 LDSHARED='$(CC) -shared'
2120 LDCXXSHARED='$(CXX) -shared'
2121 else
2122 LDSHARED='$(CC) -G'
2123 LDCXXSHARED='$(CXX) -G'
Martin v. Löwisbec19582001-03-21 15:57:54 +00002124 fi;;
Tarek Ziadé00002952010-04-03 08:37:59 +00002125 SCO_SV*)
2126 LDSHARED='$(CC) -Wl,-G,-Bexport'
2127 LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
2128 CYGWIN*)
2129 LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
2130 LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
2131 atheos*)
2132 LDSHARED="gcc -shared"
2133 LDCXXSHARED="g++ -shared";;
Guido van Rossumac405f61994-09-12 10:56:06 +00002134 *) LDSHARED="ld";;
2135 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00002136fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002137AC_MSG_RESULT($LDSHARED)
Tarek Ziadé00002952010-04-03 08:37:59 +00002138LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
Neil Schemenauerb3531b82001-02-16 04:09:05 +00002139BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +00002140# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00002141# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002142AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00002143if test -z "$CCSHARED"
2144then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00002145 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +00002146 SunOS*) if test "$GCC" = yes;
Martin v. Löwiseb623572007-03-12 10:50:39 +00002147 then CCSHARED="-fPIC";
2148 elif test `uname -p` = sparc;
2149 then CCSHARED="-xcode=pic32";
2150 else CCSHARED="-Kpic";
2151 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +00002152 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +00002153 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +00002154 else CCSHARED="+z";
2155 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002156 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00002157 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00002158 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00002159 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00002160 if test "$GCC" = "yes"
2161 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +00002162 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +00002163 fi;;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00002164 SCO_SV*)
2165 if test "$GCC" = "yes"
2166 then CCSHARED="-fPIC"
2167 else CCSHARED="-Kpic -belf"
2168 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00002169 IRIX*/6*) case $CC in
2170 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +00002171 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00002172 esac;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002173 atheos*) CCSHARED="-fPIC";;
Guido van Rossumac405f61994-09-12 10:56:06 +00002174 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00002175fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002176AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00002177# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +00002178# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002179AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00002180if test -z "$LINKFORSHARED"
2181then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00002182 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00002183 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +00002184 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +00002185 LINKFORSHARED="-Wl,-E -Wl,+s";;
2186# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00002187 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002188 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00002189 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002190 Darwin/*)
Raymond Hettingerec6eb362004-11-05 07:02:59 +00002191 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
2192 # which is
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002193 # not used by the core itself but which needs to be in the core so
2194 # that dynamically loaded extension modules have access to it.
Jack Jansen97e3f002003-02-23 22:59:01 +00002195 # -prebind is no longer used, because it actually seems to give a
2196 # slowdown in stead of a speedup, maybe due to the large number of
2197 # dynamic loads Python does.
Raymond Hettingerec6eb362004-11-05 07:02:59 +00002198
2199 LINKFORSHARED="$extra_undefs"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002200 if test "$enable_framework"
2201 then
Jack Jansenda49e192005-01-07 13:08:22 +00002202 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002203 fi
Raymond Hettingerec6eb362004-11-05 07:02:59 +00002204 LINKFORSHARED="$LINKFORSHARED";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00002205 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00002206 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +00002207 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00002208 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
Guido van Rossumdf693651999-01-07 21:50:41 +00002209 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
2210 then
2211 LINKFORSHARED="-Wl,--export-dynamic"
2212 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00002213 SunOS/5*) case $CC in
2214 *gcc*)
Martin v. Löwisa4548572002-04-18 14:51:36 +00002215 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +00002216 then
2217 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +00002218 fi;;
2219 esac;;
Jason Tishler30765592003-09-04 11:04:06 +00002220 CYGWIN*)
2221 if test $enable_shared = "no"
2222 then
2223 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
2224 fi;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +00002225 QNX*)
2226 # -Wl,-E causes the symbols to be added to the dynamic
2227 # symbol table so that they can be found when a module
2228 # is loaded. -N 2048K causes the stack size to be set
2229 # to 2048 kilobytes so that the stack doesn't overflow
2230 # when running test_compile.py.
2231 LINKFORSHARED='-Wl,-E -N 2048K';;
Guido van Rossumac405f61994-09-12 10:56:06 +00002232 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00002233fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002234AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00002235
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002236
Neil Schemenauer61c51152001-01-26 16:18:16 +00002237AC_SUBST(CFLAGSFORSHARED)
2238AC_MSG_CHECKING(CFLAGSFORSHARED)
2239if test ! "$LIBRARY" = "$LDLIBRARY"
2240then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +00002241 case $ac_sys_system in
2242 CYGWIN*)
2243 # Cygwin needs CCSHARED when building extension DLLs
2244 # but not when building the interpreter DLL.
2245 CFLAGSFORSHARED='';;
2246 *)
2247 CFLAGSFORSHARED='$(CCSHARED)'
2248 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +00002249fi
2250AC_MSG_RESULT($CFLAGSFORSHARED)
2251
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002252# SHLIBS are libraries (except -lc and -lm) to link to the python shared
2253# library (with --enable-shared).
2254# For platforms on which shared libraries are not allowed to have unresolved
Martin v. Löwisd6359c52002-08-04 12:38:50 +00002255# symbols, this must be set to $(LIBS) (expanded by make). We do this even
2256# if it is not required, since it creates a dependency of the shared library
2257# to LIBS. This, in turn, means that applications linking the shared libpython
2258# don't need to link LIBS explicitly. The default should be only changed
2259# on systems where this approach causes problems.
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002260AC_SUBST(SHLIBS)
2261AC_MSG_CHECKING(SHLIBS)
2262case "$ac_sys_system" in
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002263 *)
Martin v. Löwisd6359c52002-08-04 12:38:50 +00002264 SHLIBS='$(LIBS)';;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002265esac
2266AC_MSG_RESULT($SHLIBS)
2267
2268
Guido van Rossum627b2d71993-12-24 10:39:16 +00002269# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002270AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
2271AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Victor Stinner7c906672015-01-06 13:53:37 +01002272AC_CHECK_LIB(crypto, RAND_egd,
2273 AC_DEFINE(HAVE_RAND_EGD, 1,
2274 [Define if the libcrypto has RAND_egd]))
Martin v. Löwis519adae2003-09-20 10:47:47 +00002275
Skip Montanaro4d756af2008-12-01 01:55:22 +00002276# only check for sem_init if thread support is requested
Martin v. Löwis519adae2003-09-20 10:47:47 +00002277if test "$with_threads" = "yes" -o -z "$with_threads"; then
2278 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
2279 # posix4 on Solaris 2.6
2280 # pthread (first!) on Linux
2281fi
2282
Martin v. Löwis19d17342003-06-14 21:03:05 +00002283# check if we need libintl for locale functions
2284AC_CHECK_LIB(intl, textdomain,
2285 AC_DEFINE(WITH_LIBINTL, 1,
2286 [Define to 1 if libintl is needed for locale functions.]))
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002287
2288# checks for system dependent C++ extensions support
2289case "$ac_sys_system" in
2290 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
Matthias Klosec511b472010-05-08 11:01:39 +00002291 AC_LINK_IFELSE([
Georg Brandl94800df2011-02-25 11:09:02 +00002292 AC_LANG_PROGRAM([[#include <load.h>]],
Matthias Klosec511b472010-05-08 11:01:39 +00002293 [[loadAndInit("", 0, "")]])
2294 ],[
2295 AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002296 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
2297 and you want support for AIX C++ shared extension modules.])
Matthias Klosec511b472010-05-08 11:01:39 +00002298 AC_MSG_RESULT(yes)
2299 ],[
2300 AC_MSG_RESULT(no)
2301 ]);;
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002302 *) ;;
2303esac
2304
Guido van Rossum70c7f481998-03-26 18:44:10 +00002305# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002306# BeOS' sockets are stashed in libnet.
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002307AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002308AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Skip Montanarob9949db2004-01-17 04:04:13 +00002309
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00002310case "$ac_sys_system" in
2311BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002312AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
2313;;
2314esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00002315
Guido van Rossumc5a39031996-07-31 17:35:03 +00002316AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002317AC_ARG_WITH(libs,
Matthias Klose22520ea2010-05-08 10:14:46 +00002318 AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002319[
Guido van Rossumc5a39031996-07-31 17:35:03 +00002320AC_MSG_RESULT($withval)
2321LIBS="$withval $LIBS"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002322],
2323[AC_MSG_RESULT(no)])
Guido van Rossum627b2d71993-12-24 10:39:16 +00002324
Benjamin Peterson64e8f6e2014-12-15 00:00:23 -05002325PKG_PROG_PKG_CONFIG
Benjamin Petersone9e07bf2010-03-09 21:46:54 +00002326
Benjamin Peterson2c196742009-12-31 03:17:18 +00002327# Check for use of the system expat library
2328AC_MSG_CHECKING(for --with-system-expat)
2329AC_ARG_WITH(system_expat,
Benjamin Petersonf2d1b2a2010-10-31 16:53:53 +00002330 AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
2331 [],
2332 [with_system_expat="no"])
Benjamin Peterson2c196742009-12-31 03:17:18 +00002333
2334AC_MSG_RESULT($with_system_expat)
2335
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002336# Check for use of the system libffi library
2337AC_MSG_CHECKING(for --with-system-ffi)
2338AC_ARG_WITH(system_ffi,
Benjamin Petersonf2d1b2a2010-10-31 16:53:53 +00002339 AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),
2340 [],
2341 [with_system_ffi="no"])
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002342
Benjamin Petersone9e07bf2010-03-09 21:46:54 +00002343if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
Benjamin Peterson1c335e62010-01-01 15:16:29 +00002344 LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
2345else
2346 LIBFFI_INCLUDEDIR=""
2347fi
2348AC_SUBST(LIBFFI_INCLUDEDIR)
2349
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002350AC_MSG_RESULT($with_system_ffi)
2351
Ned Deilya2a9f572013-10-25 00:30:10 -07002352# Check for --with-tcltk-includes=path and --with-tcltk-libs=path
2353AC_SUBST(TCLTK_INCLUDES)
2354AC_SUBST(TCLTK_LIBS)
2355AC_MSG_CHECKING(for --with-tcltk-includes)
2356AC_ARG_WITH(tcltk-includes,
2357 AS_HELP_STRING([--with-tcltk-includes='-I...'], [override search for Tcl and Tk include files]),
2358 [],
2359 [with_tcltk_includes="default"])
2360AC_MSG_RESULT($with_tcltk_includes)
2361AC_MSG_CHECKING(for --with-tcltk-libs)
2362AC_ARG_WITH(tcltk-libs,
2363 AS_HELP_STRING([--with-tcltk-libs='-L...'], [override search for Tcl and Tk libs]),
2364 [],
2365 [with_tcltk_libs="default"])
2366AC_MSG_RESULT($with_tcltk_libs)
2367if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault
2368then
2369 if test "x$with_tcltk_includes" != "x$with_tcltk_libs"
2370 then
2371 AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither])
2372 fi
2373 TCLTK_INCLUDES=""
2374 TCLTK_LIBS=""
2375else
2376 TCLTK_INCLUDES="$with_tcltk_includes"
2377 TCLTK_LIBS="$with_tcltk_libs"
2378fi
2379
Matthias Klose10cbe482009-04-29 17:18:19 +00002380# Check for --with-dbmliborder
2381AC_MSG_CHECKING(for --with-dbmliborder)
2382AC_ARG_WITH(dbmliborder,
Matthias Klose22520ea2010-05-08 10:14:46 +00002383 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 +00002384[
2385if test x$with_dbmliborder = xyes
2386then
2387AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2388else
2389 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
2390 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
2391 then
2392 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2393 fi
2394 done
Matthias Klose61dbdb92009-04-29 20:09:50 +00002395fi])
2396AC_MSG_RESULT($with_dbmliborder)
Matthias Klose10cbe482009-04-29 17:18:19 +00002397
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002398# Determine if signalmodule should be used.
2399AC_SUBST(USE_SIGNAL_MODULE)
2400AC_SUBST(SIGNAL_OBJS)
2401AC_MSG_CHECKING(for --with-signal-module)
2402AC_ARG_WITH(signal-module,
Matthias Klose22520ea2010-05-08 10:14:46 +00002403 AS_HELP_STRING([--with-signal-module], [disable/enable signal module]))
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002404
2405if test -z "$with_signal_module"
2406then with_signal_module="yes"
2407fi
2408AC_MSG_RESULT($with_signal_module)
2409
2410if test "${with_signal_module}" = "yes"; then
2411 USE_SIGNAL_MODULE=""
2412 SIGNAL_OBJS=""
2413else
2414 USE_SIGNAL_MODULE="#"
2415 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2416fi
2417
Guido van Rossum3d15bd82001-01-10 18:53:48 +00002418# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00002419AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002420USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00002421
Guido van Rossum54d93d41997-01-22 20:51:58 +00002422AC_MSG_CHECKING(for --with-dec-threads)
2423AC_SUBST(LDLAST)
2424AC_ARG_WITH(dec-threads,
Matthias Klose22520ea2010-05-08 10:14:46 +00002425 AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002426[
Barry Warsawc0d24d82000-06-29 16:12:00 +00002427AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00002428LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00002429if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00002430 with_thread="$withval";
2431fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002432[AC_MSG_RESULT(no)])
Guido van Rossum54d93d41997-01-22 20:51:58 +00002433
Martin v. Löwis11437992002-04-12 09:54:03 +00002434# Templates for things AC_DEFINEd more than once.
2435# For a single AC_DEFINE, no template is needed.
2436AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2437AH_TEMPLATE(_REENTRANT,
2438 [Define to force use of thread-safe errno, h_errno, and other functions])
2439AH_TEMPLATE(WITH_THREAD,
2440 [Define if you want to compile in rudimentary thread support])
2441
Guido van Rossum54d93d41997-01-22 20:51:58 +00002442AC_MSG_CHECKING(for --with-threads)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002443dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawc0d24d82000-06-29 16:12:00 +00002444AC_ARG_WITH(threads,
Matthias Klose22520ea2010-05-08 10:14:46 +00002445 AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support]))
Guido van Rossum54d93d41997-01-22 20:51:58 +00002446
Barry Warsawc0d24d82000-06-29 16:12:00 +00002447# --with-thread is deprecated, but check for it anyway
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002448dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00002449AC_ARG_WITH(thread,
Matthias Klose22520ea2010-05-08 10:14:46 +00002450 AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002451 [with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002452
2453if test -z "$with_threads"
2454then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002455fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00002456AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00002457
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002458AC_SUBST(THREADOBJ)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002459if test "$with_threads" = "no"
2460then
2461 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002462elif test "$ac_cv_pthread_is_default" = yes
2463then
2464 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002465 # Defining _REENTRANT on system with POSIX threads should not hurt.
2466 AC_DEFINE(_REENTRANT)
2467 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002468 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00002469elif test "$ac_cv_kpthread" = "yes"
2470then
2471 CC="$CC -Kpthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002472 if test "$ac_cv_cxx_thread" = "yes"; then
2473 CXX="$CXX -Kpthread"
2474 fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00002475 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002476 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002477 THREADOBJ="Python/thread.o"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002478elif test "$ac_cv_kthread" = "yes"
2479then
2480 CC="$CC -Kthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002481 if test "$ac_cv_cxx_thread" = "yes"; then
2482 CXX="$CXX -Kthread"
2483 fi
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002484 AC_DEFINE(WITH_THREAD)
2485 posix_threads=yes
2486 THREADOBJ="Python/thread.o"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002487elif test "$ac_cv_pthread" = "yes"
2488then
2489 CC="$CC -pthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002490 if test "$ac_cv_cxx_thread" = "yes"; then
2491 CXX="$CXX -pthread"
2492 fi
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002493 AC_DEFINE(WITH_THREAD)
2494 posix_threads=yes
2495 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +00002496else
Martin v. Löwis130fb172001-07-19 11:00:41 +00002497 if test ! -z "$with_threads" -a -d "$with_threads"
2498 then LDFLAGS="$LDFLAGS -L$with_threads"
2499 fi
2500 if test ! -z "$withval" -a -d "$withval"
2501 then LDFLAGS="$LDFLAGS -L$withval"
2502 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002503
2504 # According to the POSIX spec, a pthreads implementation must
Matthias Klosea2542be2004-08-16 11:35:51 +00002505 # define _POSIX_THREADS in unistd.h. Some apparently don't
2506 # (e.g. gnu pth with pthread emulation)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002507 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2508 AC_EGREP_CPP(yes,
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002509 [
2510#include <unistd.h>
2511#ifdef _POSIX_THREADS
2512yes
2513#endif
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002514 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2515 AC_MSG_RESULT($unistd_defines_pthreads)
2516
Martin v. Löwis130fb172001-07-19 11:00:41 +00002517 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002518 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2519 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002520 AC_DEFINE(HURD_C_THREADS, 1,
2521 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002522 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002523 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002524 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2525 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002526 AC_DEFINE(MACH_C_THREADS, 1,
2527 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002528 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002529 AC_MSG_CHECKING(for --with-pth)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002530 AC_ARG_WITH([pth],
Matthias Klose22520ea2010-05-08 10:14:46 +00002531 AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002532 [AC_MSG_RESULT($withval)
2533 AC_DEFINE([WITH_THREAD])
2534 AC_DEFINE([HAVE_PTH], 1,
2535 [Define if you have GNU PTH threads.])
2536 LIBS="-lpth $LIBS"
2537 THREADOBJ="Python/thread.o"],
2538 [AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002539
2540 # Just looking for pthread_create in libpthread is not enough:
2541 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2542 # So we really have to include pthread.h, and then link.
2543 _libs=$LIBS
2544 LIBS="$LIBS -lpthread"
2545 AC_MSG_CHECKING([for pthread_create in -lpthread])
Stefan Krahae66ca62012-11-22 22:36:57 +01002546 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2547#include <stdio.h>
2548#include <pthread.h>
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002549
Matthias Klosec511b472010-05-08 11:01:39 +00002550void * start_routine (void *arg) { exit (0); }]], [[
2551pthread_create (NULL, NULL, start_routine, NULL)]])],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002552 AC_MSG_RESULT(yes)
2553 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002554 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002555 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002556 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00002557 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002558 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002559 THREADOBJ="Python/thread.o"],[
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002560 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2561 AC_DEFINE(ATHEOS_THREADS, 1,
2562 [Define this if you have AtheOS threads.])
2563 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002564 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002565 AC_DEFINE(BEOS_THREADS, 1,
2566 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002567 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002568 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002569 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002570 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002571 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002572 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002573 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002574 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002575 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002576 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002577 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002578 LIBS="$LIBS -lpthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002579 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002580 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002581 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002582 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002583 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002584 USE_THREAD_MODULE="#"])
Skip Montanarof8712e52004-01-17 03:04:46 +00002585 ])])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002586
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002587 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2588 LIBS="$LIBS -lmpc"
2589 THREADOBJ="Python/thread.o"
2590 USE_THREAD_MODULE=""])
2591
2592 if test "$posix_threads" != "yes"; then
2593 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2594 LIBS="$LIBS -lthread"
2595 THREADOBJ="Python/thread.o"
2596 USE_THREAD_MODULE=""])
2597 fi
2598
2599 if test "$USE_THREAD_MODULE" != "#"
2600 then
2601 # If the above checks didn't disable threads, (at least) OSF1
2602 # needs this '-threads' argument during linking.
2603 case $ac_sys_system in
2604 OSF1) LDLAST=-threads;;
2605 esac
2606 fi
2607fi
2608
2609if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002610 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002611 AC_DEFINE(_POSIX_THREADS, 1,
2612 [Define if you have POSIX threads,
2613 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002614 fi
2615
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002616 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2617 case $ac_sys_system/$ac_sys_release in
Charles-François Natali4929eb92011-07-21 19:41:04 +02002618 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002619 [Defined for Solaris 2.6 bug in pthread header.])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002620 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002621 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002622 [Define if the Posix semaphores do not work on your system])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002623 ;;
Charles-François Natali4929eb92011-07-21 19:41:04 +02002624 AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002625 [Define if the Posix semaphores do not work on your system])
Christian Heimescba36bb2008-01-30 22:54:18 +00002626 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002627 esac
2628
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002629 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2630 AC_CACHE_VAL(ac_cv_pthread_system_supported,
Stefan Krahae66ca62012-11-22 22:36:57 +01002631 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
2632 #include <stdio.h>
2633 #include <pthread.h>
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002634 void *foo(void *parm) {
2635 return NULL;
2636 }
2637 main() {
2638 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002639 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002640 if (pthread_attr_init(&attr)) exit(-1);
2641 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002642 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002643 exit(0);
Matthias Klosec511b472010-05-08 11:01:39 +00002644 }]])],
2645 [ac_cv_pthread_system_supported=yes],
2646 [ac_cv_pthread_system_supported=no],
2647 [ac_cv_pthread_system_supported=no])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002648 ])
2649 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2650 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002651 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002652 fi
Jason Tishlerfac083d2003-07-22 15:20:49 +00002653 AC_CHECK_FUNCS(pthread_sigmask,
2654 [case $ac_sys_system in
2655 CYGWIN*)
2656 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2657 [Define if pthread_sigmask() does not work on your system.])
2658 ;;
2659 esac])
Christian Heimes0d604cf2013-08-21 13:26:05 +02002660 AC_CHECK_FUNCS(pthread_atfork)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002661fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002662
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002663
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002664# Check for enable-ipv6
Martin v. Löwis11437992002-04-12 09:54:03 +00002665AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002666AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002667AC_ARG_ENABLE(ipv6,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002668[ --enable-ipv6 Enable ipv6 (with ipv4) support
2669 --disable-ipv6 Disable ipv6 support],
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002670[ case "$enableval" in
2671 no)
2672 AC_MSG_RESULT(no)
2673 ipv6=no
2674 ;;
2675 *) AC_MSG_RESULT(yes)
2676 AC_DEFINE(ENABLE_IPV6)
2677 ipv6=yes
2678 ;;
2679 esac ],
2680
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002681[
2682dnl the check does not work on cross compilation case...
Charles-François Natalibe2b9072013-01-08 19:47:00 +01002683 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* AF_INET6 available check */
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002684#include <sys/types.h>
Charles-François Natalibe2b9072013-01-08 19:47:00 +01002685#include <sys/socket.h>]],
2686[[int domain = AF_INET6;]])],[
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002687 AC_MSG_RESULT(yes)
Matthias Klosec511b472010-05-08 11:01:39 +00002688 ipv6=yes
2689],[
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002690 AC_MSG_RESULT(no)
2691 ipv6=no
Matthias Klosec511b472010-05-08 11:01:39 +00002692])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002693
2694if test "$ipv6" = "yes"; then
2695 AC_MSG_CHECKING(if RFC2553 API is available)
Matthias Klosec511b472010-05-08 11:01:39 +00002696 AC_COMPILE_IFELSE([
2697 AC_LANG_PROGRAM([[#include <sys/types.h>
2698#include <netinet/in.h>]],
2699 [[struct sockaddr_in6 x;
2700 x.sin6_scope_id;]])
2701 ],[
2702 AC_MSG_RESULT(yes)
2703 ipv6=yes
2704 ],[
2705 AC_MSG_RESULT(no, IPv6 disabled)
2706 ipv6=no
2707 ])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002708fi
2709
2710if test "$ipv6" = "yes"; then
2711 AC_DEFINE(ENABLE_IPV6)
2712fi
2713])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002714
2715ipv6type=unknown
2716ipv6lib=none
2717ipv6trylibc=no
2718
2719if test "$ipv6" = "yes"; then
2720 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00002721 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2722 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002723 case $i in
2724 inria)
2725 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002726 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002727#include <netinet/in.h>
2728#ifdef IPV6_INRIA_VERSION
2729yes
2730#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002731 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002732 ;;
2733 kame)
2734 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002735 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002736#include <netinet/in.h>
2737#ifdef __KAME__
2738yes
2739#endif],
2740 [ipv6type=$i;
2741 ipv6lib=inet6
2742 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002743 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002744 ;;
2745 linux-glibc)
2746 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002747 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002748#include <features.h>
2749#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2750yes
2751#endif],
2752 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002753 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002754 ;;
2755 linux-inet6)
2756 dnl http://www.v6.linux.or.jp/
2757 if test -d /usr/inet6; then
2758 ipv6type=$i
2759 ipv6lib=inet6
2760 ipv6libdir=/usr/inet6/lib
Skip Montanarodecc6a42003-01-01 20:07:49 +00002761 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002762 fi
2763 ;;
2764 solaris)
2765 if test -f /etc/netconfig; then
Antoine Pitrou31e85952011-01-03 18:57:14 +00002766 if $GREP -q tcp6 /etc/netconfig; then
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002767 ipv6type=$i
2768 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002769 fi
2770 fi
2771 ;;
2772 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002773 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002774#include <sys/param.h>
2775#ifdef _TOSHIBA_INET6
2776yes
2777#endif],
2778 [ipv6type=$i;
2779 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002780 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002781 ;;
2782 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002783 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002784#include </usr/local/v6/include/sys/v6config.h>
2785#ifdef __V6D__
2786yes
2787#endif],
2788 [ipv6type=$i;
2789 ipv6lib=v6;
2790 ipv6libdir=/usr/local/v6/lib;
Skip Montanarodecc6a42003-01-01 20:07:49 +00002791 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002792 ;;
2793 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002794 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002795#include <sys/param.h>
2796#ifdef _ZETA_MINAMI_INET6
2797yes
2798#endif],
2799 [ipv6type=$i;
2800 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002801 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002802 ;;
2803 esac
2804 if test "$ipv6type" != "unknown"; then
2805 break
2806 fi
2807 done
2808 AC_MSG_RESULT($ipv6type)
2809fi
2810
2811if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2812 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2813 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2814 echo "using lib$ipv6lib"
2815 else
2816 if test $ipv6trylibc = "yes"; then
2817 echo "using libc"
2818 else
2819 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2820 echo "You need to fetch lib$ipv6lib.a from appropriate"
2821 echo 'ipv6 kit and compile beforehand.'
2822 exit 1
2823 fi
2824 fi
2825fi
2826
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002827AC_MSG_CHECKING(for OSX 10.5 SDK or later)
Matthias Klosec511b472010-05-08 11:01:39 +00002828AC_COMPILE_IFELSE([
Mark Dickinson0712b562010-05-08 19:13:21 +00002829 AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
Matthias Klosec511b472010-05-08 11:01:39 +00002830],[
Matthias Klose5183ebd2010-04-24 16:38:36 +00002831 AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.])
Matthias Klosec511b472010-05-08 11:01:39 +00002832 AC_MSG_RESULT(yes)
2833],[
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002834 AC_MSG_RESULT(no)
Matthias Klosec511b472010-05-08 11:01:39 +00002835])
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002836
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002837# Check for --with-doc-strings
2838AC_MSG_CHECKING(for --with-doc-strings)
2839AC_ARG_WITH(doc-strings,
Matthias Klose22520ea2010-05-08 10:14:46 +00002840 AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings]))
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002841
2842if test -z "$with_doc_strings"
2843then with_doc_strings="yes"
2844fi
2845if test "$with_doc_strings" != "no"
2846then
2847 AC_DEFINE(WITH_DOC_STRINGS, 1,
2848 [Define if you want documentation strings in extension modules])
2849fi
2850AC_MSG_RESULT($with_doc_strings)
2851
Neil Schemenauera35c6882001-02-27 04:45:05 +00002852# Check for Python-specific malloc support
Martin v. Löwisf30d60e2004-06-08 08:17:44 +00002853AC_MSG_CHECKING(for --with-tsc)
2854AC_ARG_WITH(tsc,
Matthias Klose22520ea2010-05-08 10:14:46 +00002855 AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[
Martin v. Löwisf30d60e2004-06-08 08:17:44 +00002856if test "$withval" != no
2857then
2858 AC_DEFINE(WITH_TSC, 1,
2859 [Define to profile with the Pentium timestamp counter])
2860 AC_MSG_RESULT(yes)
2861else AC_MSG_RESULT(no)
2862fi],
2863[AC_MSG_RESULT(no)])
2864
2865# Check for Python-specific malloc support
Neil Schemenauera35c6882001-02-27 04:45:05 +00002866AC_MSG_CHECKING(for --with-pymalloc)
2867AC_ARG_WITH(pymalloc,
Matthias Klose22520ea2010-05-08 10:14:46 +00002868 AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs]))
Neil Schemenauer16c22972002-03-22 15:34:49 +00002869
2870if test -z "$with_pymalloc"
2871then with_pymalloc="yes"
2872fi
2873if test "$with_pymalloc" != "no"
2874then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002875 AC_DEFINE(WITH_PYMALLOC, 1,
2876 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00002877fi
2878AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00002879
Benjamin Peterson91c12eb2009-12-03 02:52:39 +00002880# Check for Valgrind support
2881AC_MSG_CHECKING([for --with-valgrind])
2882AC_ARG_WITH([valgrind],
Matthias Klose22520ea2010-05-08 10:14:46 +00002883 AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
Benjamin Peterson91c12eb2009-12-03 02:52:39 +00002884 with_valgrind=no)
2885AC_MSG_RESULT([$with_valgrind])
2886if test "$with_valgrind" != no; then
2887 AC_CHECK_HEADER([valgrind/valgrind.h],
2888 [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
2889 [AC_MSG_ERROR([Valgrind support requested but headers not available])]
2890 )
2891fi
2892
Barry Warsawef82cd72000-06-30 16:21:01 +00002893# Check for --with-wctype-functions
2894AC_MSG_CHECKING(for --with-wctype-functions)
2895AC_ARG_WITH(wctype-functions,
Matthias Klose22520ea2010-05-08 10:14:46 +00002896 AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002897[
Barry Warsawef82cd72000-06-30 16:21:01 +00002898if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002899then
2900 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2901 [Define if you want wctype.h functions to be used instead of the
2902 one supplied by Python itself. (see Include/unicodectype.h).])
2903 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00002904else AC_MSG_RESULT(no)
2905fi],
2906[AC_MSG_RESULT(no)])
2907
Guido van Rossum68242b51996-05-28 22:53:03 +00002908# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002909AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00002910DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002911
Guido van Rossume97ee181999-12-20 21:27:22 +00002912# the dlopen() function means we might want to use dynload_shlib.o. some
2913# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00002914AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00002915
2916# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2917# loading of modules.
2918AC_SUBST(DYNLOADFILE)
2919AC_MSG_CHECKING(DYNLOADFILE)
2920if test -z "$DYNLOADFILE"
2921then
2922 case $ac_sys_system/$ac_sys_release in
Martin v. Löwisc19c5a62003-11-18 20:00:44 +00002923 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2924 if test "$ac_cv_func_dlopen" = yes
2925 then DYNLOADFILE="dynload_shlib.o"
2926 else DYNLOADFILE="dynload_aix.o"
2927 fi
2928 ;;
Guido van Rossume97ee181999-12-20 21:27:22 +00002929 BeOS*) DYNLOADFILE="dynload_beos.o";;
2930 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Anthony Baxter82201742006-04-09 15:07:40 +00002931 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2932 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002933 atheos*) DYNLOADFILE="dynload_atheos.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00002934 *)
2935 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2936 # out any dynamic loading
2937 if test "$ac_cv_func_dlopen" = yes
2938 then DYNLOADFILE="dynload_shlib.o"
2939 else DYNLOADFILE="dynload_stub.o"
2940 fi
2941 ;;
2942 esac
2943fi
2944AC_MSG_RESULT($DYNLOADFILE)
2945if test "$DYNLOADFILE" != "dynload_stub.o"
2946then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002947 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2948 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00002949fi
2950
Jack Jansenc49e5b72001-06-19 15:00:23 +00002951# MACHDEP_OBJS can be set to platform-specific object files needed by Python
2952
2953AC_SUBST(MACHDEP_OBJS)
2954AC_MSG_CHECKING(MACHDEP_OBJS)
2955if test -z "$MACHDEP_OBJS"
2956then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002957 MACHDEP_OBJS=$extra_machdep_objs
2958else
2959 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00002960fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002961AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00002962
Guido van Rossum627b2d71993-12-24 10:39:16 +00002963# checks for library functions
Martin v. Löwisaef18b12008-03-24 13:31:16 +00002964AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2965 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
Martin v. Löwis438b5342002-12-27 10:16:42 +00002966 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
Benjamin Peterson27c269a2014-12-26 11:09:00 -06002967 getentropy \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00002968 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
Benjamin Petersond16e01c2014-02-04 10:20:26 -05002969 initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime mmap \
Martin v. Löwisa5f09072002-10-11 05:37:59 +00002970 mremap nice pathconf pause plock poll pthread_init \
Guido van Rossum162e38c2003-02-19 15:25:10 +00002971 putenv readlink realpath \
Jesse Noller355b1262009-04-02 00:03:28 +00002972 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
2973 setgid \
Martin v. Löwis4daacb12003-03-28 18:37:01 +00002974 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00002975 setlocale setregid setreuid setresuid setresgid \
2976 setsid setpgid setpgrp setuid setvbuf snprintf \
Skip Montanaro7e11a012004-02-07 12:55:46 +00002977 sigaction siginterrupt sigrelse strftime \
Michael W. Hudson34f20ea2002-05-27 15:08:24 +00002978 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Neal Norwitz05a45592006-03-20 06:30:08 +00002979 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00002980
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002981# For some functions, having a definition is not sufficient, since
2982# we want to take their address.
2983AC_MSG_CHECKING(for chroot)
Matthias Klosec511b472010-05-08 11:01:39 +00002984AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])],
2985 [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2986 AC_MSG_RESULT(yes)],
2987 [AC_MSG_RESULT(no)
2988])
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002989AC_MSG_CHECKING(for link)
Matthias Klosec511b472010-05-08 11:01:39 +00002990AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])],
2991 [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2992 AC_MSG_RESULT(yes)],
2993 [AC_MSG_RESULT(no)
2994])
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002995AC_MSG_CHECKING(for symlink)
Matthias Klosec511b472010-05-08 11:01:39 +00002996AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])],
2997 [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2998 AC_MSG_RESULT(yes)],
2999 [AC_MSG_RESULT(no)
3000])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00003001AC_MSG_CHECKING(for fchdir)
Matthias Klosec511b472010-05-08 11:01:39 +00003002AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])],
3003 [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
3004 AC_MSG_RESULT(yes)],
3005 [AC_MSG_RESULT(no)
3006])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00003007AC_MSG_CHECKING(for fsync)
Matthias Klosec511b472010-05-08 11:01:39 +00003008AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])],
3009 [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
3010 AC_MSG_RESULT(yes)],
3011 [AC_MSG_RESULT(no)
3012])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00003013AC_MSG_CHECKING(for fdatasync)
Matthias Klosec511b472010-05-08 11:01:39 +00003014AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])],
3015 [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
3016 AC_MSG_RESULT(yes)],
3017 [AC_MSG_RESULT(no)
3018])
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00003019AC_MSG_CHECKING(for epoll)
Matthias Klosec511b472010-05-08 11:01:39 +00003020AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])],
3021 [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
3022 AC_MSG_RESULT(yes)],
3023 [AC_MSG_RESULT(no)
3024])
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00003025AC_MSG_CHECKING(for kqueue)
Matthias Klosec511b472010-05-08 11:01:39 +00003026AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00003027#include <sys/types.h>
3028#include <sys/event.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003029 ]], [[int x=kqueue()]])],
3030 [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
3031 AC_MSG_RESULT(yes)],
3032 [AC_MSG_RESULT(no)
3033])
Martin v. Löwisd5843682002-11-21 20:41:28 +00003034# On some systems (eg. FreeBSD 5), we would find a definition of the
3035# functions ctermid_r, setgroups in the library, but no prototype
3036# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
3037# address to avoid compiler warnings and potential miscompilations
3038# because of the missing prototypes.
3039
3040AC_MSG_CHECKING(for ctermid_r)
Matthias Klosec511b472010-05-08 11:01:39 +00003041AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisd5843682002-11-21 20:41:28 +00003042#include <stdio.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003043]], [[void* p = ctermid_r]])],
3044 [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
3045 AC_MSG_RESULT(yes)],
3046 [AC_MSG_RESULT(no)
3047])
Martin v. Löwisd5843682002-11-21 20:41:28 +00003048
Antoine Pitroub170f172010-09-10 18:47:36 +00003049AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl],
3050 [AC_COMPILE_IFELSE(
3051 [AC_LANG_PROGRAM(
3052 [#include <sys/file.h>],
3053 [void* p = flock]
3054 )],
3055 [ac_cv_flock_decl=yes],
3056 [ac_cv_flock_decl=no]
3057 )
Matthias Klosec511b472010-05-08 11:01:39 +00003058])
Antoine Pitroub170f172010-09-10 18:47:36 +00003059if test "x${ac_cv_flock_decl}" = xyes; then
3060 AC_CHECK_FUNCS(flock,,
3061 AC_CHECK_LIB(bsd,flock,
3062 [AC_DEFINE(HAVE_FLOCK)
3063 AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
3064 ])
3065 )
Antoine Pitrou85729812010-09-07 14:55:24 +00003066fi
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00003067
3068AC_MSG_CHECKING(for getpagesize)
Matthias Klosec511b472010-05-08 11:01:39 +00003069AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00003070#include <unistd.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003071]], [[void* p = getpagesize]])],
3072 [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
3073 AC_MSG_RESULT(yes)],
3074 [AC_MSG_RESULT(no)
3075])
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00003076
Charles-François Natali93a11752011-11-27 13:01:35 +01003077AC_MSG_CHECKING(for broken unsetenv)
3078AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3079#include <stdlib.h>
3080]], [[int res = unsetenv("DUMMY")]])],
3081 [AC_MSG_RESULT(no)],
3082 [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.)
3083 AC_MSG_RESULT(yes)
3084])
3085
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00003086dnl check for true
3087AC_CHECK_PROGS(TRUE, true, /bin/true)
3088
Martin v. Löwis95c419b2003-05-03 12:10:48 +00003089dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
3090dnl On others, they are in the C library, so we to take no action
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00003091AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
Martin v. Löwis95c419b2003-05-03 12:10:48 +00003092 AC_CHECK_LIB(resolv, inet_aton)
3093)
3094
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00003095# On Tru64, chflags seems to be present, but calling it will
3096# exit Python
Gregory P. Smithbb213892009-11-02 01:37:37 +00003097AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
Ned Deily43e10542011-06-27 23:41:53 -07003098AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00003099#include <sys/stat.h>
3100#include <unistd.h>
3101int main(int argc, char*argv[])
3102{
3103 if(chflags(argv[0], 0) != 0)
3104 return 1;
3105 return 0;
3106}
Ned Deily43e10542011-06-27 23:41:53 -07003107]])],
Matthias Klosec511b472010-05-08 11:01:39 +00003108[ac_cv_have_chflags=yes],
3109[ac_cv_have_chflags=no],
3110[ac_cv_have_chflags=cross])
Gregory P. Smithbb213892009-11-02 01:37:37 +00003111])
3112if test "$ac_cv_have_chflags" = cross ; then
3113 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
3114fi
3115if test "$ac_cv_have_chflags" = yes ; then
Ned Deily43e10542011-06-27 23:41:53 -07003116 AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the 'chflags' function.])
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003117fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00003118
Gregory P. Smithbb213892009-11-02 01:37:37 +00003119AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
Ned Deily43e10542011-06-27 23:41:53 -07003120AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00003121#include <sys/stat.h>
3122#include <unistd.h>
3123int main(int argc, char*argv[])
3124{
3125 if(lchflags(argv[0], 0) != 0)
3126 return 1;
3127 return 0;
3128}
Ned Deily43e10542011-06-27 23:41:53 -07003129]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross])
Gregory P. Smithbb213892009-11-02 01:37:37 +00003130])
3131if test "$ac_cv_have_lchflags" = cross ; then
3132 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
3133fi
3134if test "$ac_cv_have_lchflags" = yes ; then
Ned Deily43e10542011-06-27 23:41:53 -07003135 AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.])
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003136fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00003137
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00003138dnl Check if system zlib has *Copy() functions
Ronald Oussorenf8752642006-07-06 10:13:35 +00003139dnl
3140dnl On MacOSX the linker will search for dylibs on the entire linker path
3141dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
3142dnl to revert to a more traditional unix behaviour and make it possible to
3143dnl override the system libz with a local static library of libz. Temporarily
3144dnl add that flag to our CFLAGS as well to ensure that we check the version
3145dnl of libz that will be used by setup.py.
3146dnl The -L/usr/local/lib is needed as wel to get the same compilation
3147dnl environment as setup.py (and leaving it out can cause configure to use the
3148dnl wrong version of the library)
3149case $ac_sys_system/$ac_sys_release in
3150Darwin/*)
3151 _CUR_CFLAGS="${CFLAGS}"
3152 _CUR_LDFLAGS="${LDFLAGS}"
3153 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
3154 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
3155 ;;
3156esac
3157
Matthias Klose5183ebd2010-04-24 16:38:36 +00003158AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00003159
Ronald Oussorenf8752642006-07-06 10:13:35 +00003160case $ac_sys_system/$ac_sys_release in
3161Darwin/*)
3162 CFLAGS="${_CUR_CFLAGS}"
3163 LDFLAGS="${_CUR_LDFLAGS}"
3164 ;;
3165esac
3166
Martin v. Löwise9416172003-05-03 10:12:45 +00003167AC_MSG_CHECKING(for hstrerror)
Matthias Klosec511b472010-05-08 11:01:39 +00003168AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwise9416172003-05-03 10:12:45 +00003169#include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003170]], [[void* p = hstrerror; hstrerror(0)]])],
3171 [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
3172 AC_MSG_RESULT(yes)],
3173 [AC_MSG_RESULT(no)
3174])
Martin v. Löwise9416172003-05-03 10:12:45 +00003175
3176AC_MSG_CHECKING(for inet_aton)
Matthias Klosec511b472010-05-08 11:01:39 +00003177AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwis86d66262006-02-17 08:40:11 +00003178#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00003179#include <sys/socket.h>
3180#include <netinet/in.h>
3181#include <arpa/inet.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003182]], [[void* p = inet_aton;inet_aton(0,0)]])],
3183 [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
3184 AC_MSG_RESULT(yes)],
3185 [AC_MSG_RESULT(no)
3186])
Martin v. Löwise9416172003-05-03 10:12:45 +00003187
3188AC_MSG_CHECKING(for inet_pton)
Matthias Klosec511b472010-05-08 11:01:39 +00003189AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00003190#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00003191#include <sys/socket.h>
3192#include <netinet/in.h>
3193#include <arpa/inet.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003194]], [[void* p = inet_pton]])],
3195 [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
3196 AC_MSG_RESULT(yes)],
3197 [AC_MSG_RESULT(no)
3198])
Martin v. Löwise9416172003-05-03 10:12:45 +00003199
Martin v. Löwisd6640d42003-07-06 09:29:52 +00003200# On some systems, setgroups is in unistd.h, on others, in grp.h
Martin v. Löwisd5843682002-11-21 20:41:28 +00003201AC_MSG_CHECKING(for setgroups)
Matthias Klosec511b472010-05-08 11:01:39 +00003202AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00003203#include <unistd.h>
Martin v. Löwisd6640d42003-07-06 09:29:52 +00003204#ifdef HAVE_GRP_H
3205#include <grp.h>
3206#endif
Matthias Klosec511b472010-05-08 11:01:39 +00003207]], [[void* p = setgroups]])],
3208 [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
3209 AC_MSG_RESULT(yes)],
3210 [AC_MSG_RESULT(no)
3211])
Martin v. Löwisd5843682002-11-21 20:41:28 +00003212
Fred Drake8cef4cf2000-06-28 16:40:38 +00003213# check for openpty and forkpty
3214
Martin v. Löwisfd9a72a2006-01-08 10:07:33 +00003215AC_CHECK_FUNCS(openpty,,
3216 AC_CHECK_LIB(util,openpty,
3217 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
3218 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
3219 )
3220)
3221AC_CHECK_FUNCS(forkpty,,
3222 AC_CHECK_LIB(util,forkpty,
3223 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
3224 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
3225 )
3226)
Fred Drake8cef4cf2000-06-28 16:40:38 +00003227
Brett Cannonaa5778d2008-03-18 04:09:00 +00003228# Stuff for expat.
3229AC_CHECK_FUNCS(memmove)
3230
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00003231# check for long file support functions
3232AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
3233
Brett Cannonaa5778d2008-03-18 04:09:00 +00003234AC_REPLACE_FUNCS(dup2 getcwd strdup)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003235AC_CHECK_FUNCS(getpgrp,
Matthias Klosec511b472010-05-08 11:01:39 +00003236 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
3237 [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
3238 [])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003239)
Jack Jansen150753c2003-03-29 22:07:47 +00003240AC_CHECK_FUNCS(setpgrp,
Matthias Klosec511b472010-05-08 11:01:39 +00003241 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])],
3242 [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])],
3243 [])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003244)
3245AC_CHECK_FUNCS(gettimeofday,
Matthias Klosec511b472010-05-08 11:01:39 +00003246 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]],
3247 [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])],
3248 [],
3249 [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
3250 [Define if gettimeofday() does not have second (timezone) argument
3251 This is the case on Motorola V4 (R40V4.2)])
3252 ])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003253)
Guido van Rossum627b2d71993-12-24 10:39:16 +00003254
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00003255AC_MSG_CHECKING(for major, minor, and makedev)
Matthias Klosec511b472010-05-08 11:01:39 +00003256AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Neal Norwitz6eb37f02003-02-23 23:28:15 +00003257#if defined(MAJOR_IN_MKDEV)
3258#include <sys/mkdev.h>
3259#elif defined(MAJOR_IN_SYSMACROS)
3260#include <sys/sysmacros.h>
3261#else
3262#include <sys/types.h>
3263#endif
Matthias Klosec511b472010-05-08 11:01:39 +00003264]], [[
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00003265 makedev(major(0),minor(0));
Matthias Klosec511b472010-05-08 11:01:39 +00003266]])],[
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00003267 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
3268 [Define to 1 if you have the device macros.])
3269 AC_MSG_RESULT(yes)
3270],[
3271 AC_MSG_RESULT(no)
3272])
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003273
3274# On OSF/1 V5.1, getaddrinfo is available, but a define
3275# for [no]getaddrinfo in netdb.h.
3276AC_MSG_CHECKING(for getaddrinfo)
Matthias Klosec511b472010-05-08 11:01:39 +00003277AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00003278#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003279#include <sys/socket.h>
3280#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00003281#include <stdio.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003282]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],
3283[have_getaddrinfo=yes],
3284[have_getaddrinfo=no])
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003285AC_MSG_RESULT($have_getaddrinfo)
3286if test $have_getaddrinfo = yes
3287then
3288 AC_MSG_CHECKING(getaddrinfo bug)
3289 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
Matthias Klosec511b472010-05-08 11:01:39 +00003290 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
Stefan Krah0afe4e42012-11-22 23:56:51 +01003291#include <stdio.h>
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003292#include <sys/types.h>
3293#include <netdb.h>
3294#include <string.h>
3295#include <sys/socket.h>
3296#include <netinet/in.h>
3297
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003298int main()
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003299{
3300 int passive, gaierr, inet4 = 0, inet6 = 0;
3301 struct addrinfo hints, *ai, *aitop;
3302 char straddr[INET6_ADDRSTRLEN], strport[16];
3303
3304 for (passive = 0; passive <= 1; passive++) {
3305 memset(&hints, 0, sizeof(hints));
3306 hints.ai_family = AF_UNSPEC;
3307 hints.ai_flags = passive ? AI_PASSIVE : 0;
3308 hints.ai_socktype = SOCK_STREAM;
Hye-Shik Chang54f94392004-04-14 07:55:31 +00003309 hints.ai_protocol = IPPROTO_TCP;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003310 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
3311 (void)gai_strerror(gaierr);
3312 goto bad;
3313 }
3314 for (ai = aitop; ai; ai = ai->ai_next) {
3315 if (ai->ai_addr == NULL ||
3316 ai->ai_addrlen == 0 ||
3317 getnameinfo(ai->ai_addr, ai->ai_addrlen,
3318 straddr, sizeof(straddr), strport, sizeof(strport),
3319 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
3320 goto bad;
3321 }
3322 switch (ai->ai_family) {
3323 case AF_INET:
3324 if (strcmp(strport, "54321") != 0) {
3325 goto bad;
3326 }
3327 if (passive) {
3328 if (strcmp(straddr, "0.0.0.0") != 0) {
3329 goto bad;
3330 }
3331 } else {
3332 if (strcmp(straddr, "127.0.0.1") != 0) {
3333 goto bad;
3334 }
3335 }
3336 inet4++;
3337 break;
3338 case AF_INET6:
3339 if (strcmp(strport, "54321") != 0) {
3340 goto bad;
3341 }
3342 if (passive) {
3343 if (strcmp(straddr, "::") != 0) {
3344 goto bad;
3345 }
3346 } else {
3347 if (strcmp(straddr, "::1") != 0) {
3348 goto bad;
3349 }
3350 }
3351 inet6++;
3352 break;
3353 case AF_UNSPEC:
3354 goto bad;
3355 break;
3356 default:
3357 /* another family support? */
3358 break;
3359 }
3360 }
3361 }
3362
3363 if (!(inet4 == 0 || inet4 == 2))
3364 goto bad;
3365 if (!(inet6 == 0 || inet6 == 2))
3366 goto bad;
3367
3368 if (aitop)
3369 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003370 return 0;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003371
3372 bad:
3373 if (aitop)
3374 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003375 return 1;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003376}
Matthias Klosec511b472010-05-08 11:01:39 +00003377]]])],
3378[ac_cv_buggy_getaddrinfo=no],
3379[ac_cv_buggy_getaddrinfo=yes],
doko@python.orgd65e2ba2013-01-31 23:52:03 +01003380[
3381if test "${enable_ipv6+set}" = set; then
3382 ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6"
3383else
3384 ac_cv_buggy_getaddrinfo=yes
3385fi]))
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003386fi
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003387
Benjamin Peterson75fed812010-11-01 01:47:19 +00003388AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
3389
Mark Dickinson0ef0b912009-12-31 21:11:48 +00003390if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003391then
3392 if test $ipv6 = yes
3393 then
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003394 echo 'Fatal: You must get working getaddrinfo() function.'
3395 echo ' or you can specify "--disable-ipv6"'.
3396 exit 1
3397 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003398else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003399 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003400fi
Benjamin Peterson75fed812010-11-01 01:47:19 +00003401
Thomas Woutersb0db85a2001-08-08 10:39:03 +00003402AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003403
Guido van Rossum627b2d71993-12-24 10:39:16 +00003404# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003405AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00003406AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003407AC_STRUCT_TIMEZONE
Martin v. Löwis60a5d722002-10-16 20:28:25 +00003408AC_CHECK_MEMBERS([struct stat.st_rdev])
3409AC_CHECK_MEMBERS([struct stat.st_blksize])
Hye-Shik Chang5f937a72005-06-02 13:09:30 +00003410AC_CHECK_MEMBERS([struct stat.st_flags])
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00003411AC_CHECK_MEMBERS([struct stat.st_gen])
3412AC_CHECK_MEMBERS([struct stat.st_birthtime])
Guido van Rossum98bf58f2001-10-18 20:34:25 +00003413AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003414
3415AC_MSG_CHECKING(for time.h that defines altzone)
Matthias Klosec511b472010-05-08 11:01:39 +00003416AC_CACHE_VAL(ac_cv_header_time_altzone,[
3417 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])],
3418 [ac_cv_header_time_altzone=yes],
3419 [ac_cv_header_time_altzone=no])
3420 ])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003421AC_MSG_RESULT($ac_cv_header_time_altzone)
3422if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003423 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003424fi
3425
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003426was_it_defined=no
3427AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Matthias Klosec511b472010-05-08 11:01:39 +00003428AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003429#include <sys/types.h>
3430#include <sys/select.h>
3431#include <sys/time.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003432]], [[;]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003433 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
3434 [Define if you can safely include both <sys/select.h> and <sys/time.h>
3435 (which you can't on SCO ODT 3.0).])
3436 was_it_defined=yes
Matthias Klosec511b472010-05-08 11:01:39 +00003437],[])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003438AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00003439
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003440AC_MSG_CHECKING(for addrinfo)
3441AC_CACHE_VAL(ac_cv_struct_addrinfo,
Matthias Klosec511b472010-05-08 11:01:39 +00003442AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
3443 [ac_cv_struct_addrinfo=yes],
3444 [ac_cv_struct_addrinfo=no]))
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003445AC_MSG_RESULT($ac_cv_struct_addrinfo)
3446if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003447 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003448fi
3449
3450AC_MSG_CHECKING(for sockaddr_storage)
3451AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
Matthias Klosec511b472010-05-08 11:01:39 +00003452AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003453# include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003454# include <sys/socket.h>]], [[struct sockaddr_storage s]])],
3455 [ac_cv_struct_sockaddr_storage=yes],
3456 [ac_cv_struct_sockaddr_storage=no]))
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003457AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3458if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003459 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003460fi
3461
Guido van Rossum627b2d71993-12-24 10:39:16 +00003462# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003463
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003464AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003465AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003466
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003467works=no
3468AC_MSG_CHECKING(for working volatile)
Matthias Klosec511b472010-05-08 11:01:39 +00003469AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])],
3470 [works=yes],
3471 [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])]
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003472)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003473AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00003474
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003475works=no
3476AC_MSG_CHECKING(for working signed char)
Matthias Klosec511b472010-05-08 11:01:39 +00003477AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])],
3478 [works=yes],
3479 [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])]
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003480)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003481AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003482
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003483have_prototypes=no
3484AC_MSG_CHECKING(for prototypes)
Matthias Klosec511b472010-05-08 11:01:39 +00003485AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])],
3486 [AC_DEFINE(HAVE_PROTOTYPES, 1,
3487 [Define if your compiler supports function prototype])
3488 have_prototypes=yes],
3489 []
3490)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003491AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003492
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003493works=no
3494AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Matthias Klosec511b472010-05-08 11:01:39 +00003495AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003496#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00003497int foo(int x, ...) {
3498 va_list va;
3499 va_start(va, x);
3500 va_arg(va, int);
3501 va_arg(va, char *);
3502 va_arg(va, double);
3503 return 0;
3504}
Matthias Klosec511b472010-05-08 11:01:39 +00003505]], [[return foo(10, "", 3.14);]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003506 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3507 [Define if your compiler supports variable length function prototypes
3508 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3509 works=yes
Matthias Klosec511b472010-05-08 11:01:39 +00003510],[])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003511AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003512
Dave Cole331708b2004-08-09 04:51:41 +00003513# check for socketpair
3514AC_MSG_CHECKING(for socketpair)
Matthias Klosec511b472010-05-08 11:01:39 +00003515AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Dave Cole331708b2004-08-09 04:51:41 +00003516#include <sys/types.h>
3517#include <sys/socket.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003518]], [[void *x=socketpair]])],
3519 [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.])
3520 AC_MSG_RESULT(yes)],
3521 [AC_MSG_RESULT(no)]
Dave Cole331708b2004-08-09 04:51:41 +00003522)
3523
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003524# check if sockaddr has sa_len member
3525AC_MSG_CHECKING(if sockaddr has sa_len member)
Matthias Klosec511b472010-05-08 11:01:39 +00003526AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3527#include <sys/socket.h>]], [[struct sockaddr x;
3528x.sa_len = 0;]])],
3529 [AC_MSG_RESULT(yes)
3530 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])],
3531 [AC_MSG_RESULT(no)]
3532)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003533
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003534va_list_is_array=no
3535AC_MSG_CHECKING(whether va_list is an array)
Matthias Klosec511b472010-05-08 11:01:39 +00003536AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003537#ifdef HAVE_STDARG_PROTOTYPES
3538#include <stdarg.h>
3539#else
3540#include <varargs.h>
3541#endif
Matthias Klosec511b472010-05-08 11:01:39 +00003542]], [[va_list list1, list2; list1 = list2;]])],[],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003543 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3544 va_list_is_array=yes
3545])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003546AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003547
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003548# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
Martin v. Löwis11437992002-04-12 09:54:03 +00003549AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3550 [Define this if you have some version of gethostbyname_r()])
3551
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003552AC_CHECK_FUNC(gethostbyname_r, [
3553 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3554 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3555 OLD_CFLAGS=$CFLAGS
3556 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
Matthias Klosec511b472010-05-08 11:01:39 +00003557 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003558# include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003559 ]], [[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003560 char *name;
3561 struct hostent *he, *res;
3562 char buffer[2048];
3563 int buflen = 2048;
3564 int h_errnop;
3565
3566 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
Matthias Klosec511b472010-05-08 11:01:39 +00003567 ]])],[
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003568 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003569 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3570 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003571 AC_MSG_RESULT(yes)
Matthias Klosec511b472010-05-08 11:01:39 +00003572 ],[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003573 AC_MSG_RESULT(no)
3574 AC_MSG_CHECKING([gethostbyname_r with 5 args])
Matthias Klosec511b472010-05-08 11:01:39 +00003575 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003576# include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003577 ]], [[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003578 char *name;
3579 struct hostent *he;
Matthias Klosec511b472010-05-08 11:01:39 +00003580 char buffer[2048];
3581 int buflen = 2048;
3582 int h_errnop;
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003583
Matthias Klosec511b472010-05-08 11:01:39 +00003584 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3585 ]])],
3586 [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003587 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Matthias Klosec511b472010-05-08 11:01:39 +00003588 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3589 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003590 AC_MSG_RESULT(yes)
3591 ], [
3592 AC_MSG_RESULT(no)
Matthias Klosec511b472010-05-08 11:01:39 +00003593 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3594 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3595# include <netdb.h>
3596 ]], [[
3597 char *name;
3598 struct hostent *he;
3599 struct hostent_data data;
3600
3601 (void) gethostbyname_r(name, he, &data);
3602 ]])],
3603 [
3604 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3605 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3606 [Define this if you have the 3-arg version of gethostbyname_r().])
3607 AC_MSG_RESULT(yes)
3608 ], [
3609 AC_MSG_RESULT(no)
3610 ])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003611 ])
3612 ])
3613 CFLAGS=$OLD_CFLAGS
3614], [
Thomas Wouters3a584202000-08-05 23:28:51 +00003615 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003616])
3617AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3618AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3619AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003620AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003621AC_SUBST(HAVE_GETHOSTBYNAME)
3622
Guido van Rossum627b2d71993-12-24 10:39:16 +00003623# checks for system services
3624# (none yet)
3625
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003626# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00003627AC_CHECK_FUNC(__fpu_control,
3628 [],
3629 [AC_CHECK_LIB(ieee, __fpu_control)
3630])
Guido van Rossum627b2d71993-12-24 10:39:16 +00003631
Guido van Rossum93274221997-05-09 02:42:00 +00003632# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00003633AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00003634AC_ARG_WITH(fpectl,
Matthias Klose22520ea2010-05-08 10:14:46 +00003635 AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003636[
Guido van Rossum93274221997-05-09 02:42:00 +00003637if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003638then
3639 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3640 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3641 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00003642else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00003643fi],
3644[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00003645
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003646# check for --with-libm=...
3647AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003648case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00003649Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00003650BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003651*) LIBM=-lm
3652esac
Guido van Rossum93274221997-05-09 02:42:00 +00003653AC_MSG_CHECKING(for --with-libm=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003654AC_ARG_WITH(libm,
Matthias Klose22520ea2010-05-08 10:14:46 +00003655 AS_HELP_STRING([--with-libm=STRING], [math library]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003656[
Guido van Rossum93274221997-05-09 02:42:00 +00003657if test "$withval" = no
3658then LIBM=
3659 AC_MSG_RESULT(force LIBM empty)
3660elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003661then LIBM=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003662 AC_MSG_RESULT(set LIBM="$withval")
3663else AC_MSG_ERROR([proper usage is --with-libm=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003664fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003665[AC_MSG_RESULT(default LIBM="$LIBM")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003666
3667# check for --with-libc=...
3668AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00003669AC_MSG_CHECKING(for --with-libc=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003670AC_ARG_WITH(libc,
Matthias Klose22520ea2010-05-08 10:14:46 +00003671 AS_HELP_STRING([--with-libc=STRING], [C library]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003672[
Guido van Rossum93274221997-05-09 02:42:00 +00003673if test "$withval" = no
3674then LIBC=
3675 AC_MSG_RESULT(force LIBC empty)
3676elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003677then LIBC=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003678 AC_MSG_RESULT(set LIBC="$withval")
3679else AC_MSG_ERROR([proper usage is --with-libc=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003680fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003681[AC_MSG_RESULT(default LIBC="$LIBC")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003682
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003683# **************************************************
3684# * Check for various properties of floating point *
3685# **************************************************
Mark Dickinson265d7382008-04-21 22:32:24 +00003686
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003687AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3688AC_CACHE_VAL(ac_cv_little_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003689AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003690#include <string.h>
3691int main() {
3692 double x = 9006104071832581.0;
3693 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3694 return 0;
3695 else
3696 return 1;
3697}
Matthias Klosec511b472010-05-08 11:01:39 +00003698]])],
3699[ac_cv_little_endian_double=yes],
3700[ac_cv_little_endian_double=no],
3701[ac_cv_little_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003702AC_MSG_RESULT($ac_cv_little_endian_double)
3703if test "$ac_cv_little_endian_double" = yes
3704then
3705 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3706 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3707 with the least significant byte first])
3708fi
3709
3710AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3711AC_CACHE_VAL(ac_cv_big_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003712AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003713#include <string.h>
3714int main() {
3715 double x = 9006104071832581.0;
3716 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3717 return 0;
3718 else
3719 return 1;
3720}
Matthias Klosec511b472010-05-08 11:01:39 +00003721]])],
3722[ac_cv_big_endian_double=yes],
3723[ac_cv_big_endian_double=no],
3724[ac_cv_big_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003725AC_MSG_RESULT($ac_cv_big_endian_double)
3726if test "$ac_cv_big_endian_double" = yes
3727then
3728 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3729 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3730 with the most significant byte first])
3731fi
3732
3733# Some ARM platforms use a mixed-endian representation for doubles.
3734# While Python doesn't currently have full support for these platforms
3735# (see e.g., issue 1762561), we can at least make sure that float <-> string
3736# conversions work.
3737AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3738AC_CACHE_VAL(ac_cv_mixed_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003739AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003740#include <string.h>
3741int main() {
3742 double x = 9006104071832581.0;
3743 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3744 return 0;
3745 else
3746 return 1;
3747}
Matthias Klosec511b472010-05-08 11:01:39 +00003748]])],
3749[ac_cv_mixed_endian_double=yes],
3750[ac_cv_mixed_endian_double=no],
3751[ac_cv_mixed_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003752AC_MSG_RESULT($ac_cv_mixed_endian_double)
3753if test "$ac_cv_mixed_endian_double" = yes
3754then
3755 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3756 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3757 in ARM mixed-endian order (byte order 45670123)])
3758fi
3759
3760# The short float repr introduced in Python 3.1 requires the
3761# correctly-rounded string <-> double conversion functions from
3762# Python/dtoa.c, which in turn require that the FPU uses 53-bit
3763# rounding; this is a problem on x86, where the x87 FPU has a default
Mark Dickinsona548dee2009-11-15 13:12:43 +00003764# rounding precision of 64 bits. For gcc/x86, we can fix this by
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003765# using inline assembler to get and set the x87 FPU control word.
Mark Dickinsona548dee2009-11-15 13:12:43 +00003766
3767# This inline assembler syntax may also work for suncc and icc,
3768# so we try it on all platforms.
3769
3770AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
Stefan Krah99e36b92015-07-03 15:30:54 +02003771AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
Mark Dickinsona548dee2009-11-15 13:12:43 +00003772 unsigned short cw;
3773 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3774 __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
Matthias Klosec511b472010-05-08 11:01:39 +00003775]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no])
Mark Dickinsona548dee2009-11-15 13:12:43 +00003776AC_MSG_RESULT($have_gcc_asm_for_x87)
3777if test "$have_gcc_asm_for_x87" = yes
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003778then
Mark Dickinsona548dee2009-11-15 13:12:43 +00003779 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3780 [Define if we can use gcc inline assembler to get and set x87 control word])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003781fi
Mark Dickinson7a3d8642008-04-22 00:54:27 +00003782
Mark Dickinson04b27232009-01-04 12:29:36 +00003783# Detect whether system arithmetic is subject to x87-style double
3784# rounding issues. The result of this test has little meaning on non
3785# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3786# mode is round-to-nearest and double rounding issues are present, and
3787# 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3788AC_MSG_CHECKING(for x87-style double rounding)
Mark Dickinson99abd142009-10-24 13:44:16 +00003789# $BASECFLAGS may affect the result
3790ac_save_cc="$CC"
3791CC="$CC $BASECFLAGS"
Matthias Klosec511b472010-05-08 11:01:39 +00003792AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson04b27232009-01-04 12:29:36 +00003793#include <stdlib.h>
3794#include <math.h>
3795int main() {
3796 volatile double x, y, z;
3797 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3798 x = 0.99999999999999989; /* 1-2**-53 */
3799 y = 1./x;
3800 if (y != 1.)
3801 exit(0);
3802 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3803 x = 1e16;
3804 y = 2.99999;
3805 z = x + y;
3806 if (z != 1e16+4.)
3807 exit(0);
3808 /* both tests show evidence of double rounding */
3809 exit(1);
3810}
Matthias Klosec511b472010-05-08 11:01:39 +00003811]])],
3812[ac_cv_x87_double_rounding=no],
3813[ac_cv_x87_double_rounding=yes],
3814[ac_cv_x87_double_rounding=no])
Mark Dickinson99abd142009-10-24 13:44:16 +00003815CC="$ac_save_cc"
Mark Dickinson04b27232009-01-04 12:29:36 +00003816AC_MSG_RESULT($ac_cv_x87_double_rounding)
3817if test "$ac_cv_x87_double_rounding" = yes
3818then
3819 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3820 [Define if arithmetic is subject to x87-style double rounding issue])
3821fi
3822
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003823# ************************************
3824# * Check for mathematical functions *
3825# ************************************
3826
3827LIBS_SAVE=$LIBS
3828LIBS="$LIBS $LIBM"
3829
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003830# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3831# -0. on some architectures.
3832AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3833AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
Matthias Klosec511b472010-05-08 11:01:39 +00003834AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003835#include <math.h>
3836#include <stdlib.h>
3837int main() {
3838 /* return 0 if either negative zeros don't exist
3839 on this platform or if negative zeros exist
3840 and tanh(-0.) == -0. */
3841 if (atan2(0., -1.) == atan2(-0., -1.) ||
3842 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3843 else exit(1);
3844}
Matthias Klosec511b472010-05-08 11:01:39 +00003845]])],
3846[ac_cv_tanh_preserves_zero_sign=yes],
3847[ac_cv_tanh_preserves_zero_sign=no],
3848[ac_cv_tanh_preserves_zero_sign=no])])
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003849AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3850if test "$ac_cv_tanh_preserves_zero_sign" = yes
3851then
3852 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3853 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3854fi
3855
3856AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
3857AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
3858AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3859
3860LIBS=$LIBS_SAVE
3861
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003862# For multiprocessing module, check that sem_open
3863# actually works. For FreeBSD versions <= 7.2,
3864# the kernel module that provides POSIX semaphores
3865# isn't loaded by default, so an attempt to call
3866# sem_open results in a 'Signal 12' error.
3867AC_MSG_CHECKING(whether POSIX semaphores are enabled)
3868AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
Matthias Klosec511b472010-05-08 11:01:39 +00003869AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003870#include <unistd.h>
3871#include <fcntl.h>
3872#include <stdio.h>
3873#include <semaphore.h>
3874#include <sys/stat.h>
3875
3876int main(void) {
3877 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3878 if (a == SEM_FAILED) {
3879 perror("sem_open");
3880 return 1;
3881 }
3882 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003883 sem_unlink("/autoconf");
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003884 return 0;
3885}
Matthias Klosec511b472010-05-08 11:01:39 +00003886]])],
3887[ac_cv_posix_semaphores_enabled=yes],
3888[ac_cv_posix_semaphores_enabled=no],
3889[ac_cv_posix_semaphores_enabled=yes])
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003890)
3891AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
3892if test $ac_cv_posix_semaphores_enabled = no
3893then
Mark Dickinson5afa6d42009-11-28 10:44:20 +00003894 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
3895 [Define if POSIX semaphores aren't enabled on your system])
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003896fi
3897
Jesse Noller355b1262009-04-02 00:03:28 +00003898# Multiprocessing check for broken sem_getvalue
3899AC_MSG_CHECKING(for broken sem_getvalue)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003900AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
Matthias Klosec511b472010-05-08 11:01:39 +00003901AC_RUN_IFELSE([AC_LANG_SOURCE([[
Jesse Noller355b1262009-04-02 00:03:28 +00003902#include <unistd.h>
3903#include <fcntl.h>
3904#include <stdio.h>
3905#include <semaphore.h>
3906#include <sys/stat.h>
3907
3908int main(void){
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003909 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
Jesse Noller355b1262009-04-02 00:03:28 +00003910 int count;
3911 int res;
3912 if(a==SEM_FAILED){
3913 perror("sem_open");
3914 return 1;
3915
3916 }
3917 res = sem_getvalue(a, &count);
3918 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003919 sem_unlink("/autocftw");
Jesse Noller355b1262009-04-02 00:03:28 +00003920 return res==-1 ? 1 : 0;
3921}
Matthias Klosec511b472010-05-08 11:01:39 +00003922]])],
3923[ac_cv_broken_sem_getvalue=no],
3924[ac_cv_broken_sem_getvalue=yes],
3925[ac_cv_broken_sem_getvalue=yes])
Jesse Noller355b1262009-04-02 00:03:28 +00003926)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003927AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
3928if test $ac_cv_broken_sem_getvalue = yes
3929then
3930 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
3931 [define to 1 if your sem_getvalue is broken.])
3932fi
Mark Dickinson04b27232009-01-04 12:29:36 +00003933
Mark Dickinsonefc82f72009-03-20 15:51:55 +00003934# determine what size digit to use for Python's longs
3935AC_MSG_CHECKING([digit size for Python's longs])
3936AC_ARG_ENABLE(big-digits,
Matthias Klose22520ea2010-05-08 10:14:46 +00003937AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
Mark Dickinsonefc82f72009-03-20 15:51:55 +00003938[case $enable_big_digits in
3939yes)
3940 enable_big_digits=30 ;;
3941no)
3942 enable_big_digits=15 ;;
3943[15|30])
3944 ;;
3945*)
3946 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3947esac
3948AC_MSG_RESULT($enable_big_digits)
3949AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3950],
3951[AC_MSG_RESULT(no value specified)])
3952
Guido van Rossumef2255b2000-03-10 22:30:29 +00003953# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003954AC_CHECK_HEADER(wchar.h, [
3955 AC_DEFINE(HAVE_WCHAR_H, 1,
3956 [Define if the compiler provides a wchar.h header file.])
3957 wchar_h="yes"
3958],
Guido van Rossumef2255b2000-03-10 22:30:29 +00003959wchar_h="no"
3960)
3961
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003962# determine wchar_t size
3963if test "$wchar_h" = yes
3964then
Guido van Rossum67b26592001-10-20 14:21:45 +00003965 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003966fi
3967
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003968AC_MSG_CHECKING(for UCS-4 tcl)
3969have_ucs4_tcl=no
Matthias Klosec511b472010-05-08 11:01:39 +00003970AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003971#include <tcl.h>
3972#if TCL_UTF_MAX != 6
3973# error "NOT UCS4_TCL"
Matthias Klosec511b472010-05-08 11:01:39 +00003974#endif]], [[]])],[
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003975 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3976 have_ucs4_tcl=yes
Matthias Klosec511b472010-05-08 11:01:39 +00003977],[])
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003978AC_MSG_RESULT($have_ucs4_tcl)
3979
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003980# check whether wchar_t is signed or not
3981if test "$wchar_h" = yes
3982then
3983 # check whether wchar_t is signed or not
3984 AC_MSG_CHECKING(whether wchar_t is signed)
3985 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
Matthias Klosec511b472010-05-08 11:01:39 +00003986 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003987 #include <wchar.h>
3988 int main()
3989 {
Martin v. Löwis44fe0e42006-04-11 07:15:30 +00003990 /* Success: exit code 0 */
3991 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003992 }
Matthias Klosec511b472010-05-08 11:01:39 +00003993 ]])],
3994 [ac_cv_wchar_t_signed=yes],
3995 [ac_cv_wchar_t_signed=no],
3996 [ac_cv_wchar_t_signed=yes])])
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003997 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3998fi
3999
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004000AC_MSG_CHECKING(what type to use for unicode)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00004001dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004002AC_ARG_ENABLE(unicode,
Benjamin Peterson66556b02010-05-25 02:23:32 +00004003 AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is ucs2)]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00004004 [],
4005 [enable_unicode=yes])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004006
4007if test $enable_unicode = yes
4008then
Martin v. Löwisfd917792001-06-27 20:22:04 +00004009 # Without any arguments, Py_UNICODE defaults to two-byte mode
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00004010 case "$have_ucs4_tcl" in
4011 yes) enable_unicode="ucs4"
4012 ;;
4013 *) enable_unicode="ucs2"
4014 ;;
4015 esac
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004016fi
4017
Martin v. Löwis0036cba2002-04-12 09:58:45 +00004018AH_TEMPLATE(Py_UNICODE_SIZE,
4019 [Define as the size of the unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004020case "$enable_unicode" in
4021ucs2) unicode_size="2"
4022 AC_DEFINE(Py_UNICODE_SIZE,2)
4023 ;;
4024ucs4) unicode_size="4"
4025 AC_DEFINE(Py_UNICODE_SIZE,4)
4026 ;;
Martin v. Löwised11a5d2012-05-20 10:42:17 +02004027no) ;; # To allow --disable-unicode
Ezio Melotti5820efb2010-02-27 00:05:42 +00004028*) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004029esac
4030
Martin v. Löwis11437992002-04-12 09:54:03 +00004031AH_TEMPLATE(PY_UNICODE_TYPE,
4032 [Define as the integral type used for Unicode representation.])
Martin v. Löwis0036cba2002-04-12 09:58:45 +00004033
Martin v. Löwis339d0f72001-08-17 18:39:25 +00004034AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004035if test "$enable_unicode" = "no"
4036then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00004037 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004038 AC_MSG_RESULT(not used)
4039else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00004040 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004041 AC_DEFINE(Py_USING_UNICODE, 1,
4042 [Define if you want to have a Unicode type.])
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00004043
4044 # wchar_t is only usable if it maps to an unsigned type
4045 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
Matthias Klose7dbeed72004-12-24 08:22:17 +00004046 -a "$ac_cv_wchar_t_signed" = "no"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004047 then
4048 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004049 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
4050 [Define if you have a useable wchar_t type defined in wchar.h; useable
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00004051 means wchar_t must be an unsigned type with at least 16 bits. (see
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004052 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00004053 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
4054 elif test "$ac_cv_sizeof_short" = "$unicode_size"
4055 then
4056 PY_UNICODE_TYPE="unsigned short"
4057 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
4058 elif test "$ac_cv_sizeof_long" = "$unicode_size"
4059 then
4060 PY_UNICODE_TYPE="unsigned long"
4061 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
4062 else
4063 PY_UNICODE_TYPE="no type found"
4064 fi
4065 AC_MSG_RESULT($PY_UNICODE_TYPE)
4066fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00004067
4068# check for endianness
4069AC_C_BIGENDIAN
4070
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00004071# Check whether right shifting a negative integer extends the sign bit
4072# or fills with zeros (like the Cray J90, according to Tim Peters).
4073AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00004074AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Matthias Klosec511b472010-05-08 11:01:39 +00004075AC_RUN_IFELSE([AC_LANG_SOURCE([[
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00004076int main()
4077{
Vladimir Marangozova6180282000-07-12 05:05:06 +00004078 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00004079}
Matthias Klosec511b472010-05-08 11:01:39 +00004080]])],
4081[ac_cv_rshift_extends_sign=yes],
4082[ac_cv_rshift_extends_sign=no],
4083[ac_cv_rshift_extends_sign=yes])])
Vladimir Marangozova6180282000-07-12 05:05:06 +00004084AC_MSG_RESULT($ac_cv_rshift_extends_sign)
4085if test "$ac_cv_rshift_extends_sign" = no
4086then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004087 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
4088 [Define if i>>j for signed int i does not extend the sign bit
4089 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00004090fi
4091
Guido van Rossumcadfaec2001-01-05 14:45:49 +00004092# check for getc_unlocked and related locking functions
4093AC_MSG_CHECKING(for getc_unlocked() and friends)
4094AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
Matthias Klosec511b472010-05-08 11:01:39 +00004095AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
Guido van Rossumcadfaec2001-01-05 14:45:49 +00004096 FILE *f = fopen("/dev/null", "r");
4097 flockfile(f);
4098 getc_unlocked(f);
4099 funlockfile(f);
Matthias Klosec511b472010-05-08 11:01:39 +00004100]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00004101AC_MSG_RESULT($ac_cv_have_getc_unlocked)
4102if test "$ac_cv_have_getc_unlocked" = yes
4103then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004104 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
4105 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00004106fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00004107
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00004108# check where readline lives
Martin v. Löwis82bca632006-02-10 20:49:30 +00004109# save the value of LIBS so we don't actually link Python with readline
4110LIBS_no_readline=$LIBS
Gregory P. Smith980b99b2008-09-07 05:15:18 +00004111
4112# On some systems we need to link readline to a termcap compatible
4113# library. NOTE: Keep the precedence of listed libraries synchronised
4114# with setup.py.
4115py_cv_lib_readline=no
4116AC_MSG_CHECKING([how to link readline libs])
4117for py_libtermcap in "" ncursesw ncurses curses termcap; do
4118 if test -z "$py_libtermcap"; then
4119 READLINE_LIBS="-lreadline"
4120 else
4121 READLINE_LIBS="-lreadline -l$py_libtermcap"
4122 fi
4123 LIBS="$READLINE_LIBS $LIBS_no_readline"
4124 AC_LINK_IFELSE(
4125 [AC_LANG_CALL([],[readline])],
4126 [py_cv_lib_readline=yes])
4127 if test $py_cv_lib_readline = yes; then
4128 break
4129 fi
4130done
4131# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
4132#AC_SUBST([READLINE_LIBS])
Gregory P. Smith29ec7502008-09-07 19:18:16 +00004133if test $py_cv_lib_readline = no; then
Gregory P. Smith980b99b2008-09-07 05:15:18 +00004134 AC_MSG_RESULT([none])
4135else
4136 AC_MSG_RESULT([$READLINE_LIBS])
4137 AC_DEFINE(HAVE_LIBREADLINE, 1,
4138 [Define if you have the readline library (-lreadline).])
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00004139fi
4140
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00004141# check for readline 2.1
4142AC_CHECK_LIB(readline, rl_callback_handler_install,
4143 AC_DEFINE(HAVE_RL_CALLBACK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00004144 [Define if you have readline 2.1]), ,$READLINE_LIBS)
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00004145
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00004146# check for readline 2.2
Matthias Klosec511b472010-05-08 11:01:39 +00004147AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
4148 [have_readline=yes],
4149 [have_readline=no]
4150)
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00004151if test $have_readline = yes
4152then
4153 AC_EGREP_HEADER([extern int rl_completion_append_character;],
4154 [readline/readline.h],
4155 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
4156 [Define if you have readline 2.2]), )
Antoine Pitroud9ff74e2009-10-26 19:16:46 +00004157 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
4158 [readline/readline.h],
4159 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
4160 [Define if you have rl_completion_suppress_append]), )
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00004161fi
4162
Martin v. Löwis0daad592001-09-30 21:09:59 +00004163# check for readline 4.0
4164AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004165 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00004166 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis0daad592001-09-30 21:09:59 +00004167
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00004168# also in 4.0
4169AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
4170 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00004171 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00004172
Guido van Rossum353ae582001-07-10 16:45:32 +00004173# check for readline 4.2
4174AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004175 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00004176 [Define if you have readline 4.2]), ,$READLINE_LIBS)
Guido van Rossum353ae582001-07-10 16:45:32 +00004177
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00004178# also in readline 4.2
Matthias Klosec511b472010-05-08 11:01:39 +00004179AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
4180 [have_readline=yes],
4181 [have_readline=no]
4182)
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00004183if test $have_readline = yes
4184then
4185 AC_EGREP_HEADER([extern int rl_catch_signals;],
4186 [readline/readline.h],
4187 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
4188 [Define if you can turn off readline's signal handling.]), )
4189fi
4190
Martin v. Löwis82bca632006-02-10 20:49:30 +00004191# End of readline checks: restore LIBS
4192LIBS=$LIBS_no_readline
4193
Thomas Wouterse38b2f12001-07-11 22:35:31 +00004194AC_MSG_CHECKING(for broken nice())
4195AC_CACHE_VAL(ac_cv_broken_nice, [
Matthias Klosec511b472010-05-08 11:01:39 +00004196AC_RUN_IFELSE([AC_LANG_SOURCE([[
Thomas Wouterse38b2f12001-07-11 22:35:31 +00004197int main()
4198{
4199 int val1 = nice(1);
4200 if (val1 != -1 && val1 == nice(2))
4201 exit(0);
4202 exit(1);
4203}
Matthias Klosec511b472010-05-08 11:01:39 +00004204]])],
4205[ac_cv_broken_nice=yes],
4206[ac_cv_broken_nice=no],
4207[ac_cv_broken_nice=no])])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00004208AC_MSG_RESULT($ac_cv_broken_nice)
4209if test "$ac_cv_broken_nice" = yes
4210then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004211 AC_DEFINE(HAVE_BROKEN_NICE, 1,
4212 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00004213fi
4214
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004215AC_MSG_CHECKING(for broken poll())
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004216AC_CACHE_VAL(ac_cv_broken_poll,
Matthias Klosec511b472010-05-08 11:01:39 +00004217AC_RUN_IFELSE([AC_LANG_SOURCE([[
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004218#include <poll.h>
4219
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004220int main()
4221{
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004222 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004223 int poll_test;
4224
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004225 close (42);
4226
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004227 poll_test = poll(&poll_struct, 1, 0);
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004228 if (poll_test < 0)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004229 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004230 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004231 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004232 else
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00004233 return 1;
4234}
Matthias Klosec511b472010-05-08 11:01:39 +00004235]])],
4236[ac_cv_broken_poll=yes],
4237[ac_cv_broken_poll=no],
4238[ac_cv_broken_poll=no]))
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004239AC_MSG_RESULT($ac_cv_broken_poll)
4240if test "$ac_cv_broken_poll" = yes
4241then
4242 AC_DEFINE(HAVE_BROKEN_POLL, 1,
4243 [Define if poll() sets errno on invalid file descriptors.])
4244fi
4245
Brett Cannon43802422005-02-10 20:48:03 +00004246# Before we can test tzset, we need to check if struct tm has a tm_zone
4247# (which is not required by ISO C or UNIX spec) and/or if we support
4248# tzname[]
4249AC_STRUCT_TIMEZONE
Nicholas Bastine62c5c82004-03-21 23:45:42 +00004250
Brett Cannon43802422005-02-10 20:48:03 +00004251# check tzset(3) exists and works like we expect it to
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004252AC_MSG_CHECKING(for working tzset())
4253AC_CACHE_VAL(ac_cv_working_tzset, [
Matthias Klosec511b472010-05-08 11:01:39 +00004254AC_RUN_IFELSE([AC_LANG_SOURCE([[
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004255#include <stdlib.h>
4256#include <time.h>
Brett Cannon18367812003-09-19 00:59:16 +00004257#include <string.h>
Brett Cannon43802422005-02-10 20:48:03 +00004258
4259#if HAVE_TZNAME
4260extern char *tzname[];
4261#endif
4262
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004263int main()
4264{
Brett Cannon18367812003-09-19 00:59:16 +00004265 /* Note that we need to ensure that not only does tzset(3)
4266 do 'something' with localtime, but it works as documented
4267 in the library reference and as expected by the test suite.
Brett Cannon43802422005-02-10 20:48:03 +00004268 This includes making sure that tzname is set properly if
4269 tm->tm_zone does not exist since it is the alternative way
4270 of getting timezone info.
Brett Cannon18367812003-09-19 00:59:16 +00004271
4272 Red Hat 6.2 doesn't understand the southern hemisphere
Brett Cannon43802422005-02-10 20:48:03 +00004273 after New Year's Day.
Brett Cannon18367812003-09-19 00:59:16 +00004274 */
4275
Brett Cannon43802422005-02-10 20:48:03 +00004276 time_t groundhogday = 1044144000; /* GMT-based */
Brett Cannon18367812003-09-19 00:59:16 +00004277 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
4278
Neal Norwitz7f2588c2003-04-11 15:35:53 +00004279 putenv("TZ=UTC+0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004280 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00004281 if (localtime(&groundhogday)->tm_hour != 0)
4282 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004283#if HAVE_TZNAME
4284 /* For UTC, tzname[1] is sometimes "", sometimes " " */
4285 if (strcmp(tzname[0], "UTC") ||
4286 (tzname[1][0] != 0 && tzname[1][0] != ' '))
4287 exit(1);
4288#endif
Brett Cannon18367812003-09-19 00:59:16 +00004289
Neal Norwitz7f2588c2003-04-11 15:35:53 +00004290 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004291 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00004292 if (localtime(&groundhogday)->tm_hour != 19)
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004293 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004294#if HAVE_TZNAME
4295 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
4296 exit(1);
4297#endif
Brett Cannon18367812003-09-19 00:59:16 +00004298
4299 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
4300 tzset();
4301 if (localtime(&groundhogday)->tm_hour != 11)
4302 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004303#if HAVE_TZNAME
4304 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
4305 exit(1);
4306#endif
4307
4308#if HAVE_STRUCT_TM_TM_ZONE
Brett Cannon18367812003-09-19 00:59:16 +00004309 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
4310 exit(1);
4311 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
4312 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004313#endif
Brett Cannon18367812003-09-19 00:59:16 +00004314
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004315 exit(0);
4316}
Matthias Klosec511b472010-05-08 11:01:39 +00004317]])],
4318[ac_cv_working_tzset=yes],
4319[ac_cv_working_tzset=no],
4320[ac_cv_working_tzset=no])])
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004321AC_MSG_RESULT($ac_cv_working_tzset)
4322if test "$ac_cv_working_tzset" = yes
4323then
4324 AC_DEFINE(HAVE_WORKING_TZSET, 1,
4325 [Define if tzset() actually switches the local timezone in a meaningful way.])
4326fi
4327
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004328# Look for subsecond timestamps in struct stat
4329AC_MSG_CHECKING(for tv_nsec in struct stat)
4330AC_CACHE_VAL(ac_cv_stat_tv_nsec,
Matthias Klosec511b472010-05-08 11:01:39 +00004331AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004332struct stat st;
4333st.st_mtim.tv_nsec = 1;
Matthias Klosec511b472010-05-08 11:01:39 +00004334]])],
4335[ac_cv_stat_tv_nsec=yes],
4336[ac_cv_stat_tv_nsec=no]))
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004337AC_MSG_RESULT($ac_cv_stat_tv_nsec)
4338if test "$ac_cv_stat_tv_nsec" = yes
4339then
4340 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
4341 [Define if you have struct stat.st_mtim.tv_nsec])
4342fi
4343
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004344# Look for BSD style subsecond timestamps in struct stat
4345AC_MSG_CHECKING(for tv_nsec2 in struct stat)
4346AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
Matthias Klosec511b472010-05-08 11:01:39 +00004347AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004348struct stat st;
4349st.st_mtimespec.tv_nsec = 1;
Matthias Klosec511b472010-05-08 11:01:39 +00004350]])],
4351[ac_cv_stat_tv_nsec2=yes],
4352[ac_cv_stat_tv_nsec2=no]))
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004353AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
4354if test "$ac_cv_stat_tv_nsec2" = yes
4355then
4356 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
4357 [Define if you have struct stat.st_mtimensec])
4358fi
4359
doko@ubuntu.comf27ec3e2014-04-17 20:11:19 +02004360# first curses configure check
4361ac_save_cppflags="$CPPFLAGS"
4362CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
4363
4364AC_CHECK_HEADERS(curses.h ncurses.h)
4365
4366# On Solaris, term.h requires curses.h
4367AC_CHECK_HEADERS(term.h,,,[
4368#ifdef HAVE_CURSES_H
4369#include <curses.h>
4370#endif
4371])
4372
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004373# On HP/UX 11.0, mvwdelch is a block with a return statement
4374AC_MSG_CHECKING(whether mvwdelch is an expression)
4375AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
Matthias Klosec511b472010-05-08 11:01:39 +00004376AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004377 int rtn;
4378 rtn = mvwdelch(0,0,0);
Matthias Klosec511b472010-05-08 11:01:39 +00004379]])],
4380[ac_cv_mvwdelch_is_expression=yes],
4381[ac_cv_mvwdelch_is_expression=no]))
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004382AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
4383
4384if test "$ac_cv_mvwdelch_is_expression" = yes
4385then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004386 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
4387 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004388fi
4389
4390AC_MSG_CHECKING(whether WINDOW has _flags)
4391AC_CACHE_VAL(ac_cv_window_has_flags,
Matthias Klosec511b472010-05-08 11:01:39 +00004392AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004393 WINDOW *w;
4394 w->_flags = 0;
Matthias Klosec511b472010-05-08 11:01:39 +00004395]])],
4396[ac_cv_window_has_flags=yes],
4397[ac_cv_window_has_flags=no]))
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004398AC_MSG_RESULT($ac_cv_window_has_flags)
4399
4400
4401if test "$ac_cv_window_has_flags" = yes
4402then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004403 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
4404 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004405fi
4406
Walter Dörwald4994d952006-06-19 08:07:50 +00004407AC_MSG_CHECKING(for is_term_resized)
Matthias Klosec511b472010-05-08 11:01:39 +00004408AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])],
4409 [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
4410 AC_MSG_RESULT(yes)],
4411 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004412)
4413
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004414AC_MSG_CHECKING(for resize_term)
Matthias Klosec511b472010-05-08 11:01:39 +00004415AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])],
4416 [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
4417 AC_MSG_RESULT(yes)],
4418 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004419)
4420
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004421AC_MSG_CHECKING(for resizeterm)
Matthias Klosec511b472010-05-08 11:01:39 +00004422AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])],
4423 [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
4424 AC_MSG_RESULT(yes)],
4425 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004426)
doko@ubuntu.comf27ec3e2014-04-17 20:11:19 +02004427# last curses configure check
4428CPPFLAGS=$ac_save_cppflags
Walter Dörwald4994d952006-06-19 08:07:50 +00004429
doko@python.orgd65e2ba2013-01-31 23:52:03 +01004430AC_MSG_NOTICE([checking for device files])
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004431
doko@python.orgd65e2ba2013-01-31 23:52:03 +01004432dnl NOTE: Inform user how to proceed with files when cross compiling.
4433if test "x$cross_compiling" = xyes; then
4434 if test "${ac_cv_file__dev_ptmx+set}" != set; then
4435 AC_MSG_CHECKING([for /dev/ptmx])
4436 AC_MSG_RESULT([not set])
4437 AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
4438 fi
4439 if test "${ac_cv_file__dev_ptc+set}" != set; then
4440 AC_MSG_CHECKING([for /dev/ptc])
4441 AC_MSG_RESULT([not set])
4442 AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling])
4443 fi
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004444fi
4445
doko@python.orgd65e2ba2013-01-31 23:52:03 +01004446AC_CHECK_FILE(/dev/ptmx, [], [])
4447if test "x$ac_cv_file__dev_ptmx" = xyes; then
4448 AC_DEFINE(HAVE_DEV_PTMX, 1,
4449 [Define to 1 if you have the /dev/ptmx device file.])
4450fi
4451AC_CHECK_FILE(/dev/ptc, [], [])
4452if test "x$ac_cv_file__dev_ptc" = xyes; then
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004453 AC_DEFINE(HAVE_DEV_PTC, 1,
doko@python.orgd65e2ba2013-01-31 23:52:03 +01004454 [Define to 1 if you have the /dev/ptc device file.])
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004455fi
Neal Norwitz865400f2003-03-21 01:42:58 +00004456
Mark Dickinson82864d12009-11-15 16:18:58 +00004457if test "$have_long_long" = yes
4458then
4459 AC_MSG_CHECKING(for %lld and %llu printf() format support)
4460 AC_CACHE_VAL(ac_cv_have_long_long_format,
Matthias Klosec511b472010-05-08 11:01:39 +00004461 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
Mark Dickinson82864d12009-11-15 16:18:58 +00004462 #include <stdio.h>
4463 #include <stddef.h>
4464 #include <string.h>
4465
4466 #ifdef HAVE_SYS_TYPES_H
4467 #include <sys/types.h>
4468 #endif
4469
4470 int main()
4471 {
4472 char buffer[256];
4473
4474 if (sprintf(buffer, "%lld", (long long)123) < 0)
4475 return 1;
4476 if (strcmp(buffer, "123"))
4477 return 1;
4478
4479 if (sprintf(buffer, "%lld", (long long)-123) < 0)
4480 return 1;
4481 if (strcmp(buffer, "-123"))
4482 return 1;
4483
4484 if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
4485 return 1;
4486 if (strcmp(buffer, "123"))
4487 return 1;
4488
4489 return 0;
4490 }
Matthias Klosec511b472010-05-08 11:01:39 +00004491 ]]])],
4492 [ac_cv_have_long_long_format=yes],
4493 [ac_cv_have_long_long_format=no],
doko@python.orgd65e2ba2013-01-31 23:52:03 +01004494 [ac_cv_have_long_long_format="cross -- assuming no"
4495 if test x$GCC = xyes; then
4496 save_CFLAGS=$CFLAGS
4497 CFLAGS="$CFLAGS -Werror -Wformat"
4498 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4499 #include <stdio.h>
4500 #include <stddef.h>
4501 ]], [[
4502 char *buffer;
4503 sprintf(buffer, "%lld", (long long)123);
4504 sprintf(buffer, "%lld", (long long)-123);
4505 sprintf(buffer, "%llu", (unsigned long long)123);
4506 ]])],
4507 ac_cv_have_long_long_format=yes
4508 )
4509 CFLAGS=$save_CFLAGS
4510 fi])
Mark Dickinson82864d12009-11-15 16:18:58 +00004511 )
4512 AC_MSG_RESULT($ac_cv_have_long_long_format)
4513fi
4514
Mark Dickinson5ce84742009-12-31 20:48:04 +00004515if test "$ac_cv_have_long_long_format" = yes
Mark Dickinson82864d12009-11-15 16:18:58 +00004516then
4517 AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
4518 [Define to printf format modifier for long long type])
4519fi
4520
Ronald Oussoren315cd0c2009-11-19 16:25:21 +00004521if test $ac_sys_system = Darwin
4522then
4523 LIBS="$LIBS -framework CoreFoundation"
4524fi
4525
Mark Dickinson82864d12009-11-15 16:18:58 +00004526
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004527AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
Matthias Klosec511b472010-05-08 11:01:39 +00004528AC_RUN_IFELSE([AC_LANG_SOURCE([[
Alexandre Vassalottie7cf1182009-07-17 06:33:51 +00004529#include <stdio.h>
Brett Cannon09d12362006-05-11 05:11:33 +00004530#include <stddef.h>
4531#include <string.h>
4532
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004533#ifdef HAVE_SYS_TYPES_H
4534#include <sys/types.h>
4535#endif
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004536
4537#ifdef HAVE_SSIZE_T
4538typedef ssize_t Py_ssize_t;
4539#elif SIZEOF_VOID_P == SIZEOF_LONG
4540typedef long Py_ssize_t;
4541#else
4542typedef int Py_ssize_t;
4543#endif
Brett Cannon09d12362006-05-11 05:11:33 +00004544
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004545int main()
4546{
4547 char buffer[256];
4548
Brett Cannon09d12362006-05-11 05:11:33 +00004549 if(sprintf(buffer, "%zd", (size_t)123) < 0)
4550 return 1;
4551
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004552 if (strcmp(buffer, "123"))
Brett Cannon09d12362006-05-11 05:11:33 +00004553 return 1;
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004554
4555 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
4556 return 1;
4557
4558 if (strcmp(buffer, "-123"))
4559 return 1;
4560
Brett Cannon09d12362006-05-11 05:11:33 +00004561 return 0;
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004562}
Matthias Klosec511b472010-05-08 11:01:39 +00004563]])],
4564[ac_cv_have_size_t_format=yes],
4565[ac_cv_have_size_t_format=no],
4566[ac_cv_have_size_t_format="cross -- assuming yes"
4567])])
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004568if test "$ac_cv_have_size_t_format" != no ; then
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004569 AC_DEFINE(PY_FORMAT_SIZE_T, "z",
4570 [Define to printf format modifier for Py_ssize_t])
4571fi
Brett Cannon09d12362006-05-11 05:11:33 +00004572
Martin v. Löwis01c04012002-11-11 14:58:44 +00004573AC_CHECK_TYPE(socklen_t,,
4574 AC_DEFINE(socklen_t,int,
Matthias Klose5183ebd2010-04-24 16:38:36 +00004575 [Define to `int' if <sys/socket.h> does not define.]),[
Martin v. Löwis01c04012002-11-11 14:58:44 +00004576#ifdef HAVE_SYS_TYPES_H
4577#include <sys/types.h>
4578#endif
Guido van Rossum95713eb2000-05-18 20:53:31 +00004579#ifdef HAVE_SYS_SOCKET_H
4580#include <sys/socket.h>
4581#endif
Martin v. Löwis01c04012002-11-11 14:58:44 +00004582])
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004583
R. David Murray1d9d16e2010-10-16 00:43:13 +00004584case $ac_sys_system in
4585AIX*)
4586 AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;;
4587esac
4588
4589
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00004590AC_SUBST(THREADHEADERS)
4591
4592for h in `(cd $srcdir;echo Python/thread_*.h)`
4593do
4594 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4595done
4596
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004597AC_SUBST(SRCDIRS)
Neal Norwitzd24499d2005-12-18 21:36:39 +00004598SRCDIRS="Parser Grammar Objects Python Modules Mac"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00004599AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004600for dir in $SRCDIRS; do
4601 if test ! -d $dir; then
4602 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00004603 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004604done
Benjamin Peterson2c992a02015-05-28 12:45:31 -05004605
4606# BEGIN_COMPUTED_GOTO
4607# Check for --with-computed-gotos
4608AC_MSG_CHECKING(for --with-computed-gotos)
4609AC_ARG_WITH(computed-gotos,
4610 AS_HELP_STRING([--with(out)-computed-gotos],
4611 [Use computed gotos in evaluation loop (enabled by default on supported compilers)]),
4612[
4613if test "$withval" = yes
4614then
4615 AC_DEFINE(USE_COMPUTED_GOTOS, 1,
4616 [Define if you want to use computed gotos in ceval.c.])
4617 AC_MSG_RESULT(yes)
4618fi
4619if test "$withval" = no
4620then
4621 AC_DEFINE(USE_COMPUTED_GOTOS, 0,
4622 [Define if you want to use computed gotos in ceval.c.])
4623 AC_MSG_RESULT(no)
4624fi
4625],
4626[AC_MSG_RESULT(no value specified)])
4627
4628AC_MSG_CHECKING(whether $CC supports computed gotos)
4629AC_CACHE_VAL(ac_cv_computed_gotos,
4630AC_RUN_IFELSE([AC_LANG_SOURCE([[[
4631int main(int argc, char **argv)
4632{
4633 static void *targets[1] = { &&LABEL1 };
4634 goto LABEL2;
4635LABEL1:
4636 return 0;
4637LABEL2:
4638 goto *targets[0];
4639 return 1;
4640}
4641]]])],
4642[ac_cv_computed_gotos=yes],
4643[ac_cv_computed_gotos=no],
4644[if test "${with_computed_gotos+set}" = set; then
4645 ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos"
4646 else
4647 ac_cv_computed_gotos=no
4648 fi]))
4649AC_MSG_RESULT($ac_cv_computed_gotos)
4650case "$ac_cv_computed_gotos" in yes*)
4651 AC_DEFINE(HAVE_COMPUTED_GOTOS, 1,
4652 [Define if the C compiler supports computed gotos.])
4653esac
4654# END_COMPUTED_GOTO
4655
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004656AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00004657
Ned Deily3f1d0b32014-11-20 02:11:03 -08004658# ensurepip option
4659AC_MSG_CHECKING(for ensurepip)
4660AC_ARG_WITH(ensurepip,
4661 [AS_HELP_STRING([--with(out)-ensurepip=@<:@=OPTION@:>@],
4662 ["install" or "upgrade" using bundled pip, default is "no"])],
4663 [],
4664 [with_ensurepip=no])
4665AS_CASE($with_ensurepip,
4666 [yes|upgrade],[ENSUREPIP=upgrade],
4667 [install],[ENSUREPIP=install],
4668 [no],[ENSUREPIP=no],
4669 [AC_MSG_ERROR([--with-ensurepip=upgrade|install|no])])
4670AC_MSG_RESULT($ENSUREPIP)
4671AC_SUBST(ENSUREPIP)
4672
Guido van Rossum627b2d71993-12-24 10:39:16 +00004673# generate output files
Antoine Pitrouf2caeed2009-05-24 20:23:57 +00004674AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
Antoine Pitrouaabdceb2010-09-10 20:03:17 +00004675AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
Martin v. Löwis88afe662002-10-26 13:47:44 +00004676AC_OUTPUT
Neil Schemenauer61c51152001-01-26 16:18:16 +00004677
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004678echo "creating Modules/Setup"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004679if test ! -f Modules/Setup
4680then
4681 cp $srcdir/Modules/Setup.dist Modules/Setup
4682fi
4683
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004684echo "creating Modules/Setup.local"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004685if test ! -f Modules/Setup.local
4686then
4687 echo "# Edit this file for local setup changes" >Modules/Setup.local
4688fi
4689
4690echo "creating Makefile"
4691$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4692 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00004693 Modules/Setup.local Modules/Setup
Skip Montanaro7221d932007-08-22 19:02:16 +00004694
4695case $ac_sys_system in
4696BeOS)
4697 AC_MSG_WARN([
4698
4699 Support for BeOS is deprecated as of Python 2.6.
4700 See PEP 11 for the gory details.
4701 ])
4702 ;;
4703*) ;;
4704esac
4705
Neil Schemenauer66252162001-02-19 04:47:42 +00004706mv config.c Modules