blob: e153bca6c17432f6207bde8cc84423abda10c9ae [file] [log] [blame]
Benjamin Petersond7c77842008-05-26 13:01:25 +00001dnl ***********************************************
2dnl * Please run autoreconf to test your changes! *
3dnl ***********************************************
Benjamin Peterson98b1b022008-11-30 14:43:23 +00004dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.61).
Martin v. Löwis88afe662002-10-26 13:47:44 +00005
6# Set VERSION so we only need to edit in one place (i.e., here)
Martin v. Löwis174440b2008-10-03 08:59:41 +00007m4_define(PYTHON_VERSION, 2.7)
Martin v. Löwis88afe662002-10-26 13:47:44 +00008
Alexandre Vassalotti130ae152009-07-18 00:31:06 +00009dnl Some m4 magic to ensure that the configure script is generated
10dnl by the correct autoconf version.
11m4_define([version_required],
12[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), 0,
13 [],
14 [m4_fatal([Autoconf version $1 is required for Python], 63)])
15])
16version_required(2.61)
17
Guido van Rossum76be6ed1995-01-02 18:33:54 +000018AC_REVISION($Revision$)
Georg Brandl464432d2009-05-20 18:24:08 +000019AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
Martin v. Löwis88afe662002-10-26 13:47:44 +000020AC_CONFIG_SRCDIR([Include/object.h])
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +000021AC_CONFIG_HEADER(pyconfig.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +000022
Georg Brandlbcd64a32009-03-31 21:45:18 +000023dnl Ensure that if prefix is specified, it does not end in a slash. If
24dnl it does, we get path names containing '//' which is both ugly and
25dnl can cause trouble.
26
27dnl Last slash shouldn't be stripped if prefix=/
28if test "$prefix" != "/"; then
29 prefix=`echo "$prefix" | sed -e 's/\/$//g'`
30fi
31
Martin v. Löwis8316feb2003-06-14 07:48:07 +000032dnl This is for stuff that absolutely must end up in pyconfig.h.
33dnl Please use pyport.h instead, if possible.
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000034AH_TOP([
35#ifndef Py_PYCONFIG_H
36#define Py_PYCONFIG_H
37])
Martin v. Löwis11437992002-04-12 09:54:03 +000038AH_BOTTOM([
Martin v. Löwis11437992002-04-12 09:54:03 +000039/* Define the macros needed if on a UnixWare 7.x system. */
40#if defined(__USLC__) && defined(__SCO_VERSION__)
41#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
42#endif
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000043
44#endif /*Py_PYCONFIG_H*/
Martin v. Löwis11437992002-04-12 09:54:03 +000045])
46
Martin v. Löwis8316feb2003-06-14 07:48:07 +000047# We don't use PACKAGE_ variables, and they cause conflicts
48# with other autoconf-based packages that include Python.h
49grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
50rm confdefs.h
51mv confdefs.h.new confdefs.h
52
Guido van Rossum642b6781997-07-19 19:35:41 +000053AC_SUBST(VERSION)
Martin v. Löwis88afe662002-10-26 13:47:44 +000054VERSION=PYTHON_VERSION
Guido van Rossum642b6781997-07-19 19:35:41 +000055
Martin v. Löwis1142de32002-03-29 16:28:31 +000056AC_SUBST(SOVERSION)
57SOVERSION=1.0
58
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +000059# The later defininition of _XOPEN_SOURCE disables certain features
60# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
61AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
62
Martin v. Löwisbcd93962003-05-03 10:32:18 +000063# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
64# certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
65# them.
66AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
67
Andrew MacIntyreabccf412003-07-02 13:53:25 +000068# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
69# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
70# them.
71AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
72
Martin v. Löwisd6320502004-08-12 13:45:08 +000073# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
74# u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
75AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
76
Ronald Oussoren5640ce22008-06-05 12:58:24 +000077# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
78# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
79# them.
80AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
81
82
Martin v. Löwise981a4e2002-11-11 13:26:51 +000083define_xopen_source=yes
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +000084
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +000085# Arguments passed to configure.
86AC_SUBST(CONFIG_ARGS)
87CONFIG_ARGS="$ac_configure_args"
88
Ronald Oussoren3c0a1262010-01-17 19:27:57 +000089AC_MSG_CHECKING([for --enable-universalsdk])
Ronald Oussoren988117f2006-04-29 11:31:35 +000090AC_ARG_ENABLE(universalsdk,
Brett Cannon91a1dec2008-02-13 19:15:44 +000091 AC_HELP_STRING(--enable-universalsdk@<:@=SDKDIR@:>@, Build against Mac OS X 10.4u SDK (ppc/i386)),
Ronald Oussoren988117f2006-04-29 11:31:35 +000092[
93 case $enableval in
94 yes)
95 enableval=/Developer/SDKs/MacOSX10.4u.sdk
Ronald Oussoren3c0a1262010-01-17 19:27:57 +000096 if test ! -d "${enableval}"
97 then
98 enableval=/
99 fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000100 ;;
101 esac
102 case $enableval in
103 no)
104 UNIVERSALSDK=
105 enable_universalsdk=
106 ;;
107 *)
108 UNIVERSALSDK=$enableval
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000109 if test ! -d "${UNIVERSALSDK}"
110 then
111 AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
112 fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000113 ;;
114 esac
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000115
Ronald Oussoren988117f2006-04-29 11:31:35 +0000116],[
117 UNIVERSALSDK=
118 enable_universalsdk=
119])
Ronald Oussoren3c0a1262010-01-17 19:27:57 +0000120if test -n "${UNIVERSALSDK}"
121then
122 AC_MSG_RESULT(${UNIVERSALSDK})
123else
124 AC_MSG_RESULT(no)
125fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000126AC_SUBST(UNIVERSALSDK)
127
Benjamin Peterson0e6ea5d2008-07-16 20:17:04 +0000128AC_SUBST(ARCH_RUN_32BIT)
129
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000130UNIVERSAL_ARCHS="32-bit"
Ronald Oussoren92919a62009-12-24 13:30:58 +0000131AC_SUBST(LIPO_32BIT_FLAGS)
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000132AC_MSG_CHECKING(for --with-universal-archs)
133AC_ARG_WITH(universal-archs,
Ronald Oussoren23d92532009-09-07 06:12:00 +0000134 AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")),
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000135[
136 AC_MSG_RESULT($withval)
137 UNIVERSAL_ARCHS="$withval"
Ronald Oussoren9ebd2422009-09-29 13:00:44 +0000138 if test "${enable_universalsdk}" ; then
139 :
140 else
141 AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
142 fi
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000143],
144[
145 AC_MSG_RESULT(32-bit)
146])
147
148
149
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000150AC_ARG_WITH(framework-name,
151 AC_HELP_STRING(--with-framework-name=FRAMEWORK,
152 specify an alternate name of the framework built with --enable-framework),
153[
Ronald Oussoren9ebd2422009-09-29 13:00:44 +0000154 if test "${enable_framework}"; then
155 :
156 else
157 AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
158 fi
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000159 PYTHONFRAMEWORK=${withval}
160 PYTHONFRAMEWORKDIR=${withval}.framework
161 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
162 ],[
163 PYTHONFRAMEWORK=Python
164 PYTHONFRAMEWORKDIR=Python.framework
165 PYTHONFRAMEWORKIDENTIFIER=org.python.python
166])
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000167dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000168AC_ARG_ENABLE(framework,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000169 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
170[
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000171 case $enableval in
172 yes)
173 enableval=/Library/Frameworks
Jack Jansen127e56e2001-09-11 14:41:54 +0000174 esac
175 case $enableval in
176 no)
177 PYTHONFRAMEWORK=
178 PYTHONFRAMEWORKDIR=no-framework
179 PYTHONFRAMEWORKPREFIX=
180 PYTHONFRAMEWORKINSTALLDIR=
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000181 FRAMEWORKINSTALLFIRST=
182 FRAMEWORKINSTALLLAST=
Ronald Oussoren5b787322006-06-06 19:50:24 +0000183 FRAMEWORKALTINSTALLFIRST=
184 FRAMEWORKALTINSTALLLAST=
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000185 if test "x${prefix}" = "xNONE"; then
186 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
187 else
188 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
189 fi
Jack Jansen127e56e2001-09-11 14:41:54 +0000190 enable_framework=
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000191 ;;
192 *)
193 PYTHONFRAMEWORKPREFIX=$enableval
Jack Jansen127e56e2001-09-11 14:41:54 +0000194 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000195 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000196 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
Ronald Oussoren92919a62009-12-24 13:30:58 +0000197 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
198 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000199
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000200 if test "x${prefix}" = "xNONE" ; then
201 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
202 else
203 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
204 fi
Jack Jansen127e56e2001-09-11 14:41:54 +0000205 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
Ronald Oussoren836b0392006-05-14 19:56:34 +0000206
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000207 # Add files for Mac specific code to the list of output
Ronald Oussoren836b0392006-05-14 19:56:34 +0000208 # files:
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000209 AC_CONFIG_FILES(Mac/Makefile)
210 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
211 AC_CONFIG_FILES(Mac/IDLE/Makefile)
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000212 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
213 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000214 esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000215 ],[
216 PYTHONFRAMEWORK=
Jack Jansen127e56e2001-09-11 14:41:54 +0000217 PYTHONFRAMEWORKDIR=no-framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000218 PYTHONFRAMEWORKPREFIX=
219 PYTHONFRAMEWORKINSTALLDIR=
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000220 FRAMEWORKINSTALLFIRST=
221 FRAMEWORKINSTALLLAST=
Ronald Oussoren5b787322006-06-06 19:50:24 +0000222 FRAMEWORKALTINSTALLFIRST=
223 FRAMEWORKALTINSTALLLAST=
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000224 if test "x${prefix}" = "xNONE" ; then
225 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
226 else
227 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
228 fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000229 enable_framework=
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000230
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000231])
232AC_SUBST(PYTHONFRAMEWORK)
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000233AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000234AC_SUBST(PYTHONFRAMEWORKDIR)
235AC_SUBST(PYTHONFRAMEWORKPREFIX)
236AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000237AC_SUBST(FRAMEWORKINSTALLFIRST)
238AC_SUBST(FRAMEWORKINSTALLLAST)
Ronald Oussoren5b787322006-06-06 19:50:24 +0000239AC_SUBST(FRAMEWORKALTINSTALLFIRST)
240AC_SUBST(FRAMEWORKALTINSTALLLAST)
241AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000242
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000243##AC_ARG_WITH(dyld,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000244## AC_HELP_STRING(--with-dyld,
245## Use (OpenStep|Rhapsody) dynamic linker))
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000246##
Guido van Rossumb418f891996-07-30 18:06:02 +0000247# Set name for machine-dependent library files
248AC_SUBST(MACHDEP)
249AC_MSG_CHECKING(MACHDEP)
250if test -z "$MACHDEP"
251then
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000252 ac_sys_system=`uname -s`
Georg Brandlfe18a112009-09-04 07:55:14 +0000253 if test "$ac_sys_system" = "AIX" \
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000254 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000255 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +0000256 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000257 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +0000258 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000259 ac_md_system=`echo $ac_sys_system |
260 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
261 ac_md_release=`echo $ac_sys_release |
Guido van Rossum67b26592001-10-20 14:21:45 +0000262 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +0000263 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000264
Guido van Rossumbcd91e01997-03-20 20:46:29 +0000265 case $MACHDEP in
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +0000266 cygwin*) MACHDEP="cygwin";;
Jack Jansen8a97f4a2001-12-05 23:27:32 +0000267 darwin*) MACHDEP="darwin";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000268 atheos*) MACHDEP="atheos";;
Martin v. Löwisf3322282003-07-13 09:46:13 +0000269 irix646) MACHDEP="irix6";;
Guido van Rossumb97ef171997-09-28 05:44:03 +0000270 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000271 esac
272fi
Jack Jansen83f898c2002-12-30 22:23:40 +0000273
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000274# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
275# disable features if it is defined, without any means to access these
276# features as extensions. For these systems, we skip the definition of
277# _XOPEN_SOURCE. Before adding a system to the list to gain access to
278# some feature, make sure there is no alternative way to access this
279# feature. Also, when using wildcards, make sure you have verified the
280# need for not defining _XOPEN_SOURCE on all systems matching the
281# wildcard, and that the wildcard does not include future systems
282# (which may remove their limitations).
283dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
284case $ac_sys_system/$ac_sys_release in
285 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
286 # even though select is a POSIX function. Reported by J. Ribbens.
Martin v. Löwis76bafc62003-10-03 13:47:44 +0000287 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
Martin v. Löwis7875ef62010-02-15 21:41:12 +0000288 # In addition, Stefan Krah confirms that issue #1244610 exists through
289 # OpenBSD 4.6, but is fixed in 4.7.
290 OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123456@:>@)
Martin v. Löwiscb78de62007-12-29 18:49:21 +0000291 define_xopen_source=no
292 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
293 # also defined. This can be overridden by defining _BSD_SOURCE
294 # As this has a different meaning on Linux, only define it on OpenBSD
295 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
296 ;;
Martin v. Löwis7875ef62010-02-15 21:41:12 +0000297 OpenBSD/4.@<:@789@:>@)
Martin v. Löwis5e2dd862010-02-15 08:32:00 +0000298 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
299 # also defined. This can be overridden by defining _BSD_SOURCE
300 # As this has a different meaning on Linux, only define it on OpenBSD
301 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
302 ;;
Martin v. Löwis4d542ec2006-11-25 15:39:19 +0000303 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
304 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
305 # Marc Recht
Georg Brandl4b9bcfc2008-11-16 08:00:17 +0000306 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 +0000307 define_xopen_source=no;;
Martin v. Löwisa9d71422003-03-28 18:43:31 +0000308 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
309 # of union __?sigval. Reported by Stuart Bishop.
310 SunOS/5.6)
311 define_xopen_source=no;;
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000312 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
313 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
Martin v. Löwis253d1f42004-05-07 19:14:14 +0000314 # Reconfirmed for 7.1.4 by Martin v. Loewis.
315 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000316 define_xopen_source=no;;
317 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000318 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000319 SCO_SV/3.2)
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000320 define_xopen_source=no;;
Martin v. Löwisbb86d832008-11-04 20:40:09 +0000321 # On FreeBSD 4, the math functions C89 does not cover are never defined
322 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
323 FreeBSD/4.*)
324 define_xopen_source=no;;
325 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
326 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
327 # identifies itself as Darwin/7.*
328 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
329 # disables platform specific features beyond repair.
330 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
331 # has no effect, don't bother defining them
332 Darwin/@<:@6789@:>@.*)
Anthony Baxter6169c6b2003-10-04 07:46:23 +0000333 define_xopen_source=no;;
Ronald Oussorena55af9a2010-01-17 16:25:57 +0000334 Darwin/1@<:@0-9@:>@.*)
335 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000336 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
337 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
338 # or has another value. By not (re)defining it, the defaults come in place.
Martin v. Löwisc19c5a62003-11-18 20:00:44 +0000339 AIX/4)
340 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000341 AIX/5)
342 if test `uname -r` -eq 1; then
343 define_xopen_source=no
344 fi
345 ;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000346 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
347 # defining NI_NUMERICHOST.
348 QNX/6.3.2)
349 define_xopen_source=no
350 ;;
Martin v. Löwisa0588362006-04-04 06:03:50 +0000351
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000352esac
353
354if test $define_xopen_source = yes
355then
Skip Montanarof0d5f792004-08-15 14:08:23 +0000356 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
357 # defined precisely as g++ defines it
Martin v. Löwis7dece662005-11-26 11:38:24 +0000358 # Furthermore, on Solaris 10, XPG6 requires the use of a C99
359 # compiler
Skip Montanarof0d5f792004-08-15 14:08:23 +0000360 case $ac_sys_system/$ac_sys_release in
Martin v. Löwis7dece662005-11-26 11:38:24 +0000361 SunOS/5.8|SunOS/5.9|SunOS/5.10)
Skip Montanarof0d5f792004-08-15 14:08:23 +0000362 AC_DEFINE(_XOPEN_SOURCE, 500,
363 Define to the level of X/Open that your system supports)
364 ;;
365 *)
366 AC_DEFINE(_XOPEN_SOURCE, 600,
367 Define to the level of X/Open that your system supports)
368 ;;
369 esac
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000370
371 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
372 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
373 # several APIs are not declared. Since this is also needed in some
374 # cases for HP-UX, we define it globally.
Martin v. Löwis7dece662005-11-26 11:38:24 +0000375 # except for Solaris 10, where it must not be defined,
376 # as it implies XPG4.2
377 case $ac_sys_system/$ac_sys_release in
378 SunOS/5.10)
379 ;;
380 *)
381 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
382 Define to activate Unix95-and-earlier features)
383 ;;
384 esac
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000385
Bob Ippolito7026a0a2005-03-28 23:23:47 +0000386 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
387
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000388fi
389
Guido van Rossum91922671997-10-09 20:24:13 +0000390#
391# SGI compilers allow the specification of the both the ABI and the
392# ISA on the command line. Depending on the values of these switches,
393# different and often incompatable code will be generated.
394#
395# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
396# thus supply support for various ABI/ISA combinations. The MACHDEP
397# variable is also adjusted.
398#
399AC_SUBST(SGI_ABI)
400if test ! -z "$SGI_ABI"
401then
402 CC="cc $SGI_ABI"
403 LDFLAGS="$SGI_ABI $LDFLAGS"
404 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
405fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000406AC_MSG_RESULT($MACHDEP)
407
Jack Jansen83f898c2002-12-30 22:23:40 +0000408# And add extra plat-mac for darwin
409AC_SUBST(EXTRAPLATDIR)
Jack Jansen7b59b422003-03-17 15:44:10 +0000410AC_SUBST(EXTRAMACHDEPPATH)
Jack Jansen83f898c2002-12-30 22:23:40 +0000411AC_MSG_CHECKING(EXTRAPLATDIR)
412if test -z "$EXTRAPLATDIR"
413then
414 case $MACHDEP in
Jack Jansen7b59b422003-03-17 15:44:10 +0000415 darwin)
416 EXTRAPLATDIR="\$(PLATMACDIRS)"
417 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
418 ;;
419 *)
420 EXTRAPLATDIR=""
421 EXTRAMACHDEPPATH=""
422 ;;
Jack Jansen83f898c2002-12-30 22:23:40 +0000423 esac
424fi
425AC_MSG_RESULT($EXTRAPLATDIR)
426
Jack Jansen6b08a402004-06-03 12:41:45 +0000427# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
428# it may influence the way we can build extensions, so distutils
429# needs to check it
430AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
Ronald Oussoren988117f2006-04-29 11:31:35 +0000431AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
Jack Jansen6b08a402004-06-03 12:41:45 +0000432CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
Ronald Oussoren988117f2006-04-29 11:31:35 +0000433EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
Jack Jansen6b08a402004-06-03 12:41:45 +0000434
Mark Dickinson65134662008-04-25 16:11:04 +0000435AC_MSG_CHECKING(machine type as reported by uname -m)
436ac_sys_machine=`uname -m`
437AC_MSG_RESULT($ac_sys_machine)
438
Guido van Rossum627b2d71993-12-24 10:39:16 +0000439# checks for alternative programs
Skip Montanarodecc6a42003-01-01 20:07:49 +0000440
441# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
442# for debug/optimization stuff. BASECFLAGS is for flags that are required
443# just to get things to compile and link. Users are free to override OPT
444# when running configure or make. The build should not break if they do.
445# BASECFLAGS should generally not be messed with, however.
446
447# XXX shouldn't some/most/all of this code be merged with the stuff later
448# on that fiddles with OPT and BASECFLAGS?
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000449AC_MSG_CHECKING(for --without-gcc)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000450AC_ARG_WITH(gcc,
451 AC_HELP_STRING(--without-gcc,never use gcc),
452[
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000453 case $withval in
Skip Montanaro516144f2009-01-04 10:36:58 +0000454 no) CC=${CC:-cc}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000455 without_gcc=yes;;
456 yes) CC=gcc
457 without_gcc=no;;
458 *) CC=$withval
459 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000460 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000461 case $ac_sys_system in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000462 AIX*) CC=cc_r
463 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000464 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000465 case $BE_HOST_CPU in
466 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000467 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000468 without_gcc=yes
Skip Montanarodecc6a42003-01-01 20:07:49 +0000469 BASECFLAGS="$BASECFLAGS -export pragma"
470 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000471 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000472 ;;
473 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000474 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000475 without_gcc=no
Skip Montanarodecc6a42003-01-01 20:07:49 +0000476 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000477 ;;
478 *)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000479 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000480 ;;
481 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000482 AR="\$(srcdir)/Modules/ar_beos"
483 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000484 ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000485 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000486 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000487AC_MSG_RESULT($without_gcc)
488
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000489# If the user switches compilers, we can't believe the cache
490if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
491then
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000492 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
493(it is also a good idea to do 'make clean' before compiling)])
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000494fi
495
Guido van Rossum627b2d71993-12-24 10:39:16 +0000496AC_PROG_CC
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000497
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000498AC_SUBST(CXX)
499AC_SUBST(MAINCC)
500AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
501AC_ARG_WITH(cxx_main,
502 AC_HELP_STRING([--with-cxx-main=<compiler>],
503 [compile main() and link python executable with C++ compiler]),
504[
505
506 case $withval in
507 no) with_cxx_main=no
508 MAINCC='$(CC)';;
509 yes) with_cxx_main=yes
510 MAINCC='$(CXX)';;
511 *) with_cxx_main=yes
512 MAINCC=$withval
513 if test -z "$CXX"
514 then
515 CXX=$withval
516 fi;;
517 esac], [
518 with_cxx_main=no
519 MAINCC='$(CC)'
520])
521AC_MSG_RESULT($with_cxx_main)
522
523preset_cxx="$CXX"
524if test -z "$CXX"
525then
526 case "$CC" in
527 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
528 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
529 esac
530 if test "$CXX" = "notfound"
531 then
532 CXX=""
533 fi
534fi
535if test -z "$CXX"
536then
537 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
538 if test "$CXX" = "notfound"
539 then
540 CXX=""
541 fi
542fi
543if test "$preset_cxx" != "$CXX"
544then
545 AC_MSG_WARN([
546
547 By default, distutils will build C++ extension modules with "$CXX".
548 If this is not intended, then set CXX on the configure command line.
549 ])
550fi
551
552
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000553# checks for UNIX variants that set C preprocessor variables
554AC_AIX
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000555
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000556# Check for unsupported systems
557case $ac_sys_system/$ac_sys_release in
Brett Cannon19fab762007-06-02 03:02:29 +0000558atheos*|Linux*/1*)
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000559 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
560 echo See README for details.
561 exit 1;;
562esac
563
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000564AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000565AC_MSG_CHECKING(for --with-suffix)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000566AC_ARG_WITH(suffix,
567 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
568[
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000569 case $withval in
570 no) EXEEXT=;;
571 yes) EXEEXT=.exe;;
572 *) EXEEXT=$withval;;
573 esac])
574AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000575
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000576# Test whether we're running on a non-case-sensitive system, in which
577# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000578AC_SUBST(BUILDEXEEXT)
579AC_MSG_CHECKING(for case-insensitive build directory)
Jack Jansen3c2c4332002-11-06 13:33:32 +0000580if test ! -d CaseSensitiveTestDir; then
581mkdir CaseSensitiveTestDir
582fi
583
584if test -d casesensitivetestdir
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000585then
Jack Jansen1999ef42001-12-06 21:47:20 +0000586 AC_MSG_RESULT(yes)
587 BUILDEXEEXT=.exe
588else
589 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000590 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000591fi
Jack Jansen3c2c4332002-11-06 13:33:32 +0000592rmdir CaseSensitiveTestDir
Guido van Rossumfb842551997-08-06 23:42:07 +0000593
Guido van Rossumdd997f71998-10-07 19:58:26 +0000594case $MACHDEP in
595bsdos*)
596 case $CC in
597 gcc) CC="$CC -D_HAVE_BSDI";;
598 esac;;
599esac
600
Guido van Rossum84561611997-08-21 00:08:11 +0000601case $ac_sys_system in
602hp*|HP*)
603 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000604 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000605 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000606SunOS*)
607 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000608 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000609 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000610esac
611
Martin v. Löwise8964d42001-03-06 12:09:07 +0000612
Neil Schemenauer61c51152001-01-26 16:18:16 +0000613AC_SUBST(LIBRARY)
614AC_MSG_CHECKING(LIBRARY)
615if test -z "$LIBRARY"
616then
617 LIBRARY='libpython$(VERSION).a'
618fi
619AC_MSG_RESULT($LIBRARY)
620
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000621# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000622# name of the library into which to insert object files). BLDLIBRARY is also
623# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
624# is blank as the main program is not linked directly against LDLIBRARY.
625# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
626# systems without shared libraries, LDLIBRARY is the same as LIBRARY
627# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
628# DLLLIBRARY is the shared (i.e., DLL) library.
629#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000630# RUNSHARED is used to run shared python without installed libraries
631#
632# INSTSONAME is the name of the shared library that will be use to install
633# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000634AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000635AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000636AC_SUBST(BLDLIBRARY)
637AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000638AC_SUBST(INSTSONAME)
639AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000640LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000641BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis09bdf722002-05-08 08:51:29 +0000642INSTSONAME='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000643DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000644LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000645RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000646
Guido van Rossumfb842551997-08-06 23:42:07 +0000647# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000648# If CXX is set, and if it is needed to link a main function that was
649# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
650# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000651# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000652# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000653AC_SUBST(LINKCC)
654AC_MSG_CHECKING(LINKCC)
655if test -z "$LINKCC"
656then
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000657 LINKCC='$(PURIFY) $(MAINCC)'
Guido van Rossumfb842551997-08-06 23:42:07 +0000658 case $ac_sys_system in
659 AIX*)
Neal Norwitz0b27ff92003-03-31 15:53:49 +0000660 exp_extra="\"\""
661 if test $ac_sys_release -ge 5 -o \
662 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
663 exp_extra="."
664 fi
665 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000666 QNX*)
667 # qcc must be used because the other compilers do not
668 # support -N.
669 LINKCC=qcc;;
Guido van Rossumfb842551997-08-06 23:42:07 +0000670 esac
671fi
672AC_MSG_RESULT($LINKCC)
673
Tarek Ziadée2be83d2009-05-09 08:28:53 +0000674# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
675# make sure we default having it set to "no": this is used by
676# distutils.unixccompiler to know if it should add --enable-new-dtags
677# to linker command lines, and failing to detect GNU ld simply results
678# in the same bahaviour as before.
679AC_SUBST(GNULD)
680AC_MSG_CHECKING(for GNU ld)
681ac_prog=ld
682if test "$GCC" = yes; then
683 ac_prog=`$CC -print-prog-name=ld`
684fi
685case `"$ac_prog" -V 2>&1 < /dev/null` in
686 *GNU*)
687 GNULD=yes;;
688 *)
689 GNULD=no;;
690esac
691AC_MSG_RESULT($GNULD)
692
Martin v. Löwis1142de32002-03-29 16:28:31 +0000693AC_MSG_CHECKING(for --enable-shared)
694AC_ARG_ENABLE(shared,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000695 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000696
Martin v. Löwis1142de32002-03-29 16:28:31 +0000697if test -z "$enable_shared"
698then
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000699 case $ac_sys_system in
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000700 CYGWIN* | atheos*)
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000701 enable_shared="yes";;
702 *)
703 enable_shared="no";;
704 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000705fi
706AC_MSG_RESULT($enable_shared)
707
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000708AC_MSG_CHECKING(for --enable-profiling)
709AC_ARG_ENABLE(profiling,
710 AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
711[ac_save_cc="$CC"
712 CC="$CC -pg"
713 AC_TRY_RUN([int main() { return 0; }],
714 ac_enable_profiling="yes",
715 ac_enable_profiling="no",
716 ac_enable_profiling="no")
717 CC="$ac_save_cc"])
718AC_MSG_RESULT($ac_enable_profiling)
719
720case "$ac_enable_profiling" in
721 "yes")
722 BASECFLAGS="-pg $BASECFLAGS"
723 LDFLAGS="-pg $LDFLAGS"
724 ;;
725esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000726
727AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000728
Guido van Rossumb8552162001-09-05 14:58:11 +0000729# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
730# library that we build, but we do not want to link against it (we
731# will find it with a -framework option). For this reason there is an
732# extra variable BLDLIBRARY against which Python and the extension
733# modules are linked, BLDLIBRARY. This is normally the same as
734# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000735if test "$enable_framework"
736then
737 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen66b84832003-07-04 12:14:39 +0000738 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000739 BLDLIBRARY=''
740else
741 BLDLIBRARY='$(LDLIBRARY)'
742fi
743
Martin v. Löwis1142de32002-03-29 16:28:31 +0000744# Other platforms follow
745if test $enable_shared = "yes"; then
Mark Hammond8235ea12002-07-19 06:55:41 +0000746 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
Martin v. Löwis1142de32002-03-29 16:28:31 +0000747 case $ac_sys_system in
748 BeOS*)
749 LDLIBRARY='libpython$(VERSION).so'
750 ;;
751 CYGWIN*)
752 LDLIBRARY='libpython$(VERSION).dll.a'
753 DLLLIBRARY='libpython$(VERSION).dll'
754 ;;
755 SunOS*)
756 LDLIBRARY='libpython$(VERSION).so'
Martin v. Löwisd141a8c2003-06-14 15:20:28 +0000757 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000758 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Martin v. Löwis2389c412003-10-31 15:42:07 +0000759 INSTSONAME="$LDLIBRARY".$SOVERSION
Martin v. Löwis1142de32002-03-29 16:28:31 +0000760 ;;
Martin v. Löwis86d66262006-02-17 08:40:11 +0000761 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000762 LDLIBRARY='libpython$(VERSION).so'
763 BLDLIBRARY='-L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000764 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Hye-Shik Chang33761492004-10-26 09:53:46 +0000765 case $ac_sys_system in
766 FreeBSD*)
767 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
768 ;;
769 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000770 INSTSONAME="$LDLIBRARY".$SOVERSION
771 ;;
772 hp*|HP*)
Neal Norwitz58e28882006-05-19 07:00:58 +0000773 case `uname -m` in
774 ia64)
775 LDLIBRARY='libpython$(VERSION).so'
776 ;;
777 *)
778 LDLIBRARY='libpython$(VERSION).sl'
779 ;;
780 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000781 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000782 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000783 ;;
784 OSF*)
785 LDLIBRARY='libpython$(VERSION).so'
Neal Norwitz671b9e32006-01-09 07:07:12 +0000786 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000787 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000788 ;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000789 atheos*)
790 LDLIBRARY='libpython$(VERSION).so'
791 BLDLIBRARY='-L. -lpython$(VERSION)'
792 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
793 ;;
Ronald Oussoren79f90492009-01-02 10:44:46 +0000794 Darwin*)
795 LDLIBRARY='libpython$(VERSION).dylib'
796 BLDLIBRARY='-L. -lpython$(VERSION)'
797 RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
798 ;;
799
Martin v. Löwis1142de32002-03-29 16:28:31 +0000800 esac
Jason Tishler30765592003-09-04 11:04:06 +0000801else # shared is disabled
802 case $ac_sys_system in
803 CYGWIN*)
804 BLDLIBRARY='$(LIBRARY)'
805 LDLIBRARY='libpython$(VERSION).dll.a'
806 ;;
807 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000808fi
809
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000810AC_MSG_RESULT($LDLIBRARY)
811
Guido van Rossum627b2d71993-12-24 10:39:16 +0000812AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000813AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000814AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000815
Tarek Ziadé99f660a2009-05-07 21:20:34 +0000816# tweak ARFLAGS only if the user didn't set it on the command line
817AC_SUBST(ARFLAGS)
818if test -z "$ARFLAGS"
819then
820 ARFLAGS="rc"
821fi
822
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000823AC_SUBST(SVNVERSION)
Martin v. Löwisff600232006-04-03 19:12:32 +0000824AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000825if test $SVNVERSION = found
826then
827 SVNVERSION="svnversion \$(srcdir)"
828else
Benjamin Petersone5afa3b2009-05-23 19:24:37 +0000829 SVNVERSION="echo Unversioned directory"
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000830fi
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000831
Neil Schemenauera42c8272001-03-31 00:01:55 +0000832case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +0000833bsdos*|hp*|HP*)
834 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +0000835 if test -z "$INSTALL"
836 then
837 INSTALL="${srcdir}/install-sh -c"
838 fi
839esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000840AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000841
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000842# Not every filesystem supports hard links
843AC_SUBST(LN)
844if test -z "$LN" ; then
845 case $ac_sys_system in
846 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000847 CYGWIN*) LN="ln -s";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000848 atheos*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000849 *) LN=ln;;
850 esac
851fi
852
Fred Drake9f715822001-07-11 06:27:00 +0000853# Check for --with-pydebug
854AC_MSG_CHECKING(for --with-pydebug)
855AC_ARG_WITH(pydebug,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000856 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
857[
Fred Drake9f715822001-07-11 06:27:00 +0000858if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000859then
860 AC_DEFINE(Py_DEBUG, 1,
861 [Define if you want to build an interpreter with many run-time checks.])
862 AC_MSG_RESULT(yes);
863 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +0000864else AC_MSG_RESULT(no); Py_DEBUG='false'
865fi],
866[AC_MSG_RESULT(no)])
867
Skip Montanarodecc6a42003-01-01 20:07:49 +0000868# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
869# merged with this chunk of code?
870
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000871# Optimizer/debugger flags
Skip Montanarodecc6a42003-01-01 20:07:49 +0000872# ------------------------
873# (The following bit of code is complicated enough - please keep things
874# indented properly. Just pretend you're editing Python code. ;-)
875
876# There are two parallel sets of case statements below, one that checks to
877# see if OPT was set and one that does BASECFLAGS setting based upon
878# compiler and platform. BASECFLAGS tweaks need to be made even if the
879# user set OPT.
880
881# tweak OPT based on compiler and platform, only if the user didn't set
882# it on the command line
Guido van Rossumb418f891996-07-30 18:06:02 +0000883AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000884if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000885then
Skip Montanarodecc6a42003-01-01 20:07:49 +0000886 case $GCC in
887 yes)
Skip Montanaro288a5be2006-04-13 02:00:56 +0000888 if test "$CC" != 'g++' ; then
889 STRICT_PROTO="-Wstrict-prototypes"
890 fi
Guido van Rossum7c862f82007-12-13 20:50:10 +0000891 # For gcc 4.x we need to use -fwrapv so lets check if its supported
892 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
893 WRAP="-fwrapv"
894 fi
Skip Montanarodecc6a42003-01-01 20:07:49 +0000895 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000896 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000897 if test "$Py_DEBUG" = 'true' ; then
898 # Optimization messes up debuggers, so turn it off for
899 # debug builds.
Skip Montanaro288a5be2006-04-13 02:00:56 +0000900 OPT="-g -Wall $STRICT_PROTO"
Fred Drake9f715822001-07-11 06:27:00 +0000901 else
Guido van Rossum7c862f82007-12-13 20:50:10 +0000902 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +0000903 fi
904 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000905 *)
Skip Montanaro288a5be2006-04-13 02:00:56 +0000906 OPT="-O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +0000907 ;;
Fred Drake9f715822001-07-11 06:27:00 +0000908 esac
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000909 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +0000910 SCO_SV*) OPT="$OPT -m486 -DSCO5"
911 ;;
912 esac
Fred Drake9f715822001-07-11 06:27:00 +0000913 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +0000914
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000915 *)
Skip Montanarodecc6a42003-01-01 20:07:49 +0000916 OPT="-O"
917 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000918 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000919fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000920
Skip Montanarodecc6a42003-01-01 20:07:49 +0000921AC_SUBST(BASECFLAGS)
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000922
923# The -arch flags for universal builds on OSX
924UNIVERSAL_ARCH_FLAGS=
925AC_SUBST(UNIVERSAL_ARCH_FLAGS)
926
Skip Montanarodecc6a42003-01-01 20:07:49 +0000927# tweak BASECFLAGS based on compiler and platform
928case $GCC in
929yes)
Martin v. Löwis70fedcd2003-07-07 21:26:19 +0000930 # Python violates C99 rules, by casting between incompatible
931 # pointer types. GCC may generate bad code as a result of that,
932 # so use -fno-strict-aliasing if supported.
933 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
934 ac_save_cc="$CC"
935 CC="$CC -fno-strict-aliasing"
Alexandre Vassalotti00900892009-07-17 05:26:39 +0000936 AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +0000937 AC_TRY_COMPILE([],[int main() { return 0; }],
Martin v. Löwis70fedcd2003-07-07 21:26:19 +0000938 ac_cv_no_strict_aliasing_ok=yes,
Alexandre Vassalotti00900892009-07-17 05:26:39 +0000939 ac_cv_no_strict_aliasing_ok=no))
Martin v. Löwis70fedcd2003-07-07 21:26:19 +0000940 CC="$ac_save_cc"
941 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
942 if test $ac_cv_no_strict_aliasing_ok = yes
943 then
944 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
945 fi
Mark Dickinson65134662008-04-25 16:11:04 +0000946
947 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
948 # support. Without this, treatment of subnormals doesn't follow
949 # the standard.
950 case $ac_sys_machine in
951 alpha*)
952 BASECFLAGS="$BASECFLAGS -mieee"
953 ;;
954 esac
955
Skip Montanarodecc6a42003-01-01 20:07:49 +0000956 case $ac_sys_system in
957 SCO_SV*)
958 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
959 ;;
960 # is there any other compiler on Darwin besides gcc?
961 Darwin*)
Jeffrey Yasskin1b4e45b2008-03-17 14:40:53 +0000962 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
963 # used to be here, but non-Apple gcc doesn't accept them.
Ronald Oussorena55af9a2010-01-17 16:25:57 +0000964 if test "${CC}" = gcc
965 then
966 AC_MSG_CHECKING(which compiler should be used)
967 case "${UNIVERSALSDK}" in
968 */MacOSX10.4u.sdk)
969 # Build using 10.4 SDK, force usage of gcc when the
970 # compiler is gcc, otherwise the user will get very
971 # confusing error messages when building on OSX 10.6
972 CC=gcc-4.0
973 CPP=cpp-4.0
974 ;;
975 esac
976 AC_MSG_RESULT($CC)
Ronald Oussoren988117f2006-04-29 11:31:35 +0000977 fi
978
Benjamin Peterson4347c442008-07-17 15:59:24 +0000979 # Calculate the right deployment target for this build.
980 #
981 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
982 if test ${cur_target} '>' 10.2; then
983 cur_target=10.3
Ronald Oussoren25967582009-09-06 10:00:26 +0000984 if test ${enable_universalsdk}; then
985 if test "${UNIVERSAL_ARCHS}" = "all"; then
986 # Ensure that the default platform for a
987 # 4-way universal build is OSX 10.5,
988 # that's the first OS release where
989 # 4-way builds make sense.
990 cur_target='10.5'
Ronald Oussoren23d92532009-09-07 06:12:00 +0000991
992 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
993 cur_target='10.5'
994
995 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
996 cur_target='10.5'
997
998 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
999 cur_target='10.5'
Ronald Oussoren25967582009-09-06 10:00:26 +00001000 fi
1001 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001002 if test `/usr/bin/arch` = "i386"; then
Ronald Oussoren25967582009-09-06 10:00:26 +00001003 # On Intel macs default to a deployment
1004 # target of 10.4, that's the first OSX
1005 # release with Intel support.
1006 cur_target="10.4"
1007 fi
1008 fi
Benjamin Peterson4347c442008-07-17 15:59:24 +00001009 fi
1010 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1011
1012 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1013 # environment with a value that is the same as what we'll use
1014 # in the Makefile to ensure that we'll get the same compiler
1015 # environment during configure and build time.
1016 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1017 export MACOSX_DEPLOYMENT_TARGET
1018 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1019
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001020 if test "${enable_universalsdk}"; then
1021 UNIVERSAL_ARCH_FLAGS=""
1022 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
1023 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
1024 ARCH_RUN_32BIT=""
1025 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
1026
1027
1028 # You have to use different flags on various versions of
1029 # OSX to extract PPC code from an universal binary, basically
1030 # '-arch ppc' on OSX 10.4 and '-arch ppc7400' on anything
1031 # newer.
1032 # Because '-arch pp7400' works on OSX 10.5 or higher this
1033 # test is only present in the '32-bit' branch, all other
1034 # branches require OSX 10.5 to compile.
1035
1036 AC_MSG_CHECKING(lipo flag for extracting ppc code)
1037 FN="test.$$"
1038 cat >${FN}.c <<-EOF
1039 int main() { return 0; }
1040EOF
1041 ${CC} ${CFLAGS} -arch ppc -arch i386 -o ${FN} ${FN}.c -isysroot ${UNIVERSALSDK}
1042 if test $? != 0 ; then
1043 rm ${FN} ${FN}.c
1044 AC_MSG_RESULT([failed, assumee -extract ppc7400])
1045 else
1046 lipo -extract -output "${FN}.out" -arch ppc7400 "${FN}" 2>/dev/null
1047 if test $? != 0 ; then
1048 LIPO_32BIT_FLAGS="-extract ppc -extract i386"
1049 AC_MSG_RESULT("'-extract ppc'")
1050 else
1051 AC_MSG_RESULT("'-extract ppc7400'")
1052 fi
1053 rm -f ${FN} ${FN}.c ${FN}.out
1054 fi
1055
1056 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
1057 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
1058 LIPO_32BIT_FLAGS=""
1059 ARCH_RUN_32BIT="true"
1060
1061 elif test "$UNIVERSAL_ARCHS" = "all" ; then
1062 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
1063 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001064 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001065
1066 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
1067 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
1068 LIPO_32BIT_FLAGS="-extract i386"
Ronald Oussoren92397ce2010-01-17 19:32:00 +00001069 ARCH_RUN_32BIT="/usr/bin/arch -i386"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001070
1071 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
1072 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
1073 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
Ronald Oussoren9922f172010-02-11 13:19:34 +00001074 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001075
1076 else
1077 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
1078
1079 fi
1080
1081
1082 BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
1083 tgt=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
1084 if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
1085 CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
1086 CPPFLAGS="-isysroot ${UNIVERSALSDK}"
1087 fi
1088
1089 fi
1090
1091
Skip Montanarodecc6a42003-01-01 20:07:49 +00001092 ;;
Neal Norwitzdedeeaa2006-03-31 06:54:45 +00001093 OSF*)
1094 BASECFLAGS="$BASECFLAGS -mieee"
1095 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001096 esac
1097 ;;
1098
1099*)
1100 case $ac_sys_system in
1101 OpenUNIX*|UnixWare*)
1102 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1103 ;;
Neal Norwitzb44f1652003-05-26 14:11:55 +00001104 OSF*)
1105 BASECFLAGS="$BASECFLAGS -ieee -std"
1106 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001107 SCO_SV*)
1108 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1109 ;;
1110 esac
1111 ;;
1112esac
1113
Fred Drakee1ceaa02001-12-04 20:55:47 +00001114if test "$Py_DEBUG" = 'true'; then
1115 :
1116else
1117 OPT="-DNDEBUG $OPT"
1118fi
1119
Guido van Rossum6f2260e1996-09-09 16:21:03 +00001120if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001121then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001122 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001123fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001124
Neal Norwitz020c46a2006-01-07 21:39:28 +00001125# disable check for icc since it seems to pass, but generates a warning
1126if test "$CC" = icc
1127then
1128 ac_cv_opt_olimit_ok=no
1129fi
1130
Guido van Rossum91922671997-10-09 20:24:13 +00001131AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1132AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1133[ac_save_cc="$CC"
1134CC="$CC -OPT:Olimit=0"
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001135AC_TRY_COMPILE([],[int main() { return 0; }],
Guido van Rossum91922671997-10-09 20:24:13 +00001136 ac_cv_opt_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +00001137 ac_cv_opt_olimit_ok=no,
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001138 )
Guido van Rossum91922671997-10-09 20:24:13 +00001139CC="$ac_save_cc"])
1140AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +00001141if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +00001142 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +00001143 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1144 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1145 # environment?
1146 Darwin*)
1147 ;;
1148 *)
1149 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1150 ;;
Guido van Rossum5839e582000-10-09 19:52:35 +00001151 esac
Guido van Rossumf8678121998-07-07 21:05:09 +00001152else
1153 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1154 AC_CACHE_VAL(ac_cv_olimit_ok,
1155 [ac_save_cc="$CC"
1156 CC="$CC -Olimit 1500"
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001157 AC_TRY_COMPILE([],[int main() { return 0; }],
Guido van Rossumf8678121998-07-07 21:05:09 +00001158 ac_cv_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +00001159 ac_cv_olimit_ok=no,
Gregory P. Smithec3b8bd2009-11-01 21:02:52 +00001160 )
Guido van Rossumf8678121998-07-07 21:05:09 +00001161 CC="$ac_save_cc"])
1162 AC_MSG_RESULT($ac_cv_olimit_ok)
1163 if test $ac_cv_olimit_ok = yes; then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001164 BASECFLAGS="$BASECFLAGS -Olimit 1500"
Guido van Rossumf8678121998-07-07 21:05:09 +00001165 fi
Guido van Rossum201afe51997-05-14 21:14:44 +00001166fi
Guido van Rossumf8678121998-07-07 21:05:09 +00001167
Martin v. Löwisaac13162006-10-19 10:58:46 +00001168# Check whether GCC supports PyArg_ParseTuple format
1169if test "$GCC" = "yes"
1170then
1171 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1172 save_CFLAGS=$CFLAGS
1173 CFLAGS="$CFLAGS -Werror"
1174 AC_TRY_COMPILE([
1175 void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
1176 ],,
1177 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1178 AC_MSG_RESULT(yes),
1179 AC_MSG_RESULT(no)
1180 )
Martin v. Löwisc1d75972006-10-19 16:01:37 +00001181 CFLAGS=$save_CFLAGS
Martin v. Löwisaac13162006-10-19 10:58:46 +00001182fi
1183
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001184# On some compilers, pthreads are available without further options
1185# (e.g. MacOS X). On some of these systems, the compiler will not
1186# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1187# So we have to see first whether pthreads are available without
1188# options before we can check whether -Kpthread improves anything.
1189AC_MSG_CHECKING(whether pthreads are available without options)
1190AC_CACHE_VAL(ac_cv_pthread_is_default,
1191[AC_TRY_RUN([
1192#include <pthread.h>
1193
1194void* routine(void* p){return NULL;}
1195
1196int main(){
1197 pthread_t p;
1198 if(pthread_create(&p,NULL,routine,NULL)!=0)
1199 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001200 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001201 return 0;
1202}
1203],
Skip Montanarod8d39a02003-07-10 20:44:10 +00001204[
1205 ac_cv_pthread_is_default=yes
1206 ac_cv_kthread=no
1207 ac_cv_pthread=no
1208],
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001209 ac_cv_pthread_is_default=no,
1210 ac_cv_pthread_is_default=no)
1211])
1212AC_MSG_RESULT($ac_cv_pthread_is_default)
1213
1214
1215if test $ac_cv_pthread_is_default = yes
1216then
1217 ac_cv_kpthread=no
1218else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001219# -Kpthread, if available, provides the right #defines
1220# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001221# Some compilers won't report that they do not support -Kpthread,
1222# so we need to run a program to see whether it really made the
1223# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +00001224AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1225AC_CACHE_VAL(ac_cv_kpthread,
1226[ac_save_cc="$CC"
1227CC="$CC -Kpthread"
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001228AC_TRY_RUN([
1229#include <pthread.h>
1230
1231void* routine(void* p){return NULL;}
1232
1233int main(){
1234 pthread_t p;
1235 if(pthread_create(&p,NULL,routine,NULL)!=0)
1236 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001237 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001238 return 0;
1239}
1240],
Martin v. Löwis130fb172001-07-19 11:00:41 +00001241 ac_cv_kpthread=yes,
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001242 ac_cv_kpthread=no,
Martin v. Löwis130fb172001-07-19 11:00:41 +00001243 ac_cv_kpthread=no)
1244CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001245AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001246fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00001247
Skip Montanarod8d39a02003-07-10 20:44:10 +00001248if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001249then
1250# -Kthread, if available, provides the right #defines
1251# and linker options to make pthread_create available
1252# Some compilers won't report that they do not support -Kthread,
1253# so we need to run a program to see whether it really made the
1254# function available.
1255AC_MSG_CHECKING(whether $CC accepts -Kthread)
1256AC_CACHE_VAL(ac_cv_kthread,
1257[ac_save_cc="$CC"
1258CC="$CC -Kthread"
1259AC_TRY_RUN([
1260#include <pthread.h>
1261
1262void* routine(void* p){return NULL;}
1263
1264int main(){
1265 pthread_t p;
1266 if(pthread_create(&p,NULL,routine,NULL)!=0)
1267 return 1;
1268 (void)pthread_detach(p);
1269 return 0;
1270}
1271],
1272 ac_cv_kthread=yes,
1273 ac_cv_kthread=no,
1274 ac_cv_kthread=no)
1275CC="$ac_save_cc"])
1276AC_MSG_RESULT($ac_cv_kthread)
1277fi
1278
Skip Montanarod8d39a02003-07-10 20:44:10 +00001279if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001280then
1281# -pthread, if available, provides the right #defines
1282# and linker options to make pthread_create available
1283# Some compilers won't report that they do not support -pthread,
1284# so we need to run a program to see whether it really made the
1285# function available.
1286AC_MSG_CHECKING(whether $CC accepts -pthread)
1287AC_CACHE_VAL(ac_cv_thread,
1288[ac_save_cc="$CC"
1289CC="$CC -pthread"
1290AC_TRY_RUN([
1291#include <pthread.h>
1292
1293void* routine(void* p){return NULL;}
1294
1295int main(){
1296 pthread_t p;
1297 if(pthread_create(&p,NULL,routine,NULL)!=0)
1298 return 1;
1299 (void)pthread_detach(p);
1300 return 0;
1301}
1302],
1303 ac_cv_pthread=yes,
1304 ac_cv_pthread=no,
1305 ac_cv_pthread=no)
1306CC="$ac_save_cc"])
1307AC_MSG_RESULT($ac_cv_pthread)
1308fi
1309
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001310# If we have set a CC compiler flag for thread support then
1311# check if it works for CXX, too.
1312ac_cv_cxx_thread=no
1313if test ! -z "$CXX"
1314then
1315AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1316ac_save_cxx="$CXX"
1317
1318if test "$ac_cv_kpthread" = "yes"
1319then
Martin v. Löwis519adae2003-09-20 10:47:47 +00001320 CXX="$CXX -Kpthread"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001321 ac_cv_cxx_thread=yes
1322elif test "$ac_cv_kthread" = "yes"
1323then
1324 CXX="$CXX -Kthread"
1325 ac_cv_cxx_thread=yes
1326elif test "$ac_cv_pthread" = "yes"
1327then
1328 CXX="$CXX -pthread"
1329 ac_cv_cxx_thread=yes
1330fi
1331
1332if test $ac_cv_cxx_thread = yes
1333then
1334 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1335 $CXX -c conftest.$ac_ext 2>&5
1336 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1337 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1338 then
1339 ac_cv_cxx_thread=yes
1340 else
1341 ac_cv_cxx_thread=no
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001342 fi
1343 rm -fr conftest*
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001344fi
Brett Cannonc601e0f2004-11-07 01:24:12 +00001345AC_MSG_RESULT($ac_cv_cxx_thread)
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001346fi
Martin v. Löwis519adae2003-09-20 10:47:47 +00001347CXX="$ac_save_cxx"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001348
Fred Drakece81d592000-07-09 14:39:29 +00001349dnl # check for ANSI or K&R ("traditional") preprocessor
1350dnl AC_MSG_CHECKING(for C preprocessor type)
1351dnl AC_TRY_COMPILE([
1352dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1353dnl int foo;
1354dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1355dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
1356dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +00001357
Guido van Rossum627b2d71993-12-24 10:39:16 +00001358# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001359AC_HEADER_STDC
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001360AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1361fcntl.h grp.h \
Neal Norwitz9fdfaaf2008-03-28 05:34:59 +00001362ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001363shadow.h signal.h stdint.h stropts.h termios.h thread.h \
Martin v. Löwis14e73b12003-01-01 09:51:12 +00001364unistd.h utime.h \
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00001365sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1366sys/lock.h sys/mkdev.h sys/modem.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001367sys/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 +00001368sys/termio.h sys/time.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001369sys/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 +00001370sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001371bluetooth/bluetooth.h linux/tipc.h spawn.h util.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001372AC_HEADER_DIRENT
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00001373AC_HEADER_MAJOR
Guido van Rossum627b2d71993-12-24 10:39:16 +00001374
Martin v. Löwisae2830c2004-09-18 09:54:52 +00001375# On Solaris, term.h requires curses.h
Martin v. Löwisfd1c69e2004-11-30 22:09:37 +00001376AC_CHECK_HEADERS(term.h,,,[
Martin v. Löwis5d52e782004-09-18 10:07:03 +00001377#ifdef HAVE_CURSES_H
1378#include <curses.h>
1379#endif
1380])
Martin v. Löwisae2830c2004-09-18 09:54:52 +00001381
Martin v. Löwis11017b12006-01-14 18:12:57 +00001382# On Linux, netlink.h requires asm/types.h
1383AC_CHECK_HEADERS(linux/netlink.h,,,[
1384#ifdef HAVE_ASM_TYPES_H
1385#include <asm/types.h>
1386#endif
1387#ifdef HAVE_SYS_SOCKET_H
1388#include <sys/socket.h>
1389#endif
1390])
1391
Guido van Rossum627b2d71993-12-24 10:39:16 +00001392# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001393was_it_defined=no
1394AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001395AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1396 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1397])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001398AC_MSG_RESULT($was_it_defined)
1399
Neal Norwitz11690112002-07-30 01:08:28 +00001400# Check whether using makedev requires defining _OSF_SOURCE
1401AC_MSG_CHECKING(for makedev)
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001402AC_TRY_LINK([#include <sys/types.h> ],
Neal Norwitz11690112002-07-30 01:08:28 +00001403 [ makedev(0, 0) ],
1404 ac_cv_has_makedev=yes,
1405 ac_cv_has_makedev=no)
1406if test "$ac_cv_has_makedev" = "no"; then
1407 # we didn't link, try if _OSF_SOURCE will allow us to link
1408 AC_TRY_LINK([
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001409#define _OSF_SOURCE 1
1410#include <sys/types.h>
Neal Norwitz11690112002-07-30 01:08:28 +00001411 ],
1412 [ makedev(0, 0) ],
1413 ac_cv_has_makedev=yes,
1414 ac_cv_has_makedev=no)
1415 if test "$ac_cv_has_makedev" = "yes"; then
1416 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1417 fi
1418fi
1419AC_MSG_RESULT($ac_cv_has_makedev)
1420if test "$ac_cv_has_makedev" = "yes"; then
1421 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1422fi
1423
Martin v. Löwis399a6892002-10-04 10:22:02 +00001424# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1425# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1426# defined, but the compiler does not support pragma redefine_extname,
1427# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1428# structures (such as rlimit64) without declaring them. As a
1429# work-around, disable LFS on such configurations
1430
1431use_lfs=yes
1432AC_MSG_CHECKING(Solaris LFS bug)
1433AC_TRY_COMPILE([
1434#define _LARGEFILE_SOURCE 1
1435#define _FILE_OFFSET_BITS 64
1436#include <sys/resource.h>
1437],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1438AC_MSG_RESULT($sol_lfs_bug)
1439if test "$sol_lfs_bug" = "yes"; then
1440 use_lfs=no
1441fi
1442
1443if test "$use_lfs" = "yes"; then
Guido van Rossum810cc512001-09-09 23:51:39 +00001444# Two defines needed to enable largefile support on various platforms
1445# These may affect some typedefs
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001446AC_DEFINE(_LARGEFILE_SOURCE, 1,
1447[This must be defined on some systems to enable large file support.])
1448AC_DEFINE(_FILE_OFFSET_BITS, 64,
1449[This must be set to 64 on some systems to enable large file support.])
Martin v. Löwis399a6892002-10-04 10:22:02 +00001450fi
Guido van Rossum810cc512001-09-09 23:51:39 +00001451
Guido van Rossum300fda71996-08-19 21:58:16 +00001452# Add some code to confdefs.h so that the test for off_t works on SCO
1453cat >> confdefs.h <<\EOF
1454#if defined(SCO_DS)
1455#undef _OFF_T
1456#endif
1457EOF
1458
Guido van Rossumef2255b2000-03-10 22:30:29 +00001459# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001460AC_TYPE_MODE_T
1461AC_TYPE_OFF_T
1462AC_TYPE_PID_T
1463AC_TYPE_SIGNAL
1464AC_TYPE_SIZE_T
1465AC_TYPE_UID_T
Mark Dickinsonefc82f72009-03-20 15:51:55 +00001466AC_TYPE_UINT32_T
1467AC_TYPE_UINT64_T
1468AC_TYPE_INT32_T
1469AC_TYPE_INT64_T
Christian Heimes951cc0f2008-01-31 23:08:23 +00001470AC_CHECK_TYPE(ssize_t,
Martin v. Löwis18e16552006-02-15 17:27:45 +00001471 AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001472
Guido van Rossumef2255b2000-03-10 22:30:29 +00001473# Sizes of various common basic types
Skip Montanarob9820a32004-01-17 00:16:12 +00001474# ANSI C requires sizeof(char) == 1, so no need to check it
Guido van Rossum3065c942001-09-17 04:03:14 +00001475AC_CHECK_SIZEOF(int, 4)
1476AC_CHECK_SIZEOF(long, 4)
1477AC_CHECK_SIZEOF(void *, 4)
Guido van Rossum3065c942001-09-17 04:03:14 +00001478AC_CHECK_SIZEOF(short, 2)
1479AC_CHECK_SIZEOF(float, 4)
1480AC_CHECK_SIZEOF(double, 8)
1481AC_CHECK_SIZEOF(fpos_t, 4)
Martin v. Löwis18e16552006-02-15 17:27:45 +00001482AC_CHECK_SIZEOF(size_t, 4)
Christian Heimes951cc0f2008-01-31 23:08:23 +00001483AC_CHECK_SIZEOF(pid_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +00001484
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001485AC_MSG_CHECKING(for long long support)
1486have_long_long=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001487AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1488 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1489 have_long_long=yes
1490])
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001491AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001492if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +00001493AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001494fi
1495
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001496AC_MSG_CHECKING(for long double support)
1497have_long_double=no
1498AC_TRY_COMPILE([], [long double x; x = (long double)0.;], [
1499 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1500 have_long_double=yes
1501])
1502AC_MSG_RESULT($have_long_double)
Mark Dickinsondc1688a2008-06-27 22:20:14 +00001503if test "$have_long_double" = yes ; then
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001504AC_CHECK_SIZEOF(long double, 12)
1505fi
1506
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001507AC_MSG_CHECKING(for _Bool support)
1508have_c99_bool=no
1509AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [
1510 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1511 have_c99_bool=yes
1512])
1513AC_MSG_RESULT($have_c99_bool)
1514if test "$have_c99_bool" = yes ; then
1515AC_CHECK_SIZEOF(_Bool, 1)
1516fi
1517
Martin v. Löwisebe26702006-10-02 14:55:51 +00001518AC_CHECK_TYPES(uintptr_t,
1519 [AC_CHECK_SIZEOF(uintptr_t, 4)],
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001520 [], [#ifdef HAVE_STDINT_H
1521 #include <stdint.h>
1522 #endif])
Martin v. Löwisebe26702006-10-02 14:55:51 +00001523
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001524AC_CHECK_SIZEOF(off_t, [], [
1525#ifdef HAVE_SYS_TYPES_H
1526#include <sys/types.h>
1527#endif
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001528])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001529
1530AC_MSG_CHECKING(whether to enable large file support)
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001531if test "$have_long_long" = yes
1532then
1533if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001534 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001535 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1536 [Defined to enable large file support when an off_t is bigger than a long
1537 and long long is available and at least as big as an off_t. You may need
1538 to add some flags for configuration and compilation to enable this mode.
1539 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001540 AC_MSG_RESULT(yes)
1541else
1542 AC_MSG_RESULT(no)
1543fi
Mark Dickinson0ef0b912009-12-31 21:11:48 +00001544else
1545 AC_MSG_RESULT(no)
1546fi
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001547
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001548AC_CHECK_SIZEOF(time_t, [], [
1549#ifdef HAVE_SYS_TYPES_H
1550#include <sys/types.h>
1551#endif
1552#ifdef HAVE_TIME_H
1553#include <time.h>
1554#endif
Fred Drakea3f6e912000-06-29 20:44:47 +00001555])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001556
Trent Mick635f6fb2000-08-23 21:33:05 +00001557# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001558ac_save_cc="$CC"
1559if test "$ac_cv_kpthread" = "yes"
1560then CC="$CC -Kpthread"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001561elif test "$ac_cv_kthread" = "yes"
1562then CC="$CC -Kthread"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001563elif test "$ac_cv_pthread" = "yes"
1564then CC="$CC -pthread"
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001565fi
Trent Mick635f6fb2000-08-23 21:33:05 +00001566AC_MSG_CHECKING(for pthread_t)
1567have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +00001568AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +00001569AC_MSG_RESULT($have_pthread_t)
1570if test "$have_pthread_t" = yes ; then
Alexandre Vassalotti856782e2009-07-17 04:59:05 +00001571 AC_CHECK_SIZEOF(pthread_t, [], [
1572#ifdef HAVE_PTHREAD_H
1573#include <pthread.h>
1574#endif
Trent Mick635f6fb2000-08-23 21:33:05 +00001575 ])
Trent Mick635f6fb2000-08-23 21:33:05 +00001576fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001577CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +00001578
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001579AC_MSG_CHECKING(for --enable-toolbox-glue)
1580AC_ARG_ENABLE(toolbox-glue,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001581 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001582
1583if test -z "$enable_toolbox_glue"
1584then
1585 case $ac_sys_system/$ac_sys_release in
1586 Darwin/*)
1587 enable_toolbox_glue="yes";;
1588 *)
1589 enable_toolbox_glue="no";;
1590 esac
1591fi
1592case "$enable_toolbox_glue" in
1593yes)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001594 extra_machdep_objs="Python/mactoolboxglue.o"
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001595 extra_undefs="-u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001596 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1597 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001598 ;;
1599*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001600 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +00001601 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001602 ;;
1603esac
1604AC_MSG_RESULT($enable_toolbox_glue)
1605
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00001606
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001607AC_SUBST(OTHER_LIBTOOL_OPT)
1608case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001609 Darwin/@<:@01567@:>@\..*)
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001610 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1611 ;;
1612 Darwin/*)
1613 OTHER_LIBTOOL_OPT=""
1614 ;;
1615esac
1616
Ronald Oussoren25967582009-09-06 10:00:26 +00001617
1618ARCH_RUN_32BIT=""
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001619AC_SUBST(LIBTOOL_CRUFT)
1620case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001621 Darwin/@<:@01567@:>@\..*)
Ronald Oussoren988117f2006-04-29 11:31:35 +00001622 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1623 if test "${enable_universalsdk}"; then
1624 :
1625 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001626 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001627 fi
Jack Jansenb36687a2004-07-16 08:43:47 +00001628 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001629 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +00001630 Darwin/*)
Ronald Oussorena55af9a2010-01-17 16:25:57 +00001631 gcc_version=`gcc -dumpversion`
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001632 if test ${gcc_version} '<' 4.0
1633 then
1634 LIBTOOL_CRUFT="-lcc_dynamic"
1635 else
1636 LIBTOOL_CRUFT=""
1637 fi
Ronald Oussoren23d92532009-09-07 06:12:00 +00001638 AC_TRY_RUN([
Ronald Oussoren25967582009-09-06 10:00:26 +00001639 #include <unistd.h>
1640 int main(int argc, char*argv[])
1641 {
1642 if (sizeof(long) == 4) {
1643 return 0;
1644 } else {
1645 return 1;
1646 }
Ronald Oussoren84ddd722009-09-08 07:17:10 +00001647 }
Ronald Oussoren23d92532009-09-07 06:12:00 +00001648 ], ac_osx_32bit=yes,
Ronald Oussoren25967582009-09-06 10:00:26 +00001649 ac_osx_32bit=no,
Ronald Oussoren23d92532009-09-07 06:12:00 +00001650 ac_osx_32bit=yes)
Ronald Oussoren25967582009-09-06 10:00:26 +00001651
1652 if test "${ac_osx_32bit}" = "yes"; then
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001653 case `/usr/bin/arch` in
Ronald Oussoren25967582009-09-06 10:00:26 +00001654 i386)
1655 MACOSX_DEFAULT_ARCH="i386"
1656 ;;
1657 ppc)
1658 MACOSX_DEFAULT_ARCH="ppc"
1659 ;;
1660 *)
1661 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1662 ;;
1663 esac
1664 else
Ronald Oussorenbc0e83c2010-02-11 13:26:54 +00001665 case `/usr/bin/arch` in
Ronald Oussoren25967582009-09-06 10:00:26 +00001666 i386)
1667 MACOSX_DEFAULT_ARCH="x86_64"
1668 ;;
1669 ppc)
1670 MACOSX_DEFAULT_ARCH="ppc64"
1671 ;;
1672 *)
1673 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1674 ;;
1675 esac
1676
1677 #ARCH_RUN_32BIT="true"
1678 fi
1679
1680 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
Jack Jansenb36687a2004-07-16 08:43:47 +00001681 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001682 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001683esac
1684
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001685AC_MSG_CHECKING(for --enable-framework)
1686if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001687then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001688 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001689 # -F. is needed to allow linking to the framework while
1690 # in the build location.
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001691 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1692 [Define if you want to produce an OpenStep/Rhapsody framework
1693 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001694 AC_MSG_RESULT(yes)
Ronald Oussoren450d5612009-06-08 21:12:41 +00001695 if test $enable_shared = "yes"
1696 then
Ronald Oussoren9ebd2422009-09-29 13:00:44 +00001697 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 +00001698 fi
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001699else
1700 AC_MSG_RESULT(no)
1701fi
1702
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001703AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001704case $ac_sys_system/$ac_sys_release in
1705 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001706 AC_DEFINE(WITH_DYLD, 1,
1707 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1708 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1709 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001710 AC_MSG_RESULT(always on for Darwin)
1711 ;;
1712 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001713 AC_MSG_RESULT(no)
1714 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001715esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001716
Guido van Rossumac405f61994-09-12 10:56:06 +00001717# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +00001718AC_SUBST(SO)
1719AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001720AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001721AC_SUBST(CCSHARED)
1722AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001723# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +00001724# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001725AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +00001726if test -z "$SO"
1727then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001728 case $ac_sys_system in
Neal Norwitz58e28882006-05-19 07:00:58 +00001729 hp*|HP*)
1730 case `uname -m` in
1731 ia64) SO=.so;;
1732 *) SO=.sl;;
1733 esac
1734 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001735 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001736 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +00001737 esac
Martin v. Löwis368de8f2003-06-14 14:46:38 +00001738else
1739 # this might also be a termcap variable, see #610332
1740 echo
1741 echo '====================================================================='
1742 echo '+ +'
1743 echo '+ WARNING: You have set SO in your environment. +'
1744 echo '+ Do you really mean to change the extension for shared libraries? +'
1745 echo '+ Continuing in 10 seconds to let you to ponder. +'
1746 echo '+ +'
1747 echo '====================================================================='
1748 sleep 10
Guido van Rossumac405f61994-09-12 10:56:06 +00001749fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001750AC_MSG_RESULT($SO)
Ronald Oussoren79f90492009-01-02 10:44:46 +00001751
Neal Norwitz58e28882006-05-19 07:00:58 +00001752AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
Guido van Rossumac405f61994-09-12 10:56:06 +00001753# LDSHARED is the ld *command* used to create shared library
Skip Montanaroce59c042004-01-17 14:19:44 +00001754# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001755# (Shared libraries in this instance are shared modules to be loaded into
1756# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001757AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001758if test -z "$LDSHARED"
1759then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001760 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001761 AIX*)
1762 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
Guido van Rossumce608b02001-09-28 15:59:38 +00001763 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001764 ;;
1765 BeOS*)
1766 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +00001767 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001768 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001769 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +00001770 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Greg Ward57c9a662000-05-26 12:22:54 +00001771 SunOS/5*)
1772 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +00001773 then LDSHARED='$(CC) -shared'
Martin v. Löwisaa5afe12002-10-07 06:21:41 +00001774 else LDSHARED='$(CC) -G';
Greg Ward57c9a662000-05-26 12:22:54 +00001775 fi ;;
Thomas Hellerdc96a772008-04-04 10:07:55 +00001776 hp*|HP*)
1777 if test "$GCC" = "yes"
1778 then LDSHARED='$(CC) -shared'
1779 else LDSHARED='ld -b';
1780 fi ;;
Guido van Rossum71001e41995-01-26 00:44:03 +00001781 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Jack Jansen418c3b12001-11-14 10:59:57 +00001782 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +00001783 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1784 if test "$enable_framework" ; then
1785 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001786 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1787 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001788 else
1789 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +00001790 LDSHARED="$LDSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +00001791 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00001792 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001793 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1794 if test "$enable_framework" ; then
1795 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001796 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1797 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001798 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +00001799 # No framework, use the Python app as bundle-loader
1800 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
Jack Jansenc28fc372003-02-25 13:14:43 +00001801 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001802 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00001803 Darwin/*)
1804 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1805 # This allows an extension to be used in any Python
Ronald Oussoren38f1b982007-09-02 09:46:07 +00001806
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001807 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
Jack Jansen6b08a402004-06-03 12:41:45 +00001808 then
Ronald Oussoren988117f2006-04-29 11:31:35 +00001809 if test "${enable_universalsdk}"; then
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001810 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001811 fi
Jack Jansen6b08a402004-06-03 12:41:45 +00001812 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1813 BLDSHARED="$LDSHARED"
Jack Jansen6b08a402004-06-03 12:41:45 +00001814 else
1815 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1816 if test "$enable_framework" ; then
1817 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001818 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1819 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen6b08a402004-06-03 12:41:45 +00001820 else
1821 # No framework, use the Python app as bundle-loader
1822 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1823 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1824 fi
1825 fi
1826 ;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +00001827 Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';;
Guido van Rossum458e7fa1999-09-17 15:40:40 +00001828 BSD/OS*/4*) LDSHARED="gcc -shared";;
Martin v. Löwis222c5152006-06-03 07:37:13 +00001829 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +00001830 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +00001831 then
Hye-Shik Chang33761492004-10-26 09:53:46 +00001832 LDSHARED="$CC -shared ${LDFLAGS}"
Guido van Rossum0286ae82000-08-29 15:06:49 +00001833 else
1834 LDSHARED="ld -Bshareable ${LDFLAGS}"
1835 fi;;
Martin v. Löwis222c5152006-06-03 07:37:13 +00001836 OpenBSD*)
1837 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1838 then
1839 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1840 else
1841 case `uname -r` in
1842 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
1843 LDSHARED="ld -Bshareable ${LDFLAGS}"
1844 ;;
1845 *)
1846 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1847 ;;
1848 esac
1849 fi;;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001850 NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001851 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001852 if test "$GCC" = "yes"
Martin v. Löwis79f3c532002-12-11 12:51:58 +00001853 then LDSHARED='$(CC) -shared'
1854 else LDSHARED='$(CC) -G'
Martin v. Löwisbec19582001-03-21 15:57:54 +00001855 fi;;
Martin v. Löwis79f3c532002-12-11 12:51:58 +00001856 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001857 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001858 atheos*) LDSHARED="gcc -shared";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001859 *) LDSHARED="ld";;
1860 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001861fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001862AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001863BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +00001864# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001865# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001866AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001867if test -z "$CCSHARED"
1868then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001869 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +00001870 SunOS*) if test "$GCC" = yes;
Martin v. Löwiseb623572007-03-12 10:50:39 +00001871 then CCSHARED="-fPIC";
1872 elif test `uname -p` = sparc;
1873 then CCSHARED="-xcode=pic32";
1874 else CCSHARED="-Kpic";
1875 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +00001876 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +00001877 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +00001878 else CCSHARED="+z";
1879 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001880 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001881 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001882 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001883 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001884 if test "$GCC" = "yes"
1885 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001886 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +00001887 fi;;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001888 SCO_SV*)
1889 if test "$GCC" = "yes"
1890 then CCSHARED="-fPIC"
1891 else CCSHARED="-Kpic -belf"
1892 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001893 IRIX*/6*) case $CC in
1894 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +00001895 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001896 esac;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001897 atheos*) CCSHARED="-fPIC";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001898 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001899fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001900AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001901# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +00001902# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001903AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001904if test -z "$LINKFORSHARED"
1905then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001906 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001907 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +00001908 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +00001909 LINKFORSHARED="-Wl,-E -Wl,+s";;
1910# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001911 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001912 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001913 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001914 Darwin/*)
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001915 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1916 # which is
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001917 # not used by the core itself but which needs to be in the core so
1918 # that dynamically loaded extension modules have access to it.
Jack Jansen97e3f002003-02-23 22:59:01 +00001919 # -prebind is no longer used, because it actually seems to give a
1920 # slowdown in stead of a speedup, maybe due to the large number of
1921 # dynamic loads Python does.
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001922
1923 LINKFORSHARED="$extra_undefs"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001924 if test "$enable_framework"
1925 then
Jack Jansenda49e192005-01-07 13:08:22 +00001926 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001927 fi
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001928 LINKFORSHARED="$LINKFORSHARED";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001929 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001930 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +00001931 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001932 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
Guido van Rossumdf693651999-01-07 21:50:41 +00001933 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1934 then
1935 LINKFORSHARED="-Wl,--export-dynamic"
1936 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001937 SunOS/5*) case $CC in
1938 *gcc*)
Martin v. Löwisa4548572002-04-18 14:51:36 +00001939 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +00001940 then
1941 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001942 fi;;
1943 esac;;
Jason Tishler30765592003-09-04 11:04:06 +00001944 CYGWIN*)
1945 if test $enable_shared = "no"
1946 then
1947 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1948 fi;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +00001949 QNX*)
1950 # -Wl,-E causes the symbols to be added to the dynamic
1951 # symbol table so that they can be found when a module
1952 # is loaded. -N 2048K causes the stack size to be set
1953 # to 2048 kilobytes so that the stack doesn't overflow
1954 # when running test_compile.py.
1955 LINKFORSHARED='-Wl,-E -N 2048K';;
Guido van Rossumac405f61994-09-12 10:56:06 +00001956 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001957fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001958AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001959
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00001960
Neil Schemenauer61c51152001-01-26 16:18:16 +00001961AC_SUBST(CFLAGSFORSHARED)
1962AC_MSG_CHECKING(CFLAGSFORSHARED)
1963if test ! "$LIBRARY" = "$LDLIBRARY"
1964then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +00001965 case $ac_sys_system in
1966 CYGWIN*)
1967 # Cygwin needs CCSHARED when building extension DLLs
1968 # but not when building the interpreter DLL.
1969 CFLAGSFORSHARED='';;
1970 *)
1971 CFLAGSFORSHARED='$(CCSHARED)'
1972 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +00001973fi
1974AC_MSG_RESULT($CFLAGSFORSHARED)
1975
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001976# SHLIBS are libraries (except -lc and -lm) to link to the python shared
1977# library (with --enable-shared).
1978# For platforms on which shared libraries are not allowed to have unresolved
Martin v. Löwisd6359c52002-08-04 12:38:50 +00001979# symbols, this must be set to $(LIBS) (expanded by make). We do this even
1980# if it is not required, since it creates a dependency of the shared library
1981# to LIBS. This, in turn, means that applications linking the shared libpython
1982# don't need to link LIBS explicitly. The default should be only changed
1983# on systems where this approach causes problems.
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001984AC_SUBST(SHLIBS)
1985AC_MSG_CHECKING(SHLIBS)
1986case "$ac_sys_system" in
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001987 *)
Martin v. Löwisd6359c52002-08-04 12:38:50 +00001988 SHLIBS='$(LIBS)';;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001989esac
1990AC_MSG_RESULT($SHLIBS)
1991
1992
Guido van Rossum627b2d71993-12-24 10:39:16 +00001993# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001994AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1995AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Martin v. Löwis519adae2003-09-20 10:47:47 +00001996
Skip Montanaro4d756af2008-12-01 01:55:22 +00001997# only check for sem_init if thread support is requested
Martin v. Löwis519adae2003-09-20 10:47:47 +00001998if test "$with_threads" = "yes" -o -z "$with_threads"; then
1999 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
2000 # posix4 on Solaris 2.6
2001 # pthread (first!) on Linux
2002fi
2003
Martin v. Löwis19d17342003-06-14 21:03:05 +00002004# check if we need libintl for locale functions
2005AC_CHECK_LIB(intl, textdomain,
2006 AC_DEFINE(WITH_LIBINTL, 1,
2007 [Define to 1 if libintl is needed for locale functions.]))
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002008
2009# checks for system dependent C++ extensions support
2010case "$ac_sys_system" in
2011 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
2012 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
2013 [loadAndInit("", 0, "")],
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002014 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
2015 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
2016 and you want support for AIX C++ shared extension modules.])
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00002017 AC_MSG_RESULT(yes)],
2018 [AC_MSG_RESULT(no)]);;
2019 *) ;;
2020esac
2021
Guido van Rossum70c7f481998-03-26 18:44:10 +00002022# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002023# BeOS' sockets are stashed in libnet.
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002024AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00002025AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Skip Montanarob9949db2004-01-17 04:04:13 +00002026
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00002027case "$ac_sys_system" in
2028BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00002029AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
2030;;
2031esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00002032
Guido van Rossumc5a39031996-07-31 17:35:03 +00002033AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002034AC_ARG_WITH(libs,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002035 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
2036[
Guido van Rossumc5a39031996-07-31 17:35:03 +00002037AC_MSG_RESULT($withval)
2038LIBS="$withval $LIBS"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002039],
2040[AC_MSG_RESULT(no)])
Guido van Rossum627b2d71993-12-24 10:39:16 +00002041
Benjamin Peterson2c196742009-12-31 03:17:18 +00002042# Check for use of the system expat library
2043AC_MSG_CHECKING(for --with-system-expat)
2044AC_ARG_WITH(system_expat,
2045 AC_HELP_STRING(--with-system-expat, build pyexpat module using an installed expat library))
2046
2047AC_MSG_RESULT($with_system_expat)
2048
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002049# Check for use of the system libffi library
2050AC_MSG_CHECKING(for --with-system-ffi)
2051AC_ARG_WITH(system_ffi,
2052 AC_HELP_STRING(--with-system-ffi, build _ctypes module using an installed ffi library))
2053
Benjamin Peterson1c335e62010-01-01 15:16:29 +00002054if test "$with_system_ffi" = "yes"; then
2055 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2056 LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
2057else
2058 LIBFFI_INCLUDEDIR=""
2059fi
2060AC_SUBST(LIBFFI_INCLUDEDIR)
2061
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002062AC_MSG_RESULT($with_system_ffi)
2063
Matthias Klose10cbe482009-04-29 17:18:19 +00002064# Check for --with-dbmliborder
2065AC_MSG_CHECKING(for --with-dbmliborder)
2066AC_ARG_WITH(dbmliborder,
Matthias Klose51c614e2009-04-29 19:52:49 +00002067 AC_HELP_STRING([--with-dbmliborder=db1:db2:...], [order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]),
Matthias Klose10cbe482009-04-29 17:18:19 +00002068[
2069if test x$with_dbmliborder = xyes
2070then
2071AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2072else
2073 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
2074 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
2075 then
2076 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2077 fi
2078 done
Matthias Klose61dbdb92009-04-29 20:09:50 +00002079fi])
2080AC_MSG_RESULT($with_dbmliborder)
Matthias Klose10cbe482009-04-29 17:18:19 +00002081
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002082# Determine if signalmodule should be used.
2083AC_SUBST(USE_SIGNAL_MODULE)
2084AC_SUBST(SIGNAL_OBJS)
2085AC_MSG_CHECKING(for --with-signal-module)
2086AC_ARG_WITH(signal-module,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002087 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002088
2089if test -z "$with_signal_module"
2090then with_signal_module="yes"
2091fi
2092AC_MSG_RESULT($with_signal_module)
2093
2094if test "${with_signal_module}" = "yes"; then
2095 USE_SIGNAL_MODULE=""
2096 SIGNAL_OBJS=""
2097else
2098 USE_SIGNAL_MODULE="#"
2099 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2100fi
2101
Guido van Rossum3d15bd82001-01-10 18:53:48 +00002102# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00002103AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002104USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00002105
Guido van Rossum54d93d41997-01-22 20:51:58 +00002106AC_MSG_CHECKING(for --with-dec-threads)
2107AC_SUBST(LDLAST)
2108AC_ARG_WITH(dec-threads,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002109 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
2110[
Barry Warsawc0d24d82000-06-29 16:12:00 +00002111AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00002112LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00002113if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00002114 with_thread="$withval";
2115fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002116[AC_MSG_RESULT(no)])
Guido van Rossum54d93d41997-01-22 20:51:58 +00002117
Martin v. Löwis11437992002-04-12 09:54:03 +00002118# Templates for things AC_DEFINEd more than once.
2119# For a single AC_DEFINE, no template is needed.
2120AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2121AH_TEMPLATE(_REENTRANT,
2122 [Define to force use of thread-safe errno, h_errno, and other functions])
2123AH_TEMPLATE(WITH_THREAD,
2124 [Define if you want to compile in rudimentary thread support])
2125
Guido van Rossum54d93d41997-01-22 20:51:58 +00002126AC_MSG_CHECKING(for --with-threads)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002127dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawc0d24d82000-06-29 16:12:00 +00002128AC_ARG_WITH(threads,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002129 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
Guido van Rossum54d93d41997-01-22 20:51:58 +00002130
Barry Warsawc0d24d82000-06-29 16:12:00 +00002131# --with-thread is deprecated, but check for it anyway
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002132dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00002133AC_ARG_WITH(thread,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002134 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
2135 [with_threads=$with_thread])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002136
2137if test -z "$with_threads"
2138then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002139fi
Barry Warsawc0d24d82000-06-29 16:12:00 +00002140AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00002141
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002142AC_SUBST(THREADOBJ)
Barry Warsawc0d24d82000-06-29 16:12:00 +00002143if test "$with_threads" = "no"
2144then
2145 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002146elif test "$ac_cv_pthread_is_default" = yes
2147then
2148 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002149 # Defining _REENTRANT on system with POSIX threads should not hurt.
2150 AC_DEFINE(_REENTRANT)
2151 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002152 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00002153elif test "$ac_cv_kpthread" = "yes"
2154then
2155 CC="$CC -Kpthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002156 if test "$ac_cv_cxx_thread" = "yes"; then
2157 CXX="$CXX -Kpthread"
2158 fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00002159 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002160 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002161 THREADOBJ="Python/thread.o"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002162elif test "$ac_cv_kthread" = "yes"
2163then
2164 CC="$CC -Kthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002165 if test "$ac_cv_cxx_thread" = "yes"; then
2166 CXX="$CXX -Kthread"
2167 fi
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002168 AC_DEFINE(WITH_THREAD)
2169 posix_threads=yes
2170 THREADOBJ="Python/thread.o"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002171elif test "$ac_cv_pthread" = "yes"
2172then
2173 CC="$CC -pthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002174 if test "$ac_cv_cxx_thread" = "yes"; then
2175 CXX="$CXX -pthread"
2176 fi
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002177 AC_DEFINE(WITH_THREAD)
2178 posix_threads=yes
2179 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d82000-06-29 16:12:00 +00002180else
Martin v. Löwis130fb172001-07-19 11:00:41 +00002181 if test ! -z "$with_threads" -a -d "$with_threads"
2182 then LDFLAGS="$LDFLAGS -L$with_threads"
2183 fi
2184 if test ! -z "$withval" -a -d "$withval"
2185 then LDFLAGS="$LDFLAGS -L$withval"
2186 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002187
2188 # According to the POSIX spec, a pthreads implementation must
Matthias Klosea2542be2004-08-16 11:35:51 +00002189 # define _POSIX_THREADS in unistd.h. Some apparently don't
2190 # (e.g. gnu pth with pthread emulation)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002191 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2192 AC_EGREP_CPP(yes,
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002193 [
2194#include <unistd.h>
2195#ifdef _POSIX_THREADS
2196yes
2197#endif
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002198 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2199 AC_MSG_RESULT($unistd_defines_pthreads)
2200
Martin v. Löwis130fb172001-07-19 11:00:41 +00002201 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002202 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2203 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002204 AC_DEFINE(HURD_C_THREADS, 1,
2205 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002206 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002207 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002208 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2209 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002210 AC_DEFINE(MACH_C_THREADS, 1,
2211 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002212 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002213 AC_MSG_CHECKING(for --with-pth)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002214 AC_ARG_WITH([pth],
2215 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
2216 [AC_MSG_RESULT($withval)
2217 AC_DEFINE([WITH_THREAD])
2218 AC_DEFINE([HAVE_PTH], 1,
2219 [Define if you have GNU PTH threads.])
2220 LIBS="-lpth $LIBS"
2221 THREADOBJ="Python/thread.o"],
2222 [AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002223
2224 # Just looking for pthread_create in libpthread is not enough:
2225 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2226 # So we really have to include pthread.h, and then link.
2227 _libs=$LIBS
2228 LIBS="$LIBS -lpthread"
2229 AC_MSG_CHECKING([for pthread_create in -lpthread])
2230 AC_TRY_LINK([#include <pthread.h>
2231
2232void * start_routine (void *arg) { exit (0); }], [
2233pthread_create (NULL, NULL, start_routine, NULL)], [
2234 AC_MSG_RESULT(yes)
2235 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002236 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002237 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002238 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00002239 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002240 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002241 THREADOBJ="Python/thread.o"],[
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002242 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2243 AC_DEFINE(ATHEOS_THREADS, 1,
2244 [Define this if you have AtheOS threads.])
2245 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002246 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002247 AC_DEFINE(BEOS_THREADS, 1,
2248 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002249 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002250 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002251 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002252 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002253 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002254 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002255 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002256 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002257 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002258 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002259 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002260 LIBS="$LIBS -lpthread"
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_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002263 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002264 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002265 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002266 USE_THREAD_MODULE="#"])
Skip Montanarof8712e52004-01-17 03:04:46 +00002267 ])])])])])])])])])])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002268
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002269 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2270 LIBS="$LIBS -lmpc"
2271 THREADOBJ="Python/thread.o"
2272 USE_THREAD_MODULE=""])
2273
2274 if test "$posix_threads" != "yes"; then
2275 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2276 LIBS="$LIBS -lthread"
2277 THREADOBJ="Python/thread.o"
2278 USE_THREAD_MODULE=""])
2279 fi
2280
2281 if test "$USE_THREAD_MODULE" != "#"
2282 then
2283 # If the above checks didn't disable threads, (at least) OSF1
2284 # needs this '-threads' argument during linking.
2285 case $ac_sys_system in
2286 OSF1) LDLAST=-threads;;
2287 esac
2288 fi
2289fi
2290
2291if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002292 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002293 AC_DEFINE(_POSIX_THREADS, 1,
2294 [Define if you have POSIX threads,
2295 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002296 fi
2297
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002298 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2299 case $ac_sys_system/$ac_sys_release in
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002300 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
2301 Defined for Solaris 2.6 bug in pthread header.)
2302 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002303 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002304 Define if the Posix semaphores do not work on your system)
2305 ;;
Christian Heimescba36bb2008-01-30 22:54:18 +00002306 AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2307 Define if the Posix semaphores do not work on your system)
2308 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002309 esac
2310
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002311 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2312 AC_CACHE_VAL(ac_cv_pthread_system_supported,
2313 [AC_TRY_RUN([#include <pthread.h>
2314 void *foo(void *parm) {
2315 return NULL;
2316 }
2317 main() {
2318 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002319 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002320 if (pthread_attr_init(&attr)) exit(-1);
2321 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002322 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002323 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00002324 }],
2325 ac_cv_pthread_system_supported=yes,
2326 ac_cv_pthread_system_supported=no,
2327 ac_cv_pthread_system_supported=no)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002328 ])
2329 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2330 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002331 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002332 fi
Jason Tishlerfac083d2003-07-22 15:20:49 +00002333 AC_CHECK_FUNCS(pthread_sigmask,
2334 [case $ac_sys_system in
2335 CYGWIN*)
2336 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2337 [Define if pthread_sigmask() does not work on your system.])
2338 ;;
2339 esac])
Barry Warsawc0d24d82000-06-29 16:12:00 +00002340fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002341
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002342
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002343# Check for enable-ipv6
Martin v. Löwis11437992002-04-12 09:54:03 +00002344AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002345AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002346AC_ARG_ENABLE(ipv6,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002347[ --enable-ipv6 Enable ipv6 (with ipv4) support
2348 --disable-ipv6 Disable ipv6 support],
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002349[ case "$enableval" in
2350 no)
2351 AC_MSG_RESULT(no)
2352 ipv6=no
2353 ;;
2354 *) AC_MSG_RESULT(yes)
2355 AC_DEFINE(ENABLE_IPV6)
2356 ipv6=yes
2357 ;;
2358 esac ],
2359
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002360[
2361dnl the check does not work on cross compilation case...
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002362 AC_TRY_RUN([ /* AF_INET6 available check */
2363#include <sys/types.h>
2364#include <sys/socket.h>
2365main()
2366{
2367 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
2368 exit(1);
2369 else
2370 exit(0);
2371}
2372],
2373 AC_MSG_RESULT(yes)
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002374 ipv6=yes,
2375 AC_MSG_RESULT(no)
2376 ipv6=no,
2377 AC_MSG_RESULT(no)
2378 ipv6=no
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002379)
2380
2381if test "$ipv6" = "yes"; then
2382 AC_MSG_CHECKING(if RFC2553 API is available)
2383 AC_TRY_COMPILE([#include <sys/types.h>
2384#include <netinet/in.h>],
2385 [struct sockaddr_in6 x;
2386x.sin6_scope_id;],
2387 AC_MSG_RESULT(yes)
2388 ipv6=yes,
2389 AC_MSG_RESULT(no, IPv6 disabled)
2390 ipv6=no)
2391fi
2392
2393if test "$ipv6" = "yes"; then
2394 AC_DEFINE(ENABLE_IPV6)
2395fi
2396])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002397
2398ipv6type=unknown
2399ipv6lib=none
2400ipv6trylibc=no
2401
2402if test "$ipv6" = "yes"; then
2403 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00002404 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2405 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002406 case $i in
2407 inria)
2408 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002409 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002410#include <netinet/in.h>
2411#ifdef IPV6_INRIA_VERSION
2412yes
2413#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002414 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002415 ;;
2416 kame)
2417 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002418 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002419#include <netinet/in.h>
2420#ifdef __KAME__
2421yes
2422#endif],
2423 [ipv6type=$i;
2424 ipv6lib=inet6
2425 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002426 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002427 ;;
2428 linux-glibc)
2429 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002430 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002431#include <features.h>
2432#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2433yes
2434#endif],
2435 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002436 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002437 ;;
2438 linux-inet6)
2439 dnl http://www.v6.linux.or.jp/
2440 if test -d /usr/inet6; then
2441 ipv6type=$i
2442 ipv6lib=inet6
2443 ipv6libdir=/usr/inet6/lib
Skip Montanarodecc6a42003-01-01 20:07:49 +00002444 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002445 fi
2446 ;;
2447 solaris)
2448 if test -f /etc/netconfig; then
2449 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
2450 ipv6type=$i
2451 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002452 fi
2453 fi
2454 ;;
2455 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002456 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002457#include <sys/param.h>
2458#ifdef _TOSHIBA_INET6
2459yes
2460#endif],
2461 [ipv6type=$i;
2462 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002463 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002464 ;;
2465 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002466 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002467#include </usr/local/v6/include/sys/v6config.h>
2468#ifdef __V6D__
2469yes
2470#endif],
2471 [ipv6type=$i;
2472 ipv6lib=v6;
2473 ipv6libdir=/usr/local/v6/lib;
Skip Montanarodecc6a42003-01-01 20:07:49 +00002474 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002475 ;;
2476 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002477 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002478#include <sys/param.h>
2479#ifdef _ZETA_MINAMI_INET6
2480yes
2481#endif],
2482 [ipv6type=$i;
2483 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002484 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002485 ;;
2486 esac
2487 if test "$ipv6type" != "unknown"; then
2488 break
2489 fi
2490 done
2491 AC_MSG_RESULT($ipv6type)
2492fi
2493
2494if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2495 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2496 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2497 echo "using lib$ipv6lib"
2498 else
2499 if test $ipv6trylibc = "yes"; then
2500 echo "using libc"
2501 else
2502 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2503 echo "You need to fetch lib$ipv6lib.a from appropriate"
2504 echo 'ipv6 kit and compile beforehand.'
2505 exit 1
2506 fi
2507 fi
2508fi
2509
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002510AC_MSG_CHECKING(for OSX 10.5 SDK or later)
2511AC_TRY_COMPILE([#include <Carbon/Carbon.h>], FSIORefNum fRef = 0,
2512 AC_DEFINE(HAVE_OSX105_SDK, 1, Define if compiling using MacOS X 10.5 SDK or later.)
2513 AC_MSG_RESULT(yes),
2514 AC_MSG_RESULT(no)
2515)
2516
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002517# Check for --with-doc-strings
2518AC_MSG_CHECKING(for --with-doc-strings)
2519AC_ARG_WITH(doc-strings,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002520 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002521
2522if test -z "$with_doc_strings"
2523then with_doc_strings="yes"
2524fi
2525if test "$with_doc_strings" != "no"
2526then
2527 AC_DEFINE(WITH_DOC_STRINGS, 1,
2528 [Define if you want documentation strings in extension modules])
2529fi
2530AC_MSG_RESULT($with_doc_strings)
2531
Neil Schemenauera35c6882001-02-27 04:45:05 +00002532# Check for Python-specific malloc support
Martin v. Löwisf30d60e2004-06-08 08:17:44 +00002533AC_MSG_CHECKING(for --with-tsc)
2534AC_ARG_WITH(tsc,
2535[ --with(out)-tsc enable/disable timestamp counter profile], [
2536if test "$withval" != no
2537then
2538 AC_DEFINE(WITH_TSC, 1,
2539 [Define to profile with the Pentium timestamp counter])
2540 AC_MSG_RESULT(yes)
2541else AC_MSG_RESULT(no)
2542fi],
2543[AC_MSG_RESULT(no)])
2544
2545# Check for Python-specific malloc support
Neil Schemenauera35c6882001-02-27 04:45:05 +00002546AC_MSG_CHECKING(for --with-pymalloc)
2547AC_ARG_WITH(pymalloc,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002548 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
Neil Schemenauer16c22972002-03-22 15:34:49 +00002549
2550if test -z "$with_pymalloc"
2551then with_pymalloc="yes"
2552fi
2553if test "$with_pymalloc" != "no"
2554then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002555 AC_DEFINE(WITH_PYMALLOC, 1,
2556 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00002557fi
2558AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00002559
Benjamin Peterson91c12eb2009-12-03 02:52:39 +00002560# Check for Valgrind support
2561AC_MSG_CHECKING([for --with-valgrind])
2562AC_ARG_WITH([valgrind],
2563 AC_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
2564 with_valgrind=no)
2565AC_MSG_RESULT([$with_valgrind])
2566if test "$with_valgrind" != no; then
2567 AC_CHECK_HEADER([valgrind/valgrind.h],
2568 [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
2569 [AC_MSG_ERROR([Valgrind support requested but headers not available])]
2570 )
2571fi
2572
Barry Warsawef82cd72000-06-30 16:21:01 +00002573# Check for --with-wctype-functions
2574AC_MSG_CHECKING(for --with-wctype-functions)
2575AC_ARG_WITH(wctype-functions,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002576 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
2577[
Barry Warsawef82cd72000-06-30 16:21:01 +00002578if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002579then
2580 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2581 [Define if you want wctype.h functions to be used instead of the
2582 one supplied by Python itself. (see Include/unicodectype.h).])
2583 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00002584else AC_MSG_RESULT(no)
2585fi],
2586[AC_MSG_RESULT(no)])
2587
Guido van Rossum68242b51996-05-28 22:53:03 +00002588# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002589AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00002590DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002591
Guido van Rossume97ee181999-12-20 21:27:22 +00002592# the dlopen() function means we might want to use dynload_shlib.o. some
2593# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00002594AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00002595
2596# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2597# loading of modules.
2598AC_SUBST(DYNLOADFILE)
2599AC_MSG_CHECKING(DYNLOADFILE)
2600if test -z "$DYNLOADFILE"
2601then
2602 case $ac_sys_system/$ac_sys_release in
Martin v. Löwisc19c5a62003-11-18 20:00:44 +00002603 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2604 if test "$ac_cv_func_dlopen" = yes
2605 then DYNLOADFILE="dynload_shlib.o"
2606 else DYNLOADFILE="dynload_aix.o"
2607 fi
2608 ;;
Guido van Rossume97ee181999-12-20 21:27:22 +00002609 BeOS*) DYNLOADFILE="dynload_beos.o";;
2610 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Anthony Baxter82201742006-04-09 15:07:40 +00002611 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2612 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002613 atheos*) DYNLOADFILE="dynload_atheos.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00002614 *)
2615 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2616 # out any dynamic loading
2617 if test "$ac_cv_func_dlopen" = yes
2618 then DYNLOADFILE="dynload_shlib.o"
2619 else DYNLOADFILE="dynload_stub.o"
2620 fi
2621 ;;
2622 esac
2623fi
2624AC_MSG_RESULT($DYNLOADFILE)
2625if test "$DYNLOADFILE" != "dynload_stub.o"
2626then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002627 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2628 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00002629fi
2630
Jack Jansenc49e5b72001-06-19 15:00:23 +00002631# MACHDEP_OBJS can be set to platform-specific object files needed by Python
2632
2633AC_SUBST(MACHDEP_OBJS)
2634AC_MSG_CHECKING(MACHDEP_OBJS)
2635if test -z "$MACHDEP_OBJS"
2636then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002637 MACHDEP_OBJS=$extra_machdep_objs
2638else
2639 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00002640fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002641AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00002642
Guido van Rossum627b2d71993-12-24 10:39:16 +00002643# checks for library functions
Martin v. Löwisaef18b12008-03-24 13:31:16 +00002644AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2645 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
Martin v. Löwis438b5342002-12-27 10:16:42 +00002646 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00002647 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
Antoine Pitrou30b3b352009-12-02 20:37:54 +00002648 initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime \
Martin v. Löwisa5f09072002-10-11 05:37:59 +00002649 mremap nice pathconf pause plock poll pthread_init \
Guido van Rossum162e38c2003-02-19 15:25:10 +00002650 putenv readlink realpath \
Jesse Noller355b1262009-04-02 00:03:28 +00002651 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
2652 setgid \
Martin v. Löwis4daacb12003-03-28 18:37:01 +00002653 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
Martin v. Löwis50ea4562009-11-27 13:56:01 +00002654 setlocale setregid setreuid setresuid setresgid \
2655 setsid setpgid setpgrp setuid setvbuf snprintf \
Skip Montanaro7e11a012004-02-07 12:55:46 +00002656 sigaction siginterrupt sigrelse strftime \
Michael W. Hudson34f20ea2002-05-27 15:08:24 +00002657 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Neal Norwitz05a45592006-03-20 06:30:08 +00002658 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00002659
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002660# For some functions, having a definition is not sufficient, since
2661# we want to take their address.
2662AC_MSG_CHECKING(for chroot)
2663AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2664 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2665 AC_MSG_RESULT(yes),
2666 AC_MSG_RESULT(no)
2667)
2668AC_MSG_CHECKING(for link)
2669AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2670 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2671 AC_MSG_RESULT(yes),
2672 AC_MSG_RESULT(no)
2673)
2674AC_MSG_CHECKING(for symlink)
2675AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2676 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2677 AC_MSG_RESULT(yes),
2678 AC_MSG_RESULT(no)
2679)
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002680AC_MSG_CHECKING(for fchdir)
2681AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2682 AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2683 AC_MSG_RESULT(yes),
2684 AC_MSG_RESULT(no)
2685)
2686AC_MSG_CHECKING(for fsync)
2687AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
Skip Montanarod4fa8072003-09-25 14:49:15 +00002688 AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002689 AC_MSG_RESULT(yes),
2690 AC_MSG_RESULT(no)
2691)
2692AC_MSG_CHECKING(for fdatasync)
2693AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2694 AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2695 AC_MSG_RESULT(yes),
2696 AC_MSG_RESULT(no)
2697)
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00002698AC_MSG_CHECKING(for epoll)
2699AC_TRY_COMPILE([#include <sys/epoll.h>], void *x=epoll_create,
2700 AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2701 AC_MSG_RESULT(yes),
2702 AC_MSG_RESULT(no)
2703)
2704AC_MSG_CHECKING(for kqueue)
2705AC_TRY_COMPILE([
2706#include <sys/types.h>
2707#include <sys/event.h>
2708 ], int x=kqueue(),
2709 AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2710 AC_MSG_RESULT(yes),
2711 AC_MSG_RESULT(no)
2712)
Martin v. Löwisd5843682002-11-21 20:41:28 +00002713# On some systems (eg. FreeBSD 5), we would find a definition of the
2714# functions ctermid_r, setgroups in the library, but no prototype
2715# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2716# address to avoid compiler warnings and potential miscompilations
2717# because of the missing prototypes.
2718
2719AC_MSG_CHECKING(for ctermid_r)
2720AC_TRY_COMPILE([
2721#include "confdefs.h"
2722#include <stdio.h>
2723], void* p = ctermid_r,
2724 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2725 AC_MSG_RESULT(yes),
2726 AC_MSG_RESULT(no)
2727)
2728
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00002729AC_MSG_CHECKING(for flock)
2730AC_TRY_COMPILE([
2731#include "confdefs.h"
2732#include <sys/file.h>
2733], void* p = flock,
2734 AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2735 AC_MSG_RESULT(yes),
2736 AC_MSG_RESULT(no)
2737)
2738
2739AC_MSG_CHECKING(for getpagesize)
2740AC_TRY_COMPILE([
2741#include "confdefs.h"
2742#include <unistd.h>
2743], void* p = getpagesize,
2744 AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2745 AC_MSG_RESULT(yes),
2746 AC_MSG_RESULT(no)
2747)
2748
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002749dnl check for true
2750AC_CHECK_PROGS(TRUE, true, /bin/true)
2751
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002752dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2753dnl On others, they are in the C library, so we to take no action
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002754AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002755 AC_CHECK_LIB(resolv, inet_aton)
2756)
2757
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002758# On Tru64, chflags seems to be present, but calling it will
2759# exit Python
Gregory P. Smithbb213892009-11-02 01:37:37 +00002760AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
Alexandre Vassalotti30267d62009-07-17 06:10:06 +00002761AC_TRY_RUN([[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002762#include <sys/stat.h>
2763#include <unistd.h>
2764int main(int argc, char*argv[])
2765{
2766 if(chflags(argv[0], 0) != 0)
2767 return 1;
2768 return 0;
2769}
Alexandre Vassalotti30267d62009-07-17 06:10:06 +00002770]], ac_cv_have_chflags=yes,
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002771 ac_cv_have_chflags=no,
Gregory P. Smithbb213892009-11-02 01:37:37 +00002772 ac_cv_have_chflags=cross)
2773])
2774if test "$ac_cv_have_chflags" = cross ; then
2775 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
2776fi
2777if test "$ac_cv_have_chflags" = yes ; then
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002778 AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
2779fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002780
Gregory P. Smithbb213892009-11-02 01:37:37 +00002781AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
Alexandre Vassalotti30267d62009-07-17 06:10:06 +00002782AC_TRY_RUN([[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002783#include <sys/stat.h>
2784#include <unistd.h>
2785int main(int argc, char*argv[])
2786{
2787 if(lchflags(argv[0], 0) != 0)
2788 return 1;
2789 return 0;
2790}
Alexandre Vassalotti30267d62009-07-17 06:10:06 +00002791]], ac_cv_have_lchflags=yes,
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002792 ac_cv_have_lchflags=no,
Gregory P. Smithbb213892009-11-02 01:37:37 +00002793 ac_cv_have_lchflags=cross)
2794])
2795if test "$ac_cv_have_lchflags" = cross ; then
2796 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
2797fi
2798if test "$ac_cv_have_lchflags" = yes ; then
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002799 AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
2800fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002801
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00002802dnl Check if system zlib has *Copy() functions
Ronald Oussorenf8752642006-07-06 10:13:35 +00002803dnl
2804dnl On MacOSX the linker will search for dylibs on the entire linker path
2805dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
2806dnl to revert to a more traditional unix behaviour and make it possible to
2807dnl override the system libz with a local static library of libz. Temporarily
2808dnl add that flag to our CFLAGS as well to ensure that we check the version
2809dnl of libz that will be used by setup.py.
2810dnl The -L/usr/local/lib is needed as wel to get the same compilation
2811dnl environment as setup.py (and leaving it out can cause configure to use the
2812dnl wrong version of the library)
2813case $ac_sys_system/$ac_sys_release in
2814Darwin/*)
2815 _CUR_CFLAGS="${CFLAGS}"
2816 _CUR_LDFLAGS="${LDFLAGS}"
2817 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
2818 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
2819 ;;
2820esac
2821
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00002822AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, Define if the zlib library has inflateCopy))
2823
Ronald Oussorenf8752642006-07-06 10:13:35 +00002824case $ac_sys_system/$ac_sys_release in
2825Darwin/*)
2826 CFLAGS="${_CUR_CFLAGS}"
2827 LDFLAGS="${_CUR_LDFLAGS}"
2828 ;;
2829esac
2830
Martin v. Löwise9416172003-05-03 10:12:45 +00002831AC_MSG_CHECKING(for hstrerror)
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002832AC_TRY_LINK([
Martin v. Löwise9416172003-05-03 10:12:45 +00002833#include "confdefs.h"
2834#include <netdb.h>
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002835], void* p = hstrerror; hstrerror(0),
Martin v. Löwise9416172003-05-03 10:12:45 +00002836 AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2837 AC_MSG_RESULT(yes),
2838 AC_MSG_RESULT(no)
2839)
2840
2841AC_MSG_CHECKING(for inet_aton)
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002842AC_TRY_LINK([
Martin v. Löwise9416172003-05-03 10:12:45 +00002843#include "confdefs.h"
Martin v. Löwis86d66262006-02-17 08:40:11 +00002844#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00002845#include <sys/socket.h>
2846#include <netinet/in.h>
2847#include <arpa/inet.h>
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002848], void* p = inet_aton;inet_aton(0,0),
Martin v. Löwise9416172003-05-03 10:12:45 +00002849 AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2850 AC_MSG_RESULT(yes),
2851 AC_MSG_RESULT(no)
2852)
2853
2854AC_MSG_CHECKING(for inet_pton)
2855AC_TRY_COMPILE([
2856#include "confdefs.h"
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00002857#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00002858#include <sys/socket.h>
2859#include <netinet/in.h>
2860#include <arpa/inet.h>
2861], void* p = inet_pton,
2862 AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2863 AC_MSG_RESULT(yes),
2864 AC_MSG_RESULT(no)
2865)
2866
Martin v. Löwisd6640d42003-07-06 09:29:52 +00002867# On some systems, setgroups is in unistd.h, on others, in grp.h
Martin v. Löwisd5843682002-11-21 20:41:28 +00002868AC_MSG_CHECKING(for setgroups)
2869AC_TRY_COMPILE([
2870#include "confdefs.h"
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00002871#include <unistd.h>
Martin v. Löwisd6640d42003-07-06 09:29:52 +00002872#ifdef HAVE_GRP_H
2873#include <grp.h>
2874#endif
Martin v. Löwisd5843682002-11-21 20:41:28 +00002875],
2876void* p = setgroups,
2877 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2878 AC_MSG_RESULT(yes),
2879 AC_MSG_RESULT(no)
2880)
2881
Fred Drake8cef4cf2000-06-28 16:40:38 +00002882# check for openpty and forkpty
2883
Martin v. Löwisfd9a72a2006-01-08 10:07:33 +00002884AC_CHECK_FUNCS(openpty,,
2885 AC_CHECK_LIB(util,openpty,
2886 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2887 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2888 )
2889)
2890AC_CHECK_FUNCS(forkpty,,
2891 AC_CHECK_LIB(util,forkpty,
2892 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2893 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2894 )
2895)
Fred Drake8cef4cf2000-06-28 16:40:38 +00002896
Brett Cannonaa5778d2008-03-18 04:09:00 +00002897# Stuff for expat.
2898AC_CHECK_FUNCS(memmove)
2899
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00002900# check for long file support functions
2901AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2902
Brett Cannonaa5778d2008-03-18 04:09:00 +00002903AC_REPLACE_FUNCS(dup2 getcwd strdup)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002904AC_CHECK_FUNCS(getpgrp,
2905 AC_TRY_COMPILE([#include <unistd.h>],
2906 [getpgrp(0);],
2907 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2908 [Define if getpgrp() must be called as getpgrp(0).])
2909 )
2910)
Jack Jansen150753c2003-03-29 22:07:47 +00002911AC_CHECK_FUNCS(setpgrp,
2912 AC_TRY_COMPILE([#include <unistd.h>],
2913 [setpgrp(0,0);],
2914 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2915 [Define if setpgrp() must be called as setpgrp(0, 0).])
2916 )
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002917)
2918AC_CHECK_FUNCS(gettimeofday,
2919 AC_TRY_COMPILE([#include <sys/time.h>],
2920 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2921 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2922 [Define if gettimeofday() does not have second (timezone) argument
2923 This is the case on Motorola V4 (R40V4.2)])
2924 )
2925)
Guido van Rossum627b2d71993-12-24 10:39:16 +00002926
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002927AC_MSG_CHECKING(for major, minor, and makedev)
Martin v. Löwise3271202002-11-07 07:42:30 +00002928AC_TRY_LINK([
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002929#if defined(MAJOR_IN_MKDEV)
2930#include <sys/mkdev.h>
2931#elif defined(MAJOR_IN_SYSMACROS)
2932#include <sys/sysmacros.h>
2933#else
2934#include <sys/types.h>
2935#endif
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002936],[
2937 makedev(major(0),minor(0));
2938],[
2939 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2940 [Define to 1 if you have the device macros.])
2941 AC_MSG_RESULT(yes)
2942],[
2943 AC_MSG_RESULT(no)
2944])
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002945
2946# On OSF/1 V5.1, getaddrinfo is available, but a define
2947# for [no]getaddrinfo in netdb.h.
2948AC_MSG_CHECKING(for getaddrinfo)
2949AC_TRY_LINK([
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00002950#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002951#include <sys/socket.h>
2952#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00002953#include <stdio.h>
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002954], [getaddrinfo(NULL, NULL, NULL, NULL);],
2955have_getaddrinfo=yes,
2956have_getaddrinfo=no)
2957AC_MSG_RESULT($have_getaddrinfo)
2958if test $have_getaddrinfo = yes
2959then
2960 AC_MSG_CHECKING(getaddrinfo bug)
2961 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
2962 AC_TRY_RUN([[
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002963#include <sys/types.h>
2964#include <netdb.h>
2965#include <string.h>
2966#include <sys/socket.h>
2967#include <netinet/in.h>
2968
Alexandre Vassalotti00900892009-07-17 05:26:39 +00002969int main()
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002970{
2971 int passive, gaierr, inet4 = 0, inet6 = 0;
2972 struct addrinfo hints, *ai, *aitop;
2973 char straddr[INET6_ADDRSTRLEN], strport[16];
2974
2975 for (passive = 0; passive <= 1; passive++) {
2976 memset(&hints, 0, sizeof(hints));
2977 hints.ai_family = AF_UNSPEC;
2978 hints.ai_flags = passive ? AI_PASSIVE : 0;
2979 hints.ai_socktype = SOCK_STREAM;
Hye-Shik Chang54f94392004-04-14 07:55:31 +00002980 hints.ai_protocol = IPPROTO_TCP;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002981 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2982 (void)gai_strerror(gaierr);
2983 goto bad;
2984 }
2985 for (ai = aitop; ai; ai = ai->ai_next) {
2986 if (ai->ai_addr == NULL ||
2987 ai->ai_addrlen == 0 ||
2988 getnameinfo(ai->ai_addr, ai->ai_addrlen,
2989 straddr, sizeof(straddr), strport, sizeof(strport),
2990 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2991 goto bad;
2992 }
2993 switch (ai->ai_family) {
2994 case AF_INET:
2995 if (strcmp(strport, "54321") != 0) {
2996 goto bad;
2997 }
2998 if (passive) {
2999 if (strcmp(straddr, "0.0.0.0") != 0) {
3000 goto bad;
3001 }
3002 } else {
3003 if (strcmp(straddr, "127.0.0.1") != 0) {
3004 goto bad;
3005 }
3006 }
3007 inet4++;
3008 break;
3009 case AF_INET6:
3010 if (strcmp(strport, "54321") != 0) {
3011 goto bad;
3012 }
3013 if (passive) {
3014 if (strcmp(straddr, "::") != 0) {
3015 goto bad;
3016 }
3017 } else {
3018 if (strcmp(straddr, "::1") != 0) {
3019 goto bad;
3020 }
3021 }
3022 inet6++;
3023 break;
3024 case AF_UNSPEC:
3025 goto bad;
3026 break;
3027 default:
3028 /* another family support? */
3029 break;
3030 }
3031 }
3032 }
3033
3034 if (!(inet4 == 0 || inet4 == 2))
3035 goto bad;
3036 if (!(inet6 == 0 || inet6 == 2))
3037 goto bad;
3038
3039 if (aitop)
3040 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003041 return 0;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003042
3043 bad:
3044 if (aitop)
3045 freeaddrinfo(aitop);
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003046 return 1;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003047}
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003048]], ac_cv_buggy_getaddrinfo=no,
3049 ac_cv_buggy_getaddrinfo=yes,
3050 ac_cv_buggy_getaddrinfo=yes))
3051fi
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003052
Mark Dickinson0ef0b912009-12-31 21:11:48 +00003053if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003054then
3055 if test $ipv6 = yes
3056 then
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003057 echo 'Fatal: You must get working getaddrinfo() function.'
3058 echo ' or you can specify "--disable-ipv6"'.
3059 exit 1
3060 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00003061else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003062 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003063fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00003064AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003065
Guido van Rossum627b2d71993-12-24 10:39:16 +00003066# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003067AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00003068AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003069AC_STRUCT_TIMEZONE
Martin v. Löwis60a5d722002-10-16 20:28:25 +00003070AC_CHECK_MEMBERS([struct stat.st_rdev])
3071AC_CHECK_MEMBERS([struct stat.st_blksize])
Hye-Shik Chang5f937a72005-06-02 13:09:30 +00003072AC_CHECK_MEMBERS([struct stat.st_flags])
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00003073AC_CHECK_MEMBERS([struct stat.st_gen])
3074AC_CHECK_MEMBERS([struct stat.st_birthtime])
Guido van Rossum98bf58f2001-10-18 20:34:25 +00003075AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003076
3077AC_MSG_CHECKING(for time.h that defines altzone)
3078AC_CACHE_VAL(ac_cv_header_time_altzone,
3079[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
3080 ac_cv_header_time_altzone=yes,
3081 ac_cv_header_time_altzone=no)])
3082AC_MSG_RESULT($ac_cv_header_time_altzone)
3083if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003084 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003085fi
3086
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003087was_it_defined=no
3088AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003089AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003090#include <sys/types.h>
3091#include <sys/select.h>
3092#include <sys/time.h>
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003093], [;], [
3094 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
3095 [Define if you can safely include both <sys/select.h> and <sys/time.h>
3096 (which you can't on SCO ODT 3.0).])
3097 was_it_defined=yes
3098])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003099AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00003100
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003101AC_MSG_CHECKING(for addrinfo)
3102AC_CACHE_VAL(ac_cv_struct_addrinfo,
3103AC_TRY_COMPILE([
3104# include <netdb.h>],
3105 [struct addrinfo a],
3106 ac_cv_struct_addrinfo=yes,
3107 ac_cv_struct_addrinfo=no))
3108AC_MSG_RESULT($ac_cv_struct_addrinfo)
3109if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003110 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003111fi
3112
3113AC_MSG_CHECKING(for sockaddr_storage)
3114AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
3115AC_TRY_COMPILE([
3116# include <sys/types.h>
3117# include <sys/socket.h>],
3118 [struct sockaddr_storage s],
3119 ac_cv_struct_sockaddr_storage=yes,
3120 ac_cv_struct_sockaddr_storage=no))
3121AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3122if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003123 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003124fi
3125
Guido van Rossum627b2d71993-12-24 10:39:16 +00003126# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003127
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003128AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003129AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003130
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003131works=no
3132AC_MSG_CHECKING(for working volatile)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003133AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
3134 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
3135)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003136AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00003137
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003138works=no
3139AC_MSG_CHECKING(for working signed char)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003140AC_TRY_COMPILE([], [signed char c;], works=yes,
3141 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
3142)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003143AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003144
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003145have_prototypes=no
3146AC_MSG_CHECKING(for prototypes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003147AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
3148 AC_DEFINE(HAVE_PROTOTYPES, 1,
3149 [Define if your compiler supports function prototype])
3150 have_prototypes=yes
3151])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003152AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003153
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003154works=no
3155AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003156AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003157#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00003158int foo(int x, ...) {
3159 va_list va;
3160 va_start(va, x);
3161 va_arg(va, int);
3162 va_arg(va, char *);
3163 va_arg(va, double);
3164 return 0;
3165}
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003166], [return foo(10, "", 3.14);], [
3167 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3168 [Define if your compiler supports variable length function prototypes
3169 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3170 works=yes
3171])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003172AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003173
Dave Cole331708b2004-08-09 04:51:41 +00003174# check for socketpair
3175AC_MSG_CHECKING(for socketpair)
3176AC_TRY_COMPILE([
3177#include <sys/types.h>
3178#include <sys/socket.h>
3179], void *x=socketpair,
3180 AC_DEFINE(HAVE_SOCKETPAIR, 1, Define if you have the 'socketpair' function.)
3181 AC_MSG_RESULT(yes),
3182 AC_MSG_RESULT(no)
3183)
3184
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003185# check if sockaddr has sa_len member
3186AC_MSG_CHECKING(if sockaddr has sa_len member)
3187AC_TRY_COMPILE([#include <sys/types.h>
3188#include <sys/socket.h>],
3189[struct sockaddr x;
3190x.sa_len = 0;],
3191 AC_MSG_RESULT(yes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003192 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003193 AC_MSG_RESULT(no))
3194
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003195va_list_is_array=no
3196AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003197AC_TRY_COMPILE([
3198#ifdef HAVE_STDARG_PROTOTYPES
3199#include <stdarg.h>
3200#else
3201#include <varargs.h>
3202#endif
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003203], [va_list list1, list2; list1 = list2;], , [
3204 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3205 va_list_is_array=yes
3206])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003207AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003208
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003209# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
Martin v. Löwis11437992002-04-12 09:54:03 +00003210AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3211 [Define this if you have some version of gethostbyname_r()])
3212
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003213AC_CHECK_FUNC(gethostbyname_r, [
3214 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3215 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3216 OLD_CFLAGS=$CFLAGS
3217 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
3218 AC_TRY_COMPILE([
3219# include <netdb.h>
3220 ], [
3221 char *name;
3222 struct hostent *he, *res;
3223 char buffer[2048];
3224 int buflen = 2048;
3225 int h_errnop;
3226
3227 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
3228 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003229 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003230 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3231 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003232 AC_MSG_RESULT(yes)
3233 ], [
3234 AC_MSG_RESULT(no)
3235 AC_MSG_CHECKING([gethostbyname_r with 5 args])
3236 AC_TRY_COMPILE([
3237# include <netdb.h>
3238 ], [
3239 char *name;
3240 struct hostent *he;
3241 char buffer[2048];
3242 int buflen = 2048;
3243 int h_errnop;
3244
3245 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3246 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003247 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003248 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3249 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003250 AC_MSG_RESULT(yes)
3251 ], [
3252 AC_MSG_RESULT(no)
3253 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3254 AC_TRY_COMPILE([
3255# include <netdb.h>
3256 ], [
3257 char *name;
3258 struct hostent *he;
3259 struct hostent_data data;
3260
3261 (void) gethostbyname_r(name, he, &data);
3262 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003263 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003264 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3265 [Define this if you have the 3-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003266 AC_MSG_RESULT(yes)
3267 ], [
3268 AC_MSG_RESULT(no)
3269 ])
3270 ])
3271 ])
3272 CFLAGS=$OLD_CFLAGS
3273], [
Thomas Wouters3a584202000-08-05 23:28:51 +00003274 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003275])
3276AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3277AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3278AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003279AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003280AC_SUBST(HAVE_GETHOSTBYNAME)
3281
Guido van Rossum627b2d71993-12-24 10:39:16 +00003282# checks for system services
3283# (none yet)
3284
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003285# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00003286AC_CHECK_FUNC(__fpu_control,
3287 [],
3288 [AC_CHECK_LIB(ieee, __fpu_control)
3289])
Guido van Rossum627b2d71993-12-24 10:39:16 +00003290
Guido van Rossum93274221997-05-09 02:42:00 +00003291# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00003292AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d82000-06-29 16:12:00 +00003293AC_ARG_WITH(fpectl,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003294 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
3295[
Guido van Rossum93274221997-05-09 02:42:00 +00003296if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003297then
3298 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3299 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3300 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00003301else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00003302fi],
3303[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00003304
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003305# check for --with-libm=...
3306AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003307case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00003308Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00003309BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003310*) LIBM=-lm
3311esac
Guido van Rossum93274221997-05-09 02:42:00 +00003312AC_MSG_CHECKING(for --with-libm=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003313AC_ARG_WITH(libm,
3314 AC_HELP_STRING(--with-libm=STRING, math library),
3315[
Guido van Rossum93274221997-05-09 02:42:00 +00003316if test "$withval" = no
3317then LIBM=
3318 AC_MSG_RESULT(force LIBM empty)
3319elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003320then LIBM=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003321 AC_MSG_RESULT(set LIBM="$withval")
3322else AC_MSG_ERROR([proper usage is --with-libm=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003323fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003324[AC_MSG_RESULT(default LIBM="$LIBM")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003325
3326# check for --with-libc=...
3327AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00003328AC_MSG_CHECKING(for --with-libc=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003329AC_ARG_WITH(libc,
3330 AC_HELP_STRING(--with-libc=STRING, C library),
3331[
Guido van Rossum93274221997-05-09 02:42:00 +00003332if test "$withval" = no
3333then LIBC=
3334 AC_MSG_RESULT(force LIBC empty)
3335elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003336then LIBC=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003337 AC_MSG_RESULT(set LIBC="$withval")
3338else AC_MSG_ERROR([proper usage is --with-libc=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003339fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003340[AC_MSG_RESULT(default LIBC="$LIBC")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003341
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003342# **************************************************
3343# * Check for various properties of floating point *
3344# **************************************************
Mark Dickinson265d7382008-04-21 22:32:24 +00003345
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003346AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3347AC_CACHE_VAL(ac_cv_little_endian_double, [
3348AC_TRY_RUN([
3349#include <string.h>
3350int main() {
3351 double x = 9006104071832581.0;
3352 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3353 return 0;
3354 else
3355 return 1;
3356}
3357],
3358ac_cv_little_endian_double=yes,
3359ac_cv_little_endian_double=no,
3360ac_cv_little_endian_double=no)])
3361AC_MSG_RESULT($ac_cv_little_endian_double)
3362if test "$ac_cv_little_endian_double" = yes
3363then
3364 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3365 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3366 with the least significant byte first])
3367fi
3368
3369AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3370AC_CACHE_VAL(ac_cv_big_endian_double, [
3371AC_TRY_RUN([
3372#include <string.h>
3373int main() {
3374 double x = 9006104071832581.0;
3375 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3376 return 0;
3377 else
3378 return 1;
3379}
3380],
3381ac_cv_big_endian_double=yes,
3382ac_cv_big_endian_double=no,
3383ac_cv_big_endian_double=no)])
3384AC_MSG_RESULT($ac_cv_big_endian_double)
3385if test "$ac_cv_big_endian_double" = yes
3386then
3387 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3388 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3389 with the most significant byte first])
3390fi
3391
3392# Some ARM platforms use a mixed-endian representation for doubles.
3393# While Python doesn't currently have full support for these platforms
3394# (see e.g., issue 1762561), we can at least make sure that float <-> string
3395# conversions work.
3396AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3397AC_CACHE_VAL(ac_cv_mixed_endian_double, [
3398AC_TRY_RUN([
3399#include <string.h>
3400int main() {
3401 double x = 9006104071832581.0;
3402 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3403 return 0;
3404 else
3405 return 1;
3406}
3407],
3408ac_cv_mixed_endian_double=yes,
3409ac_cv_mixed_endian_double=no,
3410ac_cv_mixed_endian_double=no)])
3411AC_MSG_RESULT($ac_cv_mixed_endian_double)
3412if test "$ac_cv_mixed_endian_double" = yes
3413then
3414 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3415 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3416 in ARM mixed-endian order (byte order 45670123)])
3417fi
3418
3419# The short float repr introduced in Python 3.1 requires the
3420# correctly-rounded string <-> double conversion functions from
3421# Python/dtoa.c, which in turn require that the FPU uses 53-bit
3422# rounding; this is a problem on x86, where the x87 FPU has a default
Mark Dickinsona548dee2009-11-15 13:12:43 +00003423# rounding precision of 64 bits. For gcc/x86, we can fix this by
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003424# using inline assembler to get and set the x87 FPU control word.
Mark Dickinsona548dee2009-11-15 13:12:43 +00003425
3426# This inline assembler syntax may also work for suncc and icc,
3427# so we try it on all platforms.
3428
3429AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
3430AC_TRY_COMPILE([], [
3431 unsigned short cw;
3432 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3433 __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
3434],
3435[have_gcc_asm_for_x87=yes], [have_gcc_asm_for_x87=no])
3436AC_MSG_RESULT($have_gcc_asm_for_x87)
3437if test "$have_gcc_asm_for_x87" = yes
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003438then
Mark Dickinsona548dee2009-11-15 13:12:43 +00003439 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3440 [Define if we can use gcc inline assembler to get and set x87 control word])
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003441fi
Mark Dickinson7a3d8642008-04-22 00:54:27 +00003442
Mark Dickinson04b27232009-01-04 12:29:36 +00003443# Detect whether system arithmetic is subject to x87-style double
3444# rounding issues. The result of this test has little meaning on non
3445# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3446# mode is round-to-nearest and double rounding issues are present, and
3447# 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3448AC_MSG_CHECKING(for x87-style double rounding)
Mark Dickinson99abd142009-10-24 13:44:16 +00003449# $BASECFLAGS may affect the result
3450ac_save_cc="$CC"
3451CC="$CC $BASECFLAGS"
Mark Dickinson04b27232009-01-04 12:29:36 +00003452AC_TRY_RUN([
3453#include <stdlib.h>
3454#include <math.h>
3455int main() {
3456 volatile double x, y, z;
3457 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3458 x = 0.99999999999999989; /* 1-2**-53 */
3459 y = 1./x;
3460 if (y != 1.)
3461 exit(0);
3462 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3463 x = 1e16;
3464 y = 2.99999;
3465 z = x + y;
3466 if (z != 1e16+4.)
3467 exit(0);
3468 /* both tests show evidence of double rounding */
3469 exit(1);
3470}
3471],
3472ac_cv_x87_double_rounding=no,
3473ac_cv_x87_double_rounding=yes,
Mark Dickinson99abd142009-10-24 13:44:16 +00003474ac_cv_x87_double_rounding=no)
3475CC="$ac_save_cc"
Mark Dickinson04b27232009-01-04 12:29:36 +00003476AC_MSG_RESULT($ac_cv_x87_double_rounding)
3477if test "$ac_cv_x87_double_rounding" = yes
3478then
3479 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3480 [Define if arithmetic is subject to x87-style double rounding issue])
3481fi
3482
Mark Dickinson1d6e2e12009-10-24 13:28:38 +00003483# ************************************
3484# * Check for mathematical functions *
3485# ************************************
3486
3487LIBS_SAVE=$LIBS
3488LIBS="$LIBS $LIBM"
3489
Mark Dickinsonc63392c2009-11-28 13:13:13 +00003490# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3491# -0. on some architectures.
3492AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3493AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
3494AC_TRY_RUN([
3495#include <math.h>
3496#include <stdlib.h>
3497int main() {
3498 /* return 0 if either negative zeros don't exist
3499 on this platform or if negative zeros exist
3500 and tanh(-0.) == -0. */
3501 if (atan2(0., -1.) == atan2(-0., -1.) ||
3502 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3503 else exit(1);
3504}
3505],
3506ac_cv_tanh_preserves_zero_sign=yes,
3507ac_cv_tanh_preserves_zero_sign=no,
3508ac_cv_tanh_preserves_zero_sign=no)])
3509AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3510if test "$ac_cv_tanh_preserves_zero_sign" = yes
3511then
3512 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3513 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3514fi
3515
3516AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
3517AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
3518AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3519
3520LIBS=$LIBS_SAVE
3521
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003522# For multiprocessing module, check that sem_open
3523# actually works. For FreeBSD versions <= 7.2,
3524# the kernel module that provides POSIX semaphores
3525# isn't loaded by default, so an attempt to call
3526# sem_open results in a 'Signal 12' error.
3527AC_MSG_CHECKING(whether POSIX semaphores are enabled)
3528AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
3529AC_TRY_RUN([
3530#include <unistd.h>
3531#include <fcntl.h>
3532#include <stdio.h>
3533#include <semaphore.h>
3534#include <sys/stat.h>
3535
3536int main(void) {
3537 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3538 if (a == SEM_FAILED) {
3539 perror("sem_open");
3540 return 1;
3541 }
3542 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003543 sem_unlink("/autoconf");
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003544 return 0;
3545}
3546], ac_cv_posix_semaphores_enabled=yes,
3547 ac_cv_posix_semaphores_enabled=no,
3548 ac_cv_posix_semaphores_enabled=yes)
3549)
3550AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
3551if test $ac_cv_posix_semaphores_enabled = no
3552then
Mark Dickinson5afa6d42009-11-28 10:44:20 +00003553 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
3554 [Define if POSIX semaphores aren't enabled on your system])
Mark Dickinsonc4920e82009-11-20 19:30:22 +00003555fi
3556
Jesse Noller355b1262009-04-02 00:03:28 +00003557# Multiprocessing check for broken sem_getvalue
3558AC_MSG_CHECKING(for broken sem_getvalue)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003559AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
Jesse Noller355b1262009-04-02 00:03:28 +00003560AC_TRY_RUN([
3561#include <unistd.h>
3562#include <fcntl.h>
3563#include <stdio.h>
3564#include <semaphore.h>
3565#include <sys/stat.h>
3566
3567int main(void){
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003568 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
Jesse Noller355b1262009-04-02 00:03:28 +00003569 int count;
3570 int res;
3571 if(a==SEM_FAILED){
3572 perror("sem_open");
3573 return 1;
3574
3575 }
3576 res = sem_getvalue(a, &count);
3577 sem_close(a);
Mark Dickinson59dc89e2009-12-13 21:06:06 +00003578 sem_unlink("/autocftw");
Jesse Noller355b1262009-04-02 00:03:28 +00003579 return res==-1 ? 1 : 0;
3580}
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003581], ac_cv_broken_sem_getvalue=no,
3582 ac_cv_broken_sem_getvalue=yes,
3583 ac_cv_broken_sem_getvalue=yes)
Jesse Noller355b1262009-04-02 00:03:28 +00003584)
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003585AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
3586if test $ac_cv_broken_sem_getvalue = yes
3587then
3588 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
3589 [define to 1 if your sem_getvalue is broken.])
3590fi
Mark Dickinson04b27232009-01-04 12:29:36 +00003591
Mark Dickinsonefc82f72009-03-20 15:51:55 +00003592# determine what size digit to use for Python's longs
3593AC_MSG_CHECKING([digit size for Python's longs])
3594AC_ARG_ENABLE(big-digits,
3595AC_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
3596[case $enable_big_digits in
3597yes)
3598 enable_big_digits=30 ;;
3599no)
3600 enable_big_digits=15 ;;
3601[15|30])
3602 ;;
3603*)
3604 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3605esac
3606AC_MSG_RESULT($enable_big_digits)
3607AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3608],
3609[AC_MSG_RESULT(no value specified)])
3610
Guido van Rossumef2255b2000-03-10 22:30:29 +00003611# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003612AC_CHECK_HEADER(wchar.h, [
3613 AC_DEFINE(HAVE_WCHAR_H, 1,
3614 [Define if the compiler provides a wchar.h header file.])
3615 wchar_h="yes"
3616],
Guido van Rossumef2255b2000-03-10 22:30:29 +00003617wchar_h="no"
3618)
3619
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003620# determine wchar_t size
3621if test "$wchar_h" = yes
3622then
Guido van Rossum67b26592001-10-20 14:21:45 +00003623 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003624fi
3625
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003626AC_MSG_CHECKING(for UCS-4 tcl)
3627have_ucs4_tcl=no
3628AC_TRY_COMPILE([
3629#include <tcl.h>
3630#if TCL_UTF_MAX != 6
3631# error "NOT UCS4_TCL"
3632#endif], [], [
3633 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3634 have_ucs4_tcl=yes
3635])
3636AC_MSG_RESULT($have_ucs4_tcl)
3637
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003638# check whether wchar_t is signed or not
3639if test "$wchar_h" = yes
3640then
3641 # check whether wchar_t is signed or not
3642 AC_MSG_CHECKING(whether wchar_t is signed)
3643 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
3644 AC_TRY_RUN([
3645 #include <wchar.h>
3646 int main()
3647 {
Martin v. Löwis44fe0e42006-04-11 07:15:30 +00003648 /* Success: exit code 0 */
3649 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003650 }
3651 ],
3652 ac_cv_wchar_t_signed=yes,
3653 ac_cv_wchar_t_signed=no,
3654 ac_cv_wchar_t_signed=yes)])
3655 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3656fi
3657
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003658AC_MSG_CHECKING(what type to use for unicode)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003659dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003660AC_ARG_ENABLE(unicode,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003661 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
3662 [],
3663 [enable_unicode=yes])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003664
3665if test $enable_unicode = yes
3666then
Martin v. Löwisfd917792001-06-27 20:22:04 +00003667 # Without any arguments, Py_UNICODE defaults to two-byte mode
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003668 case "$have_ucs4_tcl" in
3669 yes) enable_unicode="ucs4"
3670 ;;
3671 *) enable_unicode="ucs2"
3672 ;;
3673 esac
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003674fi
3675
Martin v. Löwis0036cba2002-04-12 09:58:45 +00003676AH_TEMPLATE(Py_UNICODE_SIZE,
3677 [Define as the size of the unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003678case "$enable_unicode" in
3679ucs2) unicode_size="2"
3680 AC_DEFINE(Py_UNICODE_SIZE,2)
3681 ;;
3682ucs4) unicode_size="4"
3683 AC_DEFINE(Py_UNICODE_SIZE,4)
3684 ;;
3685esac
3686
Martin v. Löwis11437992002-04-12 09:54:03 +00003687AH_TEMPLATE(PY_UNICODE_TYPE,
3688 [Define as the integral type used for Unicode representation.])
Martin v. Löwis0036cba2002-04-12 09:58:45 +00003689
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003690AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003691if test "$enable_unicode" = "no"
3692then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003693 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003694 AC_MSG_RESULT(not used)
3695else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003696 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003697 AC_DEFINE(Py_USING_UNICODE, 1,
3698 [Define if you want to have a Unicode type.])
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003699
3700 # wchar_t is only usable if it maps to an unsigned type
3701 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
Matthias Klose7dbeed72004-12-24 08:22:17 +00003702 -a "$ac_cv_wchar_t_signed" = "no"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003703 then
3704 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003705 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3706 [Define if you have a useable wchar_t type defined in wchar.h; useable
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003707 means wchar_t must be an unsigned type with at least 16 bits. (see
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003708 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003709 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3710 elif test "$ac_cv_sizeof_short" = "$unicode_size"
3711 then
3712 PY_UNICODE_TYPE="unsigned short"
3713 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3714 elif test "$ac_cv_sizeof_long" = "$unicode_size"
3715 then
3716 PY_UNICODE_TYPE="unsigned long"
3717 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3718 else
3719 PY_UNICODE_TYPE="no type found"
3720 fi
3721 AC_MSG_RESULT($PY_UNICODE_TYPE)
3722fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00003723
3724# check for endianness
3725AC_C_BIGENDIAN
3726
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003727# Check whether right shifting a negative integer extends the sign bit
3728# or fills with zeros (like the Cray J90, according to Tim Peters).
3729AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00003730AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003731AC_TRY_RUN([
3732int main()
3733{
Vladimir Marangozova6180282000-07-12 05:05:06 +00003734 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003735}
Guido van Rossum3065c942001-09-17 04:03:14 +00003736],
3737ac_cv_rshift_extends_sign=yes,
3738ac_cv_rshift_extends_sign=no,
3739ac_cv_rshift_extends_sign=yes)])
Vladimir Marangozova6180282000-07-12 05:05:06 +00003740AC_MSG_RESULT($ac_cv_rshift_extends_sign)
3741if test "$ac_cv_rshift_extends_sign" = no
3742then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003743 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
3744 [Define if i>>j for signed int i does not extend the sign bit
3745 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00003746fi
3747
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003748# check for getc_unlocked and related locking functions
3749AC_MSG_CHECKING(for getc_unlocked() and friends)
3750AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
3751AC_TRY_LINK([#include <stdio.h>],[
3752 FILE *f = fopen("/dev/null", "r");
3753 flockfile(f);
3754 getc_unlocked(f);
3755 funlockfile(f);
3756], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
3757AC_MSG_RESULT($ac_cv_have_getc_unlocked)
3758if test "$ac_cv_have_getc_unlocked" = yes
3759then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003760 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
3761 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003762fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003763
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00003764# check where readline lives
Martin v. Löwis82bca632006-02-10 20:49:30 +00003765# save the value of LIBS so we don't actually link Python with readline
3766LIBS_no_readline=$LIBS
Gregory P. Smith980b99b2008-09-07 05:15:18 +00003767
3768# On some systems we need to link readline to a termcap compatible
3769# library. NOTE: Keep the precedence of listed libraries synchronised
3770# with setup.py.
3771py_cv_lib_readline=no
3772AC_MSG_CHECKING([how to link readline libs])
3773for py_libtermcap in "" ncursesw ncurses curses termcap; do
3774 if test -z "$py_libtermcap"; then
3775 READLINE_LIBS="-lreadline"
3776 else
3777 READLINE_LIBS="-lreadline -l$py_libtermcap"
3778 fi
3779 LIBS="$READLINE_LIBS $LIBS_no_readline"
3780 AC_LINK_IFELSE(
3781 [AC_LANG_CALL([],[readline])],
3782 [py_cv_lib_readline=yes])
3783 if test $py_cv_lib_readline = yes; then
3784 break
3785 fi
3786done
3787# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3788#AC_SUBST([READLINE_LIBS])
Gregory P. Smith29ec7502008-09-07 19:18:16 +00003789if test $py_cv_lib_readline = no; then
Gregory P. Smith980b99b2008-09-07 05:15:18 +00003790 AC_MSG_RESULT([none])
3791else
3792 AC_MSG_RESULT([$READLINE_LIBS])
3793 AC_DEFINE(HAVE_LIBREADLINE, 1,
3794 [Define if you have the readline library (-lreadline).])
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00003795fi
3796
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003797# check for readline 2.1
3798AC_CHECK_LIB(readline, rl_callback_handler_install,
3799 AC_DEFINE(HAVE_RL_CALLBACK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003800 [Define if you have readline 2.1]), ,$READLINE_LIBS)
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003801
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003802# check for readline 2.2
3803AC_TRY_CPP([#include <readline/readline.h>],
3804have_readline=yes, have_readline=no)
3805if test $have_readline = yes
3806then
3807 AC_EGREP_HEADER([extern int rl_completion_append_character;],
3808 [readline/readline.h],
3809 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
3810 [Define if you have readline 2.2]), )
Antoine Pitroud9ff74e2009-10-26 19:16:46 +00003811 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
3812 [readline/readline.h],
3813 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
3814 [Define if you have rl_completion_suppress_append]), )
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003815fi
3816
Martin v. Löwis0daad592001-09-30 21:09:59 +00003817# check for readline 4.0
3818AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003819 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003820 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis0daad592001-09-30 21:09:59 +00003821
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00003822# also in 4.0
3823AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
3824 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003825 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00003826
Guido van Rossum353ae582001-07-10 16:45:32 +00003827# check for readline 4.2
3828AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003829 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003830 [Define if you have readline 4.2]), ,$READLINE_LIBS)
Guido van Rossum353ae582001-07-10 16:45:32 +00003831
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003832# also in readline 4.2
3833AC_TRY_CPP([#include <readline/readline.h>],
3834have_readline=yes, have_readline=no)
3835if test $have_readline = yes
3836then
3837 AC_EGREP_HEADER([extern int rl_catch_signals;],
3838 [readline/readline.h],
3839 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3840 [Define if you can turn off readline's signal handling.]), )
3841fi
3842
Martin v. Löwis82bca632006-02-10 20:49:30 +00003843# End of readline checks: restore LIBS
3844LIBS=$LIBS_no_readline
3845
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003846AC_MSG_CHECKING(for broken nice())
3847AC_CACHE_VAL(ac_cv_broken_nice, [
3848AC_TRY_RUN([
3849int main()
3850{
3851 int val1 = nice(1);
3852 if (val1 != -1 && val1 == nice(2))
3853 exit(0);
3854 exit(1);
3855}
Guido van Rossum3065c942001-09-17 04:03:14 +00003856],
3857ac_cv_broken_nice=yes,
3858ac_cv_broken_nice=no,
3859ac_cv_broken_nice=no)])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003860AC_MSG_RESULT($ac_cv_broken_nice)
3861if test "$ac_cv_broken_nice" = yes
3862then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003863 AC_DEFINE(HAVE_BROKEN_NICE, 1,
3864 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003865fi
3866
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003867AC_MSG_CHECKING(for broken poll())
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003868AC_CACHE_VAL(ac_cv_broken_poll,
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003869AC_TRY_RUN([
3870#include <poll.h>
3871
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003872int main()
3873{
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003874 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003875 int poll_test;
3876
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003877 close (42);
3878
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003879 poll_test = poll(&poll_struct, 1, 0);
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003880 if (poll_test < 0)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003881 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003882 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003883 return 0;
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003884 else
Alexandre Vassalotti66da2632009-07-17 06:17:33 +00003885 return 1;
3886}
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003887],
3888ac_cv_broken_poll=yes,
3889ac_cv_broken_poll=no,
Alexandre Vassalotti00900892009-07-17 05:26:39 +00003890ac_cv_broken_poll=no))
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003891AC_MSG_RESULT($ac_cv_broken_poll)
3892if test "$ac_cv_broken_poll" = yes
3893then
3894 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3895 [Define if poll() sets errno on invalid file descriptors.])
3896fi
3897
Brett Cannon43802422005-02-10 20:48:03 +00003898# Before we can test tzset, we need to check if struct tm has a tm_zone
3899# (which is not required by ISO C or UNIX spec) and/or if we support
3900# tzname[]
3901AC_STRUCT_TIMEZONE
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003902
Brett Cannon43802422005-02-10 20:48:03 +00003903# check tzset(3) exists and works like we expect it to
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003904AC_MSG_CHECKING(for working tzset())
3905AC_CACHE_VAL(ac_cv_working_tzset, [
3906AC_TRY_RUN([
3907#include <stdlib.h>
3908#include <time.h>
Brett Cannon18367812003-09-19 00:59:16 +00003909#include <string.h>
Brett Cannon43802422005-02-10 20:48:03 +00003910
3911#if HAVE_TZNAME
3912extern char *tzname[];
3913#endif
3914
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003915int main()
3916{
Brett Cannon18367812003-09-19 00:59:16 +00003917 /* Note that we need to ensure that not only does tzset(3)
3918 do 'something' with localtime, but it works as documented
3919 in the library reference and as expected by the test suite.
Brett Cannon43802422005-02-10 20:48:03 +00003920 This includes making sure that tzname is set properly if
3921 tm->tm_zone does not exist since it is the alternative way
3922 of getting timezone info.
Brett Cannon18367812003-09-19 00:59:16 +00003923
3924 Red Hat 6.2 doesn't understand the southern hemisphere
Brett Cannon43802422005-02-10 20:48:03 +00003925 after New Year's Day.
Brett Cannon18367812003-09-19 00:59:16 +00003926 */
3927
Brett Cannon43802422005-02-10 20:48:03 +00003928 time_t groundhogday = 1044144000; /* GMT-based */
Brett Cannon18367812003-09-19 00:59:16 +00003929 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3930
Neal Norwitz7f2588c2003-04-11 15:35:53 +00003931 putenv("TZ=UTC+0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003932 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00003933 if (localtime(&groundhogday)->tm_hour != 0)
3934 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003935#if HAVE_TZNAME
3936 /* For UTC, tzname[1] is sometimes "", sometimes " " */
3937 if (strcmp(tzname[0], "UTC") ||
3938 (tzname[1][0] != 0 && tzname[1][0] != ' '))
3939 exit(1);
3940#endif
Brett Cannon18367812003-09-19 00:59:16 +00003941
Neal Norwitz7f2588c2003-04-11 15:35:53 +00003942 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003943 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00003944 if (localtime(&groundhogday)->tm_hour != 19)
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003945 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003946#if HAVE_TZNAME
3947 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
3948 exit(1);
3949#endif
Brett Cannon18367812003-09-19 00:59:16 +00003950
3951 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
3952 tzset();
3953 if (localtime(&groundhogday)->tm_hour != 11)
3954 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003955#if HAVE_TZNAME
3956 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
3957 exit(1);
3958#endif
3959
3960#if HAVE_STRUCT_TM_TM_ZONE
Brett Cannon18367812003-09-19 00:59:16 +00003961 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
3962 exit(1);
3963 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
3964 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003965#endif
Brett Cannon18367812003-09-19 00:59:16 +00003966
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003967 exit(0);
3968}
3969],
3970ac_cv_working_tzset=yes,
3971ac_cv_working_tzset=no,
3972ac_cv_working_tzset=no)])
3973AC_MSG_RESULT($ac_cv_working_tzset)
3974if test "$ac_cv_working_tzset" = yes
3975then
3976 AC_DEFINE(HAVE_WORKING_TZSET, 1,
3977 [Define if tzset() actually switches the local timezone in a meaningful way.])
3978fi
3979
Martin v. Löwis94717ed2002-09-09 14:24:16 +00003980# Look for subsecond timestamps in struct stat
3981AC_MSG_CHECKING(for tv_nsec in struct stat)
3982AC_CACHE_VAL(ac_cv_stat_tv_nsec,
3983AC_TRY_COMPILE([#include <sys/stat.h>], [
3984struct stat st;
3985st.st_mtim.tv_nsec = 1;
3986],
Martin v. Löwisa32c9942002-09-09 16:17:47 +00003987ac_cv_stat_tv_nsec=yes,
Martin v. Löwis94717ed2002-09-09 14:24:16 +00003988ac_cv_stat_tv_nsec=no,
3989ac_cv_stat_tv_nsec=no))
3990AC_MSG_RESULT($ac_cv_stat_tv_nsec)
3991if test "$ac_cv_stat_tv_nsec" = yes
3992then
3993 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
3994 [Define if you have struct stat.st_mtim.tv_nsec])
3995fi
3996
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00003997# Look for BSD style subsecond timestamps in struct stat
3998AC_MSG_CHECKING(for tv_nsec2 in struct stat)
3999AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
4000AC_TRY_COMPILE([#include <sys/stat.h>], [
4001struct stat st;
4002st.st_mtimespec.tv_nsec = 1;
4003],
4004ac_cv_stat_tv_nsec2=yes,
4005ac_cv_stat_tv_nsec2=no,
4006ac_cv_stat_tv_nsec2=no))
4007AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
4008if test "$ac_cv_stat_tv_nsec2" = yes
4009then
4010 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
4011 [Define if you have struct stat.st_mtimensec])
4012fi
4013
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004014# On HP/UX 11.0, mvwdelch is a block with a return statement
4015AC_MSG_CHECKING(whether mvwdelch is an expression)
4016AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
4017AC_TRY_COMPILE([#include <curses.h>], [
4018 int rtn;
4019 rtn = mvwdelch(0,0,0);
4020], ac_cv_mvwdelch_is_expression=yes,
4021 ac_cv_mvwdelch_is_expression=no,
4022 ac_cv_mvwdelch_is_expression=yes))
4023AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
4024
4025if test "$ac_cv_mvwdelch_is_expression" = yes
4026then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004027 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
4028 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004029fi
4030
4031AC_MSG_CHECKING(whether WINDOW has _flags)
4032AC_CACHE_VAL(ac_cv_window_has_flags,
4033AC_TRY_COMPILE([#include <curses.h>], [
4034 WINDOW *w;
4035 w->_flags = 0;
4036], ac_cv_window_has_flags=yes,
4037 ac_cv_window_has_flags=no,
4038 ac_cv_window_has_flags=no))
4039AC_MSG_RESULT($ac_cv_window_has_flags)
4040
4041
4042if test "$ac_cv_window_has_flags" = yes
4043then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00004044 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
4045 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00004046fi
4047
Walter Dörwald4994d952006-06-19 08:07:50 +00004048AC_MSG_CHECKING(for is_term_resized)
4049AC_TRY_COMPILE([#include <curses.h>], void *x=is_term_resized,
4050 AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
4051 AC_MSG_RESULT(yes),
4052 AC_MSG_RESULT(no)
4053)
4054
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004055AC_MSG_CHECKING(for resize_term)
4056AC_TRY_COMPILE([#include <curses.h>], void *x=resize_term,
4057 AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
Walter Dörwald4994d952006-06-19 08:07:50 +00004058 AC_MSG_RESULT(yes),
4059 AC_MSG_RESULT(no)
4060)
4061
Walter Dörwald05fdbf12006-06-19 08:14:09 +00004062AC_MSG_CHECKING(for resizeterm)
4063AC_TRY_COMPILE([#include <curses.h>], void *x=resizeterm,
4064 AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
Walter Dörwald4994d952006-06-19 08:07:50 +00004065 AC_MSG_RESULT(yes),
4066 AC_MSG_RESULT(no)
4067)
4068
Martin v. Löwisfefbc202006-10-17 18:59:23 +00004069AC_MSG_CHECKING(for /dev/ptmx)
4070
4071if test -r /dev/ptmx
4072then
4073 AC_MSG_RESULT(yes)
4074 AC_DEFINE(HAVE_DEV_PTMX, 1,
4075 [Define if we have /dev/ptmx.])
4076else
4077 AC_MSG_RESULT(no)
4078fi
4079
4080AC_MSG_CHECKING(for /dev/ptc)
4081
4082if test -r /dev/ptc
4083then
4084 AC_MSG_RESULT(yes)
4085 AC_DEFINE(HAVE_DEV_PTC, 1,
4086 [Define if we have /dev/ptc.])
4087else
4088 AC_MSG_RESULT(no)
4089fi
Neal Norwitz865400f2003-03-21 01:42:58 +00004090
Mark Dickinson82864d12009-11-15 16:18:58 +00004091if test "$have_long_long" = yes
4092then
4093 AC_MSG_CHECKING(for %lld and %llu printf() format support)
4094 AC_CACHE_VAL(ac_cv_have_long_long_format,
4095 AC_TRY_RUN([[
4096 #include <stdio.h>
4097 #include <stddef.h>
4098 #include <string.h>
4099
4100 #ifdef HAVE_SYS_TYPES_H
4101 #include <sys/types.h>
4102 #endif
4103
4104 int main()
4105 {
4106 char buffer[256];
4107
4108 if (sprintf(buffer, "%lld", (long long)123) < 0)
4109 return 1;
4110 if (strcmp(buffer, "123"))
4111 return 1;
4112
4113 if (sprintf(buffer, "%lld", (long long)-123) < 0)
4114 return 1;
4115 if (strcmp(buffer, "-123"))
4116 return 1;
4117
4118 if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
4119 return 1;
4120 if (strcmp(buffer, "123"))
4121 return 1;
4122
4123 return 0;
4124 }
4125 ]], ac_cv_have_long_long_format=yes,
4126 ac_cv_have_long_long_format=no,
4127 ac_cv_have_long_long_format=no)
4128 )
4129 AC_MSG_RESULT($ac_cv_have_long_long_format)
4130fi
4131
Mark Dickinson5ce84742009-12-31 20:48:04 +00004132if test "$ac_cv_have_long_long_format" = yes
Mark Dickinson82864d12009-11-15 16:18:58 +00004133then
4134 AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
4135 [Define to printf format modifier for long long type])
4136fi
4137
Ronald Oussoren315cd0c2009-11-19 16:25:21 +00004138if test $ac_sys_system = Darwin
4139then
4140 LIBS="$LIBS -framework CoreFoundation"
4141fi
4142
Mark Dickinson82864d12009-11-15 16:18:58 +00004143
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004144AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
4145AC_TRY_RUN([
Alexandre Vassalottie7cf1182009-07-17 06:33:51 +00004146#include <stdio.h>
Brett Cannon09d12362006-05-11 05:11:33 +00004147#include <stddef.h>
4148#include <string.h>
4149
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004150#ifdef HAVE_SYS_TYPES_H
4151#include <sys/types.h>
4152#endif
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004153
4154#ifdef HAVE_SSIZE_T
4155typedef ssize_t Py_ssize_t;
4156#elif SIZEOF_VOID_P == SIZEOF_LONG
4157typedef long Py_ssize_t;
4158#else
4159typedef int Py_ssize_t;
4160#endif
Brett Cannon09d12362006-05-11 05:11:33 +00004161
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00004162int main()
4163{
4164 char buffer[256];
4165
Brett Cannon09d12362006-05-11 05:11:33 +00004166 if(sprintf(buffer, "%zd", (size_t)123) < 0)
4167 return 1;
4168
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004169 if (strcmp(buffer, "123"))
Brett Cannon09d12362006-05-11 05:11:33 +00004170 return 1;
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00004171
4172 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
4173 return 1;
4174
4175 if (strcmp(buffer, "-123"))
4176 return 1;
4177
Brett Cannon09d12362006-05-11 05:11:33 +00004178 return 0;
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004179}
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004180], ac_cv_have_size_t_format=yes,
Alexandre Vassalottie7cf1182009-07-17 06:33:51 +00004181 ac_cv_have_size_t_format=no,
Gregory P. Smithd8cb2d92009-11-02 02:02:38 +00004182 [ac_cv_have_size_t_format="cross -- assuming yes"]
4183)])
4184if test "$ac_cv_have_size_t_format" != no ; then
Alexandre Vassalotti00900892009-07-17 05:26:39 +00004185 AC_DEFINE(PY_FORMAT_SIZE_T, "z",
4186 [Define to printf format modifier for Py_ssize_t])
4187fi
Brett Cannon09d12362006-05-11 05:11:33 +00004188
Martin v. Löwis01c04012002-11-11 14:58:44 +00004189AC_CHECK_TYPE(socklen_t,,
4190 AC_DEFINE(socklen_t,int,
4191 Define to `int' if <sys/socket.h> does not define.),[
4192#ifdef HAVE_SYS_TYPES_H
4193#include <sys/types.h>
4194#endif
Guido van Rossum95713eb2000-05-18 20:53:31 +00004195#ifdef HAVE_SYS_SOCKET_H
4196#include <sys/socket.h>
4197#endif
Martin v. Löwis01c04012002-11-11 14:58:44 +00004198])
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004199
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00004200AC_SUBST(THREADHEADERS)
4201
4202for h in `(cd $srcdir;echo Python/thread_*.h)`
4203do
4204 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4205done
4206
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004207AC_SUBST(SRCDIRS)
Neal Norwitzd24499d2005-12-18 21:36:39 +00004208SRCDIRS="Parser Grammar Objects Python Modules Mac"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00004209AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004210for dir in $SRCDIRS; do
4211 if test ! -d $dir; then
4212 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00004213 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00004214done
4215AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00004216
Guido van Rossum627b2d71993-12-24 10:39:16 +00004217# generate output files
Antoine Pitrouf2caeed2009-05-24 20:23:57 +00004218AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
Martin v. Löwis88afe662002-10-26 13:47:44 +00004219AC_OUTPUT
Neil Schemenauer61c51152001-01-26 16:18:16 +00004220
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004221echo "creating Modules/Setup"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004222if test ! -f Modules/Setup
4223then
4224 cp $srcdir/Modules/Setup.dist Modules/Setup
4225fi
4226
Martin v. Löwisf7afe952006-04-14 15:16:15 +00004227echo "creating Modules/Setup.local"
Neil Schemenauer61c51152001-01-26 16:18:16 +00004228if test ! -f Modules/Setup.local
4229then
4230 echo "# Edit this file for local setup changes" >Modules/Setup.local
4231fi
4232
4233echo "creating Makefile"
4234$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4235 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00004236 Modules/Setup.local Modules/Setup
Skip Montanaro7221d932007-08-22 19:02:16 +00004237
4238case $ac_sys_system in
4239BeOS)
4240 AC_MSG_WARN([
4241
4242 Support for BeOS is deprecated as of Python 2.6.
4243 See PEP 11 for the gory details.
4244 ])
4245 ;;
4246*) ;;
4247esac
4248
Neil Schemenauer66252162001-02-19 04:47:42 +00004249mv config.c Modules