blob: a13b44acc8db3dabce359beabcb5b234667a88f8 [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öwisa9d71422003-03-28 18:43:31 +0000345 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
346 # of union __?sigval. Reported by Stuart Bishop.
347 SunOS/5.6)
348 define_xopen_source=no;;
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000349 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
350 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
Martin v. Löwis253d1f42004-05-07 19:14:14 +0000351 # Reconfirmed for 7.1.4 by Martin v. Loewis.
352 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000353 define_xopen_source=no;;
354 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000355 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000356 SCO_SV/3.2)
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000357 define_xopen_source=no;;
Martin v. Löwisbb86d832008-11-04 20:40:09 +0000358 # On FreeBSD 4, the math functions C89 does not cover are never defined
359 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
360 FreeBSD/4.*)
361 define_xopen_source=no;;
362 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
363 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
364 # identifies itself as Darwin/7.*
365 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
366 # disables platform specific features beyond repair.
367 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
368 # has no effect, don't bother defining them
369 Darwin/@<:@6789@:>@.*)
Anthony Baxter6169c6b2003-10-04 07:46:23 +0000370 define_xopen_source=no;;
Ronald Oussorena55af9a2010-01-17 16:25:57 +0000371 Darwin/1@<:@0-9@:>@.*)
372 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000373 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
374 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
375 # or has another value. By not (re)defining it, the defaults come in place.
Martin v. Löwisc19c5a62003-11-18 20:00:44 +0000376 AIX/4)
377 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000378 AIX/5)
379 if test `uname -r` -eq 1; then
380 define_xopen_source=no
381 fi
382 ;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000383 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
384 # defining NI_NUMERICHOST.
385 QNX/6.3.2)
386 define_xopen_source=no
387 ;;
Martin v. Löwisa0588362006-04-04 06:03:50 +0000388
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000389esac
390
391if test $define_xopen_source = yes
392then
Skip Montanarof0d5f792004-08-15 14:08:23 +0000393 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
394 # defined precisely as g++ defines it
Martin v. Löwis7dece662005-11-26 11:38:24 +0000395 # Furthermore, on Solaris 10, XPG6 requires the use of a C99
396 # compiler
Skip Montanarof0d5f792004-08-15 14:08:23 +0000397 case $ac_sys_system/$ac_sys_release in
Martin v. Löwis7dece662005-11-26 11:38:24 +0000398 SunOS/5.8|SunOS/5.9|SunOS/5.10)
Skip Montanarof0d5f792004-08-15 14:08:23 +0000399 AC_DEFINE(_XOPEN_SOURCE, 500,
400 Define to the level of X/Open that your system supports)
401 ;;
402 *)
403 AC_DEFINE(_XOPEN_SOURCE, 600,
404 Define to the level of X/Open that your system supports)
405 ;;
406 esac
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000407
408 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
409 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
410 # several APIs are not declared. Since this is also needed in some
411 # cases for HP-UX, we define it globally.
Martin v. Löwis7dece662005-11-26 11:38:24 +0000412 # except for Solaris 10, where it must not be defined,
413 # as it implies XPG4.2
414 case $ac_sys_system/$ac_sys_release in
415 SunOS/5.10)
416 ;;
417 *)
418 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
419 Define to activate Unix95-and-earlier features)
420 ;;
421 esac
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000422
Bob Ippolito7026a0a2005-03-28 23:23:47 +0000423 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
424
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000425fi
426
Guido van Rossum91922671997-10-09 20:24:13 +0000427#
428# SGI compilers allow the specification of the both the ABI and the
429# ISA on the command line. Depending on the values of these switches,
430# different and often incompatable code will be generated.
431#
432# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
433# thus supply support for various ABI/ISA combinations. The MACHDEP
434# variable is also adjusted.
435#
436AC_SUBST(SGI_ABI)
437if test ! -z "$SGI_ABI"
438then
439 CC="cc $SGI_ABI"
440 LDFLAGS="$SGI_ABI $LDFLAGS"
441 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
442fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000443AC_MSG_RESULT($MACHDEP)
444
Jack Jansen83f898c2002-12-30 22:23:40 +0000445# And add extra plat-mac for darwin
446AC_SUBST(EXTRAPLATDIR)
Jack Jansen7b59b422003-03-17 15:44:10 +0000447AC_SUBST(EXTRAMACHDEPPATH)
Jack Jansen83f898c2002-12-30 22:23:40 +0000448AC_MSG_CHECKING(EXTRAPLATDIR)
449if test -z "$EXTRAPLATDIR"
450then
451 case $MACHDEP in
Jack Jansen7b59b422003-03-17 15:44:10 +0000452 darwin)
453 EXTRAPLATDIR="\$(PLATMACDIRS)"
454 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
455 ;;
456 *)
457 EXTRAPLATDIR=""
458 EXTRAMACHDEPPATH=""
459 ;;
Jack Jansen83f898c2002-12-30 22:23:40 +0000460 esac
461fi
462AC_MSG_RESULT($EXTRAPLATDIR)
463
Jack Jansen6b08a402004-06-03 12:41:45 +0000464# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
465# it may influence the way we can build extensions, so distutils
466# needs to check it
467AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
Ronald Oussoren988117f2006-04-29 11:31:35 +0000468AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
Jack Jansen6b08a402004-06-03 12:41:45 +0000469CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
Ronald Oussoren988117f2006-04-29 11:31:35 +0000470EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
Jack Jansen6b08a402004-06-03 12:41:45 +0000471
Mark Dickinson65134662008-04-25 16:11:04 +0000472AC_MSG_CHECKING(machine type as reported by uname -m)
473ac_sys_machine=`uname -m`
474AC_MSG_RESULT($ac_sys_machine)
475
Guido van Rossum627b2d71993-12-24 10:39:16 +0000476# checks for alternative programs
Skip Montanarodecc6a42003-01-01 20:07:49 +0000477
478# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
479# for debug/optimization stuff. BASECFLAGS is for flags that are required
480# just to get things to compile and link. Users are free to override OPT
481# when running configure or make. The build should not break if they do.
482# BASECFLAGS should generally not be messed with, however.
483
484# XXX shouldn't some/most/all of this code be merged with the stuff later
485# on that fiddles with OPT and BASECFLAGS?
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000486AC_MSG_CHECKING(for --without-gcc)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000487AC_ARG_WITH(gcc,
Matthias Klose22520ea2010-05-08 10:14:46 +0000488 AS_HELP_STRING([--without-gcc], [never use gcc]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000489[
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000490 case $withval in
Skip Montanaro516144f2009-01-04 10:36:58 +0000491 no) CC=${CC:-cc}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000492 without_gcc=yes;;
493 yes) CC=gcc
494 without_gcc=no;;
495 *) CC=$withval
496 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000497 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000498 case $ac_sys_system in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000499 AIX*) CC=cc_r
500 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000501 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000502 case $BE_HOST_CPU in
503 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000504 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000505 without_gcc=yes
Skip Montanarodecc6a42003-01-01 20:07:49 +0000506 BASECFLAGS="$BASECFLAGS -export pragma"
507 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000508 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000509 ;;
510 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000511 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000512 without_gcc=no
Skip Montanarodecc6a42003-01-01 20:07:49 +0000513 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000514 ;;
515 *)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000516 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000517 ;;
518 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000519 AR="\$(srcdir)/Modules/ar_beos"
520 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000521 ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000522 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000523 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000524AC_MSG_RESULT($without_gcc)
525
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000526# If the user switches compilers, we can't believe the cache
527if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
528then
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000529 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
530(it is also a good idea to do 'make clean' before compiling)])
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000531fi
532
Marc-André Lemburg6d5e5792010-04-30 17:20:14 +0000533# If the user set CFLAGS, use this instead of the automatically
534# determined setting
535preset_cflags="$CFLAGS"
Guido van Rossum627b2d71993-12-24 10:39:16 +0000536AC_PROG_CC
Marc-André Lemburg6d5e5792010-04-30 17:20:14 +0000537if test ! -z "$preset_cflags"
538then
539 CFLAGS=$preset_cflags
540fi
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000541
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000542AC_SUBST(CXX)
543AC_SUBST(MAINCC)
544AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
545AC_ARG_WITH(cxx_main,
Matthias Klose22520ea2010-05-08 10:14:46 +0000546 AS_HELP_STRING([--with-cxx-main=<compiler>],
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000547 [compile main() and link python executable with C++ compiler]),
548[
549
550 case $withval in
551 no) with_cxx_main=no
552 MAINCC='$(CC)';;
553 yes) with_cxx_main=yes
554 MAINCC='$(CXX)';;
555 *) with_cxx_main=yes
556 MAINCC=$withval
557 if test -z "$CXX"
558 then
559 CXX=$withval
560 fi;;
561 esac], [
562 with_cxx_main=no
563 MAINCC='$(CC)'
564])
565AC_MSG_RESULT($with_cxx_main)
566
567preset_cxx="$CXX"
568if test -z "$CXX"
569then
570 case "$CC" in
571 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
572 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
573 esac
574 if test "$CXX" = "notfound"
575 then
576 CXX=""
577 fi
578fi
579if test -z "$CXX"
580then
581 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
582 if test "$CXX" = "notfound"
583 then
584 CXX=""
585 fi
586fi
587if test "$preset_cxx" != "$CXX"
588then
589 AC_MSG_WARN([
590
591 By default, distutils will build C++ extension modules with "$CXX".
592 If this is not intended, then set CXX on the configure command line.
593 ])
594fi
595
596
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000597# checks for UNIX variants that set C preprocessor variables
Matthias Klose9f8e0c12010-05-08 10:17:27 +0000598AC_USE_SYSTEM_EXTENSIONS
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000599
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000600# Check for unsupported systems
601case $ac_sys_system/$ac_sys_release in
Brett Cannon19fab762007-06-02 03:02:29 +0000602atheos*|Linux*/1*)
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000603 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
604 echo See README for details.
605 exit 1;;
606esac
607
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000608AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000609AC_MSG_CHECKING(for --with-suffix)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000610AC_ARG_WITH(suffix,
Matthias Klose22520ea2010-05-08 10:14:46 +0000611 AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000612[
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000613 case $withval in
614 no) EXEEXT=;;
615 yes) EXEEXT=.exe;;
616 *) EXEEXT=$withval;;
617 esac])
618AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000619
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000620# Test whether we're running on a non-case-sensitive system, in which
621# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000622AC_SUBST(BUILDEXEEXT)
623AC_MSG_CHECKING(for case-insensitive build directory)
Jack Jansen3c2c4332002-11-06 13:33:32 +0000624if test ! -d CaseSensitiveTestDir; then
625mkdir CaseSensitiveTestDir
626fi
627
628if test -d casesensitivetestdir
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000629then
Jack Jansen1999ef42001-12-06 21:47:20 +0000630 AC_MSG_RESULT(yes)
631 BUILDEXEEXT=.exe
632else
633 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000634 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000635fi
Jack Jansen3c2c4332002-11-06 13:33:32 +0000636rmdir CaseSensitiveTestDir
Guido van Rossumfb842551997-08-06 23:42:07 +0000637
Guido van Rossumdd997f71998-10-07 19:58:26 +0000638case $MACHDEP in
639bsdos*)
640 case $CC in
641 gcc) CC="$CC -D_HAVE_BSDI";;
642 esac;;
643esac
644
Guido van Rossum84561611997-08-21 00:08:11 +0000645case $ac_sys_system in
646hp*|HP*)
647 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000648 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000649 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000650SunOS*)
651 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000652 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000653 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000654esac
655
Martin v. Löwise8964d42001-03-06 12:09:07 +0000656
Neil Schemenauer61c51152001-01-26 16:18:16 +0000657AC_SUBST(LIBRARY)
658AC_MSG_CHECKING(LIBRARY)
659if test -z "$LIBRARY"
660then
661 LIBRARY='libpython$(VERSION).a'
662fi
663AC_MSG_RESULT($LIBRARY)
664
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000665# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000666# name of the library into which to insert object files). BLDLIBRARY is also
667# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
668# is blank as the main program is not linked directly against LDLIBRARY.
669# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
670# systems without shared libraries, LDLIBRARY is the same as LIBRARY
671# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
672# DLLLIBRARY is the shared (i.e., DLL) library.
673#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000674# RUNSHARED is used to run shared python without installed libraries
675#
676# INSTSONAME is the name of the shared library that will be use to install
677# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000678AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000679AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000680AC_SUBST(BLDLIBRARY)
681AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000682AC_SUBST(INSTSONAME)
683AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000684LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000685BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis09bdf722002-05-08 08:51:29 +0000686INSTSONAME='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000687DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000688LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000689RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000690
Guido van Rossumfb842551997-08-06 23:42:07 +0000691# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000692# If CXX is set, and if it is needed to link a main function that was
693# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
694# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000695# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000696# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000697AC_SUBST(LINKCC)
698AC_MSG_CHECKING(LINKCC)
699if test -z "$LINKCC"
700then
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000701 LINKCC='$(PURIFY) $(MAINCC)'
Guido van Rossumfb842551997-08-06 23:42:07 +0000702 case $ac_sys_system in
703 AIX*)
Neal Norwitz0b27ff92003-03-31 15:53:49 +0000704 exp_extra="\"\""
705 if test $ac_sys_release -ge 5 -o \
706 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
707 exp_extra="."
708 fi
709 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000710 QNX*)
711 # qcc must be used because the other compilers do not
712 # support -N.
713 LINKCC=qcc;;
Guido van Rossumfb842551997-08-06 23:42:07 +0000714 esac
715fi
716AC_MSG_RESULT($LINKCC)
717
Tarek Ziadée2be83d2009-05-09 08:28:53 +0000718# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
719# make sure we default having it set to "no": this is used by
720# distutils.unixccompiler to know if it should add --enable-new-dtags
721# to linker command lines, and failing to detect GNU ld simply results
722# in the same bahaviour as before.
723AC_SUBST(GNULD)
724AC_MSG_CHECKING(for GNU ld)
725ac_prog=ld
726if test "$GCC" = yes; then
727 ac_prog=`$CC -print-prog-name=ld`
728fi
729case `"$ac_prog" -V 2>&1 < /dev/null` in
730 *GNU*)
731 GNULD=yes;;
732 *)
733 GNULD=no;;
734esac
735AC_MSG_RESULT($GNULD)
736
Martin v. Löwis1142de32002-03-29 16:28:31 +0000737AC_MSG_CHECKING(for --enable-shared)
738AC_ARG_ENABLE(shared,
Matthias Klose22520ea2010-05-08 10:14:46 +0000739 AS_HELP_STRING([--enable-shared], [disable/enable building shared python library]))
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000740
Martin v. Löwis1142de32002-03-29 16:28:31 +0000741if test -z "$enable_shared"
742then
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000743 case $ac_sys_system in
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000744 CYGWIN* | atheos*)
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000745 enable_shared="yes";;
746 *)
747 enable_shared="no";;
748 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000749fi
750AC_MSG_RESULT($enable_shared)
751
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000752AC_MSG_CHECKING(for --enable-profiling)
753AC_ARG_ENABLE(profiling,
Matthias Klose22520ea2010-05-08 10:14:46 +0000754 AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]),
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000755[ac_save_cc="$CC"
756 CC="$CC -pg"
Matthias Klosec511b472010-05-08 11:01:39 +0000757 AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
758 [ac_enable_profiling="yes"],
759 [ac_enable_profiling="no"],
760 [ac_enable_profiling="no"])
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000761 CC="$ac_save_cc"])
762AC_MSG_RESULT($ac_enable_profiling)
763
764case "$ac_enable_profiling" in
765 "yes")
766 BASECFLAGS="-pg $BASECFLAGS"
767 LDFLAGS="-pg $LDFLAGS"
768 ;;
769esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000770
771AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000772
Guido van Rossumb8552162001-09-05 14:58:11 +0000773# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
774# library that we build, but we do not want to link against it (we
775# will find it with a -framework option). For this reason there is an
776# extra variable BLDLIBRARY against which Python and the extension
777# modules are linked, BLDLIBRARY. This is normally the same as
778# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000779if test "$enable_framework"
780then
781 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen66b84832003-07-04 12:14:39 +0000782 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000783 BLDLIBRARY=''
784else
785 BLDLIBRARY='$(LDLIBRARY)'
786fi
787
Martin v. Löwis1142de32002-03-29 16:28:31 +0000788# Other platforms follow
789if test $enable_shared = "yes"; then
Mark Hammond8235ea12002-07-19 06:55:41 +0000790 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
Martin v. Löwis1142de32002-03-29 16:28:31 +0000791 case $ac_sys_system in
792 BeOS*)
793 LDLIBRARY='libpython$(VERSION).so'
794 ;;
795 CYGWIN*)
796 LDLIBRARY='libpython$(VERSION).dll.a'
797 DLLLIBRARY='libpython$(VERSION).dll'
798 ;;
799 SunOS*)
800 LDLIBRARY='libpython$(VERSION).so'
Martin v. Löwisd141a8c2003-06-14 15:20:28 +0000801 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000802 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Martin v. Löwis2389c412003-10-31 15:42:07 +0000803 INSTSONAME="$LDLIBRARY".$SOVERSION
Martin v. Löwis1142de32002-03-29 16:28:31 +0000804 ;;
Martin v. Löwis86d66262006-02-17 08:40:11 +0000805 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000806 LDLIBRARY='libpython$(VERSION).so'
807 BLDLIBRARY='-L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000808 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Hye-Shik Chang33761492004-10-26 09:53:46 +0000809 case $ac_sys_system in
810 FreeBSD*)
811 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
812 ;;
813 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000814 INSTSONAME="$LDLIBRARY".$SOVERSION
815 ;;
816 hp*|HP*)
Neal Norwitz58e28882006-05-19 07:00:58 +0000817 case `uname -m` in
818 ia64)
819 LDLIBRARY='libpython$(VERSION).so'
820 ;;
821 *)
822 LDLIBRARY='libpython$(VERSION).sl'
823 ;;
824 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000825 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000826 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000827 ;;
828 OSF*)
829 LDLIBRARY='libpython$(VERSION).so'
Neal Norwitz671b9e32006-01-09 07:07:12 +0000830 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000831 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000832 ;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000833 atheos*)
834 LDLIBRARY='libpython$(VERSION).so'
835 BLDLIBRARY='-L. -lpython$(VERSION)'
836 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
837 ;;
Ronald Oussoren79f90492009-01-02 10:44:46 +0000838 Darwin*)
839 LDLIBRARY='libpython$(VERSION).dylib'
840 BLDLIBRARY='-L. -lpython$(VERSION)'
841 RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
842 ;;
843
Martin v. Löwis1142de32002-03-29 16:28:31 +0000844 esac
Jason Tishler30765592003-09-04 11:04:06 +0000845else # shared is disabled
846 case $ac_sys_system in
847 CYGWIN*)
848 BLDLIBRARY='$(LIBRARY)'
849 LDLIBRARY='libpython$(VERSION).dll.a'
850 ;;
851 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000852fi
853
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000854AC_MSG_RESULT($LDLIBRARY)
855
Guido van Rossum627b2d71993-12-24 10:39:16 +0000856AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000857AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000858AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000859
Tarek Ziadé99f660a2009-05-07 21:20:34 +0000860# tweak ARFLAGS only if the user didn't set it on the command line
861AC_SUBST(ARFLAGS)
862if test -z "$ARFLAGS"
863then
864 ARFLAGS="rc"
865fi
866
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000867AC_SUBST(SVNVERSION)
Martin v. Löwisff600232006-04-03 19:12:32 +0000868AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000869if test $SVNVERSION = found
870then
871 SVNVERSION="svnversion \$(srcdir)"
872else
Benjamin Petersone5afa3b2009-05-23 19:24:37 +0000873 SVNVERSION="echo Unversioned directory"
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000874fi
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000875
Neil Schemenauera42c8272001-03-31 00:01:55 +0000876case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +0000877bsdos*|hp*|HP*)
878 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +0000879 if test -z "$INSTALL"
880 then
881 INSTALL="${srcdir}/install-sh -c"
882 fi
883esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000884AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000885
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000886# Not every filesystem supports hard links
887AC_SUBST(LN)
888if test -z "$LN" ; then
889 case $ac_sys_system in
890 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000891 CYGWIN*) LN="ln -s";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000892 atheos*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000893 *) LN=ln;;
894 esac
895fi
896
Fred Drake9f715822001-07-11 06:27:00 +0000897# Check for --with-pydebug
898AC_MSG_CHECKING(for --with-pydebug)
899AC_ARG_WITH(pydebug,
Matthias Klose22520ea2010-05-08 10:14:46 +0000900 AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000901[
Fred Drake9f715822001-07-11 06:27:00 +0000902if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000903then
904 AC_DEFINE(Py_DEBUG, 1,
905 [Define if you want to build an interpreter with many run-time checks.])
906 AC_MSG_RESULT(yes);
907 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +0000908else AC_MSG_RESULT(no); Py_DEBUG='false'
909fi],
910[AC_MSG_RESULT(no)])
911
Skip Montanarodecc6a42003-01-01 20:07:49 +0000912# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
913# merged with this chunk of code?
914
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000915# Optimizer/debugger flags
Skip Montanarodecc6a42003-01-01 20:07:49 +0000916# ------------------------
917# (The following bit of code is complicated enough - please keep things
918# indented properly. Just pretend you're editing Python code. ;-)
919
920# There are two parallel sets of case statements below, one that checks to
921# see if OPT was set and one that does BASECFLAGS setting based upon
922# compiler and platform. BASECFLAGS tweaks need to be made even if the
923# user set OPT.
924
925# tweak OPT based on compiler and platform, only if the user didn't set
926# it on the command line
Guido van Rossumb418f891996-07-30 18:06:02 +0000927AC_SUBST(OPT)
Benjamin Petersond4b721b2010-03-23 20:58:37 +0000928if test "${OPT-unset}" = "unset"
Guido van Rossumb418f891996-07-30 18:06:02 +0000929then
Skip Montanarodecc6a42003-01-01 20:07:49 +0000930 case $GCC in
931 yes)
Skip Montanaro288a5be2006-04-13 02:00:56 +0000932 if test "$CC" != 'g++' ; then
933 STRICT_PROTO="-Wstrict-prototypes"
934 fi
Guido van Rossum7c862f82007-12-13 20:50:10 +0000935 # For gcc 4.x we need to use -fwrapv so lets check if its supported
936 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
937 WRAP="-fwrapv"
938 fi
Skip Montanarodecc6a42003-01-01 20:07:49 +0000939 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000940 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000941 if test "$Py_DEBUG" = 'true' ; then
942 # Optimization messes up debuggers, so turn it off for
943 # debug builds.
Mark Dickinsond2f3e3f2010-05-05 22:23:58 +0000944 OPT="-g -O0 -Wall $STRICT_PROTO"
Fred Drake9f715822001-07-11 06:27:00 +0000945 else
Guido van Rossum7c862f82007-12-13 20:50:10 +0000946 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +0000947 fi
948 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000949 *)
Skip Montanaro288a5be2006-04-13 02:00:56 +0000950 OPT="-O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +0000951 ;;
Fred Drake9f715822001-07-11 06:27:00 +0000952 esac
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000953 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +0000954 SCO_SV*) OPT="$OPT -m486 -DSCO5"
955 ;;
956 esac
Fred Drake9f715822001-07-11 06:27:00 +0000957 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +0000958
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000959 *)
Skip Montanarodecc6a42003-01-01 20:07:49 +0000960 OPT="-O"
961 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000962 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000963fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000964
Skip Montanarodecc6a42003-01-01 20:07:49 +0000965AC_SUBST(BASECFLAGS)
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000966
967# The -arch flags for universal builds on OSX
968UNIVERSAL_ARCH_FLAGS=
969AC_SUBST(UNIVERSAL_ARCH_FLAGS)
970
Skip Montanarodecc6a42003-01-01 20:07:49 +0000971# tweak BASECFLAGS based on compiler and platform
972case $GCC in
973yes)
Martin v. Löwis70fedcd2003-07-07 21:26:19 +0000974 # Python violates C99 rules, by casting between incompatible
975 # pointer types. GCC may generate bad code as a result of that,
976 # so use -fno-strict-aliasing if supported.
977 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
978 ac_save_cc="$CC"
979 CC="$CC -fno-strict-aliasing"
Alexandre Vassalotti00900892009-07-17 05:26:39 +0000980 AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
Matthias Klosec511b472010-05-08 11:01:39 +0000981 AC_COMPILE_IFELSE(
982 [AC_LANG_PROGRAM([[]], [[int main() { return 0; }]])],
983 [ac_cv_no_strict_aliasing_ok=yes],
984 [ac_cv_no_strict_aliasing_ok=no]))
Martin v. Löwis70fedcd2003-07-07 21:26:19 +0000985 CC="$ac_save_cc"
986 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
987 if test $ac_cv_no_strict_aliasing_ok = yes
988 then
989 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
990 fi
Mark Dickinson65134662008-04-25 16:11:04 +0000991
992 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
993 # support. Without this, treatment of subnormals doesn't follow
994 # the standard.
995 case $ac_sys_machine in
996 alpha*)
997 BASECFLAGS="$BASECFLAGS -mieee"
998 ;;
999 esac
1000
Skip Montanarodecc6a42003-01-01 20:07:49 +00001001 case $ac_sys_system in
1002 SCO_SV*)
1003 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
1004 ;;
1005 # is there any other compiler on Darwin besides gcc?
1006 Darwin*)
Jeffrey Yasskin1b4e45b2008-03-17 14:40:53 +00001007 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
1008 # used to be here, but non-Apple gcc doesn't accept them.
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001009 if test "${CC}" = gcc
1010 then
1011 AC_MSG_CHECKING(which compiler should be used)
1012 case "${UNIVERSALSDK}" in
1013 */MacOSX10.4u.sdk)
1014 # Build using 10.4 SDK, force usage of gcc when the
1015 # compiler is gcc, otherwise the user will get very
1016 # confusing error messages when building on OSX 10.6
1017 CC=gcc-4.0
1018 CPP=cpp-4.0
1019 ;;
1020 esac
1021 AC_MSG_RESULT($CC)
Ronald Oussoren988117f2006-04-29 11:31:35 +00001022 fi
1023
Benjamin Peterson4347c442008-07-17 15:59:24 +00001024 # Calculate the right deployment target for this build.
1025 #
1026 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
1027 if test ${cur_target} '>' 10.2; then
1028 cur_target=10.3
Ronald Oussoren25967582009-09-06 10:00:26 +00001029 if test ${enable_universalsdk}; then
1030 if test "${UNIVERSAL_ARCHS}" = "all"; then
1031 # Ensure that the default platform for a
1032 # 4-way universal build is OSX 10.5,
1033 # that's the first OS release where
1034 # 4-way builds make sense.
1035 cur_target='10.5'
Ronald Oussoren23d92532009-09-07 06:12:00 +00001036
1037 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
1038 cur_target='10.5'
1039
1040 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
1041 cur_target='10.5'
1042
1043 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
1044 cur_target='10.5'
Ronald Oussoren25967582009-09-06 10:00:26 +00001045 fi
1046 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001047 if test `/usr/bin/arch` = "i386"; then
Ronald Oussoren25967582009-09-06 10:00:26 +00001048 # On Intel macs default to a deployment
1049 # target of 10.4, that's the first OSX
1050 # release with Intel support.
1051 cur_target="10.4"
1052 fi
1053 fi
Benjamin Peterson4347c442008-07-17 15:59:24 +00001054 fi
1055 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1056
1057 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1058 # environment with a value that is the same as what we'll use
1059 # in the Makefile to ensure that we'll get the same compiler
1060 # environment during configure and build time.
1061 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1062 export MACOSX_DEPLOYMENT_TARGET
1063 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1064
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001065 if test "${enable_universalsdk}"; then
1066 UNIVERSAL_ARCH_FLAGS=""
1067 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
1068 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
1069 ARCH_RUN_32BIT=""
Ronald Oussoren75912852010-04-08 08:13:31 +00001070 LIPO_32BIT_FLAGS=""
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001071
1072 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
1073 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
1074 LIPO_32BIT_FLAGS=""
1075 ARCH_RUN_32BIT="true"
1076
1077 elif test "$UNIVERSAL_ARCHS" = "all" ; then
1078 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
1079 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001080 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001081
1082 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
1083 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
1084 LIPO_32BIT_FLAGS="-extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001085 ARCH_RUN_32BIT="/usr/bin/arch -i386"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001086
1087 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
1088 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
1089 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren9922f172010-02-11 13:19:34 +00001090 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001091
1092 else
1093 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
1094
1095 fi
1096
1097
Ronald Oussoren974eb5e2010-04-18 17:59:37 +00001098 CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
1099 if test "${UNIVERSALSDK}" != "/"
1100 then
1101 CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
1102 LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1103 CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001104 fi
1105
1106 fi
1107
1108
Skip Montanarodecc6a42003-01-01 20:07:49 +00001109 ;;
Neal Norwitzdedeeaa2006-03-31 06:54:45 +00001110 OSF*)
1111 BASECFLAGS="$BASECFLAGS -mieee"
1112 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001113 esac
1114 ;;
1115
1116*)
1117 case $ac_sys_system in
1118 OpenUNIX*|UnixWare*)
1119 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1120 ;;
Neal Norwitzb44f1652003-05-26 14:11:55 +00001121 OSF*)
1122 BASECFLAGS="$BASECFLAGS -ieee -std"
1123 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001124 SCO_SV*)
1125 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1126 ;;
1127 esac
1128 ;;
1129esac
1130
Fred Drakee1ceaa02001-12-04 20:55:47 +00001131if test "$Py_DEBUG" = 'true'; then
1132 :
1133else
1134 OPT="-DNDEBUG $OPT"
1135fi
1136
Guido van Rossum6f2260e1996-09-09 16:21:03 +00001137if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001138then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001139 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001140fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001141
Neal Norwitz020c46a2006-01-07 21:39:28 +00001142# disable check for icc since it seems to pass, but generates a warning
1143if test "$CC" = icc
1144then
1145 ac_cv_opt_olimit_ok=no
1146fi
1147
Guido van Rossum91922671997-10-09 20:24:13 +00001148AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1149AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1150[ac_save_cc="$CC"
1151CC="$CC -OPT:Olimit=0"
Matthias Klosec511b472010-05-08 11:01:39 +00001152AC_COMPILE_IFELSE(
1153 [AC_LANG_PROGRAM([[]], [[int main() { return 0; }]])],
1154 [ac_cv_opt_olimit_ok=yes],
1155 [ac_cv_opt_olimit_ok=no]
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001156 )
Guido van Rossum91922671997-10-09 20:24:13 +00001157CC="$ac_save_cc"])
1158AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +00001159if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +00001160 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +00001161 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1162 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1163 # environment?
1164 Darwin*)
1165 ;;
1166 *)
1167 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1168 ;;
Guido van Rossum5839e582000-10-09 19:52:35 +00001169 esac
Guido van Rossumf8678121998-07-07 21:05:09 +00001170else
1171 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1172 AC_CACHE_VAL(ac_cv_olimit_ok,
1173 [ac_save_cc="$CC"
1174 CC="$CC -Olimit 1500"
Matthias Klosec511b472010-05-08 11:01:39 +00001175 AC_COMPILE_IFELSE(
1176 [AC_LANG_PROGRAM([[]], [[int main() { return 0; }]])],
1177 [ac_cv_olimit_ok=yes],
1178 [ac_cv_olimit_ok=no]
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001179 )
Guido van Rossumf8678121998-07-07 21:05:09 +00001180 CC="$ac_save_cc"])
1181 AC_MSG_RESULT($ac_cv_olimit_ok)
1182 if test $ac_cv_olimit_ok = yes; then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001183 BASECFLAGS="$BASECFLAGS -Olimit 1500"
Guido van Rossumf8678121998-07-07 21:05:09 +00001184 fi
Guido van Rossum201afe51997-05-14 21:14:44 +00001185fi
Guido van Rossumf8678121998-07-07 21:05:09 +00001186
Martin v. Löwisaac13162006-10-19 10:58:46 +00001187# Check whether GCC supports PyArg_ParseTuple format
1188if test "$GCC" = "yes"
1189then
1190 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1191 save_CFLAGS=$CFLAGS
1192 CFLAGS="$CFLAGS -Werror"
Matthias Klosec511b472010-05-08 11:01:39 +00001193 AC_COMPILE_IFELSE([
1194 AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
1195 ],[
1196 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1,
1197 [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1198 AC_MSG_RESULT(yes)
1199 ],[
1200 AC_MSG_RESULT(no)
1201 ])
Martin v. Löwisc1d75972006-10-19 16:01:37 +00001202 CFLAGS=$save_CFLAGS
Martin v. Löwisaac13162006-10-19 10:58:46 +00001203fi
1204
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001205# On some compilers, pthreads are available without further options
1206# (e.g. MacOS X). On some of these systems, the compiler will not
1207# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1208# So we have to see first whether pthreads are available without
1209# options before we can check whether -Kpthread improves anything.
1210AC_MSG_CHECKING(whether pthreads are available without options)
1211AC_CACHE_VAL(ac_cv_pthread_is_default,
Matthias Klosec511b472010-05-08 11:01:39 +00001212[AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001213#include <pthread.h>
1214
1215void* routine(void* p){return NULL;}
1216
1217int main(){
1218 pthread_t p;
1219 if(pthread_create(&p,NULL,routine,NULL)!=0)
1220 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001221 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001222 return 0;
1223}
Matthias Klosec511b472010-05-08 11:01:39 +00001224]])],[
Skip Montanarod8d39a02003-07-10 20:44:10 +00001225 ac_cv_pthread_is_default=yes
1226 ac_cv_kthread=no
1227 ac_cv_pthread=no
Matthias Klosec511b472010-05-08 11:01:39 +00001228],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no])
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001229])
1230AC_MSG_RESULT($ac_cv_pthread_is_default)
1231
1232
1233if test $ac_cv_pthread_is_default = yes
1234then
1235 ac_cv_kpthread=no
1236else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001237# -Kpthread, if available, provides the right #defines
1238# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001239# Some compilers won't report that they do not support -Kpthread,
1240# so we need to run a program to see whether it really made the
1241# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +00001242AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1243AC_CACHE_VAL(ac_cv_kpthread,
1244[ac_save_cc="$CC"
1245CC="$CC -Kpthread"
Matthias Klosec511b472010-05-08 11:01:39 +00001246AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001247#include <pthread.h>
1248
1249void* routine(void* p){return NULL;}
1250
1251int main(){
1252 pthread_t p;
1253 if(pthread_create(&p,NULL,routine,NULL)!=0)
1254 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001255 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001256 return 0;
1257}
Matthias Klosec511b472010-05-08 11:01:39 +00001258]])],[ac_cv_kpthread=yes],[ac_cv_kpthread=no],[ac_cv_kpthread=no])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001259CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001260AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001261fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00001262
Skip Montanarod8d39a02003-07-10 20:44:10 +00001263if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001264then
1265# -Kthread, if available, provides the right #defines
1266# and linker options to make pthread_create available
1267# Some compilers won't report that they do not support -Kthread,
1268# so we need to run a program to see whether it really made the
1269# function available.
1270AC_MSG_CHECKING(whether $CC accepts -Kthread)
1271AC_CACHE_VAL(ac_cv_kthread,
1272[ac_save_cc="$CC"
1273CC="$CC -Kthread"
Matthias Klosec511b472010-05-08 11:01:39 +00001274AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001275#include <pthread.h>
1276
1277void* routine(void* p){return NULL;}
1278
1279int main(){
1280 pthread_t p;
1281 if(pthread_create(&p,NULL,routine,NULL)!=0)
1282 return 1;
1283 (void)pthread_detach(p);
1284 return 0;
1285}
Matthias Klosec511b472010-05-08 11:01:39 +00001286]])],[ac_cv_kthread=yes],[ac_cv_kthread=no],[ac_cv_kthread=no])
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001287CC="$ac_save_cc"])
1288AC_MSG_RESULT($ac_cv_kthread)
1289fi
1290
Skip Montanarod8d39a02003-07-10 20:44:10 +00001291if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001292then
1293# -pthread, if available, provides the right #defines
1294# and linker options to make pthread_create available
1295# Some compilers won't report that they do not support -pthread,
1296# so we need to run a program to see whether it really made the
1297# function available.
1298AC_MSG_CHECKING(whether $CC accepts -pthread)
1299AC_CACHE_VAL(ac_cv_thread,
1300[ac_save_cc="$CC"
1301CC="$CC -pthread"
Matthias Klosec511b472010-05-08 11:01:39 +00001302AC_RUN_IFELSE([AC_LANG_SOURCE([[
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001303#include <pthread.h>
1304
1305void* routine(void* p){return NULL;}
1306
1307int main(){
1308 pthread_t p;
1309 if(pthread_create(&p,NULL,routine,NULL)!=0)
1310 return 1;
1311 (void)pthread_detach(p);
1312 return 0;
1313}
Matthias Klosec511b472010-05-08 11:01:39 +00001314]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001315CC="$ac_save_cc"])
1316AC_MSG_RESULT($ac_cv_pthread)
1317fi
1318
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001319# If we have set a CC compiler flag for thread support then
1320# check if it works for CXX, too.
1321ac_cv_cxx_thread=no
1322if test ! -z "$CXX"
1323then
1324AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1325ac_save_cxx="$CXX"
1326
1327if test "$ac_cv_kpthread" = "yes"
1328then
Martin v. Löwis519adae2003-09-20 10:47:47 +00001329 CXX="$CXX -Kpthread"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001330 ac_cv_cxx_thread=yes
1331elif test "$ac_cv_kthread" = "yes"
1332then
1333 CXX="$CXX -Kthread"
1334 ac_cv_cxx_thread=yes
1335elif test "$ac_cv_pthread" = "yes"
1336then
1337 CXX="$CXX -pthread"
1338 ac_cv_cxx_thread=yes
1339fi
1340
1341if test $ac_cv_cxx_thread = yes
1342then
1343 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1344 $CXX -c conftest.$ac_ext 2>&5
1345 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1346 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1347 then
1348 ac_cv_cxx_thread=yes
1349 else
1350 ac_cv_cxx_thread=no
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001351 fi
1352 rm -fr conftest*
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001353fi
Brett Cannonc601e0f2004-11-07 01:24:12 +00001354AC_MSG_RESULT($ac_cv_cxx_thread)
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001355fi
Martin v. Löwis519adae2003-09-20 10:47:47 +00001356CXX="$ac_save_cxx"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001357
Fred Drakece81d592000-07-09 14:39:29 +00001358dnl # check for ANSI or K&R ("traditional") preprocessor
1359dnl AC_MSG_CHECKING(for C preprocessor type)
Matthias Klosec511b472010-05-08 11:01:39 +00001360dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Fred Drakece81d592000-07-09 14:39:29 +00001361dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1362dnl int foo;
1363dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
Matthias Klosec511b472010-05-08 11:01:39 +00001364dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional])
Fred Drakece81d592000-07-09 14:39:29 +00001365dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +00001366
Guido van Rossum627b2d71993-12-24 10:39:16 +00001367# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001368AC_HEADER_STDC
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001369AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1370fcntl.h grp.h \
Neal Norwitz9fdfaaf2008-03-28 05:34:59 +00001371ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001372shadow.h signal.h stdint.h stropts.h termios.h thread.h \
Martin v. Löwis14e73b12003-01-01 09:51:12 +00001373unistd.h utime.h \
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00001374sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1375sys/lock.h sys/mkdev.h sys/modem.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001376sys/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 +00001377sys/termio.h sys/time.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001378sys/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 +00001379sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001380bluetooth/bluetooth.h linux/tipc.h spawn.h util.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001381AC_HEADER_DIRENT
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00001382AC_HEADER_MAJOR
Guido van Rossum627b2d71993-12-24 10:39:16 +00001383
Martin v. Löwisae2830c2004-09-18 09:54:52 +00001384# On Solaris, term.h requires curses.h
Martin v. Löwisfd1c69e2004-11-30 22:09:37 +00001385AC_CHECK_HEADERS(term.h,,,[
Martin v. Löwis5d52e782004-09-18 10:07:03 +00001386#ifdef HAVE_CURSES_H
1387#include <curses.h>
1388#endif
1389])
Martin v. Löwisae2830c2004-09-18 09:54:52 +00001390
Martin v. Löwis11017b12006-01-14 18:12:57 +00001391# On Linux, netlink.h requires asm/types.h
1392AC_CHECK_HEADERS(linux/netlink.h,,,[
1393#ifdef HAVE_ASM_TYPES_H
1394#include <asm/types.h>
1395#endif
1396#ifdef HAVE_SYS_SOCKET_H
1397#include <sys/socket.h>
1398#endif
1399])
1400
Guido van Rossum627b2d71993-12-24 10:39:16 +00001401# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001402was_it_defined=no
1403AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001404AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1405 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1406])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001407AC_MSG_RESULT($was_it_defined)
1408
Neal Norwitz11690112002-07-30 01:08:28 +00001409# Check whether using makedev requires defining _OSF_SOURCE
1410AC_MSG_CHECKING(for makedev)
Matthias Klosec511b472010-05-08 11:01:39 +00001411AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Jesus Cea616de772010-04-28 10:32:30 +00001412#if defined(MAJOR_IN_MKDEV)
1413#include <sys/mkdev.h>
1414#elif defined(MAJOR_IN_SYSMACROS)
1415#include <sys/sysmacros.h>
1416#else
1417#include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001418#endif ]], [[ makedev(0, 0) ]])],
1419[ac_cv_has_makedev=yes],
1420[ac_cv_has_makedev=no])
Neal Norwitz11690112002-07-30 01:08:28 +00001421if test "$ac_cv_has_makedev" = "no"; then
1422 # we didn't link, try if _OSF_SOURCE will allow us to link
Matthias Klosec511b472010-05-08 11:01:39 +00001423 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001424#define _OSF_SOURCE 1
1425#include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001426 ]], [[ makedev(0, 0) ]])],
1427[ac_cv_has_makedev=yes],
1428[ac_cv_has_makedev=no])
Neal Norwitz11690112002-07-30 01:08:28 +00001429 if test "$ac_cv_has_makedev" = "yes"; then
1430 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1431 fi
1432fi
1433AC_MSG_RESULT($ac_cv_has_makedev)
1434if test "$ac_cv_has_makedev" = "yes"; then
1435 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1436fi
1437
Martin v. Löwis399a6892002-10-04 10:22:02 +00001438# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1439# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1440# defined, but the compiler does not support pragma redefine_extname,
1441# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1442# structures (such as rlimit64) without declaring them. As a
1443# work-around, disable LFS on such configurations
1444
1445use_lfs=yes
1446AC_MSG_CHECKING(Solaris LFS bug)
Matthias Klosec511b472010-05-08 11:01:39 +00001447AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwis399a6892002-10-04 10:22:02 +00001448#define _LARGEFILE_SOURCE 1
1449#define _FILE_OFFSET_BITS 64
1450#include <sys/resource.h>
Matthias Klosec511b472010-05-08 11:01:39 +00001451]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes])
Martin v. Löwis399a6892002-10-04 10:22:02 +00001452AC_MSG_RESULT($sol_lfs_bug)
1453if test "$sol_lfs_bug" = "yes"; then
1454 use_lfs=no
1455fi
1456
1457if test "$use_lfs" = "yes"; then
Guido van Rossum810cc512001-09-09 23:51:39 +00001458# Two defines needed to enable largefile support on various platforms
1459# These may affect some typedefs
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001460AC_DEFINE(_LARGEFILE_SOURCE, 1,
1461[This must be defined on some systems to enable large file support.])
1462AC_DEFINE(_FILE_OFFSET_BITS, 64,
1463[This must be set to 64 on some systems to enable large file support.])
Martin v. Löwis399a6892002-10-04 10:22:02 +00001464fi
Guido van Rossum810cc512001-09-09 23:51:39 +00001465
Guido van Rossum300fda71996-08-19 21:58:16 +00001466# Add some code to confdefs.h so that the test for off_t works on SCO
1467cat >> confdefs.h <<\EOF
1468#if defined(SCO_DS)
1469#undef _OFF_T
1470#endif
1471EOF
1472
Guido van Rossumef2255b2000-03-10 22:30:29 +00001473# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001474AC_TYPE_MODE_T
1475AC_TYPE_OFF_T
1476AC_TYPE_PID_T
Matthias Klosecbf54b12010-05-08 11:04:18 +00001477AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001478AC_TYPE_SIZE_T
1479AC_TYPE_UID_T
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001480AC_TYPE_UINT32_T
1481AC_TYPE_UINT64_T
1482AC_TYPE_INT32_T
1483AC_TYPE_INT64_T
Christian Heimes951cc0f2008-01-31 23:08:23 +00001484AC_CHECK_TYPE(ssize_t,
Matthias Klose5183ebd2010-04-24 16:38:36 +00001485 AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001486
Guido van Rossumef2255b2000-03-10 22:30:29 +00001487# Sizes of various common basic types
Skip Montanarob9820a32004-01-17 00:16:12 +00001488# ANSI C requires sizeof(char) == 1, so no need to check it
Guido van Rossum3065c942001-09-17 04:03:14 +00001489AC_CHECK_SIZEOF(int, 4)
1490AC_CHECK_SIZEOF(long, 4)
1491AC_CHECK_SIZEOF(void *, 4)
Guido van Rossum3065c942001-09-17 04:03:14 +00001492AC_CHECK_SIZEOF(short, 2)
1493AC_CHECK_SIZEOF(float, 4)
1494AC_CHECK_SIZEOF(double, 8)
1495AC_CHECK_SIZEOF(fpos_t, 4)
Martin v. Löwis18e16552006-02-15 17:27:45 +00001496AC_CHECK_SIZEOF(size_t, 4)
Christian Heimes951cc0f2008-01-31 23:08:23 +00001497AC_CHECK_SIZEOF(pid_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +00001498
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001499AC_MSG_CHECKING(for long long support)
1500have_long_long=no
Matthias Klosec511b472010-05-08 11:01:39 +00001501AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001502 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1503 have_long_long=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001504],[])
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001505AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001506if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +00001507AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001508fi
1509
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001510AC_MSG_CHECKING(for long double support)
1511have_long_double=no
Matthias Klosec511b472010-05-08 11:01:39 +00001512AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001513 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1514 have_long_double=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001515],[])
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001516AC_MSG_RESULT($have_long_double)
Mark Dickinsondc1688a2008-06-27 22:20:14 +00001517if test "$have_long_double" = yes ; then
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001518AC_CHECK_SIZEOF(long double, 12)
1519fi
1520
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001521AC_MSG_CHECKING(for _Bool support)
1522have_c99_bool=no
Matthias Klosec511b472010-05-08 11:01:39 +00001523AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Bool x; x = (_Bool)0;]])],[
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001524 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1525 have_c99_bool=yes
Matthias Klosec511b472010-05-08 11:01:39 +00001526],[])
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001527AC_MSG_RESULT($have_c99_bool)
1528if test "$have_c99_bool" = yes ; then
1529AC_CHECK_SIZEOF(_Bool, 1)
1530fi
1531
Martin v. Löwisebe26702006-10-02 14:55:51 +00001532AC_CHECK_TYPES(uintptr_t,
1533 [AC_CHECK_SIZEOF(uintptr_t, 4)],
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001534 [], [#ifdef HAVE_STDINT_H
1535 #include <stdint.h>
1536 #endif])
Martin v. Löwisebe26702006-10-02 14:55:51 +00001537
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001538AC_CHECK_SIZEOF(off_t, [], [
1539#ifdef HAVE_SYS_TYPES_H
1540#include <sys/types.h>
1541#endif
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001542])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001543
1544AC_MSG_CHECKING(whether to enable large file support)
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001545if test "$have_long_long" = yes
1546then
1547if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001548 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001549 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1550 [Defined to enable large file support when an off_t is bigger than a long
1551 and long long is available and at least as big as an off_t. You may need
1552 to add some flags for configuration and compilation to enable this mode.
1553 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001554 AC_MSG_RESULT(yes)
1555else
1556 AC_MSG_RESULT(no)
1557fi
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001558else
1559 AC_MSG_RESULT(no)
1560fi
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001561
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001562AC_CHECK_SIZEOF(time_t, [], [
1563#ifdef HAVE_SYS_TYPES_H
1564#include <sys/types.h>
1565#endif
1566#ifdef HAVE_TIME_H
1567#include <time.h>
1568#endif
Fred Drakea3f6e912000-06-29 20:44:47 +00001569])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001570
Trent Mick635f6fb2000-08-23 21:33:05 +00001571# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001572ac_save_cc="$CC"
1573if test "$ac_cv_kpthread" = "yes"
1574then CC="$CC -Kpthread"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001575elif test "$ac_cv_kthread" = "yes"
1576then CC="$CC -Kthread"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001577elif test "$ac_cv_pthread" = "yes"
1578then CC="$CC -pthread"
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001579fi
Trent Mick635f6fb2000-08-23 21:33:05 +00001580AC_MSG_CHECKING(for pthread_t)
1581have_pthread_t=no
Matthias Klosec511b472010-05-08 11:01:39 +00001582AC_COMPILE_IFELSE([
1583 AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
1584],[have_pthread_t=yes],[])
Trent Mick635f6fb2000-08-23 21:33:05 +00001585AC_MSG_RESULT($have_pthread_t)
1586if test "$have_pthread_t" = yes ; then
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001587 AC_CHECK_SIZEOF(pthread_t, [], [
1588#ifdef HAVE_PTHREAD_H
1589#include <pthread.h>
1590#endif
Trent Mick635f6fb2000-08-23 21:33:05 +00001591 ])
Trent Mick635f6fb2000-08-23 21:33:05 +00001592fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001593CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +00001594
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001595AC_MSG_CHECKING(for --enable-toolbox-glue)
1596AC_ARG_ENABLE(toolbox-glue,
Matthias Klose22520ea2010-05-08 10:14:46 +00001597 AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions]))
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001598
1599if test -z "$enable_toolbox_glue"
1600then
1601 case $ac_sys_system/$ac_sys_release in
1602 Darwin/*)
1603 enable_toolbox_glue="yes";;
1604 *)
1605 enable_toolbox_glue="no";;
1606 esac
1607fi
1608case "$enable_toolbox_glue" in
1609yes)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001610 extra_machdep_objs="Python/mactoolboxglue.o"
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001611 extra_undefs="-u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001612 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1613 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001614 ;;
1615*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001616 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +00001617 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001618 ;;
1619esac
1620AC_MSG_RESULT($enable_toolbox_glue)
1621
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00001622
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001623AC_SUBST(OTHER_LIBTOOL_OPT)
1624case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001625 Darwin/@<:@01567@:>@\..*)
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001626 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1627 ;;
1628 Darwin/*)
1629 OTHER_LIBTOOL_OPT=""
1630 ;;
1631esac
1632
Ronald Oussoren25967582009-09-06 10:00:26 +00001633
1634ARCH_RUN_32BIT=""
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001635AC_SUBST(LIBTOOL_CRUFT)
1636case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001637 Darwin/@<:@01567@:>@\..*)
Ronald Oussoren988117f2006-04-29 11:31:35 +00001638 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1639 if test "${enable_universalsdk}"; then
1640 :
1641 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001642 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001643 fi
Jack Jansenb36687a2004-07-16 08:43:47 +00001644 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001645 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +00001646 Darwin/*)
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001647 gcc_version=`gcc -dumpversion`
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001648 if test ${gcc_version} '<' 4.0
1649 then
1650 LIBTOOL_CRUFT="-lcc_dynamic"
1651 else
1652 LIBTOOL_CRUFT=""
1653 fi
Matthias Klosec511b472010-05-08 11:01:39 +00001654 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Ronald Oussoren25967582009-09-06 10:00:26 +00001655 #include <unistd.h>
1656 int main(int argc, char*argv[])
1657 {
1658 if (sizeof(long) == 4) {
1659 return 0;
1660 } else {
1661 return 1;
1662 }
Ronald Oussoren84ddd722009-09-08 07:17:10 +00001663 }
Matthias Klosec511b472010-05-08 11:01:39 +00001664 ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
Ronald Oussoren25967582009-09-06 10:00:26 +00001665
1666 if test "${ac_osx_32bit}" = "yes"; then
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001667 case `/usr/bin/arch` in
Ronald Oussoren25967582009-09-06 10:00:26 +00001668 i386)
1669 MACOSX_DEFAULT_ARCH="i386"
1670 ;;
1671 ppc)
1672 MACOSX_DEFAULT_ARCH="ppc"
1673 ;;
1674 *)
1675 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1676 ;;
1677 esac
1678 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001679 case `/usr/bin/arch` in
Ronald Oussoren25967582009-09-06 10:00:26 +00001680 i386)
1681 MACOSX_DEFAULT_ARCH="x86_64"
1682 ;;
1683 ppc)
1684 MACOSX_DEFAULT_ARCH="ppc64"
1685 ;;
1686 *)
1687 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1688 ;;
1689 esac
1690
1691 #ARCH_RUN_32BIT="true"
1692 fi
1693
1694 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
Jack Jansenb36687a2004-07-16 08:43:47 +00001695 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001696 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001697esac
1698
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001699AC_MSG_CHECKING(for --enable-framework)
1700if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001701then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001702 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001703 # -F. is needed to allow linking to the framework while
1704 # in the build location.
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001705 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1706 [Define if you want to produce an OpenStep/Rhapsody framework
1707 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001708 AC_MSG_RESULT(yes)
Ronald Oussoren450d5612009-06-08 21:12:41 +00001709 if test $enable_shared = "yes"
1710 then
Ronald Oussoren9ebd2422009-09-29 13:00:44 +00001711 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 +00001712 fi
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001713else
1714 AC_MSG_RESULT(no)
1715fi
1716
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001717AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001718case $ac_sys_system/$ac_sys_release in
1719 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001720 AC_DEFINE(WITH_DYLD, 1,
1721 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1722 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1723 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001724 AC_MSG_RESULT(always on for Darwin)
1725 ;;
1726 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001727 AC_MSG_RESULT(no)
1728 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001729esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001730
Guido van Rossumac405f61994-09-12 10:56:06 +00001731# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +00001732AC_SUBST(SO)
1733AC_SUBST(LDSHARED)
Tarek Ziadé00002952010-04-03 08:37:59 +00001734AC_SUBST(LDCXXSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001735AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001736AC_SUBST(CCSHARED)
1737AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001738# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +00001739# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001740AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +00001741if test -z "$SO"
1742then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001743 case $ac_sys_system in
Neal Norwitz58e28882006-05-19 07:00:58 +00001744 hp*|HP*)
1745 case `uname -m` in
1746 ia64) SO=.so;;
1747 *) SO=.sl;;
1748 esac
1749 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001750 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001751 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +00001752 esac
Martin v. Löwis368de8f2003-06-14 14:46:38 +00001753else
1754 # this might also be a termcap variable, see #610332
1755 echo
1756 echo '====================================================================='
1757 echo '+ +'
1758 echo '+ WARNING: You have set SO in your environment. +'
1759 echo '+ Do you really mean to change the extension for shared libraries? +'
1760 echo '+ Continuing in 10 seconds to let you to ponder. +'
1761 echo '+ +'
1762 echo '====================================================================='
1763 sleep 10
Guido van Rossumac405f61994-09-12 10:56:06 +00001764fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001765AC_MSG_RESULT($SO)
Ronald Oussoren79f90492009-01-02 10:44:46 +00001766
Neal Norwitz58e28882006-05-19 07:00:58 +00001767AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
Guido van Rossumac405f61994-09-12 10:56:06 +00001768# LDSHARED is the ld *command* used to create shared library
Skip Montanaroce59c042004-01-17 14:19:44 +00001769# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001770# (Shared libraries in this instance are shared modules to be loaded into
1771# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001772AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001773if test -z "$LDSHARED"
1774then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001775 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001776 AIX*)
1777 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
Guido van Rossumce608b02001-09-28 15:59:38 +00001778 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001779 ;;
1780 BeOS*)
1781 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +00001782 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001783 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001784 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +00001785 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Greg Ward57c9a662000-05-26 12:22:54 +00001786 SunOS/5*)
Tarek Ziadé00002952010-04-03 08:37:59 +00001787 if test "$GCC" = "yes" ; then
1788 LDSHARED='$(CC) -shared'
1789 LDCXXSHARED='$(CXX) -shared'
1790 else
1791 LDSHARED='$(CC) -G'
1792 LDCXXSHARED='$(CXX) -G'
Greg Ward57c9a662000-05-26 12:22:54 +00001793 fi ;;
Thomas Hellerdc96a772008-04-04 10:07:55 +00001794 hp*|HP*)
Tarek Ziadé00002952010-04-03 08:37:59 +00001795 if test "$GCC" = "yes" ; then
1796 LDSHARED='$(CC) -shared'
1797 LDCXXSHARED='$(CXX) -shared'
1798 else
1799 LDSHARED='ld -b'
Thomas Hellerdc96a772008-04-04 10:07:55 +00001800 fi ;;
Guido van Rossum71001e41995-01-26 00:44:03 +00001801 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Jack Jansen418c3b12001-11-14 10:59:57 +00001802 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +00001803 LDSHARED='$(CC) $(LDFLAGS) -bundle'
Tarek Ziadé00002952010-04-03 08:37:59 +00001804 LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle'
Jack Jansena3891ea2001-09-07 14:25:12 +00001805 if test "$enable_framework" ; then
1806 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001807 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1808 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00001809 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001810 else
1811 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +00001812 LDSHARED="$LDSHARED -undefined suppress"
Tarek Ziadé00002952010-04-03 08:37:59 +00001813 LDCXXSHARED="$LDCXXSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +00001814 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00001815 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001816 LDSHARED='$(CC) $(LDFLAGS) -bundle'
Tarek Ziadé00002952010-04-03 08:37:59 +00001817 LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001818 if test "$enable_framework" ; then
1819 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001820 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1821 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00001822 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001823 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +00001824 # No framework, use the Python app as bundle-loader
1825 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
Jack Jansenc28fc372003-02-25 13:14:43 +00001826 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Tarek Ziadé00002952010-04-03 08:37:59 +00001827 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001828 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00001829 Darwin/*)
1830 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1831 # This allows an extension to be used in any Python
Ronald Oussoren38f1b982007-09-02 09:46:07 +00001832
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001833 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
Jack Jansen6b08a402004-06-03 12:41:45 +00001834 then
Ronald Oussoren988117f2006-04-29 11:31:35 +00001835 if test "${enable_universalsdk}"; then
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001836 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001837 fi
Jack Jansen6b08a402004-06-03 12:41:45 +00001838 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
Tarek Ziadé00002952010-04-03 08:37:59 +00001839 LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle -undefined dynamic_lookup'
Jack Jansen6b08a402004-06-03 12:41:45 +00001840 BLDSHARED="$LDSHARED"
Jack Jansen6b08a402004-06-03 12:41:45 +00001841 else
1842 LDSHARED='$(CC) $(LDFLAGS) -bundle'
Tarek Ziadé00002952010-04-03 08:37:59 +00001843 LDCXXSHARED='$(CXX) $(LDFLAGS) -bundle'
Jack Jansen6b08a402004-06-03 12:41:45 +00001844 if test "$enable_framework" ; then
1845 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001846 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1847 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Tarek Ziadé00002952010-04-03 08:37:59 +00001848 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen6b08a402004-06-03 12:41:45 +00001849 else
1850 # No framework, use the Python app as bundle-loader
1851 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1852 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Tarek Ziadé00002952010-04-03 08:37:59 +00001853 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Jack Jansen6b08a402004-06-03 12:41:45 +00001854 fi
1855 fi
1856 ;;
Tarek Ziadé00002952010-04-03 08:37:59 +00001857 Linux*|GNU*|QNX*)
1858 LDSHARED='$(CC) -shared'
1859 LDCXXSHARED='$(CXX) -shared';;
1860 BSD/OS*/4*)
1861 LDSHARED="gcc -shared"
1862 LDCXXSHARED="g++ -shared";;
Martin v. Löwis222c5152006-06-03 07:37:13 +00001863 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +00001864 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +00001865 then
Benjamin Peterson3b2abe92010-03-14 15:06:14 +00001866 LDSHARED='$(CC) -shared ${LDFLAGS}'
Tarek Ziadé00002952010-04-03 08:37:59 +00001867 LDCXXSHARED='$(CXX) -shared ${LDFLAGS}'
Guido van Rossum0286ae82000-08-29 15:06:49 +00001868 else
1869 LDSHARED="ld -Bshareable ${LDFLAGS}"
1870 fi;;
Martin v. Löwis222c5152006-06-03 07:37:13 +00001871 OpenBSD*)
1872 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1873 then
1874 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
Tarek Ziadé00002952010-04-03 08:37:59 +00001875 LDCXXSHARED='$(CXX) -shared $(CCSHARED) ${LDFLAGS}'
Martin v. Löwis222c5152006-06-03 07:37:13 +00001876 else
1877 case `uname -r` in
1878 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
1879 LDSHARED="ld -Bshareable ${LDFLAGS}"
1880 ;;
1881 *)
1882 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
Tarek Ziadé00002952010-04-03 08:37:59 +00001883 LDCXXSHARED='$(CXX) -shared $(CCSHARED) ${LDFLAGS}'
Martin v. Löwis222c5152006-06-03 07:37:13 +00001884 ;;
1885 esac
1886 fi;;
Tarek Ziadé00002952010-04-03 08:37:59 +00001887 NetBSD*|DragonFly*)
1888 LDSHARED="cc -shared ${LDFLAGS}"
1889 LDCXXSHARED="c++ -shared ${LDFLAGS}";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001890 OpenUNIX*|UnixWare*)
Tarek Ziadé00002952010-04-03 08:37:59 +00001891 if test "$GCC" = "yes" ; then
1892 LDSHARED='$(CC) -shared'
1893 LDCXXSHARED='$(CXX) -shared'
1894 else
1895 LDSHARED='$(CC) -G'
1896 LDCXXSHARED='$(CXX) -G'
Martin v. Löwisbec19582001-03-21 15:57:54 +00001897 fi;;
Tarek Ziadé00002952010-04-03 08:37:59 +00001898 SCO_SV*)
1899 LDSHARED='$(CC) -Wl,-G,-Bexport'
1900 LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
1901 CYGWIN*)
1902 LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
1903 LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
1904 atheos*)
1905 LDSHARED="gcc -shared"
1906 LDCXXSHARED="g++ -shared";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001907 *) LDSHARED="ld";;
1908 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001909fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001910AC_MSG_RESULT($LDSHARED)
Tarek Ziadé00002952010-04-03 08:37:59 +00001911LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001912BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +00001913# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001914# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001915AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001916if test -z "$CCSHARED"
1917then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001918 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +00001919 SunOS*) if test "$GCC" = yes;
Martin v. Löwiseb623572007-03-12 10:50:39 +00001920 then CCSHARED="-fPIC";
1921 elif test `uname -p` = sparc;
1922 then CCSHARED="-xcode=pic32";
1923 else CCSHARED="-Kpic";
1924 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +00001925 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +00001926 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +00001927 else CCSHARED="+z";
1928 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001929 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001930 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001931 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001932 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001933 if test "$GCC" = "yes"
1934 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001935 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +00001936 fi;;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001937 SCO_SV*)
1938 if test "$GCC" = "yes"
1939 then CCSHARED="-fPIC"
1940 else CCSHARED="-Kpic -belf"
1941 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001942 IRIX*/6*) case $CC in
1943 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +00001944 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001945 esac;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001946 atheos*) CCSHARED="-fPIC";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001947 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001948fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001949AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001950# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +00001951# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001952AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001953if test -z "$LINKFORSHARED"
1954then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001955 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001956 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +00001957 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +00001958 LINKFORSHARED="-Wl,-E -Wl,+s";;
1959# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001960 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001961 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001962 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001963 Darwin/*)
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001964 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1965 # which is
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001966 # not used by the core itself but which needs to be in the core so
1967 # that dynamically loaded extension modules have access to it.
Jack Jansen97e3f002003-02-23 22:59:01 +00001968 # -prebind is no longer used, because it actually seems to give a
1969 # slowdown in stead of a speedup, maybe due to the large number of
1970 # dynamic loads Python does.
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001971
1972 LINKFORSHARED="$extra_undefs"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001973 if test "$enable_framework"
1974 then
Jack Jansenda49e192005-01-07 13:08:22 +00001975 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001976 fi
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001977 LINKFORSHARED="$LINKFORSHARED";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001978 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001979 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +00001980 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001981 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
Guido van Rossumdf693651999-01-07 21:50:41 +00001982 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1983 then
1984 LINKFORSHARED="-Wl,--export-dynamic"
1985 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001986 SunOS/5*) case $CC in
1987 *gcc*)
Martin v. Löwisa4548572002-04-18 14:51:36 +00001988 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +00001989 then
1990 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001991 fi;;
1992 esac;;
Jason Tishler30765592003-09-04 11:04:06 +00001993 CYGWIN*)
1994 if test $enable_shared = "no"
1995 then
1996 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1997 fi;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +00001998 QNX*)
1999 # -Wl,-E causes the symbols to be added to the dynamic
2000 # symbol table so that they can be found when a module
2001 # is loaded. -N 2048K causes the stack size to be set
2002 # to 2048 kilobytes so that the stack doesn't overflow
2003 # when running test_compile.py.
2004 LINKFORSHARED='-Wl,-E -N 2048K';;
Guido van Rossumac405f61994-09-12 10:56:06 +00002005 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00002006fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002007AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00002008
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002009
Neil Schemenauer61c51152001-01-26 16:18:16 +00002010AC_SUBST(CFLAGSFORSHARED)
2011AC_MSG_CHECKING(CFLAGSFORSHARED)
2012if test ! "$LIBRARY" = "$LDLIBRARY"
2013then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +00002014 case $ac_sys_system in
2015 CYGWIN*)
2016 # Cygwin needs CCSHARED when building extension DLLs
2017 # but not when building the interpreter DLL.
2018 CFLAGSFORSHARED='';;
2019 *)
2020 CFLAGSFORSHARED='$(CCSHARED)'
2021 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +00002022fi
2023AC_MSG_RESULT($CFLAGSFORSHARED)
2024
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002025# SHLIBS are libraries (except -lc and -lm) to link to the python shared
2026# library (with --enable-shared).
2027# For platforms on which shared libraries are not allowed to have unresolved
Martin v. Löwisd6359c52002-08-04 12:38:50 +00002028# symbols, this must be set to $(LIBS) (expanded by make). We do this even
2029# if it is not required, since it creates a dependency of the shared library
2030# to LIBS. This, in turn, means that applications linking the shared libpython
2031# don't need to link LIBS explicitly. The default should be only changed
2032# on systems where this approach causes problems.
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002033AC_SUBST(SHLIBS)
2034AC_MSG_CHECKING(SHLIBS)
2035case "$ac_sys_system" in
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002036 *)
Martin v. Löwisd6359c52002-08-04 12:38:50 +00002037 SHLIBS='$(LIBS)';;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002038esac
2039AC_MSG_RESULT($SHLIBS)
2040
2041
Guido van Rossum627b2d71993-12-24 10:39:16 +00002042# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002043AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
2044AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Martin v. Löwis519adae2003-09-20 10:47:47 +00002045
Skip Montanaro4d756af2008-12-01 01:55:22 +00002046# only check for sem_init if thread support is requested
Martin v. Löwis519adae2003-09-20 10:47:47 +00002047if test "$with_threads" = "yes" -o -z "$with_threads"; then
2048 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
2049 # posix4 on Solaris 2.6
2050 # pthread (first!) on Linux
2051fi
2052
Martin v. Löwis19d17342003-06-14 21:03:05 +00002053# check if we need libintl for locale functions
2054AC_CHECK_LIB(intl, textdomain,
2055 AC_DEFINE(WITH_LIBINTL, 1,
2056 [Define to 1 if libintl is needed for locale functions.]))
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002057
2058# checks for system dependent C++ extensions support
2059case "$ac_sys_system" in
2060 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
Matthias Klosec511b472010-05-08 11:01:39 +00002061 AC_LINK_IFELSE([
2062 AC_LANG_PROGRAM([[#include "/usr/lpp/xlC/include/load.h"]],
2063 [[loadAndInit("", 0, "")]])
2064 ],[
2065 AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002066 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
2067 and you want support for AIX C++ shared extension modules.])
Matthias Klosec511b472010-05-08 11:01:39 +00002068 AC_MSG_RESULT(yes)
2069 ],[
2070 AC_MSG_RESULT(no)
2071 ]);;
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002072 *) ;;
2073esac
2074
Guido van Rossum70c7f481998-03-26 18:44:10 +00002075# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002076# BeOS' sockets are stashed in libnet.
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002077AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002078AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Skip Montanarob9949db2004-01-17 04:04:13 +00002079
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00002080case "$ac_sys_system" in
2081BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002082AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
2083;;
2084esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00002085
Guido van Rossumc5a39031996-07-31 17:35:03 +00002086AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002087AC_ARG_WITH(libs,
Matthias Klose22520ea2010-05-08 10:14:46 +00002088 AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002089[
Guido van Rossumc5a39031996-07-31 17:35:03 +00002090AC_MSG_RESULT($withval)
2091LIBS="$withval $LIBS"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002092],
2093[AC_MSG_RESULT(no)])
Guido van Rossum627b2d71993-12-24 10:39:16 +00002094
Benjamin Petersone9e07bf2010-03-09 21:46:54 +00002095AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2096
Benjamin Peterson2c196742009-12-31 03:17:18 +00002097# Check for use of the system expat library
2098AC_MSG_CHECKING(for --with-system-expat)
2099AC_ARG_WITH(system_expat,
Matthias Klose22520ea2010-05-08 10:14:46 +00002100 AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]))
Benjamin Peterson2c196742009-12-31 03:17:18 +00002101
2102AC_MSG_RESULT($with_system_expat)
2103
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002104# Check for use of the system libffi library
2105AC_MSG_CHECKING(for --with-system-ffi)
2106AC_ARG_WITH(system_ffi,
Matthias Klose22520ea2010-05-08 10:14:46 +00002107 AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]))
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002108
Benjamin Petersone9e07bf2010-03-09 21:46:54 +00002109if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
Benjamin Peterson1c335e62010-01-01 15:16:29 +00002110 LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
2111else
2112 LIBFFI_INCLUDEDIR=""
2113fi
2114AC_SUBST(LIBFFI_INCLUDEDIR)
2115
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002116AC_MSG_RESULT($with_system_ffi)
2117
Matthias Klose10cbe482009-04-29 17:18:19 +00002118# Check for --with-dbmliborder
2119AC_MSG_CHECKING(for --with-dbmliborder)
2120AC_ARG_WITH(dbmliborder,
Matthias Klose22520ea2010-05-08 10:14:46 +00002121 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 +00002122[
2123if test x$with_dbmliborder = xyes
2124then
2125AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2126else
2127 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
2128 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
2129 then
2130 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2131 fi
2132 done
Matthias Klose61dbdb92009-04-29 20:09:50 +00002133fi])
2134AC_MSG_RESULT($with_dbmliborder)
Matthias Klose10cbe482009-04-29 17:18:19 +00002135
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002136# Determine if signalmodule should be used.
2137AC_SUBST(USE_SIGNAL_MODULE)
2138AC_SUBST(SIGNAL_OBJS)
2139AC_MSG_CHECKING(for --with-signal-module)
2140AC_ARG_WITH(signal-module,
Matthias Klose22520ea2010-05-08 10:14:46 +00002141 AS_HELP_STRING([--with-signal-module], [disable/enable signal module]))
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002142
2143if test -z "$with_signal_module"
2144then with_signal_module="yes"
2145fi
2146AC_MSG_RESULT($with_signal_module)
2147
2148if test "${with_signal_module}" = "yes"; then
2149 USE_SIGNAL_MODULE=""
2150 SIGNAL_OBJS=""
2151else
2152 USE_SIGNAL_MODULE="#"
2153 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2154fi
2155
Guido van Rossum3d15bd82001-01-10 18:53:48 +00002156# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00002157AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002158USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00002159
Guido van Rossum54d93d41997-01-22 20:51:58 +00002160AC_MSG_CHECKING(for --with-dec-threads)
2161AC_SUBST(LDLAST)
2162AC_ARG_WITH(dec-threads,
Matthias Klose22520ea2010-05-08 10:14:46 +00002163 AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002164[
Barry Warsawc0d24d82000-06-29 16:12:00 +00002165AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00002166LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00002167if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00002168 with_thread="$withval";
2169fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002170[AC_MSG_RESULT(no)])
Guido van Rossum54d93d41997-01-22 20:51:58 +00002171
Martin v. Löwis11437992002-04-12 09:54:03 +00002172# Templates for things AC_DEFINEd more than once.
2173# For a single AC_DEFINE, no template is needed.
2174AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2175AH_TEMPLATE(_REENTRANT,
2176 [Define to force use of thread-safe errno, h_errno, and other functions])
2177AH_TEMPLATE(WITH_THREAD,
2178 [Define if you want to compile in rudimentary thread support])
2179
Guido van Rossum54d93d41997-01-22 20:51:58 +00002180AC_MSG_CHECKING(for --with-threads)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002181dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawc0d24d82000-06-29 16:12:00 +00002182AC_ARG_WITH(threads,
Matthias Klose22520ea2010-05-08 10:14:46 +00002183 AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support]))
Guido van Rossum54d93d41997-01-22 20:51:58 +00002184
Barry Warsawc0d24d82000-06-29 16:12:00 +00002185# --with-thread is deprecated, but check for it anyway
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002186dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00002187AC_ARG_WITH(thread,
Matthias Klose22520ea2010-05-08 10:14:46 +00002188 AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002189 [with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002190
2191if test -z "$with_threads"
2192then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002193fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00002194AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00002195
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002196AC_SUBST(THREADOBJ)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002197if test "$with_threads" = "no"
2198then
2199 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002200elif test "$ac_cv_pthread_is_default" = yes
2201then
2202 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002203 # Defining _REENTRANT on system with POSIX threads should not hurt.
2204 AC_DEFINE(_REENTRANT)
2205 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002206 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00002207elif test "$ac_cv_kpthread" = "yes"
2208then
2209 CC="$CC -Kpthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002210 if test "$ac_cv_cxx_thread" = "yes"; then
2211 CXX="$CXX -Kpthread"
2212 fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00002213 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002214 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002215 THREADOBJ="Python/thread.o"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002216elif test "$ac_cv_kthread" = "yes"
2217then
2218 CC="$CC -Kthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002219 if test "$ac_cv_cxx_thread" = "yes"; then
2220 CXX="$CXX -Kthread"
2221 fi
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002222 AC_DEFINE(WITH_THREAD)
2223 posix_threads=yes
2224 THREADOBJ="Python/thread.o"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002225elif test "$ac_cv_pthread" = "yes"
2226then
2227 CC="$CC -pthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002228 if test "$ac_cv_cxx_thread" = "yes"; then
2229 CXX="$CXX -pthread"
2230 fi
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002231 AC_DEFINE(WITH_THREAD)
2232 posix_threads=yes
2233 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +00002234else
Martin v. Löwis130fb172001-07-19 11:00:41 +00002235 if test ! -z "$with_threads" -a -d "$with_threads"
2236 then LDFLAGS="$LDFLAGS -L$with_threads"
2237 fi
2238 if test ! -z "$withval" -a -d "$withval"
2239 then LDFLAGS="$LDFLAGS -L$withval"
2240 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002241
2242 # According to the POSIX spec, a pthreads implementation must
Matthias Klosea2542be2004-08-16 11:35:51 +00002243 # define _POSIX_THREADS in unistd.h. Some apparently don't
2244 # (e.g. gnu pth with pthread emulation)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002245 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2246 AC_EGREP_CPP(yes,
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002247 [
2248#include <unistd.h>
2249#ifdef _POSIX_THREADS
2250yes
2251#endif
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002252 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2253 AC_MSG_RESULT($unistd_defines_pthreads)
2254
Martin v. Löwis130fb172001-07-19 11:00:41 +00002255 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002256 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2257 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002258 AC_DEFINE(HURD_C_THREADS, 1,
2259 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002260 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002261 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002262 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2263 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002264 AC_DEFINE(MACH_C_THREADS, 1,
2265 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002266 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002267 AC_MSG_CHECKING(for --with-pth)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002268 AC_ARG_WITH([pth],
Matthias Klose22520ea2010-05-08 10:14:46 +00002269 AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002270 [AC_MSG_RESULT($withval)
2271 AC_DEFINE([WITH_THREAD])
2272 AC_DEFINE([HAVE_PTH], 1,
2273 [Define if you have GNU PTH threads.])
2274 LIBS="-lpth $LIBS"
2275 THREADOBJ="Python/thread.o"],
2276 [AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002277
2278 # Just looking for pthread_create in libpthread is not enough:
2279 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2280 # So we really have to include pthread.h, and then link.
2281 _libs=$LIBS
2282 LIBS="$LIBS -lpthread"
2283 AC_MSG_CHECKING([for pthread_create in -lpthread])
Matthias Klosec511b472010-05-08 11:01:39 +00002284 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002285
Matthias Klosec511b472010-05-08 11:01:39 +00002286void * start_routine (void *arg) { exit (0); }]], [[
2287pthread_create (NULL, NULL, start_routine, NULL)]])],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002288 AC_MSG_RESULT(yes)
2289 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002290 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002291 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002292 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00002293 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002294 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002295 THREADOBJ="Python/thread.o"],[
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002296 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2297 AC_DEFINE(ATHEOS_THREADS, 1,
2298 [Define this if you have AtheOS threads.])
2299 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002300 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002301 AC_DEFINE(BEOS_THREADS, 1,
2302 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002303 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002304 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002305 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002306 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002307 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002308 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002309 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002310 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002311 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002312 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002313 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002314 LIBS="$LIBS -lpthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002315 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002316 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002317 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002318 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002319 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002320 USE_THREAD_MODULE="#"])
Skip Montanarof8712e52004-01-17 03:04:46 +00002321 ])])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002322
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002323 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2324 LIBS="$LIBS -lmpc"
2325 THREADOBJ="Python/thread.o"
2326 USE_THREAD_MODULE=""])
2327
2328 if test "$posix_threads" != "yes"; then
2329 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2330 LIBS="$LIBS -lthread"
2331 THREADOBJ="Python/thread.o"
2332 USE_THREAD_MODULE=""])
2333 fi
2334
2335 if test "$USE_THREAD_MODULE" != "#"
2336 then
2337 # If the above checks didn't disable threads, (at least) OSF1
2338 # needs this '-threads' argument during linking.
2339 case $ac_sys_system in
2340 OSF1) LDLAST=-threads;;
2341 esac
2342 fi
2343fi
2344
2345if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002346 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002347 AC_DEFINE(_POSIX_THREADS, 1,
2348 [Define if you have POSIX threads,
2349 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002350 fi
2351
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002352 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2353 case $ac_sys_system/$ac_sys_release in
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002354 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002355 [Defined for Solaris 2.6 bug in pthread header.])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002356 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002357 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002358 [Define if the Posix semaphores do not work on your system])
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002359 ;;
Christian Heimescba36bb2008-01-30 22:54:18 +00002360 AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Matthias Klose5183ebd2010-04-24 16:38:36 +00002361 [Define if the Posix semaphores do not work on your system])
Christian Heimescba36bb2008-01-30 22:54:18 +00002362 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002363 esac
2364
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002365 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2366 AC_CACHE_VAL(ac_cv_pthread_system_supported,
Matthias Klosec511b472010-05-08 11:01:39 +00002367 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <pthread.h>
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002368 void *foo(void *parm) {
2369 return NULL;
2370 }
2371 main() {
2372 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002373 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002374 if (pthread_attr_init(&attr)) exit(-1);
2375 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002376 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002377 exit(0);
Matthias Klosec511b472010-05-08 11:01:39 +00002378 }]])],
2379 [ac_cv_pthread_system_supported=yes],
2380 [ac_cv_pthread_system_supported=no],
2381 [ac_cv_pthread_system_supported=no])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002382 ])
2383 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2384 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002385 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002386 fi
Jason Tishlerfac083d2003-07-22 15:20:49 +00002387 AC_CHECK_FUNCS(pthread_sigmask,
2388 [case $ac_sys_system in
2389 CYGWIN*)
2390 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2391 [Define if pthread_sigmask() does not work on your system.])
2392 ;;
2393 esac])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002394fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002395
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002396
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002397# Check for enable-ipv6
Martin v. Löwis11437992002-04-12 09:54:03 +00002398AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002399AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002400AC_ARG_ENABLE(ipv6,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002401[ --enable-ipv6 Enable ipv6 (with ipv4) support
2402 --disable-ipv6 Disable ipv6 support],
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002403[ case "$enableval" in
2404 no)
2405 AC_MSG_RESULT(no)
2406 ipv6=no
2407 ;;
2408 *) AC_MSG_RESULT(yes)
2409 AC_DEFINE(ENABLE_IPV6)
2410 ipv6=yes
2411 ;;
2412 esac ],
2413
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002414[
2415dnl the check does not work on cross compilation case...
Matthias Klosec511b472010-05-08 11:01:39 +00002416 AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* AF_INET6 available check */
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002417#include <sys/types.h>
2418#include <sys/socket.h>
2419main()
2420{
2421 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
2422 exit(1);
2423 else
2424 exit(0);
2425}
Matthias Klosec511b472010-05-08 11:01:39 +00002426]])],[
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002427 AC_MSG_RESULT(yes)
Matthias Klosec511b472010-05-08 11:01:39 +00002428 ipv6=yes
2429],[
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002430 AC_MSG_RESULT(no)
2431 ipv6=no
Matthias Klosec511b472010-05-08 11:01:39 +00002432],[
2433 AC_MSG_RESULT(no)
2434 ipv6=no
2435])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002436
2437if test "$ipv6" = "yes"; then
2438 AC_MSG_CHECKING(if RFC2553 API is available)
Matthias Klosec511b472010-05-08 11:01:39 +00002439 AC_COMPILE_IFELSE([
2440 AC_LANG_PROGRAM([[#include <sys/types.h>
2441#include <netinet/in.h>]],
2442 [[struct sockaddr_in6 x;
2443 x.sin6_scope_id;]])
2444 ],[
2445 AC_MSG_RESULT(yes)
2446 ipv6=yes
2447 ],[
2448 AC_MSG_RESULT(no, IPv6 disabled)
2449 ipv6=no
2450 ])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002451fi
2452
2453if test "$ipv6" = "yes"; then
2454 AC_DEFINE(ENABLE_IPV6)
2455fi
2456])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002457
2458ipv6type=unknown
2459ipv6lib=none
2460ipv6trylibc=no
2461
2462if test "$ipv6" = "yes"; then
2463 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00002464 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2465 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002466 case $i in
2467 inria)
2468 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002469 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002470#include <netinet/in.h>
2471#ifdef IPV6_INRIA_VERSION
2472yes
2473#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002474 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002475 ;;
2476 kame)
2477 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002478 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002479#include <netinet/in.h>
2480#ifdef __KAME__
2481yes
2482#endif],
2483 [ipv6type=$i;
2484 ipv6lib=inet6
2485 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002486 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002487 ;;
2488 linux-glibc)
2489 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002490 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002491#include <features.h>
2492#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2493yes
2494#endif],
2495 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002496 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002497 ;;
2498 linux-inet6)
2499 dnl http://www.v6.linux.or.jp/
2500 if test -d /usr/inet6; then
2501 ipv6type=$i
2502 ipv6lib=inet6
2503 ipv6libdir=/usr/inet6/lib
Skip Montanarodecc6a42003-01-01 20:07:49 +00002504 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002505 fi
2506 ;;
2507 solaris)
2508 if test -f /etc/netconfig; then
2509 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
2510 ipv6type=$i
2511 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002512 fi
2513 fi
2514 ;;
2515 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002516 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002517#include <sys/param.h>
2518#ifdef _TOSHIBA_INET6
2519yes
2520#endif],
2521 [ipv6type=$i;
2522 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002523 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002524 ;;
2525 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002526 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002527#include </usr/local/v6/include/sys/v6config.h>
2528#ifdef __V6D__
2529yes
2530#endif],
2531 [ipv6type=$i;
2532 ipv6lib=v6;
2533 ipv6libdir=/usr/local/v6/lib;
Skip Montanarodecc6a42003-01-01 20:07:49 +00002534 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002535 ;;
2536 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002537 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002538#include <sys/param.h>
2539#ifdef _ZETA_MINAMI_INET6
2540yes
2541#endif],
2542 [ipv6type=$i;
2543 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002544 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002545 ;;
2546 esac
2547 if test "$ipv6type" != "unknown"; then
2548 break
2549 fi
2550 done
2551 AC_MSG_RESULT($ipv6type)
2552fi
2553
2554if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2555 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2556 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2557 echo "using lib$ipv6lib"
2558 else
2559 if test $ipv6trylibc = "yes"; then
2560 echo "using libc"
2561 else
2562 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2563 echo "You need to fetch lib$ipv6lib.a from appropriate"
2564 echo 'ipv6 kit and compile beforehand.'
2565 exit 1
2566 fi
2567 fi
2568fi
2569
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002570AC_MSG_CHECKING(for OSX 10.5 SDK or later)
Matthias Klosec511b472010-05-08 11:01:39 +00002571AC_COMPILE_IFELSE([
Mark Dickinson0712b562010-05-08 19:13:21 +00002572 AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
Matthias Klosec511b472010-05-08 11:01:39 +00002573],[
Matthias Klose5183ebd2010-04-24 16:38:36 +00002574 AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.])
Matthias Klosec511b472010-05-08 11:01:39 +00002575 AC_MSG_RESULT(yes)
2576],[
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002577 AC_MSG_RESULT(no)
Matthias Klosec511b472010-05-08 11:01:39 +00002578])
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002579
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002580# Check for --with-doc-strings
2581AC_MSG_CHECKING(for --with-doc-strings)
2582AC_ARG_WITH(doc-strings,
Matthias Klose22520ea2010-05-08 10:14:46 +00002583 AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings]))
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002584
2585if test -z "$with_doc_strings"
2586then with_doc_strings="yes"
2587fi
2588if test "$with_doc_strings" != "no"
2589then
2590 AC_DEFINE(WITH_DOC_STRINGS, 1,
2591 [Define if you want documentation strings in extension modules])
2592fi
2593AC_MSG_RESULT($with_doc_strings)
2594
Neil Schemenauera35c6882001-02-27 04:45:05 +00002595# Check for Python-specific malloc support
Martin v. Löwisf30d60e2004-06-08 08:17:44 +00002596AC_MSG_CHECKING(for --with-tsc)
2597AC_ARG_WITH(tsc,
Matthias Klose22520ea2010-05-08 10:14:46 +00002598 AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[
Martin v. Löwisf30d60e2004-06-08 08:17:44 +00002599if test "$withval" != no
2600then
2601 AC_DEFINE(WITH_TSC, 1,
2602 [Define to profile with the Pentium timestamp counter])
2603 AC_MSG_RESULT(yes)
2604else AC_MSG_RESULT(no)
2605fi],
2606[AC_MSG_RESULT(no)])
2607
2608# Check for Python-specific malloc support
Neil Schemenauera35c6882001-02-27 04:45:05 +00002609AC_MSG_CHECKING(for --with-pymalloc)
2610AC_ARG_WITH(pymalloc,
Matthias Klose22520ea2010-05-08 10:14:46 +00002611 AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs]))
Neil Schemenauer16c22972002-03-22 15:34:49 +00002612
2613if test -z "$with_pymalloc"
2614then with_pymalloc="yes"
2615fi
2616if test "$with_pymalloc" != "no"
2617then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002618 AC_DEFINE(WITH_PYMALLOC, 1,
2619 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00002620fi
2621AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00002622
Benjamin Peterson91c12eb2009-12-03 02:52:39 +00002623# Check for Valgrind support
2624AC_MSG_CHECKING([for --with-valgrind])
2625AC_ARG_WITH([valgrind],
Matthias Klose22520ea2010-05-08 10:14:46 +00002626 AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
Benjamin Peterson91c12eb2009-12-03 02:52:39 +00002627 with_valgrind=no)
2628AC_MSG_RESULT([$with_valgrind])
2629if test "$with_valgrind" != no; then
2630 AC_CHECK_HEADER([valgrind/valgrind.h],
2631 [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
2632 [AC_MSG_ERROR([Valgrind support requested but headers not available])]
2633 )
2634fi
2635
Barry Warsawef82cd72000-06-30 16:21:01 +00002636# Check for --with-wctype-functions
2637AC_MSG_CHECKING(for --with-wctype-functions)
2638AC_ARG_WITH(wctype-functions,
Matthias Klose22520ea2010-05-08 10:14:46 +00002639 AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002640[
Barry Warsawef82cd72000-06-30 16:21:01 +00002641if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002642then
2643 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2644 [Define if you want wctype.h functions to be used instead of the
2645 one supplied by Python itself. (see Include/unicodectype.h).])
2646 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00002647else AC_MSG_RESULT(no)
2648fi],
2649[AC_MSG_RESULT(no)])
2650
Guido van Rossum68242b51996-05-28 22:53:03 +00002651# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002652AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00002653DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002654
Guido van Rossume97ee181999-12-20 21:27:22 +00002655# the dlopen() function means we might want to use dynload_shlib.o. some
2656# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00002657AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00002658
2659# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2660# loading of modules.
2661AC_SUBST(DYNLOADFILE)
2662AC_MSG_CHECKING(DYNLOADFILE)
2663if test -z "$DYNLOADFILE"
2664then
2665 case $ac_sys_system/$ac_sys_release in
Martin v. Löwisc19c5a62003-11-18 20:00:44 +00002666 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2667 if test "$ac_cv_func_dlopen" = yes
2668 then DYNLOADFILE="dynload_shlib.o"
2669 else DYNLOADFILE="dynload_aix.o"
2670 fi
2671 ;;
Guido van Rossume97ee181999-12-20 21:27:22 +00002672 BeOS*) DYNLOADFILE="dynload_beos.o";;
2673 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Anthony Baxter82201742006-04-09 15:07:40 +00002674 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2675 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002676 atheos*) DYNLOADFILE="dynload_atheos.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00002677 *)
2678 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2679 # out any dynamic loading
2680 if test "$ac_cv_func_dlopen" = yes
2681 then DYNLOADFILE="dynload_shlib.o"
2682 else DYNLOADFILE="dynload_stub.o"
2683 fi
2684 ;;
2685 esac
2686fi
2687AC_MSG_RESULT($DYNLOADFILE)
2688if test "$DYNLOADFILE" != "dynload_stub.o"
2689then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002690 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2691 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00002692fi
2693
Jack Jansenc49e5b72001-06-19 15:00:23 +00002694# MACHDEP_OBJS can be set to platform-specific object files needed by Python
2695
2696AC_SUBST(MACHDEP_OBJS)
2697AC_MSG_CHECKING(MACHDEP_OBJS)
2698if test -z "$MACHDEP_OBJS"
2699then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002700 MACHDEP_OBJS=$extra_machdep_objs
2701else
2702 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00002703fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002704AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00002705
Guido van Rossum627b2d71993-12-24 10:39:16 +00002706# checks for library functions
Martin v. Löwisaef18b12008-03-24 13:31:16 +00002707AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2708 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
Martin v. Löwis438b5342002-12-27 10:16:42 +00002709 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00002710 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
Antoine Pitrou30b3b352009-12-02 20:37:54 +00002711 initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime \
Martin v. Löwisa5f09072002-10-11 05:37:59 +00002712 mremap nice pathconf pause plock poll pthread_init \
Guido van Rossum162e38c2003-02-19 15:25:10 +00002713 putenv readlink realpath \
Jesse Noller355b1262009-04-02 00:03:28 +00002714 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
2715 setgid \
Martin v. Löwis4daacb12003-03-28 18:37:01 +00002716 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00002717 setlocale setregid setreuid setresuid setresgid \
2718 setsid setpgid setpgrp setuid setvbuf snprintf \
Skip Montanaro7e11a012004-02-07 12:55:46 +00002719 sigaction siginterrupt sigrelse strftime \
Michael W. Hudson34f20ea2002-05-27 15:08:24 +00002720 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Neal Norwitz05a45592006-03-20 06:30:08 +00002721 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00002722
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002723# For some functions, having a definition is not sufficient, since
2724# we want to take their address.
2725AC_MSG_CHECKING(for chroot)
Matthias Klosec511b472010-05-08 11:01:39 +00002726AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])],
2727 [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2728 AC_MSG_RESULT(yes)],
2729 [AC_MSG_RESULT(no)
2730])
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002731AC_MSG_CHECKING(for link)
Matthias Klosec511b472010-05-08 11:01:39 +00002732AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])],
2733 [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2734 AC_MSG_RESULT(yes)],
2735 [AC_MSG_RESULT(no)
2736])
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002737AC_MSG_CHECKING(for symlink)
Matthias Klosec511b472010-05-08 11:01:39 +00002738AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])],
2739 [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2740 AC_MSG_RESULT(yes)],
2741 [AC_MSG_RESULT(no)
2742])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002743AC_MSG_CHECKING(for fchdir)
Matthias Klosec511b472010-05-08 11:01:39 +00002744AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])],
2745 [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2746 AC_MSG_RESULT(yes)],
2747 [AC_MSG_RESULT(no)
2748])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002749AC_MSG_CHECKING(for fsync)
Matthias Klosec511b472010-05-08 11:01:39 +00002750AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])],
2751 [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2752 AC_MSG_RESULT(yes)],
2753 [AC_MSG_RESULT(no)
2754])
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002755AC_MSG_CHECKING(for fdatasync)
Matthias Klosec511b472010-05-08 11:01:39 +00002756AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])],
2757 [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2758 AC_MSG_RESULT(yes)],
2759 [AC_MSG_RESULT(no)
2760])
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00002761AC_MSG_CHECKING(for epoll)
Matthias Klosec511b472010-05-08 11:01:39 +00002762AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])],
2763 [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2764 AC_MSG_RESULT(yes)],
2765 [AC_MSG_RESULT(no)
2766])
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00002767AC_MSG_CHECKING(for kqueue)
Matthias Klosec511b472010-05-08 11:01:39 +00002768AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00002769#include <sys/types.h>
2770#include <sys/event.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002771 ]], [[int x=kqueue()]])],
2772 [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2773 AC_MSG_RESULT(yes)],
2774 [AC_MSG_RESULT(no)
2775])
Martin v. Löwisd5843682002-11-21 20:41:28 +00002776# On some systems (eg. FreeBSD 5), we would find a definition of the
2777# functions ctermid_r, setgroups in the library, but no prototype
2778# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2779# address to avoid compiler warnings and potential miscompilations
2780# because of the missing prototypes.
2781
2782AC_MSG_CHECKING(for ctermid_r)
Matthias Klosec511b472010-05-08 11:01:39 +00002783AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisd5843682002-11-21 20:41:28 +00002784#include "confdefs.h"
2785#include <stdio.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002786]], [[void* p = ctermid_r]])],
2787 [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2788 AC_MSG_RESULT(yes)],
2789 [AC_MSG_RESULT(no)
2790])
Martin v. Löwisd5843682002-11-21 20:41:28 +00002791
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00002792AC_MSG_CHECKING(for flock)
Matthias Klosec511b472010-05-08 11:01:39 +00002793AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00002794#include "confdefs.h"
2795#include <sys/file.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002796]], [[void* p = flock]])],
2797 [AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2798 AC_MSG_RESULT(yes)],
2799 [AC_MSG_RESULT(no)
2800])
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00002801
2802AC_MSG_CHECKING(for getpagesize)
Matthias Klosec511b472010-05-08 11:01:39 +00002803AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00002804#include "confdefs.h"
2805#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 "confdefs.h"
2896#include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002897]], [[void* p = hstrerror; hstrerror(0)]])],
2898 [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2899 AC_MSG_RESULT(yes)],
2900 [AC_MSG_RESULT(no)
2901])
Martin v. Löwise9416172003-05-03 10:12:45 +00002902
2903AC_MSG_CHECKING(for inet_aton)
Matthias Klosec511b472010-05-08 11:01:39 +00002904AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwise9416172003-05-03 10:12:45 +00002905#include "confdefs.h"
Martin v. Löwis86d66262006-02-17 08:40:11 +00002906#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00002907#include <sys/socket.h>
2908#include <netinet/in.h>
2909#include <arpa/inet.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002910]], [[void* p = inet_aton;inet_aton(0,0)]])],
2911 [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2912 AC_MSG_RESULT(yes)],
2913 [AC_MSG_RESULT(no)
2914])
Martin v. Löwise9416172003-05-03 10:12:45 +00002915
2916AC_MSG_CHECKING(for inet_pton)
Matthias Klosec511b472010-05-08 11:01:39 +00002917AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwise9416172003-05-03 10:12:45 +00002918#include "confdefs.h"
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00002919#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00002920#include <sys/socket.h>
2921#include <netinet/in.h>
2922#include <arpa/inet.h>
Matthias Klosec511b472010-05-08 11:01:39 +00002923]], [[void* p = inet_pton]])],
2924 [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2925 AC_MSG_RESULT(yes)],
2926 [AC_MSG_RESULT(no)
2927])
Martin v. Löwise9416172003-05-03 10:12:45 +00002928
Martin v. Löwisd6640d42003-07-06 09:29:52 +00002929# On some systems, setgroups is in unistd.h, on others, in grp.h
Martin v. Löwisd5843682002-11-21 20:41:28 +00002930AC_MSG_CHECKING(for setgroups)
Matthias Klosec511b472010-05-08 11:01:39 +00002931AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisd5843682002-11-21 20:41:28 +00002932#include "confdefs.h"
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00002933#include <unistd.h>
Martin v. Löwisd6640d42003-07-06 09:29:52 +00002934#ifdef HAVE_GRP_H
2935#include <grp.h>
2936#endif
Matthias Klosec511b472010-05-08 11:01:39 +00002937]], [[void* p = setgroups]])],
2938 [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2939 AC_MSG_RESULT(yes)],
2940 [AC_MSG_RESULT(no)
2941])
Martin v. Löwisd5843682002-11-21 20:41:28 +00002942
Fred Drake8cef4cf2000-06-28 16:40:38 +00002943# check for openpty and forkpty
2944
Martin v. Löwisfd9a72a2006-01-08 10:07:33 +00002945AC_CHECK_FUNCS(openpty,,
2946 AC_CHECK_LIB(util,openpty,
2947 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2948 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2949 )
2950)
2951AC_CHECK_FUNCS(forkpty,,
2952 AC_CHECK_LIB(util,forkpty,
2953 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2954 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2955 )
2956)
Fred Drake8cef4cf2000-06-28 16:40:38 +00002957
Brett Cannonaa5778d2008-03-18 04:09:00 +00002958# Stuff for expat.
2959AC_CHECK_FUNCS(memmove)
2960
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00002961# check for long file support functions
2962AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2963
Brett Cannonaa5778d2008-03-18 04:09:00 +00002964AC_REPLACE_FUNCS(dup2 getcwd strdup)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002965AC_CHECK_FUNCS(getpgrp,
Matthias Klosec511b472010-05-08 11:01:39 +00002966 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
2967 [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
2968 [])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002969)
Jack Jansen150753c2003-03-29 22:07:47 +00002970AC_CHECK_FUNCS(setpgrp,
Matthias Klosec511b472010-05-08 11:01:39 +00002971 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])],
2972 [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])],
2973 [])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002974)
2975AC_CHECK_FUNCS(gettimeofday,
Matthias Klosec511b472010-05-08 11:01:39 +00002976 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]],
2977 [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])],
2978 [],
2979 [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2980 [Define if gettimeofday() does not have second (timezone) argument
2981 This is the case on Motorola V4 (R40V4.2)])
2982 ])
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002983)
Guido van Rossum627b2d71993-12-24 10:39:16 +00002984
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002985AC_MSG_CHECKING(for major, minor, and makedev)
Matthias Klosec511b472010-05-08 11:01:39 +00002986AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002987#if defined(MAJOR_IN_MKDEV)
2988#include <sys/mkdev.h>
2989#elif defined(MAJOR_IN_SYSMACROS)
2990#include <sys/sysmacros.h>
2991#else
2992#include <sys/types.h>
2993#endif
Matthias Klosec511b472010-05-08 11:01:39 +00002994]], [[
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002995 makedev(major(0),minor(0));
Matthias Klosec511b472010-05-08 11:01:39 +00002996]])],[
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002997 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2998 [Define to 1 if you have the device macros.])
2999 AC_MSG_RESULT(yes)
3000],[
3001 AC_MSG_RESULT(no)
3002])
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003003
3004# On OSF/1 V5.1, getaddrinfo is available, but a define
3005# for [no]getaddrinfo in netdb.h.
3006AC_MSG_CHECKING(for getaddrinfo)
Matthias Klosec511b472010-05-08 11:01:39 +00003007AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00003008#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003009#include <sys/socket.h>
3010#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00003011#include <stdio.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003012]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],
3013[have_getaddrinfo=yes],
3014[have_getaddrinfo=no])
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003015AC_MSG_RESULT($have_getaddrinfo)
3016if test $have_getaddrinfo = yes
3017then
3018 AC_MSG_CHECKING(getaddrinfo bug)
3019 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
Matthias Klosec511b472010-05-08 11:01:39 +00003020 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003021#include <sys/types.h>
3022#include <netdb.h>
3023#include <string.h>
3024#include <sys/socket.h>
3025#include <netinet/in.h>
3026
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003027int main()
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003028{
3029 int passive, gaierr, inet4 = 0, inet6 = 0;
3030 struct addrinfo hints, *ai, *aitop;
3031 char straddr[INET6_ADDRSTRLEN], strport[16];
3032
3033 for (passive = 0; passive <= 1; passive++) {
3034 memset(&hints, 0, sizeof(hints));
3035 hints.ai_family = AF_UNSPEC;
3036 hints.ai_flags = passive ? AI_PASSIVE : 0;
3037 hints.ai_socktype = SOCK_STREAM;
Hye-Shik Chang54f94392004-04-14 07:55:31 +00003038 hints.ai_protocol = IPPROTO_TCP;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003039 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
3040 (void)gai_strerror(gaierr);
3041 goto bad;
3042 }
3043 for (ai = aitop; ai; ai = ai->ai_next) {
3044 if (ai->ai_addr == NULL ||
3045 ai->ai_addrlen == 0 ||
3046 getnameinfo(ai->ai_addr, ai->ai_addrlen,
3047 straddr, sizeof(straddr), strport, sizeof(strport),
3048 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
3049 goto bad;
3050 }
3051 switch (ai->ai_family) {
3052 case AF_INET:
3053 if (strcmp(strport, "54321") != 0) {
3054 goto bad;
3055 }
3056 if (passive) {
3057 if (strcmp(straddr, "0.0.0.0") != 0) {
3058 goto bad;
3059 }
3060 } else {
3061 if (strcmp(straddr, "127.0.0.1") != 0) {
3062 goto bad;
3063 }
3064 }
3065 inet4++;
3066 break;
3067 case AF_INET6:
3068 if (strcmp(strport, "54321") != 0) {
3069 goto bad;
3070 }
3071 if (passive) {
3072 if (strcmp(straddr, "::") != 0) {
3073 goto bad;
3074 }
3075 } else {
3076 if (strcmp(straddr, "::1") != 0) {
3077 goto bad;
3078 }
3079 }
3080 inet6++;
3081 break;
3082 case AF_UNSPEC:
3083 goto bad;
3084 break;
3085 default:
3086 /* another family support? */
3087 break;
3088 }
3089 }
3090 }
3091
3092 if (!(inet4 == 0 || inet4 == 2))
3093 goto bad;
3094 if (!(inet6 == 0 || inet6 == 2))
3095 goto bad;
3096
3097 if (aitop)
3098 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003099 return 0;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003100
3101 bad:
3102 if (aitop)
3103 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003104 return 1;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003105}
Matthias Klosec511b472010-05-08 11:01:39 +00003106]]])],
3107[ac_cv_buggy_getaddrinfo=no],
3108[ac_cv_buggy_getaddrinfo=yes],
3109[ac_cv_buggy_getaddrinfo=yes]))
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003110fi
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003111
Mark Dickinson0ef0b912009-12-31 21:11:48 +00003112if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003113then
3114 if test $ipv6 = yes
3115 then
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003116 echo 'Fatal: You must get working getaddrinfo() function.'
3117 echo ' or you can specify "--disable-ipv6"'.
3118 exit 1
3119 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003120else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003121 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003122fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00003123AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003124
Guido van Rossum627b2d71993-12-24 10:39:16 +00003125# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003126AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00003127AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003128AC_STRUCT_TIMEZONE
Martin v. Löwis60a5d722002-10-16 20:28:25 +00003129AC_CHECK_MEMBERS([struct stat.st_rdev])
3130AC_CHECK_MEMBERS([struct stat.st_blksize])
Hye-Shik Chang5f937a72005-06-02 13:09:30 +00003131AC_CHECK_MEMBERS([struct stat.st_flags])
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00003132AC_CHECK_MEMBERS([struct stat.st_gen])
3133AC_CHECK_MEMBERS([struct stat.st_birthtime])
Guido van Rossum98bf58f2001-10-18 20:34:25 +00003134AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003135
3136AC_MSG_CHECKING(for time.h that defines altzone)
Matthias Klosec511b472010-05-08 11:01:39 +00003137AC_CACHE_VAL(ac_cv_header_time_altzone,[
3138 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])],
3139 [ac_cv_header_time_altzone=yes],
3140 [ac_cv_header_time_altzone=no])
3141 ])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003142AC_MSG_RESULT($ac_cv_header_time_altzone)
3143if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003144 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003145fi
3146
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003147was_it_defined=no
3148AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Matthias Klosec511b472010-05-08 11:01:39 +00003149AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003150#include <sys/types.h>
3151#include <sys/select.h>
3152#include <sys/time.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003153]], [[;]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003154 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
3155 [Define if you can safely include both <sys/select.h> and <sys/time.h>
3156 (which you can't on SCO ODT 3.0).])
3157 was_it_defined=yes
Matthias Klosec511b472010-05-08 11:01:39 +00003158],[])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003159AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00003160
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003161AC_MSG_CHECKING(for addrinfo)
3162AC_CACHE_VAL(ac_cv_struct_addrinfo,
Matthias Klosec511b472010-05-08 11:01:39 +00003163AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
3164 [ac_cv_struct_addrinfo=yes],
3165 [ac_cv_struct_addrinfo=no]))
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003166AC_MSG_RESULT($ac_cv_struct_addrinfo)
3167if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003168 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003169fi
3170
3171AC_MSG_CHECKING(for sockaddr_storage)
3172AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
Matthias Klosec511b472010-05-08 11:01:39 +00003173AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003174# include <sys/types.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003175# include <sys/socket.h>]], [[struct sockaddr_storage s]])],
3176 [ac_cv_struct_sockaddr_storage=yes],
3177 [ac_cv_struct_sockaddr_storage=no]))
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003178AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3179if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003180 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003181fi
3182
Guido van Rossum627b2d71993-12-24 10:39:16 +00003183# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003184
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003185AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003186AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003187
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003188works=no
3189AC_MSG_CHECKING(for working volatile)
Matthias Klosec511b472010-05-08 11:01:39 +00003190AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])],
3191 [works=yes],
3192 [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])]
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003193)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003194AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00003195
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003196works=no
3197AC_MSG_CHECKING(for working signed char)
Matthias Klosec511b472010-05-08 11:01:39 +00003198AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])],
3199 [works=yes],
3200 [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])]
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003201)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003202AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003203
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003204have_prototypes=no
3205AC_MSG_CHECKING(for prototypes)
Matthias Klosec511b472010-05-08 11:01:39 +00003206AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])],
3207 [AC_DEFINE(HAVE_PROTOTYPES, 1,
3208 [Define if your compiler supports function prototype])
3209 have_prototypes=yes],
3210 []
3211)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003212AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003213
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003214works=no
3215AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Matthias Klosec511b472010-05-08 11:01:39 +00003216AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003217#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00003218int foo(int x, ...) {
3219 va_list va;
3220 va_start(va, x);
3221 va_arg(va, int);
3222 va_arg(va, char *);
3223 va_arg(va, double);
3224 return 0;
3225}
Matthias Klosec511b472010-05-08 11:01:39 +00003226]], [[return foo(10, "", 3.14);]])],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003227 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3228 [Define if your compiler supports variable length function prototypes
3229 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3230 works=yes
Matthias Klosec511b472010-05-08 11:01:39 +00003231],[])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003232AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003233
Dave Cole331708b2004-08-09 04:51:41 +00003234# check for socketpair
3235AC_MSG_CHECKING(for socketpair)
Matthias Klosec511b472010-05-08 11:01:39 +00003236AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Dave Cole331708b2004-08-09 04:51:41 +00003237#include <sys/types.h>
3238#include <sys/socket.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003239]], [[void *x=socketpair]])],
3240 [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.])
3241 AC_MSG_RESULT(yes)],
3242 [AC_MSG_RESULT(no)]
Dave Cole331708b2004-08-09 04:51:41 +00003243)
3244
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003245# check if sockaddr has sa_len member
3246AC_MSG_CHECKING(if sockaddr has sa_len member)
Matthias Klosec511b472010-05-08 11:01:39 +00003247AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3248#include <sys/socket.h>]], [[struct sockaddr x;
3249x.sa_len = 0;]])],
3250 [AC_MSG_RESULT(yes)
3251 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])],
3252 [AC_MSG_RESULT(no)]
3253)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003254
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003255va_list_is_array=no
3256AC_MSG_CHECKING(whether va_list is an array)
Matthias Klosec511b472010-05-08 11:01:39 +00003257AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003258#ifdef HAVE_STDARG_PROTOTYPES
3259#include <stdarg.h>
3260#else
3261#include <varargs.h>
3262#endif
Matthias Klosec511b472010-05-08 11:01:39 +00003263]], [[va_list list1, list2; list1 = list2;]])],[],[
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003264 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3265 va_list_is_array=yes
3266])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003267AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003268
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003269# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
Martin v. Löwis11437992002-04-12 09:54:03 +00003270AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3271 [Define this if you have some version of gethostbyname_r()])
3272
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003273AC_CHECK_FUNC(gethostbyname_r, [
3274 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3275 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3276 OLD_CFLAGS=$CFLAGS
3277 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
Matthias Klosec511b472010-05-08 11:01:39 +00003278 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003279# include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003280 ]], [[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003281 char *name;
3282 struct hostent *he, *res;
3283 char buffer[2048];
3284 int buflen = 2048;
3285 int h_errnop;
3286
3287 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
Matthias Klosec511b472010-05-08 11:01:39 +00003288 ]])],[
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003289 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003290 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3291 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003292 AC_MSG_RESULT(yes)
Matthias Klosec511b472010-05-08 11:01:39 +00003293 ],[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003294 AC_MSG_RESULT(no)
3295 AC_MSG_CHECKING([gethostbyname_r with 5 args])
Matthias Klosec511b472010-05-08 11:01:39 +00003296 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003297# include <netdb.h>
Matthias Klosec511b472010-05-08 11:01:39 +00003298 ]], [[
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003299 char *name;
3300 struct hostent *he;
Matthias Klosec511b472010-05-08 11:01:39 +00003301 char buffer[2048];
3302 int buflen = 2048;
3303 int h_errnop;
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003304
Matthias Klosec511b472010-05-08 11:01:39 +00003305 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3306 ]])],
3307 [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003308 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Matthias Klosec511b472010-05-08 11:01:39 +00003309 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3310 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003311 AC_MSG_RESULT(yes)
3312 ], [
3313 AC_MSG_RESULT(no)
Matthias Klosec511b472010-05-08 11:01:39 +00003314 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3315 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3316# include <netdb.h>
3317 ]], [[
3318 char *name;
3319 struct hostent *he;
3320 struct hostent_data data;
3321
3322 (void) gethostbyname_r(name, he, &data);
3323 ]])],
3324 [
3325 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3326 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3327 [Define this if you have the 3-arg version of gethostbyname_r().])
3328 AC_MSG_RESULT(yes)
3329 ], [
3330 AC_MSG_RESULT(no)
3331 ])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003332 ])
3333 ])
3334 CFLAGS=$OLD_CFLAGS
3335], [
Thomas Wouters3a584202000-08-05 23:28:51 +00003336 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003337])
3338AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3339AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3340AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003341AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003342AC_SUBST(HAVE_GETHOSTBYNAME)
3343
Guido van Rossum627b2d71993-12-24 10:39:16 +00003344# checks for system services
3345# (none yet)
3346
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003347# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00003348AC_CHECK_FUNC(__fpu_control,
3349 [],
3350 [AC_CHECK_LIB(ieee, __fpu_control)
3351])
Guido van Rossum627b2d71993-12-24 10:39:16 +00003352
Guido van Rossum93274221997-05-09 02:42:00 +00003353# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00003354AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00003355AC_ARG_WITH(fpectl,
Matthias Klose22520ea2010-05-08 10:14:46 +00003356 AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003357[
Guido van Rossum93274221997-05-09 02:42:00 +00003358if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003359then
3360 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3361 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3362 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00003363else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00003364fi],
3365[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00003366
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003367# check for --with-libm=...
3368AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003369case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00003370Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00003371BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003372*) LIBM=-lm
3373esac
Guido van Rossum93274221997-05-09 02:42:00 +00003374AC_MSG_CHECKING(for --with-libm=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003375AC_ARG_WITH(libm,
Matthias Klose22520ea2010-05-08 10:14:46 +00003376 AS_HELP_STRING([--with-libm=STRING], [math library]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003377[
Guido van Rossum93274221997-05-09 02:42:00 +00003378if test "$withval" = no
3379then LIBM=
3380 AC_MSG_RESULT(force LIBM empty)
3381elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003382then LIBM=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003383 AC_MSG_RESULT(set LIBM="$withval")
3384else AC_MSG_ERROR([proper usage is --with-libm=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003385fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003386[AC_MSG_RESULT(default LIBM="$LIBM")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003387
3388# check for --with-libc=...
3389AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00003390AC_MSG_CHECKING(for --with-libc=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003391AC_ARG_WITH(libc,
Matthias Klose22520ea2010-05-08 10:14:46 +00003392 AS_HELP_STRING([--with-libc=STRING], [C library]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003393[
Guido van Rossum93274221997-05-09 02:42:00 +00003394if test "$withval" = no
3395then LIBC=
3396 AC_MSG_RESULT(force LIBC empty)
3397elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003398then LIBC=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003399 AC_MSG_RESULT(set LIBC="$withval")
3400else AC_MSG_ERROR([proper usage is --with-libc=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003401fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003402[AC_MSG_RESULT(default LIBC="$LIBC")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003403
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003404# **************************************************
3405# * Check for various properties of floating point *
3406# **************************************************
Mark Dickinson265d7382008-04-21 22:32:24 +00003407
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003408AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3409AC_CACHE_VAL(ac_cv_little_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003410AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003411#include <string.h>
3412int main() {
3413 double x = 9006104071832581.0;
3414 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3415 return 0;
3416 else
3417 return 1;
3418}
Matthias Klosec511b472010-05-08 11:01:39 +00003419]])],
3420[ac_cv_little_endian_double=yes],
3421[ac_cv_little_endian_double=no],
3422[ac_cv_little_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003423AC_MSG_RESULT($ac_cv_little_endian_double)
3424if test "$ac_cv_little_endian_double" = yes
3425then
3426 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3427 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3428 with the least significant byte first])
3429fi
3430
3431AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3432AC_CACHE_VAL(ac_cv_big_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003433AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003434#include <string.h>
3435int main() {
3436 double x = 9006104071832581.0;
3437 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3438 return 0;
3439 else
3440 return 1;
3441}
Matthias Klosec511b472010-05-08 11:01:39 +00003442]])],
3443[ac_cv_big_endian_double=yes],
3444[ac_cv_big_endian_double=no],
3445[ac_cv_big_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003446AC_MSG_RESULT($ac_cv_big_endian_double)
3447if test "$ac_cv_big_endian_double" = yes
3448then
3449 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3450 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3451 with the most significant byte first])
3452fi
3453
3454# Some ARM platforms use a mixed-endian representation for doubles.
3455# While Python doesn't currently have full support for these platforms
3456# (see e.g., issue 1762561), we can at least make sure that float <-> string
3457# conversions work.
3458AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3459AC_CACHE_VAL(ac_cv_mixed_endian_double, [
Matthias Klosec511b472010-05-08 11:01:39 +00003460AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003461#include <string.h>
3462int main() {
3463 double x = 9006104071832581.0;
3464 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3465 return 0;
3466 else
3467 return 1;
3468}
Matthias Klosec511b472010-05-08 11:01:39 +00003469]])],
3470[ac_cv_mixed_endian_double=yes],
3471[ac_cv_mixed_endian_double=no],
3472[ac_cv_mixed_endian_double=no])])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003473AC_MSG_RESULT($ac_cv_mixed_endian_double)
3474if test "$ac_cv_mixed_endian_double" = yes
3475then
3476 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3477 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3478 in ARM mixed-endian order (byte order 45670123)])
3479fi
3480
3481# The short float repr introduced in Python 3.1 requires the
3482# correctly-rounded string <-> double conversion functions from
3483# Python/dtoa.c, which in turn require that the FPU uses 53-bit
3484# rounding; this is a problem on x86, where the x87 FPU has a default
Mark Dickinsona548dee2009-11-15 13:12:43 +00003485# rounding precision of 64 bits. For gcc/x86, we can fix this by
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003486# using inline assembler to get and set the x87 FPU control word.
Mark Dickinsona548dee2009-11-15 13:12:43 +00003487
3488# This inline assembler syntax may also work for suncc and icc,
3489# so we try it on all platforms.
3490
3491AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
Matthias Klosec511b472010-05-08 11:01:39 +00003492AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
Mark Dickinsona548dee2009-11-15 13:12:43 +00003493 unsigned short cw;
3494 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3495 __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
Matthias Klosec511b472010-05-08 11:01:39 +00003496]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no])
Mark Dickinsona548dee2009-11-15 13:12:43 +00003497AC_MSG_RESULT($have_gcc_asm_for_x87)
3498if test "$have_gcc_asm_for_x87" = yes
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003499then
Mark Dickinsona548dee2009-11-15 13:12:43 +00003500 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3501 [Define if we can use gcc inline assembler to get and set x87 control word])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003502fi
Mark Dickinson7a3d8642008-04-22 00:54:27 +00003503
Mark Dickinson04b27232009-01-04 12:29:36 +00003504# Detect whether system arithmetic is subject to x87-style double
3505# rounding issues. The result of this test has little meaning on non
3506# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3507# mode is round-to-nearest and double rounding issues are present, and
3508# 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3509AC_MSG_CHECKING(for x87-style double rounding)
Mark Dickinson99abd142009-10-24 13:44:16 +00003510# $BASECFLAGS may affect the result
3511ac_save_cc="$CC"
3512CC="$CC $BASECFLAGS"
Matthias Klosec511b472010-05-08 11:01:39 +00003513AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinson04b27232009-01-04 12:29:36 +00003514#include <stdlib.h>
3515#include <math.h>
3516int main() {
3517 volatile double x, y, z;
3518 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3519 x = 0.99999999999999989; /* 1-2**-53 */
3520 y = 1./x;
3521 if (y != 1.)
3522 exit(0);
3523 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3524 x = 1e16;
3525 y = 2.99999;
3526 z = x + y;
3527 if (z != 1e16+4.)
3528 exit(0);
3529 /* both tests show evidence of double rounding */
3530 exit(1);
3531}
Matthias Klosec511b472010-05-08 11:01:39 +00003532]])],
3533[ac_cv_x87_double_rounding=no],
3534[ac_cv_x87_double_rounding=yes],
3535[ac_cv_x87_double_rounding=no])
Mark Dickinson99abd142009-10-24 13:44:16 +00003536CC="$ac_save_cc"
Mark Dickinson04b27232009-01-04 12:29:36 +00003537AC_MSG_RESULT($ac_cv_x87_double_rounding)
3538if test "$ac_cv_x87_double_rounding" = yes
3539then
3540 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3541 [Define if arithmetic is subject to x87-style double rounding issue])
3542fi
3543
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003544# ************************************
3545# * Check for mathematical functions *
3546# ************************************
3547
3548LIBS_SAVE=$LIBS
3549LIBS="$LIBS $LIBM"
3550
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003551# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3552# -0. on some architectures.
3553AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3554AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
Matthias Klosec511b472010-05-08 11:01:39 +00003555AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003556#include <math.h>
3557#include <stdlib.h>
3558int main() {
3559 /* return 0 if either negative zeros don't exist
3560 on this platform or if negative zeros exist
3561 and tanh(-0.) == -0. */
3562 if (atan2(0., -1.) == atan2(-0., -1.) ||
3563 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3564 else exit(1);
3565}
Matthias Klosec511b472010-05-08 11:01:39 +00003566]])],
3567[ac_cv_tanh_preserves_zero_sign=yes],
3568[ac_cv_tanh_preserves_zero_sign=no],
3569[ac_cv_tanh_preserves_zero_sign=no])])
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003570AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3571if test "$ac_cv_tanh_preserves_zero_sign" = yes
3572then
3573 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3574 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3575fi
3576
3577AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
3578AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
3579AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3580
3581LIBS=$LIBS_SAVE
3582
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003583# For multiprocessing module, check that sem_open
3584# actually works. For FreeBSD versions <= 7.2,
3585# the kernel module that provides POSIX semaphores
3586# isn't loaded by default, so an attempt to call
3587# sem_open results in a 'Signal 12' error.
3588AC_MSG_CHECKING(whether POSIX semaphores are enabled)
3589AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
Matthias Klosec511b472010-05-08 11:01:39 +00003590AC_RUN_IFELSE([AC_LANG_SOURCE([[
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003591#include <unistd.h>
3592#include <fcntl.h>
3593#include <stdio.h>
3594#include <semaphore.h>
3595#include <sys/stat.h>
3596
3597int main(void) {
3598 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3599 if (a == SEM_FAILED) {
3600 perror("sem_open");
3601 return 1;
3602 }
3603 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003604 sem_unlink("/autoconf");
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003605 return 0;
3606}
Matthias Klosec511b472010-05-08 11:01:39 +00003607]])],
3608[ac_cv_posix_semaphores_enabled=yes],
3609[ac_cv_posix_semaphores_enabled=no],
3610[ac_cv_posix_semaphores_enabled=yes])
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003611)
3612AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
3613if test $ac_cv_posix_semaphores_enabled = no
3614then
Mark Dickinson5afa6d42009-11-28 10:44:20 +00003615 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
3616 [Define if POSIX semaphores aren't enabled on your system])
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003617fi
3618
Jesse Noller355b1262009-04-02 00:03:28 +00003619# Multiprocessing check for broken sem_getvalue
3620AC_MSG_CHECKING(for broken sem_getvalue)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003621AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
Matthias Klosec511b472010-05-08 11:01:39 +00003622AC_RUN_IFELSE([AC_LANG_SOURCE([[
Jesse Noller355b1262009-04-02 00:03:28 +00003623#include <unistd.h>
3624#include <fcntl.h>
3625#include <stdio.h>
3626#include <semaphore.h>
3627#include <sys/stat.h>
3628
3629int main(void){
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003630 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
Jesse Noller355b1262009-04-02 00:03:28 +00003631 int count;
3632 int res;
3633 if(a==SEM_FAILED){
3634 perror("sem_open");
3635 return 1;
3636
3637 }
3638 res = sem_getvalue(a, &count);
3639 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003640 sem_unlink("/autocftw");
Jesse Noller355b1262009-04-02 00:03:28 +00003641 return res==-1 ? 1 : 0;
3642}
Matthias Klosec511b472010-05-08 11:01:39 +00003643]])],
3644[ac_cv_broken_sem_getvalue=no],
3645[ac_cv_broken_sem_getvalue=yes],
3646[ac_cv_broken_sem_getvalue=yes])
Jesse Noller355b1262009-04-02 00:03:28 +00003647)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003648AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
3649if test $ac_cv_broken_sem_getvalue = yes
3650then
3651 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
3652 [define to 1 if your sem_getvalue is broken.])
3653fi
Mark Dickinson04b27232009-01-04 12:29:36 +00003654
Mark Dickinsonefc82f72009-03-20 15:51:55 +00003655# determine what size digit to use for Python's longs
3656AC_MSG_CHECKING([digit size for Python's longs])
3657AC_ARG_ENABLE(big-digits,
Matthias Klose22520ea2010-05-08 10:14:46 +00003658AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
Mark Dickinsonefc82f72009-03-20 15:51:55 +00003659[case $enable_big_digits in
3660yes)
3661 enable_big_digits=30 ;;
3662no)
3663 enable_big_digits=15 ;;
3664[15|30])
3665 ;;
3666*)
3667 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3668esac
3669AC_MSG_RESULT($enable_big_digits)
3670AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3671],
3672[AC_MSG_RESULT(no value specified)])
3673
Guido van Rossumef2255b2000-03-10 22:30:29 +00003674# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003675AC_CHECK_HEADER(wchar.h, [
3676 AC_DEFINE(HAVE_WCHAR_H, 1,
3677 [Define if the compiler provides a wchar.h header file.])
3678 wchar_h="yes"
3679],
Guido van Rossumef2255b2000-03-10 22:30:29 +00003680wchar_h="no"
3681)
3682
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003683# determine wchar_t size
3684if test "$wchar_h" = yes
3685then
Guido van Rossum67b26592001-10-20 14:21:45 +00003686 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003687fi
3688
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003689AC_MSG_CHECKING(for UCS-4 tcl)
3690have_ucs4_tcl=no
Matthias Klosec511b472010-05-08 11:01:39 +00003691AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003692#include <tcl.h>
3693#if TCL_UTF_MAX != 6
3694# error "NOT UCS4_TCL"
Matthias Klosec511b472010-05-08 11:01:39 +00003695#endif]], [[]])],[
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003696 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3697 have_ucs4_tcl=yes
Matthias Klosec511b472010-05-08 11:01:39 +00003698],[])
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003699AC_MSG_RESULT($have_ucs4_tcl)
3700
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003701# check whether wchar_t is signed or not
3702if test "$wchar_h" = yes
3703then
3704 # check whether wchar_t is signed or not
3705 AC_MSG_CHECKING(whether wchar_t is signed)
3706 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
Matthias Klosec511b472010-05-08 11:01:39 +00003707 AC_RUN_IFELSE([AC_LANG_SOURCE([[
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003708 #include <wchar.h>
3709 int main()
3710 {
Martin v. Löwis44fe0e42006-04-11 07:15:30 +00003711 /* Success: exit code 0 */
3712 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003713 }
Matthias Klosec511b472010-05-08 11:01:39 +00003714 ]])],
3715 [ac_cv_wchar_t_signed=yes],
3716 [ac_cv_wchar_t_signed=no],
3717 [ac_cv_wchar_t_signed=yes])])
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003718 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3719fi
3720
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003721AC_MSG_CHECKING(what type to use for unicode)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003722dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003723AC_ARG_ENABLE(unicode,
Matthias Klose22520ea2010-05-08 10:14:46 +00003724 AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is yes)]),
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003725 [],
3726 [enable_unicode=yes])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003727
3728if test $enable_unicode = yes
3729then
Martin v. Löwisfd917792001-06-27 20:22:04 +00003730 # Without any arguments, Py_UNICODE defaults to two-byte mode
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003731 case "$have_ucs4_tcl" in
3732 yes) enable_unicode="ucs4"
3733 ;;
3734 *) enable_unicode="ucs2"
3735 ;;
3736 esac
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003737fi
3738
Martin v. Löwis0036cba2002-04-12 09:58:45 +00003739AH_TEMPLATE(Py_UNICODE_SIZE,
3740 [Define as the size of the unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003741case "$enable_unicode" in
3742ucs2) unicode_size="2"
3743 AC_DEFINE(Py_UNICODE_SIZE,2)
3744 ;;
3745ucs4) unicode_size="4"
3746 AC_DEFINE(Py_UNICODE_SIZE,4)
3747 ;;
Ezio Melotti5820efb2010-02-27 00:05:42 +00003748*) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003749esac
3750
Martin v. Löwis11437992002-04-12 09:54:03 +00003751AH_TEMPLATE(PY_UNICODE_TYPE,
3752 [Define as the integral type used for Unicode representation.])
Martin v. Löwis0036cba2002-04-12 09:58:45 +00003753
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003754AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003755if test "$enable_unicode" = "no"
3756then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003757 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003758 AC_MSG_RESULT(not used)
3759else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003760 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003761 AC_DEFINE(Py_USING_UNICODE, 1,
3762 [Define if you want to have a Unicode type.])
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003763
3764 # wchar_t is only usable if it maps to an unsigned type
3765 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
Matthias Klose7dbeed72004-12-24 08:22:17 +00003766 -a "$ac_cv_wchar_t_signed" = "no"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003767 then
3768 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003769 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3770 [Define if you have a useable wchar_t type defined in wchar.h; useable
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003771 means wchar_t must be an unsigned type with at least 16 bits. (see
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003772 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003773 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3774 elif test "$ac_cv_sizeof_short" = "$unicode_size"
3775 then
3776 PY_UNICODE_TYPE="unsigned short"
3777 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3778 elif test "$ac_cv_sizeof_long" = "$unicode_size"
3779 then
3780 PY_UNICODE_TYPE="unsigned long"
3781 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3782 else
3783 PY_UNICODE_TYPE="no type found"
3784 fi
3785 AC_MSG_RESULT($PY_UNICODE_TYPE)
3786fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00003787
3788# check for endianness
3789AC_C_BIGENDIAN
3790
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003791# Check whether right shifting a negative integer extends the sign bit
3792# or fills with zeros (like the Cray J90, according to Tim Peters).
3793AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00003794AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Matthias Klosec511b472010-05-08 11:01:39 +00003795AC_RUN_IFELSE([AC_LANG_SOURCE([[
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003796int main()
3797{
Vladimir Marangozova6180282000-07-12 05:05:06 +00003798 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003799}
Matthias Klosec511b472010-05-08 11:01:39 +00003800]])],
3801[ac_cv_rshift_extends_sign=yes],
3802[ac_cv_rshift_extends_sign=no],
3803[ac_cv_rshift_extends_sign=yes])])
Vladimir Marangozova6180282000-07-12 05:05:06 +00003804AC_MSG_RESULT($ac_cv_rshift_extends_sign)
3805if test "$ac_cv_rshift_extends_sign" = no
3806then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003807 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
3808 [Define if i>>j for signed int i does not extend the sign bit
3809 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00003810fi
3811
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003812# check for getc_unlocked and related locking functions
3813AC_MSG_CHECKING(for getc_unlocked() and friends)
3814AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
Matthias Klosec511b472010-05-08 11:01:39 +00003815AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003816 FILE *f = fopen("/dev/null", "r");
3817 flockfile(f);
3818 getc_unlocked(f);
3819 funlockfile(f);
Matthias Klosec511b472010-05-08 11:01:39 +00003820]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003821AC_MSG_RESULT($ac_cv_have_getc_unlocked)
3822if test "$ac_cv_have_getc_unlocked" = yes
3823then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003824 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
3825 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003826fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003827
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00003828# check where readline lives
Martin v. Löwis82bca632006-02-10 20:49:30 +00003829# save the value of LIBS so we don't actually link Python with readline
3830LIBS_no_readline=$LIBS
Gregory P. Smith980b99b2008-09-07 05:15:18 +00003831
3832# On some systems we need to link readline to a termcap compatible
3833# library. NOTE: Keep the precedence of listed libraries synchronised
3834# with setup.py.
3835py_cv_lib_readline=no
3836AC_MSG_CHECKING([how to link readline libs])
3837for py_libtermcap in "" ncursesw ncurses curses termcap; do
3838 if test -z "$py_libtermcap"; then
3839 READLINE_LIBS="-lreadline"
3840 else
3841 READLINE_LIBS="-lreadline -l$py_libtermcap"
3842 fi
3843 LIBS="$READLINE_LIBS $LIBS_no_readline"
3844 AC_LINK_IFELSE(
3845 [AC_LANG_CALL([],[readline])],
3846 [py_cv_lib_readline=yes])
3847 if test $py_cv_lib_readline = yes; then
3848 break
3849 fi
3850done
3851# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3852#AC_SUBST([READLINE_LIBS])
Gregory P. Smith29ec7502008-09-07 19:18:16 +00003853if test $py_cv_lib_readline = no; then
Gregory P. Smith980b99b2008-09-07 05:15:18 +00003854 AC_MSG_RESULT([none])
3855else
3856 AC_MSG_RESULT([$READLINE_LIBS])
3857 AC_DEFINE(HAVE_LIBREADLINE, 1,
3858 [Define if you have the readline library (-lreadline).])
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00003859fi
3860
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003861# check for readline 2.1
3862AC_CHECK_LIB(readline, rl_callback_handler_install,
3863 AC_DEFINE(HAVE_RL_CALLBACK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003864 [Define if you have readline 2.1]), ,$READLINE_LIBS)
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003865
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003866# check for readline 2.2
Matthias Klosec511b472010-05-08 11:01:39 +00003867AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
3868 [have_readline=yes],
3869 [have_readline=no]
3870)
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003871if test $have_readline = yes
3872then
3873 AC_EGREP_HEADER([extern int rl_completion_append_character;],
3874 [readline/readline.h],
3875 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
3876 [Define if you have readline 2.2]), )
Antoine Pitroud9ff74e2009-10-26 19:16:46 +00003877 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
3878 [readline/readline.h],
3879 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
3880 [Define if you have rl_completion_suppress_append]), )
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003881fi
3882
Martin v. Löwis0daad592001-09-30 21:09:59 +00003883# check for readline 4.0
3884AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003885 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003886 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis0daad592001-09-30 21:09:59 +00003887
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00003888# also in 4.0
3889AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
3890 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003891 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00003892
Guido van Rossum353ae582001-07-10 16:45:32 +00003893# check for readline 4.2
3894AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003895 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003896 [Define if you have readline 4.2]), ,$READLINE_LIBS)
Guido van Rossum353ae582001-07-10 16:45:32 +00003897
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003898# also in readline 4.2
Matthias Klosec511b472010-05-08 11:01:39 +00003899AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
3900 [have_readline=yes],
3901 [have_readline=no]
3902)
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003903if test $have_readline = yes
3904then
3905 AC_EGREP_HEADER([extern int rl_catch_signals;],
3906 [readline/readline.h],
3907 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3908 [Define if you can turn off readline's signal handling.]), )
3909fi
3910
Martin v. Löwis82bca632006-02-10 20:49:30 +00003911# End of readline checks: restore LIBS
3912LIBS=$LIBS_no_readline
3913
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003914AC_MSG_CHECKING(for broken nice())
3915AC_CACHE_VAL(ac_cv_broken_nice, [
Matthias Klosec511b472010-05-08 11:01:39 +00003916AC_RUN_IFELSE([AC_LANG_SOURCE([[
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003917int main()
3918{
3919 int val1 = nice(1);
3920 if (val1 != -1 && val1 == nice(2))
3921 exit(0);
3922 exit(1);
3923}
Matthias Klosec511b472010-05-08 11:01:39 +00003924]])],
3925[ac_cv_broken_nice=yes],
3926[ac_cv_broken_nice=no],
3927[ac_cv_broken_nice=no])])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003928AC_MSG_RESULT($ac_cv_broken_nice)
3929if test "$ac_cv_broken_nice" = yes
3930then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003931 AC_DEFINE(HAVE_BROKEN_NICE, 1,
3932 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003933fi
3934
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003935AC_MSG_CHECKING(for broken poll())
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003936AC_CACHE_VAL(ac_cv_broken_poll,
Matthias Klosec511b472010-05-08 11:01:39 +00003937AC_RUN_IFELSE([AC_LANG_SOURCE([[
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003938#include <poll.h>
3939
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003940int main()
3941{
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003942 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003943 int poll_test;
3944
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003945 close (42);
3946
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003947 poll_test = poll(&poll_struct, 1, 0);
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003948 if (poll_test < 0)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003949 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003950 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003951 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003952 else
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003953 return 1;
3954}
Matthias Klosec511b472010-05-08 11:01:39 +00003955]])],
3956[ac_cv_broken_poll=yes],
3957[ac_cv_broken_poll=no],
3958[ac_cv_broken_poll=no]))
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003959AC_MSG_RESULT($ac_cv_broken_poll)
3960if test "$ac_cv_broken_poll" = yes
3961then
3962 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3963 [Define if poll() sets errno on invalid file descriptors.])
3964fi
3965
Brett Cannon43802422005-02-10 20:48:03 +00003966# Before we can test tzset, we need to check if struct tm has a tm_zone
3967# (which is not required by ISO C or UNIX spec) and/or if we support
3968# tzname[]
3969AC_STRUCT_TIMEZONE
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003970
Brett Cannon43802422005-02-10 20:48:03 +00003971# check tzset(3) exists and works like we expect it to
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003972AC_MSG_CHECKING(for working tzset())
3973AC_CACHE_VAL(ac_cv_working_tzset, [
Matthias Klosec511b472010-05-08 11:01:39 +00003974AC_RUN_IFELSE([AC_LANG_SOURCE([[
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003975#include <stdlib.h>
3976#include <time.h>
Brett Cannon18367812003-09-19 00:59:16 +00003977#include <string.h>
Brett Cannon43802422005-02-10 20:48:03 +00003978
3979#if HAVE_TZNAME
3980extern char *tzname[];
3981#endif
3982
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003983int main()
3984{
Brett Cannon18367812003-09-19 00:59:16 +00003985 /* Note that we need to ensure that not only does tzset(3)
3986 do 'something' with localtime, but it works as documented
3987 in the library reference and as expected by the test suite.
Brett Cannon43802422005-02-10 20:48:03 +00003988 This includes making sure that tzname is set properly if
3989 tm->tm_zone does not exist since it is the alternative way
3990 of getting timezone info.
Brett Cannon18367812003-09-19 00:59:16 +00003991
3992 Red Hat 6.2 doesn't understand the southern hemisphere
Brett Cannon43802422005-02-10 20:48:03 +00003993 after New Year's Day.
Brett Cannon18367812003-09-19 00:59:16 +00003994 */
3995
Brett Cannon43802422005-02-10 20:48:03 +00003996 time_t groundhogday = 1044144000; /* GMT-based */
Brett Cannon18367812003-09-19 00:59:16 +00003997 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3998
Neal Norwitz7f2588c2003-04-11 15:35:53 +00003999 putenv("TZ=UTC+0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004000 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00004001 if (localtime(&groundhogday)->tm_hour != 0)
4002 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004003#if HAVE_TZNAME
4004 /* For UTC, tzname[1] is sometimes "", sometimes " " */
4005 if (strcmp(tzname[0], "UTC") ||
4006 (tzname[1][0] != 0 && tzname[1][0] != ' '))
4007 exit(1);
4008#endif
Brett Cannon18367812003-09-19 00:59:16 +00004009
Neal Norwitz7f2588c2003-04-11 15:35:53 +00004010 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004011 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00004012 if (localtime(&groundhogday)->tm_hour != 19)
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004013 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004014#if HAVE_TZNAME
4015 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
4016 exit(1);
4017#endif
Brett Cannon18367812003-09-19 00:59:16 +00004018
4019 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
4020 tzset();
4021 if (localtime(&groundhogday)->tm_hour != 11)
4022 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004023#if HAVE_TZNAME
4024 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
4025 exit(1);
4026#endif
4027
4028#if HAVE_STRUCT_TM_TM_ZONE
Brett Cannon18367812003-09-19 00:59:16 +00004029 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
4030 exit(1);
4031 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
4032 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00004033#endif
Brett Cannon18367812003-09-19 00:59:16 +00004034
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004035 exit(0);
4036}
Matthias Klosec511b472010-05-08 11:01:39 +00004037]])],
4038[ac_cv_working_tzset=yes],
4039[ac_cv_working_tzset=no],
4040[ac_cv_working_tzset=no])])
Guido van Rossumd11b62e2003-03-14 21:51:36 +00004041AC_MSG_RESULT($ac_cv_working_tzset)
4042if test "$ac_cv_working_tzset" = yes
4043then
4044 AC_DEFINE(HAVE_WORKING_TZSET, 1,
4045 [Define if tzset() actually switches the local timezone in a meaningful way.])
4046fi
4047
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004048# Look for subsecond timestamps in struct stat
4049AC_MSG_CHECKING(for tv_nsec in struct stat)
4050AC_CACHE_VAL(ac_cv_stat_tv_nsec,
Matthias Klosec511b472010-05-08 11:01:39 +00004051AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004052struct stat st;
4053st.st_mtim.tv_nsec = 1;
Matthias Klosec511b472010-05-08 11:01:39 +00004054]])],
4055[ac_cv_stat_tv_nsec=yes],
4056[ac_cv_stat_tv_nsec=no]))
Martin v. Löwis94717ed2002-09-09 14:24:16 +00004057AC_MSG_RESULT($ac_cv_stat_tv_nsec)
4058if test "$ac_cv_stat_tv_nsec" = yes
4059then
4060 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
4061 [Define if you have struct stat.st_mtim.tv_nsec])
4062fi
4063
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004064# Look for BSD style subsecond timestamps in struct stat
4065AC_MSG_CHECKING(for tv_nsec2 in struct stat)
4066AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
Matthias Klosec511b472010-05-08 11:01:39 +00004067AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004068struct stat st;
4069st.st_mtimespec.tv_nsec = 1;
Matthias Klosec511b472010-05-08 11:01:39 +00004070]])],
4071[ac_cv_stat_tv_nsec2=yes],
4072[ac_cv_stat_tv_nsec2=no]))
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00004073AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
4074if test "$ac_cv_stat_tv_nsec2" = yes
4075then
4076 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
4077 [Define if you have struct stat.st_mtimensec])
4078fi
4079
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004080# On HP/UX 11.0, mvwdelch is a block with a return statement
4081AC_MSG_CHECKING(whether mvwdelch is an expression)
4082AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
Matthias Klosec511b472010-05-08 11:01:39 +00004083AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004084 int rtn;
4085 rtn = mvwdelch(0,0,0);
Matthias Klosec511b472010-05-08 11:01:39 +00004086]])],
4087[ac_cv_mvwdelch_is_expression=yes],
4088[ac_cv_mvwdelch_is_expression=no]))
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004089AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
4090
4091if test "$ac_cv_mvwdelch_is_expression" = yes
4092then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004093 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
4094 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004095fi
4096
4097AC_MSG_CHECKING(whether WINDOW has _flags)
4098AC_CACHE_VAL(ac_cv_window_has_flags,
Matthias Klosec511b472010-05-08 11:01:39 +00004099AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004100 WINDOW *w;
4101 w->_flags = 0;
Matthias Klosec511b472010-05-08 11:01:39 +00004102]])],
4103[ac_cv_window_has_flags=yes],
4104[ac_cv_window_has_flags=no]))
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004105AC_MSG_RESULT($ac_cv_window_has_flags)
4106
4107
4108if test "$ac_cv_window_has_flags" = yes
4109then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004110 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
4111 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004112fi
4113
Walter Dörwald4994d952006-06-19 08:07:50 +00004114AC_MSG_CHECKING(for is_term_resized)
Matthias Klosec511b472010-05-08 11:01:39 +00004115AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])],
4116 [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
4117 AC_MSG_RESULT(yes)],
4118 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004119)
4120
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004121AC_MSG_CHECKING(for resize_term)
Matthias Klosec511b472010-05-08 11:01:39 +00004122AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])],
4123 [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
4124 AC_MSG_RESULT(yes)],
4125 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004126)
4127
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004128AC_MSG_CHECKING(for resizeterm)
Matthias Klosec511b472010-05-08 11:01:39 +00004129AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])],
4130 [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
4131 AC_MSG_RESULT(yes)],
4132 [AC_MSG_RESULT(no)]
Walter Dörwald4994d952006-06-19 08:07:50 +00004133)
4134
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004135AC_MSG_CHECKING(for /dev/ptmx)
4136
4137if test -r /dev/ptmx
4138then
4139 AC_MSG_RESULT(yes)
4140 AC_DEFINE(HAVE_DEV_PTMX, 1,
4141 [Define if we have /dev/ptmx.])
4142else
4143 AC_MSG_RESULT(no)
4144fi
4145
4146AC_MSG_CHECKING(for /dev/ptc)
4147
4148if test -r /dev/ptc
4149then
4150 AC_MSG_RESULT(yes)
4151 AC_DEFINE(HAVE_DEV_PTC, 1,
4152 [Define if we have /dev/ptc.])
4153else
4154 AC_MSG_RESULT(no)
4155fi
Neal Norwitz865400f2003-03-21 01:42:58 +00004156
Mark Dickinson82864d12009-11-15 16:18:58 +00004157if test "$have_long_long" = yes
4158then
4159 AC_MSG_CHECKING(for %lld and %llu printf() format support)
4160 AC_CACHE_VAL(ac_cv_have_long_long_format,
Matthias Klosec511b472010-05-08 11:01:39 +00004161 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
Mark Dickinson82864d12009-11-15 16:18:58 +00004162 #include <stdio.h>
4163 #include <stddef.h>
4164 #include <string.h>
4165
4166 #ifdef HAVE_SYS_TYPES_H
4167 #include <sys/types.h>
4168 #endif
4169
4170 int main()
4171 {
4172 char buffer[256];
4173
4174 if (sprintf(buffer, "%lld", (long long)123) < 0)
4175 return 1;
4176 if (strcmp(buffer, "123"))
4177 return 1;
4178
4179 if (sprintf(buffer, "%lld", (long long)-123) < 0)
4180 return 1;
4181 if (strcmp(buffer, "-123"))
4182 return 1;
4183
4184 if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
4185 return 1;
4186 if (strcmp(buffer, "123"))
4187 return 1;
4188
4189 return 0;
4190 }
Matthias Klosec511b472010-05-08 11:01:39 +00004191 ]]])],
4192 [ac_cv_have_long_long_format=yes],
4193 [ac_cv_have_long_long_format=no],
4194 [ac_cv_have_long_long_format=no])
Mark Dickinson82864d12009-11-15 16:18:58 +00004195 )
4196 AC_MSG_RESULT($ac_cv_have_long_long_format)
4197fi
4198
Mark Dickinson5ce84742009-12-31 20:48:04 +00004199if test "$ac_cv_have_long_long_format" = yes
Mark Dickinson82864d12009-11-15 16:18:58 +00004200then
4201 AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
4202 [Define to printf format modifier for long long type])
4203fi
4204
Ronald Oussoren315cd0c2009-11-19 16:25:21 +00004205if test $ac_sys_system = Darwin
4206then
4207 LIBS="$LIBS -framework CoreFoundation"
4208fi
4209
Mark Dickinson82864d12009-11-15 16:18:58 +00004210
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004211AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
Matthias Klosec511b472010-05-08 11:01:39 +00004212AC_RUN_IFELSE([AC_LANG_SOURCE([[
Alexandre Vassalottie7cf1182009-07-17 06:33:51 +00004213#include <stdio.h>
Brett Cannon09d12362006-05-11 05:11:33 +00004214#include <stddef.h>
4215#include <string.h>
4216
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004217#ifdef HAVE_SYS_TYPES_H
4218#include <sys/types.h>
4219#endif
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004220
4221#ifdef HAVE_SSIZE_T
4222typedef ssize_t Py_ssize_t;
4223#elif SIZEOF_VOID_P == SIZEOF_LONG
4224typedef long Py_ssize_t;
4225#else
4226typedef int Py_ssize_t;
4227#endif
Brett Cannon09d12362006-05-11 05:11:33 +00004228
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004229int main()
4230{
4231 char buffer[256];
4232
Brett Cannon09d12362006-05-11 05:11:33 +00004233 if(sprintf(buffer, "%zd", (size_t)123) < 0)
4234 return 1;
4235
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004236 if (strcmp(buffer, "123"))
Brett Cannon09d12362006-05-11 05:11:33 +00004237 return 1;
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004238
4239 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
4240 return 1;
4241
4242 if (strcmp(buffer, "-123"))
4243 return 1;
4244
Brett Cannon09d12362006-05-11 05:11:33 +00004245 return 0;
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004246}
Matthias Klosec511b472010-05-08 11:01:39 +00004247]])],
4248[ac_cv_have_size_t_format=yes],
4249[ac_cv_have_size_t_format=no],
4250[ac_cv_have_size_t_format="cross -- assuming yes"
4251])])
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004252if test "$ac_cv_have_size_t_format" != no ; then
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004253 AC_DEFINE(PY_FORMAT_SIZE_T, "z",
4254 [Define to printf format modifier for Py_ssize_t])
4255fi
Brett Cannon09d12362006-05-11 05:11:33 +00004256
Martin v. Löwis01c04012002-11-11 14:58:44 +00004257AC_CHECK_TYPE(socklen_t,,
4258 AC_DEFINE(socklen_t,int,
Matthias Klose5183ebd2010-04-24 16:38:36 +00004259 [Define to `int' if <sys/socket.h> does not define.]),[
Martin v. Löwis01c04012002-11-11 14:58:44 +00004260#ifdef HAVE_SYS_TYPES_H
4261#include <sys/types.h>
4262#endif
Guido van Rossum95713eb2000-05-18 20:53:31 +00004263#ifdef HAVE_SYS_SOCKET_H
4264#include <sys/socket.h>
4265#endif
Martin v. Löwis01c04012002-11-11 14:58:44 +00004266])
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004267
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00004268AC_SUBST(THREADHEADERS)
4269
4270for h in `(cd $srcdir;echo Python/thread_*.h)`
4271do
4272 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4273done
4274
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004275AC_SUBST(SRCDIRS)
Neal Norwitzd24499d2005-12-18 21:36:39 +00004276SRCDIRS="Parser Grammar Objects Python Modules Mac"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00004277AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004278for dir in $SRCDIRS; do
4279 if test ! -d $dir; then
4280 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00004281 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004282done
4283AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00004284
Guido van Rossum627b2d71993-12-24 10:39:16 +00004285# generate output files
Antoine Pitrouf2caeed2009-05-24 20:23:57 +00004286AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
Martin v. Löwis88afe662002-10-26 13:47:44 +00004287AC_OUTPUT
Neil Schemenauer61c51152001-01-26 16:18:16 +00004288
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004289echo "creating Modules/Setup"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004290if test ! -f Modules/Setup
4291then
4292 cp $srcdir/Modules/Setup.dist Modules/Setup
4293fi
4294
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004295echo "creating Modules/Setup.local"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004296if test ! -f Modules/Setup.local
4297then
4298 echo "# Edit this file for local setup changes" >Modules/Setup.local
4299fi
4300
4301echo "creating Makefile"
4302$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4303 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00004304 Modules/Setup.local Modules/Setup
Skip Montanaro7221d932007-08-22 19:02:16 +00004305
4306case $ac_sys_system in
4307BeOS)
4308 AC_MSG_WARN([
4309
4310 Support for BeOS is deprecated as of Python 2.6.
4311 See PEP 11 for the gory details.
4312 ])
4313 ;;
4314*) ;;
4315esac
4316
Neil Schemenauer66252162001-02-19 04:47:42 +00004317mv config.c Modules