blob: 3a87ff11372864d55ebb34a3bdcab3aafb1b83ec [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
Alexandre Vassalotti130ae152009-07-18 00:31:06 +00008dnl Some m4 magic to ensure that the configure script is generated
9dnl by the correct autoconf version.
10m4_define([version_required],
11[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), 0,
12 [],
13 [m4_fatal([Autoconf version $1 is required for Python], 63)])
14])
Matthias Klosea0bea5d2010-05-08 10:00:28 +000015version_required(2.65)
Alexandre Vassalotti130ae152009-07-18 00:31:06 +000016
Guido van Rossum76be6ed1995-01-02 18:33:54 +000017AC_REVISION($Revision$)
Georg Brandl464432d2009-05-20 18:24:08 +000018AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
Martin v. Löwis88afe662002-10-26 13:47:44 +000019AC_CONFIG_SRCDIR([Include/object.h])
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +000020AC_CONFIG_HEADER(pyconfig.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +000021
Georg Brandlbcd64a32009-03-31 21:45:18 +000022dnl Ensure that if prefix is specified, it does not end in a slash. If
23dnl it does, we get path names containing '//' which is both ugly and
24dnl can cause trouble.
25
26dnl Last slash shouldn't be stripped if prefix=/
27if test "$prefix" != "/"; then
28 prefix=`echo "$prefix" | sed -e 's/\/$//g'`
29fi
30
Martin v. Löwis8316feb2003-06-14 07:48:07 +000031dnl This is for stuff that absolutely must end up in pyconfig.h.
32dnl Please use pyport.h instead, if possible.
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000033AH_TOP([
34#ifndef Py_PYCONFIG_H
35#define Py_PYCONFIG_H
36])
Martin v. Löwis11437992002-04-12 09:54:03 +000037AH_BOTTOM([
Martin v. Löwis11437992002-04-12 09:54:03 +000038/* Define the macros needed if on a UnixWare 7.x system. */
39#if defined(__USLC__) && defined(__SCO_VERSION__)
40#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
41#endif
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000042
43#endif /*Py_PYCONFIG_H*/
Martin v. Löwis11437992002-04-12 09:54:03 +000044])
45
Martin v. Löwis8316feb2003-06-14 07:48:07 +000046# We don't use PACKAGE_ variables, and they cause conflicts
47# with other autoconf-based packages that include Python.h
48grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
49rm confdefs.h
50mv confdefs.h.new confdefs.h
51
Guido van Rossum642b6781997-07-19 19:35:41 +000052AC_SUBST(VERSION)
Martin v. Löwis88afe662002-10-26 13:47:44 +000053VERSION=PYTHON_VERSION
Guido van Rossum642b6781997-07-19 19:35:41 +000054
Martin v. Löwis1142de32002-03-29 16:28:31 +000055AC_SUBST(SOVERSION)
56SOVERSION=1.0
57
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +000058# The later defininition of _XOPEN_SOURCE disables certain features
59# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
60AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
61
Martin v. Löwisbcd93962003-05-03 10:32:18 +000062# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
63# certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
64# them.
65AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
66
Andrew MacIntyreabccf412003-07-02 13:53:25 +000067# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
68# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
69# them.
70AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
71
Martin v. Löwisd6320502004-08-12 13:45:08 +000072# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
73# u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
74AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
75
Ronald Oussoren5640ce22008-06-05 12:58:24 +000076# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
77# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
78# them.
79AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
80
81
Martin v. Löwise981a4e2002-11-11 13:26:51 +000082define_xopen_source=yes
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +000083
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +000084# Arguments passed to configure.
85AC_SUBST(CONFIG_ARGS)
86CONFIG_ARGS="$ac_configure_args"
87
Ronald Oussoren3c0a1262010-01-17 19:27:57 +000088AC_MSG_CHECKING([for --enable-universalsdk])
Ronald Oussoren988117f2006-04-29 11:31:35 +000089AC_ARG_ENABLE(universalsdk,
Matthias Klose22520ea2010-05-08 10:14:46 +000090 AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build against Mac OS X 10.4u SDK (ppc/i386)]),
Ronald Oussoren988117f2006-04-29 11:31:35 +000091[
92 case $enableval in
93 yes)
94 enableval=/Developer/SDKs/MacOSX10.4u.sdk
Ronald Oussoren3c0a1262010-01-17 19:27:57 +000095 if test ! -d "${enableval}"
96 then
97 enableval=/
98 fi
Ronald Oussoren988117f2006-04-29 11:31:35 +000099 ;;
100 esac
101 case $enableval in
102 no)
103 UNIVERSALSDK=
104 enable_universalsdk=
105 ;;
106 *)
107 UNIVERSALSDK=$enableval
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000108 if test ! -d "${UNIVERSALSDK}"
109 then
110 AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
111 fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000112 ;;
113 esac
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000114
Ronald Oussoren988117f2006-04-29 11:31:35 +0000115],[
116 UNIVERSALSDK=
117 enable_universalsdk=
118])
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000119if test -n "${UNIVERSALSDK}"
120then
121 AC_MSG_RESULT(${UNIVERSALSDK})
122else
123 AC_MSG_RESULT(no)
124fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000125AC_SUBST(UNIVERSALSDK)
126
Benjamin Peterson0e6ea5d2008-07-16 20:17:04 +0000127AC_SUBST(ARCH_RUN_32BIT)
128
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000129UNIVERSAL_ARCHS="32-bit"
Ronald Oussoren92919a62009-12-24 13:30:58 +0000130AC_SUBST(LIPO_32BIT_FLAGS)
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000131AC_MSG_CHECKING(for --with-universal-archs)
132AC_ARG_WITH(universal-archs,
Matthias Klose22520ea2010-05-08 10:14:46 +0000133 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 +0000134[
135 AC_MSG_RESULT($withval)
136 UNIVERSAL_ARCHS="$withval"
Ronald Oussoren9ebd2422009-09-29 13:00:44 +0000137 if test "${enable_universalsdk}" ; then
138 :
139 else
140 AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
141 fi
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000142],
143[
144 AC_MSG_RESULT(32-bit)
145])
146
147
148
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000149AC_ARG_WITH(framework-name,
Matthias Klose22520ea2010-05-08 10:14:46 +0000150 AS_HELP_STRING([--with-framework-name=FRAMEWORK],
Matthias Klose5183ebd2010-04-24 16:38:36 +0000151 [specify an alternate name of the framework built with --enable-framework]),
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000152[
Ronald Oussoren9ebd2422009-09-29 13:00:44 +0000153 if test "${enable_framework}"; then
154 :
155 else
156 AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
157 fi
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000158 PYTHONFRAMEWORK=${withval}
159 PYTHONFRAMEWORKDIR=${withval}.framework
160 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
161 ],[
162 PYTHONFRAMEWORK=Python
163 PYTHONFRAMEWORKDIR=Python.framework
164 PYTHONFRAMEWORKIDENTIFIER=org.python.python
165])
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000166dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000167AC_ARG_ENABLE(framework,
Matthias Klose22520ea2010-05-08 10:14:46 +0000168 AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@], [Build (MacOSX|Darwin) framework]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000169[
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000170 case $enableval in
171 yes)
172 enableval=/Library/Frameworks
Jack Jansen127e56e2001-09-11 14:41:54 +0000173 esac
174 case $enableval in
175 no)
176 PYTHONFRAMEWORK=
177 PYTHONFRAMEWORKDIR=no-framework
178 PYTHONFRAMEWORKPREFIX=
179 PYTHONFRAMEWORKINSTALLDIR=
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000180 FRAMEWORKINSTALLFIRST=
181 FRAMEWORKINSTALLLAST=
Ronald Oussoren5b787322006-06-06 19:50:24 +0000182 FRAMEWORKALTINSTALLFIRST=
183 FRAMEWORKALTINSTALLLAST=
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000184 if test "x${prefix}" = "xNONE"; then
185 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
186 else
187 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
188 fi
Jack Jansen127e56e2001-09-11 14:41:54 +0000189 enable_framework=
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000190 ;;
191 *)
Ronald Oussoren01d149f2010-04-30 11:20:14 +0000192 PYTHONFRAMEWORKPREFIX="${enableval}"
Jack Jansen127e56e2001-09-11 14:41:54 +0000193 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000194 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000195 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
Ronald Oussoren92919a62009-12-24 13:30:58 +0000196 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
197 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
Ronald Oussoren01d149f2010-04-30 11:20:14 +0000198 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000199
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000200 if test "x${prefix}" = "xNONE" ; then
201 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
Ronald Oussoren01d149f2010-04-30 11:20:14 +0000202
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000203 else
204 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
205 fi
Ronald Oussoren01d149f2010-04-30 11:20:14 +0000206
207 case "${enableval}" in
208 /System*)
209 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
210 if test "${prefix}" = "NONE" ; then
211 # See below
212 FRAMEWORKUNIXTOOLSPREFIX="/usr"
213 fi
214 ;;
215
216 /Library*)
217 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
218 ;;
219
220 */Library/Frameworks)
221 MDIR="`dirname "${enableval}"`"
222 MDIR="`dirname "${MDIR}"`"
223 FRAMEWORKINSTALLAPPSPREFIX="${MDIR}/Applications"
224
225 if test "${prefix}" = "NONE"; then
226 # User hasn't specified the
227 # --prefix option, but wants to install
228 # the framework in a non-default location,
229 # ensure that the compatibility links get
230 # installed relative to that prefix as well
231 # instead of in /usr/local.
232 FRAMEWORKUNIXTOOLSPREFIX="${MDIR}"
233 fi
234 ;;
235
236 *)
237 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
238 ;;
239 esac
240
Jack Jansen127e56e2001-09-11 14:41:54 +0000241 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
Ronald Oussoren836b0392006-05-14 19:56:34 +0000242
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000243 # Add files for Mac specific code to the list of output
Ronald Oussoren836b0392006-05-14 19:56:34 +0000244 # files:
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000245 AC_CONFIG_FILES(Mac/Makefile)
246 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
247 AC_CONFIG_FILES(Mac/IDLE/Makefile)
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000248 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
249 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000250 esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000251 ],[
252 PYTHONFRAMEWORK=
Jack Jansen127e56e2001-09-11 14:41:54 +0000253 PYTHONFRAMEWORKDIR=no-framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000254 PYTHONFRAMEWORKPREFIX=
255 PYTHONFRAMEWORKINSTALLDIR=
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000256 FRAMEWORKINSTALLFIRST=
257 FRAMEWORKINSTALLLAST=
Ronald Oussoren5b787322006-06-06 19:50:24 +0000258 FRAMEWORKALTINSTALLFIRST=
259 FRAMEWORKALTINSTALLLAST=
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000260 if test "x${prefix}" = "xNONE" ; then
261 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
262 else
263 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
264 fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000265 enable_framework=
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000266
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000267])
268AC_SUBST(PYTHONFRAMEWORK)
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000269AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000270AC_SUBST(PYTHONFRAMEWORKDIR)
271AC_SUBST(PYTHONFRAMEWORKPREFIX)
272AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000273AC_SUBST(FRAMEWORKINSTALLFIRST)
274AC_SUBST(FRAMEWORKINSTALLLAST)
Ronald Oussoren5b787322006-06-06 19:50:24 +0000275AC_SUBST(FRAMEWORKALTINSTALLFIRST)
276AC_SUBST(FRAMEWORKALTINSTALLLAST)
277AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
Ronald Oussoren01d149f2010-04-30 11:20:14 +0000278AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000279
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000280##AC_ARG_WITH(dyld,
Matthias Klose22520ea2010-05-08 10:14:46 +0000281## AS_HELP_STRING([--with-dyld],
282## [Use (OpenStep|Rhapsody) dynamic linker]))
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000283##
Guido van Rossumb418f891996-07-30 18:06:02 +0000284# Set name for machine-dependent library files
285AC_SUBST(MACHDEP)
286AC_MSG_CHECKING(MACHDEP)
287if test -z "$MACHDEP"
288then
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000289 ac_sys_system=`uname -s`
Georg Brandlfe18a112009-09-04 07:55:14 +0000290 if test "$ac_sys_system" = "AIX" \
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000291 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000292 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +0000293 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000294 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +0000295 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000296 ac_md_system=`echo $ac_sys_system |
297 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
298 ac_md_release=`echo $ac_sys_release |
Guido van Rossum67b26592001-10-20 14:21:45 +0000299 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +0000300 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000301
Guido van Rossumbcd91e01997-03-20 20:46:29 +0000302 case $MACHDEP in
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +0000303 cygwin*) MACHDEP="cygwin";;
Jack Jansen8a97f4a2001-12-05 23:27:32 +0000304 darwin*) MACHDEP="darwin";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000305 atheos*) MACHDEP="atheos";;
Martin v. Löwisf3322282003-07-13 09:46:13 +0000306 irix646) MACHDEP="irix6";;
Guido van Rossumb97ef171997-09-28 05:44:03 +0000307 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000308 esac
309fi
Jack Jansen83f898c2002-12-30 22:23:40 +0000310
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000311# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
312# disable features if it is defined, without any means to access these
313# features as extensions. For these systems, we skip the definition of
314# _XOPEN_SOURCE. Before adding a system to the list to gain access to
315# some feature, make sure there is no alternative way to access this
316# feature. Also, when using wildcards, make sure you have verified the
317# need for not defining _XOPEN_SOURCE on all systems matching the
318# wildcard, and that the wildcard does not include future systems
319# (which may remove their limitations).
320dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
321case $ac_sys_system/$ac_sys_release in
322 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
323 # even though select is a POSIX function. Reported by J. Ribbens.
Martin v. Löwis76bafc62003-10-03 13:47:44 +0000324 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
Martin v. Löwis7875ef62010-02-15 21:41:12 +0000325 # In addition, Stefan Krah confirms that issue #1244610 exists through
326 # OpenBSD 4.6, but is fixed in 4.7.
327 OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123456@:>@)
Martin v. Löwiscb78de62007-12-29 18:49:21 +0000328 define_xopen_source=no
329 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
330 # also defined. This can be overridden by defining _BSD_SOURCE
331 # As this has a different meaning on Linux, only define it on OpenBSD
332 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
333 ;;
Martin v. Löwis7875ef62010-02-15 21:41:12 +0000334 OpenBSD/4.@<:@789@:>@)
Martin v. Löwis5e2dd862010-02-15 08:32:00 +0000335 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
336 # also defined. This can be overridden by defining _BSD_SOURCE
337 # As this has a different meaning on Linux, only define it on OpenBSD
338 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
339 ;;
Martin v. Löwis4d542ec2006-11-25 15:39:19 +0000340 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
341 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
342 # Marc Recht
Georg Brandl4b9bcfc2008-11-16 08:00:17 +0000343 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 +0000344 define_xopen_source=no;;
Martin v. Löwisb41afb52010-05-28 15:28:47 +0000345 # From the perspective of Solaris, _XOPEN_SOURCE is not so much a
346 # request to enable features supported by the standard as a request
347 # to disable features not supported by the standard. The best way
348 # for Python to use Solaris is simply to leave _XOPEN_SOURCE out
349 # entirely and define __EXTENSIONS__ instead.
350 SunOS/*)
Martin v. Löwisa9d71422003-03-28 18:43:31 +0000351 define_xopen_source=no;;
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000352 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
353 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
Martin v. Löwis253d1f42004-05-07 19:14:14 +0000354 # Reconfirmed for 7.1.4 by Martin v. Loewis.
355 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000356 define_xopen_source=no;;
357 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000358 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000359 SCO_SV/3.2)
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000360 define_xopen_source=no;;
Martin v. Löwisbb86d832008-11-04 20:40:09 +0000361 # On FreeBSD 4, the math functions C89 does not cover are never defined
362 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
363 FreeBSD/4.*)
364 define_xopen_source=no;;
365 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
366 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
367 # identifies itself as Darwin/7.*
368 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
369 # disables platform specific features beyond repair.
370 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
371 # has no effect, don't bother defining them
372 Darwin/@<:@6789@:>@.*)
Anthony Baxter6169c6b2003-10-04 07:46:23 +0000373 define_xopen_source=no;;
Ronald Oussorena55af9a2010-01-17 16:25:57 +0000374 Darwin/1@<:@0-9@:>@.*)
375 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000376 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
377 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
378 # or has another value. By not (re)defining it, the defaults come in place.
Martin v. Löwisc19c5a62003-11-18 20:00:44 +0000379 AIX/4)
380 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000381 AIX/5)
382 if test `uname -r` -eq 1; then
383 define_xopen_source=no
384 fi
385 ;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000386 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
387 # defining NI_NUMERICHOST.
388 QNX/6.3.2)
389 define_xopen_source=no
390 ;;
Martin v. Löwisa0588362006-04-04 06:03:50 +0000391
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000392esac
393
394if test $define_xopen_source = yes
395then
Martin v. Löwisb41afb52010-05-28 15:28:47 +0000396 AC_DEFINE(_XOPEN_SOURCE, 600,
397 Define to the level of X/Open that your system supports)
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000398
399 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
400 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
401 # several APIs are not declared. Since this is also needed in some
402 # cases for HP-UX, we define it globally.
Martin v. Löwisb41afb52010-05-28 15:28:47 +0000403 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
404 Define to activate Unix95-and-earlier features)
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000405
Bob Ippolito7026a0a2005-03-28 23:23:47 +0000406 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
407
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000408fi
409
Guido van Rossum91922671997-10-09 20:24:13 +0000410#
411# SGI compilers allow the specification of the both the ABI and the
412# ISA on the command line. Depending on the values of these switches,
413# different and often incompatable code will be generated.
414#
415# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
416# thus supply support for various ABI/ISA combinations. The MACHDEP
417# variable is also adjusted.
418#
419AC_SUBST(SGI_ABI)
420if test ! -z "$SGI_ABI"
421then
422 CC="cc $SGI_ABI"
423 LDFLAGS="$SGI_ABI $LDFLAGS"
424 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
425fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000426AC_MSG_RESULT($MACHDEP)
427
Jack Jansen83f898c2002-12-30 22:23:40 +0000428# And add extra plat-mac for darwin
429AC_SUBST(EXTRAPLATDIR)
Jack Jansen7b59b422003-03-17 15:44:10 +0000430AC_SUBST(EXTRAMACHDEPPATH)
Jack Jansen83f898c2002-12-30 22:23:40 +0000431AC_MSG_CHECKING(EXTRAPLATDIR)
432if test -z "$EXTRAPLATDIR"
433then
434 case $MACHDEP in
Jack Jansen7b59b422003-03-17 15:44:10 +0000435 darwin)
436 EXTRAPLATDIR="\$(PLATMACDIRS)"
437 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
438 ;;
439 *)
440 EXTRAPLATDIR=""
441 EXTRAMACHDEPPATH=""
442 ;;
Jack Jansen83f898c2002-12-30 22:23:40 +0000443 esac
444fi
445AC_MSG_RESULT($EXTRAPLATDIR)
446
Jack Jansen6b08a402004-06-03 12:41:45 +0000447# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
448# it may influence the way we can build extensions, so distutils
449# needs to check it
450AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
Ronald Oussoren988117f2006-04-29 11:31:35 +0000451AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
Jack Jansen6b08a402004-06-03 12:41:45 +0000452CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
Ronald Oussoren988117f2006-04-29 11:31:35 +0000453EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
Jack Jansen6b08a402004-06-03 12:41:45 +0000454
Mark Dickinson65134662008-04-25 16:11:04 +0000455AC_MSG_CHECKING(machine type as reported by uname -m)
456ac_sys_machine=`uname -m`
457AC_MSG_RESULT($ac_sys_machine)
458
Guido van Rossum627b2d71993-12-24 10:39:16 +0000459# checks for alternative programs
Skip Montanarodecc6a42003-01-01 20:07:49 +0000460
461# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
462# for debug/optimization stuff. BASECFLAGS is for flags that are required
463# just to get things to compile and link. Users are free to override OPT
464# when running configure or make. The build should not break if they do.
465# BASECFLAGS should generally not be messed with, however.
466
467# XXX shouldn't some/most/all of this code be merged with the stuff later
468# on that fiddles with OPT and BASECFLAGS?
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000469AC_MSG_CHECKING(for --without-gcc)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000470AC_ARG_WITH(gcc,
Matthias Klose22520ea2010-05-08 10:14:46 +0000471 AS_HELP_STRING([--without-gcc], [never use gcc]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000472[
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000473 case $withval in
Skip Montanaro516144f2009-01-04 10:36:58 +0000474 no) CC=${CC:-cc}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000475 without_gcc=yes;;
476 yes) CC=gcc
477 without_gcc=no;;
478 *) CC=$withval
479 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000480 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000481 case $ac_sys_system in
Antoine Pitrou285cd162010-09-21 15:23:17 +0000482 AIX*) CC=${CC:-xlc_r}
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000483 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000484 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000485 case $BE_HOST_CPU in
486 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000487 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000488 without_gcc=yes
Skip Montanarodecc6a42003-01-01 20:07:49 +0000489 BASECFLAGS="$BASECFLAGS -export pragma"
490 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000491 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000492 ;;
493 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000494 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000495 without_gcc=no
Skip Montanarodecc6a42003-01-01 20:07:49 +0000496 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000497 ;;
498 *)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000499 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000500 ;;
501 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000502 AR="\$(srcdir)/Modules/ar_beos"
503 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000504 ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000505 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000506 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000507AC_MSG_RESULT($without_gcc)
508
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000509# If the user switches compilers, we can't believe the cache
510if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
511then
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000512 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
513(it is also a good idea to do 'make clean' before compiling)])
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000514fi
515
Marc-André Lemburg6d5e5792010-04-30 17:20:14 +0000516# If the user set CFLAGS, use this instead of the automatically
517# determined setting
518preset_cflags="$CFLAGS"
Guido van Rossum627b2d71993-12-24 10:39:16 +0000519AC_PROG_CC
Marc-André Lemburg6d5e5792010-04-30 17:20:14 +0000520if test ! -z "$preset_cflags"
521then
522 CFLAGS=$preset_cflags
523fi
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000524
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000525AC_SUBST(CXX)
526AC_SUBST(MAINCC)
527AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
528AC_ARG_WITH(cxx_main,
Matthias Klose22520ea2010-05-08 10:14:46 +0000529 AS_HELP_STRING([--with-cxx-main=<compiler>],
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000530 [compile main() and link python executable with C++ compiler]),
531[
532
533 case $withval in
534 no) with_cxx_main=no
535 MAINCC='$(CC)';;
536 yes) with_cxx_main=yes
537 MAINCC='$(CXX)';;
538 *) with_cxx_main=yes
539 MAINCC=$withval
540 if test -z "$CXX"
541 then
542 CXX=$withval
543 fi;;
544 esac], [
545 with_cxx_main=no
546 MAINCC='$(CC)'
547])
548AC_MSG_RESULT($with_cxx_main)
549
550preset_cxx="$CXX"
551if test -z "$CXX"
552then
553 case "$CC" in
554 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
555 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
556 esac
557 if test "$CXX" = "notfound"
558 then
559 CXX=""
560 fi
561fi
562if test -z "$CXX"
563then
564 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
565 if test "$CXX" = "notfound"
566 then
567 CXX=""
568 fi
569fi
570if test "$preset_cxx" != "$CXX"
571then
572 AC_MSG_WARN([
573
574 By default, distutils will build C++ extension modules with "$CXX".
575 If this is not intended, then set CXX on the configure command line.
576 ])
577fi
578
579
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000580# checks for UNIX variants that set C preprocessor variables
Matthias Klose9f8e0c12010-05-08 10:17:27 +0000581AC_USE_SYSTEM_EXTENSIONS
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000582
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000583# Check for unsupported systems
584case $ac_sys_system/$ac_sys_release in
Brett Cannon19fab762007-06-02 03:02:29 +0000585atheos*|Linux*/1*)
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000586 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
587 echo See README for details.
588 exit 1;;
589esac
590
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000591AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000592AC_MSG_CHECKING(for --with-suffix)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000593AC_ARG_WITH(suffix,
Matthias Klose22520ea2010-05-08 10:14:46 +0000594 AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000595[
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000596 case $withval in
597 no) EXEEXT=;;
598 yes) EXEEXT=.exe;;
599 *) EXEEXT=$withval;;
600 esac])
601AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000602
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000603# Test whether we're running on a non-case-sensitive system, in which
604# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000605AC_SUBST(BUILDEXEEXT)
606AC_MSG_CHECKING(for case-insensitive build directory)
Jack Jansen3c2c4332002-11-06 13:33:32 +0000607if test ! -d CaseSensitiveTestDir; then
608mkdir CaseSensitiveTestDir
609fi
610
611if test -d casesensitivetestdir
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000612then
Jack Jansen1999ef42001-12-06 21:47:20 +0000613 AC_MSG_RESULT(yes)
614 BUILDEXEEXT=.exe
615else
616 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000617 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000618fi
Jack Jansen3c2c4332002-11-06 13:33:32 +0000619rmdir CaseSensitiveTestDir
Guido van Rossumfb842551997-08-06 23:42:07 +0000620
Guido van Rossumdd997f71998-10-07 19:58:26 +0000621case $MACHDEP in
622bsdos*)
623 case $CC in
624 gcc) CC="$CC -D_HAVE_BSDI";;
625 esac;;
626esac
627
Guido van Rossum84561611997-08-21 00:08:11 +0000628case $ac_sys_system in
629hp*|HP*)
630 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000631 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000632 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000633SunOS*)
634 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000635 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000636 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000637esac
638
Martin v. Löwise8964d42001-03-06 12:09:07 +0000639
Neil Schemenauer61c51152001-01-26 16:18:16 +0000640AC_SUBST(LIBRARY)
641AC_MSG_CHECKING(LIBRARY)
642if test -z "$LIBRARY"
643then
644 LIBRARY='libpython$(VERSION).a'
645fi
646AC_MSG_RESULT($LIBRARY)
647
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000648# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000649# name of the library into which to insert object files). BLDLIBRARY is also
650# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
651# is blank as the main program is not linked directly against LDLIBRARY.
652# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
653# systems without shared libraries, LDLIBRARY is the same as LIBRARY
654# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
655# DLLLIBRARY is the shared (i.e., DLL) library.
656#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000657# RUNSHARED is used to run shared python without installed libraries
658#
659# INSTSONAME is the name of the shared library that will be use to install
660# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000661AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000662AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000663AC_SUBST(BLDLIBRARY)
664AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000665AC_SUBST(INSTSONAME)
666AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000667LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000668BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis09bdf722002-05-08 08:51:29 +0000669INSTSONAME='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000670DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000671LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000672RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000673
Guido van Rossumfb842551997-08-06 23:42:07 +0000674# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000675# If CXX is set, and if it is needed to link a main function that was
676# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
677# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000678# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000679# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000680AC_SUBST(LINKCC)
681AC_MSG_CHECKING(LINKCC)
682if test -z "$LINKCC"
683then
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000684 LINKCC='$(PURIFY) $(MAINCC)'
Guido van Rossumfb842551997-08-06 23:42:07 +0000685 case $ac_sys_system in
686 AIX*)
Neal Norwitz0b27ff92003-03-31 15:53:49 +0000687 exp_extra="\"\""
688 if test $ac_sys_release -ge 5 -o \
689 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
690 exp_extra="."
691 fi
692 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000693 QNX*)
694 # qcc must be used because the other compilers do not
695 # support -N.
696 LINKCC=qcc;;
Guido van Rossumfb842551997-08-06 23:42:07 +0000697 esac
698fi
699AC_MSG_RESULT($LINKCC)
700
Tarek Ziadée2be83d2009-05-09 08:28:53 +0000701# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
702# make sure we default having it set to "no": this is used by
703# distutils.unixccompiler to know if it should add --enable-new-dtags
704# to linker command lines, and failing to detect GNU ld simply results
705# in the same bahaviour as before.
706AC_SUBST(GNULD)
707AC_MSG_CHECKING(for GNU ld)
708ac_prog=ld
709if test "$GCC" = yes; then
710 ac_prog=`$CC -print-prog-name=ld`
711fi
712case `"$ac_prog" -V 2>&1 < /dev/null` in
713 *GNU*)
714 GNULD=yes;;
715 *)
716 GNULD=no;;
717esac
718AC_MSG_RESULT($GNULD)
719
Martin v. Löwis1142de32002-03-29 16:28:31 +0000720AC_MSG_CHECKING(for --enable-shared)
721AC_ARG_ENABLE(shared,
Matthias Klose22520ea2010-05-08 10:14:46 +0000722 AS_HELP_STRING([--enable-shared], [disable/enable building shared python library]))
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000723
Martin v. Löwis1142de32002-03-29 16:28:31 +0000724if test -z "$enable_shared"
725then
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000726 case $ac_sys_system in
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000727 CYGWIN* | atheos*)
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000728 enable_shared="yes";;
729 *)
730 enable_shared="no";;
731 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000732fi
733AC_MSG_RESULT($enable_shared)
734
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000735AC_MSG_CHECKING(for --enable-profiling)
736AC_ARG_ENABLE(profiling,
Matthias Klose22520ea2010-05-08 10:14:46 +0000737 AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]),
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000738[ac_save_cc="$CC"
739 CC="$CC -pg"
Matthias Klosec511b472010-05-08 11:01:39 +0000740 AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
741 [ac_enable_profiling="yes"],
742 [ac_enable_profiling="no"],
743 [ac_enable_profiling="no"])
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000744 CC="$ac_save_cc"])
745AC_MSG_RESULT($ac_enable_profiling)
746
747case "$ac_enable_profiling" in
748 "yes")
749 BASECFLAGS="-pg $BASECFLAGS"
750 LDFLAGS="-pg $LDFLAGS"
751 ;;
752esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000753
754AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000755
Guido van Rossumb8552162001-09-05 14:58:11 +0000756# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
757# library that we build, but we do not want to link against it (we
758# will find it with a -framework option). For this reason there is an
759# extra variable BLDLIBRARY against which Python and the extension
760# modules are linked, BLDLIBRARY. This is normally the same as
761# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000762if test "$enable_framework"
763then
764 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen66b84832003-07-04 12:14:39 +0000765 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000766 BLDLIBRARY=''
767else
768 BLDLIBRARY='$(LDLIBRARY)'
769fi
770
Martin v. Löwis1142de32002-03-29 16:28:31 +0000771# Other platforms follow
772if test $enable_shared = "yes"; then
Mark Hammond8235ea12002-07-19 06:55:41 +0000773 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
Martin v. Löwis1142de32002-03-29 16:28:31 +0000774 case $ac_sys_system in
775 BeOS*)
776 LDLIBRARY='libpython$(VERSION).so'
777 ;;
778 CYGWIN*)
779 LDLIBRARY='libpython$(VERSION).dll.a'
780 DLLLIBRARY='libpython$(VERSION).dll'
781 ;;
782 SunOS*)
783 LDLIBRARY='libpython$(VERSION).so'
Martin v. Löwisd141a8c2003-06-14 15:20:28 +0000784 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000785 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Martin v. Löwis2389c412003-10-31 15:42:07 +0000786 INSTSONAME="$LDLIBRARY".$SOVERSION
Martin v. Löwis1142de32002-03-29 16:28:31 +0000787 ;;
Martin v. Löwis86d66262006-02-17 08:40:11 +0000788 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000789 LDLIBRARY='libpython$(VERSION).so'
790 BLDLIBRARY='-L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000791 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Hye-Shik Chang33761492004-10-26 09:53:46 +0000792 case $ac_sys_system in
793 FreeBSD*)
794 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
795 ;;
796 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000797 INSTSONAME="$LDLIBRARY".$SOVERSION
798 ;;
799 hp*|HP*)
Neal Norwitz58e28882006-05-19 07:00:58 +0000800 case `uname -m` in
801 ia64)
802 LDLIBRARY='libpython$(VERSION).so'
803 ;;
804 *)
805 LDLIBRARY='libpython$(VERSION).sl'
806 ;;
807 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000808 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000809 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000810 ;;
811 OSF*)
812 LDLIBRARY='libpython$(VERSION).so'
Neal Norwitz671b9e32006-01-09 07:07:12 +0000813 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000814 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000815 ;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000816 atheos*)
817 LDLIBRARY='libpython$(VERSION).so'
818 BLDLIBRARY='-L. -lpython$(VERSION)'
819 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
820 ;;
Ronald Oussoren79f90492009-01-02 10:44:46 +0000821 Darwin*)
822 LDLIBRARY='libpython$(VERSION).dylib'
823 BLDLIBRARY='-L. -lpython$(VERSION)'
824 RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
825 ;;
Antoine Pitrouaabdceb2010-09-10 20:03:17 +0000826 AIX*)
827 LDLIBRARY='libpython$(VERSION).so'
828 RUNSHARED=LIBPATH=`pwd`:${LIBPATH}
829 ;;
Ronald Oussoren79f90492009-01-02 10:44:46 +0000830
Martin v. Löwis1142de32002-03-29 16:28:31 +0000831 esac
Jason Tishler30765592003-09-04 11:04:06 +0000832else # shared is disabled
833 case $ac_sys_system in
834 CYGWIN*)
835 BLDLIBRARY='$(LIBRARY)'
836 LDLIBRARY='libpython$(VERSION).dll.a'
837 ;;
838 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000839fi
840
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000841AC_MSG_RESULT($LDLIBRARY)
842
Guido van Rossum627b2d71993-12-24 10:39:16 +0000843AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000844AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000845AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000846
Tarek Ziadé99f660a2009-05-07 21:20:34 +0000847# tweak ARFLAGS only if the user didn't set it on the command line
848AC_SUBST(ARFLAGS)
849if test -z "$ARFLAGS"
850then
851 ARFLAGS="rc"
852fi
853
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000854AC_SUBST(SVNVERSION)
Martin v. Löwisff600232006-04-03 19:12:32 +0000855AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000856if test $SVNVERSION = found
857then
858 SVNVERSION="svnversion \$(srcdir)"
859else
Benjamin Petersone5afa3b2009-05-23 19:24:37 +0000860 SVNVERSION="echo Unversioned directory"
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000861fi
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000862
Neil Schemenauera42c8272001-03-31 00:01:55 +0000863case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +0000864bsdos*|hp*|HP*)
865 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +0000866 if test -z "$INSTALL"
867 then
868 INSTALL="${srcdir}/install-sh -c"
869 fi
870esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000871AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000872
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000873# Not every filesystem supports hard links
874AC_SUBST(LN)
875if test -z "$LN" ; then
876 case $ac_sys_system in
877 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000878 CYGWIN*) LN="ln -s";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000879 atheos*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000880 *) LN=ln;;
881 esac
882fi
883
Fred Drake9f715822001-07-11 06:27:00 +0000884# Check for --with-pydebug
885AC_MSG_CHECKING(for --with-pydebug)
886AC_ARG_WITH(pydebug,
Matthias Klose22520ea2010-05-08 10:14:46 +0000887 AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000888[
Fred Drake9f715822001-07-11 06:27:00 +0000889if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000890then
891 AC_DEFINE(Py_DEBUG, 1,
892 [Define if you want to build an interpreter with many run-time checks.])
893 AC_MSG_RESULT(yes);
894 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +0000895else AC_MSG_RESULT(no); Py_DEBUG='false'
896fi],
897[AC_MSG_RESULT(no)])
898
Skip Montanarodecc6a42003-01-01 20:07:49 +0000899# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
900# merged with this chunk of code?
901
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000902# Optimizer/debugger flags
Skip Montanarodecc6a42003-01-01 20:07:49 +0000903# ------------------------
904# (The following bit of code is complicated enough - please keep things
905# indented properly. Just pretend you're editing Python code. ;-)
906
907# There are two parallel sets of case statements below, one that checks to
908# see if OPT was set and one that does BASECFLAGS setting based upon
909# compiler and platform. BASECFLAGS tweaks need to be made even if the
910# user set OPT.
911
912# tweak OPT based on compiler and platform, only if the user didn't set
913# it on the command line
Guido van Rossumb418f891996-07-30 18:06:02 +0000914AC_SUBST(OPT)
Benjamin Petersond4b721b2010-03-23 20:58:37 +0000915if test "${OPT-unset}" = "unset"
Guido van Rossumb418f891996-07-30 18:06:02 +0000916then
Skip Montanarodecc6a42003-01-01 20:07:49 +0000917 case $GCC in
918 yes)
Skip Montanaro288a5be2006-04-13 02:00:56 +0000919 if test "$CC" != 'g++' ; then
920 STRICT_PROTO="-Wstrict-prototypes"
921 fi
Guido van Rossum7c862f82007-12-13 20:50:10 +0000922 # For gcc 4.x we need to use -fwrapv so lets check if its supported
923 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
924 WRAP="-fwrapv"
925 fi
Skip Montanarodecc6a42003-01-01 20:07:49 +0000926 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000927 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000928 if test "$Py_DEBUG" = 'true' ; then
929 # Optimization messes up debuggers, so turn it off for
930 # debug builds.
Mark Dickinsond2f3e3f2010-05-05 22:23:58 +0000931 OPT="-g -O0 -Wall $STRICT_PROTO"
Fred Drake9f715822001-07-11 06:27:00 +0000932 else
Guido van Rossum7c862f82007-12-13 20:50:10 +0000933 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +0000934 fi
935 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000936 *)
Skip Montanaro288a5be2006-04-13 02:00:56 +0000937 OPT="-O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +0000938 ;;
Fred Drake9f715822001-07-11 06:27:00 +0000939 esac
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000940 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +0000941 SCO_SV*) OPT="$OPT -m486 -DSCO5"
942 ;;
943 esac
Fred Drake9f715822001-07-11 06:27:00 +0000944 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +0000945
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000946 *)
Skip Montanarodecc6a42003-01-01 20:07:49 +0000947 OPT="-O"
948 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000949 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000950fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000951
Skip Montanarodecc6a42003-01-01 20:07:49 +0000952AC_SUBST(BASECFLAGS)
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000953
954# The -arch flags for universal builds on OSX
955UNIVERSAL_ARCH_FLAGS=
956AC_SUBST(UNIVERSAL_ARCH_FLAGS)
957
Skip Montanarodecc6a42003-01-01 20:07:49 +0000958# tweak BASECFLAGS based on compiler and platform
959case $GCC in
960yes)
Martin v. Löwis70fedcd2003-07-07 21:26:19 +0000961 # Python violates C99 rules, by casting between incompatible
962 # pointer types. GCC may generate bad code as a result of that,
963 # so use -fno-strict-aliasing if supported.
964 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
965 ac_save_cc="$CC"
966 CC="$CC -fno-strict-aliasing"
Alexandre Vassalotti00900892009-07-17 05:26:39 +0000967 AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
Matthias Klosec511b472010-05-08 11:01:39 +0000968 AC_COMPILE_IFELSE(
Mark Dickinson5e13e292010-05-11 08:55:06 +0000969 [AC_LANG_PROGRAM([[]], [[]])],
Matthias Klosec511b472010-05-08 11:01:39 +0000970 [ac_cv_no_strict_aliasing_ok=yes],
971 [ac_cv_no_strict_aliasing_ok=no]))
Martin v. Löwis70fedcd2003-07-07 21:26:19 +0000972 CC="$ac_save_cc"
973 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
974 if test $ac_cv_no_strict_aliasing_ok = yes
975 then
976 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
977 fi
Mark Dickinson65134662008-04-25 16:11:04 +0000978
979 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
980 # support. Without this, treatment of subnormals doesn't follow
981 # the standard.
982 case $ac_sys_machine in
983 alpha*)
984 BASECFLAGS="$BASECFLAGS -mieee"
985 ;;
986 esac
987
Skip Montanarodecc6a42003-01-01 20:07:49 +0000988 case $ac_sys_system in
989 SCO_SV*)
990 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
991 ;;
992 # is there any other compiler on Darwin besides gcc?
993 Darwin*)
Jeffrey Yasskin1b4e45b2008-03-17 14:40:53 +0000994 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
995 # used to be here, but non-Apple gcc doesn't accept them.
Ronald Oussorena55af9a2010-01-17 16:25:57 +0000996 if test "${CC}" = gcc
997 then
998 AC_MSG_CHECKING(which compiler should be used)
999 case "${UNIVERSALSDK}" in
1000 */MacOSX10.4u.sdk)
1001 # Build using 10.4 SDK, force usage of gcc when the
1002 # compiler is gcc, otherwise the user will get very
1003 # confusing error messages when building on OSX 10.6
1004 CC=gcc-4.0
1005 CPP=cpp-4.0
1006 ;;
1007 esac
1008 AC_MSG_RESULT($CC)
Ronald Oussoren988117f2006-04-29 11:31:35 +00001009 fi
1010
Benjamin Peterson4347c442008-07-17 15:59:24 +00001011 # Calculate the right deployment target for this build.
1012 #
1013 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
1014 if test ${cur_target} '>' 10.2; then
1015 cur_target=10.3
Ronald Oussoren25967582009-09-06 10:00:26 +00001016 if test ${enable_universalsdk}; then
1017 if test "${UNIVERSAL_ARCHS}" = "all"; then
1018 # Ensure that the default platform for a
1019 # 4-way universal build is OSX 10.5,
1020 # that's the first OS release where
1021 # 4-way builds make sense.
1022 cur_target='10.5'
Ronald Oussoren23d92532009-09-07 06:12:00 +00001023
1024 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
1025 cur_target='10.5'
1026
1027 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
1028 cur_target='10.5'
1029
1030 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
1031 cur_target='10.5'
Ronald Oussoren25967582009-09-06 10:00:26 +00001032 fi
1033 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001034 if test `/usr/bin/arch` = "i386"; then
Ronald Oussoren25967582009-09-06 10:00:26 +00001035 # On Intel macs default to a deployment
1036 # target of 10.4, that's the first OSX
1037 # release with Intel support.
1038 cur_target="10.4"
1039 fi
1040 fi
Benjamin Peterson4347c442008-07-17 15:59:24 +00001041 fi
1042 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1043
1044 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1045 # environment with a value that is the same as what we'll use
1046 # in the Makefile to ensure that we'll get the same compiler
1047 # environment during configure and build time.
1048 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1049 export MACOSX_DEPLOYMENT_TARGET
1050 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1051
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001052 if test "${enable_universalsdk}"; then
1053 UNIVERSAL_ARCH_FLAGS=""
1054 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
1055 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
1056 ARCH_RUN_32BIT=""
Ronald Oussoren75912852010-04-08 08:13:31 +00001057 LIPO_32BIT_FLAGS=""
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001058
1059 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
1060 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
1061 LIPO_32BIT_FLAGS=""
1062 ARCH_RUN_32BIT="true"
1063
1064 elif test "$UNIVERSAL_ARCHS" = "all" ; then
1065 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
1066 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001067 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001068
1069 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
1070 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
1071 LIPO_32BIT_FLAGS="-extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001072 ARCH_RUN_32BIT="/usr/bin/arch -i386"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001073
1074 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
1075 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
1076 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren9922f172010-02-11 13:19:34 +00001077 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001078
1079 else
1080 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
1081
1082 fi
1083
1084
Ronald Oussoren974eb5e2010-04-18 17:59:37 +00001085 CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
1086 if test "${UNIVERSALSDK}" != "/"
1087 then
1088 CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
1089 LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1090 CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001091 fi
1092
1093 fi
1094
1095
Skip Montanarodecc6a42003-01-01 20:07:49 +00001096 ;;
Neal Norwitzdedeeaa2006-03-31 06:54:45 +00001097 OSF*)
1098 BASECFLAGS="$BASECFLAGS -mieee"
1099 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001100 esac
1101 ;;
1102
1103*)
1104 case $ac_sys_system in
1105 OpenUNIX*|UnixWare*)
1106 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1107 ;;
Neal Norwitzb44f1652003-05-26 14:11:55 +00001108 OSF*)
1109 BASECFLAGS="$BASECFLAGS -ieee -std"
1110 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001111 SCO_SV*)
1112 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1113 ;;
1114 esac
1115 ;;
1116esac
1117
Fred Drakee1ceaa02001-12-04 20:55:47 +00001118if test "$Py_DEBUG" = 'true'; then
1119 :
1120else
1121 OPT="-DNDEBUG $OPT"
1122fi
1123
Guido van Rossum6f2260e1996-09-09 16:21:03 +00001124if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001125then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001126 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001127fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001128
Neal Norwitz020c46a2006-01-07 21:39:28 +00001129# disable check for icc since it seems to pass, but generates a warning
1130if test "$CC" = icc
1131then
1132 ac_cv_opt_olimit_ok=no
1133fi
1134
Guido van Rossum91922671997-10-09 20:24:13 +00001135AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1136AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1137[ac_save_cc="$CC"
1138CC="$CC -OPT:Olimit=0"
Matthias Klosec511b472010-05-08 11:01:39 +00001139AC_COMPILE_IFELSE(
Mark Dickinson5e13e292010-05-11 08:55:06 +00001140 [AC_LANG_PROGRAM([[]], [[]])],
Matthias Klosec511b472010-05-08 11:01:39 +00001141 [ac_cv_opt_olimit_ok=yes],
1142 [ac_cv_opt_olimit_ok=no]
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001143 )
Guido van Rossum91922671997-10-09 20:24:13 +00001144CC="$ac_save_cc"])
1145AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +00001146if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +00001147 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +00001148 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1149 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1150 # environment?
1151 Darwin*)
1152 ;;
1153 *)
1154 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1155 ;;
Guido van Rossum5839e582000-10-09 19:52:35 +00001156 esac
Guido van Rossumf8678121998-07-07 21:05:09 +00001157else
1158 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1159 AC_CACHE_VAL(ac_cv_olimit_ok,
1160 [ac_save_cc="$CC"
1161 CC="$CC -Olimit 1500"
Matthias Klosec511b472010-05-08 11:01:39 +00001162 AC_COMPILE_IFELSE(
Mark Dickinson5e13e292010-05-11 08:55:06 +00001163 [AC_LANG_PROGRAM([[]], [[]])],
Matthias Klosec511b472010-05-08 11:01:39 +00001164 [ac_cv_olimit_ok=yes],
1165 [ac_cv_olimit_ok=no]
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001166 )
Guido van Rossumf8678121998-07-07 21:05:09 +00001167 CC="$ac_save_cc"])
1168 AC_MSG_RESULT($ac_cv_olimit_ok)
1169 if test $ac_cv_olimit_ok = yes; then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001170 BASECFLAGS="$BASECFLAGS -Olimit 1500"
Guido van Rossumf8678121998-07-07 21:05:09 +00001171 fi
Guido van Rossum201afe51997-05-14 21:14:44 +00001172fi
Guido van Rossumf8678121998-07-07 21:05:09 +00001173
Martin v. Löwisaac13162006-10-19 10:58:46 +00001174# Check whether GCC supports PyArg_ParseTuple format
1175if test "$GCC" = "yes"
1176then
1177 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1178 save_CFLAGS=$CFLAGS
1179 CFLAGS="$CFLAGS -Werror"
Matthias Klosec511b472010-05-08 11:01:39 +00001180 AC_COMPILE_IFELSE([
1181 AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
1182 ],[
1183 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1,
1184 [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1185 AC_MSG_RESULT(yes)
1186 ],[
1187 AC_MSG_RESULT(no)
1188 ])
Martin v. Löwisc1d75972006-10-19 16:01:37 +00001189 CFLAGS=$save_CFLAGS
Martin v. Löwisaac13162006-10-19 10:58:46 +00001190fi
1191
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001192# On some compilers, pthreads are available without further options
1193# (e.g. MacOS X). On some of these systems, the compiler will not
1194# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1195# So we have to see first whether pthreads are available without
1196# options before we can check whether -Kpthread improves anything.
1197AC_MSG_CHECKING(whether pthreads are available without options)
1198AC_CACHE_VAL(ac_cv_pthread_is_default,
Matthias Klosec511b472010-05-08 11:01:39 +00001199[AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001200#include <pthread.h>
1201
1202void* routine(void* p){return NULL;}
1203
1204int main(){
1205 pthread_t p;
1206 if(pthread_create(&p,NULL,routine,NULL)!=0)
1207 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001208 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001209 return 0;
1210}
Matthias Klosec511b472010-05-08 11:01:39 +00001211]])],[
Skip Montanarod8d39a02003-07-10 20:44:10 +00001212 ac_cv_pthread_is_default=yes
1213 ac_cv_kthread=no
1214 ac_cv_pthread=no
Matthias Klosec511b472010-05-08 11:01:39 +00001215],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no])
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001216])
1217AC_MSG_RESULT($ac_cv_pthread_is_default)
1218
1219
1220if test $ac_cv_pthread_is_default = yes
1221then
1222 ac_cv_kpthread=no
1223else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001224# -Kpthread, if available, provides the right #defines
1225# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001226# Some compilers won't report that they do not support -Kpthread,
1227# so we need to run a program to see whether it really made the
1228# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +00001229AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1230AC_CACHE_VAL(ac_cv_kpthread,
1231[ac_save_cc="$CC"
1232CC="$CC -Kpthread"
Matthias Klosec511b472010-05-08 11:01:39 +00001233AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001234#include <pthread.h>
1235
1236void* routine(void* p){return NULL;}
1237
1238int main(){
1239 pthread_t p;
1240 if(pthread_create(&p,NULL,routine,NULL)!=0)
1241 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001242 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001243 return 0;
1244}
Matthias Klosec511b472010-05-08 11:01:39 +00001245]])],[ac_cv_kpthread=yes],[ac_cv_kpthread=no],[ac_cv_kpthread=no])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001246CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001247AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001248fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00001249
Skip Montanarod8d39a02003-07-10 20:44:10 +00001250if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001251then
1252# -Kthread, if available, provides the right #defines
1253# and linker options to make pthread_create available
1254# Some compilers won't report that they do not support -Kthread,
1255# so we need to run a program to see whether it really made the
1256# function available.
1257AC_MSG_CHECKING(whether $CC accepts -Kthread)
1258AC_CACHE_VAL(ac_cv_kthread,
1259[ac_save_cc="$CC"
1260CC="$CC -Kthread"
Matthias Klosec511b472010-05-08 11:01:39 +00001261AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001262#include <pthread.h>
1263
1264void* routine(void* p){return NULL;}
1265
1266int main(){
1267 pthread_t p;
1268 if(pthread_create(&p,NULL,routine,NULL)!=0)
1269 return 1;
1270 (void)pthread_detach(p);
1271 return 0;
1272}
Matthias Klosec511b472010-05-08 11:01:39 +00001273]])],[ac_cv_kthread=yes],[ac_cv_kthread=no],[ac_cv_kthread=no])
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001274CC="$ac_save_cc"])
1275AC_MSG_RESULT($ac_cv_kthread)
1276fi
1277
Skip Montanarod8d39a02003-07-10 20:44:10 +00001278if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001279then
1280# -pthread, if available, provides the right #defines
1281# and linker options to make pthread_create available
1282# Some compilers won't report that they do not support -pthread,
1283# so we need to run a program to see whether it really made the
1284# function available.
1285AC_MSG_CHECKING(whether $CC accepts -pthread)
1286AC_CACHE_VAL(ac_cv_thread,
1287[ac_save_cc="$CC"
1288CC="$CC -pthread"
Matthias Klosec511b472010-05-08 11:01:39 +00001289AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001290#include <pthread.h>
1291
1292void* routine(void* p){return NULL;}
1293
1294int main(){
1295 pthread_t p;
1296 if(pthread_create(&p,NULL,routine,NULL)!=0)
1297 return 1;
1298 (void)pthread_detach(p);
1299 return 0;
1300}
Matthias Klosec511b472010-05-08 11:01:39 +00001301]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001302CC="$ac_save_cc"])
1303AC_MSG_RESULT($ac_cv_pthread)
1304fi
1305
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001306# If we have set a CC compiler flag for thread support then
1307# check if it works for CXX, too.
1308ac_cv_cxx_thread=no
1309if test ! -z "$CXX"
1310then
1311AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1312ac_save_cxx="$CXX"
1313
1314if test "$ac_cv_kpthread" = "yes"
1315then
Martin v. Löwis519adae2003-09-20 10:47:47 +00001316 CXX="$CXX -Kpthread"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001317 ac_cv_cxx_thread=yes
1318elif test "$ac_cv_kthread" = "yes"
1319then
1320 CXX="$CXX -Kthread"
1321 ac_cv_cxx_thread=yes
1322elif test "$ac_cv_pthread" = "yes"
1323then
1324 CXX="$CXX -pthread"
1325 ac_cv_cxx_thread=yes
1326fi
1327
1328if test $ac_cv_cxx_thread = yes
1329then
1330 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1331 $CXX -c conftest.$ac_ext 2>&5
1332 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1333 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1334 then
1335 ac_cv_cxx_thread=yes
1336 else
1337 ac_cv_cxx_thread=no
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001338 fi
1339 rm -fr conftest*
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001340fi
Brett Cannonc601e0f2004-11-07 01:24:12 +00001341AC_MSG_RESULT($ac_cv_cxx_thread)
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001342fi
Martin v. Löwis519adae2003-09-20 10:47:47 +00001343CXX="$ac_save_cxx"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001344
Fred Drakece81d592000-07-09 14:39:29 +00001345dnl # check for ANSI or K&R ("traditional") preprocessor
1346dnl AC_MSG_CHECKING(for C preprocessor type)
Matthias Klosec511b472010-05-08 11:01:39 +00001347dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Fred Drakece81d592000-07-09 14:39:29 +00001348dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1349dnl int foo;
1350dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
Matthias Klosec511b472010-05-08 11:01:39 +00001351dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional])
Fred Drakece81d592000-07-09 14:39:29 +00001352dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +00001353
Guido van Rossum627b2d71993-12-24 10:39:16 +00001354# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001355AC_HEADER_STDC
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001356AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1357fcntl.h grp.h \
Neal Norwitz9fdfaaf2008-03-28 05:34:59 +00001358ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001359shadow.h signal.h stdint.h stropts.h termios.h thread.h \
Martin v. Löwis14e73b12003-01-01 09:51:12 +00001360unistd.h utime.h \
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00001361sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1362sys/lock.h sys/mkdev.h sys/modem.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001363sys/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 +00001364sys/termio.h sys/time.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001365sys/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 +00001366sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001367bluetooth/bluetooth.h linux/tipc.h spawn.h util.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001368AC_HEADER_DIRENT
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00001369AC_HEADER_MAJOR
Guido van Rossum627b2d71993-12-24 10:39:16 +00001370
Martin v. Löwisae2830c2004-09-18 09:54:52 +00001371# On Solaris, term.h requires curses.h
Martin v. Löwisfd1c69e2004-11-30 22:09:37 +00001372AC_CHECK_HEADERS(term.h,,,[
Martin v. Löwis5d52e782004-09-18 10:07:03 +00001373#ifdef HAVE_CURSES_H
1374#include <curses.h>
1375#endif
1376])
Martin v. Löwisae2830c2004-09-18 09:54:52 +00001377
Martin v. Löwis11017b12006-01-14 18:12:57 +00001378# On Linux, netlink.h requires asm/types.h
1379AC_CHECK_HEADERS(linux/netlink.h,,,[
1380#ifdef HAVE_ASM_TYPES_H
1381#include <asm/types.h>
1382#endif
1383#ifdef HAVE_SYS_SOCKET_H
1384#include <sys/socket.h>
1385#endif
1386])
1387
Guido van Rossum627b2d71993-12-24 10:39:16 +00001388# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001389was_it_defined=no
1390AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001391AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1392 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1393])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001394AC_MSG_RESULT($was_it_defined)
1395
Neal Norwitz11690112002-07-30 01:08:28 +00001396# Check whether using makedev requires defining _OSF_SOURCE
1397AC_MSG_CHECKING(for makedev)
Matthias Klosec511b472010-05-08 11:01:39 +00001398AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Jesus Cea616de772010-04-28 10:32:30 +00001399#if defined(MAJOR_IN_MKDEV)
1400#include <sys/mkdev.h>
1401#elif defined(MAJOR_IN_SYSMACROS)
1402#include <sys/sysmacros.h>
1403#else
1404#include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001405#endif ]], [[ makedev(0, 0) ]])],
1406[ac_cv_has_makedev=yes],
1407[ac_cv_has_makedev=no])
Neal Norwitz11690112002-07-30 01:08:28 +00001408if test "$ac_cv_has_makedev" = "no"; then
1409 # we didn't link, try if _OSF_SOURCE will allow us to link
Matthias Klosec511b472010-05-08 11:01:39 +00001410 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001411#define _OSF_SOURCE 1
1412#include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001413 ]], [[ makedev(0, 0) ]])],
1414[ac_cv_has_makedev=yes],
1415[ac_cv_has_makedev=no])
Neal Norwitz11690112002-07-30 01:08:28 +00001416 if test "$ac_cv_has_makedev" = "yes"; then
1417 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1418 fi
1419fi
1420AC_MSG_RESULT($ac_cv_has_makedev)
1421if test "$ac_cv_has_makedev" = "yes"; then
1422 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1423fi
1424
Martin v. Löwis399a6892002-10-04 10:22:02 +00001425# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1426# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1427# defined, but the compiler does not support pragma redefine_extname,
1428# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1429# structures (such as rlimit64) without declaring them. As a
1430# work-around, disable LFS on such configurations
1431
1432use_lfs=yes
1433AC_MSG_CHECKING(Solaris LFS bug)
Matthias Klosec511b472010-05-08 11:01:39 +00001434AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwis399a6892002-10-04 10:22:02 +00001435#define _LARGEFILE_SOURCE 1
1436#define _FILE_OFFSET_BITS 64
1437#include <sys/resource.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001438]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes])
Martin v. Löwis399a6892002-10-04 10:22:02 +00001439AC_MSG_RESULT($sol_lfs_bug)
1440if test "$sol_lfs_bug" = "yes"; then
1441 use_lfs=no
1442fi
1443
1444if test "$use_lfs" = "yes"; then
Guido van Rossum810cc512001-09-09 23:51:39 +00001445# Two defines needed to enable largefile support on various platforms
1446# These may affect some typedefs
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001447AC_DEFINE(_LARGEFILE_SOURCE, 1,
1448[This must be defined on some systems to enable large file support.])
1449AC_DEFINE(_FILE_OFFSET_BITS, 64,
1450[This must be set to 64 on some systems to enable large file support.])
Martin v. Löwis399a6892002-10-04 10:22:02 +00001451fi
Guido van Rossum810cc512001-09-09 23:51:39 +00001452
Guido van Rossum300fda71996-08-19 21:58:16 +00001453# Add some code to confdefs.h so that the test for off_t works on SCO
1454cat >> confdefs.h <<\EOF
1455#if defined(SCO_DS)
1456#undef _OFF_T
1457#endif
1458EOF
1459
Guido van Rossumef2255b2000-03-10 22:30:29 +00001460# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001461AC_TYPE_MODE_T
1462AC_TYPE_OFF_T
1463AC_TYPE_PID_T
Matthias Klosecbf54b12010-05-08 11:04:18 +00001464AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001465AC_TYPE_SIZE_T
1466AC_TYPE_UID_T
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001467AC_TYPE_UINT32_T
1468AC_TYPE_UINT64_T
1469AC_TYPE_INT32_T
1470AC_TYPE_INT64_T
Christian Heimes951cc0f2008-01-31 23:08:23 +00001471AC_CHECK_TYPE(ssize_t,
Matthias Klose5183ebd2010-04-24 16:38:36 +00001472 AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001473
Guido van Rossumef2255b2000-03-10 22:30:29 +00001474# Sizes of various common basic types
Skip Montanarob9820a32004-01-17 00:16:12 +00001475# ANSI C requires sizeof(char) == 1, so no need to check it
Guido van Rossum3065c942001-09-17 04:03:14 +00001476AC_CHECK_SIZEOF(int, 4)
1477AC_CHECK_SIZEOF(long, 4)
1478AC_CHECK_SIZEOF(void *, 4)
Guido van Rossum3065c942001-09-17 04:03:14 +00001479AC_CHECK_SIZEOF(short, 2)
1480AC_CHECK_SIZEOF(float, 4)
1481AC_CHECK_SIZEOF(double, 8)
1482AC_CHECK_SIZEOF(fpos_t, 4)
Martin v. Löwis18e16552006-02-15 17:27:45 +00001483AC_CHECK_SIZEOF(size_t, 4)
Christian Heimes951cc0f2008-01-31 23:08:23 +00001484AC_CHECK_SIZEOF(pid_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +00001485
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001486AC_MSG_CHECKING(for long long support)
1487have_long_long=no
Matthias Klosec511b472010-05-08 11:01:39 +00001488AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001489 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1490 have_long_long=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001491],[])
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001492AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001493if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +00001494AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001495fi
1496
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001497AC_MSG_CHECKING(for long double support)
1498have_long_double=no
Matthias Klosec511b472010-05-08 11:01:39 +00001499AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001500 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1501 have_long_double=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001502],[])
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001503AC_MSG_RESULT($have_long_double)
Mark Dickinsondc1688a2008-06-27 22:20:14 +00001504if test "$have_long_double" = yes ; then
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001505AC_CHECK_SIZEOF(long double, 12)
1506fi
1507
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001508AC_MSG_CHECKING(for _Bool support)
1509have_c99_bool=no
Matthias Klosec511b472010-05-08 11:01:39 +00001510AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Bool x; x = (_Bool)0;]])],[
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001511 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1512 have_c99_bool=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001513],[])
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001514AC_MSG_RESULT($have_c99_bool)
1515if test "$have_c99_bool" = yes ; then
1516AC_CHECK_SIZEOF(_Bool, 1)
1517fi
1518
Martin v. Löwisebe26702006-10-02 14:55:51 +00001519AC_CHECK_TYPES(uintptr_t,
1520 [AC_CHECK_SIZEOF(uintptr_t, 4)],
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001521 [], [#ifdef HAVE_STDINT_H
1522 #include <stdint.h>
Antoine Pitrou7be5a652010-10-10 08:14:41 +00001523 #endif
1524 #ifdef HAVE_INTTYPES_H
1525 #include <inttypes.h>
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001526 #endif])
Martin v. Löwisebe26702006-10-02 14:55:51 +00001527
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001528AC_CHECK_SIZEOF(off_t, [], [
1529#ifdef HAVE_SYS_TYPES_H
1530#include <sys/types.h>
1531#endif
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001532])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001533
1534AC_MSG_CHECKING(whether to enable large file support)
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001535if test "$have_long_long" = yes
1536then
1537if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001538 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001539 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1540 [Defined to enable large file support when an off_t is bigger than a long
1541 and long long is available and at least as big as an off_t. You may need
1542 to add some flags for configuration and compilation to enable this mode.
1543 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001544 AC_MSG_RESULT(yes)
1545else
1546 AC_MSG_RESULT(no)
1547fi
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001548else
1549 AC_MSG_RESULT(no)
1550fi
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001551
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001552AC_CHECK_SIZEOF(time_t, [], [
1553#ifdef HAVE_SYS_TYPES_H
1554#include <sys/types.h>
1555#endif
1556#ifdef HAVE_TIME_H
1557#include <time.h>
1558#endif
Fred Drakea3f6e912000-06-29 20:44:47 +00001559])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001560
Trent Mick635f6fb2000-08-23 21:33:05 +00001561# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001562ac_save_cc="$CC"
1563if test "$ac_cv_kpthread" = "yes"
1564then CC="$CC -Kpthread"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001565elif test "$ac_cv_kthread" = "yes"
1566then CC="$CC -Kthread"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001567elif test "$ac_cv_pthread" = "yes"
1568then CC="$CC -pthread"
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001569fi
Trent Mick635f6fb2000-08-23 21:33:05 +00001570AC_MSG_CHECKING(for pthread_t)
1571have_pthread_t=no
Matthias Klosec511b472010-05-08 11:01:39 +00001572AC_COMPILE_IFELSE([
1573 AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
1574],[have_pthread_t=yes],[])
Trent Mick635f6fb2000-08-23 21:33:05 +00001575AC_MSG_RESULT($have_pthread_t)
1576if test "$have_pthread_t" = yes ; then
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001577 AC_CHECK_SIZEOF(pthread_t, [], [
1578#ifdef HAVE_PTHREAD_H
1579#include <pthread.h>
1580#endif
Trent Mick635f6fb2000-08-23 21:33:05 +00001581 ])
Trent Mick635f6fb2000-08-23 21:33:05 +00001582fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001583CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +00001584
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001585AC_MSG_CHECKING(for --enable-toolbox-glue)
1586AC_ARG_ENABLE(toolbox-glue,
Matthias Klose22520ea2010-05-08 10:14:46 +00001587 AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions]))
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001588
1589if test -z "$enable_toolbox_glue"
1590then
1591 case $ac_sys_system/$ac_sys_release in
1592 Darwin/*)
1593 enable_toolbox_glue="yes";;
1594 *)
1595 enable_toolbox_glue="no";;
1596 esac
1597fi
1598case "$enable_toolbox_glue" in
1599yes)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001600 extra_machdep_objs="Python/mactoolboxglue.o"
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001601 extra_undefs="-u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001602 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1603 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001604 ;;
1605*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001606 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +00001607 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001608 ;;
1609esac
1610AC_MSG_RESULT($enable_toolbox_glue)
1611
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00001612
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001613AC_SUBST(OTHER_LIBTOOL_OPT)
1614case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001615 Darwin/@<:@01567@:>@\..*)
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001616 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1617 ;;
1618 Darwin/*)
1619 OTHER_LIBTOOL_OPT=""
1620 ;;
1621esac
1622
Ronald Oussoren25967582009-09-06 10:00:26 +00001623
1624ARCH_RUN_32BIT=""
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001625AC_SUBST(LIBTOOL_CRUFT)
1626case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001627 Darwin/@<:@01567@:>@\..*)
Ronald Oussoren988117f2006-04-29 11:31:35 +00001628 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1629 if test "${enable_universalsdk}"; then
1630 :
1631 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001632 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001633 fi
Jack Jansenb36687a2004-07-16 08:43:47 +00001634 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001635 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +00001636 Darwin/*)
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001637 gcc_version=`gcc -dumpversion`
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001638 if test ${gcc_version} '<' 4.0
1639 then
1640 LIBTOOL_CRUFT="-lcc_dynamic"
1641 else
1642 LIBTOOL_CRUFT=""
1643 fi
Matthias Klosec511b472010-05-08 11:01:39 +00001644 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Ronald Oussoren25967582009-09-06 10:00:26 +00001645 #include <unistd.h>
1646 int main(int argc, char*argv[])
1647 {
1648 if (sizeof(long) == 4) {
1649 return 0;
1650 } else {
1651 return 1;
1652 }
Ronald Oussoren84ddd722009-09-08 07:17:10 +00001653 }
Matthias Klosec511b472010-05-08 11:01:39 +00001654 ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
Ronald Oussoren25967582009-09-06 10:00:26 +00001655
1656 if test "${ac_osx_32bit}" = "yes"; then
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001657 case `/usr/bin/arch` in
Ronald Oussoren25967582009-09-06 10:00:26 +00001658 i386)
1659 MACOSX_DEFAULT_ARCH="i386"
1660 ;;
1661 ppc)
1662 MACOSX_DEFAULT_ARCH="ppc"
1663 ;;
1664 *)
1665 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1666 ;;
1667 esac
1668 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001669 case `/usr/bin/arch` in
Ronald Oussoren25967582009-09-06 10:00:26 +00001670 i386)
1671 MACOSX_DEFAULT_ARCH="x86_64"
1672 ;;
1673 ppc)
1674 MACOSX_DEFAULT_ARCH="ppc64"
1675 ;;
1676 *)
1677 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1678 ;;
1679 esac
1680
1681 #ARCH_RUN_32BIT="true"
1682 fi
1683
1684 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
Jack Jansenb36687a2004-07-16 08:43:47 +00001685 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001686 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001687esac
1688
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001689AC_MSG_CHECKING(for --enable-framework)
1690if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001691then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001692 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001693 # -F. is needed to allow linking to the framework while
1694 # in the build location.
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001695 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1696 [Define if you want to produce an OpenStep/Rhapsody framework
1697 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001698 AC_MSG_RESULT(yes)
Ronald Oussoren450d5612009-06-08 21:12:41 +00001699 if test $enable_shared = "yes"
1700 then
Ronald Oussoren9ebd2422009-09-29 13:00:44 +00001701 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 +00001702 fi
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001703else
1704 AC_MSG_RESULT(no)
1705fi
1706
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001707AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001708case $ac_sys_system/$ac_sys_release in
1709 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001710 AC_DEFINE(WITH_DYLD, 1,
1711 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1712 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1713 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001714 AC_MSG_RESULT(always on for Darwin)
1715 ;;
1716 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001717 AC_MSG_RESULT(no)
1718 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001719esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001720
Guido van Rossumac405f61994-09-12 10:56:06 +00001721# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +00001722AC_SUBST(SO)
1723AC_SUBST(LDSHARED)
Tarek Ziadé00002952010-04-03 08:37:59 +00001724AC_SUBST(LDCXXSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001725AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001726AC_SUBST(CCSHARED)
1727AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001728# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +00001729# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001730AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +00001731if test -z "$SO"
1732then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001733 case $ac_sys_system in
Neal Norwitz58e28882006-05-19 07:00:58 +00001734 hp*|HP*)
1735 case `uname -m` in
1736 ia64) SO=.so;;
1737 *) SO=.sl;;
1738 esac
1739 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001740 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001741 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +00001742 esac
Martin v. Löwis368de8f2003-06-14 14:46:38 +00001743else
1744 # this might also be a termcap variable, see #610332
1745 echo
1746 echo '====================================================================='
1747 echo '+ +'
1748 echo '+ WARNING: You have set SO in your environment. +'
1749 echo '+ Do you really mean to change the extension for shared libraries? +'
1750 echo '+ Continuing in 10 seconds to let you to ponder. +'
1751 echo '+ +'
1752 echo '====================================================================='
1753 sleep 10
Guido van Rossumac405f61994-09-12 10:56:06 +00001754fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001755AC_MSG_RESULT($SO)
Ronald Oussoren79f90492009-01-02 10:44:46 +00001756
Neal Norwitz58e28882006-05-19 07:00:58 +00001757AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
Guido van Rossumac405f61994-09-12 10:56:06 +00001758# LDSHARED is the ld *command* used to create shared library
Skip Montanaroce59c042004-01-17 14:19:44 +00001759# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001760# (Shared libraries in this instance are shared modules to be loaded into
1761# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001762AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001763if test -z "$LDSHARED"
1764then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001765 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001766 AIX*)
Antoine Pitrouaabdceb2010-09-10 20:03:17 +00001767 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp -L\$(srcdir)"
Guido van Rossumce608b02001-09-28 15:59:38 +00001768 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001769 ;;
1770 BeOS*)
1771 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +00001772 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001773 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001774 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +00001775 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Greg Ward57c9a662000-05-26 12:22:54 +00001776 SunOS/5*)
Tarek Ziadé00002952010-04-03 08:37:59 +00001777 if test "$GCC" = "yes" ; then
1778 LDSHARED='$(CC) -shared'
1779 LDCXXSHARED='$(CXX) -shared'
1780 else
1781 LDSHARED='$(CC) -G'
1782 LDCXXSHARED='$(CXX) -G'
Greg Ward57c9a662000-05-26 12:22:54 +00001783 fi ;;
Thomas Hellerdc96a772008-04-04 10:07:55 +00001784 hp*|HP*)
Tarek Ziadé00002952010-04-03 08:37:59 +00001785 if test "$GCC" = "yes" ; then
1786 LDSHARED='$(CC) -shared'
1787 LDCXXSHARED='$(CXX) -shared'
1788 else
1789 LDSHARED='ld -b'
Thomas Hellerdc96a772008-04-04 10:07:55 +00001790 fi ;;
Guido van Rossum71001e41995-01-26 00:44:03 +00001791 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Jack Jansen418c3b12001-11-14 10:59:57 +00001792 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +00001793 LDSHARED='$(CC) $(LDFLAGS) -bundle'
Tarek Ziadé00002952010-04-03 08:37:59 +00001794 LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle'
Jack Jansena3891ea2001-09-07 14:25:12 +00001795 if test "$enable_framework" ; then
1796 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001797 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1798 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00001799 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001800 else
1801 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +00001802 LDSHARED="$LDSHARED -undefined suppress"
Tarek Ziadé00002952010-04-03 08:37:59 +00001803 LDCXXSHARED="$LDCXXSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +00001804 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00001805 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001806 LDSHARED='$(CC) $(LDFLAGS) -bundle'
Tarek Ziadé00002952010-04-03 08:37:59 +00001807 LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001808 if test "$enable_framework" ; then
1809 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001810 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1811 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00001812 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001813 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +00001814 # No framework, use the Python app as bundle-loader
1815 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
Jack Jansenc28fc372003-02-25 13:14:43 +00001816 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Tarek Ziadé00002952010-04-03 08:37:59 +00001817 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001818 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00001819 Darwin/*)
1820 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1821 # This allows an extension to be used in any Python
Ronald Oussoren38f1b982007-09-02 09:46:07 +00001822
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001823 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
Jack Jansen6b08a402004-06-03 12:41:45 +00001824 then
Ronald Oussoren988117f2006-04-29 11:31:35 +00001825 if test "${enable_universalsdk}"; then
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001826 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001827 fi
Jack Jansen6b08a402004-06-03 12:41:45 +00001828 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
Tarek Ziadé00002952010-04-03 08:37:59 +00001829 LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle -undefined dynamic_lookup'
Jack Jansen6b08a402004-06-03 12:41:45 +00001830 BLDSHARED="$LDSHARED"
Jack Jansen6b08a402004-06-03 12:41:45 +00001831 else
1832 LDSHARED='$(CC) $(LDFLAGS) -bundle'
Tarek Ziadé00002952010-04-03 08:37:59 +00001833 LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle'
Jack Jansen6b08a402004-06-03 12:41:45 +00001834 if test "$enable_framework" ; then
1835 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001836 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1837 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00001838 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen6b08a402004-06-03 12:41:45 +00001839 else
1840 # No framework, use the Python app as bundle-loader
1841 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1842 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Tarek Ziadé00002952010-04-03 08:37:59 +00001843 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Jack Jansen6b08a402004-06-03 12:41:45 +00001844 fi
1845 fi
1846 ;;
Tarek Ziadé00002952010-04-03 08:37:59 +00001847 Linux*|GNU*|QNX*)
1848 LDSHARED='$(CC) -shared'
1849 LDCXXSHARED='$(CXX) -shared';;
1850 BSD/OS*/4*)
1851 LDSHARED="gcc -shared"
1852 LDCXXSHARED="g++ -shared";;
Martin v. Löwis222c5152006-06-03 07:37:13 +00001853 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +00001854 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +00001855 then
Benjamin Peterson3b2abe92010-03-14 15:06:14 +00001856 LDSHARED='$(CC) -shared ${LDFLAGS}'
Tarek Ziadé00002952010-04-03 08:37:59 +00001857 LDCXXSHARED='$(CXX) -shared ${LDFLAGS}'
Guido van Rossum0286ae82000-08-29 15:06:49 +00001858 else
1859 LDSHARED="ld -Bshareable ${LDFLAGS}"
1860 fi;;
Martin v. Löwis222c5152006-06-03 07:37:13 +00001861 OpenBSD*)
1862 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1863 then
1864 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
Tarek Ziadé00002952010-04-03 08:37:59 +00001865 LDCXXSHARED='$(CXX) -shared $(CCSHARED) ${LDFLAGS}'
Martin v. Löwis222c5152006-06-03 07:37:13 +00001866 else
1867 case `uname -r` in
1868 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
1869 LDSHARED="ld -Bshareable ${LDFLAGS}"
1870 ;;
1871 *)
1872 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
Tarek Ziadé00002952010-04-03 08:37:59 +00001873 LDCXXSHARED='$(CXX) -shared $(CCSHARED) ${LDFLAGS}'
Martin v. Löwis222c5152006-06-03 07:37:13 +00001874 ;;
1875 esac
1876 fi;;
Tarek Ziadé00002952010-04-03 08:37:59 +00001877 NetBSD*|DragonFly*)
1878 LDSHARED="cc -shared ${LDFLAGS}"
1879 LDCXXSHARED="c++ -shared ${LDFLAGS}";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001880 OpenUNIX*|UnixWare*)
Tarek Ziadé00002952010-04-03 08:37:59 +00001881 if test "$GCC" = "yes" ; then
1882 LDSHARED='$(CC) -shared'
1883 LDCXXSHARED='$(CXX) -shared'
1884 else
1885 LDSHARED='$(CC) -G'
1886 LDCXXSHARED='$(CXX) -G'
Martin v. Löwisbec19582001-03-21 15:57:54 +00001887 fi;;
Tarek Ziadé00002952010-04-03 08:37:59 +00001888 SCO_SV*)
1889 LDSHARED='$(CC) -Wl,-G,-Bexport'
1890 LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
1891 CYGWIN*)
1892 LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
1893 LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
1894 atheos*)
1895 LDSHARED="gcc -shared"
1896 LDCXXSHARED="g++ -shared";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001897 *) LDSHARED="ld";;
1898 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001899fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001900AC_MSG_RESULT($LDSHARED)
Tarek Ziadé00002952010-04-03 08:37:59 +00001901LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001902BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +00001903# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001904# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001905AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001906if test -z "$CCSHARED"
1907then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001908 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +00001909 SunOS*) if test "$GCC" = yes;
Martin v. Löwiseb623572007-03-12 10:50:39 +00001910 then CCSHARED="-fPIC";
1911 elif test `uname -p` = sparc;
1912 then CCSHARED="-xcode=pic32";
1913 else CCSHARED="-Kpic";
1914 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +00001915 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +00001916 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +00001917 else CCSHARED="+z";
1918 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001919 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001920 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001921 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001922 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001923 if test "$GCC" = "yes"
1924 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001925 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +00001926 fi;;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001927 SCO_SV*)
1928 if test "$GCC" = "yes"
1929 then CCSHARED="-fPIC"
1930 else CCSHARED="-Kpic -belf"
1931 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001932 IRIX*/6*) case $CC in
1933 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +00001934 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001935 esac;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001936 atheos*) CCSHARED="-fPIC";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001937 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001938fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001939AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001940# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +00001941# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001942AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001943if test -z "$LINKFORSHARED"
1944then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001945 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001946 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +00001947 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +00001948 LINKFORSHARED="-Wl,-E -Wl,+s";;
1949# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001950 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001951 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001952 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001953 Darwin/*)
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001954 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1955 # which is
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001956 # not used by the core itself but which needs to be in the core so
1957 # that dynamically loaded extension modules have access to it.
Jack Jansen97e3f002003-02-23 22:59:01 +00001958 # -prebind is no longer used, because it actually seems to give a
1959 # slowdown in stead of a speedup, maybe due to the large number of
1960 # dynamic loads Python does.
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001961
1962 LINKFORSHARED="$extra_undefs"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001963 if test "$enable_framework"
1964 then
Jack Jansenda49e192005-01-07 13:08:22 +00001965 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001966 fi
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001967 LINKFORSHARED="$LINKFORSHARED";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001968 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001969 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +00001970 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001971 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
Guido van Rossumdf693651999-01-07 21:50:41 +00001972 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1973 then
1974 LINKFORSHARED="-Wl,--export-dynamic"
1975 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001976 SunOS/5*) case $CC in
1977 *gcc*)
Martin v. Löwisa4548572002-04-18 14:51:36 +00001978 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +00001979 then
1980 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001981 fi;;
1982 esac;;
Jason Tishler30765592003-09-04 11:04:06 +00001983 CYGWIN*)
1984 if test $enable_shared = "no"
1985 then
1986 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1987 fi;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +00001988 QNX*)
1989 # -Wl,-E causes the symbols to be added to the dynamic
1990 # symbol table so that they can be found when a module
1991 # is loaded. -N 2048K causes the stack size to be set
1992 # to 2048 kilobytes so that the stack doesn't overflow
1993 # when running test_compile.py.
1994 LINKFORSHARED='-Wl,-E -N 2048K';;
Guido van Rossumac405f61994-09-12 10:56:06 +00001995 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001996fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001997AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001998
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00001999
Neil Schemenauer61c51152001-01-26 16:18:16 +00002000AC_SUBST(CFLAGSFORSHARED)
2001AC_MSG_CHECKING(CFLAGSFORSHARED)
2002if test ! "$LIBRARY" = "$LDLIBRARY"
2003then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +00002004 case $ac_sys_system in
2005 CYGWIN*)
2006 # Cygwin needs CCSHARED when building extension DLLs
2007 # but not when building the interpreter DLL.
2008 CFLAGSFORSHARED='';;
2009 *)
2010 CFLAGSFORSHARED='$(CCSHARED)'
2011 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +00002012fi
2013AC_MSG_RESULT($CFLAGSFORSHARED)
2014
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002015# SHLIBS are libraries (except -lc and -lm) to link to the python shared
2016# library (with --enable-shared).
2017# For platforms on which shared libraries are not allowed to have unresolved
Martin v. Löwisd6359c52002-08-04 12:38:50 +00002018# symbols, this must be set to $(LIBS) (expanded by make). We do this even
2019# if it is not required, since it creates a dependency of the shared library
2020# to LIBS. This, in turn, means that applications linking the shared libpython
2021# don't need to link LIBS explicitly. The default should be only changed
2022# on systems where this approach causes problems.
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002023AC_SUBST(SHLIBS)
2024AC_MSG_CHECKING(SHLIBS)
2025case "$ac_sys_system" in
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002026 *)
Martin v. Löwisd6359c52002-08-04 12:38:50 +00002027 SHLIBS='$(LIBS)';;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002028esac
2029AC_MSG_RESULT($SHLIBS)
2030
2031
Guido van Rossum627b2d71993-12-24 10:39:16 +00002032# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002033AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
2034AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Martin v. Löwis519adae2003-09-20 10:47:47 +00002035
Skip Montanaro4d756af2008-12-01 01:55:22 +00002036# only check for sem_init if thread support is requested
Martin v. Löwis519adae2003-09-20 10:47:47 +00002037if test "$with_threads" = "yes" -o -z "$with_threads"; then
2038 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
2039 # posix4 on Solaris 2.6
2040 # pthread (first!) on Linux
2041fi
2042
Martin v. Löwis19d17342003-06-14 21:03:05 +00002043# check if we need libintl for locale functions
2044AC_CHECK_LIB(intl, textdomain,
2045 AC_DEFINE(WITH_LIBINTL, 1,
2046 [Define to 1 if libintl is needed for locale functions.]))
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002047
2048# checks for system dependent C++ extensions support
2049case "$ac_sys_system" in
2050 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
Matthias Klosec511b472010-05-08 11:01:39 +00002051 AC_LINK_IFELSE([
2052 AC_LANG_PROGRAM([[#include "/usr/lpp/xlC/include/load.h"]],
2053 [[loadAndInit("", 0, "")]])
2054 ],[
2055 AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002056 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
2057 and you want support for AIX C++ shared extension modules.])
Matthias Klosec511b472010-05-08 11:01:39 +00002058 AC_MSG_RESULT(yes)
2059 ],[
2060 AC_MSG_RESULT(no)
2061 ]);;
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002062 *) ;;
2063esac
2064
Guido van Rossum70c7f481998-03-26 18:44:10 +00002065# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002066# BeOS' sockets are stashed in libnet.
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002067AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002068AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Skip Montanarob9949db2004-01-17 04:04:13 +00002069
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00002070case "$ac_sys_system" in
2071BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002072AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
2073;;
2074esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00002075
Guido van Rossumc5a39031996-07-31 17:35:03 +00002076AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002077AC_ARG_WITH(libs,
Matthias Klose22520ea2010-05-08 10:14:46 +00002078 AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002079[
Guido van Rossumc5a39031996-07-31 17:35:03 +00002080AC_MSG_RESULT($withval)
2081LIBS="$withval $LIBS"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002082],
2083[AC_MSG_RESULT(no)])
Guido van Rossum627b2d71993-12-24 10:39:16 +00002084
Benjamin Petersone9e07bf2010-03-09 21:46:54 +00002085AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2086
Benjamin Peterson2c196742009-12-31 03:17:18 +00002087# Check for use of the system expat library
2088AC_MSG_CHECKING(for --with-system-expat)
2089AC_ARG_WITH(system_expat,
Matthias Klose22520ea2010-05-08 10:14:46 +00002090 AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]))
Benjamin Peterson2c196742009-12-31 03:17:18 +00002091
2092AC_MSG_RESULT($with_system_expat)
2093
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002094# Check for use of the system libffi library
2095AC_MSG_CHECKING(for --with-system-ffi)
2096AC_ARG_WITH(system_ffi,
Matthias Klose22520ea2010-05-08 10:14:46 +00002097 AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]))
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002098
Benjamin Petersone9e07bf2010-03-09 21:46:54 +00002099if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
Benjamin Peterson1c335e62010-01-01 15:16:29 +00002100 LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
2101else
2102 LIBFFI_INCLUDEDIR=""
2103fi
2104AC_SUBST(LIBFFI_INCLUDEDIR)
2105
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002106AC_MSG_RESULT($with_system_ffi)
2107
Matthias Klose10cbe482009-04-29 17:18:19 +00002108# Check for --with-dbmliborder
2109AC_MSG_CHECKING(for --with-dbmliborder)
2110AC_ARG_WITH(dbmliborder,
Matthias Klose22520ea2010-05-08 10:14:46 +00002111 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 +00002112[
2113if test x$with_dbmliborder = xyes
2114then
2115AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2116else
2117 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
2118 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
2119 then
2120 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2121 fi
2122 done
Matthias Klose61dbdb92009-04-29 20:09:50 +00002123fi])
2124AC_MSG_RESULT($with_dbmliborder)
Matthias Klose10cbe482009-04-29 17:18:19 +00002125
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002126# Determine if signalmodule should be used.
2127AC_SUBST(USE_SIGNAL_MODULE)
2128AC_SUBST(SIGNAL_OBJS)
2129AC_MSG_CHECKING(for --with-signal-module)
2130AC_ARG_WITH(signal-module,
Matthias Klose22520ea2010-05-08 10:14:46 +00002131 AS_HELP_STRING([--with-signal-module], [disable/enable signal module]))
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002132
2133if test -z "$with_signal_module"
2134then with_signal_module="yes"
2135fi
2136AC_MSG_RESULT($with_signal_module)
2137
2138if test "${with_signal_module}" = "yes"; then
2139 USE_SIGNAL_MODULE=""
2140 SIGNAL_OBJS=""
2141else
2142 USE_SIGNAL_MODULE="#"
2143 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2144fi
2145
Guido van Rossum3d15bd82001-01-10 18:53:48 +00002146# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00002147AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002148USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00002149
Guido van Rossum54d93d41997-01-22 20:51:58 +00002150AC_MSG_CHECKING(for --with-dec-threads)
2151AC_SUBST(LDLAST)
2152AC_ARG_WITH(dec-threads,
Matthias Klose22520ea2010-05-08 10:14:46 +00002153 AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002154[
Barry Warsawc0d24d82000-06-29 16:12:00 +00002155AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00002156LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00002157if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00002158 with_thread="$withval";
2159fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002160[AC_MSG_RESULT(no)])
Guido van Rossum54d93d41997-01-22 20:51:58 +00002161
Martin v. Löwis11437992002-04-12 09:54:03 +00002162# Templates for things AC_DEFINEd more than once.
2163# For a single AC_DEFINE, no template is needed.
2164AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2165AH_TEMPLATE(_REENTRANT,
2166 [Define to force use of thread-safe errno, h_errno, and other functions])
2167AH_TEMPLATE(WITH_THREAD,
2168 [Define if you want to compile in rudimentary thread support])
2169
Guido van Rossum54d93d41997-01-22 20:51:58 +00002170AC_MSG_CHECKING(for --with-threads)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002171dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawc0d24d82000-06-29 16:12:00 +00002172AC_ARG_WITH(threads,
Matthias Klose22520ea2010-05-08 10:14:46 +00002173 AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support]))
Guido van Rossum54d93d41997-01-22 20:51:58 +00002174
Barry Warsawc0d24d82000-06-29 16:12:00 +00002175# --with-thread is deprecated, but check for it anyway
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002176dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00002177AC_ARG_WITH(thread,
Matthias Klose22520ea2010-05-08 10:14:46 +00002178 AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002179 [with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002180
2181if test -z "$with_threads"
2182then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002183fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00002184AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00002185
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002186AC_SUBST(THREADOBJ)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002187if test "$with_threads" = "no"
2188then
2189 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002190elif test "$ac_cv_pthread_is_default" = yes
2191then
2192 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002193 # Defining _REENTRANT on system with POSIX threads should not hurt.
2194 AC_DEFINE(_REENTRANT)
2195 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002196 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00002197elif test "$ac_cv_kpthread" = "yes"
2198then
2199 CC="$CC -Kpthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002200 if test "$ac_cv_cxx_thread" = "yes"; then
2201 CXX="$CXX -Kpthread"
2202 fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00002203 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002204 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002205 THREADOBJ="Python/thread.o"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002206elif test "$ac_cv_kthread" = "yes"
2207then
2208 CC="$CC -Kthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002209 if test "$ac_cv_cxx_thread" = "yes"; then
2210 CXX="$CXX -Kthread"
2211 fi
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002212 AC_DEFINE(WITH_THREAD)
2213 posix_threads=yes
2214 THREADOBJ="Python/thread.o"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002215elif test "$ac_cv_pthread" = "yes"
2216then
2217 CC="$CC -pthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002218 if test "$ac_cv_cxx_thread" = "yes"; then
2219 CXX="$CXX -pthread"
2220 fi
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002221 AC_DEFINE(WITH_THREAD)
2222 posix_threads=yes
2223 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +00002224else
Martin v. Löwis130fb172001-07-19 11:00:41 +00002225 if test ! -z "$with_threads" -a -d "$with_threads"
2226 then LDFLAGS="$LDFLAGS -L$with_threads"
2227 fi
2228 if test ! -z "$withval" -a -d "$withval"
2229 then LDFLAGS="$LDFLAGS -L$withval"
2230 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002231
2232 # According to the POSIX spec, a pthreads implementation must
Matthias Klosea2542be2004-08-16 11:35:51 +00002233 # define _POSIX_THREADS in unistd.h. Some apparently don't
2234 # (e.g. gnu pth with pthread emulation)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002235 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2236 AC_EGREP_CPP(yes,
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002237 [
2238#include <unistd.h>
2239#ifdef _POSIX_THREADS
2240yes
2241#endif
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002242 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2243 AC_MSG_RESULT($unistd_defines_pthreads)
2244
Martin v. Löwis130fb172001-07-19 11:00:41 +00002245 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002246 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2247 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002248 AC_DEFINE(HURD_C_THREADS, 1,
2249 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002250 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002251 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002252 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2253 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002254 AC_DEFINE(MACH_C_THREADS, 1,
2255 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002256 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002257 AC_MSG_CHECKING(for --with-pth)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002258 AC_ARG_WITH([pth],
Matthias Klose22520ea2010-05-08 10:14:46 +00002259 AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002260 [AC_MSG_RESULT($withval)
2261 AC_DEFINE([WITH_THREAD])
2262 AC_DEFINE([HAVE_PTH], 1,
2263 [Define if you have GNU PTH threads.])
2264 LIBS="-lpth $LIBS"
2265 THREADOBJ="Python/thread.o"],
2266 [AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002267
2268 # Just looking for pthread_create in libpthread is not enough:
2269 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2270 # So we really have to include pthread.h, and then link.
2271 _libs=$LIBS
2272 LIBS="$LIBS -lpthread"
2273 AC_MSG_CHECKING([for pthread_create in -lpthread])
Matthias Klosec511b472010-05-08 11:01:39 +00002274 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002275
Matthias Klosec511b472010-05-08 11:01:39 +00002276void * start_routine (void *arg) { exit (0); }]], [[
2277pthread_create (NULL, NULL, start_routine, NULL)]])],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002278 AC_MSG_RESULT(yes)
2279 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002280 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002281 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002282 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00002283 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002284 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002285 THREADOBJ="Python/thread.o"],[
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002286 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2287 AC_DEFINE(ATHEOS_THREADS, 1,
2288 [Define this if you have AtheOS threads.])
2289 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002290 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002291 AC_DEFINE(BEOS_THREADS, 1,
2292 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002293 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002294 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002295 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002296 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002297 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002298 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002299 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002300 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002301 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002302 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002303 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002304 LIBS="$LIBS -lpthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002305 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002306 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002307 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002308 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002309 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002310 USE_THREAD_MODULE="#"])
Skip Montanarof8712e52004-01-17 03:04:46 +00002311 ])])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002312
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002313 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2314 LIBS="$LIBS -lmpc"
2315 THREADOBJ="Python/thread.o"
2316 USE_THREAD_MODULE=""])
2317
2318 if test "$posix_threads" != "yes"; then
2319 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2320 LIBS="$LIBS -lthread"
2321 THREADOBJ="Python/thread.o"
2322 USE_THREAD_MODULE=""])
2323 fi
2324
2325 if test "$USE_THREAD_MODULE" != "#"
2326 then
2327 # If the above checks didn't disable threads, (at least) OSF1
2328 # needs this '-threads' argument during linking.
2329 case $ac_sys_system in
2330 OSF1) LDLAST=-threads;;
2331 esac
2332 fi
2333fi
2334
2335if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002336 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002337 AC_DEFINE(_POSIX_THREADS, 1,
2338 [Define if you have POSIX threads,
2339 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002340 fi
2341
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002342 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2343 case $ac_sys_system/$ac_sys_release in
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002344 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002345 [Defined for Solaris 2.6 bug in pthread header.])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002346 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002347 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002348 [Define if the Posix semaphores do not work on your system])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002349 ;;
Christian Heimescba36bb2008-01-30 22:54:18 +00002350 AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002351 [Define if the Posix semaphores do not work on your system])
Christian Heimescba36bb2008-01-30 22:54:18 +00002352 ;;
Antoine Pitroub41947b2010-08-30 14:55:30 +00002353 AIX/6) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2354 Define if the Posix semaphores do not work on your system)
2355 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002356 esac
2357
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002358 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2359 AC_CACHE_VAL(ac_cv_pthread_system_supported,
Matthias Klosec511b472010-05-08 11:01:39 +00002360 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <pthread.h>
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002361 void *foo(void *parm) {
2362 return NULL;
2363 }
2364 main() {
2365 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002366 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002367 if (pthread_attr_init(&attr)) exit(-1);
2368 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002369 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002370 exit(0);
Matthias Klosec511b472010-05-08 11:01:39 +00002371 }]])],
2372 [ac_cv_pthread_system_supported=yes],
2373 [ac_cv_pthread_system_supported=no],
2374 [ac_cv_pthread_system_supported=no])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002375 ])
2376 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2377 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002378 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002379 fi
Jason Tishlerfac083d2003-07-22 15:20:49 +00002380 AC_CHECK_FUNCS(pthread_sigmask,
2381 [case $ac_sys_system in
2382 CYGWIN*)
2383 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2384 [Define if pthread_sigmask() does not work on your system.])
2385 ;;
2386 esac])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002387fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002388
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002389
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002390# Check for enable-ipv6
Martin v. Löwis11437992002-04-12 09:54:03 +00002391AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002392AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002393AC_ARG_ENABLE(ipv6,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002394[ --enable-ipv6 Enable ipv6 (with ipv4) support
2395 --disable-ipv6 Disable ipv6 support],
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002396[ case "$enableval" in
2397 no)
2398 AC_MSG_RESULT(no)
2399 ipv6=no
2400 ;;
2401 *) AC_MSG_RESULT(yes)
2402 AC_DEFINE(ENABLE_IPV6)
2403 ipv6=yes
2404 ;;
2405 esac ],
2406
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002407[
2408dnl the check does not work on cross compilation case...
Matthias Klosec511b472010-05-08 11:01:39 +00002409 AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* AF_INET6 available check */
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002410#include <sys/types.h>
2411#include <sys/socket.h>
2412main()
2413{
2414 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
2415 exit(1);
2416 else
2417 exit(0);
2418}
Matthias Klosec511b472010-05-08 11:01:39 +00002419]])],[
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002420 AC_MSG_RESULT(yes)
Matthias Klosec511b472010-05-08 11:01:39 +00002421 ipv6=yes
2422],[
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002423 AC_MSG_RESULT(no)
2424 ipv6=no
Matthias Klosec511b472010-05-08 11:01:39 +00002425],[
2426 AC_MSG_RESULT(no)
2427 ipv6=no
2428])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002429
2430if test "$ipv6" = "yes"; then
2431 AC_MSG_CHECKING(if RFC2553 API is available)
Matthias Klosec511b472010-05-08 11:01:39 +00002432 AC_COMPILE_IFELSE([
2433 AC_LANG_PROGRAM([[#include <sys/types.h>
2434#include <netinet/in.h>]],
2435 [[struct sockaddr_in6 x;
2436 x.sin6_scope_id;]])
2437 ],[
2438 AC_MSG_RESULT(yes)
2439 ipv6=yes
2440 ],[
2441 AC_MSG_RESULT(no, IPv6 disabled)
2442 ipv6=no
2443 ])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002444fi
2445
2446if test "$ipv6" = "yes"; then
2447 AC_DEFINE(ENABLE_IPV6)
2448fi
2449])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002450
2451ipv6type=unknown
2452ipv6lib=none
2453ipv6trylibc=no
2454
2455if test "$ipv6" = "yes"; then
2456 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00002457 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2458 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002459 case $i in
2460 inria)
2461 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002462 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002463#include <netinet/in.h>
2464#ifdef IPV6_INRIA_VERSION
2465yes
2466#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002467 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002468 ;;
2469 kame)
2470 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002471 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002472#include <netinet/in.h>
2473#ifdef __KAME__
2474yes
2475#endif],
2476 [ipv6type=$i;
2477 ipv6lib=inet6
2478 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002479 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002480 ;;
2481 linux-glibc)
2482 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002483 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002484#include <features.h>
2485#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2486yes
2487#endif],
2488 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002489 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002490 ;;
2491 linux-inet6)
2492 dnl http://www.v6.linux.or.jp/
2493 if test -d /usr/inet6; then
2494 ipv6type=$i
2495 ipv6lib=inet6
2496 ipv6libdir=/usr/inet6/lib
Skip Montanarodecc6a42003-01-01 20:07:49 +00002497 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002498 fi
2499 ;;
2500 solaris)
2501 if test -f /etc/netconfig; then
2502 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
2503 ipv6type=$i
2504 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002505 fi
2506 fi
2507 ;;
2508 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002509 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002510#include <sys/param.h>
2511#ifdef _TOSHIBA_INET6
2512yes
2513#endif],
2514 [ipv6type=$i;
2515 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002516 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002517 ;;
2518 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002519 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002520#include </usr/local/v6/include/sys/v6config.h>
2521#ifdef __V6D__
2522yes
2523#endif],
2524 [ipv6type=$i;
2525 ipv6lib=v6;
2526 ipv6libdir=/usr/local/v6/lib;
Skip Montanarodecc6a42003-01-01 20:07:49 +00002527 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002528 ;;
2529 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002530 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002531#include <sys/param.h>
2532#ifdef _ZETA_MINAMI_INET6
2533yes
2534#endif],
2535 [ipv6type=$i;
2536 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002537 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002538 ;;
2539 esac
2540 if test "$ipv6type" != "unknown"; then
2541 break
2542 fi
2543 done
2544 AC_MSG_RESULT($ipv6type)
2545fi
2546
2547if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2548 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2549 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2550 echo "using lib$ipv6lib"
2551 else
2552 if test $ipv6trylibc = "yes"; then
2553 echo "using libc"
2554 else
2555 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2556 echo "You need to fetch lib$ipv6lib.a from appropriate"
2557 echo 'ipv6 kit and compile beforehand.'
2558 exit 1
2559 fi
2560 fi
2561fi
2562
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002563AC_MSG_CHECKING(for OSX 10.5 SDK or later)
Matthias Klosec511b472010-05-08 11:01:39 +00002564AC_COMPILE_IFELSE([
Mark Dickinson0712b562010-05-08 19:13:21 +00002565 AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
Matthias Klosec511b472010-05-08 11:01:39 +00002566],[
Matthias Klose5183ebd2010-04-24 16:38:36 +00002567 AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.])
Matthias Klosec511b472010-05-08 11:01:39 +00002568 AC_MSG_RESULT(yes)
2569],[
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002570 AC_MSG_RESULT(no)
Matthias Klosec511b472010-05-08 11:01:39 +00002571])
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002572
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002573# Check for --with-doc-strings
2574AC_MSG_CHECKING(for --with-doc-strings)
2575AC_ARG_WITH(doc-strings,
Matthias Klose22520ea2010-05-08 10:14:46 +00002576 AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings]))
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002577
2578if test -z "$with_doc_strings"
2579then with_doc_strings="yes"
2580fi
2581if test "$with_doc_strings" != "no"
2582then
2583 AC_DEFINE(WITH_DOC_STRINGS, 1,
2584 [Define if you want documentation strings in extension modules])
2585fi
2586AC_MSG_RESULT($with_doc_strings)
2587
Neil Schemenauera35c6882001-02-27 04:45:05 +00002588# Check for Python-specific malloc support
Martin v. Löwisf30d60e2004-06-08 08:17:44 +00002589AC_MSG_CHECKING(for --with-tsc)
2590AC_ARG_WITH(tsc,
Matthias Klose22520ea2010-05-08 10:14:46 +00002591 AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[
Martin v. Löwisf30d60e2004-06-08 08:17:44 +00002592if test "$withval" != no
2593then
2594 AC_DEFINE(WITH_TSC, 1,
2595 [Define to profile with the Pentium timestamp counter])
2596 AC_MSG_RESULT(yes)
2597else AC_MSG_RESULT(no)
2598fi],
2599[AC_MSG_RESULT(no)])
2600
2601# Check for Python-specific malloc support
Neil Schemenauera35c6882001-02-27 04:45:05 +00002602AC_MSG_CHECKING(for --with-pymalloc)
2603AC_ARG_WITH(pymalloc,
Matthias Klose22520ea2010-05-08 10:14:46 +00002604 AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs]))
Neil Schemenauer16c22972002-03-22 15:34:49 +00002605
2606if test -z "$with_pymalloc"
2607then with_pymalloc="yes"
2608fi
2609if test "$with_pymalloc" != "no"
2610then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002611 AC_DEFINE(WITH_PYMALLOC, 1,
2612 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00002613fi
2614AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00002615
Benjamin Peterson91c12eb2009-12-03 02:52:39 +00002616# Check for Valgrind support
2617AC_MSG_CHECKING([for --with-valgrind])
2618AC_ARG_WITH([valgrind],
Matthias Klose22520ea2010-05-08 10:14:46 +00002619 AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
Benjamin Peterson91c12eb2009-12-03 02:52:39 +00002620 with_valgrind=no)
2621AC_MSG_RESULT([$with_valgrind])
2622if test "$with_valgrind" != no; then
2623 AC_CHECK_HEADER([valgrind/valgrind.h],
2624 [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
2625 [AC_MSG_ERROR([Valgrind support requested but headers not available])]
2626 )
2627fi
2628
Barry Warsawef82cd72000-06-30 16:21:01 +00002629# Check for --with-wctype-functions
2630AC_MSG_CHECKING(for --with-wctype-functions)
2631AC_ARG_WITH(wctype-functions,
Matthias Klose22520ea2010-05-08 10:14:46 +00002632 AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002633[
Barry Warsawef82cd72000-06-30 16:21:01 +00002634if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002635then
2636 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2637 [Define if you want wctype.h functions to be used instead of the
2638 one supplied by Python itself. (see Include/unicodectype.h).])
2639 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00002640else AC_MSG_RESULT(no)
2641fi],
2642[AC_MSG_RESULT(no)])
2643
Guido van Rossum68242b51996-05-28 22:53:03 +00002644# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002645AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00002646DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002647
Guido van Rossume97ee181999-12-20 21:27:22 +00002648# the dlopen() function means we might want to use dynload_shlib.o. some
2649# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00002650AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00002651
2652# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2653# loading of modules.
2654AC_SUBST(DYNLOADFILE)
2655AC_MSG_CHECKING(DYNLOADFILE)
2656if test -z "$DYNLOADFILE"
2657then
2658 case $ac_sys_system/$ac_sys_release in
Martin v. Löwisc19c5a62003-11-18 20:00:44 +00002659 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2660 if test "$ac_cv_func_dlopen" = yes
2661 then DYNLOADFILE="dynload_shlib.o"
2662 else DYNLOADFILE="dynload_aix.o"
2663 fi
2664 ;;
Guido van Rossume97ee181999-12-20 21:27:22 +00002665 BeOS*) DYNLOADFILE="dynload_beos.o";;
2666 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Anthony Baxter82201742006-04-09 15:07:40 +00002667 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2668 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002669 atheos*) DYNLOADFILE="dynload_atheos.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00002670 *)
2671 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2672 # out any dynamic loading
2673 if test "$ac_cv_func_dlopen" = yes
2674 then DYNLOADFILE="dynload_shlib.o"
2675 else DYNLOADFILE="dynload_stub.o"
2676 fi
2677 ;;
2678 esac
2679fi
2680AC_MSG_RESULT($DYNLOADFILE)
2681if test "$DYNLOADFILE" != "dynload_stub.o"
2682then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002683 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2684 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00002685fi
2686
Jack Jansenc49e5b72001-06-19 15:00:23 +00002687# MACHDEP_OBJS can be set to platform-specific object files needed by Python
2688
2689AC_SUBST(MACHDEP_OBJS)
2690AC_MSG_CHECKING(MACHDEP_OBJS)
2691if test -z "$MACHDEP_OBJS"
2692then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002693 MACHDEP_OBJS=$extra_machdep_objs
2694else
2695 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00002696fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002697AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00002698
Guido van Rossum627b2d71993-12-24 10:39:16 +00002699# checks for library functions
Martin v. Löwisaef18b12008-03-24 13:31:16 +00002700AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2701 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
Martin v. Löwis438b5342002-12-27 10:16:42 +00002702 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00002703 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
Antoine Pitrou30b3b352009-12-02 20:37:54 +00002704 initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime \
Martin v. Löwisa5f09072002-10-11 05:37:59 +00002705 mremap nice pathconf pause plock poll pthread_init \
Guido van Rossum162e38c2003-02-19 15:25:10 +00002706 putenv readlink realpath \
Jesse Noller355b1262009-04-02 00:03:28 +00002707 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
2708 setgid \
Martin v. Löwis4daacb12003-03-28 18:37:01 +00002709 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00002710 setlocale setregid setreuid setresuid setresgid \
2711 setsid setpgid setpgrp setuid setvbuf snprintf \
Skip Montanaro7e11a012004-02-07 12:55:46 +00002712 sigaction siginterrupt sigrelse strftime \
Michael W. Hudson34f20ea2002-05-27 15:08:24 +00002713 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Neal Norwitz05a45592006-03-20 06:30:08 +00002714 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00002715
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002716# For some functions, having a definition is not sufficient, since
2717# we want to take their address.
2718AC_MSG_CHECKING(for chroot)
Matthias Klosec511b472010-05-08 11:01:39 +00002719AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])],
2720 [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2721 AC_MSG_RESULT(yes)],
2722 [AC_MSG_RESULT(no)
2723])
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002724AC_MSG_CHECKING(for link)
Matthias Klosec511b472010-05-08 11:01:39 +00002725AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])],
2726 [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2727 AC_MSG_RESULT(yes)],
2728 [AC_MSG_RESULT(no)
2729])
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002730AC_MSG_CHECKING(for symlink)
Matthias Klosec511b472010-05-08 11:01:39 +00002731AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])],
2732 [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2733 AC_MSG_RESULT(yes)],
2734 [AC_MSG_RESULT(no)
2735])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002736AC_MSG_CHECKING(for fchdir)
Matthias Klosec511b472010-05-08 11:01:39 +00002737AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])],
2738 [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2739 AC_MSG_RESULT(yes)],
2740 [AC_MSG_RESULT(no)
2741])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002742AC_MSG_CHECKING(for fsync)
Matthias Klosec511b472010-05-08 11:01:39 +00002743AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])],
2744 [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2745 AC_MSG_RESULT(yes)],
2746 [AC_MSG_RESULT(no)
2747])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002748AC_MSG_CHECKING(for fdatasync)
Matthias Klosec511b472010-05-08 11:01:39 +00002749AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])],
2750 [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2751 AC_MSG_RESULT(yes)],
2752 [AC_MSG_RESULT(no)
2753])
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00002754AC_MSG_CHECKING(for epoll)
Matthias Klosec511b472010-05-08 11:01:39 +00002755AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])],
2756 [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2757 AC_MSG_RESULT(yes)],
2758 [AC_MSG_RESULT(no)
2759])
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00002760AC_MSG_CHECKING(for kqueue)
Matthias Klosec511b472010-05-08 11:01:39 +00002761AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00002762#include <sys/types.h>
2763#include <sys/event.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002764 ]], [[int x=kqueue()]])],
2765 [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2766 AC_MSG_RESULT(yes)],
2767 [AC_MSG_RESULT(no)
2768])
Martin v. Löwisd5843682002-11-21 20:41:28 +00002769# On some systems (eg. FreeBSD 5), we would find a definition of the
2770# functions ctermid_r, setgroups in the library, but no prototype
2771# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2772# address to avoid compiler warnings and potential miscompilations
2773# because of the missing prototypes.
2774
2775AC_MSG_CHECKING(for ctermid_r)
Matthias Klosec511b472010-05-08 11:01:39 +00002776AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisd5843682002-11-21 20:41:28 +00002777#include <stdio.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002778]], [[void* p = ctermid_r]])],
2779 [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2780 AC_MSG_RESULT(yes)],
2781 [AC_MSG_RESULT(no)
2782])
Martin v. Löwisd5843682002-11-21 20:41:28 +00002783
Antoine Pitroub170f172010-09-10 18:47:36 +00002784AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl],
2785 [AC_COMPILE_IFELSE(
2786 [AC_LANG_PROGRAM(
2787 [#include <sys/file.h>],
2788 [void* p = flock]
2789 )],
2790 [ac_cv_flock_decl=yes],
2791 [ac_cv_flock_decl=no]
2792 )
Matthias Klosec511b472010-05-08 11:01:39 +00002793])
Antoine Pitroub170f172010-09-10 18:47:36 +00002794if test "x${ac_cv_flock_decl}" = xyes; then
2795 AC_CHECK_FUNCS(flock,,
2796 AC_CHECK_LIB(bsd,flock,
2797 [AC_DEFINE(HAVE_FLOCK)
2798 AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
2799 ])
2800 )
Antoine Pitrou85729812010-09-07 14:55:24 +00002801fi
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00002802
2803AC_MSG_CHECKING(for getpagesize)
Matthias Klosec511b472010-05-08 11:01:39 +00002804AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00002805#include <unistd.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002806]], [[void* p = getpagesize]])],
2807 [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2808 AC_MSG_RESULT(yes)],
2809 [AC_MSG_RESULT(no)
2810])
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00002811
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002812dnl check for true
2813AC_CHECK_PROGS(TRUE, true, /bin/true)
2814
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002815dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2816dnl On others, they are in the C library, so we to take no action
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002817AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002818 AC_CHECK_LIB(resolv, inet_aton)
2819)
2820
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002821# On Tru64, chflags seems to be present, but calling it will
2822# exit Python
Gregory P. Smithbb213892009-11-02 01:37:37 +00002823AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
Matthias Klosec511b472010-05-08 11:01:39 +00002824AC_RUN_IFELSE([AC_LANG_SOURCE([[[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002825#include <sys/stat.h>
2826#include <unistd.h>
2827int main(int argc, char*argv[])
2828{
2829 if(chflags(argv[0], 0) != 0)
2830 return 1;
2831 return 0;
2832}
Matthias Klosec511b472010-05-08 11:01:39 +00002833]]])],
2834[ac_cv_have_chflags=yes],
2835[ac_cv_have_chflags=no],
2836[ac_cv_have_chflags=cross])
Gregory P. Smithbb213892009-11-02 01:37:37 +00002837])
2838if test "$ac_cv_have_chflags" = cross ; then
2839 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
2840fi
2841if test "$ac_cv_have_chflags" = yes ; then
Matthias Klose5183ebd2010-04-24 16:38:36 +00002842 AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the `chflags' function.])
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002843fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002844
Gregory P. Smithbb213892009-11-02 01:37:37 +00002845AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
Matthias Klosec511b472010-05-08 11:01:39 +00002846AC_RUN_IFELSE([AC_LANG_SOURCE([[[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002847#include <sys/stat.h>
2848#include <unistd.h>
2849int main(int argc, char*argv[])
2850{
2851 if(lchflags(argv[0], 0) != 0)
2852 return 1;
2853 return 0;
2854}
Matthias Klosec511b472010-05-08 11:01:39 +00002855]]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross])
Gregory P. Smithbb213892009-11-02 01:37:37 +00002856])
2857if test "$ac_cv_have_lchflags" = cross ; then
2858 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
2859fi
2860if test "$ac_cv_have_lchflags" = yes ; then
Matthias Klose5183ebd2010-04-24 16:38:36 +00002861 AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the `lchflags' function.])
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002862fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002863
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00002864dnl Check if system zlib has *Copy() functions
Ronald Oussorenf8752642006-07-06 10:13:35 +00002865dnl
2866dnl On MacOSX the linker will search for dylibs on the entire linker path
2867dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
2868dnl to revert to a more traditional unix behaviour and make it possible to
2869dnl override the system libz with a local static library of libz. Temporarily
2870dnl add that flag to our CFLAGS as well to ensure that we check the version
2871dnl of libz that will be used by setup.py.
2872dnl The -L/usr/local/lib is needed as wel to get the same compilation
2873dnl environment as setup.py (and leaving it out can cause configure to use the
2874dnl wrong version of the library)
2875case $ac_sys_system/$ac_sys_release in
2876Darwin/*)
2877 _CUR_CFLAGS="${CFLAGS}"
2878 _CUR_LDFLAGS="${LDFLAGS}"
2879 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
2880 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
2881 ;;
2882esac
2883
Matthias Klose5183ebd2010-04-24 16:38:36 +00002884AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00002885
Ronald Oussorenf8752642006-07-06 10:13:35 +00002886case $ac_sys_system/$ac_sys_release in
2887Darwin/*)
2888 CFLAGS="${_CUR_CFLAGS}"
2889 LDFLAGS="${_CUR_LDFLAGS}"
2890 ;;
2891esac
2892
Martin v. Löwise9416172003-05-03 10:12:45 +00002893AC_MSG_CHECKING(for hstrerror)
Matthias Klosec511b472010-05-08 11:01:39 +00002894AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwise9416172003-05-03 10:12:45 +00002895#include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002896]], [[void* p = hstrerror; hstrerror(0)]])],
2897 [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2898 AC_MSG_RESULT(yes)],
2899 [AC_MSG_RESULT(no)
2900])
Martin v. Löwise9416172003-05-03 10:12:45 +00002901
2902AC_MSG_CHECKING(for inet_aton)
Matthias Klosec511b472010-05-08 11:01:39 +00002903AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwis86d66262006-02-17 08:40:11 +00002904#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00002905#include <sys/socket.h>
2906#include <netinet/in.h>
2907#include <arpa/inet.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002908]], [[void* p = inet_aton;inet_aton(0,0)]])],
2909 [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2910 AC_MSG_RESULT(yes)],
2911 [AC_MSG_RESULT(no)
2912])
Martin v. Löwise9416172003-05-03 10:12:45 +00002913
2914AC_MSG_CHECKING(for inet_pton)
Matthias Klosec511b472010-05-08 11:01:39 +00002915AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00002916#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00002917#include <sys/socket.h>
2918#include <netinet/in.h>
2919#include <arpa/inet.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002920]], [[void* p = inet_pton]])],
2921 [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2922 AC_MSG_RESULT(yes)],
2923 [AC_MSG_RESULT(no)
2924])
Martin v. Löwise9416172003-05-03 10:12:45 +00002925
Martin v. Löwisd6640d42003-07-06 09:29:52 +00002926# On some systems, setgroups is in unistd.h, on others, in grp.h
Martin v. Löwisd5843682002-11-21 20:41:28 +00002927AC_MSG_CHECKING(for setgroups)
Matthias Klosec511b472010-05-08 11:01:39 +00002928AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00002929#include <unistd.h>
Martin v. Löwisd6640d42003-07-06 09:29:52 +00002930#ifdef HAVE_GRP_H
2931#include <grp.h>
2932#endif
Matthias Klosec511b472010-05-08 11:01:39 +00002933]], [[void* p = setgroups]])],
2934 [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2935 AC_MSG_RESULT(yes)],
2936 [AC_MSG_RESULT(no)
2937])
Martin v. Löwisd5843682002-11-21 20:41:28 +00002938
Fred Drake8cef4cf2000-06-28 16:40:38 +00002939# check for openpty and forkpty
2940
Martin v. Löwisfd9a72a2006-01-08 10:07:33 +00002941AC_CHECK_FUNCS(openpty,,
2942 AC_CHECK_LIB(util,openpty,
2943 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2944 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2945 )
2946)
2947AC_CHECK_FUNCS(forkpty,,
2948 AC_CHECK_LIB(util,forkpty,
2949 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2950 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2951 )
2952)
Fred Drake8cef4cf2000-06-28 16:40:38 +00002953
Brett Cannonaa5778d2008-03-18 04:09:00 +00002954# Stuff for expat.
2955AC_CHECK_FUNCS(memmove)
2956
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00002957# check for long file support functions
2958AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2959
Brett Cannonaa5778d2008-03-18 04:09:00 +00002960AC_REPLACE_FUNCS(dup2 getcwd strdup)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002961AC_CHECK_FUNCS(getpgrp,
Matthias Klosec511b472010-05-08 11:01:39 +00002962 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
2963 [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
2964 [])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002965)
Jack Jansen150753c2003-03-29 22:07:47 +00002966AC_CHECK_FUNCS(setpgrp,
Matthias Klosec511b472010-05-08 11:01:39 +00002967 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])],
2968 [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])],
2969 [])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002970)
2971AC_CHECK_FUNCS(gettimeofday,
Matthias Klosec511b472010-05-08 11:01:39 +00002972 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]],
2973 [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])],
2974 [],
2975 [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2976 [Define if gettimeofday() does not have second (timezone) argument
2977 This is the case on Motorola V4 (R40V4.2)])
2978 ])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002979)
Guido van Rossum627b2d71993-12-24 10:39:16 +00002980
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002981AC_MSG_CHECKING(for major, minor, and makedev)
Matthias Klosec511b472010-05-08 11:01:39 +00002982AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002983#if defined(MAJOR_IN_MKDEV)
2984#include <sys/mkdev.h>
2985#elif defined(MAJOR_IN_SYSMACROS)
2986#include <sys/sysmacros.h>
2987#else
2988#include <sys/types.h>
2989#endif
Matthias Klosec511b472010-05-08 11:01:39 +00002990]], [[
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002991 makedev(major(0),minor(0));
Matthias Klosec511b472010-05-08 11:01:39 +00002992]])],[
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002993 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2994 [Define to 1 if you have the device macros.])
2995 AC_MSG_RESULT(yes)
2996],[
2997 AC_MSG_RESULT(no)
2998])
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002999
3000# On OSF/1 V5.1, getaddrinfo is available, but a define
3001# for [no]getaddrinfo in netdb.h.
3002AC_MSG_CHECKING(for getaddrinfo)
Matthias Klosec511b472010-05-08 11:01:39 +00003003AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00003004#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003005#include <sys/socket.h>
3006#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00003007#include <stdio.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003008]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],
3009[have_getaddrinfo=yes],
3010[have_getaddrinfo=no])
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003011AC_MSG_RESULT($have_getaddrinfo)
3012if test $have_getaddrinfo = yes
3013then
3014 AC_MSG_CHECKING(getaddrinfo bug)
3015 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
Matthias Klosec511b472010-05-08 11:01:39 +00003016 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003017#include <sys/types.h>
3018#include <netdb.h>
3019#include <string.h>
3020#include <sys/socket.h>
3021#include <netinet/in.h>
3022
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003023int main()
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003024{
3025 int passive, gaierr, inet4 = 0, inet6 = 0;
3026 struct addrinfo hints, *ai, *aitop;
3027 char straddr[INET6_ADDRSTRLEN], strport[16];
3028
3029 for (passive = 0; passive <= 1; passive++) {
3030 memset(&hints, 0, sizeof(hints));
3031 hints.ai_family = AF_UNSPEC;
3032 hints.ai_flags = passive ? AI_PASSIVE : 0;
3033 hints.ai_socktype = SOCK_STREAM;
Hye-Shik Chang54f94392004-04-14 07:55:31 +00003034 hints.ai_protocol = IPPROTO_TCP;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003035 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
3036 (void)gai_strerror(gaierr);
3037 goto bad;
3038 }
3039 for (ai = aitop; ai; ai = ai->ai_next) {
3040 if (ai->ai_addr == NULL ||
3041 ai->ai_addrlen == 0 ||
3042 getnameinfo(ai->ai_addr, ai->ai_addrlen,
3043 straddr, sizeof(straddr), strport, sizeof(strport),
3044 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
3045 goto bad;
3046 }
3047 switch (ai->ai_family) {
3048 case AF_INET:
3049 if (strcmp(strport, "54321") != 0) {
3050 goto bad;
3051 }
3052 if (passive) {
3053 if (strcmp(straddr, "0.0.0.0") != 0) {
3054 goto bad;
3055 }
3056 } else {
3057 if (strcmp(straddr, "127.0.0.1") != 0) {
3058 goto bad;
3059 }
3060 }
3061 inet4++;
3062 break;
3063 case AF_INET6:
3064 if (strcmp(strport, "54321") != 0) {
3065 goto bad;
3066 }
3067 if (passive) {
3068 if (strcmp(straddr, "::") != 0) {
3069 goto bad;
3070 }
3071 } else {
3072 if (strcmp(straddr, "::1") != 0) {
3073 goto bad;
3074 }
3075 }
3076 inet6++;
3077 break;
3078 case AF_UNSPEC:
3079 goto bad;
3080 break;
3081 default:
3082 /* another family support? */
3083 break;
3084 }
3085 }
3086 }
3087
3088 if (!(inet4 == 0 || inet4 == 2))
3089 goto bad;
3090 if (!(inet6 == 0 || inet6 == 2))
3091 goto bad;
3092
3093 if (aitop)
3094 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003095 return 0;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003096
3097 bad:
3098 if (aitop)
3099 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003100 return 1;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003101}
Matthias Klosec511b472010-05-08 11:01:39 +00003102]]])],
3103[ac_cv_buggy_getaddrinfo=no],
3104[ac_cv_buggy_getaddrinfo=yes],
3105[ac_cv_buggy_getaddrinfo=yes]))
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003106fi
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003107
Mark Dickinson0ef0b912009-12-31 21:11:48 +00003108if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003109then
3110 if test $ipv6 = yes
3111 then
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003112 echo 'Fatal: You must get working getaddrinfo() function.'
3113 echo ' or you can specify "--disable-ipv6"'.
3114 exit 1
3115 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003116else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003117 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003118fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00003119AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003120
Guido van Rossum627b2d71993-12-24 10:39:16 +00003121# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003122AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00003123AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003124AC_STRUCT_TIMEZONE
Martin v. Löwis60a5d722002-10-16 20:28:25 +00003125AC_CHECK_MEMBERS([struct stat.st_rdev])
3126AC_CHECK_MEMBERS([struct stat.st_blksize])
Hye-Shik Chang5f937a72005-06-02 13:09:30 +00003127AC_CHECK_MEMBERS([struct stat.st_flags])
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00003128AC_CHECK_MEMBERS([struct stat.st_gen])
3129AC_CHECK_MEMBERS([struct stat.st_birthtime])
Guido van Rossum98bf58f2001-10-18 20:34:25 +00003130AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003131
3132AC_MSG_CHECKING(for time.h that defines altzone)
Matthias Klosec511b472010-05-08 11:01:39 +00003133AC_CACHE_VAL(ac_cv_header_time_altzone,[
3134 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])],
3135 [ac_cv_header_time_altzone=yes],
3136 [ac_cv_header_time_altzone=no])
3137 ])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003138AC_MSG_RESULT($ac_cv_header_time_altzone)
3139if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003140 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003141fi
3142
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003143was_it_defined=no
3144AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Matthias Klosec511b472010-05-08 11:01:39 +00003145AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003146#include <sys/types.h>
3147#include <sys/select.h>
3148#include <sys/time.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003149]], [[;]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003150 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
3151 [Define if you can safely include both <sys/select.h> and <sys/time.h>
3152 (which you can't on SCO ODT 3.0).])
3153 was_it_defined=yes
Matthias Klosec511b472010-05-08 11:01:39 +00003154],[])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003155AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00003156
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003157AC_MSG_CHECKING(for addrinfo)
3158AC_CACHE_VAL(ac_cv_struct_addrinfo,
Matthias Klosec511b472010-05-08 11:01:39 +00003159AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
3160 [ac_cv_struct_addrinfo=yes],
3161 [ac_cv_struct_addrinfo=no]))
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003162AC_MSG_RESULT($ac_cv_struct_addrinfo)
3163if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003164 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003165fi
3166
3167AC_MSG_CHECKING(for sockaddr_storage)
3168AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
Matthias Klosec511b472010-05-08 11:01:39 +00003169AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003170# include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003171# include <sys/socket.h>]], [[struct sockaddr_storage s]])],
3172 [ac_cv_struct_sockaddr_storage=yes],
3173 [ac_cv_struct_sockaddr_storage=no]))
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003174AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3175if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003176 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003177fi
3178
Guido van Rossum627b2d71993-12-24 10:39:16 +00003179# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003180
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003181AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003182AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003183
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003184works=no
3185AC_MSG_CHECKING(for working volatile)
Matthias Klosec511b472010-05-08 11:01:39 +00003186AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])],
3187 [works=yes],
3188 [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])]
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003189)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003190AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00003191
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003192works=no
3193AC_MSG_CHECKING(for working signed char)
Matthias Klosec511b472010-05-08 11:01:39 +00003194AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])],
3195 [works=yes],
3196 [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])]
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003197)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003198AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003199
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003200have_prototypes=no
3201AC_MSG_CHECKING(for prototypes)
Matthias Klosec511b472010-05-08 11:01:39 +00003202AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])],
3203 [AC_DEFINE(HAVE_PROTOTYPES, 1,
3204 [Define if your compiler supports function prototype])
3205 have_prototypes=yes],
3206 []
3207)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003208AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003209
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003210works=no
3211AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Matthias Klosec511b472010-05-08 11:01:39 +00003212AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003213#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00003214int foo(int x, ...) {
3215 va_list va;
3216 va_start(va, x);
3217 va_arg(va, int);
3218 va_arg(va, char *);
3219 va_arg(va, double);
3220 return 0;
3221}
Matthias Klosec511b472010-05-08 11:01:39 +00003222]], [[return foo(10, "", 3.14);]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003223 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3224 [Define if your compiler supports variable length function prototypes
3225 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3226 works=yes
Matthias Klosec511b472010-05-08 11:01:39 +00003227],[])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003228AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003229
Dave Cole331708b2004-08-09 04:51:41 +00003230# check for socketpair
3231AC_MSG_CHECKING(for socketpair)
Matthias Klosec511b472010-05-08 11:01:39 +00003232AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Dave Cole331708b2004-08-09 04:51:41 +00003233#include <sys/types.h>
3234#include <sys/socket.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003235]], [[void *x=socketpair]])],
3236 [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.])
3237 AC_MSG_RESULT(yes)],
3238 [AC_MSG_RESULT(no)]
Dave Cole331708b2004-08-09 04:51:41 +00003239)
3240
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003241# check if sockaddr has sa_len member
3242AC_MSG_CHECKING(if sockaddr has sa_len member)
Matthias Klosec511b472010-05-08 11:01:39 +00003243AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3244#include <sys/socket.h>]], [[struct sockaddr x;
3245x.sa_len = 0;]])],
3246 [AC_MSG_RESULT(yes)
3247 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])],
3248 [AC_MSG_RESULT(no)]
3249)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003250
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003251va_list_is_array=no
3252AC_MSG_CHECKING(whether va_list is an array)
Matthias Klosec511b472010-05-08 11:01:39 +00003253AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003254#ifdef HAVE_STDARG_PROTOTYPES
3255#include <stdarg.h>
3256#else
3257#include <varargs.h>
3258#endif
Matthias Klosec511b472010-05-08 11:01:39 +00003259]], [[va_list list1, list2; list1 = list2;]])],[],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003260 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3261 va_list_is_array=yes
3262])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003263AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003264
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003265# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
Martin v. Löwis11437992002-04-12 09:54:03 +00003266AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3267 [Define this if you have some version of gethostbyname_r()])
3268
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003269AC_CHECK_FUNC(gethostbyname_r, [
3270 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3271 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3272 OLD_CFLAGS=$CFLAGS
3273 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
Matthias Klosec511b472010-05-08 11:01:39 +00003274 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003275# include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003276 ]], [[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003277 char *name;
3278 struct hostent *he, *res;
3279 char buffer[2048];
3280 int buflen = 2048;
3281 int h_errnop;
3282
3283 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
Matthias Klosec511b472010-05-08 11:01:39 +00003284 ]])],[
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003285 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003286 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3287 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003288 AC_MSG_RESULT(yes)
Matthias Klosec511b472010-05-08 11:01:39 +00003289 ],[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003290 AC_MSG_RESULT(no)
3291 AC_MSG_CHECKING([gethostbyname_r with 5 args])
Matthias Klosec511b472010-05-08 11:01:39 +00003292 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003293# include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003294 ]], [[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003295 char *name;
3296 struct hostent *he;
Matthias Klosec511b472010-05-08 11:01:39 +00003297 char buffer[2048];
3298 int buflen = 2048;
3299 int h_errnop;
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003300
Matthias Klosec511b472010-05-08 11:01:39 +00003301 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3302 ]])],
3303 [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003304 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Matthias Klosec511b472010-05-08 11:01:39 +00003305 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3306 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003307 AC_MSG_RESULT(yes)
3308 ], [
3309 AC_MSG_RESULT(no)
Matthias Klosec511b472010-05-08 11:01:39 +00003310 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3311 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3312# include <netdb.h>
3313 ]], [[
3314 char *name;
3315 struct hostent *he;
3316 struct hostent_data data;
3317
3318 (void) gethostbyname_r(name, he, &data);
3319 ]])],
3320 [
3321 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3322 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3323 [Define this if you have the 3-arg version of gethostbyname_r().])
3324 AC_MSG_RESULT(yes)
3325 ], [
3326 AC_MSG_RESULT(no)
3327 ])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003328 ])
3329 ])
3330 CFLAGS=$OLD_CFLAGS
3331], [
Thomas Wouters3a584202000-08-05 23:28:51 +00003332 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003333])
3334AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3335AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3336AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003337AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003338AC_SUBST(HAVE_GETHOSTBYNAME)
3339
Guido van Rossum627b2d71993-12-24 10:39:16 +00003340# checks for system services
3341# (none yet)
3342
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003343# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00003344AC_CHECK_FUNC(__fpu_control,
3345 [],
3346 [AC_CHECK_LIB(ieee, __fpu_control)
3347])
Guido van Rossum627b2d71993-12-24 10:39:16 +00003348
Guido van Rossum93274221997-05-09 02:42:00 +00003349# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00003350AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00003351AC_ARG_WITH(fpectl,
Matthias Klose22520ea2010-05-08 10:14:46 +00003352 AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003353[
Guido van Rossum93274221997-05-09 02:42:00 +00003354if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003355then
3356 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3357 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3358 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00003359else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00003360fi],
3361[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00003362
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003363# check for --with-libm=...
3364AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003365case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00003366Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00003367BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003368*) LIBM=-lm
3369esac
Guido van Rossum93274221997-05-09 02:42:00 +00003370AC_MSG_CHECKING(for --with-libm=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003371AC_ARG_WITH(libm,
Matthias Klose22520ea2010-05-08 10:14:46 +00003372 AS_HELP_STRING([--with-libm=STRING], [math library]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003373[
Guido van Rossum93274221997-05-09 02:42:00 +00003374if test "$withval" = no
3375then LIBM=
3376 AC_MSG_RESULT(force LIBM empty)
3377elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003378then LIBM=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003379 AC_MSG_RESULT(set LIBM="$withval")
3380else AC_MSG_ERROR([proper usage is --with-libm=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003381fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003382[AC_MSG_RESULT(default LIBM="$LIBM")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003383
3384# check for --with-libc=...
3385AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00003386AC_MSG_CHECKING(for --with-libc=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003387AC_ARG_WITH(libc,
Matthias Klose22520ea2010-05-08 10:14:46 +00003388 AS_HELP_STRING([--with-libc=STRING], [C library]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003389[
Guido van Rossum93274221997-05-09 02:42:00 +00003390if test "$withval" = no
3391then LIBC=
3392 AC_MSG_RESULT(force LIBC empty)
3393elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003394then LIBC=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003395 AC_MSG_RESULT(set LIBC="$withval")
3396else AC_MSG_ERROR([proper usage is --with-libc=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003397fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003398[AC_MSG_RESULT(default LIBC="$LIBC")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003399
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003400# **************************************************
3401# * Check for various properties of floating point *
3402# **************************************************
Mark Dickinson265d7382008-04-21 22:32:24 +00003403
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003404AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3405AC_CACHE_VAL(ac_cv_little_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003406AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003407#include <string.h>
3408int main() {
3409 double x = 9006104071832581.0;
3410 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3411 return 0;
3412 else
3413 return 1;
3414}
Matthias Klosec511b472010-05-08 11:01:39 +00003415]])],
3416[ac_cv_little_endian_double=yes],
3417[ac_cv_little_endian_double=no],
3418[ac_cv_little_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003419AC_MSG_RESULT($ac_cv_little_endian_double)
3420if test "$ac_cv_little_endian_double" = yes
3421then
3422 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3423 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3424 with the least significant byte first])
3425fi
3426
3427AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3428AC_CACHE_VAL(ac_cv_big_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003429AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003430#include <string.h>
3431int main() {
3432 double x = 9006104071832581.0;
3433 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3434 return 0;
3435 else
3436 return 1;
3437}
Matthias Klosec511b472010-05-08 11:01:39 +00003438]])],
3439[ac_cv_big_endian_double=yes],
3440[ac_cv_big_endian_double=no],
3441[ac_cv_big_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003442AC_MSG_RESULT($ac_cv_big_endian_double)
3443if test "$ac_cv_big_endian_double" = yes
3444then
3445 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3446 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3447 with the most significant byte first])
3448fi
3449
3450# Some ARM platforms use a mixed-endian representation for doubles.
3451# While Python doesn't currently have full support for these platforms
3452# (see e.g., issue 1762561), we can at least make sure that float <-> string
3453# conversions work.
3454AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3455AC_CACHE_VAL(ac_cv_mixed_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003456AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003457#include <string.h>
3458int main() {
3459 double x = 9006104071832581.0;
3460 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3461 return 0;
3462 else
3463 return 1;
3464}
Matthias Klosec511b472010-05-08 11:01:39 +00003465]])],
3466[ac_cv_mixed_endian_double=yes],
3467[ac_cv_mixed_endian_double=no],
3468[ac_cv_mixed_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003469AC_MSG_RESULT($ac_cv_mixed_endian_double)
3470if test "$ac_cv_mixed_endian_double" = yes
3471then
3472 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3473 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3474 in ARM mixed-endian order (byte order 45670123)])
3475fi
3476
3477# The short float repr introduced in Python 3.1 requires the
3478# correctly-rounded string <-> double conversion functions from
3479# Python/dtoa.c, which in turn require that the FPU uses 53-bit
3480# rounding; this is a problem on x86, where the x87 FPU has a default
Mark Dickinsona548dee2009-11-15 13:12:43 +00003481# rounding precision of 64 bits. For gcc/x86, we can fix this by
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003482# using inline assembler to get and set the x87 FPU control word.
Mark Dickinsona548dee2009-11-15 13:12:43 +00003483
3484# This inline assembler syntax may also work for suncc and icc,
3485# so we try it on all platforms.
3486
3487AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
Matthias Klosec511b472010-05-08 11:01:39 +00003488AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
Mark Dickinsona548dee2009-11-15 13:12:43 +00003489 unsigned short cw;
3490 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3491 __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
Matthias Klosec511b472010-05-08 11:01:39 +00003492]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no])
Mark Dickinsona548dee2009-11-15 13:12:43 +00003493AC_MSG_RESULT($have_gcc_asm_for_x87)
3494if test "$have_gcc_asm_for_x87" = yes
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003495then
Mark Dickinsona548dee2009-11-15 13:12:43 +00003496 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3497 [Define if we can use gcc inline assembler to get and set x87 control word])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003498fi
Mark Dickinson7a3d8642008-04-22 00:54:27 +00003499
Mark Dickinson04b27232009-01-04 12:29:36 +00003500# Detect whether system arithmetic is subject to x87-style double
3501# rounding issues. The result of this test has little meaning on non
3502# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3503# mode is round-to-nearest and double rounding issues are present, and
3504# 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3505AC_MSG_CHECKING(for x87-style double rounding)
Mark Dickinson99abd142009-10-24 13:44:16 +00003506# $BASECFLAGS may affect the result
3507ac_save_cc="$CC"
3508CC="$CC $BASECFLAGS"
Matthias Klosec511b472010-05-08 11:01:39 +00003509AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson04b27232009-01-04 12:29:36 +00003510#include <stdlib.h>
3511#include <math.h>
3512int main() {
3513 volatile double x, y, z;
3514 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3515 x = 0.99999999999999989; /* 1-2**-53 */
3516 y = 1./x;
3517 if (y != 1.)
3518 exit(0);
3519 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3520 x = 1e16;
3521 y = 2.99999;
3522 z = x + y;
3523 if (z != 1e16+4.)
3524 exit(0);
3525 /* both tests show evidence of double rounding */
3526 exit(1);
3527}
Matthias Klosec511b472010-05-08 11:01:39 +00003528]])],
3529[ac_cv_x87_double_rounding=no],
3530[ac_cv_x87_double_rounding=yes],
3531[ac_cv_x87_double_rounding=no])
Mark Dickinson99abd142009-10-24 13:44:16 +00003532CC="$ac_save_cc"
Mark Dickinson04b27232009-01-04 12:29:36 +00003533AC_MSG_RESULT($ac_cv_x87_double_rounding)
3534if test "$ac_cv_x87_double_rounding" = yes
3535then
3536 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3537 [Define if arithmetic is subject to x87-style double rounding issue])
3538fi
3539
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003540# ************************************
3541# * Check for mathematical functions *
3542# ************************************
3543
3544LIBS_SAVE=$LIBS
3545LIBS="$LIBS $LIBM"
3546
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003547# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3548# -0. on some architectures.
3549AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3550AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
Matthias Klosec511b472010-05-08 11:01:39 +00003551AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003552#include <math.h>
3553#include <stdlib.h>
3554int main() {
3555 /* return 0 if either negative zeros don't exist
3556 on this platform or if negative zeros exist
3557 and tanh(-0.) == -0. */
3558 if (atan2(0., -1.) == atan2(-0., -1.) ||
3559 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3560 else exit(1);
3561}
Matthias Klosec511b472010-05-08 11:01:39 +00003562]])],
3563[ac_cv_tanh_preserves_zero_sign=yes],
3564[ac_cv_tanh_preserves_zero_sign=no],
3565[ac_cv_tanh_preserves_zero_sign=no])])
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003566AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3567if test "$ac_cv_tanh_preserves_zero_sign" = yes
3568then
3569 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3570 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3571fi
3572
3573AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
3574AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
3575AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3576
3577LIBS=$LIBS_SAVE
3578
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003579# For multiprocessing module, check that sem_open
3580# actually works. For FreeBSD versions <= 7.2,
3581# the kernel module that provides POSIX semaphores
3582# isn't loaded by default, so an attempt to call
3583# sem_open results in a 'Signal 12' error.
3584AC_MSG_CHECKING(whether POSIX semaphores are enabled)
3585AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
Matthias Klosec511b472010-05-08 11:01:39 +00003586AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003587#include <unistd.h>
3588#include <fcntl.h>
3589#include <stdio.h>
3590#include <semaphore.h>
3591#include <sys/stat.h>
3592
3593int main(void) {
3594 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3595 if (a == SEM_FAILED) {
3596 perror("sem_open");
3597 return 1;
3598 }
3599 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003600 sem_unlink("/autoconf");
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003601 return 0;
3602}
Matthias Klosec511b472010-05-08 11:01:39 +00003603]])],
3604[ac_cv_posix_semaphores_enabled=yes],
3605[ac_cv_posix_semaphores_enabled=no],
3606[ac_cv_posix_semaphores_enabled=yes])
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003607)
3608AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
3609if test $ac_cv_posix_semaphores_enabled = no
3610then
Mark Dickinson5afa6d42009-11-28 10:44:20 +00003611 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
3612 [Define if POSIX semaphores aren't enabled on your system])
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003613fi
3614
Jesse Noller355b1262009-04-02 00:03:28 +00003615# Multiprocessing check for broken sem_getvalue
3616AC_MSG_CHECKING(for broken sem_getvalue)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003617AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
Matthias Klosec511b472010-05-08 11:01:39 +00003618AC_RUN_IFELSE([AC_LANG_SOURCE([[
Jesse Noller355b1262009-04-02 00:03:28 +00003619#include <unistd.h>
3620#include <fcntl.h>
3621#include <stdio.h>
3622#include <semaphore.h>
3623#include <sys/stat.h>
3624
3625int main(void){
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003626 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
Jesse Noller355b1262009-04-02 00:03:28 +00003627 int count;
3628 int res;
3629 if(a==SEM_FAILED){
3630 perror("sem_open");
3631 return 1;
3632
3633 }
3634 res = sem_getvalue(a, &count);
3635 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003636 sem_unlink("/autocftw");
Jesse Noller355b1262009-04-02 00:03:28 +00003637 return res==-1 ? 1 : 0;
3638}
Matthias Klosec511b472010-05-08 11:01:39 +00003639]])],
3640[ac_cv_broken_sem_getvalue=no],
3641[ac_cv_broken_sem_getvalue=yes],
3642[ac_cv_broken_sem_getvalue=yes])
Jesse Noller355b1262009-04-02 00:03:28 +00003643)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003644AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
3645if test $ac_cv_broken_sem_getvalue = yes
3646then
3647 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
3648 [define to 1 if your sem_getvalue is broken.])
3649fi
Mark Dickinson04b27232009-01-04 12:29:36 +00003650
Mark Dickinsonefc82f72009-03-20 15:51:55 +00003651# determine what size digit to use for Python's longs
3652AC_MSG_CHECKING([digit size for Python's longs])
3653AC_ARG_ENABLE(big-digits,
Matthias Klose22520ea2010-05-08 10:14:46 +00003654AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
Mark Dickinsonefc82f72009-03-20 15:51:55 +00003655[case $enable_big_digits in
3656yes)
3657 enable_big_digits=30 ;;
3658no)
3659 enable_big_digits=15 ;;
3660[15|30])
3661 ;;
3662*)
3663 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3664esac
3665AC_MSG_RESULT($enable_big_digits)
3666AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3667],
3668[AC_MSG_RESULT(no value specified)])
3669
Guido van Rossumef2255b2000-03-10 22:30:29 +00003670# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003671AC_CHECK_HEADER(wchar.h, [
3672 AC_DEFINE(HAVE_WCHAR_H, 1,
3673 [Define if the compiler provides a wchar.h header file.])
3674 wchar_h="yes"
3675],
Guido van Rossumef2255b2000-03-10 22:30:29 +00003676wchar_h="no"
3677)
3678
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003679# determine wchar_t size
3680if test "$wchar_h" = yes
3681then
Guido van Rossum67b26592001-10-20 14:21:45 +00003682 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003683fi
3684
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003685AC_MSG_CHECKING(for UCS-4 tcl)
3686have_ucs4_tcl=no
Matthias Klosec511b472010-05-08 11:01:39 +00003687AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003688#include <tcl.h>
3689#if TCL_UTF_MAX != 6
3690# error "NOT UCS4_TCL"
Matthias Klosec511b472010-05-08 11:01:39 +00003691#endif]], [[]])],[
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003692 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3693 have_ucs4_tcl=yes
Matthias Klosec511b472010-05-08 11:01:39 +00003694],[])
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003695AC_MSG_RESULT($have_ucs4_tcl)
3696
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003697# check whether wchar_t is signed or not
3698if test "$wchar_h" = yes
3699then
3700 # check whether wchar_t is signed or not
3701 AC_MSG_CHECKING(whether wchar_t is signed)
3702 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
Matthias Klosec511b472010-05-08 11:01:39 +00003703 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003704 #include <wchar.h>
3705 int main()
3706 {
Martin v. Löwis44fe0e42006-04-11 07:15:30 +00003707 /* Success: exit code 0 */
3708 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003709 }
Matthias Klosec511b472010-05-08 11:01:39 +00003710 ]])],
3711 [ac_cv_wchar_t_signed=yes],
3712 [ac_cv_wchar_t_signed=no],
3713 [ac_cv_wchar_t_signed=yes])])
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003714 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3715fi
3716
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003717AC_MSG_CHECKING(what type to use for unicode)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003718dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003719AC_ARG_ENABLE(unicode,
Benjamin Peterson66556b02010-05-25 02:23:32 +00003720 AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is ucs2)]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003721 [],
3722 [enable_unicode=yes])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003723
3724if test $enable_unicode = yes
3725then
Martin v. Löwisfd917792001-06-27 20:22:04 +00003726 # Without any arguments, Py_UNICODE defaults to two-byte mode
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003727 case "$have_ucs4_tcl" in
3728 yes) enable_unicode="ucs4"
3729 ;;
3730 *) enable_unicode="ucs2"
3731 ;;
3732 esac
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003733fi
3734
Martin v. Löwis0036cba2002-04-12 09:58:45 +00003735AH_TEMPLATE(Py_UNICODE_SIZE,
3736 [Define as the size of the unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003737case "$enable_unicode" in
3738ucs2) unicode_size="2"
3739 AC_DEFINE(Py_UNICODE_SIZE,2)
3740 ;;
3741ucs4) unicode_size="4"
3742 AC_DEFINE(Py_UNICODE_SIZE,4)
3743 ;;
Ezio Melotti5820efb2010-02-27 00:05:42 +00003744*) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003745esac
3746
Martin v. Löwis11437992002-04-12 09:54:03 +00003747AH_TEMPLATE(PY_UNICODE_TYPE,
3748 [Define as the integral type used for Unicode representation.])
Martin v. Löwis0036cba2002-04-12 09:58:45 +00003749
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003750AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003751if test "$enable_unicode" = "no"
3752then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003753 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003754 AC_MSG_RESULT(not used)
3755else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003756 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003757 AC_DEFINE(Py_USING_UNICODE, 1,
3758 [Define if you want to have a Unicode type.])
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003759
3760 # wchar_t is only usable if it maps to an unsigned type
3761 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
Matthias Klose7dbeed72004-12-24 08:22:17 +00003762 -a "$ac_cv_wchar_t_signed" = "no"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003763 then
3764 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003765 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3766 [Define if you have a useable wchar_t type defined in wchar.h; useable
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003767 means wchar_t must be an unsigned type with at least 16 bits. (see
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003768 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003769 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3770 elif test "$ac_cv_sizeof_short" = "$unicode_size"
3771 then
3772 PY_UNICODE_TYPE="unsigned short"
3773 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3774 elif test "$ac_cv_sizeof_long" = "$unicode_size"
3775 then
3776 PY_UNICODE_TYPE="unsigned long"
3777 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3778 else
3779 PY_UNICODE_TYPE="no type found"
3780 fi
3781 AC_MSG_RESULT($PY_UNICODE_TYPE)
3782fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00003783
3784# check for endianness
3785AC_C_BIGENDIAN
3786
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003787# Check whether right shifting a negative integer extends the sign bit
3788# or fills with zeros (like the Cray J90, according to Tim Peters).
3789AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00003790AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Matthias Klosec511b472010-05-08 11:01:39 +00003791AC_RUN_IFELSE([AC_LANG_SOURCE([[
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003792int main()
3793{
Vladimir Marangozova6180282000-07-12 05:05:06 +00003794 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003795}
Matthias Klosec511b472010-05-08 11:01:39 +00003796]])],
3797[ac_cv_rshift_extends_sign=yes],
3798[ac_cv_rshift_extends_sign=no],
3799[ac_cv_rshift_extends_sign=yes])])
Vladimir Marangozova6180282000-07-12 05:05:06 +00003800AC_MSG_RESULT($ac_cv_rshift_extends_sign)
3801if test "$ac_cv_rshift_extends_sign" = no
3802then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003803 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
3804 [Define if i>>j for signed int i does not extend the sign bit
3805 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00003806fi
3807
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003808# check for getc_unlocked and related locking functions
3809AC_MSG_CHECKING(for getc_unlocked() and friends)
3810AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
Matthias Klosec511b472010-05-08 11:01:39 +00003811AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003812 FILE *f = fopen("/dev/null", "r");
3813 flockfile(f);
3814 getc_unlocked(f);
3815 funlockfile(f);
Matthias Klosec511b472010-05-08 11:01:39 +00003816]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003817AC_MSG_RESULT($ac_cv_have_getc_unlocked)
3818if test "$ac_cv_have_getc_unlocked" = yes
3819then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003820 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
3821 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003822fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003823
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00003824# check where readline lives
Martin v. Löwis82bca632006-02-10 20:49:30 +00003825# save the value of LIBS so we don't actually link Python with readline
3826LIBS_no_readline=$LIBS
Gregory P. Smith980b99b2008-09-07 05:15:18 +00003827
3828# On some systems we need to link readline to a termcap compatible
3829# library. NOTE: Keep the precedence of listed libraries synchronised
3830# with setup.py.
3831py_cv_lib_readline=no
3832AC_MSG_CHECKING([how to link readline libs])
3833for py_libtermcap in "" ncursesw ncurses curses termcap; do
3834 if test -z "$py_libtermcap"; then
3835 READLINE_LIBS="-lreadline"
3836 else
3837 READLINE_LIBS="-lreadline -l$py_libtermcap"
3838 fi
3839 LIBS="$READLINE_LIBS $LIBS_no_readline"
3840 AC_LINK_IFELSE(
3841 [AC_LANG_CALL([],[readline])],
3842 [py_cv_lib_readline=yes])
3843 if test $py_cv_lib_readline = yes; then
3844 break
3845 fi
3846done
3847# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3848#AC_SUBST([READLINE_LIBS])
Gregory P. Smith29ec7502008-09-07 19:18:16 +00003849if test $py_cv_lib_readline = no; then
Gregory P. Smith980b99b2008-09-07 05:15:18 +00003850 AC_MSG_RESULT([none])
3851else
3852 AC_MSG_RESULT([$READLINE_LIBS])
3853 AC_DEFINE(HAVE_LIBREADLINE, 1,
3854 [Define if you have the readline library (-lreadline).])
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00003855fi
3856
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003857# check for readline 2.1
3858AC_CHECK_LIB(readline, rl_callback_handler_install,
3859 AC_DEFINE(HAVE_RL_CALLBACK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003860 [Define if you have readline 2.1]), ,$READLINE_LIBS)
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003861
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003862# check for readline 2.2
Matthias Klosec511b472010-05-08 11:01:39 +00003863AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
3864 [have_readline=yes],
3865 [have_readline=no]
3866)
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003867if test $have_readline = yes
3868then
3869 AC_EGREP_HEADER([extern int rl_completion_append_character;],
3870 [readline/readline.h],
3871 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
3872 [Define if you have readline 2.2]), )
Antoine Pitroud9ff74e2009-10-26 19:16:46 +00003873 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
3874 [readline/readline.h],
3875 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
3876 [Define if you have rl_completion_suppress_append]), )
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003877fi
3878
Martin v. Löwis0daad592001-09-30 21:09:59 +00003879# check for readline 4.0
3880AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003881 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003882 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis0daad592001-09-30 21:09:59 +00003883
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00003884# also in 4.0
3885AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
3886 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003887 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00003888
Guido van Rossum353ae582001-07-10 16:45:32 +00003889# check for readline 4.2
3890AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003891 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003892 [Define if you have readline 4.2]), ,$READLINE_LIBS)
Guido van Rossum353ae582001-07-10 16:45:32 +00003893
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003894# also in readline 4.2
Matthias Klosec511b472010-05-08 11:01:39 +00003895AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
3896 [have_readline=yes],
3897 [have_readline=no]
3898)
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003899if test $have_readline = yes
3900then
3901 AC_EGREP_HEADER([extern int rl_catch_signals;],
3902 [readline/readline.h],
3903 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3904 [Define if you can turn off readline's signal handling.]), )
3905fi
3906
Martin v. Löwis82bca632006-02-10 20:49:30 +00003907# End of readline checks: restore LIBS
3908LIBS=$LIBS_no_readline
3909
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003910AC_MSG_CHECKING(for broken nice())
3911AC_CACHE_VAL(ac_cv_broken_nice, [
Matthias Klosec511b472010-05-08 11:01:39 +00003912AC_RUN_IFELSE([AC_LANG_SOURCE([[
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003913int main()
3914{
3915 int val1 = nice(1);
3916 if (val1 != -1 && val1 == nice(2))
3917 exit(0);
3918 exit(1);
3919}
Matthias Klosec511b472010-05-08 11:01:39 +00003920]])],
3921[ac_cv_broken_nice=yes],
3922[ac_cv_broken_nice=no],
3923[ac_cv_broken_nice=no])])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003924AC_MSG_RESULT($ac_cv_broken_nice)
3925if test "$ac_cv_broken_nice" = yes
3926then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003927 AC_DEFINE(HAVE_BROKEN_NICE, 1,
3928 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003929fi
3930
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003931AC_MSG_CHECKING(for broken poll())
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003932AC_CACHE_VAL(ac_cv_broken_poll,
Matthias Klosec511b472010-05-08 11:01:39 +00003933AC_RUN_IFELSE([AC_LANG_SOURCE([[
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003934#include <poll.h>
3935
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003936int main()
3937{
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003938 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003939 int poll_test;
3940
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003941 close (42);
3942
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003943 poll_test = poll(&poll_struct, 1, 0);
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003944 if (poll_test < 0)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003945 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003946 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003947 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003948 else
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003949 return 1;
3950}
Matthias Klosec511b472010-05-08 11:01:39 +00003951]])],
3952[ac_cv_broken_poll=yes],
3953[ac_cv_broken_poll=no],
3954[ac_cv_broken_poll=no]))
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003955AC_MSG_RESULT($ac_cv_broken_poll)
3956if test "$ac_cv_broken_poll" = yes
3957then
3958 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3959 [Define if poll() sets errno on invalid file descriptors.])
3960fi
3961
Brett Cannon43802422005-02-10 20:48:03 +00003962# Before we can test tzset, we need to check if struct tm has a tm_zone
3963# (which is not required by ISO C or UNIX spec) and/or if we support
3964# tzname[]
3965AC_STRUCT_TIMEZONE
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003966
Brett Cannon43802422005-02-10 20:48:03 +00003967# check tzset(3) exists and works like we expect it to
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003968AC_MSG_CHECKING(for working tzset())
3969AC_CACHE_VAL(ac_cv_working_tzset, [
Matthias Klosec511b472010-05-08 11:01:39 +00003970AC_RUN_IFELSE([AC_LANG_SOURCE([[
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003971#include <stdlib.h>
3972#include <time.h>
Brett Cannon18367812003-09-19 00:59:16 +00003973#include <string.h>
Brett Cannon43802422005-02-10 20:48:03 +00003974
3975#if HAVE_TZNAME
3976extern char *tzname[];
3977#endif
3978
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003979int main()
3980{
Brett Cannon18367812003-09-19 00:59:16 +00003981 /* Note that we need to ensure that not only does tzset(3)
3982 do 'something' with localtime, but it works as documented
3983 in the library reference and as expected by the test suite.
Brett Cannon43802422005-02-10 20:48:03 +00003984 This includes making sure that tzname is set properly if
3985 tm->tm_zone does not exist since it is the alternative way
3986 of getting timezone info.
Brett Cannon18367812003-09-19 00:59:16 +00003987
3988 Red Hat 6.2 doesn't understand the southern hemisphere
Brett Cannon43802422005-02-10 20:48:03 +00003989 after New Year's Day.
Brett Cannon18367812003-09-19 00:59:16 +00003990 */
3991
Brett Cannon43802422005-02-10 20:48:03 +00003992 time_t groundhogday = 1044144000; /* GMT-based */
Brett Cannon18367812003-09-19 00:59:16 +00003993 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3994
Neal Norwitz7f2588c2003-04-11 15:35:53 +00003995 putenv("TZ=UTC+0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003996 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00003997 if (localtime(&groundhogday)->tm_hour != 0)
3998 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003999#if HAVE_TZNAME
4000 /* For UTC, tzname[1] is sometimes "", sometimes " " */
4001 if (strcmp(tzname[0], "UTC") ||
4002 (tzname[1][0] != 0 && tzname[1][0] != ' '))
4003 exit(1);
4004#endif
Brett Cannon18367812003-09-19 00:59:16 +00004005
Neal Norwitz7f2588c2003-04-11 15:35:53 +00004006 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004007 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00004008 if (localtime(&groundhogday)->tm_hour != 19)
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004009 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004010#if HAVE_TZNAME
4011 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
4012 exit(1);
4013#endif
Brett Cannon18367812003-09-19 00:59:16 +00004014
4015 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
4016 tzset();
4017 if (localtime(&groundhogday)->tm_hour != 11)
4018 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004019#if HAVE_TZNAME
4020 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
4021 exit(1);
4022#endif
4023
4024#if HAVE_STRUCT_TM_TM_ZONE
Brett Cannon18367812003-09-19 00:59:16 +00004025 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
4026 exit(1);
4027 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
4028 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004029#endif
Brett Cannon18367812003-09-19 00:59:16 +00004030
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004031 exit(0);
4032}
Matthias Klosec511b472010-05-08 11:01:39 +00004033]])],
4034[ac_cv_working_tzset=yes],
4035[ac_cv_working_tzset=no],
4036[ac_cv_working_tzset=no])])
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004037AC_MSG_RESULT($ac_cv_working_tzset)
4038if test "$ac_cv_working_tzset" = yes
4039then
4040 AC_DEFINE(HAVE_WORKING_TZSET, 1,
4041 [Define if tzset() actually switches the local timezone in a meaningful way.])
4042fi
4043
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004044# Look for subsecond timestamps in struct stat
4045AC_MSG_CHECKING(for tv_nsec in struct stat)
4046AC_CACHE_VAL(ac_cv_stat_tv_nsec,
Matthias Klosec511b472010-05-08 11:01:39 +00004047AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004048struct stat st;
4049st.st_mtim.tv_nsec = 1;
Matthias Klosec511b472010-05-08 11:01:39 +00004050]])],
4051[ac_cv_stat_tv_nsec=yes],
4052[ac_cv_stat_tv_nsec=no]))
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004053AC_MSG_RESULT($ac_cv_stat_tv_nsec)
4054if test "$ac_cv_stat_tv_nsec" = yes
4055then
4056 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
4057 [Define if you have struct stat.st_mtim.tv_nsec])
4058fi
4059
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004060# Look for BSD style subsecond timestamps in struct stat
4061AC_MSG_CHECKING(for tv_nsec2 in struct stat)
4062AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
Matthias Klosec511b472010-05-08 11:01:39 +00004063AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004064struct stat st;
4065st.st_mtimespec.tv_nsec = 1;
Matthias Klosec511b472010-05-08 11:01:39 +00004066]])],
4067[ac_cv_stat_tv_nsec2=yes],
4068[ac_cv_stat_tv_nsec2=no]))
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004069AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
4070if test "$ac_cv_stat_tv_nsec2" = yes
4071then
4072 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
4073 [Define if you have struct stat.st_mtimensec])
4074fi
4075
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004076# On HP/UX 11.0, mvwdelch is a block with a return statement
4077AC_MSG_CHECKING(whether mvwdelch is an expression)
4078AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
Matthias Klosec511b472010-05-08 11:01:39 +00004079AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004080 int rtn;
4081 rtn = mvwdelch(0,0,0);
Matthias Klosec511b472010-05-08 11:01:39 +00004082]])],
4083[ac_cv_mvwdelch_is_expression=yes],
4084[ac_cv_mvwdelch_is_expression=no]))
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004085AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
4086
4087if test "$ac_cv_mvwdelch_is_expression" = yes
4088then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004089 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
4090 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004091fi
4092
4093AC_MSG_CHECKING(whether WINDOW has _flags)
4094AC_CACHE_VAL(ac_cv_window_has_flags,
Matthias Klosec511b472010-05-08 11:01:39 +00004095AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004096 WINDOW *w;
4097 w->_flags = 0;
Matthias Klosec511b472010-05-08 11:01:39 +00004098]])],
4099[ac_cv_window_has_flags=yes],
4100[ac_cv_window_has_flags=no]))
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004101AC_MSG_RESULT($ac_cv_window_has_flags)
4102
4103
4104if test "$ac_cv_window_has_flags" = yes
4105then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004106 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
4107 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004108fi
4109
Walter Dörwald4994d952006-06-19 08:07:50 +00004110AC_MSG_CHECKING(for is_term_resized)
Matthias Klosec511b472010-05-08 11:01:39 +00004111AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])],
4112 [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
4113 AC_MSG_RESULT(yes)],
4114 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004115)
4116
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004117AC_MSG_CHECKING(for resize_term)
Matthias Klosec511b472010-05-08 11:01:39 +00004118AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])],
4119 [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
4120 AC_MSG_RESULT(yes)],
4121 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004122)
4123
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004124AC_MSG_CHECKING(for resizeterm)
Matthias Klosec511b472010-05-08 11:01:39 +00004125AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])],
4126 [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
4127 AC_MSG_RESULT(yes)],
4128 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004129)
4130
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004131AC_MSG_CHECKING(for /dev/ptmx)
4132
4133if test -r /dev/ptmx
4134then
4135 AC_MSG_RESULT(yes)
4136 AC_DEFINE(HAVE_DEV_PTMX, 1,
4137 [Define if we have /dev/ptmx.])
4138else
4139 AC_MSG_RESULT(no)
4140fi
4141
4142AC_MSG_CHECKING(for /dev/ptc)
4143
4144if test -r /dev/ptc
4145then
4146 AC_MSG_RESULT(yes)
4147 AC_DEFINE(HAVE_DEV_PTC, 1,
4148 [Define if we have /dev/ptc.])
4149else
4150 AC_MSG_RESULT(no)
4151fi
Neal Norwitz865400f2003-03-21 01:42:58 +00004152
Mark Dickinson82864d12009-11-15 16:18:58 +00004153if test "$have_long_long" = yes
4154then
4155 AC_MSG_CHECKING(for %lld and %llu printf() format support)
4156 AC_CACHE_VAL(ac_cv_have_long_long_format,
Matthias Klosec511b472010-05-08 11:01:39 +00004157 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
Mark Dickinson82864d12009-11-15 16:18:58 +00004158 #include <stdio.h>
4159 #include <stddef.h>
4160 #include <string.h>
4161
4162 #ifdef HAVE_SYS_TYPES_H
4163 #include <sys/types.h>
4164 #endif
4165
4166 int main()
4167 {
4168 char buffer[256];
4169
4170 if (sprintf(buffer, "%lld", (long long)123) < 0)
4171 return 1;
4172 if (strcmp(buffer, "123"))
4173 return 1;
4174
4175 if (sprintf(buffer, "%lld", (long long)-123) < 0)
4176 return 1;
4177 if (strcmp(buffer, "-123"))
4178 return 1;
4179
4180 if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
4181 return 1;
4182 if (strcmp(buffer, "123"))
4183 return 1;
4184
4185 return 0;
4186 }
Matthias Klosec511b472010-05-08 11:01:39 +00004187 ]]])],
4188 [ac_cv_have_long_long_format=yes],
4189 [ac_cv_have_long_long_format=no],
4190 [ac_cv_have_long_long_format=no])
Mark Dickinson82864d12009-11-15 16:18:58 +00004191 )
4192 AC_MSG_RESULT($ac_cv_have_long_long_format)
4193fi
4194
Mark Dickinson5ce84742009-12-31 20:48:04 +00004195if test "$ac_cv_have_long_long_format" = yes
Mark Dickinson82864d12009-11-15 16:18:58 +00004196then
4197 AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
4198 [Define to printf format modifier for long long type])
4199fi
4200
Ronald Oussoren315cd0c2009-11-19 16:25:21 +00004201if test $ac_sys_system = Darwin
4202then
4203 LIBS="$LIBS -framework CoreFoundation"
4204fi
4205
Mark Dickinson82864d12009-11-15 16:18:58 +00004206
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004207AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
Matthias Klosec511b472010-05-08 11:01:39 +00004208AC_RUN_IFELSE([AC_LANG_SOURCE([[
Alexandre Vassalottie7cf1182009-07-17 06:33:51 +00004209#include <stdio.h>
Brett Cannon09d12362006-05-11 05:11:33 +00004210#include <stddef.h>
4211#include <string.h>
4212
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004213#ifdef HAVE_SYS_TYPES_H
4214#include <sys/types.h>
4215#endif
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004216
4217#ifdef HAVE_SSIZE_T
4218typedef ssize_t Py_ssize_t;
4219#elif SIZEOF_VOID_P == SIZEOF_LONG
4220typedef long Py_ssize_t;
4221#else
4222typedef int Py_ssize_t;
4223#endif
Brett Cannon09d12362006-05-11 05:11:33 +00004224
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004225int main()
4226{
4227 char buffer[256];
4228
Brett Cannon09d12362006-05-11 05:11:33 +00004229 if(sprintf(buffer, "%zd", (size_t)123) < 0)
4230 return 1;
4231
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004232 if (strcmp(buffer, "123"))
Brett Cannon09d12362006-05-11 05:11:33 +00004233 return 1;
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004234
4235 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
4236 return 1;
4237
4238 if (strcmp(buffer, "-123"))
4239 return 1;
4240
Brett Cannon09d12362006-05-11 05:11:33 +00004241 return 0;
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004242}
Matthias Klosec511b472010-05-08 11:01:39 +00004243]])],
4244[ac_cv_have_size_t_format=yes],
4245[ac_cv_have_size_t_format=no],
4246[ac_cv_have_size_t_format="cross -- assuming yes"
4247])])
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004248if test "$ac_cv_have_size_t_format" != no ; then
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004249 AC_DEFINE(PY_FORMAT_SIZE_T, "z",
4250 [Define to printf format modifier for Py_ssize_t])
4251fi
Brett Cannon09d12362006-05-11 05:11:33 +00004252
Martin v. Löwis01c04012002-11-11 14:58:44 +00004253AC_CHECK_TYPE(socklen_t,,
4254 AC_DEFINE(socklen_t,int,
Matthias Klose5183ebd2010-04-24 16:38:36 +00004255 [Define to `int' if <sys/socket.h> does not define.]),[
Martin v. Löwis01c04012002-11-11 14:58:44 +00004256#ifdef HAVE_SYS_TYPES_H
4257#include <sys/types.h>
4258#endif
Guido van Rossum95713eb2000-05-18 20:53:31 +00004259#ifdef HAVE_SYS_SOCKET_H
4260#include <sys/socket.h>
4261#endif
Martin v. Löwis01c04012002-11-11 14:58:44 +00004262])
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004263
R. David Murray1d9d16e2010-10-16 00:43:13 +00004264case $ac_sys_system in
4265AIX*)
4266 AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;;
4267esac
4268
4269
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00004270AC_SUBST(THREADHEADERS)
4271
4272for h in `(cd $srcdir;echo Python/thread_*.h)`
4273do
4274 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4275done
4276
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004277AC_SUBST(SRCDIRS)
Neal Norwitzd24499d2005-12-18 21:36:39 +00004278SRCDIRS="Parser Grammar Objects Python Modules Mac"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00004279AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004280for dir in $SRCDIRS; do
4281 if test ! -d $dir; then
4282 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00004283 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004284done
4285AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00004286
Guido van Rossum627b2d71993-12-24 10:39:16 +00004287# generate output files
Antoine Pitrouf2caeed2009-05-24 20:23:57 +00004288AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
Antoine Pitrouaabdceb2010-09-10 20:03:17 +00004289AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
Martin v. Löwis88afe662002-10-26 13:47:44 +00004290AC_OUTPUT
Neil Schemenauer61c51152001-01-26 16:18:16 +00004291
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004292echo "creating Modules/Setup"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004293if test ! -f Modules/Setup
4294then
4295 cp $srcdir/Modules/Setup.dist Modules/Setup
4296fi
4297
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004298echo "creating Modules/Setup.local"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004299if test ! -f Modules/Setup.local
4300then
4301 echo "# Edit this file for local setup changes" >Modules/Setup.local
4302fi
4303
4304echo "creating Makefile"
4305$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4306 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00004307 Modules/Setup.local Modules/Setup
Skip Montanaro7221d932007-08-22 19:02:16 +00004308
4309case $ac_sys_system in
4310BeOS)
4311 AC_MSG_WARN([
4312
4313 Support for BeOS is deprecated as of Python 2.6.
4314 See PEP 11 for the gory details.
4315 ])
4316 ;;
4317*) ;;
4318esac
4319
Neil Schemenauer66252162001-02-19 04:47:42 +00004320mv config.c Modules