blob: aa9f45dc8900c582b873b365f9c752f0518b1bf0 [file] [log] [blame]
Benjamin Petersond7c77842008-05-26 13:01:25 +00001dnl ***********************************************
2dnl * Please run autoreconf to test your changes! *
3dnl ***********************************************
Georg Brandl5c7f8fb2008-12-05 09:00:55 +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)
Neal Norwitz9be57322006-08-18 05:39:20 +00007m4_define(PYTHON_VERSION, 2.6)
Martin v. Löwis88afe662002-10-26 13:47:44 +00008
Guido van Rossum76be6ed1995-01-02 18:33:54 +00009AC_REVISION($Revision$)
Martin v. Löwiseba40652007-08-30 20:10:57 +000010AC_PREREQ(2.61)
Martin v. Löwis1d459062005-03-14 21:23:33 +000011AC_INIT(python, PYTHON_VERSION, http://www.python.org/python-bugs)
Martin v. Löwis88afe662002-10-26 13:47:44 +000012AC_CONFIG_SRCDIR([Include/object.h])
Martin v. Löwis4f1cd8b2001-07-26 13:41:06 +000013AC_CONFIG_HEADER(pyconfig.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +000014
Martin v. Löwis8316feb2003-06-14 07:48:07 +000015dnl This is for stuff that absolutely must end up in pyconfig.h.
16dnl Please use pyport.h instead, if possible.
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000017AH_TOP([
18#ifndef Py_PYCONFIG_H
19#define Py_PYCONFIG_H
20])
Martin v. Löwis11437992002-04-12 09:54:03 +000021AH_BOTTOM([
Martin v. Löwis11437992002-04-12 09:54:03 +000022/* Define the macros needed if on a UnixWare 7.x system. */
23#if defined(__USLC__) && defined(__SCO_VERSION__)
24#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
25#endif
Martin v. Löwisbddf5a52002-11-11 13:37:28 +000026
27#endif /*Py_PYCONFIG_H*/
Martin v. Löwis11437992002-04-12 09:54:03 +000028])
29
Martin v. Löwis8316feb2003-06-14 07:48:07 +000030# We don't use PACKAGE_ variables, and they cause conflicts
31# with other autoconf-based packages that include Python.h
32grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
33rm confdefs.h
34mv confdefs.h.new confdefs.h
35
Guido van Rossum642b6781997-07-19 19:35:41 +000036AC_SUBST(VERSION)
Martin v. Löwis88afe662002-10-26 13:47:44 +000037VERSION=PYTHON_VERSION
Guido van Rossum642b6781997-07-19 19:35:41 +000038
Martin v. Löwis1142de32002-03-29 16:28:31 +000039AC_SUBST(SOVERSION)
40SOVERSION=1.0
41
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +000042# The later defininition of _XOPEN_SOURCE disables certain features
43# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
44AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
45
Martin v. Löwisbcd93962003-05-03 10:32:18 +000046# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
47# certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
48# them.
49AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
50
Andrew MacIntyreabccf412003-07-02 13:53:25 +000051# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
52# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
53# them.
54AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
55
Martin v. Löwisd6320502004-08-12 13:45:08 +000056# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
57# u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
58AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
59
Ronald Oussoren5640ce22008-06-05 12:58:24 +000060# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
61# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
62# them.
63AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
64
65
Martin v. Löwise981a4e2002-11-11 13:26:51 +000066define_xopen_source=yes
Martin v. Löwis6f18a3c2002-07-20 08:51:52 +000067
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +000068# Arguments passed to configure.
69AC_SUBST(CONFIG_ARGS)
70CONFIG_ARGS="$ac_configure_args"
71
Ronald Oussoren9b831f42010-02-07 11:57:14 +000072AC_MSG_CHECKING([for --enable-universalsdk])
Ronald Oussoren988117f2006-04-29 11:31:35 +000073AC_ARG_ENABLE(universalsdk,
Brett Cannon91a1dec2008-02-13 19:15:44 +000074 AC_HELP_STRING(--enable-universalsdk@<:@=SDKDIR@:>@, Build against Mac OS X 10.4u SDK (ppc/i386)),
Ronald Oussoren988117f2006-04-29 11:31:35 +000075[
76 case $enableval in
77 yes)
78 enableval=/Developer/SDKs/MacOSX10.4u.sdk
Ronald Oussoren9b831f42010-02-07 11:57:14 +000079 if test ! -d "${enableval}"
80 then
81 enableval=/
82 fi
Ronald Oussoren988117f2006-04-29 11:31:35 +000083 ;;
84 esac
85 case $enableval in
86 no)
87 UNIVERSALSDK=
88 enable_universalsdk=
89 ;;
90 *)
91 UNIVERSALSDK=$enableval
Ronald Oussoren9b831f42010-02-07 11:57:14 +000092 if test ! -d "${UNIVERSALSDK}"
93 then
94 AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
95 fi
Ronald Oussoren988117f2006-04-29 11:31:35 +000096 ;;
97 esac
Ronald Oussoren9b831f42010-02-07 11:57:14 +000098
Ronald Oussoren988117f2006-04-29 11:31:35 +000099],[
100 UNIVERSALSDK=
101 enable_universalsdk=
102])
Ronald Oussoren9b831f42010-02-07 11:57:14 +0000103if test -n "${UNIVERSALSDK}"
104then
105 AC_MSG_RESULT(${UNIVERSALSDK})
106else
107 AC_MSG_RESULT(no)
108fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000109AC_SUBST(UNIVERSALSDK)
110
Benjamin Peterson0e6ea5d2008-07-16 20:17:04 +0000111AC_SUBST(ARCH_RUN_32BIT)
112
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000113UNIVERSAL_ARCHS="32-bit"
114AC_MSG_CHECKING(for --with-universal-archs)
115AC_ARG_WITH(universal-archs,
Ronald Oussoren7ab74352009-09-08 07:10:07 +0000116 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 +0000117[
118 AC_MSG_RESULT($withval)
119 UNIVERSAL_ARCHS="$withval"
Ronald Oussorend0841712009-09-29 13:01:59 +0000120 if test "${enable_universalsdk}" ; then
121 :
122 else
123 AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
124 fi
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000125],
126[
127 AC_MSG_RESULT(32-bit)
128])
129
130
131
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000132AC_ARG_WITH(framework-name,
133 AC_HELP_STRING(--with-framework-name=FRAMEWORK,
134 specify an alternate name of the framework built with --enable-framework),
135[
Ronald Oussorend0841712009-09-29 13:01:59 +0000136 if test "${enable_framework}"; then
137 :
138 else
139 AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
140 fi
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000141 PYTHONFRAMEWORK=${withval}
142 PYTHONFRAMEWORKDIR=${withval}.framework
143 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
144 ],[
145 PYTHONFRAMEWORK=Python
146 PYTHONFRAMEWORKDIR=Python.framework
147 PYTHONFRAMEWORKIDENTIFIER=org.python.python
148])
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000149dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000150AC_ARG_ENABLE(framework,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000151 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
152[
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000153 case $enableval in
154 yes)
155 enableval=/Library/Frameworks
Jack Jansen127e56e2001-09-11 14:41:54 +0000156 esac
157 case $enableval in
158 no)
159 PYTHONFRAMEWORK=
160 PYTHONFRAMEWORKDIR=no-framework
161 PYTHONFRAMEWORKPREFIX=
162 PYTHONFRAMEWORKINSTALLDIR=
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000163 FRAMEWORKINSTALLFIRST=
164 FRAMEWORKINSTALLLAST=
Ronald Oussoren5b787322006-06-06 19:50:24 +0000165 FRAMEWORKALTINSTALLFIRST=
166 FRAMEWORKALTINSTALLLAST=
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000167 if test "x${prefix}" = "xNONE"; then
168 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
169 else
170 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
171 fi
Jack Jansen127e56e2001-09-11 14:41:54 +0000172 enable_framework=
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000173 ;;
174 *)
175 PYTHONFRAMEWORKPREFIX=$enableval
Jack Jansen127e56e2001-09-11 14:41:54 +0000176 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000177 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000178 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
179 if test "$UNIVERSAL_ARCHS" = "all"
180 then
181 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way"
Ronald Oussoren75d83852009-03-30 17:56:14 +0000182 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkaltinstallunixtools4way"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000183 else
Ronald Oussoren75d83852009-03-30 17:56:14 +0000184 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000185 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
186 fi
187
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000188 if test "x${prefix}" = "xNONE" ; then
189 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
190 else
191 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
192 fi
Jack Jansen127e56e2001-09-11 14:41:54 +0000193 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
Ronald Oussoren836b0392006-05-14 19:56:34 +0000194
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000195 # Add files for Mac specific code to the list of output
Ronald Oussoren836b0392006-05-14 19:56:34 +0000196 # files:
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000197 AC_CONFIG_FILES(Mac/Makefile)
198 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
199 AC_CONFIG_FILES(Mac/IDLE/Makefile)
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000200 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
201 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000202 esac
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000203 ],[
204 PYTHONFRAMEWORK=
Jack Jansen127e56e2001-09-11 14:41:54 +0000205 PYTHONFRAMEWORKDIR=no-framework
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000206 PYTHONFRAMEWORKPREFIX=
207 PYTHONFRAMEWORKINSTALLDIR=
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000208 FRAMEWORKINSTALLFIRST=
209 FRAMEWORKINSTALLLAST=
Ronald Oussoren5b787322006-06-06 19:50:24 +0000210 FRAMEWORKALTINSTALLFIRST=
211 FRAMEWORKALTINSTALLLAST=
Ronald Oussoren2db3a8f2006-06-07 19:06:01 +0000212 if test "x${prefix}" = "xNONE" ; then
213 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
214 else
215 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
216 fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000217 enable_framework=
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000218
219 if test "$UNIVERSAL_ARCHS" = "all"
220 then
221 FRAMEWORKINSTALLLAST=update4wayuniversal
222 FRAMEWORKALTINSTALLLAST=update4wayuniversal
223 fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000224])
225AC_SUBST(PYTHONFRAMEWORK)
Ronald Oussoren580c7fe2008-05-02 19:45:11 +0000226AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000227AC_SUBST(PYTHONFRAMEWORKDIR)
228AC_SUBST(PYTHONFRAMEWORKPREFIX)
229AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
Ronald Oussoren567a8ff2006-05-26 11:43:26 +0000230AC_SUBST(FRAMEWORKINSTALLFIRST)
231AC_SUBST(FRAMEWORKINSTALLLAST)
Ronald Oussoren5b787322006-06-06 19:50:24 +0000232AC_SUBST(FRAMEWORKALTINSTALLFIRST)
233AC_SUBST(FRAMEWORKALTINSTALLLAST)
234AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000235
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000236##AC_ARG_WITH(dyld,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000237## AC_HELP_STRING(--with-dyld,
238## Use (OpenStep|Rhapsody) dynamic linker))
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000239##
Guido van Rossumb418f891996-07-30 18:06:02 +0000240# Set name for machine-dependent library files
241AC_SUBST(MACHDEP)
242AC_MSG_CHECKING(MACHDEP)
243if test -z "$MACHDEP"
244then
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000245 ac_sys_system=`uname -s`
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000246 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
247 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000248 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +0000249 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000250 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +0000251 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000252 ac_md_system=`echo $ac_sys_system |
253 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
254 ac_md_release=`echo $ac_sys_release |
Guido van Rossum67b26592001-10-20 14:21:45 +0000255 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +0000256 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000257
Guido van Rossumbcd91e01997-03-20 20:46:29 +0000258 case $MACHDEP in
Andrew M. Kuchling5a3e4cb2001-07-20 19:29:04 +0000259 cygwin*) MACHDEP="cygwin";;
Jack Jansen8a97f4a2001-12-05 23:27:32 +0000260 darwin*) MACHDEP="darwin";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000261 atheos*) MACHDEP="atheos";;
Martin v. Löwisf3322282003-07-13 09:46:13 +0000262 irix646) MACHDEP="irix6";;
Guido van Rossumb97ef171997-09-28 05:44:03 +0000263 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000264 esac
265fi
Jack Jansen83f898c2002-12-30 22:23:40 +0000266
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000267# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
268# disable features if it is defined, without any means to access these
269# features as extensions. For these systems, we skip the definition of
270# _XOPEN_SOURCE. Before adding a system to the list to gain access to
271# some feature, make sure there is no alternative way to access this
272# feature. Also, when using wildcards, make sure you have verified the
273# need for not defining _XOPEN_SOURCE on all systems matching the
274# wildcard, and that the wildcard does not include future systems
275# (which may remove their limitations).
276dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
277case $ac_sys_system/$ac_sys_release in
278 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
279 # even though select is a POSIX function. Reported by J. Ribbens.
Martin v. Löwis76bafc62003-10-03 13:47:44 +0000280 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
Gregory P. Smith980b99b2008-09-07 05:15:18 +0000281 OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123@:>@)
Martin v. Löwiscb78de62007-12-29 18:49:21 +0000282 define_xopen_source=no
283 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
284 # also defined. This can be overridden by defining _BSD_SOURCE
285 # As this has a different meaning on Linux, only define it on OpenBSD
286 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
287 ;;
Martin v. Löwis4d542ec2006-11-25 15:39:19 +0000288 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
289 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
290 # Marc Recht
Georg Brandl60616122008-11-16 08:02:56 +0000291 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 +0000292 define_xopen_source=no;;
Martin v. Löwisa9d71422003-03-28 18:43:31 +0000293 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
294 # of union __?sigval. Reported by Stuart Bishop.
295 SunOS/5.6)
296 define_xopen_source=no;;
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000297 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
298 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
Martin v. Löwis253d1f42004-05-07 19:14:14 +0000299 # Reconfirmed for 7.1.4 by Martin v. Loewis.
300 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000301 define_xopen_source=no;;
302 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000303 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
Martin v. Löwisc2409b42003-05-11 05:53:41 +0000304 SCO_SV/3.2)
Martin v. Löwis53e73c32003-05-05 05:13:18 +0000305 define_xopen_source=no;;
Martin v. Löwis7f08c1f2008-11-04 20:43:31 +0000306 # On FreeBSD 4, the math functions C89 does not cover are never defined
307 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
308 FreeBSD/4.*)
309 define_xopen_source=no;;
310 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
311 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
312 # identifies itself as Darwin/7.*
313 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
314 # disables platform specific features beyond repair.
315 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
316 # has no effect, don't bother defining them
317 Darwin/@<:@6789@:>@.*)
Anthony Baxter6169c6b2003-10-04 07:46:23 +0000318 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000319 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
320 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
321 # or has another value. By not (re)defining it, the defaults come in place.
Martin v. Löwisc19c5a62003-11-18 20:00:44 +0000322 AIX/4)
323 define_xopen_source=no;;
Trent Mickaf16e8c2004-08-25 23:55:59 +0000324 AIX/5)
325 if test `uname -r` -eq 1; then
326 define_xopen_source=no
327 fi
328 ;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000329 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
330 # defining NI_NUMERICHOST.
331 QNX/6.3.2)
332 define_xopen_source=no
333 ;;
Martin v. Löwisa0588362006-04-04 06:03:50 +0000334
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000335esac
336
337if test $define_xopen_source = yes
338then
Skip Montanarof0d5f792004-08-15 14:08:23 +0000339 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
340 # defined precisely as g++ defines it
Martin v. Löwis7dece662005-11-26 11:38:24 +0000341 # Furthermore, on Solaris 10, XPG6 requires the use of a C99
342 # compiler
Skip Montanarof0d5f792004-08-15 14:08:23 +0000343 case $ac_sys_system/$ac_sys_release in
Martin v. Löwis7dece662005-11-26 11:38:24 +0000344 SunOS/5.8|SunOS/5.9|SunOS/5.10)
Skip Montanarof0d5f792004-08-15 14:08:23 +0000345 AC_DEFINE(_XOPEN_SOURCE, 500,
346 Define to the level of X/Open that your system supports)
347 ;;
348 *)
349 AC_DEFINE(_XOPEN_SOURCE, 600,
350 Define to the level of X/Open that your system supports)
351 ;;
352 esac
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000353
354 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
355 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
356 # several APIs are not declared. Since this is also needed in some
357 # cases for HP-UX, we define it globally.
Martin v. Löwis7dece662005-11-26 11:38:24 +0000358 # except for Solaris 10, where it must not be defined,
359 # as it implies XPG4.2
360 case $ac_sys_system/$ac_sys_release in
361 SunOS/5.10)
362 ;;
363 *)
364 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
365 Define to activate Unix95-and-earlier features)
366 ;;
367 esac
Martin v. Löwis678fc1e2002-11-12 06:04:39 +0000368
Bob Ippolito7026a0a2005-03-28 23:23:47 +0000369 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
370
Martin v. Löwise981a4e2002-11-11 13:26:51 +0000371fi
372
Guido van Rossum91922671997-10-09 20:24:13 +0000373#
374# SGI compilers allow the specification of the both the ABI and the
375# ISA on the command line. Depending on the values of these switches,
376# different and often incompatable code will be generated.
377#
378# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
379# thus supply support for various ABI/ISA combinations. The MACHDEP
380# variable is also adjusted.
381#
382AC_SUBST(SGI_ABI)
383if test ! -z "$SGI_ABI"
384then
385 CC="cc $SGI_ABI"
386 LDFLAGS="$SGI_ABI $LDFLAGS"
387 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
388fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000389AC_MSG_RESULT($MACHDEP)
390
Jack Jansen83f898c2002-12-30 22:23:40 +0000391# And add extra plat-mac for darwin
392AC_SUBST(EXTRAPLATDIR)
Jack Jansen7b59b422003-03-17 15:44:10 +0000393AC_SUBST(EXTRAMACHDEPPATH)
Jack Jansen83f898c2002-12-30 22:23:40 +0000394AC_MSG_CHECKING(EXTRAPLATDIR)
395if test -z "$EXTRAPLATDIR"
396then
397 case $MACHDEP in
Jack Jansen7b59b422003-03-17 15:44:10 +0000398 darwin)
399 EXTRAPLATDIR="\$(PLATMACDIRS)"
400 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
401 ;;
402 *)
403 EXTRAPLATDIR=""
404 EXTRAMACHDEPPATH=""
405 ;;
Jack Jansen83f898c2002-12-30 22:23:40 +0000406 esac
407fi
408AC_MSG_RESULT($EXTRAPLATDIR)
409
Jack Jansen6b08a402004-06-03 12:41:45 +0000410# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
411# it may influence the way we can build extensions, so distutils
412# needs to check it
413AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
Ronald Oussoren988117f2006-04-29 11:31:35 +0000414AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
Jack Jansen6b08a402004-06-03 12:41:45 +0000415CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
Ronald Oussoren988117f2006-04-29 11:31:35 +0000416EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
Jack Jansen6b08a402004-06-03 12:41:45 +0000417
Mark Dickinson65134662008-04-25 16:11:04 +0000418AC_MSG_CHECKING(machine type as reported by uname -m)
419ac_sys_machine=`uname -m`
420AC_MSG_RESULT($ac_sys_machine)
421
Guido van Rossum627b2d71993-12-24 10:39:16 +0000422# checks for alternative programs
Skip Montanarodecc6a42003-01-01 20:07:49 +0000423
424# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
425# for debug/optimization stuff. BASECFLAGS is for flags that are required
426# just to get things to compile and link. Users are free to override OPT
427# when running configure or make. The build should not break if they do.
428# BASECFLAGS should generally not be messed with, however.
429
430# XXX shouldn't some/most/all of this code be merged with the stuff later
431# on that fiddles with OPT and BASECFLAGS?
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000432AC_MSG_CHECKING(for --without-gcc)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000433AC_ARG_WITH(gcc,
434 AC_HELP_STRING(--without-gcc,never use gcc),
435[
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000436 case $withval in
Georg Brandlc04c2892009-01-14 00:00:17 +0000437 no) CC=${CC:-cc}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000438 without_gcc=yes;;
439 yes) CC=gcc
440 without_gcc=no;;
441 *) CC=$withval
442 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000443 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000444 case $ac_sys_system in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000445 AIX*) CC=cc_r
446 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000447 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000448 case $BE_HOST_CPU in
449 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000450 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000451 without_gcc=yes
Skip Montanarodecc6a42003-01-01 20:07:49 +0000452 BASECFLAGS="$BASECFLAGS -export pragma"
453 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000454 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000455 ;;
456 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000457 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000458 without_gcc=no
Skip Montanarodecc6a42003-01-01 20:07:49 +0000459 OPT="$OPT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000460 ;;
461 *)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000462 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000463 ;;
464 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000465 AR="\$(srcdir)/Modules/ar_beos"
466 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000467 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000468 Monterey*)
469 RANLIB=:
Martin v. Löwis130fb172001-07-19 11:00:41 +0000470 without_gcc=;;
471 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000472 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000473AC_MSG_RESULT($without_gcc)
474
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000475# If the user switches compilers, we can't believe the cache
476if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
477then
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000478 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
479(it is also a good idea to do 'make clean' before compiling)])
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000480fi
481
Guido van Rossum627b2d71993-12-24 10:39:16 +0000482AC_PROG_CC
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000483
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000484AC_SUBST(CXX)
485AC_SUBST(MAINCC)
486AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
487AC_ARG_WITH(cxx_main,
488 AC_HELP_STRING([--with-cxx-main=<compiler>],
489 [compile main() and link python executable with C++ compiler]),
490[
491
492 case $withval in
493 no) with_cxx_main=no
494 MAINCC='$(CC)';;
495 yes) with_cxx_main=yes
496 MAINCC='$(CXX)';;
497 *) with_cxx_main=yes
498 MAINCC=$withval
499 if test -z "$CXX"
500 then
501 CXX=$withval
502 fi;;
503 esac], [
504 with_cxx_main=no
505 MAINCC='$(CC)'
506])
507AC_MSG_RESULT($with_cxx_main)
508
509preset_cxx="$CXX"
510if test -z "$CXX"
511then
512 case "$CC" in
513 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
514 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
515 esac
516 if test "$CXX" = "notfound"
517 then
518 CXX=""
519 fi
520fi
521if test -z "$CXX"
522then
523 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
524 if test "$CXX" = "notfound"
525 then
526 CXX=""
527 fi
528fi
529if test "$preset_cxx" != "$CXX"
530then
531 AC_MSG_WARN([
532
533 By default, distutils will build C++ extension modules with "$CXX".
534 If this is not intended, then set CXX on the configure command line.
535 ])
536fi
537
538
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000539# checks for UNIX variants that set C preprocessor variables
540AC_AIX
Martin v. Löwis1d5ecb72001-08-09 10:29:44 +0000541
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000542# Check for unsupported systems
543case $ac_sys_system/$ac_sys_release in
Brett Cannon19fab762007-06-02 03:02:29 +0000544atheos*|Linux*/1*)
Martin v. Löwis779ffc02002-12-02 22:17:01 +0000545 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
546 echo See README for details.
547 exit 1;;
548esac
549
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000550AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000551AC_MSG_CHECKING(for --with-suffix)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000552AC_ARG_WITH(suffix,
553 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
554[
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000555 case $withval in
556 no) EXEEXT=;;
557 yes) EXEEXT=.exe;;
558 *) EXEEXT=$withval;;
559 esac])
560AC_MSG_RESULT($EXEEXT)
Jack Jansen1999ef42001-12-06 21:47:20 +0000561
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000562# Test whether we're running on a non-case-sensitive system, in which
563# case we give a warning if no ext is given
Jack Jansen1999ef42001-12-06 21:47:20 +0000564AC_SUBST(BUILDEXEEXT)
565AC_MSG_CHECKING(for case-insensitive build directory)
Jack Jansen3c2c4332002-11-06 13:33:32 +0000566if test ! -d CaseSensitiveTestDir; then
567mkdir CaseSensitiveTestDir
568fi
569
570if test -d casesensitivetestdir
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000571then
Jack Jansen1999ef42001-12-06 21:47:20 +0000572 AC_MSG_RESULT(yes)
573 BUILDEXEEXT=.exe
574else
575 AC_MSG_RESULT(no)
Jack Jansendd19cf82001-12-06 22:36:17 +0000576 BUILDEXEEXT=$EXEEXT
Jack Jansen9a66b6d2001-08-08 13:56:14 +0000577fi
Jack Jansen3c2c4332002-11-06 13:33:32 +0000578rmdir CaseSensitiveTestDir
Guido van Rossumfb842551997-08-06 23:42:07 +0000579
Guido van Rossumdd997f71998-10-07 19:58:26 +0000580case $MACHDEP in
581bsdos*)
582 case $CC in
583 gcc) CC="$CC -D_HAVE_BSDI";;
584 esac;;
585esac
586
Guido van Rossum84561611997-08-21 00:08:11 +0000587case $ac_sys_system in
588hp*|HP*)
589 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000590 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000591 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000592Monterey*)
593 case $CC in
594 cc) CC="$CC -Wl,-Bexport";;
595 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000596SunOS*)
597 # Some functions have a prototype only with that define, e.g. confstr
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000598 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
Martin v. Löwise8964d42001-03-06 12:09:07 +0000599 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000600esac
601
Martin v. Löwise8964d42001-03-06 12:09:07 +0000602
Neil Schemenauer61c51152001-01-26 16:18:16 +0000603AC_SUBST(LIBRARY)
604AC_MSG_CHECKING(LIBRARY)
605if test -z "$LIBRARY"
606then
607 LIBRARY='libpython$(VERSION).a'
608fi
609AC_MSG_RESULT($LIBRARY)
610
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000611# LDLIBRARY is the name of the library to link against (as opposed to the
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000612# name of the library into which to insert object files). BLDLIBRARY is also
613# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
614# is blank as the main program is not linked directly against LDLIBRARY.
615# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
616# systems without shared libraries, LDLIBRARY is the same as LIBRARY
617# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
618# DLLLIBRARY is the shared (i.e., DLL) library.
619#
Martin v. Löwis1142de32002-03-29 16:28:31 +0000620# RUNSHARED is used to run shared python without installed libraries
621#
622# INSTSONAME is the name of the shared library that will be use to install
623# on the system - some systems like version suffix, others don't
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000624AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000625AC_SUBST(DLLLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000626AC_SUBST(BLDLIBRARY)
627AC_SUBST(LDLIBRARYDIR)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000628AC_SUBST(INSTSONAME)
629AC_SUBST(RUNSHARED)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000630LDLIBRARY="$LIBRARY"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000631BLDLIBRARY='$(LDLIBRARY)'
Martin v. Löwis09bdf722002-05-08 08:51:29 +0000632INSTSONAME='$(LDLIBRARY)'
Guido van Rossum27552902001-01-23 01:52:26 +0000633DLLLIBRARY=''
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000634LDLIBRARYDIR=''
Martin v. Löwis1142de32002-03-29 16:28:31 +0000635RUNSHARED=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000636
Guido van Rossumfb842551997-08-06 23:42:07 +0000637# LINKCC is the command that links the python executable -- default is $(CC).
Martin v. Löwisb7da67a2001-10-18 15:35:38 +0000638# If CXX is set, and if it is needed to link a main function that was
639# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
640# python might then depend on the C++ runtime
Fred Drake5790be12000-10-09 17:06:13 +0000641# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000642# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000643AC_SUBST(LINKCC)
644AC_MSG_CHECKING(LINKCC)
645if test -z "$LINKCC"
646then
Martin v. Löwis0f48d982006-04-14 14:34:26 +0000647 LINKCC='$(PURIFY) $(MAINCC)'
Guido van Rossumfb842551997-08-06 23:42:07 +0000648 case $ac_sys_system in
649 AIX*)
Neal Norwitz0b27ff92003-03-31 15:53:49 +0000650 exp_extra="\"\""
651 if test $ac_sys_release -ge 5 -o \
652 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
653 exp_extra="."
654 fi
655 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000656 Monterey64*)
Martin v. Löwis4e732dc2002-03-19 15:15:32 +0000657 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
Martin v. Löwis8c255e42008-05-23 15:06:50 +0000658 QNX*)
659 # qcc must be used because the other compilers do not
660 # support -N.
661 LINKCC=qcc;;
Guido van Rossumfb842551997-08-06 23:42:07 +0000662 esac
663fi
664AC_MSG_RESULT($LINKCC)
665
Martin v. Löwis1142de32002-03-29 16:28:31 +0000666AC_MSG_CHECKING(for --enable-shared)
667AC_ARG_ENABLE(shared,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000668 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000669
Martin v. Löwis1142de32002-03-29 16:28:31 +0000670if test -z "$enable_shared"
671then
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000672 case $ac_sys_system in
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000673 CYGWIN* | atheos*)
Martin v. Löwisb51033d2002-05-03 05:53:15 +0000674 enable_shared="yes";;
675 *)
676 enable_shared="no";;
677 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000678fi
679AC_MSG_RESULT($enable_shared)
680
Skip Montanaro56f6a4f2004-06-18 02:47:22 +0000681AC_MSG_CHECKING(for --enable-profiling)
682AC_ARG_ENABLE(profiling,
683 AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
684[ac_save_cc="$CC"
685 CC="$CC -pg"
686 AC_TRY_RUN([int main() { return 0; }],
687 ac_enable_profiling="yes",
688 ac_enable_profiling="no",
689 ac_enable_profiling="no")
690 CC="$ac_save_cc"])
691AC_MSG_RESULT($ac_enable_profiling)
692
693case "$ac_enable_profiling" in
694 "yes")
695 BASECFLAGS="-pg $BASECFLAGS"
696 LDFLAGS="-pg $LDFLAGS"
697 ;;
698esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000699
700AC_MSG_CHECKING(LDLIBRARY)
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000701
Guido van Rossumb8552162001-09-05 14:58:11 +0000702# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
703# library that we build, but we do not want to link against it (we
704# will find it with a -framework option). For this reason there is an
705# extra variable BLDLIBRARY against which Python and the extension
706# modules are linked, BLDLIBRARY. This is normally the same as
707# LDLIBRARY, but empty for MacOSX framework builds.
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000708if test "$enable_framework"
709then
710 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen66b84832003-07-04 12:14:39 +0000711 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
Jack Jansenb6e9cad2001-08-15 01:26:28 +0000712 BLDLIBRARY=''
713else
714 BLDLIBRARY='$(LDLIBRARY)'
715fi
716
Martin v. Löwis1142de32002-03-29 16:28:31 +0000717# Other platforms follow
718if test $enable_shared = "yes"; then
Mark Hammond8235ea12002-07-19 06:55:41 +0000719 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
Martin v. Löwis1142de32002-03-29 16:28:31 +0000720 case $ac_sys_system in
721 BeOS*)
722 LDLIBRARY='libpython$(VERSION).so'
723 ;;
724 CYGWIN*)
725 LDLIBRARY='libpython$(VERSION).dll.a'
726 DLLLIBRARY='libpython$(VERSION).dll'
727 ;;
728 SunOS*)
729 LDLIBRARY='libpython$(VERSION).so'
Martin v. Löwisd141a8c2003-06-14 15:20:28 +0000730 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000731 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Martin v. Löwis2389c412003-10-31 15:42:07 +0000732 INSTSONAME="$LDLIBRARY".$SOVERSION
Martin v. Löwis1142de32002-03-29 16:28:31 +0000733 ;;
Martin v. Löwis86d66262006-02-17 08:40:11 +0000734 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
Martin v. Löwis1142de32002-03-29 16:28:31 +0000735 LDLIBRARY='libpython$(VERSION).so'
736 BLDLIBRARY='-L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000737 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Hye-Shik Chang33761492004-10-26 09:53:46 +0000738 case $ac_sys_system in
739 FreeBSD*)
740 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
741 ;;
742 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000743 INSTSONAME="$LDLIBRARY".$SOVERSION
744 ;;
745 hp*|HP*)
Neal Norwitz58e28882006-05-19 07:00:58 +0000746 case `uname -m` in
747 ia64)
748 LDLIBRARY='libpython$(VERSION).so'
749 ;;
750 *)
751 LDLIBRARY='libpython$(VERSION).sl'
752 ;;
753 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000754 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000755 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000756 ;;
757 OSF*)
758 LDLIBRARY='libpython$(VERSION).so'
Neal Norwitz671b9e32006-01-09 07:07:12 +0000759 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
Martin v. Löwisfc9b75f2003-08-09 09:06:52 +0000760 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
Martin v. Löwis1142de32002-03-29 16:28:31 +0000761 ;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000762 atheos*)
763 LDLIBRARY='libpython$(VERSION).so'
764 BLDLIBRARY='-L. -lpython$(VERSION)'
765 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
766 ;;
Ronald Oussorene9cce8e2009-01-02 10:46:42 +0000767 Darwin*)
768 LDLIBRARY='libpython$(VERSION).dylib'
769 BLDLIBRARY='-L. -lpython$(VERSION)'
770 RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
771 ;;
772
Martin v. Löwis1142de32002-03-29 16:28:31 +0000773 esac
Jason Tishler30765592003-09-04 11:04:06 +0000774else # shared is disabled
775 case $ac_sys_system in
776 CYGWIN*)
777 BLDLIBRARY='$(LIBRARY)'
778 LDLIBRARY='libpython$(VERSION).dll.a'
779 ;;
780 esac
Martin v. Löwis1142de32002-03-29 16:28:31 +0000781fi
782
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000783AC_MSG_RESULT($LDLIBRARY)
784
Guido van Rossum627b2d71993-12-24 10:39:16 +0000785AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000786AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000787AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000788
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000789AC_SUBST(SVNVERSION)
Martin v. Löwisff600232006-04-03 19:12:32 +0000790AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000791if test $SVNVERSION = found
792then
793 SVNVERSION="svnversion \$(srcdir)"
794else
Benjamin Peterson2eb65452009-05-23 19:35:33 +0000795 SVNVERSION="echo Unversioned directory"
Martin v. Löwisc5bf5a02006-01-05 10:33:59 +0000796fi
Martin v. Löwisdea59e52006-01-05 10:00:36 +0000797
Neil Schemenauera42c8272001-03-31 00:01:55 +0000798case $MACHDEP in
Neil Schemenaueraf5567f2001-10-21 22:32:04 +0000799bsdos*|hp*|HP*)
800 # install -d does not work on BSDI or HP-UX
Neil Schemenauera42c8272001-03-31 00:01:55 +0000801 if test -z "$INSTALL"
802 then
803 INSTALL="${srcdir}/install-sh -c"
804 fi
805esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000806AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000807
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000808# Not every filesystem supports hard links
809AC_SUBST(LN)
810if test -z "$LN" ; then
811 case $ac_sys_system in
812 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000813 CYGWIN*) LN="ln -s";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +0000814 atheos*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000815 *) LN=ln;;
816 esac
817fi
818
Fred Drake9f715822001-07-11 06:27:00 +0000819# Check for --with-pydebug
820AC_MSG_CHECKING(for --with-pydebug)
821AC_ARG_WITH(pydebug,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +0000822 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
823[
Fred Drake9f715822001-07-11 06:27:00 +0000824if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +0000825then
826 AC_DEFINE(Py_DEBUG, 1,
827 [Define if you want to build an interpreter with many run-time checks.])
828 AC_MSG_RESULT(yes);
829 Py_DEBUG='true'
Fred Drake9f715822001-07-11 06:27:00 +0000830else AC_MSG_RESULT(no); Py_DEBUG='false'
831fi],
832[AC_MSG_RESULT(no)])
833
Skip Montanarodecc6a42003-01-01 20:07:49 +0000834# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
835# merged with this chunk of code?
836
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000837# Optimizer/debugger flags
Skip Montanarodecc6a42003-01-01 20:07:49 +0000838# ------------------------
839# (The following bit of code is complicated enough - please keep things
840# indented properly. Just pretend you're editing Python code. ;-)
841
842# There are two parallel sets of case statements below, one that checks to
843# see if OPT was set and one that does BASECFLAGS setting based upon
844# compiler and platform. BASECFLAGS tweaks need to be made even if the
845# user set OPT.
846
847# tweak OPT based on compiler and platform, only if the user didn't set
848# it on the command line
Guido van Rossumb418f891996-07-30 18:06:02 +0000849AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000850if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000851then
Skip Montanarodecc6a42003-01-01 20:07:49 +0000852 case $GCC in
853 yes)
Skip Montanaro288a5be2006-04-13 02:00:56 +0000854 if test "$CC" != 'g++' ; then
855 STRICT_PROTO="-Wstrict-prototypes"
856 fi
Guido van Rossum7c862f82007-12-13 20:50:10 +0000857 # For gcc 4.x we need to use -fwrapv so lets check if its supported
858 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
859 WRAP="-fwrapv"
860 fi
Skip Montanarodecc6a42003-01-01 20:07:49 +0000861 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000862 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000863 if test "$Py_DEBUG" = 'true' ; then
864 # Optimization messes up debuggers, so turn it off for
865 # debug builds.
Skip Montanaro288a5be2006-04-13 02:00:56 +0000866 OPT="-g -Wall $STRICT_PROTO"
Fred Drake9f715822001-07-11 06:27:00 +0000867 else
Guido van Rossum7c862f82007-12-13 20:50:10 +0000868 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +0000869 fi
870 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000871 *)
Skip Montanaro288a5be2006-04-13 02:00:56 +0000872 OPT="-O3 -Wall $STRICT_PROTO"
Skip Montanarodecc6a42003-01-01 20:07:49 +0000873 ;;
Fred Drake9f715822001-07-11 06:27:00 +0000874 esac
Martin v. Löwis21ee4092002-09-30 16:19:48 +0000875 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +0000876 SCO_SV*) OPT="$OPT -m486 -DSCO5"
877 ;;
878 esac
Fred Drake9f715822001-07-11 06:27:00 +0000879 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +0000880
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000881 *)
Skip Montanarodecc6a42003-01-01 20:07:49 +0000882 OPT="-O"
883 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000884 esac
Skip Montanarodecc6a42003-01-01 20:07:49 +0000885
886 # The current (beta) Monterey compiler dies with optimizations
887 # XXX what is Monterey? Does it still die w/ -O? Can we get rid of this?
Jack Jansenca06bc62001-08-03 15:32:23 +0000888 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +0000889 Monterey*)
890 OPT=""
891 ;;
Jack Jansenca06bc62001-08-03 15:32:23 +0000892 esac
Skip Montanarodecc6a42003-01-01 20:07:49 +0000893
Guido van Rossum4e8af441994-08-19 15:33:54 +0000894fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000895
Skip Montanarodecc6a42003-01-01 20:07:49 +0000896AC_SUBST(BASECFLAGS)
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000897
898# The -arch flags for universal builds on OSX
899UNIVERSAL_ARCH_FLAGS=
900AC_SUBST(UNIVERSAL_ARCH_FLAGS)
901
Skip Montanarodecc6a42003-01-01 20:07:49 +0000902# tweak BASECFLAGS based on compiler and platform
903case $GCC in
904yes)
Martin v. Löwis70fedcd2003-07-07 21:26:19 +0000905 # Python violates C99 rules, by casting between incompatible
906 # pointer types. GCC may generate bad code as a result of that,
907 # so use -fno-strict-aliasing if supported.
908 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
909 ac_save_cc="$CC"
910 CC="$CC -fno-strict-aliasing"
911 AC_TRY_RUN([int main() { return 0; }],
912 ac_cv_no_strict_aliasing_ok=yes,
913 ac_cv_no_strict_aliasing_ok=no,
914 ac_cv_no_strict_aliasing_ok=no)
915 CC="$ac_save_cc"
916 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
917 if test $ac_cv_no_strict_aliasing_ok = yes
918 then
919 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
920 fi
Mark Dickinson65134662008-04-25 16:11:04 +0000921
922 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
923 # support. Without this, treatment of subnormals doesn't follow
924 # the standard.
925 case $ac_sys_machine in
926 alpha*)
927 BASECFLAGS="$BASECFLAGS -mieee"
928 ;;
929 esac
930
Skip Montanarodecc6a42003-01-01 20:07:49 +0000931 case $ac_sys_system in
932 SCO_SV*)
933 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
934 ;;
935 # is there any other compiler on Darwin besides gcc?
936 Darwin*)
Jeffrey Yasskin1b4e45b2008-03-17 14:40:53 +0000937 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
938 # used to be here, but non-Apple gcc doesn't accept them.
Benjamin Peterson4347c442008-07-17 15:59:24 +0000939
940
Ronald Oussoren988117f2006-04-29 11:31:35 +0000941 if test "${enable_universalsdk}"; then
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000942 UNIVERSAL_ARCH_FLAGS=""
943 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
944 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
Benjamin Peterson0e6ea5d2008-07-16 20:17:04 +0000945 ARCH_RUN_32BIT=""
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000946
947 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
948 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
Ronald Oussoren461f2202009-09-06 10:54:28 +0000949 ARCH_RUN_32BIT="true"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000950
951 elif test "$UNIVERSAL_ARCHS" = "all" ; then
952 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
Ronald Oussorend8244f52010-02-11 13:22:03 +0000953 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000954
Ronald Oussoren7ab74352009-09-08 07:10:07 +0000955 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
956 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
Ronald Oussorend8244f52010-02-11 13:22:03 +0000957 ARCH_RUN_32BIT="/usr/bin/arch -i386"
Ronald Oussoren7ab74352009-09-08 07:10:07 +0000958
959 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
960 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
Ronald Oussorend8244f52010-02-11 13:22:03 +0000961 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
Ronald Oussoren7ab74352009-09-08 07:10:07 +0000962
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000963 else
Ronald Oussorenba0aa6b2009-09-20 20:16:38 +0000964 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
Ronald Oussoren5640ce22008-06-05 12:58:24 +0000965
966 fi
967
968
969 BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
Ronald Oussoren5a849d42008-07-22 07:06:00 +0000970 tgt=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
Benjamin Peterson4347c442008-07-17 15:59:24 +0000971 if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
972 CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
973 fi
Ronald Oussoren988117f2006-04-29 11:31:35 +0000974 fi
975
Benjamin Peterson4347c442008-07-17 15:59:24 +0000976 # Calculate the right deployment target for this build.
977 #
978 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
979 if test ${cur_target} '>' 10.2; then
980 cur_target=10.3
Ronald Oussoren461f2202009-09-06 10:54:28 +0000981 if test ${enable_universalsdk}; then
982 if test "${UNIVERSAL_ARCHS}" = "all"; then
983 # Ensure that the default platform for a
984 # 4-way universal build is OSX 10.5,
985 # that's the first OS release where
986 # 4-way builds make sense.
987 cur_target='10.5'
Ronald Oussoren7ab74352009-09-08 07:10:07 +0000988
989 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
990 cur_target='10.5'
991
992 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
993 cur_target='10.5'
994
995 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
996 cur_target='10.5'
Ronald Oussoren461f2202009-09-06 10:54:28 +0000997 fi
998 else
999 if test `arch` = "i386"; then
1000 # On Intel macs default to a deployment
1001 # target of 10.4, that's the first OSX
1002 # release with Intel support.
1003 cur_target="10.4"
1004 fi
1005 fi
Benjamin Peterson4347c442008-07-17 15:59:24 +00001006 fi
1007 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1008
1009 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1010 # environment with a value that is the same as what we'll use
1011 # in the Makefile to ensure that we'll get the same compiler
1012 # environment during configure and build time.
1013 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1014 export MACOSX_DEPLOYMENT_TARGET
1015 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1016
Skip Montanarodecc6a42003-01-01 20:07:49 +00001017 ;;
Neal Norwitzdedeeaa2006-03-31 06:54:45 +00001018 OSF*)
1019 BASECFLAGS="$BASECFLAGS -mieee"
1020 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001021 esac
1022 ;;
1023
1024*)
1025 case $ac_sys_system in
1026 OpenUNIX*|UnixWare*)
1027 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1028 ;;
Neal Norwitzb44f1652003-05-26 14:11:55 +00001029 OSF*)
1030 BASECFLAGS="$BASECFLAGS -ieee -std"
1031 ;;
Skip Montanarodecc6a42003-01-01 20:07:49 +00001032 SCO_SV*)
1033 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1034 ;;
1035 esac
1036 ;;
1037esac
1038
Fred Drakee1ceaa02001-12-04 20:55:47 +00001039if test "$Py_DEBUG" = 'true'; then
1040 :
1041else
1042 OPT="-DNDEBUG $OPT"
1043fi
1044
Guido van Rossum6f2260e1996-09-09 16:21:03 +00001045if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001046then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001047 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +00001048fi
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001049
Neal Norwitz020c46a2006-01-07 21:39:28 +00001050# disable check for icc since it seems to pass, but generates a warning
1051if test "$CC" = icc
1052then
1053 ac_cv_opt_olimit_ok=no
1054fi
1055
Guido van Rossum91922671997-10-09 20:24:13 +00001056AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1057AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1058[ac_save_cc="$CC"
1059CC="$CC -OPT:Olimit=0"
1060AC_TRY_RUN([int main() { return 0; }],
1061 ac_cv_opt_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +00001062 ac_cv_opt_olimit_ok=no,
Guido van Rossum91922671997-10-09 20:24:13 +00001063 ac_cv_opt_olimit_ok=no)
1064CC="$ac_save_cc"])
1065AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +00001066if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +00001067 case $ac_sys_system in
Skip Montanarodecc6a42003-01-01 20:07:49 +00001068 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1069 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1070 # environment?
1071 Darwin*)
1072 ;;
1073 *)
1074 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1075 ;;
Guido van Rossum5839e582000-10-09 19:52:35 +00001076 esac
Guido van Rossumf8678121998-07-07 21:05:09 +00001077else
1078 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1079 AC_CACHE_VAL(ac_cv_olimit_ok,
1080 [ac_save_cc="$CC"
1081 CC="$CC -Olimit 1500"
1082 AC_TRY_RUN([int main() { return 0; }],
1083 ac_cv_olimit_ok=yes,
Guido van Rossum3065c942001-09-17 04:03:14 +00001084 ac_cv_olimit_ok=no,
Guido van Rossumf8678121998-07-07 21:05:09 +00001085 ac_cv_olimit_ok=no)
1086 CC="$ac_save_cc"])
1087 AC_MSG_RESULT($ac_cv_olimit_ok)
1088 if test $ac_cv_olimit_ok = yes; then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001089 BASECFLAGS="$BASECFLAGS -Olimit 1500"
Guido van Rossumf8678121998-07-07 21:05:09 +00001090 fi
Guido van Rossum201afe51997-05-14 21:14:44 +00001091fi
Guido van Rossumf8678121998-07-07 21:05:09 +00001092
Martin v. Löwisaac13162006-10-19 10:58:46 +00001093# Check whether GCC supports PyArg_ParseTuple format
1094if test "$GCC" = "yes"
1095then
1096 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1097 save_CFLAGS=$CFLAGS
1098 CFLAGS="$CFLAGS -Werror"
1099 AC_TRY_COMPILE([
1100 void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
1101 ],,
1102 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1103 AC_MSG_RESULT(yes),
1104 AC_MSG_RESULT(no)
1105 )
Martin v. Löwisc1d75972006-10-19 16:01:37 +00001106 CFLAGS=$save_CFLAGS
Martin v. Löwisaac13162006-10-19 10:58:46 +00001107fi
1108
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001109# On some compilers, pthreads are available without further options
1110# (e.g. MacOS X). On some of these systems, the compiler will not
1111# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1112# So we have to see first whether pthreads are available without
1113# options before we can check whether -Kpthread improves anything.
1114AC_MSG_CHECKING(whether pthreads are available without options)
1115AC_CACHE_VAL(ac_cv_pthread_is_default,
1116[AC_TRY_RUN([
1117#include <pthread.h>
1118
1119void* routine(void* p){return NULL;}
1120
1121int main(){
1122 pthread_t p;
1123 if(pthread_create(&p,NULL,routine,NULL)!=0)
1124 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001125 (void)pthread_detach(p);
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001126 return 0;
1127}
1128],
Skip Montanarod8d39a02003-07-10 20:44:10 +00001129[
1130 ac_cv_pthread_is_default=yes
1131 ac_cv_kthread=no
1132 ac_cv_pthread=no
1133],
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001134 ac_cv_pthread_is_default=no,
1135 ac_cv_pthread_is_default=no)
1136])
1137AC_MSG_RESULT($ac_cv_pthread_is_default)
1138
1139
1140if test $ac_cv_pthread_is_default = yes
1141then
1142 ac_cv_kpthread=no
1143else
Martin v. Löwis130fb172001-07-19 11:00:41 +00001144# -Kpthread, if available, provides the right #defines
1145# and linker options to make pthread_create available
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001146# Some compilers won't report that they do not support -Kpthread,
1147# so we need to run a program to see whether it really made the
1148# function available.
Martin v. Löwis130fb172001-07-19 11:00:41 +00001149AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1150AC_CACHE_VAL(ac_cv_kpthread,
1151[ac_save_cc="$CC"
1152CC="$CC -Kpthread"
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001153AC_TRY_RUN([
1154#include <pthread.h>
1155
1156void* routine(void* p){return NULL;}
1157
1158int main(){
1159 pthread_t p;
1160 if(pthread_create(&p,NULL,routine,NULL)!=0)
1161 return 1;
Jack Jansen4f8d0542002-03-08 13:43:01 +00001162 (void)pthread_detach(p);
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001163 return 0;
1164}
1165],
Martin v. Löwis130fb172001-07-19 11:00:41 +00001166 ac_cv_kpthread=yes,
Martin v. Löwis260aecc2001-10-07 08:14:41 +00001167 ac_cv_kpthread=no,
Martin v. Löwis130fb172001-07-19 11:00:41 +00001168 ac_cv_kpthread=no)
1169CC="$ac_save_cc"])
Martin v. Löwis130fb172001-07-19 11:00:41 +00001170AC_MSG_RESULT($ac_cv_kpthread)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00001171fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00001172
Skip Montanarod8d39a02003-07-10 20:44:10 +00001173if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001174then
1175# -Kthread, if available, provides the right #defines
1176# and linker options to make pthread_create available
1177# Some compilers won't report that they do not support -Kthread,
1178# so we need to run a program to see whether it really made the
1179# function available.
1180AC_MSG_CHECKING(whether $CC accepts -Kthread)
1181AC_CACHE_VAL(ac_cv_kthread,
1182[ac_save_cc="$CC"
1183CC="$CC -Kthread"
1184AC_TRY_RUN([
1185#include <pthread.h>
1186
1187void* routine(void* p){return NULL;}
1188
1189int main(){
1190 pthread_t p;
1191 if(pthread_create(&p,NULL,routine,NULL)!=0)
1192 return 1;
1193 (void)pthread_detach(p);
1194 return 0;
1195}
1196],
1197 ac_cv_kthread=yes,
1198 ac_cv_kthread=no,
1199 ac_cv_kthread=no)
1200CC="$ac_save_cc"])
1201AC_MSG_RESULT($ac_cv_kthread)
1202fi
1203
Skip Montanarod8d39a02003-07-10 20:44:10 +00001204if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001205then
1206# -pthread, if available, provides the right #defines
1207# and linker options to make pthread_create available
1208# Some compilers won't report that they do not support -pthread,
1209# so we need to run a program to see whether it really made the
1210# function available.
1211AC_MSG_CHECKING(whether $CC accepts -pthread)
1212AC_CACHE_VAL(ac_cv_thread,
1213[ac_save_cc="$CC"
1214CC="$CC -pthread"
1215AC_TRY_RUN([
1216#include <pthread.h>
1217
1218void* routine(void* p){return NULL;}
1219
1220int main(){
1221 pthread_t p;
1222 if(pthread_create(&p,NULL,routine,NULL)!=0)
1223 return 1;
1224 (void)pthread_detach(p);
1225 return 0;
1226}
1227],
1228 ac_cv_pthread=yes,
1229 ac_cv_pthread=no,
1230 ac_cv_pthread=no)
1231CC="$ac_save_cc"])
1232AC_MSG_RESULT($ac_cv_pthread)
1233fi
1234
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001235# If we have set a CC compiler flag for thread support then
1236# check if it works for CXX, too.
1237ac_cv_cxx_thread=no
1238if test ! -z "$CXX"
1239then
1240AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1241ac_save_cxx="$CXX"
1242
1243if test "$ac_cv_kpthread" = "yes"
1244then
Martin v. Löwis519adae2003-09-20 10:47:47 +00001245 CXX="$CXX -Kpthread"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001246 ac_cv_cxx_thread=yes
1247elif test "$ac_cv_kthread" = "yes"
1248then
1249 CXX="$CXX -Kthread"
1250 ac_cv_cxx_thread=yes
1251elif test "$ac_cv_pthread" = "yes"
1252then
1253 CXX="$CXX -pthread"
1254 ac_cv_cxx_thread=yes
1255fi
1256
1257if test $ac_cv_cxx_thread = yes
1258then
1259 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1260 $CXX -c conftest.$ac_ext 2>&5
1261 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1262 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1263 then
1264 ac_cv_cxx_thread=yes
1265 else
1266 ac_cv_cxx_thread=no
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001267 fi
1268 rm -fr conftest*
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001269fi
Brett Cannonc601e0f2004-11-07 01:24:12 +00001270AC_MSG_RESULT($ac_cv_cxx_thread)
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001271fi
Martin v. Löwis519adae2003-09-20 10:47:47 +00001272CXX="$ac_save_cxx"
Martin v. Löwisab1e5852003-06-28 07:46:38 +00001273
Fred Drakece81d592000-07-09 14:39:29 +00001274dnl # check for ANSI or K&R ("traditional") preprocessor
1275dnl AC_MSG_CHECKING(for C preprocessor type)
1276dnl AC_TRY_COMPILE([
1277dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1278dnl int foo;
1279dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1280dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
1281dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +00001282
Guido van Rossum627b2d71993-12-24 10:39:16 +00001283# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001284AC_HEADER_STDC
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001285AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1286fcntl.h grp.h \
Neal Norwitz9fdfaaf2008-03-28 05:34:59 +00001287ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001288shadow.h signal.h stdint.h stropts.h termios.h thread.h \
Martin v. Löwis14e73b12003-01-01 09:51:12 +00001289unistd.h utime.h \
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00001290sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1291sys/lock.h sys/mkdev.h sys/modem.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001292sys/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 +00001293sys/termio.h sys/time.h \
Martin v. Löwis0e8bd7e2006-06-10 12:23:46 +00001294sys/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 +00001295sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
Christian Heimesfb2d25a2008-01-07 16:12:44 +00001296bluetooth/bluetooth.h linux/tipc.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001297AC_HEADER_DIRENT
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00001298AC_HEADER_MAJOR
Guido van Rossum627b2d71993-12-24 10:39:16 +00001299
Martin v. Löwisae2830c2004-09-18 09:54:52 +00001300# On Solaris, term.h requires curses.h
Martin v. Löwisfd1c69e72004-11-30 22:09:37 +00001301AC_CHECK_HEADERS(term.h,,,[
Martin v. Löwis5d52e782004-09-18 10:07:03 +00001302#ifdef HAVE_CURSES_H
1303#include <curses.h>
1304#endif
1305])
Martin v. Löwisae2830c2004-09-18 09:54:52 +00001306
Martin v. Löwis11017b12006-01-14 18:12:57 +00001307# On Linux, netlink.h requires asm/types.h
1308AC_CHECK_HEADERS(linux/netlink.h,,,[
1309#ifdef HAVE_ASM_TYPES_H
1310#include <asm/types.h>
1311#endif
1312#ifdef HAVE_SYS_SOCKET_H
1313#include <sys/socket.h>
1314#endif
1315])
1316
Guido van Rossum627b2d71993-12-24 10:39:16 +00001317# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001318was_it_defined=no
1319AC_MSG_CHECKING(for clock_t in time.h)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001320AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1321 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1322])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001323AC_MSG_RESULT($was_it_defined)
1324
Neal Norwitz11690112002-07-30 01:08:28 +00001325# Check whether using makedev requires defining _OSF_SOURCE
1326AC_MSG_CHECKING(for makedev)
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001327AC_TRY_LINK([#include <sys/types.h> ],
Neal Norwitz11690112002-07-30 01:08:28 +00001328 [ makedev(0, 0) ],
1329 ac_cv_has_makedev=yes,
1330 ac_cv_has_makedev=no)
1331if test "$ac_cv_has_makedev" = "no"; then
1332 # we didn't link, try if _OSF_SOURCE will allow us to link
1333 AC_TRY_LINK([
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001334#define _OSF_SOURCE 1
1335#include <sys/types.h>
Neal Norwitz11690112002-07-30 01:08:28 +00001336 ],
1337 [ makedev(0, 0) ],
1338 ac_cv_has_makedev=yes,
1339 ac_cv_has_makedev=no)
1340 if test "$ac_cv_has_makedev" = "yes"; then
1341 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1342 fi
1343fi
1344AC_MSG_RESULT($ac_cv_has_makedev)
1345if test "$ac_cv_has_makedev" = "yes"; then
1346 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1347fi
1348
Martin v. Löwis399a6892002-10-04 10:22:02 +00001349# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1350# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1351# defined, but the compiler does not support pragma redefine_extname,
1352# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1353# structures (such as rlimit64) without declaring them. As a
1354# work-around, disable LFS on such configurations
1355
1356use_lfs=yes
1357AC_MSG_CHECKING(Solaris LFS bug)
1358AC_TRY_COMPILE([
1359#define _LARGEFILE_SOURCE 1
1360#define _FILE_OFFSET_BITS 64
1361#include <sys/resource.h>
1362],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1363AC_MSG_RESULT($sol_lfs_bug)
1364if test "$sol_lfs_bug" = "yes"; then
1365 use_lfs=no
1366fi
1367
1368if test "$use_lfs" = "yes"; then
Guido van Rossum810cc512001-09-09 23:51:39 +00001369# Two defines needed to enable largefile support on various platforms
1370# These may affect some typedefs
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001371AC_DEFINE(_LARGEFILE_SOURCE, 1,
1372[This must be defined on some systems to enable large file support.])
1373AC_DEFINE(_FILE_OFFSET_BITS, 64,
1374[This must be set to 64 on some systems to enable large file support.])
Martin v. Löwis399a6892002-10-04 10:22:02 +00001375fi
Guido van Rossum810cc512001-09-09 23:51:39 +00001376
Guido van Rossum300fda71996-08-19 21:58:16 +00001377# Add some code to confdefs.h so that the test for off_t works on SCO
1378cat >> confdefs.h <<\EOF
1379#if defined(SCO_DS)
1380#undef _OFF_T
1381#endif
1382EOF
1383
Guido van Rossumef2255b2000-03-10 22:30:29 +00001384# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001385AC_TYPE_MODE_T
1386AC_TYPE_OFF_T
1387AC_TYPE_PID_T
1388AC_TYPE_SIGNAL
1389AC_TYPE_SIZE_T
1390AC_TYPE_UID_T
Christian Heimes951cc0f2008-01-31 23:08:23 +00001391AC_CHECK_TYPE(ssize_t,
Martin v. Löwis18e16552006-02-15 17:27:45 +00001392 AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001393
Guido van Rossumef2255b2000-03-10 22:30:29 +00001394# Sizes of various common basic types
Skip Montanarob9820a32004-01-17 00:16:12 +00001395# ANSI C requires sizeof(char) == 1, so no need to check it
Guido van Rossum3065c942001-09-17 04:03:14 +00001396AC_CHECK_SIZEOF(int, 4)
1397AC_CHECK_SIZEOF(long, 4)
1398AC_CHECK_SIZEOF(void *, 4)
Guido van Rossum3065c942001-09-17 04:03:14 +00001399AC_CHECK_SIZEOF(short, 2)
1400AC_CHECK_SIZEOF(float, 4)
1401AC_CHECK_SIZEOF(double, 8)
1402AC_CHECK_SIZEOF(fpos_t, 4)
Martin v. Löwis18e16552006-02-15 17:27:45 +00001403AC_CHECK_SIZEOF(size_t, 4)
Christian Heimes951cc0f2008-01-31 23:08:23 +00001404AC_CHECK_SIZEOF(pid_t, 4)
Guido van Rossumac405f61994-09-12 10:56:06 +00001405
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001406AC_MSG_CHECKING(for long long support)
1407have_long_long=no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001408AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1409 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1410 have_long_long=yes
1411])
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001412AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001413if test "$have_long_long" = yes ; then
Guido van Rossum3065c942001-09-17 04:03:14 +00001414AC_CHECK_SIZEOF(long long, 8)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001415fi
1416
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001417AC_MSG_CHECKING(for long double support)
1418have_long_double=no
1419AC_TRY_COMPILE([], [long double x; x = (long double)0.;], [
1420 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1421 have_long_double=yes
1422])
1423AC_MSG_RESULT($have_long_double)
Mark Dickinsondc1688a2008-06-27 22:20:14 +00001424if test "$have_long_double" = yes ; then
Travis E. Oliphant711c9e92008-06-06 22:33:21 +00001425AC_CHECK_SIZEOF(long double, 12)
1426fi
1427
Martin v. Löwisaef4c6b2007-01-21 09:33:07 +00001428AC_MSG_CHECKING(for _Bool support)
1429have_c99_bool=no
1430AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [
1431 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1432 have_c99_bool=yes
1433])
1434AC_MSG_RESULT($have_c99_bool)
1435if test "$have_c99_bool" = yes ; then
1436AC_CHECK_SIZEOF(_Bool, 1)
1437fi
1438
Martin v. Löwisebe26702006-10-02 14:55:51 +00001439AC_CHECK_TYPES(uintptr_t,
1440 [AC_CHECK_SIZEOF(uintptr_t, 4)],
Martin v. Löwis40e9aed2006-10-02 15:20:37 +00001441 [], [#ifdef HAVE_STDINT_H
1442 #include <stdint.h>
1443 #endif])
Martin v. Löwisebe26702006-10-02 14:55:51 +00001444
Barry Warsawbc7c7f92000-08-18 04:53:33 +00001445
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001446# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
1447AC_MSG_CHECKING(size of off_t)
1448AC_CACHE_VAL(ac_cv_sizeof_off_t,
1449[AC_TRY_RUN([#include <stdio.h>
1450#include <sys/types.h>
1451main()
1452{
1453 FILE *f=fopen("conftestval", "w");
1454 if (!f) exit(1);
1455 fprintf(f, "%d\n", sizeof(off_t));
1456 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00001457}],
1458ac_cv_sizeof_off_t=`cat conftestval`,
1459ac_cv_sizeof_off_t=0,
1460ac_cv_sizeof_off_t=4)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001461])
1462AC_MSG_RESULT($ac_cv_sizeof_off_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001463AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1464[The number of bytes in an off_t.])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001465
1466AC_MSG_CHECKING(whether to enable large file support)
Mark Dickinsoncaa44c02009-12-31 21:20:06 +00001467if test "$have_long_long" = yes
1468then
1469if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +00001470 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001471 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1472 [Defined to enable large file support when an off_t is bigger than a long
1473 and long long is available and at least as big as an off_t. You may need
1474 to add some flags for configuration and compilation to enable this mode.
1475 (For Solaris and Linux, the necessary defines are already defined.)])
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001476 AC_MSG_RESULT(yes)
1477else
1478 AC_MSG_RESULT(no)
1479fi
Mark Dickinsoncaa44c02009-12-31 21:20:06 +00001480else
1481 AC_MSG_RESULT(no)
1482fi
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001483
Fred Drakea3f6e912000-06-29 20:44:47 +00001484# AC_CHECK_SIZEOF() doesn't include <time.h>.
1485AC_MSG_CHECKING(size of time_t)
1486AC_CACHE_VAL(ac_cv_sizeof_time_t,
1487[AC_TRY_RUN([#include <stdio.h>
1488#include <time.h>
1489main()
1490{
1491 FILE *f=fopen("conftestval", "w");
1492 if (!f) exit(1);
1493 fprintf(f, "%d\n", sizeof(time_t));
1494 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00001495}],
1496ac_cv_sizeof_time_t=`cat conftestval`,
1497ac_cv_sizeof_time_t=0,
1498ac_cv_sizeof_time_t=4)
Fred Drakea3f6e912000-06-29 20:44:47 +00001499])
1500AC_MSG_RESULT($ac_cv_sizeof_time_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001501AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
1502[The number of bytes in a time_t.])
Fred Drakea3f6e912000-06-29 20:44:47 +00001503
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001504
Trent Mick635f6fb2000-08-23 21:33:05 +00001505# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001506ac_save_cc="$CC"
1507if test "$ac_cv_kpthread" = "yes"
1508then CC="$CC -Kpthread"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00001509elif test "$ac_cv_kthread" = "yes"
1510then CC="$CC -Kthread"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00001511elif test "$ac_cv_pthread" = "yes"
1512then CC="$CC -pthread"
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001513fi
Trent Mick635f6fb2000-08-23 21:33:05 +00001514AC_MSG_CHECKING(for pthread_t)
1515have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +00001516AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +00001517AC_MSG_RESULT($have_pthread_t)
1518if test "$have_pthread_t" = yes ; then
1519 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
1520 AC_MSG_CHECKING(size of pthread_t)
1521 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
1522 [AC_TRY_RUN([#include <stdio.h>
Neal Norwitz6eb37f02003-02-23 23:28:15 +00001523#include <pthread.h>
Trent Mick635f6fb2000-08-23 21:33:05 +00001524 main()
1525 {
1526 FILE *f=fopen("conftestval", "w");
1527 if (!f) exit(1);
1528 fprintf(f, "%d\n", sizeof(pthread_t));
1529 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00001530 }],
1531 ac_cv_sizeof_pthread_t=`cat conftestval`,
1532 ac_cv_sizeof_pthread_t=0,
1533 ac_cv_sizeof_pthread_t=4)
Trent Mick635f6fb2000-08-23 21:33:05 +00001534 ])
1535 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001536 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
1537 [The number of bytes in a pthread_t.])
Trent Mick635f6fb2000-08-23 21:33:05 +00001538fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +00001539CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +00001540
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001541AC_MSG_CHECKING(for --enable-toolbox-glue)
1542AC_ARG_ENABLE(toolbox-glue,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001543 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001544
1545if test -z "$enable_toolbox_glue"
1546then
1547 case $ac_sys_system/$ac_sys_release in
1548 Darwin/*)
1549 enable_toolbox_glue="yes";;
1550 *)
1551 enable_toolbox_glue="no";;
1552 esac
1553fi
1554case "$enable_toolbox_glue" in
1555yes)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001556 extra_machdep_objs="Python/mactoolboxglue.o"
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001557 extra_undefs="-u _PyMac_Error"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001558 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1559 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001560 ;;
1561*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001562 extra_machdep_objs=""
Jack Jansen591cbed2001-08-15 13:55:15 +00001563 extra_undefs=""
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001564 ;;
1565esac
1566AC_MSG_RESULT($enable_toolbox_glue)
1567
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00001568
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001569AC_SUBST(OTHER_LIBTOOL_OPT)
1570case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001571 Darwin/@<:@01567@:>@\..*)
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001572 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1573 ;;
1574 Darwin/*)
1575 OTHER_LIBTOOL_OPT=""
1576 ;;
1577esac
1578
Ronald Oussoren461f2202009-09-06 10:54:28 +00001579
1580ARCH_RUN_32BIT=""
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001581AC_SUBST(LIBTOOL_CRUFT)
1582case $ac_sys_system/$ac_sys_release in
Anthony Baxter82201742006-04-09 15:07:40 +00001583 Darwin/@<:@01567@:>@\..*)
Ronald Oussoren988117f2006-04-29 11:31:35 +00001584 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1585 if test "${enable_universalsdk}"; then
1586 :
1587 else
Ronald Oussoren461f2202009-09-06 10:54:28 +00001588 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001589 fi
Jack Jansenb36687a2004-07-16 08:43:47 +00001590 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001591 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum5839e582000-10-09 19:52:35 +00001592 Darwin/*)
Ronald Oussorenc0fa2d242010-02-07 11:50:54 +00001593 gcc_version=`gcc -dumpversion`
Bob Ippolito7026a0a2005-03-28 23:23:47 +00001594 if test ${gcc_version} '<' 4.0
1595 then
1596 LIBTOOL_CRUFT="-lcc_dynamic"
1597 else
1598 LIBTOOL_CRUFT=""
1599 fi
Ronald Oussoren7ab74352009-09-08 07:10:07 +00001600 AC_TRY_RUN([
Ronald Oussoren461f2202009-09-06 10:54:28 +00001601 #include <unistd.h>
1602 int main(int argc, char*argv[])
1603 {
1604 if (sizeof(long) == 4) {
1605 return 0;
1606 } else {
1607 return 1;
1608 }
Ronald Oussoren7ab74352009-09-08 07:10:07 +00001609 }
1610 ], ac_osx_32bit=yes,
Ronald Oussoren461f2202009-09-06 10:54:28 +00001611 ac_osx_32bit=no,
Ronald Oussoren7ab74352009-09-08 07:10:07 +00001612 ac_osx_32bit=yes)
Ronald Oussoren461f2202009-09-06 10:54:28 +00001613
1614 if test "${ac_osx_32bit}" = "yes"; then
1615 case `arch` in
1616 i386)
1617 MACOSX_DEFAULT_ARCH="i386"
1618 ;;
1619 ppc)
1620 MACOSX_DEFAULT_ARCH="ppc"
1621 ;;
1622 *)
1623 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1624 ;;
1625 esac
1626 else
1627 case `arch` in
1628 i386)
1629 MACOSX_DEFAULT_ARCH="x86_64"
1630 ;;
1631 ppc)
1632 MACOSX_DEFAULT_ARCH="ppc64"
1633 ;;
1634 *)
1635 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1636 ;;
1637 esac
1638
1639 #ARCH_RUN_32BIT="true"
1640 fi
1641
1642 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
Jack Jansenb36687a2004-07-16 08:43:47 +00001643 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001644 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001645esac
1646
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001647AC_MSG_CHECKING(for --enable-framework)
1648if test "$enable_framework"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001649then
Skip Montanarodecc6a42003-01-01 20:07:49 +00001650 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001651 # -F. is needed to allow linking to the framework while
1652 # in the build location.
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001653 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1654 [Define if you want to produce an OpenStep/Rhapsody framework
1655 (shared library plus accessory files).])
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001656 AC_MSG_RESULT(yes)
Ronald Oussorene6e62672009-06-08 21:19:36 +00001657 if test $enable_shared = "yes"
1658 then
Ronald Oussorend0841712009-09-29 13:01:59 +00001659 AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.])
Ronald Oussorene6e62672009-06-08 21:19:36 +00001660 fi
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001661else
1662 AC_MSG_RESULT(no)
1663fi
1664
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001665AC_MSG_CHECKING(for dyld)
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001666case $ac_sys_system/$ac_sys_release in
1667 Darwin/*)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001668 AC_DEFINE(WITH_DYLD, 1,
1669 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1670 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1671 linker (rld). Dyld is necessary to support frameworks.])
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001672 AC_MSG_RESULT(always on for Darwin)
1673 ;;
1674 *)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001675 AC_MSG_RESULT(no)
1676 ;;
Jack Jansen9a66b6d2001-08-08 13:56:14 +00001677esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001678
Guido van Rossumac405f61994-09-12 10:56:06 +00001679# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +00001680AC_SUBST(SO)
1681AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001682AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001683AC_SUBST(CCSHARED)
1684AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001685# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +00001686# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001687AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +00001688if test -z "$SO"
1689then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001690 case $ac_sys_system in
Neal Norwitz58e28882006-05-19 07:00:58 +00001691 hp*|HP*)
1692 case `uname -m` in
1693 ia64) SO=.so;;
1694 *) SO=.sl;;
1695 esac
1696 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001697 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001698 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +00001699 esac
Martin v. Löwis368de8f2003-06-14 14:46:38 +00001700else
1701 # this might also be a termcap variable, see #610332
1702 echo
1703 echo '====================================================================='
1704 echo '+ +'
1705 echo '+ WARNING: You have set SO in your environment. +'
1706 echo '+ Do you really mean to change the extension for shared libraries? +'
1707 echo '+ Continuing in 10 seconds to let you to ponder. +'
1708 echo '+ +'
1709 echo '====================================================================='
1710 sleep 10
Guido van Rossumac405f61994-09-12 10:56:06 +00001711fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001712AC_MSG_RESULT($SO)
Ronald Oussorene9cce8e2009-01-02 10:46:42 +00001713
Neal Norwitz58e28882006-05-19 07:00:58 +00001714AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
Guido van Rossumac405f61994-09-12 10:56:06 +00001715# LDSHARED is the ld *command* used to create shared library
Skip Montanaroce59c042004-01-17 14:19:44 +00001716# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001717# (Shared libraries in this instance are shared modules to be loaded into
1718# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001719AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001720if test -z "$LDSHARED"
1721then
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001722 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001723 AIX*)
1724 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
Guido van Rossumce608b02001-09-28 15:59:38 +00001725 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001726 ;;
1727 BeOS*)
1728 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
Guido van Rossumce608b02001-09-28 15:59:38 +00001729 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001730 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001731 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +00001732 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Greg Ward57c9a6632000-05-26 12:22:54 +00001733 SunOS/5*)
1734 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +00001735 then LDSHARED='$(CC) -shared'
Martin v. Löwisaa5afe12002-10-07 06:21:41 +00001736 else LDSHARED='$(CC) -G';
Greg Ward57c9a6632000-05-26 12:22:54 +00001737 fi ;;
Thomas Hellerdc96a772008-04-04 10:07:55 +00001738 hp*|HP*)
1739 if test "$GCC" = "yes"
1740 then LDSHARED='$(CC) -shared'
1741 else LDSHARED='ld -b';
1742 fi ;;
Guido van Rossum71001e41995-01-26 00:44:03 +00001743 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Jack Jansen418c3b12001-11-14 10:59:57 +00001744 Darwin/1.3*)
Jack Jansena3891ea2001-09-07 14:25:12 +00001745 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1746 if test "$enable_framework" ; then
1747 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001748 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1749 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansena3891ea2001-09-07 14:25:12 +00001750 else
1751 # No framework. Ignore undefined symbols, assuming they come from Python
Jack Jansen418c3b12001-11-14 10:59:57 +00001752 LDSHARED="$LDSHARED -undefined suppress"
Jack Jansena3891ea2001-09-07 14:25:12 +00001753 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00001754 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001755 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1756 if test "$enable_framework" ; then
1757 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001758 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1759 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001760 else
Michael W. Hudson0c46c0c2002-03-07 09:58:56 +00001761 # No framework, use the Python app as bundle-loader
1762 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
Jack Jansenc28fc372003-02-25 13:14:43 +00001763 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001764 fi ;;
Jack Jansen6b08a402004-06-03 12:41:45 +00001765 Darwin/*)
1766 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1767 # This allows an extension to be used in any Python
Ronald Oussoren38f1b982007-09-02 09:46:07 +00001768
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001769 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
Jack Jansen6b08a402004-06-03 12:41:45 +00001770 then
Ronald Oussoren988117f2006-04-29 11:31:35 +00001771 if test "${enable_universalsdk}"; then
Ronald Oussoren5640ce22008-06-05 12:58:24 +00001772 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
Ronald Oussoren988117f2006-04-29 11:31:35 +00001773 fi
Jack Jansen6b08a402004-06-03 12:41:45 +00001774 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1775 BLDSHARED="$LDSHARED"
Jack Jansen6b08a402004-06-03 12:41:45 +00001776 else
1777 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1778 if test "$enable_framework" ; then
1779 # Link against the framework. All externals should be defined.
Jack Jansenda49e192005-01-07 13:08:22 +00001780 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1781 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansen6b08a402004-06-03 12:41:45 +00001782 else
1783 # No framework, use the Python app as bundle-loader
1784 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1785 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1786 fi
1787 fi
1788 ;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +00001789 Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';;
Guido van Rossum458e7fa1999-09-17 15:40:40 +00001790 BSD/OS*/4*) LDSHARED="gcc -shared";;
Martin v. Löwis222c5152006-06-03 07:37:13 +00001791 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +00001792 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +00001793 then
Hye-Shik Chang33761492004-10-26 09:53:46 +00001794 LDSHARED="$CC -shared ${LDFLAGS}"
Guido van Rossum0286ae82000-08-29 15:06:49 +00001795 else
1796 LDSHARED="ld -Bshareable ${LDFLAGS}"
1797 fi;;
Martin v. Löwis222c5152006-06-03 07:37:13 +00001798 OpenBSD*)
1799 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1800 then
1801 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1802 else
1803 case `uname -r` in
1804 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
1805 LDSHARED="ld -Bshareable ${LDFLAGS}"
1806 ;;
1807 *)
1808 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1809 ;;
1810 esac
1811 fi;;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001812 NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001813 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001814 if test "$GCC" = "yes"
Martin v. Löwis79f3c532002-12-11 12:51:58 +00001815 then LDSHARED='$(CC) -shared'
1816 else LDSHARED='$(CC) -G'
Martin v. Löwisbec19582001-03-21 15:57:54 +00001817 fi;;
Martin v. Löwis79f3c532002-12-11 12:51:58 +00001818 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
Trent Mick635f6fb2000-08-23 21:33:05 +00001819 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +00001820 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001821 atheos*) LDSHARED="gcc -shared";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001822 *) LDSHARED="ld";;
1823 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001824fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001825AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001826BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +00001827# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001828# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001829AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001830if test -z "$CCSHARED"
1831then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001832 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +00001833 SunOS*) if test "$GCC" = yes;
Martin v. Löwiseb623572007-03-12 10:50:39 +00001834 then CCSHARED="-fPIC";
1835 elif test `uname -p` = sparc;
1836 then CCSHARED="-xcode=pic32";
1837 else CCSHARED="-Kpic";
1838 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +00001839 hp*|HP*) if test "$GCC" = yes;
Martin v. Löwis703ad702001-09-05 08:36:52 +00001840 then CCSHARED="-fPIC";
Guido van Rossumaf07a441995-02-13 19:45:27 +00001841 else CCSHARED="+z";
1842 fi;;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001843 Linux*|GNU*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001844 BSD/OS*/4*) CCSHARED="-fpic";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001845 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001846 OpenUNIX*|UnixWare*)
Martin v. Löwisbec19582001-03-21 15:57:54 +00001847 if test "$GCC" = "yes"
1848 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +00001849 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +00001850 fi;;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001851 SCO_SV*)
1852 if test "$GCC" = "yes"
1853 then CCSHARED="-fPIC"
1854 else CCSHARED="-Kpic -belf"
1855 fi;;
Trent Mick635f6fb2000-08-23 21:33:05 +00001856 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001857 IRIX*/6*) case $CC in
1858 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +00001859 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001860 esac;;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001861 atheos*) CCSHARED="-fPIC";;
Guido van Rossumac405f61994-09-12 10:56:06 +00001862 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001863fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001864AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001865# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +00001866# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001867AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001868if test -z "$LINKFORSHARED"
1869then
Guido van Rossum6100aaf1997-04-29 21:48:51 +00001870 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +00001871 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +00001872 hp*|HP*)
Martin v. Löwis1142de32002-03-29 16:28:31 +00001873 LINKFORSHARED="-Wl,-E -Wl,+s";;
1874# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +00001875 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Martin v. Löwisa6e97582002-01-01 18:41:33 +00001876 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +00001877 # -u libsys_s pulls in all symbols in libsys
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001878 Darwin/*)
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001879 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1880 # which is
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001881 # not used by the core itself but which needs to be in the core so
1882 # that dynamically loaded extension modules have access to it.
Jack Jansen97e3f002003-02-23 22:59:01 +00001883 # -prebind is no longer used, because it actually seems to give a
1884 # slowdown in stead of a speedup, maybe due to the large number of
1885 # dynamic loads Python does.
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001886
1887 LINKFORSHARED="$extra_undefs"
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001888 if test "$enable_framework"
1889 then
Jack Jansenda49e192005-01-07 13:08:22 +00001890 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
Jack Jansenb6e9cad2001-08-15 01:26:28 +00001891 fi
Raymond Hettingerec6eb362004-11-05 07:02:59 +00001892 LINKFORSHARED="$LINKFORSHARED";;
Martin v. Löwis25ae43b2001-10-07 08:39:18 +00001893 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Martin v. Löwis21ee4092002-09-30 16:19:48 +00001894 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +00001895 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Martin v. Löwis86d66262006-02-17 08:40:11 +00001896 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
Guido van Rossumdf693651999-01-07 21:50:41 +00001897 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1898 then
1899 LINKFORSHARED="-Wl,--export-dynamic"
1900 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001901 SunOS/5*) case $CC in
1902 *gcc*)
Martin v. Löwisa4548572002-04-18 14:51:36 +00001903 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +00001904 then
1905 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +00001906 fi;;
1907 esac;;
Jason Tishler30765592003-09-04 11:04:06 +00001908 CYGWIN*)
1909 if test $enable_shared = "no"
1910 then
1911 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1912 fi;;
Martin v. Löwis8c255e42008-05-23 15:06:50 +00001913 QNX*)
1914 # -Wl,-E causes the symbols to be added to the dynamic
1915 # symbol table so that they can be found when a module
1916 # is loaded. -N 2048K causes the stack size to be set
1917 # to 2048 kilobytes so that the stack doesn't overflow
1918 # when running test_compile.py.
1919 LINKFORSHARED='-Wl,-E -N 2048K';;
Guido van Rossumac405f61994-09-12 10:56:06 +00001920 esac
Guido van Rossumac405f61994-09-12 10:56:06 +00001921fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001922AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +00001923
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00001924
Neil Schemenauer61c51152001-01-26 16:18:16 +00001925AC_SUBST(CFLAGSFORSHARED)
1926AC_MSG_CHECKING(CFLAGSFORSHARED)
1927if test ! "$LIBRARY" = "$LDLIBRARY"
1928then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +00001929 case $ac_sys_system in
1930 CYGWIN*)
1931 # Cygwin needs CCSHARED when building extension DLLs
1932 # but not when building the interpreter DLL.
1933 CFLAGSFORSHARED='';;
1934 *)
1935 CFLAGSFORSHARED='$(CCSHARED)'
1936 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +00001937fi
1938AC_MSG_RESULT($CFLAGSFORSHARED)
1939
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001940# SHLIBS are libraries (except -lc and -lm) to link to the python shared
1941# library (with --enable-shared).
1942# For platforms on which shared libraries are not allowed to have unresolved
Martin v. Löwisd6359c52002-08-04 12:38:50 +00001943# symbols, this must be set to $(LIBS) (expanded by make). We do this even
1944# if it is not required, since it creates a dependency of the shared library
1945# to LIBS. This, in turn, means that applications linking the shared libpython
1946# don't need to link LIBS explicitly. The default should be only changed
1947# on systems where this approach causes problems.
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001948AC_SUBST(SHLIBS)
1949AC_MSG_CHECKING(SHLIBS)
1950case "$ac_sys_system" in
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001951 *)
Martin v. Löwisd6359c52002-08-04 12:38:50 +00001952 SHLIBS='$(LIBS)';;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00001953esac
1954AC_MSG_RESULT($SHLIBS)
1955
1956
Guido van Rossum627b2d71993-12-24 10:39:16 +00001957# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001958AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1959AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Martin v. Löwis519adae2003-09-20 10:47:47 +00001960
Georg Brandl5c7f8fb2008-12-05 09:00:55 +00001961# only check for sem_init if thread support is requested
Martin v. Löwis519adae2003-09-20 10:47:47 +00001962if test "$with_threads" = "yes" -o -z "$with_threads"; then
1963 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
1964 # posix4 on Solaris 2.6
1965 # pthread (first!) on Linux
1966fi
1967
Martin v. Löwis19d17342003-06-14 21:03:05 +00001968# check if we need libintl for locale functions
1969AC_CHECK_LIB(intl, textdomain,
1970 AC_DEFINE(WITH_LIBINTL, 1,
1971 [Define to 1 if libintl is needed for locale functions.]))
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00001972
1973# checks for system dependent C++ extensions support
1974case "$ac_sys_system" in
1975 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1976 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1977 [loadAndInit("", 0, "")],
Martin v. Löwisc45929e2002-04-06 10:10:49 +00001978 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1979 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1980 and you want support for AIX C++ shared extension modules.])
Guido van Rossum0eefa3f1999-11-16 15:57:37 +00001981 AC_MSG_RESULT(yes)],
1982 [AC_MSG_RESULT(no)]);;
1983 *) ;;
1984esac
1985
Guido van Rossum70c7f481998-03-26 18:44:10 +00001986# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001987# BeOS' sockets are stashed in libnet.
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001988AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +00001989AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Skip Montanarob9949db2004-01-17 04:04:13 +00001990
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +00001991case "$ac_sys_system" in
1992BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001993AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1994;;
1995esac
Guido van Rossum70c7f481998-03-26 18:44:10 +00001996
Guido van Rossumc5a39031996-07-31 17:35:03 +00001997AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001998AC_ARG_WITH(libs,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00001999 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
2000[
Guido van Rossumc5a39031996-07-31 17:35:03 +00002001AC_MSG_RESULT($withval)
2002LIBS="$withval $LIBS"
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002003],
2004[AC_MSG_RESULT(no)])
Guido van Rossum627b2d71993-12-24 10:39:16 +00002005
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002006# Check for use of the system libffi library
2007AC_MSG_CHECKING(for --with-system-ffi)
2008AC_ARG_WITH(system_ffi,
2009 AC_HELP_STRING(--with-system-ffi, build _ctypes module using an installed ffi library))
2010
Martin v. Löwis9176fc12006-04-11 11:12:43 +00002011AC_MSG_RESULT($with_system_ffi)
2012
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002013# Determine if signalmodule should be used.
2014AC_SUBST(USE_SIGNAL_MODULE)
2015AC_SUBST(SIGNAL_OBJS)
2016AC_MSG_CHECKING(for --with-signal-module)
2017AC_ARG_WITH(signal-module,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002018 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00002019
2020if test -z "$with_signal_module"
2021then with_signal_module="yes"
2022fi
2023AC_MSG_RESULT($with_signal_module)
2024
2025if test "${with_signal_module}" = "yes"; then
2026 USE_SIGNAL_MODULE=""
2027 SIGNAL_OBJS=""
2028else
2029 USE_SIGNAL_MODULE="#"
2030 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2031fi
2032
Guido van Rossum3d15bd82001-01-10 18:53:48 +00002033# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +00002034AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002035USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +00002036
Guido van Rossum54d93d41997-01-22 20:51:58 +00002037AC_MSG_CHECKING(for --with-dec-threads)
2038AC_SUBST(LDLAST)
2039AC_ARG_WITH(dec-threads,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002040 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
2041[
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002042AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +00002043LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +00002044if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +00002045 with_thread="$withval";
2046fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002047[AC_MSG_RESULT(no)])
Guido van Rossum54d93d41997-01-22 20:51:58 +00002048
Martin v. Löwis11437992002-04-12 09:54:03 +00002049# Templates for things AC_DEFINEd more than once.
2050# For a single AC_DEFINE, no template is needed.
2051AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2052AH_TEMPLATE(_REENTRANT,
2053 [Define to force use of thread-safe errno, h_errno, and other functions])
2054AH_TEMPLATE(WITH_THREAD,
2055 [Define if you want to compile in rudimentary thread support])
2056
Guido van Rossum54d93d41997-01-22 20:51:58 +00002057AC_MSG_CHECKING(for --with-threads)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002058dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002059AC_ARG_WITH(threads,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002060 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
Guido van Rossum54d93d41997-01-22 20:51:58 +00002061
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002062# --with-thread is deprecated, but check for it anyway
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002063dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Barry Warsawa0f3c5c2000-06-30 16:39:35 +00002064AC_ARG_WITH(thread,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002065 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
2066 [with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002067
2068if test -z "$with_threads"
2069then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002070fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002071AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +00002072
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002073AC_SUBST(THREADOBJ)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002074if test "$with_threads" = "no"
2075then
2076 USE_THREAD_MODULE="#"
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002077elif test "$ac_cv_pthread_is_default" = yes
2078then
2079 AC_DEFINE(WITH_THREAD)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002080 # Defining _REENTRANT on system with POSIX threads should not hurt.
2081 AC_DEFINE(_REENTRANT)
2082 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002083 THREADOBJ="Python/thread.o"
Martin v. Löwis130fb172001-07-19 11:00:41 +00002084elif test "$ac_cv_kpthread" = "yes"
2085then
2086 CC="$CC -Kpthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002087 if test "$ac_cv_cxx_thread" = "yes"; then
2088 CXX="$CXX -Kpthread"
2089 fi
Martin v. Löwis130fb172001-07-19 11:00:41 +00002090 AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002091 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002092 THREADOBJ="Python/thread.o"
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002093elif test "$ac_cv_kthread" = "yes"
2094then
2095 CC="$CC -Kthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002096 if test "$ac_cv_cxx_thread" = "yes"; then
2097 CXX="$CXX -Kthread"
2098 fi
Martin v. Löwis5f433f02003-05-05 05:05:30 +00002099 AC_DEFINE(WITH_THREAD)
2100 posix_threads=yes
2101 THREADOBJ="Python/thread.o"
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002102elif test "$ac_cv_pthread" = "yes"
2103then
2104 CC="$CC -pthread"
Martin v. Löwis519adae2003-09-20 10:47:47 +00002105 if test "$ac_cv_cxx_thread" = "yes"; then
2106 CXX="$CXX -pthread"
2107 fi
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002108 AC_DEFINE(WITH_THREAD)
2109 posix_threads=yes
2110 THREADOBJ="Python/thread.o"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002111else
Martin v. Löwis130fb172001-07-19 11:00:41 +00002112 if test ! -z "$with_threads" -a -d "$with_threads"
2113 then LDFLAGS="$LDFLAGS -L$with_threads"
2114 fi
2115 if test ! -z "$withval" -a -d "$withval"
2116 then LDFLAGS="$LDFLAGS -L$withval"
2117 fi
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002118
2119 # According to the POSIX spec, a pthreads implementation must
Matthias Klosea2542be2004-08-16 11:35:51 +00002120 # define _POSIX_THREADS in unistd.h. Some apparently don't
2121 # (e.g. gnu pth with pthread emulation)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002122 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2123 AC_EGREP_CPP(yes,
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002124 [
2125#include <unistd.h>
2126#ifdef _POSIX_THREADS
2127yes
2128#endif
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002129 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2130 AC_MSG_RESULT($unistd_defines_pthreads)
2131
Martin v. Löwis130fb172001-07-19 11:00:41 +00002132 AC_DEFINE(_REENTRANT)
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002133 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2134 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002135 AC_DEFINE(HURD_C_THREADS, 1,
2136 [Define if you are using Mach cthreads directly under /include])
Martin v. Löwisa6e97582002-01-01 18:41:33 +00002137 LIBS="$LIBS -lthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002138 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002139 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2140 AC_DEFINE(C_THREADS)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002141 AC_DEFINE(MACH_C_THREADS, 1,
2142 [Define if you are using Mach cthreads under mach /])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002143 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002144 AC_MSG_CHECKING(for --with-pth)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002145 AC_ARG_WITH([pth],
2146 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
2147 [AC_MSG_RESULT($withval)
2148 AC_DEFINE([WITH_THREAD])
2149 AC_DEFINE([HAVE_PTH], 1,
2150 [Define if you have GNU PTH threads.])
2151 LIBS="-lpth $LIBS"
2152 THREADOBJ="Python/thread.o"],
2153 [AC_MSG_RESULT(no)
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002154
2155 # Just looking for pthread_create in libpthread is not enough:
2156 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2157 # So we really have to include pthread.h, and then link.
2158 _libs=$LIBS
2159 LIBS="$LIBS -lpthread"
2160 AC_MSG_CHECKING([for pthread_create in -lpthread])
2161 AC_TRY_LINK([#include <pthread.h>
2162
2163void * start_routine (void *arg) { exit (0); }], [
2164pthread_create (NULL, NULL, start_routine, NULL)], [
2165 AC_MSG_RESULT(yes)
2166 AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002167 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002168 THREADOBJ="Python/thread.o"],[
Martin v. Löwis8158b5a2001-10-08 13:17:28 +00002169 LIBS=$_libs
Martin v. Löwis130fb172001-07-19 11:00:41 +00002170 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002171 posix_threads=yes
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002172 THREADOBJ="Python/thread.o"],[
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002173 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2174 AC_DEFINE(ATHEOS_THREADS, 1,
2175 [Define this if you have AtheOS threads.])
2176 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002177 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002178 AC_DEFINE(BEOS_THREADS, 1,
2179 [Define this if you have BeOS threads.])
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002180 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002181 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002182 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002183 LIBS="$LIBS -lpthreads"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002184 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002185 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002186 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002187 LIBS="$LIBS -lc_r"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002188 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002189 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002190 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002191 LIBS="$LIBS -lpthread"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002192 THREADOBJ="Python/thread.o"], [
Martin v. Löwis130fb172001-07-19 11:00:41 +00002193 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002194 posix_threads=yes
Martin v. Löwis130fb172001-07-19 11:00:41 +00002195 LIBS="$LIBS -lcma"
Martin v. Löwis2d7e2642002-04-05 16:50:53 +00002196 THREADOBJ="Python/thread.o"],[
Martin v. Löwis130fb172001-07-19 11:00:41 +00002197 USE_THREAD_MODULE="#"])
Skip Montanarof8712e52004-01-17 03:04:46 +00002198 ])])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002199
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002200 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2201 LIBS="$LIBS -lmpc"
2202 THREADOBJ="Python/thread.o"
2203 USE_THREAD_MODULE=""])
2204
2205 if test "$posix_threads" != "yes"; then
2206 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2207 LIBS="$LIBS -lthread"
2208 THREADOBJ="Python/thread.o"
2209 USE_THREAD_MODULE=""])
2210 fi
2211
2212 if test "$USE_THREAD_MODULE" != "#"
2213 then
2214 # If the above checks didn't disable threads, (at least) OSF1
2215 # needs this '-threads' argument during linking.
2216 case $ac_sys_system in
2217 OSF1) LDLAST=-threads;;
2218 esac
2219 fi
2220fi
2221
2222if test "$posix_threads" = "yes"; then
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002223 if test "$unistd_defines_pthreads" = "no"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002224 AC_DEFINE(_POSIX_THREADS, 1,
2225 [Define if you have POSIX threads,
2226 and your system does not define that.])
Martin v. Löwis69c0ff32001-10-15 14:34:42 +00002227 fi
2228
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002229 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2230 case $ac_sys_system/$ac_sys_release in
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002231 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
2232 Defined for Solaris 2.6 bug in pthread header.)
2233 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002234 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002235 Define if the Posix semaphores do not work on your system)
2236 ;;
Christian Heimescba36bb2008-01-30 22:54:18 +00002237 AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2238 Define if the Posix semaphores do not work on your system)
2239 ;;
Martin v. Löwisdfc33fd2003-01-21 10:14:41 +00002240 esac
2241
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002242 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2243 AC_CACHE_VAL(ac_cv_pthread_system_supported,
2244 [AC_TRY_RUN([#include <pthread.h>
2245 void *foo(void *parm) {
2246 return NULL;
2247 }
2248 main() {
2249 pthread_attr_t attr;
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002250 pthread_t id;
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002251 if (pthread_attr_init(&attr)) exit(-1);
2252 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
Martin v. Löwisa82d3472002-02-24 16:05:05 +00002253 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002254 exit(0);
Guido van Rossum3065c942001-09-17 04:03:14 +00002255 }],
2256 ac_cv_pthread_system_supported=yes,
2257 ac_cv_pthread_system_supported=no,
2258 ac_cv_pthread_system_supported=no)
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002259 ])
2260 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2261 if test "$ac_cv_pthread_system_supported" = "yes"; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002262 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
Guido van Rossumd0b69ec2001-09-10 14:10:54 +00002263 fi
Jason Tishlerfac083d2003-07-22 15:20:49 +00002264 AC_CHECK_FUNCS(pthread_sigmask,
2265 [case $ac_sys_system in
2266 CYGWIN*)
2267 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2268 [Define if pthread_sigmask() does not work on your system.])
2269 ;;
2270 esac])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00002271fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002272
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002273
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002274# Check for enable-ipv6
Martin v. Löwis11437992002-04-12 09:54:03 +00002275AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002276AC_MSG_CHECKING([if --enable-ipv6 is specified])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002277AC_ARG_ENABLE(ipv6,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002278[ --enable-ipv6 Enable ipv6 (with ipv4) support
2279 --disable-ipv6 Disable ipv6 support],
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002280[ case "$enableval" in
2281 no)
2282 AC_MSG_RESULT(no)
2283 ipv6=no
2284 ;;
2285 *) AC_MSG_RESULT(yes)
2286 AC_DEFINE(ENABLE_IPV6)
2287 ipv6=yes
2288 ;;
2289 esac ],
2290
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002291[
2292dnl the check does not work on cross compilation case...
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002293 AC_TRY_RUN([ /* AF_INET6 available check */
2294#include <sys/types.h>
2295#include <sys/socket.h>
2296main()
2297{
2298 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
2299 exit(1);
2300 else
2301 exit(0);
2302}
2303],
2304 AC_MSG_RESULT(yes)
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002305 ipv6=yes,
2306 AC_MSG_RESULT(no)
2307 ipv6=no,
2308 AC_MSG_RESULT(no)
2309 ipv6=no
Martin v. Löwisa5f8bb52001-09-05 08:22:34 +00002310)
2311
2312if test "$ipv6" = "yes"; then
2313 AC_MSG_CHECKING(if RFC2553 API is available)
2314 AC_TRY_COMPILE([#include <sys/types.h>
2315#include <netinet/in.h>],
2316 [struct sockaddr_in6 x;
2317x.sin6_scope_id;],
2318 AC_MSG_RESULT(yes)
2319 ipv6=yes,
2320 AC_MSG_RESULT(no, IPv6 disabled)
2321 ipv6=no)
2322fi
2323
2324if test "$ipv6" = "yes"; then
2325 AC_DEFINE(ENABLE_IPV6)
2326fi
2327])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002328
2329ipv6type=unknown
2330ipv6lib=none
2331ipv6trylibc=no
2332
2333if test "$ipv6" = "yes"; then
2334 AC_MSG_CHECKING([ipv6 stack type])
Guido van Rossumb8552162001-09-05 14:58:11 +00002335 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2336 do
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002337 case $i in
2338 inria)
2339 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002340 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002341#include <netinet/in.h>
2342#ifdef IPV6_INRIA_VERSION
2343yes
2344#endif],
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002345 [ipv6type=$i])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002346 ;;
2347 kame)
2348 dnl http://www.kame.net/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002349 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002350#include <netinet/in.h>
2351#ifdef __KAME__
2352yes
2353#endif],
2354 [ipv6type=$i;
2355 ipv6lib=inet6
2356 ipv6libdir=/usr/local/v6/lib
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002357 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002358 ;;
2359 linux-glibc)
2360 dnl http://www.v6.linux.or.jp/
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002361 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002362#include <features.h>
2363#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2364yes
2365#endif],
2366 [ipv6type=$i;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002367 ipv6trylibc=yes])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002368 ;;
2369 linux-inet6)
2370 dnl http://www.v6.linux.or.jp/
2371 if test -d /usr/inet6; then
2372 ipv6type=$i
2373 ipv6lib=inet6
2374 ipv6libdir=/usr/inet6/lib
Skip Montanarodecc6a42003-01-01 20:07:49 +00002375 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002376 fi
2377 ;;
2378 solaris)
2379 if test -f /etc/netconfig; then
2380 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
2381 ipv6type=$i
2382 ipv6trylibc=yes
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002383 fi
2384 fi
2385 ;;
2386 toshiba)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002387 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002388#include <sys/param.h>
2389#ifdef _TOSHIBA_INET6
2390yes
2391#endif],
2392 [ipv6type=$i;
2393 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002394 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002395 ;;
2396 v6d)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002397 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002398#include </usr/local/v6/include/sys/v6config.h>
2399#ifdef __V6D__
2400yes
2401#endif],
2402 [ipv6type=$i;
2403 ipv6lib=v6;
2404 ipv6libdir=/usr/local/v6/lib;
Skip Montanarodecc6a42003-01-01 20:07:49 +00002405 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002406 ;;
2407 zeta)
Martin v. Löwisa5f73f92001-10-15 08:06:29 +00002408 AC_EGREP_CPP(yes, [
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002409#include <sys/param.h>
2410#ifdef _ZETA_MINAMI_INET6
2411yes
2412#endif],
2413 [ipv6type=$i;
2414 ipv6lib=inet6;
Martin v. Löwis44ddbde2001-12-02 10:15:37 +00002415 ipv6libdir=/usr/local/v6/lib])
Martin v. Löwisa2ac6022001-08-09 11:40:14 +00002416 ;;
2417 esac
2418 if test "$ipv6type" != "unknown"; then
2419 break
2420 fi
2421 done
2422 AC_MSG_RESULT($ipv6type)
2423fi
2424
2425if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2426 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2427 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2428 echo "using lib$ipv6lib"
2429 else
2430 if test $ipv6trylibc = "yes"; then
2431 echo "using libc"
2432 else
2433 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2434 echo "You need to fetch lib$ipv6lib.a from appropriate"
2435 echo 'ipv6 kit and compile beforehand.'
2436 exit 1
2437 fi
2438 fi
2439fi
2440
Ronald Oussoren0d236eb2008-06-06 21:31:33 +00002441AC_MSG_CHECKING(for OSX 10.5 SDK or later)
2442AC_TRY_COMPILE([#include <Carbon/Carbon.h>], FSIORefNum fRef = 0,
2443 AC_DEFINE(HAVE_OSX105_SDK, 1, Define if compiling using MacOS X 10.5 SDK or later.)
2444 AC_MSG_RESULT(yes),
2445 AC_MSG_RESULT(no)
2446)
2447
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002448# Check for --with-doc-strings
2449AC_MSG_CHECKING(for --with-doc-strings)
2450AC_ARG_WITH(doc-strings,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002451 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
Martin v. Löwisa3fb4f72002-06-09 13:33:54 +00002452
2453if test -z "$with_doc_strings"
2454then with_doc_strings="yes"
2455fi
2456if test "$with_doc_strings" != "no"
2457then
2458 AC_DEFINE(WITH_DOC_STRINGS, 1,
2459 [Define if you want documentation strings in extension modules])
2460fi
2461AC_MSG_RESULT($with_doc_strings)
2462
Neil Schemenauera35c6882001-02-27 04:45:05 +00002463# Check for Python-specific malloc support
Martin v. Löwisf30d60e2004-06-08 08:17:44 +00002464AC_MSG_CHECKING(for --with-tsc)
2465AC_ARG_WITH(tsc,
2466[ --with(out)-tsc enable/disable timestamp counter profile], [
2467if test "$withval" != no
2468then
2469 AC_DEFINE(WITH_TSC, 1,
2470 [Define to profile with the Pentium timestamp counter])
2471 AC_MSG_RESULT(yes)
2472else AC_MSG_RESULT(no)
2473fi],
2474[AC_MSG_RESULT(no)])
2475
2476# Check for Python-specific malloc support
Neil Schemenauera35c6882001-02-27 04:45:05 +00002477AC_MSG_CHECKING(for --with-pymalloc)
2478AC_ARG_WITH(pymalloc,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002479 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
Neil Schemenauer16c22972002-03-22 15:34:49 +00002480
2481if test -z "$with_pymalloc"
2482then with_pymalloc="yes"
2483fi
2484if test "$with_pymalloc" != "no"
2485then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002486 AC_DEFINE(WITH_PYMALLOC, 1,
2487 [Define if you want to compile in Python-specific mallocs])
Neil Schemenauer16c22972002-03-22 15:34:49 +00002488fi
2489AC_MSG_RESULT($with_pymalloc)
Neil Schemenauera35c6882001-02-27 04:45:05 +00002490
Barry Warsawef82cd72000-06-30 16:21:01 +00002491# Check for --with-wctype-functions
2492AC_MSG_CHECKING(for --with-wctype-functions)
2493AC_ARG_WITH(wctype-functions,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00002494 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
2495[
Barry Warsawef82cd72000-06-30 16:21:01 +00002496if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002497then
2498 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2499 [Define if you want wctype.h functions to be used instead of the
2500 one supplied by Python itself. (see Include/unicodectype.h).])
2501 AC_MSG_RESULT(yes)
Barry Warsawef82cd72000-06-30 16:21:01 +00002502else AC_MSG_RESULT(no)
2503fi],
2504[AC_MSG_RESULT(no)])
2505
Guido van Rossum68242b51996-05-28 22:53:03 +00002506# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002507AC_SUBST(DLINCLDIR)
Guido van Rossum98935bf2001-09-05 19:13:16 +00002508DLINCLDIR=.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002509
Guido van Rossume97ee181999-12-20 21:27:22 +00002510# the dlopen() function means we might want to use dynload_shlib.o. some
2511# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00002512AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00002513
2514# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2515# loading of modules.
2516AC_SUBST(DYNLOADFILE)
2517AC_MSG_CHECKING(DYNLOADFILE)
2518if test -z "$DYNLOADFILE"
2519then
2520 case $ac_sys_system/$ac_sys_release in
Martin v. Löwisc19c5a62003-11-18 20:00:44 +00002521 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2522 if test "$ac_cv_func_dlopen" = yes
2523 then DYNLOADFILE="dynload_shlib.o"
2524 else DYNLOADFILE="dynload_aix.o"
2525 fi
2526 ;;
Guido van Rossume97ee181999-12-20 21:27:22 +00002527 BeOS*) DYNLOADFILE="dynload_beos.o";;
2528 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Anthony Baxter82201742006-04-09 15:07:40 +00002529 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2530 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
Martin v. Löwisf90ae202002-06-11 06:22:31 +00002531 atheos*) DYNLOADFILE="dynload_atheos.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00002532 *)
2533 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2534 # out any dynamic loading
2535 if test "$ac_cv_func_dlopen" = yes
2536 then DYNLOADFILE="dynload_shlib.o"
2537 else DYNLOADFILE="dynload_stub.o"
2538 fi
2539 ;;
2540 esac
2541fi
2542AC_MSG_RESULT($DYNLOADFILE)
2543if test "$DYNLOADFILE" != "dynload_stub.o"
2544then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002545 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2546 [Defined when any dynamic module loading is enabled.])
Guido van Rossume97ee181999-12-20 21:27:22 +00002547fi
2548
Jack Jansenc49e5b72001-06-19 15:00:23 +00002549# MACHDEP_OBJS can be set to platform-specific object files needed by Python
2550
2551AC_SUBST(MACHDEP_OBJS)
2552AC_MSG_CHECKING(MACHDEP_OBJS)
2553if test -z "$MACHDEP_OBJS"
2554then
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002555 MACHDEP_OBJS=$extra_machdep_objs
2556else
2557 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
Jack Jansenc49e5b72001-06-19 15:00:23 +00002558fi
Jack Jansenb6e9cad2001-08-15 01:26:28 +00002559AC_MSG_RESULT(MACHDEP_OBJS)
Jack Jansenc49e5b72001-06-19 15:00:23 +00002560
Guido van Rossum627b2d71993-12-24 10:39:16 +00002561# checks for library functions
Martin v. Löwisaef18b12008-03-24 13:31:16 +00002562AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2563 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
Martin v. Löwis438b5342002-12-27 10:16:42 +00002564 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
Martin v. Löwisc3001752005-01-23 09:27:24 +00002565 getpriority getpwent getspnam getspent getsid getwd \
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002566 kill killpg lchmod lchown lstat mkfifo mknod mktime \
Martin v. Löwisa5f09072002-10-11 05:37:59 +00002567 mremap nice pathconf pause plock poll pthread_init \
Guido van Rossum162e38c2003-02-19 15:25:10 +00002568 putenv readlink realpath \
Martin v. Löwisd5843682002-11-21 20:41:28 +00002569 select setegid seteuid setgid \
Martin v. Löwis4daacb12003-03-28 18:37:01 +00002570 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
Skip Montanaro7e11a012004-02-07 12:55:46 +00002571 sigaction siginterrupt sigrelse strftime \
Michael W. Hudson34f20ea2002-05-27 15:08:24 +00002572 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Neal Norwitz05a45592006-03-20 06:30:08 +00002573 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00002574
Martin v. Löwisc8ad7cc2002-11-11 13:23:45 +00002575# For some functions, having a definition is not sufficient, since
2576# we want to take their address.
2577AC_MSG_CHECKING(for chroot)
2578AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2579 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2580 AC_MSG_RESULT(yes),
2581 AC_MSG_RESULT(no)
2582)
2583AC_MSG_CHECKING(for link)
2584AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2585 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2586 AC_MSG_RESULT(yes),
2587 AC_MSG_RESULT(no)
2588)
2589AC_MSG_CHECKING(for symlink)
2590AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2591 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2592 AC_MSG_RESULT(yes),
2593 AC_MSG_RESULT(no)
2594)
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002595AC_MSG_CHECKING(for fchdir)
2596AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2597 AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2598 AC_MSG_RESULT(yes),
2599 AC_MSG_RESULT(no)
2600)
2601AC_MSG_CHECKING(for fsync)
2602AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
Skip Montanarod4fa8072003-09-25 14:49:15 +00002603 AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
Martin v. Löwisa64988c2003-09-20 15:30:20 +00002604 AC_MSG_RESULT(yes),
2605 AC_MSG_RESULT(no)
2606)
2607AC_MSG_CHECKING(for fdatasync)
2608AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2609 AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2610 AC_MSG_RESULT(yes),
2611 AC_MSG_RESULT(no)
2612)
Christian Heimes0e9ab5f2008-03-21 23:49:44 +00002613AC_MSG_CHECKING(for epoll)
2614AC_TRY_COMPILE([#include <sys/epoll.h>], void *x=epoll_create,
2615 AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2616 AC_MSG_RESULT(yes),
2617 AC_MSG_RESULT(no)
2618)
2619AC_MSG_CHECKING(for kqueue)
2620AC_TRY_COMPILE([
2621#include <sys/types.h>
2622#include <sys/event.h>
2623 ], int x=kqueue(),
2624 AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2625 AC_MSG_RESULT(yes),
2626 AC_MSG_RESULT(no)
2627)
Martin v. Löwisd5843682002-11-21 20:41:28 +00002628# On some systems (eg. FreeBSD 5), we would find a definition of the
2629# functions ctermid_r, setgroups in the library, but no prototype
2630# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2631# address to avoid compiler warnings and potential miscompilations
2632# because of the missing prototypes.
2633
2634AC_MSG_CHECKING(for ctermid_r)
2635AC_TRY_COMPILE([
2636#include "confdefs.h"
2637#include <stdio.h>
2638], void* p = ctermid_r,
2639 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2640 AC_MSG_RESULT(yes),
2641 AC_MSG_RESULT(no)
2642)
2643
Martin v. Löwisf26d63b2003-03-30 17:23:49 +00002644AC_MSG_CHECKING(for flock)
2645AC_TRY_COMPILE([
2646#include "confdefs.h"
2647#include <sys/file.h>
2648], void* p = flock,
2649 AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2650 AC_MSG_RESULT(yes),
2651 AC_MSG_RESULT(no)
2652)
2653
2654AC_MSG_CHECKING(for getpagesize)
2655AC_TRY_COMPILE([
2656#include "confdefs.h"
2657#include <unistd.h>
2658], void* p = getpagesize,
2659 AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2660 AC_MSG_RESULT(yes),
2661 AC_MSG_RESULT(no)
2662)
2663
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002664dnl check for true
2665AC_CHECK_PROGS(TRUE, true, /bin/true)
2666
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002667dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2668dnl On others, they are in the C library, so we to take no action
Martin v. Löwis4ee6eef2003-05-26 05:37:51 +00002669AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002670 AC_CHECK_LIB(resolv, inet_aton)
2671)
2672
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002673# On Tru64, chflags seems to be present, but calling it will
2674# exit Python
Benjamin Petersonb453f0b2010-01-30 19:51:50 +00002675AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
2676AC_TRY_RUN([[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002677#include <sys/stat.h>
2678#include <unistd.h>
2679int main(int argc, char*argv[])
2680{
2681 if(chflags(argv[0], 0) != 0)
2682 return 1;
2683 return 0;
2684}
Benjamin Petersonb453f0b2010-01-30 19:51:50 +00002685]], ac_cv_have_chflags=yes,
2686 ac_cv_have_chflags=no,
2687 ac_cv_have_chflags=cross)
2688])
2689if test "$ac_cv_have_chflags" = cross ; then
2690 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
2691fi
2692if test "$ac_cv_have_chflags" = yes ; then
2693 AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
2694fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002695
Benjamin Petersonb453f0b2010-01-30 19:51:50 +00002696AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
2697AC_TRY_RUN([[
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002698#include <sys/stat.h>
2699#include <unistd.h>
2700int main(int argc, char*argv[])
2701{
2702 if(lchflags(argv[0], 0) != 0)
2703 return 1;
2704 return 0;
2705}
Benjamin Petersonb453f0b2010-01-30 19:51:50 +00002706]], ac_cv_have_lchflags=yes,
2707 ac_cv_have_lchflags=no,
2708 ac_cv_have_lchflags=cross)
2709])
2710if test "$ac_cv_have_lchflags" = cross ; then
2711 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
2712fi
2713if test "$ac_cv_have_lchflags" = yes ; then
2714 AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
2715fi
Martin v. Löwisa51d5c82007-12-04 08:37:59 +00002716
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00002717dnl Check if system zlib has *Copy() functions
Ronald Oussorenf8752642006-07-06 10:13:35 +00002718dnl
2719dnl On MacOSX the linker will search for dylibs on the entire linker path
2720dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
2721dnl to revert to a more traditional unix behaviour and make it possible to
2722dnl override the system libz with a local static library of libz. Temporarily
2723dnl add that flag to our CFLAGS as well to ensure that we check the version
2724dnl of libz that will be used by setup.py.
2725dnl The -L/usr/local/lib is needed as wel to get the same compilation
2726dnl environment as setup.py (and leaving it out can cause configure to use the
2727dnl wrong version of the library)
2728case $ac_sys_system/$ac_sys_release in
2729Darwin/*)
2730 _CUR_CFLAGS="${CFLAGS}"
2731 _CUR_LDFLAGS="${LDFLAGS}"
2732 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
2733 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
2734 ;;
2735esac
2736
Neal Norwitz6e73aaa2006-06-12 03:33:09 +00002737AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, Define if the zlib library has inflateCopy))
2738
Ronald Oussorenf8752642006-07-06 10:13:35 +00002739case $ac_sys_system/$ac_sys_release in
2740Darwin/*)
2741 CFLAGS="${_CUR_CFLAGS}"
2742 LDFLAGS="${_CUR_LDFLAGS}"
2743 ;;
2744esac
2745
Martin v. Löwise9416172003-05-03 10:12:45 +00002746AC_MSG_CHECKING(for hstrerror)
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002747AC_TRY_LINK([
Martin v. Löwise9416172003-05-03 10:12:45 +00002748#include "confdefs.h"
2749#include <netdb.h>
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002750], void* p = hstrerror; hstrerror(0),
Martin v. Löwise9416172003-05-03 10:12:45 +00002751 AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2752 AC_MSG_RESULT(yes),
2753 AC_MSG_RESULT(no)
2754)
2755
2756AC_MSG_CHECKING(for inet_aton)
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002757AC_TRY_LINK([
Martin v. Löwise9416172003-05-03 10:12:45 +00002758#include "confdefs.h"
Martin v. Löwis86d66262006-02-17 08:40:11 +00002759#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00002760#include <sys/socket.h>
2761#include <netinet/in.h>
2762#include <arpa/inet.h>
Martin v. Löwis95c419b2003-05-03 12:10:48 +00002763], void* p = inet_aton;inet_aton(0,0),
Martin v. Löwise9416172003-05-03 10:12:45 +00002764 AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2765 AC_MSG_RESULT(yes),
2766 AC_MSG_RESULT(no)
2767)
2768
2769AC_MSG_CHECKING(for inet_pton)
2770AC_TRY_COMPILE([
2771#include "confdefs.h"
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00002772#include <sys/types.h>
Martin v. Löwise9416172003-05-03 10:12:45 +00002773#include <sys/socket.h>
2774#include <netinet/in.h>
2775#include <arpa/inet.h>
2776], void* p = inet_pton,
2777 AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2778 AC_MSG_RESULT(yes),
2779 AC_MSG_RESULT(no)
2780)
2781
Martin v. Löwisd6640d42003-07-06 09:29:52 +00002782# On some systems, setgroups is in unistd.h, on others, in grp.h
Martin v. Löwisd5843682002-11-21 20:41:28 +00002783AC_MSG_CHECKING(for setgroups)
2784AC_TRY_COMPILE([
2785#include "confdefs.h"
Martin v. Löwisf2e488d2003-05-05 22:00:11 +00002786#include <unistd.h>
Martin v. Löwisd6640d42003-07-06 09:29:52 +00002787#ifdef HAVE_GRP_H
2788#include <grp.h>
2789#endif
Martin v. Löwisd5843682002-11-21 20:41:28 +00002790],
2791void* p = setgroups,
2792 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2793 AC_MSG_RESULT(yes),
2794 AC_MSG_RESULT(no)
2795)
2796
Fred Drake8cef4cf2000-06-28 16:40:38 +00002797# check for openpty and forkpty
2798
Martin v. Löwisfd9a72a2006-01-08 10:07:33 +00002799AC_CHECK_FUNCS(openpty,,
2800 AC_CHECK_LIB(util,openpty,
2801 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2802 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2803 )
2804)
2805AC_CHECK_FUNCS(forkpty,,
2806 AC_CHECK_LIB(util,forkpty,
2807 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2808 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2809 )
2810)
Fred Drake8cef4cf2000-06-28 16:40:38 +00002811
Brett Cannonaa5778d2008-03-18 04:09:00 +00002812# Stuff for expat.
2813AC_CHECK_FUNCS(memmove)
2814
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00002815# check for long file support functions
2816AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2817
Brett Cannonaa5778d2008-03-18 04:09:00 +00002818AC_REPLACE_FUNCS(dup2 getcwd strdup)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002819AC_CHECK_FUNCS(getpgrp,
2820 AC_TRY_COMPILE([#include <unistd.h>],
2821 [getpgrp(0);],
2822 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2823 [Define if getpgrp() must be called as getpgrp(0).])
2824 )
2825)
Jack Jansen150753c2003-03-29 22:07:47 +00002826AC_CHECK_FUNCS(setpgrp,
2827 AC_TRY_COMPILE([#include <unistd.h>],
2828 [setpgrp(0,0);],
2829 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2830 [Define if setpgrp() must be called as setpgrp(0, 0).])
2831 )
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002832)
2833AC_CHECK_FUNCS(gettimeofday,
2834 AC_TRY_COMPILE([#include <sys/time.h>],
2835 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2836 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2837 [Define if gettimeofday() does not have second (timezone) argument
2838 This is the case on Motorola V4 (R40V4.2)])
2839 )
2840)
Guido van Rossum627b2d71993-12-24 10:39:16 +00002841
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002842AC_MSG_CHECKING(for major, minor, and makedev)
Martin v. Löwise3271202002-11-07 07:42:30 +00002843AC_TRY_LINK([
Neal Norwitz6eb37f02003-02-23 23:28:15 +00002844#if defined(MAJOR_IN_MKDEV)
2845#include <sys/mkdev.h>
2846#elif defined(MAJOR_IN_SYSMACROS)
2847#include <sys/sysmacros.h>
2848#else
2849#include <sys/types.h>
2850#endif
Martin v. Löwisdbe3f762002-10-10 14:27:30 +00002851],[
2852 makedev(major(0),minor(0));
2853],[
2854 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2855 [Define to 1 if you have the device macros.])
2856 AC_MSG_RESULT(yes)
2857],[
2858 AC_MSG_RESULT(no)
2859])
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002860
2861# On OSF/1 V5.1, getaddrinfo is available, but a define
2862# for [no]getaddrinfo in netdb.h.
2863AC_MSG_CHECKING(for getaddrinfo)
2864AC_TRY_LINK([
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00002865#include <sys/types.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002866#include <sys/socket.h>
2867#include <netdb.h>
Martin v. Löwisc010b6d2001-11-09 17:50:52 +00002868#include <stdio.h>
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002869],[
2870getaddrinfo(NULL, NULL, NULL, NULL);
2871], [
2872AC_MSG_RESULT(yes)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002873AC_MSG_CHECKING(getaddrinfo bug)
2874AC_TRY_RUN([
2875#include <sys/types.h>
2876#include <netdb.h>
2877#include <string.h>
2878#include <sys/socket.h>
2879#include <netinet/in.h>
2880
2881main()
2882{
2883 int passive, gaierr, inet4 = 0, inet6 = 0;
2884 struct addrinfo hints, *ai, *aitop;
2885 char straddr[INET6_ADDRSTRLEN], strport[16];
2886
2887 for (passive = 0; passive <= 1; passive++) {
2888 memset(&hints, 0, sizeof(hints));
2889 hints.ai_family = AF_UNSPEC;
2890 hints.ai_flags = passive ? AI_PASSIVE : 0;
2891 hints.ai_socktype = SOCK_STREAM;
Hye-Shik Chang54f94392004-04-14 07:55:31 +00002892 hints.ai_protocol = IPPROTO_TCP;
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002893 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2894 (void)gai_strerror(gaierr);
2895 goto bad;
2896 }
2897 for (ai = aitop; ai; ai = ai->ai_next) {
2898 if (ai->ai_addr == NULL ||
2899 ai->ai_addrlen == 0 ||
2900 getnameinfo(ai->ai_addr, ai->ai_addrlen,
2901 straddr, sizeof(straddr), strport, sizeof(strport),
2902 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2903 goto bad;
2904 }
2905 switch (ai->ai_family) {
2906 case AF_INET:
2907 if (strcmp(strport, "54321") != 0) {
2908 goto bad;
2909 }
2910 if (passive) {
2911 if (strcmp(straddr, "0.0.0.0") != 0) {
2912 goto bad;
2913 }
2914 } else {
2915 if (strcmp(straddr, "127.0.0.1") != 0) {
2916 goto bad;
2917 }
2918 }
2919 inet4++;
2920 break;
2921 case AF_INET6:
2922 if (strcmp(strport, "54321") != 0) {
2923 goto bad;
2924 }
2925 if (passive) {
2926 if (strcmp(straddr, "::") != 0) {
2927 goto bad;
2928 }
2929 } else {
2930 if (strcmp(straddr, "::1") != 0) {
2931 goto bad;
2932 }
2933 }
2934 inet6++;
2935 break;
2936 case AF_UNSPEC:
2937 goto bad;
2938 break;
2939 default:
2940 /* another family support? */
2941 break;
2942 }
2943 }
2944 }
2945
2946 if (!(inet4 == 0 || inet4 == 2))
2947 goto bad;
2948 if (!(inet6 == 0 || inet6 == 2))
2949 goto bad;
2950
2951 if (aitop)
2952 freeaddrinfo(aitop);
2953 exit(0);
2954
2955 bad:
2956 if (aitop)
2957 freeaddrinfo(aitop);
2958 exit(1);
2959}
2960],
2961AC_MSG_RESULT(good)
2962buggygetaddrinfo=no,
2963AC_MSG_RESULT(buggy)
2964buggygetaddrinfo=yes,
2965AC_MSG_RESULT(buggy)
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002966buggygetaddrinfo=yes)], [
2967AC_MSG_RESULT(no)
2968buggygetaddrinfo=yes
2969])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002970
2971if test "$buggygetaddrinfo" = "yes"; then
2972 if test "$ipv6" = "yes"; then
2973 echo 'Fatal: You must get working getaddrinfo() function.'
2974 echo ' or you can specify "--disable-ipv6"'.
2975 exit 1
2976 fi
Martin v. Löwis861a65b2001-10-24 14:36:00 +00002977else
Martin v. Löwisc45929e2002-04-06 10:10:49 +00002978 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002979fi
Thomas Woutersb0db85a2001-08-08 10:39:03 +00002980AC_CHECK_FUNCS(getnameinfo)
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00002981
Guido van Rossum627b2d71993-12-24 10:39:16 +00002982# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002983AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00002984AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002985AC_STRUCT_TIMEZONE
Martin v. Löwis60a5d722002-10-16 20:28:25 +00002986AC_CHECK_MEMBERS([struct stat.st_rdev])
2987AC_CHECK_MEMBERS([struct stat.st_blksize])
Hye-Shik Chang5f937a72005-06-02 13:09:30 +00002988AC_CHECK_MEMBERS([struct stat.st_flags])
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00002989AC_CHECK_MEMBERS([struct stat.st_gen])
2990AC_CHECK_MEMBERS([struct stat.st_birthtime])
Guido van Rossum98bf58f2001-10-18 20:34:25 +00002991AC_STRUCT_ST_BLOCKS
Guido van Rossum76be6ed1995-01-02 18:33:54 +00002992
2993AC_MSG_CHECKING(for time.h that defines altzone)
2994AC_CACHE_VAL(ac_cv_header_time_altzone,
2995[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2996 ac_cv_header_time_altzone=yes,
2997 ac_cv_header_time_altzone=no)])
2998AC_MSG_RESULT($ac_cv_header_time_altzone)
2999if test $ac_cv_header_time_altzone = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003000 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003001fi
3002
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003003was_it_defined=no
3004AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003005AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003006#include <sys/types.h>
3007#include <sys/select.h>
3008#include <sys/time.h>
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003009], [;], [
3010 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
3011 [Define if you can safely include both <sys/select.h> and <sys/time.h>
3012 (which you can't on SCO ODT 3.0).])
3013 was_it_defined=yes
3014])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003015AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00003016
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003017AC_MSG_CHECKING(for addrinfo)
3018AC_CACHE_VAL(ac_cv_struct_addrinfo,
3019AC_TRY_COMPILE([
3020# include <netdb.h>],
3021 [struct addrinfo a],
3022 ac_cv_struct_addrinfo=yes,
3023 ac_cv_struct_addrinfo=no))
3024AC_MSG_RESULT($ac_cv_struct_addrinfo)
3025if test $ac_cv_struct_addrinfo = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003026 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003027fi
3028
3029AC_MSG_CHECKING(for sockaddr_storage)
3030AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
3031AC_TRY_COMPILE([
3032# include <sys/types.h>
3033# include <sys/socket.h>],
3034 [struct sockaddr_storage s],
3035 ac_cv_struct_sockaddr_storage=yes,
3036 ac_cv_struct_sockaddr_storage=no))
3037AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3038if test $ac_cv_struct_sockaddr_storage = yes; then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003039 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003040fi
3041
Guido van Rossum627b2d71993-12-24 10:39:16 +00003042# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003043
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003044AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003045AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003046
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003047works=no
3048AC_MSG_CHECKING(for working volatile)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003049AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
3050 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
3051)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003052AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00003053
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003054works=no
3055AC_MSG_CHECKING(for working signed char)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003056AC_TRY_COMPILE([], [signed char c;], works=yes,
3057 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
3058)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003059AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003060
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003061have_prototypes=no
3062AC_MSG_CHECKING(for prototypes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003063AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
3064 AC_DEFINE(HAVE_PROTOTYPES, 1,
3065 [Define if your compiler supports function prototype])
3066 have_prototypes=yes
3067])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003068AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003069
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003070works=no
3071AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003072AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003073#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00003074int foo(int x, ...) {
3075 va_list va;
3076 va_start(va, x);
3077 va_arg(va, int);
3078 va_arg(va, char *);
3079 va_arg(va, double);
3080 return 0;
3081}
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003082], [return foo(10, "", 3.14);], [
3083 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3084 [Define if your compiler supports variable length function prototypes
3085 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3086 works=yes
3087])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003088AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003089
Dave Cole331708b2004-08-09 04:51:41 +00003090# check for socketpair
3091AC_MSG_CHECKING(for socketpair)
3092AC_TRY_COMPILE([
3093#include <sys/types.h>
3094#include <sys/socket.h>
3095], void *x=socketpair,
3096 AC_DEFINE(HAVE_SOCKETPAIR, 1, Define if you have the 'socketpair' function.)
3097 AC_MSG_RESULT(yes),
3098 AC_MSG_RESULT(no)
3099)
3100
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003101# check if sockaddr has sa_len member
3102AC_MSG_CHECKING(if sockaddr has sa_len member)
3103AC_TRY_COMPILE([#include <sys/types.h>
3104#include <sys/socket.h>],
3105[struct sockaddr x;
3106x.sa_len = 0;],
3107 AC_MSG_RESULT(yes)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003108 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00003109 AC_MSG_RESULT(no))
3110
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003111va_list_is_array=no
3112AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003113AC_TRY_COMPILE([
3114#ifdef HAVE_STDARG_PROTOTYPES
3115#include <stdarg.h>
3116#else
3117#include <varargs.h>
3118#endif
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003119], [va_list list1, list2; list1 = list2;], , [
3120 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3121 va_list_is_array=yes
3122])
Guido van Rossum5739e7e1995-01-20 16:50:53 +00003123AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003124
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003125# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
Martin v. Löwis11437992002-04-12 09:54:03 +00003126AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3127 [Define this if you have some version of gethostbyname_r()])
3128
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003129AC_CHECK_FUNC(gethostbyname_r, [
3130 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3131 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3132 OLD_CFLAGS=$CFLAGS
3133 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
3134 AC_TRY_COMPILE([
3135# include <netdb.h>
3136 ], [
3137 char *name;
3138 struct hostent *he, *res;
3139 char buffer[2048];
3140 int buflen = 2048;
3141 int h_errnop;
3142
3143 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
3144 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003145 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003146 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3147 [Define this if you have the 6-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003148 AC_MSG_RESULT(yes)
3149 ], [
3150 AC_MSG_RESULT(no)
3151 AC_MSG_CHECKING([gethostbyname_r with 5 args])
3152 AC_TRY_COMPILE([
3153# include <netdb.h>
3154 ], [
3155 char *name;
3156 struct hostent *he;
3157 char buffer[2048];
3158 int buflen = 2048;
3159 int h_errnop;
3160
3161 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3162 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003163 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003164 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3165 [Define this if you have the 5-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003166 AC_MSG_RESULT(yes)
3167 ], [
3168 AC_MSG_RESULT(no)
3169 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3170 AC_TRY_COMPILE([
3171# include <netdb.h>
3172 ], [
3173 char *name;
3174 struct hostent *he;
3175 struct hostent_data data;
3176
3177 (void) gethostbyname_r(name, he, &data);
3178 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003179 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003180 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3181 [Define this if you have the 3-arg version of gethostbyname_r().])
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003182 AC_MSG_RESULT(yes)
3183 ], [
3184 AC_MSG_RESULT(no)
3185 ])
3186 ])
3187 ])
3188 CFLAGS=$OLD_CFLAGS
3189], [
Thomas Wouters3a584202000-08-05 23:28:51 +00003190 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003191])
3192AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3193AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3194AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00003195AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00003196AC_SUBST(HAVE_GETHOSTBYNAME)
3197
Guido van Rossum627b2d71993-12-24 10:39:16 +00003198# checks for system services
3199# (none yet)
3200
Guido van Rossum76be6ed1995-01-02 18:33:54 +00003201# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00003202AC_CHECK_FUNC(__fpu_control,
3203 [],
3204 [AC_CHECK_LIB(ieee, __fpu_control)
3205])
Guido van Rossum627b2d71993-12-24 10:39:16 +00003206
Guido van Rossum93274221997-05-09 02:42:00 +00003207# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00003208AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00003209AC_ARG_WITH(fpectl,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003210 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
3211[
Guido van Rossum93274221997-05-09 02:42:00 +00003212if test "$withval" != no
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003213then
3214 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3215 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3216 AC_MSG_RESULT(yes)
Guido van Rossum93274221997-05-09 02:42:00 +00003217else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00003218fi],
3219[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00003220
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003221# check for --with-libm=...
3222AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003223case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00003224Darwin) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00003225BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00003226*) LIBM=-lm
3227esac
Guido van Rossum93274221997-05-09 02:42:00 +00003228AC_MSG_CHECKING(for --with-libm=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003229AC_ARG_WITH(libm,
3230 AC_HELP_STRING(--with-libm=STRING, math library),
3231[
Guido van Rossum93274221997-05-09 02:42:00 +00003232if test "$withval" = no
3233then LIBM=
3234 AC_MSG_RESULT(force LIBM empty)
3235elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003236then LIBM=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003237 AC_MSG_RESULT(set LIBM="$withval")
3238else AC_MSG_ERROR([proper usage is --with-libm=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003239fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003240[AC_MSG_RESULT(default LIBM="$LIBM")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003241
3242# check for --with-libc=...
3243AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00003244AC_MSG_CHECKING(for --with-libc=STRING)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003245AC_ARG_WITH(libc,
3246 AC_HELP_STRING(--with-libc=STRING, C library),
3247[
Guido van Rossum93274221997-05-09 02:42:00 +00003248if test "$withval" = no
3249then LIBC=
3250 AC_MSG_RESULT(force LIBC empty)
3251elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003252then LIBC=$withval
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003253 AC_MSG_RESULT(set LIBC="$withval")
3254else AC_MSG_ERROR([proper usage is --with-libc=STRING])
Guido van Rossum93274221997-05-09 02:42:00 +00003255fi],
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003256[AC_MSG_RESULT(default LIBC="$LIBC")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00003257
Christian Heimes0a8143f2007-12-18 23:22:54 +00003258# ************************************
3259# * Check for mathematical functions *
3260# ************************************
Mark Dickinson265d7382008-04-21 22:32:24 +00003261
Mark Dickinson7a3d8642008-04-22 00:54:27 +00003262LIBS_SAVE=$LIBS
3263LIBS="$LIBS $LIBM"
3264
Mark Dickinsone05e8402009-05-04 13:30:43 +00003265# Detect whether system arithmetic is subject to x87-style double
3266# rounding issues. The result of this test has little meaning on non
3267# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3268# mode is round-to-nearest and double rounding issues are present, and
3269# 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3270AC_MSG_CHECKING(for x87-style double rounding)
3271AC_CACHE_VAL(ac_cv_x87_double_rounding, [
3272AC_TRY_RUN([
3273#include <stdlib.h>
3274#include <math.h>
3275int main() {
3276 volatile double x, y, z;
3277 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3278 x = 0.99999999999999989; /* 1-2**-53 */
3279 y = 1./x;
3280 if (y != 1.)
3281 exit(0);
3282 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3283 x = 1e16;
3284 y = 2.99999;
3285 z = x + y;
3286 if (z != 1e16+4.)
3287 exit(0);
3288 /* both tests show evidence of double rounding */
3289 exit(1);
3290}
3291],
3292ac_cv_x87_double_rounding=no,
3293ac_cv_x87_double_rounding=yes,
3294ac_cv_x87_double_rounding=no)])
3295AC_MSG_RESULT($ac_cv_x87_double_rounding)
3296if test "$ac_cv_x87_double_rounding" = yes
3297then
3298 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3299 [Define if arithmetic is subject to x87-style double rounding issue])
3300fi
3301
3302
Mark Dickinson265d7382008-04-21 22:32:24 +00003303# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3304# -0. on some architectures.
3305AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3306AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
3307AC_TRY_RUN([
3308#include <math.h>
Mark Dickinson7a3d8642008-04-22 00:54:27 +00003309#include <stdlib.h>
Mark Dickinson265d7382008-04-21 22:32:24 +00003310int main() {
3311 /* return 0 if either negative zeros don't exist
3312 on this platform or if negative zeros exist
3313 and tanh(-0.) == -0. */
3314 if (atan2(0., -1.) == atan2(-0., -1.) ||
3315 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3316 else exit(1);
3317}
3318],
3319ac_cv_tanh_preserves_zero_sign=yes,
3320ac_cv_tanh_preserves_zero_sign=no,
3321ac_cv_tanh_preserves_zero_sign=no)])
3322AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3323if test "$ac_cv_tanh_preserves_zero_sign" = yes
3324then
3325 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3326 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3327fi
3328
Mark Dickinsone05e8402009-05-04 13:30:43 +00003329AC_CHECK_FUNCS([acosh asinh atanh copysign expm1 finite hypot log1p])
3330AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
Christian Heimes0a8143f2007-12-18 23:22:54 +00003331
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00003332LIBS=$LIBS_SAVE
3333
Guido van Rossumef2255b2000-03-10 22:30:29 +00003334# check for wchar.h
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003335AC_CHECK_HEADER(wchar.h, [
3336 AC_DEFINE(HAVE_WCHAR_H, 1,
3337 [Define if the compiler provides a wchar.h header file.])
3338 wchar_h="yes"
3339],
Guido van Rossumef2255b2000-03-10 22:30:29 +00003340wchar_h="no"
3341)
3342
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003343# determine wchar_t size
3344if test "$wchar_h" = yes
3345then
Guido van Rossum67b26592001-10-20 14:21:45 +00003346 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003347fi
3348
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003349AC_MSG_CHECKING(for UCS-4 tcl)
3350have_ucs4_tcl=no
3351AC_TRY_COMPILE([
3352#include <tcl.h>
3353#if TCL_UTF_MAX != 6
3354# error "NOT UCS4_TCL"
3355#endif], [], [
3356 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3357 have_ucs4_tcl=yes
3358])
3359AC_MSG_RESULT($have_ucs4_tcl)
3360
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003361# check whether wchar_t is signed or not
3362if test "$wchar_h" = yes
3363then
3364 # check whether wchar_t is signed or not
3365 AC_MSG_CHECKING(whether wchar_t is signed)
3366 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
3367 AC_TRY_RUN([
3368 #include <wchar.h>
3369 int main()
3370 {
Martin v. Löwis44fe0e42006-04-11 07:15:30 +00003371 /* Success: exit code 0 */
3372 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003373 }
3374 ],
3375 ac_cv_wchar_t_signed=yes,
3376 ac_cv_wchar_t_signed=no,
3377 ac_cv_wchar_t_signed=yes)])
3378 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3379fi
3380
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003381AC_MSG_CHECKING(what type to use for unicode)
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003382dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003383AC_ARG_ENABLE(unicode,
Martin v. Löwis3e2c6322002-10-29 10:07:43 +00003384 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
3385 [],
3386 [enable_unicode=yes])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003387
3388if test $enable_unicode = yes
3389then
Martin v. Löwisfd917792001-06-27 20:22:04 +00003390 # Without any arguments, Py_UNICODE defaults to two-byte mode
Martin v. Löwisfa3bdea2003-09-04 18:50:54 +00003391 case "$have_ucs4_tcl" in
3392 yes) enable_unicode="ucs4"
3393 ;;
3394 *) enable_unicode="ucs2"
3395 ;;
3396 esac
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003397fi
3398
Martin v. Löwis0036cba2002-04-12 09:58:45 +00003399AH_TEMPLATE(Py_UNICODE_SIZE,
3400 [Define as the size of the unicode type.])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003401case "$enable_unicode" in
3402ucs2) unicode_size="2"
3403 AC_DEFINE(Py_UNICODE_SIZE,2)
3404 ;;
3405ucs4) unicode_size="4"
3406 AC_DEFINE(Py_UNICODE_SIZE,4)
3407 ;;
3408esac
3409
Martin v. Löwis11437992002-04-12 09:54:03 +00003410AH_TEMPLATE(PY_UNICODE_TYPE,
3411 [Define as the integral type used for Unicode representation.])
Martin v. Löwis0036cba2002-04-12 09:58:45 +00003412
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003413AC_SUBST(UNICODE_OBJS)
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003414if test "$enable_unicode" = "no"
3415then
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003416 UNICODE_OBJS=""
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003417 AC_MSG_RESULT(not used)
3418else
Martin v. Löwis339d0f72001-08-17 18:39:25 +00003419 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003420 AC_DEFINE(Py_USING_UNICODE, 1,
3421 [Define if you want to have a Unicode type.])
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003422
3423 # wchar_t is only usable if it maps to an unsigned type
3424 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
Matthias Klose7dbeed72004-12-24 08:22:17 +00003425 -a "$ac_cv_wchar_t_signed" = "no"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003426 then
3427 PY_UNICODE_TYPE="wchar_t"
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003428 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3429 [Define if you have a useable wchar_t type defined in wchar.h; useable
Marc-André Lemburgd7160f82003-09-22 11:14:40 +00003430 means wchar_t must be an unsigned type with at least 16 bits. (see
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003431 Include/unicodeobject.h).])
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00003432 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3433 elif test "$ac_cv_sizeof_short" = "$unicode_size"
3434 then
3435 PY_UNICODE_TYPE="unsigned short"
3436 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3437 elif test "$ac_cv_sizeof_long" = "$unicode_size"
3438 then
3439 PY_UNICODE_TYPE="unsigned long"
3440 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3441 else
3442 PY_UNICODE_TYPE="no type found"
3443 fi
3444 AC_MSG_RESULT($PY_UNICODE_TYPE)
3445fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00003446
3447# check for endianness
3448AC_C_BIGENDIAN
3449
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003450# Check whether right shifting a negative integer extends the sign bit
3451# or fills with zeros (like the Cray J90, according to Tim Peters).
3452AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00003453AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003454AC_TRY_RUN([
3455int main()
3456{
Vladimir Marangozova6180282000-07-12 05:05:06 +00003457 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003458}
Guido van Rossum3065c942001-09-17 04:03:14 +00003459],
3460ac_cv_rshift_extends_sign=yes,
3461ac_cv_rshift_extends_sign=no,
3462ac_cv_rshift_extends_sign=yes)])
Vladimir Marangozova6180282000-07-12 05:05:06 +00003463AC_MSG_RESULT($ac_cv_rshift_extends_sign)
3464if test "$ac_cv_rshift_extends_sign" = no
3465then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003466 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
3467 [Define if i>>j for signed int i does not extend the sign bit
3468 when i < 0])
Vladimir Marangozova6180282000-07-12 05:05:06 +00003469fi
3470
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003471# check for getc_unlocked and related locking functions
3472AC_MSG_CHECKING(for getc_unlocked() and friends)
3473AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
3474AC_TRY_LINK([#include <stdio.h>],[
3475 FILE *f = fopen("/dev/null", "r");
3476 flockfile(f);
3477 getc_unlocked(f);
3478 funlockfile(f);
3479], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
3480AC_MSG_RESULT($ac_cv_have_getc_unlocked)
3481if test "$ac_cv_have_getc_unlocked" = yes
3482then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003483 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
3484 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
Guido van Rossumcadfaec2001-01-05 14:45:49 +00003485fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00003486
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00003487# check where readline lives
Martin v. Löwis82bca632006-02-10 20:49:30 +00003488# save the value of LIBS so we don't actually link Python with readline
3489LIBS_no_readline=$LIBS
Gregory P. Smith980b99b2008-09-07 05:15:18 +00003490
3491# On some systems we need to link readline to a termcap compatible
3492# library. NOTE: Keep the precedence of listed libraries synchronised
3493# with setup.py.
3494py_cv_lib_readline=no
3495AC_MSG_CHECKING([how to link readline libs])
3496for py_libtermcap in "" ncursesw ncurses curses termcap; do
3497 if test -z "$py_libtermcap"; then
3498 READLINE_LIBS="-lreadline"
3499 else
3500 READLINE_LIBS="-lreadline -l$py_libtermcap"
3501 fi
3502 LIBS="$READLINE_LIBS $LIBS_no_readline"
3503 AC_LINK_IFELSE(
3504 [AC_LANG_CALL([],[readline])],
3505 [py_cv_lib_readline=yes])
3506 if test $py_cv_lib_readline = yes; then
3507 break
3508 fi
3509done
3510# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3511#AC_SUBST([READLINE_LIBS])
Gregory P. Smith29ec7502008-09-07 19:18:16 +00003512if test $py_cv_lib_readline = no; then
Gregory P. Smith980b99b2008-09-07 05:15:18 +00003513 AC_MSG_RESULT([none])
3514else
3515 AC_MSG_RESULT([$READLINE_LIBS])
3516 AC_DEFINE(HAVE_LIBREADLINE, 1,
3517 [Define if you have the readline library (-lreadline).])
Neal Norwitzfe8e3d92006-01-07 21:07:20 +00003518fi
3519
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003520# check for readline 2.1
3521AC_CHECK_LIB(readline, rl_callback_handler_install,
3522 AC_DEFINE(HAVE_RL_CALLBACK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003523 [Define if you have readline 2.1]), ,$READLINE_LIBS)
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003524
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003525# check for readline 2.2
3526AC_TRY_CPP([#include <readline/readline.h>],
3527have_readline=yes, have_readline=no)
3528if test $have_readline = yes
3529then
3530 AC_EGREP_HEADER([extern int rl_completion_append_character;],
3531 [readline/readline.h],
3532 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
3533 [Define if you have readline 2.2]), )
Antoine Pitrou632e93f2009-10-27 12:30:12 +00003534 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
3535 [readline/readline.h],
3536 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
3537 [Define if you have rl_completion_suppress_append]), )
Guido van Rossumfaf5e4d2002-12-30 16:25:41 +00003538fi
3539
Martin v. Löwis0daad592001-09-30 21:09:59 +00003540# check for readline 4.0
3541AC_CHECK_LIB(readline, rl_pre_input_hook,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003542 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003543 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis0daad592001-09-30 21:09:59 +00003544
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00003545# also in 4.0
3546AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
3547 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003548 [Define if you have readline 4.0]), ,$READLINE_LIBS)
Martin v. Löwis58bd49f2007-09-04 13:13:14 +00003549
Guido van Rossum353ae582001-07-10 16:45:32 +00003550# check for readline 4.2
3551AC_CHECK_LIB(readline, rl_completion_matches,
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003552 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
Gregory P. Smithff7b2d52008-09-03 05:57:48 +00003553 [Define if you have readline 4.2]), ,$READLINE_LIBS)
Guido van Rossum353ae582001-07-10 16:45:32 +00003554
Michael W. Hudson30ea2f22004-07-07 17:44:12 +00003555# also in readline 4.2
3556AC_TRY_CPP([#include <readline/readline.h>],
3557have_readline=yes, have_readline=no)
3558if test $have_readline = yes
3559then
3560 AC_EGREP_HEADER([extern int rl_catch_signals;],
3561 [readline/readline.h],
3562 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3563 [Define if you can turn off readline's signal handling.]), )
3564fi
3565
Martin v. Löwis82bca632006-02-10 20:49:30 +00003566# End of readline checks: restore LIBS
3567LIBS=$LIBS_no_readline
3568
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003569AC_MSG_CHECKING(for broken nice())
3570AC_CACHE_VAL(ac_cv_broken_nice, [
3571AC_TRY_RUN([
3572int main()
3573{
3574 int val1 = nice(1);
3575 if (val1 != -1 && val1 == nice(2))
3576 exit(0);
3577 exit(1);
3578}
Guido van Rossum3065c942001-09-17 04:03:14 +00003579],
3580ac_cv_broken_nice=yes,
3581ac_cv_broken_nice=no,
3582ac_cv_broken_nice=no)])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003583AC_MSG_RESULT($ac_cv_broken_nice)
3584if test "$ac_cv_broken_nice" = yes
3585then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003586 AC_DEFINE(HAVE_BROKEN_NICE, 1,
3587 [Define if nice() returns success/failure instead of the new priority.])
Thomas Wouterse38b2f12001-07-11 22:35:31 +00003588fi
3589
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003590AC_MSG_CHECKING(for broken poll())
3591AC_TRY_RUN([
3592#include <poll.h>
3593
3594int main (void)
3595 {
3596 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
3597
3598 close (42);
3599
3600 int poll_test = poll (&poll_struct, 1, 0);
3601
3602 if (poll_test < 0)
3603 {
3604 exit(0);
3605 }
3606 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
3607 {
3608 exit(0);
3609 }
3610 else
3611 {
3612 exit(1);
3613 }
3614 }
3615],
3616ac_cv_broken_poll=yes,
3617ac_cv_broken_poll=no,
3618ac_cv_broken_poll=no)
3619AC_MSG_RESULT($ac_cv_broken_poll)
3620if test "$ac_cv_broken_poll" = yes
3621then
3622 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3623 [Define if poll() sets errno on invalid file descriptors.])
3624fi
3625
Brett Cannon43802422005-02-10 20:48:03 +00003626# Before we can test tzset, we need to check if struct tm has a tm_zone
3627# (which is not required by ISO C or UNIX spec) and/or if we support
3628# tzname[]
3629AC_STRUCT_TIMEZONE
Nicholas Bastine62c5c82004-03-21 23:45:42 +00003630
Brett Cannon43802422005-02-10 20:48:03 +00003631# check tzset(3) exists and works like we expect it to
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003632AC_MSG_CHECKING(for working tzset())
3633AC_CACHE_VAL(ac_cv_working_tzset, [
3634AC_TRY_RUN([
3635#include <stdlib.h>
3636#include <time.h>
Brett Cannon18367812003-09-19 00:59:16 +00003637#include <string.h>
Brett Cannon43802422005-02-10 20:48:03 +00003638
3639#if HAVE_TZNAME
3640extern char *tzname[];
3641#endif
3642
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003643int main()
3644{
Brett Cannon18367812003-09-19 00:59:16 +00003645 /* Note that we need to ensure that not only does tzset(3)
3646 do 'something' with localtime, but it works as documented
3647 in the library reference and as expected by the test suite.
Brett Cannon43802422005-02-10 20:48:03 +00003648 This includes making sure that tzname is set properly if
3649 tm->tm_zone does not exist since it is the alternative way
3650 of getting timezone info.
Brett Cannon18367812003-09-19 00:59:16 +00003651
3652 Red Hat 6.2 doesn't understand the southern hemisphere
Brett Cannon43802422005-02-10 20:48:03 +00003653 after New Year's Day.
Brett Cannon18367812003-09-19 00:59:16 +00003654 */
3655
Brett Cannon43802422005-02-10 20:48:03 +00003656 time_t groundhogday = 1044144000; /* GMT-based */
Brett Cannon18367812003-09-19 00:59:16 +00003657 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3658
Neal Norwitz7f2588c2003-04-11 15:35:53 +00003659 putenv("TZ=UTC+0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003660 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00003661 if (localtime(&groundhogday)->tm_hour != 0)
3662 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003663#if HAVE_TZNAME
3664 /* For UTC, tzname[1] is sometimes "", sometimes " " */
3665 if (strcmp(tzname[0], "UTC") ||
3666 (tzname[1][0] != 0 && tzname[1][0] != ' '))
3667 exit(1);
3668#endif
Brett Cannon18367812003-09-19 00:59:16 +00003669
Neal Norwitz7f2588c2003-04-11 15:35:53 +00003670 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003671 tzset();
Brett Cannon18367812003-09-19 00:59:16 +00003672 if (localtime(&groundhogday)->tm_hour != 19)
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003673 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003674#if HAVE_TZNAME
3675 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
3676 exit(1);
3677#endif
Brett Cannon18367812003-09-19 00:59:16 +00003678
3679 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
3680 tzset();
3681 if (localtime(&groundhogday)->tm_hour != 11)
3682 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003683#if HAVE_TZNAME
3684 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
3685 exit(1);
3686#endif
3687
3688#if HAVE_STRUCT_TM_TM_ZONE
Brett Cannon18367812003-09-19 00:59:16 +00003689 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
3690 exit(1);
3691 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
3692 exit(1);
Brett Cannon43802422005-02-10 20:48:03 +00003693#endif
Brett Cannon18367812003-09-19 00:59:16 +00003694
Guido van Rossumd11b62e2003-03-14 21:51:36 +00003695 exit(0);
3696}
3697],
3698ac_cv_working_tzset=yes,
3699ac_cv_working_tzset=no,
3700ac_cv_working_tzset=no)])
3701AC_MSG_RESULT($ac_cv_working_tzset)
3702if test "$ac_cv_working_tzset" = yes
3703then
3704 AC_DEFINE(HAVE_WORKING_TZSET, 1,
3705 [Define if tzset() actually switches the local timezone in a meaningful way.])
3706fi
3707
Martin v. Löwis94717ed2002-09-09 14:24:16 +00003708# Look for subsecond timestamps in struct stat
3709AC_MSG_CHECKING(for tv_nsec in struct stat)
3710AC_CACHE_VAL(ac_cv_stat_tv_nsec,
3711AC_TRY_COMPILE([#include <sys/stat.h>], [
3712struct stat st;
3713st.st_mtim.tv_nsec = 1;
3714],
Martin v. Löwisa32c9942002-09-09 16:17:47 +00003715ac_cv_stat_tv_nsec=yes,
Martin v. Löwis94717ed2002-09-09 14:24:16 +00003716ac_cv_stat_tv_nsec=no,
3717ac_cv_stat_tv_nsec=no))
3718AC_MSG_RESULT($ac_cv_stat_tv_nsec)
3719if test "$ac_cv_stat_tv_nsec" = yes
3720then
3721 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
3722 [Define if you have struct stat.st_mtim.tv_nsec])
3723fi
3724
Martin v. Löwisebd9d5b2005-08-09 15:00:59 +00003725# Look for BSD style subsecond timestamps in struct stat
3726AC_MSG_CHECKING(for tv_nsec2 in struct stat)
3727AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
3728AC_TRY_COMPILE([#include <sys/stat.h>], [
3729struct stat st;
3730st.st_mtimespec.tv_nsec = 1;
3731],
3732ac_cv_stat_tv_nsec2=yes,
3733ac_cv_stat_tv_nsec2=no,
3734ac_cv_stat_tv_nsec2=no))
3735AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
3736if test "$ac_cv_stat_tv_nsec2" = yes
3737then
3738 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
3739 [Define if you have struct stat.st_mtimensec])
3740fi
3741
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00003742# On HP/UX 11.0, mvwdelch is a block with a return statement
3743AC_MSG_CHECKING(whether mvwdelch is an expression)
3744AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
3745AC_TRY_COMPILE([#include <curses.h>], [
3746 int rtn;
3747 rtn = mvwdelch(0,0,0);
3748], ac_cv_mvwdelch_is_expression=yes,
3749 ac_cv_mvwdelch_is_expression=no,
3750 ac_cv_mvwdelch_is_expression=yes))
3751AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
3752
3753if test "$ac_cv_mvwdelch_is_expression" = yes
3754then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003755 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
3756 [Define if mvwdelch in curses.h is an expression.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00003757fi
3758
3759AC_MSG_CHECKING(whether WINDOW has _flags)
3760AC_CACHE_VAL(ac_cv_window_has_flags,
3761AC_TRY_COMPILE([#include <curses.h>], [
3762 WINDOW *w;
3763 w->_flags = 0;
3764], ac_cv_window_has_flags=yes,
3765 ac_cv_window_has_flags=no,
3766 ac_cv_window_has_flags=no))
3767AC_MSG_RESULT($ac_cv_window_has_flags)
3768
3769
3770if test "$ac_cv_window_has_flags" = yes
3771then
Martin v. Löwisc45929e2002-04-06 10:10:49 +00003772 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
3773 [Define if WINDOW in curses.h offers a field _flags.])
Martin v. Löwiseb9b1032001-10-24 17:10:49 +00003774fi
3775
Walter Dörwald4994d952006-06-19 08:07:50 +00003776AC_MSG_CHECKING(for is_term_resized)
3777AC_TRY_COMPILE([#include <curses.h>], void *x=is_term_resized,
3778 AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
3779 AC_MSG_RESULT(yes),
3780 AC_MSG_RESULT(no)
3781)
3782
Walter Dörwald05fdbf12006-06-19 08:14:09 +00003783AC_MSG_CHECKING(for resize_term)
3784AC_TRY_COMPILE([#include <curses.h>], void *x=resize_term,
3785 AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
Walter Dörwald4994d952006-06-19 08:07:50 +00003786 AC_MSG_RESULT(yes),
3787 AC_MSG_RESULT(no)
3788)
3789
Walter Dörwald05fdbf12006-06-19 08:14:09 +00003790AC_MSG_CHECKING(for resizeterm)
3791AC_TRY_COMPILE([#include <curses.h>], void *x=resizeterm,
3792 AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
Walter Dörwald4994d952006-06-19 08:07:50 +00003793 AC_MSG_RESULT(yes),
3794 AC_MSG_RESULT(no)
3795)
3796
Martin v. Löwisfefbc202006-10-17 18:59:23 +00003797AC_MSG_CHECKING(for /dev/ptmx)
3798
3799if test -r /dev/ptmx
3800then
3801 AC_MSG_RESULT(yes)
3802 AC_DEFINE(HAVE_DEV_PTMX, 1,
3803 [Define if we have /dev/ptmx.])
3804else
3805 AC_MSG_RESULT(no)
3806fi
3807
3808AC_MSG_CHECKING(for /dev/ptc)
3809
3810if test -r /dev/ptc
3811then
3812 AC_MSG_RESULT(yes)
3813 AC_DEFINE(HAVE_DEV_PTC, 1,
3814 [Define if we have /dev/ptc.])
3815else
3816 AC_MSG_RESULT(no)
3817fi
Neal Norwitz865400f2003-03-21 01:42:58 +00003818
Brett Cannon09d12362006-05-11 05:11:33 +00003819AC_MSG_CHECKING(for %zd printf() format support)
3820AC_TRY_RUN([#include <stdio.h>
3821#include <stddef.h>
3822#include <string.h>
3823
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00003824#ifdef HAVE_SYS_TYPES_H
3825#include <sys/types.h>
3826#endif
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00003827
3828#ifdef HAVE_SSIZE_T
3829typedef ssize_t Py_ssize_t;
3830#elif SIZEOF_VOID_P == SIZEOF_LONG
3831typedef long Py_ssize_t;
3832#else
3833typedef int Py_ssize_t;
3834#endif
Brett Cannon09d12362006-05-11 05:11:33 +00003835
Christian Heimesdb3d6cb2007-12-16 21:39:43 +00003836int main()
3837{
3838 char buffer[256];
3839
Brett Cannon09d12362006-05-11 05:11:33 +00003840 if(sprintf(buffer, "%zd", (size_t)123) < 0)
3841 return 1;
3842
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00003843 if (strcmp(buffer, "123"))
Brett Cannon09d12362006-05-11 05:11:33 +00003844 return 1;
Neal Norwitz4a8fbdb2006-09-22 08:16:26 +00003845
3846 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
3847 return 1;
3848
3849 if (strcmp(buffer, "-123"))
3850 return 1;
3851
Brett Cannon09d12362006-05-11 05:11:33 +00003852 return 0;
3853}],
3854[AC_MSG_RESULT(yes)
3855 AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
3856 AC_MSG_RESULT(no))
3857
Martin v. Löwis01c04012002-11-11 14:58:44 +00003858AC_CHECK_TYPE(socklen_t,,
3859 AC_DEFINE(socklen_t,int,
3860 Define to `int' if <sys/socket.h> does not define.),[
3861#ifdef HAVE_SYS_TYPES_H
3862#include <sys/types.h>
3863#endif
Guido van Rossum95713eb2000-05-18 20:53:31 +00003864#ifdef HAVE_SYS_SOCKET_H
3865#include <sys/socket.h>
3866#endif
Martin v. Löwis01c04012002-11-11 14:58:44 +00003867])
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00003868
Martin v. Löwis06f15bb2001-12-02 13:02:32 +00003869AC_SUBST(THREADHEADERS)
3870
3871for h in `(cd $srcdir;echo Python/thread_*.h)`
3872do
3873 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
3874done
3875
Ronald Oussoren55114422009-11-19 16:37:33 +00003876if test $ac_sys_system = Darwin
3877then
3878 LIBS="$LIBS -framework CoreFoundation"
3879fi
3880
3881
3882
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00003883AC_SUBST(SRCDIRS)
Neal Norwitzd24499d2005-12-18 21:36:39 +00003884SRCDIRS="Parser Grammar Objects Python Modules Mac"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00003885AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00003886for dir in $SRCDIRS; do
3887 if test ! -d $dir; then
3888 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00003889 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00003890done
3891AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00003892
Guido van Rossum627b2d71993-12-24 10:39:16 +00003893# generate output files
Martin v. Löwis88afe662002-10-26 13:47:44 +00003894AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
3895AC_OUTPUT
Neil Schemenauer61c51152001-01-26 16:18:16 +00003896
Martin v. Löwisf7afe952006-04-14 15:16:15 +00003897echo "creating Modules/Setup"
Neil Schemenauer61c51152001-01-26 16:18:16 +00003898if test ! -f Modules/Setup
3899then
3900 cp $srcdir/Modules/Setup.dist Modules/Setup
3901fi
3902
Martin v. Löwisf7afe952006-04-14 15:16:15 +00003903echo "creating Modules/Setup.local"
Neil Schemenauer61c51152001-01-26 16:18:16 +00003904if test ! -f Modules/Setup.local
3905then
3906 echo "# Edit this file for local setup changes" >Modules/Setup.local
3907fi
3908
3909echo "creating Makefile"
3910$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
3911 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00003912 Modules/Setup.local Modules/Setup
Skip Montanaro7221d932007-08-22 19:02:16 +00003913
3914case $ac_sys_system in
3915BeOS)
3916 AC_MSG_WARN([
3917
3918 Support for BeOS is deprecated as of Python 2.6.
3919 See PEP 11 for the gory details.
3920 ])
3921 ;;
3922*) ;;
3923esac
3924
Neil Schemenauer66252162001-02-19 04:47:42 +00003925mv config.c Modules