source: python/vendor/current/configure.ac@ 388

Last change on this file since 388 was 388, checked in by dmik, 11 years ago

python: Update vendor to 2.7.6.

  • Property svn:eol-style set to native
File size: 130.4 KB
Line 
1dnl ***********************************************
2dnl * Please run autoreconf to test your changes! *
3dnl ***********************************************
4
5# Set VERSION so we only need to edit in one place (i.e., here)
6m4_define(PYTHON_VERSION, 2.7)
7
8AC_PREREQ(2.65)
9
10AC_REVISION($Revision$)
11AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
12AC_CONFIG_SRCDIR([Include/object.h])
13AC_CONFIG_HEADER(pyconfig.h)
14
15AC_CANONICAL_HOST
16AC_SUBST(build)
17AC_SUBST(host)
18
19if test "$cross_compiling" = yes; then
20 AC_MSG_CHECKING([for python interpreter for cross build])
21 if test -z "$PYTHON_FOR_BUILD"; then
22 for interp in python$PACKAGE_VERSION python2 python; do
23 which $interp >/dev/null 2>&1 || continue
24 if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then
25 break
26 fi
27 interp=
28 done
29 if test x$interp = x; then
30 AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
31 fi
32 AC_MSG_RESULT($interp)
33 PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp
34 fi
35elif test "$cross_compiling" = maybe; then
36 AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
37else
38 PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
39fi
40AC_SUBST(PYTHON_FOR_BUILD)
41
42dnl Ensure that if prefix is specified, it does not end in a slash. If
43dnl it does, we get path names containing '//' which is both ugly and
44dnl can cause trouble.
45
46dnl Last slash shouldn't be stripped if prefix=/
47if test "$prefix" != "/"; then
48 prefix=`echo "$prefix" | sed -e 's/\/$//g'`
49fi
50
51dnl This is for stuff that absolutely must end up in pyconfig.h.
52dnl Please use pyport.h instead, if possible.
53AH_TOP([
54#ifndef Py_PYCONFIG_H
55#define Py_PYCONFIG_H
56])
57AH_BOTTOM([
58/* Define the macros needed if on a UnixWare 7.x system. */
59#if defined(__USLC__) && defined(__SCO_VERSION__)
60#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
61#endif
62
63#endif /*Py_PYCONFIG_H*/
64])
65
66# We don't use PACKAGE_ variables, and they cause conflicts
67# with other autoconf-based packages that include Python.h
68grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
69rm confdefs.h
70mv confdefs.h.new confdefs.h
71
72AC_SUBST(VERSION)
73VERSION=PYTHON_VERSION
74
75AC_SUBST(SOVERSION)
76SOVERSION=1.0
77
78# The later defininition of _XOPEN_SOURCE disables certain features
79# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
80AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
81
82# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
83# certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
84# them.
85AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
86
87# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
88# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
89# them.
90AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
91
92# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
93# u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
94AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
95
96# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
97# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
98# them.
99AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
100
101
102define_xopen_source=yes
103
104# Arguments passed to configure.
105AC_SUBST(CONFIG_ARGS)
106CONFIG_ARGS="$ac_configure_args"
107
108AC_MSG_CHECKING([for --enable-universalsdk])
109AC_ARG_ENABLE(universalsdk,
110 AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build against Mac OS X 10.4u SDK (ppc/i386)]),
111[
112 case $enableval in
113 yes)
114 enableval=/Developer/SDKs/MacOSX10.4u.sdk
115 if test ! -d "${enableval}"
116 then
117 enableval=/
118 fi
119 ;;
120 esac
121 case $enableval in
122 no)
123 UNIVERSALSDK=
124 enable_universalsdk=
125 ;;
126 *)
127 UNIVERSALSDK=$enableval
128 if test ! -d "${UNIVERSALSDK}"
129 then
130 AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
131 fi
132 ;;
133 esac
134
135],[
136 UNIVERSALSDK=
137 enable_universalsdk=
138])
139if test -n "${UNIVERSALSDK}"
140then
141 AC_MSG_RESULT(${UNIVERSALSDK})
142else
143 AC_MSG_RESULT(no)
144fi
145AC_SUBST(UNIVERSALSDK)
146
147AC_SUBST(ARCH_RUN_32BIT)
148ARCH_RUN_32BIT=""
149
150UNIVERSAL_ARCHS="32-bit"
151AC_SUBST(LIPO_32BIT_FLAGS)
152AC_MSG_CHECKING(for --with-universal-archs)
153AC_ARG_WITH(universal-archs,
154 AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")]),
155[
156 AC_MSG_RESULT($withval)
157 UNIVERSAL_ARCHS="$withval"
158 if test "${enable_universalsdk}" ; then
159 :
160 else
161 AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
162 fi
163],
164[
165 AC_MSG_RESULT(32-bit)
166])
167
168
169
170AC_ARG_WITH(framework-name,
171 AS_HELP_STRING([--with-framework-name=FRAMEWORK],
172 [specify an alternate name of the framework built with --enable-framework]),
173[
174 if test "${enable_framework}"; then
175 :
176 else
177 AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
178 fi
179 PYTHONFRAMEWORK=${withval}
180 PYTHONFRAMEWORKDIR=${withval}.framework
181 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
182 ],[
183 PYTHONFRAMEWORK=Python
184 PYTHONFRAMEWORKDIR=Python.framework
185 PYTHONFRAMEWORKIDENTIFIER=org.python.python
186])
187dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
188AC_ARG_ENABLE(framework,
189 AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@], [Build (MacOSX|Darwin) framework]),
190[
191 case $enableval in
192 yes)
193 enableval=/Library/Frameworks
194 esac
195 case $enableval in
196 no)
197 PYTHONFRAMEWORK=
198 PYTHONFRAMEWORKDIR=no-framework
199 PYTHONFRAMEWORKPREFIX=
200 PYTHONFRAMEWORKINSTALLDIR=
201 FRAMEWORKINSTALLFIRST=
202 FRAMEWORKINSTALLLAST=
203 FRAMEWORKALTINSTALLFIRST=
204 FRAMEWORKALTINSTALLLAST=
205 if test "x${prefix}" = "xNONE"; then
206 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
207 else
208 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
209 fi
210 enable_framework=
211 ;;
212 *)
213 PYTHONFRAMEWORKPREFIX="${enableval}"
214 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
215 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
216 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
217 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
218 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
219 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
220
221 if test "x${prefix}" = "xNONE" ; then
222 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
223
224 else
225 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
226 fi
227
228 case "${enableval}" in
229 /System*)
230 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
231 if test "${prefix}" = "NONE" ; then
232 # See below
233 FRAMEWORKUNIXTOOLSPREFIX="/usr"
234 fi
235 ;;
236
237 /Library*)
238 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
239 ;;
240
241 */Library/Frameworks)
242 MDIR="`dirname "${enableval}"`"
243 MDIR="`dirname "${MDIR}"`"
244 FRAMEWORKINSTALLAPPSPREFIX="${MDIR}/Applications"
245
246 if test "${prefix}" = "NONE"; then
247 # User hasn't specified the
248 # --prefix option, but wants to install
249 # the framework in a non-default location,
250 # ensure that the compatibility links get
251 # installed relative to that prefix as well
252 # instead of in /usr/local.
253 FRAMEWORKUNIXTOOLSPREFIX="${MDIR}"
254 fi
255 ;;
256
257 *)
258 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
259 ;;
260 esac
261
262 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
263
264 # Add files for Mac specific code to the list of output
265 # files:
266 AC_CONFIG_FILES(Mac/Makefile)
267 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
268 AC_CONFIG_FILES(Mac/IDLE/Makefile)
269 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
270 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
271 esac
272 ],[
273 PYTHONFRAMEWORK=
274 PYTHONFRAMEWORKDIR=no-framework
275 PYTHONFRAMEWORKPREFIX=
276 PYTHONFRAMEWORKINSTALLDIR=
277 FRAMEWORKINSTALLFIRST=
278 FRAMEWORKINSTALLLAST=
279 FRAMEWORKALTINSTALLFIRST=
280 FRAMEWORKALTINSTALLLAST=
281 if test "x${prefix}" = "xNONE" ; then
282 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
283 else
284 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
285 fi
286 enable_framework=
287
288])
289AC_SUBST(PYTHONFRAMEWORK)
290AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
291AC_SUBST(PYTHONFRAMEWORKDIR)
292AC_SUBST(PYTHONFRAMEWORKPREFIX)
293AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
294AC_SUBST(FRAMEWORKINSTALLFIRST)
295AC_SUBST(FRAMEWORKINSTALLLAST)
296AC_SUBST(FRAMEWORKALTINSTALLFIRST)
297AC_SUBST(FRAMEWORKALTINSTALLLAST)
298AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
299AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
300
301##AC_ARG_WITH(dyld,
302## AS_HELP_STRING([--with-dyld],
303## [Use (OpenStep|Rhapsody) dynamic linker]))
304##
305# Set name for machine-dependent library files
306AC_SUBST(MACHDEP)
307AC_MSG_CHECKING(MACHDEP)
308if test -z "$MACHDEP"
309then
310 # avoid using uname for cross builds
311 if test "$cross_compiling" = yes; then
312 # ac_sys_system and ac_sys_release are only used for setting
313 # `define_xopen_source' in the case statement below. For the
314 # current supported cross builds, this macro is not adjusted.
315 case "$host" in
316 *-*-linux*)
317 ac_sys_system=Linux
318 ;;
319 *-*-cygwin*)
320 ac_sys_system=Cygwin
321 ;;
322 *)
323 # for now, limit cross builds to known configurations
324 MACHDEP="unknown"
325 AC_MSG_ERROR([cross build not supported for $host])
326 esac
327 ac_sys_release=
328 else
329 ac_sys_system=`uname -s`
330 if test "$ac_sys_system" = "AIX" \
331 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
332 ac_sys_release=`uname -v`
333 else
334 ac_sys_release=`uname -r`
335 fi
336 fi
337 ac_md_system=`echo $ac_sys_system |
338 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
339 ac_md_release=`echo $ac_sys_release |
340 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
341 MACHDEP="$ac_md_system$ac_md_release"
342
343 case $MACHDEP in
344 linux*) MACHDEP="linux2";;
345 cygwin*) MACHDEP="cygwin";;
346 darwin*) MACHDEP="darwin";;
347 atheos*) MACHDEP="atheos";;
348 irix646) MACHDEP="irix6";;
349 '') MACHDEP="unknown";;
350 esac
351fi
352
353AC_SUBST(_PYTHON_HOST_PLATFORM)
354if test "$cross_compiling" = yes; then
355 case "$host" in
356 *-*-linux*)
357 case "$host_cpu" in
358 arm*)
359 _host_cpu=arm
360 ;;
361 *)
362 _host_cpu=$host_cpu
363 esac
364 ;;
365 *-*-cygwin*)
366 _host_cpu=
367 ;;
368 *)
369 # for now, limit cross builds to known configurations
370 MACHDEP="unknown"
371 AC_MSG_ERROR([cross build not supported for $host])
372 esac
373 _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
374fi
375
376# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
377# disable features if it is defined, without any means to access these
378# features as extensions. For these systems, we skip the definition of
379# _XOPEN_SOURCE. Before adding a system to the list to gain access to
380# some feature, make sure there is no alternative way to access this
381# feature. Also, when using wildcards, make sure you have verified the
382# need for not defining _XOPEN_SOURCE on all systems matching the
383# wildcard, and that the wildcard does not include future systems
384# (which may remove their limitations).
385dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
386case $ac_sys_system/$ac_sys_release in
387 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
388 # even though select is a POSIX function. Reported by J. Ribbens.
389 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
390 # In addition, Stefan Krah confirms that issue #1244610 exists through
391 # OpenBSD 4.6, but is fixed in 4.7.
392 OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@)
393 define_xopen_source=no
394 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
395 # also defined. This can be overridden by defining _BSD_SOURCE
396 # As this has a different meaning on Linux, only define it on OpenBSD
397 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
398 ;;
399 OpenBSD/*)
400 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
401 # also defined. This can be overridden by defining _BSD_SOURCE
402 # As this has a different meaning on Linux, only define it on OpenBSD
403 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
404 ;;
405 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
406 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
407 # Marc Recht
408 NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
409 define_xopen_source=no;;
410 # From the perspective of Solaris, _XOPEN_SOURCE is not so much a
411 # request to enable features supported by the standard as a request
412 # to disable features not supported by the standard. The best way
413 # for Python to use Solaris is simply to leave _XOPEN_SOURCE out
414 # entirely and define __EXTENSIONS__ instead.
415 SunOS/*)
416 define_xopen_source=no;;
417 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
418 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
419 # Reconfirmed for 7.1.4 by Martin v. Loewis.
420 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
421 define_xopen_source=no;;
422 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
423 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
424 SCO_SV/3.2)
425 define_xopen_source=no;;
426 # On FreeBSD 4, the math functions C89 does not cover are never defined
427 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
428 FreeBSD/4.*)
429 define_xopen_source=no;;
430 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
431 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
432 # identifies itself as Darwin/7.*
433 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
434 # disables platform specific features beyond repair.
435 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
436 # has no effect, don't bother defining them
437 Darwin/@<:@6789@:>@.*)
438 define_xopen_source=no;;
439 Darwin/1@<:@0-9@:>@.*)
440 define_xopen_source=no;;
441 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
442 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
443 # or has another value. By not (re)defining it, the defaults come in place.
444 AIX/4)
445 define_xopen_source=no;;
446 AIX/5)
447 if test `uname -r` -eq 1; then
448 define_xopen_source=no
449 fi
450 ;;
451 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
452 # defining NI_NUMERICHOST.
453 QNX/6.3.2)
454 define_xopen_source=no
455 ;;
456
457esac
458
459if test $define_xopen_source = yes
460then
461 AC_DEFINE(_XOPEN_SOURCE, 600,
462 Define to the level of X/Open that your system supports)
463
464 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
465 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
466 # several APIs are not declared. Since this is also needed in some
467 # cases for HP-UX, we define it globally.
468 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
469 Define to activate Unix95-and-earlier features)
470
471 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
472
473fi
474
475#
476# SGI compilers allow the specification of the both the ABI and the
477# ISA on the command line. Depending on the values of these switches,
478# different and often incompatable code will be generated.
479#
480# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
481# thus supply support for various ABI/ISA combinations. The MACHDEP
482# variable is also adjusted.
483#
484AC_SUBST(SGI_ABI)
485if test ! -z "$SGI_ABI"
486then
487 CC="cc $SGI_ABI"
488 LDFLAGS="$SGI_ABI $LDFLAGS"
489 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
490fi
491AC_MSG_RESULT($MACHDEP)
492
493# And add extra plat-mac for darwin
494AC_SUBST(EXTRAPLATDIR)
495AC_SUBST(EXTRAMACHDEPPATH)
496AC_MSG_CHECKING(EXTRAPLATDIR)
497if test -z "$EXTRAPLATDIR"
498then
499 case $MACHDEP in
500 darwin)
501 EXTRAPLATDIR="\$(PLATMACDIRS)"
502 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
503 ;;
504 *)
505 EXTRAPLATDIR=""
506 EXTRAMACHDEPPATH=""
507 ;;
508 esac
509fi
510AC_MSG_RESULT($EXTRAPLATDIR)
511
512# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
513# it may influence the way we can build extensions, so distutils
514# needs to check it
515AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
516AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
517CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
518EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
519
520# checks for alternative programs
521
522# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
523# for debug/optimization stuff. BASECFLAGS is for flags that are required
524# just to get things to compile and link. Users are free to override OPT
525# when running configure or make. The build should not break if they do.
526# BASECFLAGS should generally not be messed with, however.
527
528# XXX shouldn't some/most/all of this code be merged with the stuff later
529# on that fiddles with OPT and BASECFLAGS?
530AC_MSG_CHECKING(for --without-gcc)
531AC_ARG_WITH(gcc,
532 AS_HELP_STRING([--without-gcc], [never use gcc]),
533[
534 case $withval in
535 no) CC=${CC:-cc}
536 without_gcc=yes;;
537 yes) CC=gcc
538 without_gcc=no;;
539 *) CC=$withval
540 without_gcc=$withval;;
541 esac], [
542 case $ac_sys_system in
543 AIX*) CC=${CC:-xlc_r}
544 without_gcc=;;
545 BeOS*)
546 case $BE_HOST_CPU in
547 ppc)
548 CC=mwcc
549 without_gcc=yes
550 BASECFLAGS="$BASECFLAGS -export pragma"
551 OPT="$OPT -O"
552 LDFLAGS="$LDFLAGS -nodup"
553 ;;
554 x86)
555 CC=gcc
556 without_gcc=no
557 OPT="$OPT -O"
558 ;;
559 *)
560 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
561 ;;
562 esac
563 AR="\$(srcdir)/Modules/ar_beos"
564 RANLIB=:
565 ;;
566 *) without_gcc=no;;
567 esac])
568AC_MSG_RESULT($without_gcc)
569
570# If the user switches compilers, we can't believe the cache
571if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
572then
573 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
574(it is also a good idea to do 'make clean' before compiling)])
575fi
576
577if test "$MACHDEP" = "irix6" && test "$CC" != "gcc"; then
578 # Normally, MIPSpro CC treats #error directives as warnings, which means
579 # a successful exit code is returned (0). This is a problem because IRIX
580 # has a bunch of system headers with this guard at the top:
581 #
582 # #ifndef __c99
583 # #error This header file is to be used only for c99 mode compilations
584 # #else
585 #
586 # When autoconf tests for such a header, like stdint.h, this happens:
587 #
588 # configure:4619: cc -c conftest.c >&5
589 # cc-1035 cc: WARNING File = /usr/include/stdint.h, Line = 5
590 # #error directive: This header file is to be used only for c99 mode
591 # compilations
592 #
593 # #error This header file is to be used only for c99 mode compilations
594 # ^
595 #
596 # configure:4619: $? = 0
597 # configure:4619: result: yes
598 #
599 # Therefore, we use `-diag_error 1035` to have the compiler treat the
600 # warning as an error, which causes cc to return a non-zero result,
601 # which autoconf can interpret correctly.
602 CFLAGS="$CFLAGS -diag_error 1035"
603 # Whilst we're here, we might as well make sure CXX defaults to something
604 # sensible if we're not using gcc.
605 if test -z "$CXX"; then
606 CXX="CC"
607 fi
608fi
609
610# If the user set CFLAGS, use this instead of the automatically
611# determined setting
612preset_cflags="$CFLAGS"
613AC_PROG_CC
614if test ! -z "$preset_cflags"
615then
616 CFLAGS=$preset_cflags
617fi
618
619AC_SUBST(CXX)
620AC_SUBST(MAINCC)
621AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
622AC_ARG_WITH(cxx_main,
623 AS_HELP_STRING([--with-cxx-main=<compiler>],
624 [compile main() and link python executable with C++ compiler]),
625[
626
627 case $withval in
628 no) with_cxx_main=no
629 MAINCC='$(CC)';;
630 yes) with_cxx_main=yes
631 MAINCC='$(CXX)';;
632 *) with_cxx_main=yes
633 MAINCC=$withval
634 if test -z "$CXX"
635 then
636 CXX=$withval
637 fi;;
638 esac], [
639 with_cxx_main=no
640 MAINCC='$(CC)'
641])
642AC_MSG_RESULT($with_cxx_main)
643
644preset_cxx="$CXX"
645if test -z "$CXX"
646then
647 case "$CC" in
648 gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
649 cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
650 esac
651 if test "$CXX" = "notfound"
652 then
653 CXX=""
654 fi
655fi
656if test -z "$CXX"
657then
658 AC_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
659 if test "$CXX" = "notfound"
660 then
661 CXX=""
662 fi
663fi
664if test "$preset_cxx" != "$CXX"
665then
666 AC_MSG_WARN([
667
668 By default, distutils will build C++ extension modules with "$CXX".
669 If this is not intended, then set CXX on the configure command line.
670 ])
671fi
672
673MULTIARCH=$($CC --print-multiarch 2>/dev/null)
674AC_SUBST(MULTIARCH)
675
676
677# checks for UNIX variants that set C preprocessor variables
678AC_USE_SYSTEM_EXTENSIONS
679
680# Check for unsupported systems
681case $ac_sys_system/$ac_sys_release in
682atheos*|Linux*/1*)
683 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
684 echo See README for details.
685 exit 1;;
686esac
687
688AC_EXEEXT
689AC_MSG_CHECKING(for --with-suffix)
690AC_ARG_WITH(suffix,
691 AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]),
692[
693 case $withval in
694 no) EXEEXT=;;
695 yes) EXEEXT=.exe;;
696 *) EXEEXT=$withval;;
697 esac])
698AC_MSG_RESULT($EXEEXT)
699
700# Test whether we're running on a non-case-sensitive system, in which
701# case we give a warning if no ext is given
702AC_SUBST(BUILDEXEEXT)
703AC_MSG_CHECKING(for case-insensitive build directory)
704if test ! -d CaseSensitiveTestDir; then
705mkdir CaseSensitiveTestDir
706fi
707
708if test -d casesensitivetestdir
709then
710 AC_MSG_RESULT(yes)
711 BUILDEXEEXT=.exe
712else
713 AC_MSG_RESULT(no)
714 BUILDEXEEXT=$EXEEXT
715fi
716rmdir CaseSensitiveTestDir
717
718case $MACHDEP in
719bsdos*)
720 case $CC in
721 gcc) CC="$CC -D_HAVE_BSDI";;
722 esac;;
723esac
724
725case $ac_sys_system in
726hp*|HP*)
727 case $CC in
728 cc|*/cc) CC="$CC -Ae";;
729 esac;;
730SunOS*)
731 # Some functions have a prototype only with that define, e.g. confstr
732 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
733 ;;
734esac
735
736
737AC_SUBST(LIBRARY)
738AC_MSG_CHECKING(LIBRARY)
739if test -z "$LIBRARY"
740then
741 LIBRARY='libpython$(VERSION).a'
742fi
743AC_MSG_RESULT($LIBRARY)
744
745# LDLIBRARY is the name of the library to link against (as opposed to the
746# name of the library into which to insert object files). BLDLIBRARY is also
747# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
748# is blank as the main program is not linked directly against LDLIBRARY.
749# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
750# systems without shared libraries, LDLIBRARY is the same as LIBRARY
751# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
752# DLLLIBRARY is the shared (i.e., DLL) library.
753#
754# RUNSHARED is used to run shared python without installed libraries
755#
756# INSTSONAME is the name of the shared library that will be use to install
757# on the system - some systems like version suffix, others don't
758AC_SUBST(LDLIBRARY)
759AC_SUBST(DLLLIBRARY)
760AC_SUBST(BLDLIBRARY)
761AC_SUBST(LDLIBRARYDIR)
762AC_SUBST(INSTSONAME)
763AC_SUBST(RUNSHARED)
764LDLIBRARY="$LIBRARY"
765BLDLIBRARY='$(LDLIBRARY)'
766INSTSONAME='$(LDLIBRARY)'
767DLLLIBRARY=''
768LDLIBRARYDIR=''
769RUNSHARED=''
770
771# LINKCC is the command that links the python executable -- default is $(CC).
772# If CXX is set, and if it is needed to link a main function that was
773# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
774# python might then depend on the C++ runtime
775# This is altered for AIX in order to build the export list before
776# linking.
777AC_SUBST(LINKCC)
778AC_MSG_CHECKING(LINKCC)
779if test -z "$LINKCC"
780then
781 LINKCC='$(PURIFY) $(MAINCC)'
782 case $ac_sys_system in
783 AIX*)
784 exp_extra="\"\""
785 if test $ac_sys_release -ge 5 -o \
786 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
787 exp_extra="."
788 fi
789 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
790 QNX*)
791 # qcc must be used because the other compilers do not
792 # support -N.
793 LINKCC=qcc;;
794 esac
795fi
796AC_MSG_RESULT($LINKCC)
797
798# GNULD is set to "yes" if the GNU linker is used. If this goes wrong
799# make sure we default having it set to "no": this is used by
800# distutils.unixccompiler to know if it should add --enable-new-dtags
801# to linker command lines, and failing to detect GNU ld simply results
802# in the same bahaviour as before.
803AC_SUBST(GNULD)
804AC_MSG_CHECKING(for GNU ld)
805ac_prog=ld
806if test "$GCC" = yes; then
807 ac_prog=`$CC -print-prog-name=ld`
808fi
809case `"$ac_prog" -V 2>&1 < /dev/null` in
810 *GNU*)
811 GNULD=yes;;
812 *)
813 GNULD=no;;
814esac
815AC_MSG_RESULT($GNULD)
816
817AC_MSG_CHECKING(for --enable-shared)
818AC_ARG_ENABLE(shared,
819 AS_HELP_STRING([--enable-shared], [disable/enable building shared python library]))
820
821if test -z "$enable_shared"
822then
823 case $ac_sys_system in
824 CYGWIN* | atheos*)
825 enable_shared="yes";;
826 *)
827 enable_shared="no";;
828 esac
829fi
830AC_MSG_RESULT($enable_shared)
831
832AC_MSG_CHECKING(for --enable-profiling)
833AC_ARG_ENABLE(profiling,
834 AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]))
835if test "x$enable_profiling" = xyes; then
836 ac_save_cc="$CC"
837 CC="$CC -pg"
838 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
839 [],
840 [enable_profiling=no])
841 CC="$ac_save_cc"
842else
843 enable_profiling=no
844fi
845AC_MSG_RESULT($enable_profiling)
846
847if test "x$enable_profiling" = xyes; then
848 BASECFLAGS="-pg $BASECFLAGS"
849 LDFLAGS="-pg $LDFLAGS"
850fi
851
852AC_MSG_CHECKING(LDLIBRARY)
853
854# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
855# library that we build, but we do not want to link against it (we
856# will find it with a -framework option). For this reason there is an
857# extra variable BLDLIBRARY against which Python and the extension
858# modules are linked, BLDLIBRARY. This is normally the same as
859# LDLIBRARY, but empty for MacOSX framework builds.
860if test "$enable_framework"
861then
862 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
863 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
864 BLDLIBRARY=''
865else
866 BLDLIBRARY='$(LDLIBRARY)'
867fi
868
869# Other platforms follow
870if test $enable_shared = "yes"; then
871 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
872 case $ac_sys_system in
873 BeOS*)
874 LDLIBRARY='libpython$(VERSION).so'
875 ;;
876 CYGWIN*)
877 LDLIBRARY='libpython$(VERSION).dll.a'
878 DLLLIBRARY='libpython$(VERSION).dll'
879 ;;
880 SunOS*)
881 LDLIBRARY='libpython$(VERSION).so'
882 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
883 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
884 INSTSONAME="$LDLIBRARY".$SOVERSION
885 ;;
886 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
887 LDLIBRARY='libpython$(VERSION).so'
888 BLDLIBRARY='-L. -lpython$(VERSION)'
889 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
890 case $ac_sys_system in
891 FreeBSD*)
892 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
893 ;;
894 esac
895 INSTSONAME="$LDLIBRARY".$SOVERSION
896 ;;
897 hp*|HP*)
898 case `uname -m` in
899 ia64)
900 LDLIBRARY='libpython$(VERSION).so'
901 ;;
902 *)
903 LDLIBRARY='libpython$(VERSION).sl'
904 ;;
905 esac
906 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
907 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
908 ;;
909 OSF*)
910 LDLIBRARY='libpython$(VERSION).so'
911 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
912 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
913 ;;
914 atheos*)
915 LDLIBRARY='libpython$(VERSION).so'
916 BLDLIBRARY='-L. -lpython$(VERSION)'
917 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
918 ;;
919 Darwin*)
920 LDLIBRARY='libpython$(VERSION).dylib'
921 BLDLIBRARY='-L. -lpython$(VERSION)'
922 RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
923 ;;
924 AIX*)
925 LDLIBRARY='libpython$(VERSION).so'
926 RUNSHARED=LIBPATH=`pwd`:${LIBPATH}
927 ;;
928
929 esac
930else # shared is disabled
931 case $ac_sys_system in
932 CYGWIN*)
933 BLDLIBRARY='$(LIBRARY)'
934 LDLIBRARY='libpython$(VERSION).dll.a'
935 ;;
936 esac
937fi
938
939if test "$cross_compiling" = yes; then
940 RUNSHARED=
941fi
942
943AC_MSG_RESULT($LDLIBRARY)
944
945AC_PROG_RANLIB
946AC_SUBST(AR)
947AC_CHECK_TOOLS(AR, ar aal, ar)
948
949# tweak ARFLAGS only if the user didn't set it on the command line
950AC_SUBST(ARFLAGS)
951if test -z "$ARFLAGS"
952then
953 ARFLAGS="rc"
954fi
955
956AC_SUBST(SVNVERSION)
957AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
958if test $SVNVERSION = found
959then
960 SVNVERSION="svnversion \$(srcdir)"
961else
962 SVNVERSION="echo Unversioned directory"
963fi
964
965AC_SUBST(BASECPPFLAGS)
966if test "$abs_srcdir" != "$abs_builddir"; then
967 # If we're building out-of-tree make sure Include (in the current dir)
968 # gets picked up before its $srcdir counterpart in order for Python-ast.h
969 # and graminit.h to get picked up from the correct directory.
970 # (A side effect of this is that these resources will automatically be
971 # regenerated when building out-of-tree, regardless of whether or not
972 # the $srcdir counterpart is up-to-date. This is an acceptable trade
973 # off.)
974 BASECPPFLAGS="-IInclude"
975else
976 BASECPPFLAGS=""
977fi
978
979AC_SUBST(HGVERSION)
980AC_SUBST(HGTAG)
981AC_SUBST(HGBRANCH)
982AC_CHECK_PROG(HAS_HG, hg, found, not-found)
983if test $HAS_HG = found
984then
985 HGVERSION="hg id -i \$(srcdir)"
986 HGTAG="hg id -t \$(srcdir)"
987 HGBRANCH="hg id -b \$(srcdir)"
988else
989 HGVERSION=""
990 HGTAG=""
991 HGBRANCH=""
992fi
993
994case $MACHDEP in
995bsdos*|hp*|HP*)
996 # install -d does not work on BSDI or HP-UX
997 if test -z "$INSTALL"
998 then
999 INSTALL="${srcdir}/install-sh -c"
1000 fi
1001esac
1002AC_PROG_INSTALL
1003AC_PROG_MKDIR_P
1004
1005# Not every filesystem supports hard links
1006AC_SUBST(LN)
1007if test -z "$LN" ; then
1008 case $ac_sys_system in
1009 BeOS*) LN="ln -s";;
1010 CYGWIN*) LN="ln -s";;
1011 atheos*) LN="ln -s";;
1012 *) LN=ln;;
1013 esac
1014fi
1015
1016# Check for --with-pydebug
1017AC_MSG_CHECKING(for --with-pydebug)
1018AC_ARG_WITH(pydebug,
1019 AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]),
1020[
1021if test "$withval" != no
1022then
1023 AC_DEFINE(Py_DEBUG, 1,
1024 [Define if you want to build an interpreter with many run-time checks.])
1025 AC_MSG_RESULT(yes);
1026 Py_DEBUG='true'
1027else AC_MSG_RESULT(no); Py_DEBUG='false'
1028fi],
1029[AC_MSG_RESULT(no)])
1030
1031# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
1032# merged with this chunk of code?
1033
1034# Optimizer/debugger flags
1035# ------------------------
1036# (The following bit of code is complicated enough - please keep things
1037# indented properly. Just pretend you're editing Python code. ;-)
1038
1039# There are two parallel sets of case statements below, one that checks to
1040# see if OPT was set and one that does BASECFLAGS setting based upon
1041# compiler and platform. BASECFLAGS tweaks need to be made even if the
1042# user set OPT.
1043
1044# tweak OPT based on compiler and platform, only if the user didn't set
1045# it on the command line
1046AC_SUBST(OPT)
1047if test "${OPT-unset}" = "unset"
1048then
1049 case $GCC in
1050 yes)
1051 if test "$CC" != 'g++' ; then
1052 STRICT_PROTO="-Wstrict-prototypes"
1053 fi
1054 # For gcc 4.x we need to use -fwrapv so lets check if its supported
1055 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
1056 WRAP="-fwrapv"
1057 fi
1058
1059 # Clang also needs -fwrapv
1060 case $CC in
1061 *clang*) WRAP="-fwrapv"
1062 ;;
1063 esac
1064
1065 case $ac_cv_prog_cc_g in
1066 yes)
1067 if test "$Py_DEBUG" = 'true' ; then
1068 # Optimization messes up debuggers, so turn it off for
1069 # debug builds.
1070 OPT="-g -O0 -Wall $STRICT_PROTO"
1071 else
1072 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
1073 fi
1074 ;;
1075 *)
1076 OPT="-O3 -Wall $STRICT_PROTO"
1077 ;;
1078 esac
1079 case $ac_sys_system in
1080 SCO_SV*) OPT="$OPT -m486 -DSCO5"
1081 ;;
1082 esac
1083 ;;
1084
1085 *)
1086 OPT="-O"
1087 ;;
1088 esac
1089fi
1090
1091AC_SUBST(BASECFLAGS)
1092
1093# The -arch flags for universal builds on OSX
1094UNIVERSAL_ARCH_FLAGS=
1095AC_SUBST(UNIVERSAL_ARCH_FLAGS)
1096
1097# tweak BASECFLAGS based on compiler and platform
1098case $GCC in
1099yes)
1100 # Python violates C99 rules, by casting between incompatible
1101 # pointer types. GCC may generate bad code as a result of that,
1102 # so use -fno-strict-aliasing if supported.
1103 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
1104 ac_save_cc="$CC"
1105 CC="$CC -fno-strict-aliasing"
1106 AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
1107 AC_COMPILE_IFELSE(
1108 [AC_LANG_PROGRAM([[]], [[]])],
1109 [ac_cv_no_strict_aliasing_ok=yes],
1110 [ac_cv_no_strict_aliasing_ok=no]))
1111 CC="$ac_save_cc"
1112 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
1113 if test $ac_cv_no_strict_aliasing_ok = yes
1114 then
1115 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
1116 fi
1117
1118 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
1119 # support. Without this, treatment of subnormals doesn't follow
1120 # the standard.
1121 case $host in
1122 alpha*)
1123 BASECFLAGS="$BASECFLAGS -mieee"
1124 ;;
1125 esac
1126
1127 case $ac_sys_system in
1128 SCO_SV*)
1129 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
1130 ;;
1131 # is there any other compiler on Darwin besides gcc?
1132 Darwin*)
1133 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
1134 # used to be here, but non-Apple gcc doesn't accept them.
1135 if test "${CC}" = gcc
1136 then
1137 AC_MSG_CHECKING(which compiler should be used)
1138 case "${UNIVERSALSDK}" in
1139 */MacOSX10.4u.sdk)
1140 # Build using 10.4 SDK, force usage of gcc when the
1141 # compiler is gcc, otherwise the user will get very
1142 # confusing error messages when building on OSX 10.6
1143 CC=gcc-4.0
1144 CPP=cpp-4.0
1145 ;;
1146 esac
1147 AC_MSG_RESULT($CC)
1148 fi
1149
1150 # Calculate the right deployment target for this build.
1151 #
1152 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
1153 if test ${cur_target} '>' 10.2; then
1154 cur_target=10.3
1155 if test ${enable_universalsdk}; then
1156 if test "${UNIVERSAL_ARCHS}" = "all"; then
1157 # Ensure that the default platform for a
1158 # 4-way universal build is OSX 10.5,
1159 # that's the first OS release where
1160 # 4-way builds make sense.
1161 cur_target='10.5'
1162
1163 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
1164 cur_target='10.5'
1165
1166 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
1167 cur_target='10.5'
1168
1169 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
1170 cur_target='10.5'
1171 fi
1172 else
1173 if test `/usr/bin/arch` = "i386"; then
1174 # On Intel macs default to a deployment
1175 # target of 10.4, that's the first OSX
1176 # release with Intel support.
1177 cur_target="10.4"
1178 fi
1179 fi
1180 fi
1181 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1182
1183 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1184 # environment with a value that is the same as what we'll use
1185 # in the Makefile to ensure that we'll get the same compiler
1186 # environment during configure and build time.
1187 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1188 export MACOSX_DEPLOYMENT_TARGET
1189 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1190
1191 if test "${enable_universalsdk}"; then
1192 UNIVERSAL_ARCH_FLAGS=""
1193 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
1194 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
1195 ARCH_RUN_32BIT=""
1196 LIPO_32BIT_FLAGS=""
1197
1198 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
1199 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
1200 LIPO_32BIT_FLAGS=""
1201 ARCH_RUN_32BIT="true"
1202
1203 elif test "$UNIVERSAL_ARCHS" = "all" ; then
1204 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
1205 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
1206 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
1207
1208 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
1209 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
1210 LIPO_32BIT_FLAGS="-extract i386"
1211 ARCH_RUN_32BIT="/usr/bin/arch -i386"
1212
1213 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
1214 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
1215 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
1216 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
1217
1218 else
1219 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
1220
1221 fi
1222
1223
1224 CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
1225 if test "${UNIVERSALSDK}" != "/"
1226 then
1227 CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
1228 LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1229 CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
1230 fi
1231
1232 fi
1233
1234
1235 ;;
1236 OSF*)
1237 BASECFLAGS="$BASECFLAGS -mieee"
1238 ;;
1239 esac
1240 ;;
1241
1242*)
1243 case $ac_sys_system in
1244 OpenUNIX*|UnixWare*)
1245 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1246 ;;
1247 OSF*)
1248 BASECFLAGS="$BASECFLAGS -ieee -std"
1249 ;;
1250 SCO_SV*)
1251 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1252 ;;
1253 esac
1254 ;;
1255esac
1256
1257if test "$Py_DEBUG" = 'true'; then
1258 :
1259else
1260 OPT="-DNDEBUG $OPT"
1261fi
1262
1263if test "$ac_arch_flags"
1264then
1265 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
1266fi
1267
1268# disable check for icc since it seems to pass, but generates a warning
1269if test "$CC" = icc
1270then
1271 ac_cv_opt_olimit_ok=no
1272fi
1273
1274AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1275AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1276[ac_save_cc="$CC"
1277CC="$CC -OPT:Olimit=0"
1278AC_COMPILE_IFELSE(
1279 [AC_LANG_PROGRAM([[]], [[]])],
1280 [ac_cv_opt_olimit_ok=yes],
1281 [ac_cv_opt_olimit_ok=no]
1282 )
1283CC="$ac_save_cc"])
1284AC_MSG_RESULT($ac_cv_opt_olimit_ok)
1285if test $ac_cv_opt_olimit_ok = yes; then
1286 case $ac_sys_system in
1287 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1288 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1289 # environment?
1290 Darwin*)
1291 ;;
1292 # XXX thankfully this useless troublemaker of a flag has been
1293 # eradicated in the 3.x line. For now, make sure it isn't picked
1294 # up by any of our other platforms that use CC.
1295 AIX*|SunOS*|HP-UX*|IRIX*)
1296 ;;
1297 *)
1298 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1299 ;;
1300 esac
1301else
1302 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1303 AC_CACHE_VAL(ac_cv_olimit_ok,
1304 [ac_save_cc="$CC"
1305 CC="$CC -Olimit 1500"
1306 AC_COMPILE_IFELSE(
1307 [AC_LANG_PROGRAM([[]], [[]])],
1308 [ac_cv_olimit_ok=yes],
1309 [ac_cv_olimit_ok=no]
1310 )
1311 CC="$ac_save_cc"])
1312 AC_MSG_RESULT($ac_cv_olimit_ok)
1313 if test $ac_cv_olimit_ok = yes; then
1314 case $ac_sys_system in
1315 # Issue #16534: On HP-UX ac_cv_olimit_ok=yes is a false positive.
1316 HP-UX*)
1317 ;;
1318 *)
1319 BASECFLAGS="$BASECFLAGS -Olimit 1500"
1320 ;;
1321 esac
1322 fi
1323fi
1324
1325# Check whether GCC supports PyArg_ParseTuple format
1326if test "$GCC" = "yes"
1327then
1328 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1329 save_CFLAGS=$CFLAGS
1330 CFLAGS="$CFLAGS -Werror -Wformat"
1331 AC_COMPILE_IFELSE([
1332 AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
1333 ],[
1334 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1,
1335 [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1336 AC_MSG_RESULT(yes)
1337 ],[
1338 AC_MSG_RESULT(no)
1339 ])
1340 CFLAGS=$save_CFLAGS
1341fi
1342
1343# On some compilers, pthreads are available without further options
1344# (e.g. MacOS X). On some of these systems, the compiler will not
1345# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1346# So we have to see first whether pthreads are available without
1347# options before we can check whether -Kpthread improves anything.
1348AC_MSG_CHECKING(whether pthreads are available without options)
1349AC_CACHE_VAL(ac_cv_pthread_is_default,
1350[AC_RUN_IFELSE([AC_LANG_SOURCE([[
1351#include <stdio.h>
1352#include <pthread.h>
1353
1354void* routine(void* p){return NULL;}
1355
1356int main(){
1357 pthread_t p;
1358 if(pthread_create(&p,NULL,routine,NULL)!=0)
1359 return 1;
1360 (void)pthread_detach(p);
1361 return 0;
1362}
1363]])],[
1364 ac_cv_pthread_is_default=yes
1365 ac_cv_kthread=no
1366 ac_cv_pthread=no
1367],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no])
1368])
1369AC_MSG_RESULT($ac_cv_pthread_is_default)
1370
1371
1372if test $ac_cv_pthread_is_default = yes
1373then
1374 ac_cv_kpthread=no
1375else
1376# -Kpthread, if available, provides the right #defines
1377# and linker options to make pthread_create available
1378# Some compilers won't report that they do not support -Kpthread,
1379# so we need to run a program to see whether it really made the
1380# function available.
1381AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1382AC_CACHE_VAL(ac_cv_kpthread,
1383[ac_save_cc="$CC"
1384CC="$CC -Kpthread"
1385AC_RUN_IFELSE([AC_LANG_SOURCE([[
1386#include <stdio.h>
1387#include <pthread.h>
1388
1389void* routine(void* p){return NULL;}
1390
1391int main(){
1392 pthread_t p;
1393 if(pthread_create(&p,NULL,routine,NULL)!=0)
1394 return 1;
1395 (void)pthread_detach(p);
1396 return 0;
1397}
1398]])],[ac_cv_kpthread=yes],[ac_cv_kpthread=no],[ac_cv_kpthread=no])
1399CC="$ac_save_cc"])
1400AC_MSG_RESULT($ac_cv_kpthread)
1401fi
1402
1403if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
1404then
1405# -Kthread, if available, provides the right #defines
1406# and linker options to make pthread_create available
1407# Some compilers won't report that they do not support -Kthread,
1408# so we need to run a program to see whether it really made the
1409# function available.
1410AC_MSG_CHECKING(whether $CC accepts -Kthread)
1411AC_CACHE_VAL(ac_cv_kthread,
1412[ac_save_cc="$CC"
1413CC="$CC -Kthread"
1414AC_RUN_IFELSE([AC_LANG_SOURCE([[
1415#include <stdio.h>
1416#include <pthread.h>
1417
1418void* routine(void* p){return NULL;}
1419
1420int main(){
1421 pthread_t p;
1422 if(pthread_create(&p,NULL,routine,NULL)!=0)
1423 return 1;
1424 (void)pthread_detach(p);
1425 return 0;
1426}
1427]])],[ac_cv_kthread=yes],[ac_cv_kthread=no],[ac_cv_kthread=no])
1428CC="$ac_save_cc"])
1429AC_MSG_RESULT($ac_cv_kthread)
1430fi
1431
1432if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
1433then
1434# -pthread, if available, provides the right #defines
1435# and linker options to make pthread_create available
1436# Some compilers won't report that they do not support -pthread,
1437# so we need to run a program to see whether it really made the
1438# function available.
1439AC_MSG_CHECKING(whether $CC accepts -pthread)
1440AC_CACHE_VAL(ac_cv_pthread,
1441[ac_save_cc="$CC"
1442CC="$CC -pthread"
1443AC_RUN_IFELSE([AC_LANG_SOURCE([[
1444#include <stdio.h>
1445#include <pthread.h>
1446
1447void* routine(void* p){return NULL;}
1448
1449int main(){
1450 pthread_t p;
1451 if(pthread_create(&p,NULL,routine,NULL)!=0)
1452 return 1;
1453 (void)pthread_detach(p);
1454 return 0;
1455}
1456]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
1457CC="$ac_save_cc"])
1458AC_MSG_RESULT($ac_cv_pthread)
1459fi
1460
1461# If we have set a CC compiler flag for thread support then
1462# check if it works for CXX, too.
1463ac_cv_cxx_thread=no
1464if test ! -z "$CXX"
1465then
1466AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1467ac_save_cxx="$CXX"
1468
1469if test "$ac_cv_kpthread" = "yes"
1470then
1471 CXX="$CXX -Kpthread"
1472 ac_cv_cxx_thread=yes
1473elif test "$ac_cv_kthread" = "yes"
1474then
1475 CXX="$CXX -Kthread"
1476 ac_cv_cxx_thread=yes
1477elif test "$ac_cv_pthread" = "yes"
1478then
1479 CXX="$CXX -pthread"
1480 ac_cv_cxx_thread=yes
1481fi
1482
1483if test $ac_cv_cxx_thread = yes
1484then
1485 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1486 $CXX -c conftest.$ac_ext 2>&5
1487 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1488 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1489 then
1490 ac_cv_cxx_thread=yes
1491 else
1492 ac_cv_cxx_thread=no
1493 fi
1494 rm -fr conftest*
1495fi
1496AC_MSG_RESULT($ac_cv_cxx_thread)
1497fi
1498CXX="$ac_save_cxx"
1499
1500dnl # check for ANSI or K&R ("traditional") preprocessor
1501dnl AC_MSG_CHECKING(for C preprocessor type)
1502dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1503dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1504dnl int foo;
1505dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1506dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional])
1507dnl AC_MSG_RESULT($cpp_type)
1508
1509# checks for header files
1510AC_HEADER_STDC
1511AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1512fcntl.h grp.h \
1513ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
1514shadow.h signal.h stdint.h stropts.h termios.h thread.h \
1515unistd.h utime.h \
1516sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1517sys/lock.h sys/mkdev.h sys/modem.h \
1518sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
1519sys/termio.h sys/time.h \
1520sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
1521sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1522bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h)
1523AC_HEADER_DIRENT
1524AC_HEADER_MAJOR
1525
1526# On Solaris, term.h requires curses.h
1527AC_CHECK_HEADERS(term.h,,,[
1528#ifdef HAVE_CURSES_H
1529#include <curses.h>
1530#endif
1531])
1532
1533# On Linux, netlink.h requires asm/types.h
1534AC_CHECK_HEADERS(linux/netlink.h,,,[
1535#ifdef HAVE_ASM_TYPES_H
1536#include <asm/types.h>
1537#endif
1538#ifdef HAVE_SYS_SOCKET_H
1539#include <sys/socket.h>
1540#endif
1541])
1542
1543# checks for typedefs
1544was_it_defined=no
1545AC_MSG_CHECKING(for clock_t in time.h)
1546AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1547 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1548])
1549AC_MSG_RESULT($was_it_defined)
1550
1551# Check whether using makedev requires defining _OSF_SOURCE
1552AC_MSG_CHECKING(for makedev)
1553AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1554#if defined(MAJOR_IN_MKDEV)
1555#include <sys/mkdev.h>
1556#elif defined(MAJOR_IN_SYSMACROS)
1557#include <sys/sysmacros.h>
1558#else
1559#include <sys/types.h>
1560#endif ]], [[ makedev(0, 0) ]])],
1561[ac_cv_has_makedev=yes],
1562[ac_cv_has_makedev=no])
1563if test "$ac_cv_has_makedev" = "no"; then
1564 # we didn't link, try if _OSF_SOURCE will allow us to link
1565 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1566#define _OSF_SOURCE 1
1567#include <sys/types.h>
1568 ]], [[ makedev(0, 0) ]])],
1569[ac_cv_has_makedev=yes],
1570[ac_cv_has_makedev=no])
1571 if test "$ac_cv_has_makedev" = "yes"; then
1572 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1573 fi
1574fi
1575AC_MSG_RESULT($ac_cv_has_makedev)
1576if test "$ac_cv_has_makedev" = "yes"; then
1577 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1578fi
1579
1580# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1581# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1582# defined, but the compiler does not support pragma redefine_extname,
1583# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1584# structures (such as rlimit64) without declaring them. As a
1585# work-around, disable LFS on such configurations
1586
1587use_lfs=yes
1588AC_MSG_CHECKING(Solaris LFS bug)
1589AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1590#define _LARGEFILE_SOURCE 1
1591#define _FILE_OFFSET_BITS 64
1592#include <sys/resource.h>
1593]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes])
1594AC_MSG_RESULT($sol_lfs_bug)
1595if test "$sol_lfs_bug" = "yes"; then
1596 use_lfs=no
1597fi
1598
1599if test "$use_lfs" = "yes"; then
1600# Two defines needed to enable largefile support on various platforms
1601# These may affect some typedefs
1602case $ac_sys_system/$ac_sys_release in
1603AIX*)
1604 AC_DEFINE(_LARGE_FILES, 1,
1605 [This must be defined on AIX systems to enable large file support.])
1606 ;;
1607esac
1608AC_DEFINE(_LARGEFILE_SOURCE, 1,
1609[This must be defined on some systems to enable large file support.])
1610AC_DEFINE(_FILE_OFFSET_BITS, 64,
1611[This must be set to 64 on some systems to enable large file support.])
1612fi
1613
1614# Add some code to confdefs.h so that the test for off_t works on SCO
1615cat >> confdefs.h <<\EOF
1616#if defined(SCO_DS)
1617#undef _OFF_T
1618#endif
1619EOF
1620
1621# Type availability checks
1622AC_TYPE_MODE_T
1623AC_TYPE_OFF_T
1624AC_TYPE_PID_T
1625AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
1626AC_TYPE_SIZE_T
1627AC_TYPE_UID_T
1628
1629# There are two separate checks for each of the exact-width integer types we
1630# need. First we check whether the type is available using the usual
1631# AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h>
1632# and <stdint.h> where available). We then also use the special type checks of
1633# the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available
1634# directly, #define's uint32_t to be a suitable type.
1635
1636AC_CHECK_TYPE(uint32_t,
1637 AC_DEFINE(HAVE_UINT32_T, 1, [Define if your compiler provides uint32_t.]),,)
1638AC_TYPE_UINT32_T
1639
1640AC_CHECK_TYPE(uint64_t,
1641 AC_DEFINE(HAVE_UINT64_T, 1, [Define if your compiler provides uint64_t.]),,)
1642AC_TYPE_UINT64_T
1643
1644AC_CHECK_TYPE(int32_t,
1645 AC_DEFINE(HAVE_INT32_T, 1, [Define if your compiler provides int32_t.]),,)
1646AC_TYPE_INT32_T
1647
1648AC_CHECK_TYPE(int64_t,
1649 AC_DEFINE(HAVE_INT64_T, 1, [Define if your compiler provides int64_t.]),,)
1650AC_TYPE_INT64_T
1651
1652AC_CHECK_TYPE(ssize_t,
1653 AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
1654
1655# Sizes of various common basic types
1656# ANSI C requires sizeof(char) == 1, so no need to check it
1657AC_CHECK_SIZEOF(int, 4)
1658AC_CHECK_SIZEOF(long, 4)
1659AC_CHECK_SIZEOF(void *, 4)
1660AC_CHECK_SIZEOF(short, 2)
1661AC_CHECK_SIZEOF(float, 4)
1662AC_CHECK_SIZEOF(double, 8)
1663AC_CHECK_SIZEOF(fpos_t, 4)
1664AC_CHECK_SIZEOF(size_t, 4)
1665AC_CHECK_SIZEOF(pid_t, 4)
1666
1667AC_MSG_CHECKING(for long long support)
1668have_long_long=no
1669AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
1670 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1671 have_long_long=yes
1672],[])
1673AC_MSG_RESULT($have_long_long)
1674if test "$have_long_long" = yes ; then
1675AC_CHECK_SIZEOF(long long, 8)
1676fi
1677
1678AC_MSG_CHECKING(for long double support)
1679have_long_double=no
1680AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
1681 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1682 have_long_double=yes
1683],[])
1684AC_MSG_RESULT($have_long_double)
1685if test "$have_long_double" = yes ; then
1686AC_CHECK_SIZEOF(long double, 12)
1687fi
1688
1689AC_MSG_CHECKING(for _Bool support)
1690have_c99_bool=no
1691AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Bool x; x = (_Bool)0;]])],[
1692 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1693 have_c99_bool=yes
1694],[])
1695AC_MSG_RESULT($have_c99_bool)
1696if test "$have_c99_bool" = yes ; then
1697AC_CHECK_SIZEOF(_Bool, 1)
1698fi
1699
1700AC_CHECK_TYPES(uintptr_t,
1701 [AC_CHECK_SIZEOF(uintptr_t, 4)],
1702 [], [#ifdef HAVE_STDINT_H
1703 #include <stdint.h>
1704 #endif
1705 #ifdef HAVE_INTTYPES_H
1706 #include <inttypes.h>
1707 #endif])
1708
1709AC_CHECK_SIZEOF(off_t, [], [
1710#ifdef HAVE_SYS_TYPES_H
1711#include <sys/types.h>
1712#endif
1713])
1714
1715AC_MSG_CHECKING(whether to enable large file support)
1716if test "$have_long_long" = yes
1717then
1718if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1719 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1720 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1721 [Defined to enable large file support when an off_t is bigger than a long
1722 and long long is available and at least as big as an off_t. You may need
1723 to add some flags for configuration and compilation to enable this mode.
1724 (For Solaris and Linux, the necessary defines are already defined.)])
1725 AC_MSG_RESULT(yes)
1726else
1727 AC_MSG_RESULT(no)
1728fi
1729else
1730 AC_MSG_RESULT(no)
1731fi
1732
1733AC_CHECK_SIZEOF(time_t, [], [
1734#ifdef HAVE_SYS_TYPES_H
1735#include <sys/types.h>
1736#endif
1737#ifdef HAVE_TIME_H
1738#include <time.h>
1739#endif
1740])
1741
1742# if have pthread_t then define SIZEOF_PTHREAD_T
1743ac_save_cc="$CC"
1744if test "$ac_cv_kpthread" = "yes"
1745then CC="$CC -Kpthread"
1746elif test "$ac_cv_kthread" = "yes"
1747then CC="$CC -Kthread"
1748elif test "$ac_cv_pthread" = "yes"
1749then CC="$CC -pthread"
1750fi
1751AC_MSG_CHECKING(for pthread_t)
1752have_pthread_t=no
1753AC_COMPILE_IFELSE([
1754 AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
1755],[have_pthread_t=yes],[])
1756AC_MSG_RESULT($have_pthread_t)
1757if test "$have_pthread_t" = yes ; then
1758 AC_CHECK_SIZEOF(pthread_t, [], [
1759#ifdef HAVE_PTHREAD_H
1760#include <pthread.h>
1761#endif
1762 ])
1763fi
1764CC="$ac_save_cc"
1765
1766AC_MSG_CHECKING(for --enable-toolbox-glue)
1767AC_ARG_ENABLE(toolbox-glue,
1768 AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions]))
1769
1770if test -z "$enable_toolbox_glue"
1771then
1772 case $ac_sys_system/$ac_sys_release in
1773 Darwin/*)
1774 enable_toolbox_glue="yes";;
1775 *)
1776 enable_toolbox_glue="no";;
1777 esac
1778fi
1779case "$enable_toolbox_glue" in
1780yes)
1781 extra_machdep_objs="Python/mactoolboxglue.o"
1782 extra_undefs="-u _PyMac_Error"
1783 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1784 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
1785 ;;
1786*)
1787 extra_machdep_objs=""
1788 extra_undefs=""
1789 ;;
1790esac
1791AC_MSG_RESULT($enable_toolbox_glue)
1792
1793
1794AC_SUBST(OTHER_LIBTOOL_OPT)
1795case $ac_sys_system/$ac_sys_release in
1796 Darwin/@<:@01567@:>@\..*)
1797 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1798 ;;
1799 Darwin/*)
1800 OTHER_LIBTOOL_OPT=""
1801 ;;
1802esac
1803
1804
1805AC_SUBST(LIBTOOL_CRUFT)
1806case $ac_sys_system/$ac_sys_release in
1807 Darwin/@<:@01567@:>@\..*)
1808 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1809 if test "${enable_universalsdk}"; then
1810 :
1811 else
1812 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
1813 fi
1814 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1815 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1816 Darwin/*)
1817 gcc_version=`gcc -dumpversion`
1818 if test ${gcc_version} '<' 4.0
1819 then
1820 LIBTOOL_CRUFT="-lcc_dynamic"
1821 else
1822 LIBTOOL_CRUFT=""
1823 fi
1824 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1825 #include <unistd.h>
1826 int main(int argc, char*argv[])
1827 {
1828 if (sizeof(long) == 4) {
1829 return 0;
1830 } else {
1831 return 1;
1832 }
1833 }
1834 ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
1835
1836 if test "${ac_osx_32bit}" = "yes"; then
1837 case `/usr/bin/arch` in
1838 i386)
1839 MACOSX_DEFAULT_ARCH="i386"
1840 ;;
1841 ppc)
1842 MACOSX_DEFAULT_ARCH="ppc"
1843 ;;
1844 *)
1845 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1846 ;;
1847 esac
1848 else
1849 case `/usr/bin/arch` in
1850 i386)
1851 MACOSX_DEFAULT_ARCH="x86_64"
1852 ;;
1853 ppc)
1854 MACOSX_DEFAULT_ARCH="ppc64"
1855 ;;
1856 *)
1857 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1858 ;;
1859 esac
1860
1861 #ARCH_RUN_32BIT="true"
1862 fi
1863
1864 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
1865 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1866 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1867esac
1868
1869AC_MSG_CHECKING(for --enable-framework)
1870if test "$enable_framework"
1871then
1872 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
1873 # -F. is needed to allow linking to the framework while
1874 # in the build location.
1875 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1876 [Define if you want to produce an OpenStep/Rhapsody framework
1877 (shared library plus accessory files).])
1878 AC_MSG_RESULT(yes)
1879 if test $enable_shared = "yes"
1880 then
1881 AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.])
1882 fi
1883else
1884 AC_MSG_RESULT(no)
1885fi
1886
1887AC_MSG_CHECKING(for dyld)
1888case $ac_sys_system/$ac_sys_release in
1889 Darwin/*)
1890 AC_DEFINE(WITH_DYLD, 1,
1891 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1892 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1893 linker (rld). Dyld is necessary to support frameworks.])
1894 AC_MSG_RESULT(always on for Darwin)
1895 ;;
1896 *)
1897 AC_MSG_RESULT(no)
1898 ;;
1899esac
1900
1901# Set info about shared libraries.
1902AC_SUBST(SO)
1903AC_SUBST(LDSHARED)
1904AC_SUBST(LDCXXSHARED)
1905AC_SUBST(BLDSHARED)
1906AC_SUBST(CCSHARED)
1907AC_SUBST(LINKFORSHARED)
1908# SO is the extension of shared libraries `(including the dot!)
1909# -- usually .so, .sl on HP-UX, .dll on Cygwin
1910AC_MSG_CHECKING(SO)
1911if test -z "$SO"
1912then
1913 case $ac_sys_system in
1914 hp*|HP*)
1915 case `uname -m` in
1916 ia64) SO=.so;;
1917 *) SO=.sl;;
1918 esac
1919 ;;
1920 CYGWIN*) SO=.dll;;
1921 *) SO=.so;;
1922 esac
1923else
1924 # this might also be a termcap variable, see #610332
1925 echo
1926 echo '====================================================================='
1927 echo '+ +'
1928 echo '+ WARNING: You have set SO in your environment. +'
1929 echo '+ Do you really mean to change the extension for shared libraries? +'
1930 echo '+ Continuing in 10 seconds to let you to ponder. +'
1931 echo '+ +'
1932 echo '====================================================================='
1933 sleep 10
1934fi
1935AC_MSG_RESULT($SO)
1936
1937AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
1938# LDSHARED is the ld *command* used to create shared library
1939# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
1940# (Shared libraries in this instance are shared modules to be loaded into
1941# Python, as opposed to building Python itself as a shared library.)
1942AC_MSG_CHECKING(LDSHARED)
1943if test -z "$LDSHARED"
1944then
1945 case $ac_sys_system/$ac_sys_release in
1946 AIX*)
1947 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
1948 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
1949 ;;
1950 BeOS*)
1951 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
1952 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
1953 ;;
1954 IRIX/5*) LDSHARED="ld -shared";;
1955 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1956 SunOS/5*)
1957 if test "$GCC" = "yes" ; then
1958 LDSHARED='$(CC) -shared'
1959 LDCXXSHARED='$(CXX) -shared'
1960 else
1961 LDSHARED='$(CC) -G'
1962 LDCXXSHARED='$(CXX) -G'
1963 fi ;;
1964 hp*|HP*)
1965 if test "$GCC" = "yes" ; then
1966 LDSHARED='$(CC) -shared'
1967 LDCXXSHARED='$(CXX) -shared'
1968 else
1969 LDSHARED='ld -b'
1970 fi ;;
1971 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1972 Darwin/1.3*)
1973 LDSHARED='$(CC) -bundle'
1974 LDCXXSHARED='$(CXX) -bundle'
1975 if test "$enable_framework" ; then
1976 # Link against the framework. All externals should be defined.
1977 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1978 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1979 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1980 else
1981 # No framework. Ignore undefined symbols, assuming they come from Python
1982 LDSHARED="$LDSHARED -undefined suppress"
1983 LDCXXSHARED="$LDCXXSHARED -undefined suppress"
1984 fi ;;
1985 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
1986 LDSHARED='$(CC) -bundle'
1987 LDCXXSHARED='$(CXX) -bundle'
1988 if test "$enable_framework" ; then
1989 # Link against the framework. All externals should be defined.
1990 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1991 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1992 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1993 else
1994 # No framework, use the Python app as bundle-loader
1995 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1996 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1997 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1998 fi ;;
1999 Darwin/*)
2000 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
2001 # This allows an extension to be used in any Python
2002
2003 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
2004 then
2005 if test "${enable_universalsdk}"; then
2006 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
2007 fi
2008 LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
2009 LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
2010 BLDSHARED="$LDSHARED"
2011 else
2012 LDSHARED='$(CC) -bundle'
2013 LDCXXSHARED='$(CXX) -bundle'
2014 if test "$enable_framework" ; then
2015 # Link against the framework. All externals should be defined.
2016 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2017 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2018 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2019 else
2020 # No framework, use the Python app as bundle-loader
2021 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
2022 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
2023 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
2024 fi
2025 fi
2026 ;;
2027 Linux*|GNU*|QNX*)
2028 LDSHARED='$(CC) -shared'
2029 LDCXXSHARED='$(CXX) -shared';;
2030 BSD/OS*/4*)
2031 LDSHARED="gcc -shared"
2032 LDCXXSHARED="g++ -shared";;
2033 FreeBSD*)
2034 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
2035 then
2036 LDSHARED='$(CC) -shared'
2037 LDCXXSHARED='$(CXX) -shared'
2038 else
2039 LDSHARED="ld -Bshareable"
2040 fi;;
2041 OpenBSD*)
2042 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
2043 then
2044 LDSHARED='$(CC) -shared $(CCSHARED)'
2045 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
2046 else
2047 case `uname -r` in
2048 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
2049 LDSHARED="ld -Bshareable ${LDFLAGS}"
2050 ;;
2051 *)
2052 LDSHARED='$(CC) -shared $(CCSHARED)'
2053 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
2054 ;;
2055 esac
2056 fi;;
2057 NetBSD*|DragonFly*)
2058 LDSHARED='$(CC) -shared'
2059 LDCXXSHARED='$(CXX) -shared';;
2060 OpenUNIX*|UnixWare*)
2061 if test "$GCC" = "yes" ; then
2062 LDSHARED='$(CC) -shared'
2063 LDCXXSHARED='$(CXX) -shared'
2064 else
2065 LDSHARED='$(CC) -G'
2066 LDCXXSHARED='$(CXX) -G'
2067 fi;;
2068 SCO_SV*)
2069 LDSHARED='$(CC) -Wl,-G,-Bexport'
2070 LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
2071 CYGWIN*)
2072 LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
2073 LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
2074 atheos*)
2075 LDSHARED="gcc -shared"
2076 LDCXXSHARED="g++ -shared";;
2077 *) LDSHARED="ld";;
2078 esac
2079fi
2080AC_MSG_RESULT($LDSHARED)
2081LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
2082BLDSHARED=${BLDSHARED-$LDSHARED}
2083# CCSHARED are the C *flags* used to create objects to go into a shared
2084# library (module) -- this is only needed for a few systems
2085AC_MSG_CHECKING(CCSHARED)
2086if test -z "$CCSHARED"
2087then
2088 case $ac_sys_system/$ac_sys_release in
2089 SunOS*) if test "$GCC" = yes;
2090 then CCSHARED="-fPIC";
2091 elif test `uname -p` = sparc;
2092 then CCSHARED="-xcode=pic32";
2093 else CCSHARED="-Kpic";
2094 fi;;
2095 hp*|HP*) if test "$GCC" = yes;
2096 then CCSHARED="-fPIC";
2097 else CCSHARED="+z";
2098 fi;;
2099 Linux*|GNU*) CCSHARED="-fPIC";;
2100 BSD/OS*/4*) CCSHARED="-fpic";;
2101 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
2102 OpenUNIX*|UnixWare*)
2103 if test "$GCC" = "yes"
2104 then CCSHARED="-fPIC"
2105 else CCSHARED="-KPIC"
2106 fi;;
2107 SCO_SV*)
2108 if test "$GCC" = "yes"
2109 then CCSHARED="-fPIC"
2110 else CCSHARED="-Kpic -belf"
2111 fi;;
2112 IRIX*/6*) case $CC in
2113 *gcc*) CCSHARED="-shared";;
2114 *) CCSHARED="";;
2115 esac;;
2116 atheos*) CCSHARED="-fPIC";;
2117 esac
2118fi
2119AC_MSG_RESULT($CCSHARED)
2120# LINKFORSHARED are the flags passed to the $(CC) command that links
2121# the python executable -- this is only needed for a few systems
2122AC_MSG_CHECKING(LINKFORSHARED)
2123if test -z "$LINKFORSHARED"
2124then
2125 case $ac_sys_system/$ac_sys_release in
2126 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
2127 hp*|HP*)
2128 LINKFORSHARED="-Wl,-E -Wl,+s";;
2129# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
2130 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
2131 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
2132 # -u libsys_s pulls in all symbols in libsys
2133 Darwin/*)
2134 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
2135 # which is
2136 # not used by the core itself but which needs to be in the core so
2137 # that dynamically loaded extension modules have access to it.
2138 # -prebind is no longer used, because it actually seems to give a
2139 # slowdown in stead of a speedup, maybe due to the large number of
2140 # dynamic loads Python does.
2141
2142 LINKFORSHARED="$extra_undefs"
2143 if test "$enable_framework"
2144 then
2145 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2146 fi
2147 LINKFORSHARED="$LINKFORSHARED";;
2148 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
2149 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
2150 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
2151 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
2152 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
2153 then
2154 LINKFORSHARED="-Wl,--export-dynamic"
2155 fi;;
2156 SunOS/5*) case $CC in
2157 *gcc*)
2158 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
2159 then
2160 LINKFORSHARED="-Xlinker --export-dynamic"
2161 fi;;
2162 esac;;
2163 CYGWIN*)
2164 if test $enable_shared = "no"
2165 then
2166 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
2167 fi;;
2168 QNX*)
2169 # -Wl,-E causes the symbols to be added to the dynamic
2170 # symbol table so that they can be found when a module
2171 # is loaded. -N 2048K causes the stack size to be set
2172 # to 2048 kilobytes so that the stack doesn't overflow
2173 # when running test_compile.py.
2174 LINKFORSHARED='-Wl,-E -N 2048K';;
2175 esac
2176fi
2177AC_MSG_RESULT($LINKFORSHARED)
2178
2179
2180AC_SUBST(CFLAGSFORSHARED)
2181AC_MSG_CHECKING(CFLAGSFORSHARED)
2182if test ! "$LIBRARY" = "$LDLIBRARY"
2183then
2184 case $ac_sys_system in
2185 CYGWIN*)
2186 # Cygwin needs CCSHARED when building extension DLLs
2187 # but not when building the interpreter DLL.
2188 CFLAGSFORSHARED='';;
2189 *)
2190 CFLAGSFORSHARED='$(CCSHARED)'
2191 esac
2192fi
2193AC_MSG_RESULT($CFLAGSFORSHARED)
2194
2195# SHLIBS are libraries (except -lc and -lm) to link to the python shared
2196# library (with --enable-shared).
2197# For platforms on which shared libraries are not allowed to have unresolved
2198# symbols, this must be set to $(LIBS) (expanded by make). We do this even
2199# if it is not required, since it creates a dependency of the shared library
2200# to LIBS. This, in turn, means that applications linking the shared libpython
2201# don't need to link LIBS explicitly. The default should be only changed
2202# on systems where this approach causes problems.
2203AC_SUBST(SHLIBS)
2204AC_MSG_CHECKING(SHLIBS)
2205case "$ac_sys_system" in
2206 *)
2207 SHLIBS='$(LIBS)';;
2208esac
2209AC_MSG_RESULT($SHLIBS)
2210
2211
2212# checks for libraries
2213AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
2214AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
2215
2216# only check for sem_init if thread support is requested
2217if test "$with_threads" = "yes" -o -z "$with_threads"; then
2218 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
2219 # posix4 on Solaris 2.6
2220 # pthread (first!) on Linux
2221fi
2222
2223# check if we need libintl for locale functions
2224AC_CHECK_LIB(intl, textdomain,
2225 AC_DEFINE(WITH_LIBINTL, 1,
2226 [Define to 1 if libintl is needed for locale functions.]))
2227
2228# checks for system dependent C++ extensions support
2229case "$ac_sys_system" in
2230 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
2231 AC_LINK_IFELSE([
2232 AC_LANG_PROGRAM([[#include <load.h>]],
2233 [[loadAndInit("", 0, "")]])
2234 ],[
2235 AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
2236 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
2237 and you want support for AIX C++ shared extension modules.])
2238 AC_MSG_RESULT(yes)
2239 ],[
2240 AC_MSG_RESULT(no)
2241 ]);;
2242 *) ;;
2243esac
2244
2245# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
2246# BeOS' sockets are stashed in libnet.
2247AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
2248AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
2249
2250case "$ac_sys_system" in
2251BeOS*)
2252AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
2253;;
2254esac
2255
2256AC_MSG_CHECKING(for --with-libs)
2257AC_ARG_WITH(libs,
2258 AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
2259[
2260AC_MSG_RESULT($withval)
2261LIBS="$withval $LIBS"
2262],
2263[AC_MSG_RESULT(no)])
2264
2265AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2266
2267# Check for use of the system expat library
2268AC_MSG_CHECKING(for --with-system-expat)
2269AC_ARG_WITH(system_expat,
2270 AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
2271 [],
2272 [with_system_expat="no"])
2273
2274AC_MSG_RESULT($with_system_expat)
2275
2276# Check for use of the system libffi library
2277AC_MSG_CHECKING(for --with-system-ffi)
2278AC_ARG_WITH(system_ffi,
2279 AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),
2280 [],
2281 [with_system_ffi="no"])
2282
2283if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
2284 LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
2285else
2286 LIBFFI_INCLUDEDIR=""
2287fi
2288AC_SUBST(LIBFFI_INCLUDEDIR)
2289
2290AC_MSG_RESULT($with_system_ffi)
2291
2292# Check for --with-tcltk-includes=path and --with-tcltk-libs=path
2293AC_SUBST(TCLTK_INCLUDES)
2294AC_SUBST(TCLTK_LIBS)
2295AC_MSG_CHECKING(for --with-tcltk-includes)
2296AC_ARG_WITH(tcltk-includes,
2297 AS_HELP_STRING([--with-tcltk-includes='-I...'], [override search for Tcl and Tk include files]),
2298 [],
2299 [with_tcltk_includes="default"])
2300AC_MSG_RESULT($with_tcltk_includes)
2301AC_MSG_CHECKING(for --with-tcltk-libs)
2302AC_ARG_WITH(tcltk-libs,
2303 AS_HELP_STRING([--with-tcltk-libs='-L...'], [override search for Tcl and Tk libs]),
2304 [],
2305 [with_tcltk_libs="default"])
2306AC_MSG_RESULT($with_tcltk_libs)
2307if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault
2308then
2309 if test "x$with_tcltk_includes" != "x$with_tcltk_libs"
2310 then
2311 AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither])
2312 fi
2313 TCLTK_INCLUDES=""
2314 TCLTK_LIBS=""
2315else
2316 TCLTK_INCLUDES="$with_tcltk_includes"
2317 TCLTK_LIBS="$with_tcltk_libs"
2318fi
2319
2320# Check for --with-dbmliborder
2321AC_MSG_CHECKING(for --with-dbmliborder)
2322AC_ARG_WITH(dbmliborder,
2323 AS_HELP_STRING([--with-dbmliborder=db1:db2:...], [order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]),
2324[
2325if test x$with_dbmliborder = xyes
2326then
2327AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2328else
2329 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
2330 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
2331 then
2332 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2333 fi
2334 done
2335fi])
2336AC_MSG_RESULT($with_dbmliborder)
2337
2338# Determine if signalmodule should be used.
2339AC_SUBST(USE_SIGNAL_MODULE)
2340AC_SUBST(SIGNAL_OBJS)
2341AC_MSG_CHECKING(for --with-signal-module)
2342AC_ARG_WITH(signal-module,
2343 AS_HELP_STRING([--with-signal-module], [disable/enable signal module]))
2344
2345if test -z "$with_signal_module"
2346then with_signal_module="yes"
2347fi
2348AC_MSG_RESULT($with_signal_module)
2349
2350if test "${with_signal_module}" = "yes"; then
2351 USE_SIGNAL_MODULE=""
2352 SIGNAL_OBJS=""
2353else
2354 USE_SIGNAL_MODULE="#"
2355 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2356fi
2357
2358# This is used to generate Setup.config
2359AC_SUBST(USE_THREAD_MODULE)
2360USE_THREAD_MODULE=""
2361
2362AC_MSG_CHECKING(for --with-dec-threads)
2363AC_SUBST(LDLAST)
2364AC_ARG_WITH(dec-threads,
2365 AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]),
2366[
2367AC_MSG_RESULT($withval)
2368LDLAST=-threads
2369if test "${with_thread+set}" != set; then
2370 with_thread="$withval";
2371fi],
2372[AC_MSG_RESULT(no)])
2373
2374# Templates for things AC_DEFINEd more than once.
2375# For a single AC_DEFINE, no template is needed.
2376AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2377AH_TEMPLATE(_REENTRANT,
2378 [Define to force use of thread-safe errno, h_errno, and other functions])
2379AH_TEMPLATE(WITH_THREAD,
2380 [Define if you want to compile in rudimentary thread support])
2381
2382AC_MSG_CHECKING(for --with-threads)
2383dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2384AC_ARG_WITH(threads,
2385 AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support]))
2386
2387# --with-thread is deprecated, but check for it anyway
2388dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2389AC_ARG_WITH(thread,
2390 AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]),
2391 [with_threads=$with_thread])
2392
2393if test -z "$with_threads"
2394then with_threads="yes"
2395fi
2396AC_MSG_RESULT($with_threads)
2397
2398AC_SUBST(THREADOBJ)
2399if test "$with_threads" = "no"
2400then
2401 USE_THREAD_MODULE="#"
2402elif test "$ac_cv_pthread_is_default" = yes
2403then
2404 AC_DEFINE(WITH_THREAD)
2405 # Defining _REENTRANT on system with POSIX threads should not hurt.
2406 AC_DEFINE(_REENTRANT)
2407 posix_threads=yes
2408 THREADOBJ="Python/thread.o"
2409elif test "$ac_cv_kpthread" = "yes"
2410then
2411 CC="$CC -Kpthread"
2412 if test "$ac_cv_cxx_thread" = "yes"; then
2413 CXX="$CXX -Kpthread"
2414 fi
2415 AC_DEFINE(WITH_THREAD)
2416 posix_threads=yes
2417 THREADOBJ="Python/thread.o"
2418elif test "$ac_cv_kthread" = "yes"
2419then
2420 CC="$CC -Kthread"
2421 if test "$ac_cv_cxx_thread" = "yes"; then
2422 CXX="$CXX -Kthread"
2423 fi
2424 AC_DEFINE(WITH_THREAD)
2425 posix_threads=yes
2426 THREADOBJ="Python/thread.o"
2427elif test "$ac_cv_pthread" = "yes"
2428then
2429 CC="$CC -pthread"
2430 if test "$ac_cv_cxx_thread" = "yes"; then
2431 CXX="$CXX -pthread"
2432 fi
2433 AC_DEFINE(WITH_THREAD)
2434 posix_threads=yes
2435 THREADOBJ="Python/thread.o"
2436else
2437 if test ! -z "$with_threads" -a -d "$with_threads"
2438 then LDFLAGS="$LDFLAGS -L$with_threads"
2439 fi
2440 if test ! -z "$withval" -a -d "$withval"
2441 then LDFLAGS="$LDFLAGS -L$withval"
2442 fi
2443
2444 # According to the POSIX spec, a pthreads implementation must
2445 # define _POSIX_THREADS in unistd.h. Some apparently don't
2446 # (e.g. gnu pth with pthread emulation)
2447 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2448 AC_EGREP_CPP(yes,
2449 [
2450#include <unistd.h>
2451#ifdef _POSIX_THREADS
2452yes
2453#endif
2454 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2455 AC_MSG_RESULT($unistd_defines_pthreads)
2456
2457 AC_DEFINE(_REENTRANT)
2458 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2459 AC_DEFINE(C_THREADS)
2460 AC_DEFINE(HURD_C_THREADS, 1,
2461 [Define if you are using Mach cthreads directly under /include])
2462 LIBS="$LIBS -lthreads"
2463 THREADOBJ="Python/thread.o"],[
2464 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2465 AC_DEFINE(C_THREADS)
2466 AC_DEFINE(MACH_C_THREADS, 1,
2467 [Define if you are using Mach cthreads under mach /])
2468 THREADOBJ="Python/thread.o"],[
2469 AC_MSG_CHECKING(for --with-pth)
2470 AC_ARG_WITH([pth],
2471 AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]),
2472 [AC_MSG_RESULT($withval)
2473 AC_DEFINE([WITH_THREAD])
2474 AC_DEFINE([HAVE_PTH], 1,
2475 [Define if you have GNU PTH threads.])
2476 LIBS="-lpth $LIBS"
2477 THREADOBJ="Python/thread.o"],
2478 [AC_MSG_RESULT(no)
2479
2480 # Just looking for pthread_create in libpthread is not enough:
2481 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2482 # So we really have to include pthread.h, and then link.
2483 _libs=$LIBS
2484 LIBS="$LIBS -lpthread"
2485 AC_MSG_CHECKING([for pthread_create in -lpthread])
2486 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2487#include <stdio.h>
2488#include <pthread.h>
2489
2490void * start_routine (void *arg) { exit (0); }]], [[
2491pthread_create (NULL, NULL, start_routine, NULL)]])],[
2492 AC_MSG_RESULT(yes)
2493 AC_DEFINE(WITH_THREAD)
2494 posix_threads=yes
2495 THREADOBJ="Python/thread.o"],[
2496 LIBS=$_libs
2497 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
2498 posix_threads=yes
2499 THREADOBJ="Python/thread.o"],[
2500 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2501 AC_DEFINE(ATHEOS_THREADS, 1,
2502 [Define this if you have AtheOS threads.])
2503 THREADOBJ="Python/thread.o"],[
2504 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
2505 AC_DEFINE(BEOS_THREADS, 1,
2506 [Define this if you have BeOS threads.])
2507 THREADOBJ="Python/thread.o"],[
2508 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
2509 posix_threads=yes
2510 LIBS="$LIBS -lpthreads"
2511 THREADOBJ="Python/thread.o"], [
2512 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
2513 posix_threads=yes
2514 LIBS="$LIBS -lc_r"
2515 THREADOBJ="Python/thread.o"], [
2516 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
2517 posix_threads=yes
2518 LIBS="$LIBS -lpthread"
2519 THREADOBJ="Python/thread.o"], [
2520 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
2521 posix_threads=yes
2522 LIBS="$LIBS -lcma"
2523 THREADOBJ="Python/thread.o"],[
2524 USE_THREAD_MODULE="#"])
2525 ])])])])])])])])])])
2526
2527 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2528 LIBS="$LIBS -lmpc"
2529 THREADOBJ="Python/thread.o"
2530 USE_THREAD_MODULE=""])
2531
2532 if test "$posix_threads" != "yes"; then
2533 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2534 LIBS="$LIBS -lthread"
2535 THREADOBJ="Python/thread.o"
2536 USE_THREAD_MODULE=""])
2537 fi
2538
2539 if test "$USE_THREAD_MODULE" != "#"
2540 then
2541 # If the above checks didn't disable threads, (at least) OSF1
2542 # needs this '-threads' argument during linking.
2543 case $ac_sys_system in
2544 OSF1) LDLAST=-threads;;
2545 esac
2546 fi
2547fi
2548
2549if test "$posix_threads" = "yes"; then
2550 if test "$unistd_defines_pthreads" = "no"; then
2551 AC_DEFINE(_POSIX_THREADS, 1,
2552 [Define if you have POSIX threads,
2553 and your system does not define that.])
2554 fi
2555
2556 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2557 case $ac_sys_system/$ac_sys_release in
2558 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
2559 [Defined for Solaris 2.6 bug in pthread header.])
2560 ;;
2561 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2562 [Define if the Posix semaphores do not work on your system])
2563 ;;
2564 AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2565 [Define if the Posix semaphores do not work on your system])
2566 ;;
2567 esac
2568
2569 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2570 AC_CACHE_VAL(ac_cv_pthread_system_supported,
2571 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
2572 #include <stdio.h>
2573 #include <pthread.h>
2574 void *foo(void *parm) {
2575 return NULL;
2576 }
2577 main() {
2578 pthread_attr_t attr;
2579 pthread_t id;
2580 if (pthread_attr_init(&attr)) exit(-1);
2581 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
2582 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
2583 exit(0);
2584 }]])],
2585 [ac_cv_pthread_system_supported=yes],
2586 [ac_cv_pthread_system_supported=no],
2587 [ac_cv_pthread_system_supported=no])
2588 ])
2589 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2590 if test "$ac_cv_pthread_system_supported" = "yes"; then
2591 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
2592 fi
2593 AC_CHECK_FUNCS(pthread_sigmask,
2594 [case $ac_sys_system in
2595 CYGWIN*)
2596 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2597 [Define if pthread_sigmask() does not work on your system.])
2598 ;;
2599 esac])
2600 AC_CHECK_FUNCS(pthread_atfork)
2601fi
2602
2603
2604# Check for enable-ipv6
2605AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
2606AC_MSG_CHECKING([if --enable-ipv6 is specified])
2607AC_ARG_ENABLE(ipv6,
2608[ --enable-ipv6 Enable ipv6 (with ipv4) support
2609 --disable-ipv6 Disable ipv6 support],
2610[ case "$enableval" in
2611 no)
2612 AC_MSG_RESULT(no)
2613 ipv6=no
2614 ;;
2615 *) AC_MSG_RESULT(yes)
2616 AC_DEFINE(ENABLE_IPV6)
2617 ipv6=yes
2618 ;;
2619 esac ],
2620
2621[
2622dnl the check does not work on cross compilation case...
2623 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* AF_INET6 available check */
2624#include <sys/types.h>
2625#include <sys/socket.h>]],
2626[[int domain = AF_INET6;]])],[
2627 AC_MSG_RESULT(yes)
2628 ipv6=yes
2629],[
2630 AC_MSG_RESULT(no)
2631 ipv6=no
2632])
2633
2634if test "$ipv6" = "yes"; then
2635 AC_MSG_CHECKING(if RFC2553 API is available)
2636 AC_COMPILE_IFELSE([
2637 AC_LANG_PROGRAM([[#include <sys/types.h>
2638#include <netinet/in.h>]],
2639 [[struct sockaddr_in6 x;
2640 x.sin6_scope_id;]])
2641 ],[
2642 AC_MSG_RESULT(yes)
2643 ipv6=yes
2644 ],[
2645 AC_MSG_RESULT(no, IPv6 disabled)
2646 ipv6=no
2647 ])
2648fi
2649
2650if test "$ipv6" = "yes"; then
2651 AC_DEFINE(ENABLE_IPV6)
2652fi
2653])
2654
2655ipv6type=unknown
2656ipv6lib=none
2657ipv6trylibc=no
2658
2659if test "$ipv6" = "yes"; then
2660 AC_MSG_CHECKING([ipv6 stack type])
2661 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2662 do
2663 case $i in
2664 inria)
2665 dnl http://www.kame.net/
2666 AC_EGREP_CPP(yes, [
2667#include <netinet/in.h>
2668#ifdef IPV6_INRIA_VERSION
2669yes
2670#endif],
2671 [ipv6type=$i])
2672 ;;
2673 kame)
2674 dnl http://www.kame.net/
2675 AC_EGREP_CPP(yes, [
2676#include <netinet/in.h>
2677#ifdef __KAME__
2678yes
2679#endif],
2680 [ipv6type=$i;
2681 ipv6lib=inet6
2682 ipv6libdir=/usr/local/v6/lib
2683 ipv6trylibc=yes])
2684 ;;
2685 linux-glibc)
2686 dnl http://www.v6.linux.or.jp/
2687 AC_EGREP_CPP(yes, [
2688#include <features.h>
2689#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2690yes
2691#endif],
2692 [ipv6type=$i;
2693 ipv6trylibc=yes])
2694 ;;
2695 linux-inet6)
2696 dnl http://www.v6.linux.or.jp/
2697 if test -d /usr/inet6; then
2698 ipv6type=$i
2699 ipv6lib=inet6
2700 ipv6libdir=/usr/inet6/lib
2701 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
2702 fi
2703 ;;
2704 solaris)
2705 if test -f /etc/netconfig; then
2706 if $GREP -q tcp6 /etc/netconfig; then
2707 ipv6type=$i
2708 ipv6trylibc=yes
2709 fi
2710 fi
2711 ;;
2712 toshiba)
2713 AC_EGREP_CPP(yes, [
2714#include <sys/param.h>
2715#ifdef _TOSHIBA_INET6
2716yes
2717#endif],
2718 [ipv6type=$i;
2719 ipv6lib=inet6;
2720 ipv6libdir=/usr/local/v6/lib])
2721 ;;
2722 v6d)
2723 AC_EGREP_CPP(yes, [
2724#include </usr/local/v6/include/sys/v6config.h>
2725#ifdef __V6D__
2726yes
2727#endif],
2728 [ipv6type=$i;
2729 ipv6lib=v6;
2730 ipv6libdir=/usr/local/v6/lib;
2731 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
2732 ;;
2733 zeta)
2734 AC_EGREP_CPP(yes, [
2735#include <sys/param.h>
2736#ifdef _ZETA_MINAMI_INET6
2737yes
2738#endif],
2739 [ipv6type=$i;
2740 ipv6lib=inet6;
2741 ipv6libdir=/usr/local/v6/lib])
2742 ;;
2743 esac
2744 if test "$ipv6type" != "unknown"; then
2745 break
2746 fi
2747 done
2748 AC_MSG_RESULT($ipv6type)
2749fi
2750
2751if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2752 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2753 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2754 echo "using lib$ipv6lib"
2755 else
2756 if test $ipv6trylibc = "yes"; then
2757 echo "using libc"
2758 else
2759 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2760 echo "You need to fetch lib$ipv6lib.a from appropriate"
2761 echo 'ipv6 kit and compile beforehand.'
2762 exit 1
2763 fi
2764 fi
2765fi
2766
2767AC_MSG_CHECKING(for OSX 10.5 SDK or later)
2768AC_COMPILE_IFELSE([
2769 AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
2770],[
2771 AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.])
2772 AC_MSG_RESULT(yes)
2773],[
2774 AC_MSG_RESULT(no)
2775])
2776
2777# Check for --with-doc-strings
2778AC_MSG_CHECKING(for --with-doc-strings)
2779AC_ARG_WITH(doc-strings,
2780 AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings]))
2781
2782if test -z "$with_doc_strings"
2783then with_doc_strings="yes"
2784fi
2785if test "$with_doc_strings" != "no"
2786then
2787 AC_DEFINE(WITH_DOC_STRINGS, 1,
2788 [Define if you want documentation strings in extension modules])
2789fi
2790AC_MSG_RESULT($with_doc_strings)
2791
2792# Check for Python-specific malloc support
2793AC_MSG_CHECKING(for --with-tsc)
2794AC_ARG_WITH(tsc,
2795 AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[
2796if test "$withval" != no
2797then
2798 AC_DEFINE(WITH_TSC, 1,
2799 [Define to profile with the Pentium timestamp counter])
2800 AC_MSG_RESULT(yes)
2801else AC_MSG_RESULT(no)
2802fi],
2803[AC_MSG_RESULT(no)])
2804
2805# Check for Python-specific malloc support
2806AC_MSG_CHECKING(for --with-pymalloc)
2807AC_ARG_WITH(pymalloc,
2808 AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs]))
2809
2810if test -z "$with_pymalloc"
2811then with_pymalloc="yes"
2812fi
2813if test "$with_pymalloc" != "no"
2814then
2815 AC_DEFINE(WITH_PYMALLOC, 1,
2816 [Define if you want to compile in Python-specific mallocs])
2817fi
2818AC_MSG_RESULT($with_pymalloc)
2819
2820# Check for Valgrind support
2821AC_MSG_CHECKING([for --with-valgrind])
2822AC_ARG_WITH([valgrind],
2823 AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
2824 with_valgrind=no)
2825AC_MSG_RESULT([$with_valgrind])
2826if test "$with_valgrind" != no; then
2827 AC_CHECK_HEADER([valgrind/valgrind.h],
2828 [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
2829 [AC_MSG_ERROR([Valgrind support requested but headers not available])]
2830 )
2831fi
2832
2833# Check for --with-wctype-functions
2834AC_MSG_CHECKING(for --with-wctype-functions)
2835AC_ARG_WITH(wctype-functions,
2836 AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]),
2837[
2838if test "$withval" != no
2839then
2840 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2841 [Define if you want wctype.h functions to be used instead of the
2842 one supplied by Python itself. (see Include/unicodectype.h).])
2843 AC_MSG_RESULT(yes)
2844else AC_MSG_RESULT(no)
2845fi],
2846[AC_MSG_RESULT(no)])
2847
2848# -I${DLINCLDIR} is added to the compile rule for importdl.o
2849AC_SUBST(DLINCLDIR)
2850DLINCLDIR=.
2851
2852# the dlopen() function means we might want to use dynload_shlib.o. some
2853# platforms, such as AIX, have dlopen(), but don't want to use it.
2854AC_CHECK_FUNCS(dlopen)
2855
2856# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2857# loading of modules.
2858AC_SUBST(DYNLOADFILE)
2859AC_MSG_CHECKING(DYNLOADFILE)
2860if test -z "$DYNLOADFILE"
2861then
2862 case $ac_sys_system/$ac_sys_release in
2863 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2864 if test "$ac_cv_func_dlopen" = yes
2865 then DYNLOADFILE="dynload_shlib.o"
2866 else DYNLOADFILE="dynload_aix.o"
2867 fi
2868 ;;
2869 BeOS*) DYNLOADFILE="dynload_beos.o";;
2870 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
2871 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2872 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
2873 atheos*) DYNLOADFILE="dynload_atheos.o";;
2874 *)
2875 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2876 # out any dynamic loading
2877 if test "$ac_cv_func_dlopen" = yes
2878 then DYNLOADFILE="dynload_shlib.o"
2879 else DYNLOADFILE="dynload_stub.o"
2880 fi
2881 ;;
2882 esac
2883fi
2884AC_MSG_RESULT($DYNLOADFILE)
2885if test "$DYNLOADFILE" != "dynload_stub.o"
2886then
2887 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2888 [Defined when any dynamic module loading is enabled.])
2889fi
2890
2891# MACHDEP_OBJS can be set to platform-specific object files needed by Python
2892
2893AC_SUBST(MACHDEP_OBJS)
2894AC_MSG_CHECKING(MACHDEP_OBJS)
2895if test -z "$MACHDEP_OBJS"
2896then
2897 MACHDEP_OBJS=$extra_machdep_objs
2898else
2899 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
2900fi
2901AC_MSG_RESULT(MACHDEP_OBJS)
2902
2903# checks for library functions
2904AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2905 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
2906 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2907 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
2908 initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime \
2909 mremap nice pathconf pause plock poll pthread_init \
2910 putenv readlink realpath \
2911 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
2912 setgid \
2913 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
2914 setlocale setregid setreuid setresuid setresgid \
2915 setsid setpgid setpgrp setuid setvbuf snprintf \
2916 sigaction siginterrupt sigrelse strftime \
2917 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
2918 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
2919
2920# For some functions, having a definition is not sufficient, since
2921# we want to take their address.
2922AC_MSG_CHECKING(for chroot)
2923AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])],
2924 [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2925 AC_MSG_RESULT(yes)],
2926 [AC_MSG_RESULT(no)
2927])
2928AC_MSG_CHECKING(for link)
2929AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])],
2930 [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2931 AC_MSG_RESULT(yes)],
2932 [AC_MSG_RESULT(no)
2933])
2934AC_MSG_CHECKING(for symlink)
2935AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])],
2936 [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2937 AC_MSG_RESULT(yes)],
2938 [AC_MSG_RESULT(no)
2939])
2940AC_MSG_CHECKING(for fchdir)
2941AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])],
2942 [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2943 AC_MSG_RESULT(yes)],
2944 [AC_MSG_RESULT(no)
2945])
2946AC_MSG_CHECKING(for fsync)
2947AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])],
2948 [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2949 AC_MSG_RESULT(yes)],
2950 [AC_MSG_RESULT(no)
2951])
2952AC_MSG_CHECKING(for fdatasync)
2953AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])],
2954 [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2955 AC_MSG_RESULT(yes)],
2956 [AC_MSG_RESULT(no)
2957])
2958AC_MSG_CHECKING(for epoll)
2959AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])],
2960 [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2961 AC_MSG_RESULT(yes)],
2962 [AC_MSG_RESULT(no)
2963])
2964AC_MSG_CHECKING(for kqueue)
2965AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2966#include <sys/types.h>
2967#include <sys/event.h>
2968 ]], [[int x=kqueue()]])],
2969 [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2970 AC_MSG_RESULT(yes)],
2971 [AC_MSG_RESULT(no)
2972])
2973# On some systems (eg. FreeBSD 5), we would find a definition of the
2974# functions ctermid_r, setgroups in the library, but no prototype
2975# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2976# address to avoid compiler warnings and potential miscompilations
2977# because of the missing prototypes.
2978
2979AC_MSG_CHECKING(for ctermid_r)
2980AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2981#include <stdio.h>
2982]], [[void* p = ctermid_r]])],
2983 [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2984 AC_MSG_RESULT(yes)],
2985 [AC_MSG_RESULT(no)
2986])
2987
2988AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl],
2989 [AC_COMPILE_IFELSE(
2990 [AC_LANG_PROGRAM(
2991 [#include <sys/file.h>],
2992 [void* p = flock]
2993 )],
2994 [ac_cv_flock_decl=yes],
2995 [ac_cv_flock_decl=no]
2996 )
2997])
2998if test "x${ac_cv_flock_decl}" = xyes; then
2999 AC_CHECK_FUNCS(flock,,
3000 AC_CHECK_LIB(bsd,flock,
3001 [AC_DEFINE(HAVE_FLOCK)
3002 AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
3003 ])
3004 )
3005fi
3006
3007AC_MSG_CHECKING(for getpagesize)
3008AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3009#include <unistd.h>
3010]], [[void* p = getpagesize]])],
3011 [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
3012 AC_MSG_RESULT(yes)],
3013 [AC_MSG_RESULT(no)
3014])
3015
3016AC_MSG_CHECKING(for broken unsetenv)
3017AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3018#include <stdlib.h>
3019]], [[int res = unsetenv("DUMMY")]])],
3020 [AC_MSG_RESULT(no)],
3021 [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.)
3022 AC_MSG_RESULT(yes)
3023])
3024
3025dnl check for true
3026AC_CHECK_PROGS(TRUE, true, /bin/true)
3027
3028dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
3029dnl On others, they are in the C library, so we to take no action
3030AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
3031 AC_CHECK_LIB(resolv, inet_aton)
3032)
3033
3034# On Tru64, chflags seems to be present, but calling it will
3035# exit Python
3036AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
3037AC_RUN_IFELSE([AC_LANG_SOURCE([[
3038#include <sys/stat.h>
3039#include <unistd.h>
3040int main(int argc, char*argv[])
3041{
3042 if(chflags(argv[0], 0) != 0)
3043 return 1;
3044 return 0;
3045}
3046]])],
3047[ac_cv_have_chflags=yes],
3048[ac_cv_have_chflags=no],
3049[ac_cv_have_chflags=cross])
3050])
3051if test "$ac_cv_have_chflags" = cross ; then
3052 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
3053fi
3054if test "$ac_cv_have_chflags" = yes ; then
3055 AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the 'chflags' function.])
3056fi
3057
3058AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
3059AC_RUN_IFELSE([AC_LANG_SOURCE([[
3060#include <sys/stat.h>
3061#include <unistd.h>
3062int main(int argc, char*argv[])
3063{
3064 if(lchflags(argv[0], 0) != 0)
3065 return 1;
3066 return 0;
3067}
3068]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross])
3069])
3070if test "$ac_cv_have_lchflags" = cross ; then
3071 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
3072fi
3073if test "$ac_cv_have_lchflags" = yes ; then
3074 AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.])
3075fi
3076
3077dnl Check if system zlib has *Copy() functions
3078dnl
3079dnl On MacOSX the linker will search for dylibs on the entire linker path
3080dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
3081dnl to revert to a more traditional unix behaviour and make it possible to
3082dnl override the system libz with a local static library of libz. Temporarily
3083dnl add that flag to our CFLAGS as well to ensure that we check the version
3084dnl of libz that will be used by setup.py.
3085dnl The -L/usr/local/lib is needed as wel to get the same compilation
3086dnl environment as setup.py (and leaving it out can cause configure to use the
3087dnl wrong version of the library)
3088case $ac_sys_system/$ac_sys_release in
3089Darwin/*)
3090 _CUR_CFLAGS="${CFLAGS}"
3091 _CUR_LDFLAGS="${LDFLAGS}"
3092 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
3093 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
3094 ;;
3095esac
3096
3097AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
3098
3099case $ac_sys_system/$ac_sys_release in
3100Darwin/*)
3101 CFLAGS="${_CUR_CFLAGS}"
3102 LDFLAGS="${_CUR_LDFLAGS}"
3103 ;;
3104esac
3105
3106AC_MSG_CHECKING(for hstrerror)
3107AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3108#include <netdb.h>
3109]], [[void* p = hstrerror; hstrerror(0)]])],
3110 [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
3111 AC_MSG_RESULT(yes)],
3112 [AC_MSG_RESULT(no)
3113])
3114
3115AC_MSG_CHECKING(for inet_aton)
3116AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3117#include <sys/types.h>
3118#include <sys/socket.h>
3119#include <netinet/in.h>
3120#include <arpa/inet.h>
3121]], [[void* p = inet_aton;inet_aton(0,0)]])],
3122 [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
3123 AC_MSG_RESULT(yes)],
3124 [AC_MSG_RESULT(no)
3125])
3126
3127AC_MSG_CHECKING(for inet_pton)
3128AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3129#include <sys/types.h>
3130#include <sys/socket.h>
3131#include <netinet/in.h>
3132#include <arpa/inet.h>
3133]], [[void* p = inet_pton]])],
3134 [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
3135 AC_MSG_RESULT(yes)],
3136 [AC_MSG_RESULT(no)
3137])
3138
3139# On some systems, setgroups is in unistd.h, on others, in grp.h
3140AC_MSG_CHECKING(for setgroups)
3141AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3142#include <unistd.h>
3143#ifdef HAVE_GRP_H
3144#include <grp.h>
3145#endif
3146]], [[void* p = setgroups]])],
3147 [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
3148 AC_MSG_RESULT(yes)],
3149 [AC_MSG_RESULT(no)
3150])
3151
3152# check for openpty and forkpty
3153
3154AC_CHECK_FUNCS(openpty,,
3155 AC_CHECK_LIB(util,openpty,
3156 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
3157 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
3158 )
3159)
3160AC_CHECK_FUNCS(forkpty,,
3161 AC_CHECK_LIB(util,forkpty,
3162 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
3163 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
3164 )
3165)
3166
3167# Stuff for expat.
3168AC_CHECK_FUNCS(memmove)
3169
3170# check for long file support functions
3171AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
3172
3173AC_REPLACE_FUNCS(dup2 getcwd strdup)
3174AC_CHECK_FUNCS(getpgrp,
3175 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
3176 [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
3177 [])
3178)
3179AC_CHECK_FUNCS(setpgrp,
3180 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])],
3181 [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])],
3182 [])
3183)
3184AC_CHECK_FUNCS(gettimeofday,
3185 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]],
3186 [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])],
3187 [],
3188 [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
3189 [Define if gettimeofday() does not have second (timezone) argument
3190 This is the case on Motorola V4 (R40V4.2)])
3191 ])
3192)
3193
3194AC_MSG_CHECKING(for major, minor, and makedev)
3195AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3196#if defined(MAJOR_IN_MKDEV)
3197#include <sys/mkdev.h>
3198#elif defined(MAJOR_IN_SYSMACROS)
3199#include <sys/sysmacros.h>
3200#else
3201#include <sys/types.h>
3202#endif
3203]], [[
3204 makedev(major(0),minor(0));
3205]])],[
3206 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
3207 [Define to 1 if you have the device macros.])
3208 AC_MSG_RESULT(yes)
3209],[
3210 AC_MSG_RESULT(no)
3211])
3212
3213# On OSF/1 V5.1, getaddrinfo is available, but a define
3214# for [no]getaddrinfo in netdb.h.
3215AC_MSG_CHECKING(for getaddrinfo)
3216AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3217#include <sys/types.h>
3218#include <sys/socket.h>
3219#include <netdb.h>
3220#include <stdio.h>
3221]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],
3222[have_getaddrinfo=yes],
3223[have_getaddrinfo=no])
3224AC_MSG_RESULT($have_getaddrinfo)
3225if test $have_getaddrinfo = yes
3226then
3227 AC_MSG_CHECKING(getaddrinfo bug)
3228 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
3229 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
3230#include <stdio.h>
3231#include <sys/types.h>
3232#include <netdb.h>
3233#include <string.h>
3234#include <sys/socket.h>
3235#include <netinet/in.h>
3236
3237int main()
3238{
3239 int passive, gaierr, inet4 = 0, inet6 = 0;
3240 struct addrinfo hints, *ai, *aitop;
3241 char straddr[INET6_ADDRSTRLEN], strport[16];
3242
3243 for (passive = 0; passive <= 1; passive++) {
3244 memset(&hints, 0, sizeof(hints));
3245 hints.ai_family = AF_UNSPEC;
3246 hints.ai_flags = passive ? AI_PASSIVE : 0;
3247 hints.ai_socktype = SOCK_STREAM;
3248 hints.ai_protocol = IPPROTO_TCP;
3249 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
3250 (void)gai_strerror(gaierr);
3251 goto bad;
3252 }
3253 for (ai = aitop; ai; ai = ai->ai_next) {
3254 if (ai->ai_addr == NULL ||
3255 ai->ai_addrlen == 0 ||
3256 getnameinfo(ai->ai_addr, ai->ai_addrlen,
3257 straddr, sizeof(straddr), strport, sizeof(strport),
3258 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
3259 goto bad;
3260 }
3261 switch (ai->ai_family) {
3262 case AF_INET:
3263 if (strcmp(strport, "54321") != 0) {
3264 goto bad;
3265 }
3266 if (passive) {
3267 if (strcmp(straddr, "0.0.0.0") != 0) {
3268 goto bad;
3269 }
3270 } else {
3271 if (strcmp(straddr, "127.0.0.1") != 0) {
3272 goto bad;
3273 }
3274 }
3275 inet4++;
3276 break;
3277 case AF_INET6:
3278 if (strcmp(strport, "54321") != 0) {
3279 goto bad;
3280 }
3281 if (passive) {
3282 if (strcmp(straddr, "::") != 0) {
3283 goto bad;
3284 }
3285 } else {
3286 if (strcmp(straddr, "::1") != 0) {
3287 goto bad;
3288 }
3289 }
3290 inet6++;
3291 break;
3292 case AF_UNSPEC:
3293 goto bad;
3294 break;
3295 default:
3296 /* another family support? */
3297 break;
3298 }
3299 }
3300 }
3301
3302 if (!(inet4 == 0 || inet4 == 2))
3303 goto bad;
3304 if (!(inet6 == 0 || inet6 == 2))
3305 goto bad;
3306
3307 if (aitop)
3308 freeaddrinfo(aitop);
3309 return 0;
3310
3311 bad:
3312 if (aitop)
3313 freeaddrinfo(aitop);
3314 return 1;
3315}
3316]]])],
3317[ac_cv_buggy_getaddrinfo=no],
3318[ac_cv_buggy_getaddrinfo=yes],
3319[
3320if test "${enable_ipv6+set}" = set; then
3321 ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6"
3322else
3323 ac_cv_buggy_getaddrinfo=yes
3324fi]))
3325fi
3326
3327AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
3328
3329if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
3330then
3331 if test $ipv6 = yes
3332 then
3333 echo 'Fatal: You must get working getaddrinfo() function.'
3334 echo ' or you can specify "--disable-ipv6"'.
3335 exit 1
3336 fi
3337else
3338 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
3339fi
3340
3341AC_CHECK_FUNCS(getnameinfo)
3342
3343# checks for structures
3344AC_HEADER_TIME
3345AC_STRUCT_TM
3346AC_STRUCT_TIMEZONE
3347AC_CHECK_MEMBERS([struct stat.st_rdev])
3348AC_CHECK_MEMBERS([struct stat.st_blksize])
3349AC_CHECK_MEMBERS([struct stat.st_flags])
3350AC_CHECK_MEMBERS([struct stat.st_gen])
3351AC_CHECK_MEMBERS([struct stat.st_birthtime])
3352AC_STRUCT_ST_BLOCKS
3353
3354AC_MSG_CHECKING(for time.h that defines altzone)
3355AC_CACHE_VAL(ac_cv_header_time_altzone,[
3356 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])],
3357 [ac_cv_header_time_altzone=yes],
3358 [ac_cv_header_time_altzone=no])
3359 ])
3360AC_MSG_RESULT($ac_cv_header_time_altzone)
3361if test $ac_cv_header_time_altzone = yes; then
3362 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
3363fi
3364
3365was_it_defined=no
3366AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
3367AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3368#include <sys/types.h>
3369#include <sys/select.h>
3370#include <sys/time.h>
3371]], [[;]])],[
3372 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
3373 [Define if you can safely include both <sys/select.h> and <sys/time.h>
3374 (which you can't on SCO ODT 3.0).])
3375 was_it_defined=yes
3376],[])
3377AC_MSG_RESULT($was_it_defined)
3378
3379AC_MSG_CHECKING(for addrinfo)
3380AC_CACHE_VAL(ac_cv_struct_addrinfo,
3381AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
3382 [ac_cv_struct_addrinfo=yes],
3383 [ac_cv_struct_addrinfo=no]))
3384AC_MSG_RESULT($ac_cv_struct_addrinfo)
3385if test $ac_cv_struct_addrinfo = yes; then
3386 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
3387fi
3388
3389AC_MSG_CHECKING(for sockaddr_storage)
3390AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
3391AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3392# include <sys/types.h>
3393# include <sys/socket.h>]], [[struct sockaddr_storage s]])],
3394 [ac_cv_struct_sockaddr_storage=yes],
3395 [ac_cv_struct_sockaddr_storage=no]))
3396AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3397if test $ac_cv_struct_sockaddr_storage = yes; then
3398 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
3399fi
3400
3401# checks for compiler characteristics
3402
3403AC_C_CHAR_UNSIGNED
3404AC_C_CONST
3405
3406works=no
3407AC_MSG_CHECKING(for working volatile)
3408AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])],
3409 [works=yes],
3410 [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])]
3411)
3412AC_MSG_RESULT($works)
3413
3414works=no
3415AC_MSG_CHECKING(for working signed char)
3416AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])],
3417 [works=yes],
3418 [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])]
3419)
3420AC_MSG_RESULT($works)
3421
3422have_prototypes=no
3423AC_MSG_CHECKING(for prototypes)
3424AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])],
3425 [AC_DEFINE(HAVE_PROTOTYPES, 1,
3426 [Define if your compiler supports function prototype])
3427 have_prototypes=yes],
3428 []
3429)
3430AC_MSG_RESULT($have_prototypes)
3431
3432works=no
3433AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
3434AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3435#include <stdarg.h>
3436int foo(int x, ...) {
3437 va_list va;
3438 va_start(va, x);
3439 va_arg(va, int);
3440 va_arg(va, char *);
3441 va_arg(va, double);
3442 return 0;
3443}
3444]], [[return foo(10, "", 3.14);]])],[
3445 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3446 [Define if your compiler supports variable length function prototypes
3447 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3448 works=yes
3449],[])
3450AC_MSG_RESULT($works)
3451
3452# check for socketpair
3453AC_MSG_CHECKING(for socketpair)
3454AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3455#include <sys/types.h>
3456#include <sys/socket.h>
3457]], [[void *x=socketpair]])],
3458 [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.])
3459 AC_MSG_RESULT(yes)],
3460 [AC_MSG_RESULT(no)]
3461)
3462
3463# check if sockaddr has sa_len member
3464AC_MSG_CHECKING(if sockaddr has sa_len member)
3465AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3466#include <sys/socket.h>]], [[struct sockaddr x;
3467x.sa_len = 0;]])],
3468 [AC_MSG_RESULT(yes)
3469 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])],
3470 [AC_MSG_RESULT(no)]
3471)
3472
3473va_list_is_array=no
3474AC_MSG_CHECKING(whether va_list is an array)
3475AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3476#ifdef HAVE_STDARG_PROTOTYPES
3477#include <stdarg.h>
3478#else
3479#include <varargs.h>
3480#endif
3481]], [[va_list list1, list2; list1 = list2;]])],[],[
3482 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3483 va_list_is_array=yes
3484])
3485AC_MSG_RESULT($va_list_is_array)
3486
3487# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
3488AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3489 [Define this if you have some version of gethostbyname_r()])
3490
3491AC_CHECK_FUNC(gethostbyname_r, [
3492 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3493 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3494 OLD_CFLAGS=$CFLAGS
3495 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
3496 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3497# include <netdb.h>
3498 ]], [[
3499 char *name;
3500 struct hostent *he, *res;
3501 char buffer[2048];
3502 int buflen = 2048;
3503 int h_errnop;
3504
3505 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
3506 ]])],[
3507 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3508 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3509 [Define this if you have the 6-arg version of gethostbyname_r().])
3510 AC_MSG_RESULT(yes)
3511 ],[
3512 AC_MSG_RESULT(no)
3513 AC_MSG_CHECKING([gethostbyname_r with 5 args])
3514 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3515# include <netdb.h>
3516 ]], [[
3517 char *name;
3518 struct hostent *he;
3519 char buffer[2048];
3520 int buflen = 2048;
3521 int h_errnop;
3522
3523 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3524 ]])],
3525 [
3526 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3527 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3528 [Define this if you have the 5-arg version of gethostbyname_r().])
3529 AC_MSG_RESULT(yes)
3530 ], [
3531 AC_MSG_RESULT(no)
3532 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3533 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3534# include <netdb.h>
3535 ]], [[
3536 char *name;
3537 struct hostent *he;
3538 struct hostent_data data;
3539
3540 (void) gethostbyname_r(name, he, &data);
3541 ]])],
3542 [
3543 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3544 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3545 [Define this if you have the 3-arg version of gethostbyname_r().])
3546 AC_MSG_RESULT(yes)
3547 ], [
3548 AC_MSG_RESULT(no)
3549 ])
3550 ])
3551 ])
3552 CFLAGS=$OLD_CFLAGS
3553], [
3554 AC_CHECK_FUNCS(gethostbyname)
3555])
3556AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3557AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3558AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
3559AC_SUBST(HAVE_GETHOSTBYNAME_R)
3560AC_SUBST(HAVE_GETHOSTBYNAME)
3561
3562# checks for system services
3563# (none yet)
3564
3565# Linux requires this for correct f.p. operations
3566AC_CHECK_FUNC(__fpu_control,
3567 [],
3568 [AC_CHECK_LIB(ieee, __fpu_control)
3569])
3570
3571# Check for --with-fpectl
3572AC_MSG_CHECKING(for --with-fpectl)
3573AC_ARG_WITH(fpectl,
3574 AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]),
3575[
3576if test "$withval" != no
3577then
3578 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3579 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3580 AC_MSG_RESULT(yes)
3581else AC_MSG_RESULT(no)
3582fi],
3583[AC_MSG_RESULT(no)])
3584
3585# check for --with-libm=...
3586AC_SUBST(LIBM)
3587case $ac_sys_system in
3588Darwin) ;;
3589BeOS) ;;
3590*) LIBM=-lm
3591esac
3592AC_MSG_CHECKING(for --with-libm=STRING)
3593AC_ARG_WITH(libm,
3594 AS_HELP_STRING([--with-libm=STRING], [math library]),
3595[
3596if test "$withval" = no
3597then LIBM=
3598 AC_MSG_RESULT(force LIBM empty)
3599elif test "$withval" != yes
3600then LIBM=$withval
3601 AC_MSG_RESULT(set LIBM="$withval")
3602else AC_MSG_ERROR([proper usage is --with-libm=STRING])
3603fi],
3604[AC_MSG_RESULT(default LIBM="$LIBM")])
3605
3606# check for --with-libc=...
3607AC_SUBST(LIBC)
3608AC_MSG_CHECKING(for --with-libc=STRING)
3609AC_ARG_WITH(libc,
3610 AS_HELP_STRING([--with-libc=STRING], [C library]),
3611[
3612if test "$withval" = no
3613then LIBC=
3614 AC_MSG_RESULT(force LIBC empty)
3615elif test "$withval" != yes
3616then LIBC=$withval
3617 AC_MSG_RESULT(set LIBC="$withval")
3618else AC_MSG_ERROR([proper usage is --with-libc=STRING])
3619fi],
3620[AC_MSG_RESULT(default LIBC="$LIBC")])
3621
3622# **************************************************
3623# * Check for various properties of floating point *
3624# **************************************************
3625
3626AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3627AC_CACHE_VAL(ac_cv_little_endian_double, [
3628AC_RUN_IFELSE([AC_LANG_SOURCE([[
3629#include <string.h>
3630int main() {
3631 double x = 9006104071832581.0;
3632 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3633 return 0;
3634 else
3635 return 1;
3636}
3637]])],
3638[ac_cv_little_endian_double=yes],
3639[ac_cv_little_endian_double=no],
3640[ac_cv_little_endian_double=no])])
3641AC_MSG_RESULT($ac_cv_little_endian_double)
3642if test "$ac_cv_little_endian_double" = yes
3643then
3644 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3645 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3646 with the least significant byte first])
3647fi
3648
3649AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3650AC_CACHE_VAL(ac_cv_big_endian_double, [
3651AC_RUN_IFELSE([AC_LANG_SOURCE([[
3652#include <string.h>
3653int main() {
3654 double x = 9006104071832581.0;
3655 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3656 return 0;
3657 else
3658 return 1;
3659}
3660]])],
3661[ac_cv_big_endian_double=yes],
3662[ac_cv_big_endian_double=no],
3663[ac_cv_big_endian_double=no])])
3664AC_MSG_RESULT($ac_cv_big_endian_double)
3665if test "$ac_cv_big_endian_double" = yes
3666then
3667 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3668 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3669 with the most significant byte first])
3670fi
3671
3672# Some ARM platforms use a mixed-endian representation for doubles.
3673# While Python doesn't currently have full support for these platforms
3674# (see e.g., issue 1762561), we can at least make sure that float <-> string
3675# conversions work.
3676AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3677AC_CACHE_VAL(ac_cv_mixed_endian_double, [
3678AC_RUN_IFELSE([AC_LANG_SOURCE([[
3679#include <string.h>
3680int main() {
3681 double x = 9006104071832581.0;
3682 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3683 return 0;
3684 else
3685 return 1;
3686}
3687]])],
3688[ac_cv_mixed_endian_double=yes],
3689[ac_cv_mixed_endian_double=no],
3690[ac_cv_mixed_endian_double=no])])
3691AC_MSG_RESULT($ac_cv_mixed_endian_double)
3692if test "$ac_cv_mixed_endian_double" = yes
3693then
3694 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3695 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3696 in ARM mixed-endian order (byte order 45670123)])
3697fi
3698
3699# The short float repr introduced in Python 3.1 requires the
3700# correctly-rounded string <-> double conversion functions from
3701# Python/dtoa.c, which in turn require that the FPU uses 53-bit
3702# rounding; this is a problem on x86, where the x87 FPU has a default
3703# rounding precision of 64 bits. For gcc/x86, we can fix this by
3704# using inline assembler to get and set the x87 FPU control word.
3705
3706# This inline assembler syntax may also work for suncc and icc,
3707# so we try it on all platforms.
3708
3709AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
3710AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3711 unsigned short cw;
3712 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3713 __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
3714]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no])
3715AC_MSG_RESULT($have_gcc_asm_for_x87)
3716if test "$have_gcc_asm_for_x87" = yes
3717then
3718 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3719 [Define if we can use gcc inline assembler to get and set x87 control word])
3720fi
3721
3722# Detect whether system arithmetic is subject to x87-style double
3723# rounding issues. The result of this test has little meaning on non
3724# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3725# mode is round-to-nearest and double rounding issues are present, and
3726# 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3727AC_MSG_CHECKING(for x87-style double rounding)
3728# $BASECFLAGS may affect the result
3729ac_save_cc="$CC"
3730CC="$CC $BASECFLAGS"
3731AC_RUN_IFELSE([AC_LANG_SOURCE([[
3732#include <stdlib.h>
3733#include <math.h>
3734int main() {
3735 volatile double x, y, z;
3736 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3737 x = 0.99999999999999989; /* 1-2**-53 */
3738 y = 1./x;
3739 if (y != 1.)
3740 exit(0);
3741 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3742 x = 1e16;
3743 y = 2.99999;
3744 z = x + y;
3745 if (z != 1e16+4.)
3746 exit(0);
3747 /* both tests show evidence of double rounding */
3748 exit(1);
3749}
3750]])],
3751[ac_cv_x87_double_rounding=no],
3752[ac_cv_x87_double_rounding=yes],
3753[ac_cv_x87_double_rounding=no])
3754CC="$ac_save_cc"
3755AC_MSG_RESULT($ac_cv_x87_double_rounding)
3756if test "$ac_cv_x87_double_rounding" = yes
3757then
3758 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3759 [Define if arithmetic is subject to x87-style double rounding issue])
3760fi
3761
3762# ************************************
3763# * Check for mathematical functions *
3764# ************************************
3765
3766LIBS_SAVE=$LIBS
3767LIBS="$LIBS $LIBM"
3768
3769# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3770# -0. on some architectures.
3771AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3772AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
3773AC_RUN_IFELSE([AC_LANG_SOURCE([[
3774#include <math.h>
3775#include <stdlib.h>
3776int main() {
3777 /* return 0 if either negative zeros don't exist
3778 on this platform or if negative zeros exist
3779 and tanh(-0.) == -0. */
3780 if (atan2(0., -1.) == atan2(-0., -1.) ||
3781 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3782 else exit(1);
3783}
3784]])],
3785[ac_cv_tanh_preserves_zero_sign=yes],
3786[ac_cv_tanh_preserves_zero_sign=no],
3787[ac_cv_tanh_preserves_zero_sign=no])])
3788AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3789if test "$ac_cv_tanh_preserves_zero_sign" = yes
3790then
3791 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3792 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3793fi
3794
3795AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
3796AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
3797AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3798
3799LIBS=$LIBS_SAVE
3800
3801# For multiprocessing module, check that sem_open
3802# actually works. For FreeBSD versions <= 7.2,
3803# the kernel module that provides POSIX semaphores
3804# isn't loaded by default, so an attempt to call
3805# sem_open results in a 'Signal 12' error.
3806AC_MSG_CHECKING(whether POSIX semaphores are enabled)
3807AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
3808AC_RUN_IFELSE([AC_LANG_SOURCE([[
3809#include <unistd.h>
3810#include <fcntl.h>
3811#include <stdio.h>
3812#include <semaphore.h>
3813#include <sys/stat.h>
3814
3815int main(void) {
3816 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3817 if (a == SEM_FAILED) {
3818 perror("sem_open");
3819 return 1;
3820 }
3821 sem_close(a);
3822 sem_unlink("/autoconf");
3823 return 0;
3824}
3825]])],
3826[ac_cv_posix_semaphores_enabled=yes],
3827[ac_cv_posix_semaphores_enabled=no],
3828[ac_cv_posix_semaphores_enabled=yes])
3829)
3830AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
3831if test $ac_cv_posix_semaphores_enabled = no
3832then
3833 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
3834 [Define if POSIX semaphores aren't enabled on your system])
3835fi
3836
3837# Multiprocessing check for broken sem_getvalue
3838AC_MSG_CHECKING(for broken sem_getvalue)
3839AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
3840AC_RUN_IFELSE([AC_LANG_SOURCE([[
3841#include <unistd.h>
3842#include <fcntl.h>
3843#include <stdio.h>
3844#include <semaphore.h>
3845#include <sys/stat.h>
3846
3847int main(void){
3848 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
3849 int count;
3850 int res;
3851 if(a==SEM_FAILED){
3852 perror("sem_open");
3853 return 1;
3854
3855 }
3856 res = sem_getvalue(a, &count);
3857 sem_close(a);
3858 sem_unlink("/autocftw");
3859 return res==-1 ? 1 : 0;
3860}
3861]])],
3862[ac_cv_broken_sem_getvalue=no],
3863[ac_cv_broken_sem_getvalue=yes],
3864[ac_cv_broken_sem_getvalue=yes])
3865)
3866AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
3867if test $ac_cv_broken_sem_getvalue = yes
3868then
3869 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
3870 [define to 1 if your sem_getvalue is broken.])
3871fi
3872
3873# determine what size digit to use for Python's longs
3874AC_MSG_CHECKING([digit size for Python's longs])
3875AC_ARG_ENABLE(big-digits,
3876AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
3877[case $enable_big_digits in
3878yes)
3879 enable_big_digits=30 ;;
3880no)
3881 enable_big_digits=15 ;;
3882[15|30])
3883 ;;
3884*)
3885 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3886esac
3887AC_MSG_RESULT($enable_big_digits)
3888AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3889],
3890[AC_MSG_RESULT(no value specified)])
3891
3892# check for wchar.h
3893AC_CHECK_HEADER(wchar.h, [
3894 AC_DEFINE(HAVE_WCHAR_H, 1,
3895 [Define if the compiler provides a wchar.h header file.])
3896 wchar_h="yes"
3897],
3898wchar_h="no"
3899)
3900
3901# determine wchar_t size
3902if test "$wchar_h" = yes
3903then
3904 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
3905fi
3906
3907AC_MSG_CHECKING(for UCS-4 tcl)
3908have_ucs4_tcl=no
3909AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3910#include <tcl.h>
3911#if TCL_UTF_MAX != 6
3912# error "NOT UCS4_TCL"
3913#endif]], [[]])],[
3914 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3915 have_ucs4_tcl=yes
3916],[])
3917AC_MSG_RESULT($have_ucs4_tcl)
3918
3919# check whether wchar_t is signed or not
3920if test "$wchar_h" = yes
3921then
3922 # check whether wchar_t is signed or not
3923 AC_MSG_CHECKING(whether wchar_t is signed)
3924 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
3925 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3926 #include <wchar.h>
3927 int main()
3928 {
3929 /* Success: exit code 0 */
3930 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
3931 }
3932 ]])],
3933 [ac_cv_wchar_t_signed=yes],
3934 [ac_cv_wchar_t_signed=no],
3935 [ac_cv_wchar_t_signed=yes])])
3936 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3937fi
3938
3939AC_MSG_CHECKING(what type to use for unicode)
3940dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
3941AC_ARG_ENABLE(unicode,
3942 AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is ucs2)]),
3943 [],
3944 [enable_unicode=yes])
3945
3946if test $enable_unicode = yes
3947then
3948 # Without any arguments, Py_UNICODE defaults to two-byte mode
3949 case "$have_ucs4_tcl" in
3950 yes) enable_unicode="ucs4"
3951 ;;
3952 *) enable_unicode="ucs2"
3953 ;;
3954 esac
3955fi
3956
3957AH_TEMPLATE(Py_UNICODE_SIZE,
3958 [Define as the size of the unicode type.])
3959case "$enable_unicode" in
3960ucs2) unicode_size="2"
3961 AC_DEFINE(Py_UNICODE_SIZE,2)
3962 ;;
3963ucs4) unicode_size="4"
3964 AC_DEFINE(Py_UNICODE_SIZE,4)
3965 ;;
3966no) ;; # To allow --disable-unicode
3967*) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
3968esac
3969
3970AH_TEMPLATE(PY_UNICODE_TYPE,
3971 [Define as the integral type used for Unicode representation.])
3972
3973AC_SUBST(UNICODE_OBJS)
3974if test "$enable_unicode" = "no"
3975then
3976 UNICODE_OBJS=""
3977 AC_MSG_RESULT(not used)
3978else
3979 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
3980 AC_DEFINE(Py_USING_UNICODE, 1,
3981 [Define if you want to have a Unicode type.])
3982
3983 # wchar_t is only usable if it maps to an unsigned type
3984 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
3985 -a "$ac_cv_wchar_t_signed" = "no"
3986 then
3987 PY_UNICODE_TYPE="wchar_t"
3988 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3989 [Define if you have a useable wchar_t type defined in wchar.h; useable
3990 means wchar_t must be an unsigned type with at least 16 bits. (see
3991 Include/unicodeobject.h).])
3992 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3993 elif test "$ac_cv_sizeof_short" = "$unicode_size"
3994 then
3995 PY_UNICODE_TYPE="unsigned short"
3996 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3997 elif test "$ac_cv_sizeof_long" = "$unicode_size"
3998 then
3999 PY_UNICODE_TYPE="unsigned long"
4000 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
4001 else
4002 PY_UNICODE_TYPE="no type found"
4003 fi
4004 AC_MSG_RESULT($PY_UNICODE_TYPE)
4005fi
4006
4007# check for endianness
4008AC_C_BIGENDIAN
4009
4010# Check whether right shifting a negative integer extends the sign bit
4011# or fills with zeros (like the Cray J90, according to Tim Peters).
4012AC_MSG_CHECKING(whether right shift extends the sign bit)
4013AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
4014AC_RUN_IFELSE([AC_LANG_SOURCE([[
4015int main()
4016{
4017 exit(((-1)>>3 == -1) ? 0 : 1);
4018}
4019]])],
4020[ac_cv_rshift_extends_sign=yes],
4021[ac_cv_rshift_extends_sign=no],
4022[ac_cv_rshift_extends_sign=yes])])
4023AC_MSG_RESULT($ac_cv_rshift_extends_sign)
4024if test "$ac_cv_rshift_extends_sign" = no
4025then
4026 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
4027 [Define if i>>j for signed int i does not extend the sign bit
4028 when i < 0])
4029fi
4030
4031# check for getc_unlocked and related locking functions
4032AC_MSG_CHECKING(for getc_unlocked() and friends)
4033AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
4034AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
4035 FILE *f = fopen("/dev/null", "r");
4036 flockfile(f);
4037 getc_unlocked(f);
4038 funlockfile(f);
4039]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])])
4040AC_MSG_RESULT($ac_cv_have_getc_unlocked)
4041if test "$ac_cv_have_getc_unlocked" = yes
4042then
4043 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
4044 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
4045fi
4046
4047# check where readline lives
4048# save the value of LIBS so we don't actually link Python with readline
4049LIBS_no_readline=$LIBS
4050
4051# On some systems we need to link readline to a termcap compatible
4052# library. NOTE: Keep the precedence of listed libraries synchronised
4053# with setup.py.
4054py_cv_lib_readline=no
4055AC_MSG_CHECKING([how to link readline libs])
4056for py_libtermcap in "" ncursesw ncurses curses termcap; do
4057 if test -z "$py_libtermcap"; then
4058 READLINE_LIBS="-lreadline"
4059 else
4060 READLINE_LIBS="-lreadline -l$py_libtermcap"
4061 fi
4062 LIBS="$READLINE_LIBS $LIBS_no_readline"
4063 AC_LINK_IFELSE(
4064 [AC_LANG_CALL([],[readline])],
4065 [py_cv_lib_readline=yes])
4066 if test $py_cv_lib_readline = yes; then
4067 break
4068 fi
4069done
4070# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
4071#AC_SUBST([READLINE_LIBS])
4072if test $py_cv_lib_readline = no; then
4073 AC_MSG_RESULT([none])
4074else
4075 AC_MSG_RESULT([$READLINE_LIBS])
4076 AC_DEFINE(HAVE_LIBREADLINE, 1,
4077 [Define if you have the readline library (-lreadline).])
4078fi
4079
4080# check for readline 2.1
4081AC_CHECK_LIB(readline, rl_callback_handler_install,
4082 AC_DEFINE(HAVE_RL_CALLBACK, 1,
4083 [Define if you have readline 2.1]), ,$READLINE_LIBS)
4084
4085# check for readline 2.2
4086AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
4087 [have_readline=yes],
4088 [have_readline=no]
4089)
4090if test $have_readline = yes
4091then
4092 AC_EGREP_HEADER([extern int rl_completion_append_character;],
4093 [readline/readline.h],
4094 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
4095 [Define if you have readline 2.2]), )
4096 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
4097 [readline/readline.h],
4098 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
4099 [Define if you have rl_completion_suppress_append]), )
4100fi
4101
4102# check for readline 4.0
4103AC_CHECK_LIB(readline, rl_pre_input_hook,
4104 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
4105 [Define if you have readline 4.0]), ,$READLINE_LIBS)
4106
4107# also in 4.0
4108AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
4109 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
4110 [Define if you have readline 4.0]), ,$READLINE_LIBS)
4111
4112# check for readline 4.2
4113AC_CHECK_LIB(readline, rl_completion_matches,
4114 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
4115 [Define if you have readline 4.2]), ,$READLINE_LIBS)
4116
4117# also in readline 4.2
4118AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
4119 [have_readline=yes],
4120 [have_readline=no]
4121)
4122if test $have_readline = yes
4123then
4124 AC_EGREP_HEADER([extern int rl_catch_signals;],
4125 [readline/readline.h],
4126 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
4127 [Define if you can turn off readline's signal handling.]), )
4128fi
4129
4130# End of readline checks: restore LIBS
4131LIBS=$LIBS_no_readline
4132
4133AC_MSG_CHECKING(for broken nice())
4134AC_CACHE_VAL(ac_cv_broken_nice, [
4135AC_RUN_IFELSE([AC_LANG_SOURCE([[
4136int main()
4137{
4138 int val1 = nice(1);
4139 if (val1 != -1 && val1 == nice(2))
4140 exit(0);
4141 exit(1);
4142}
4143]])],
4144[ac_cv_broken_nice=yes],
4145[ac_cv_broken_nice=no],
4146[ac_cv_broken_nice=no])])
4147AC_MSG_RESULT($ac_cv_broken_nice)
4148if test "$ac_cv_broken_nice" = yes
4149then
4150 AC_DEFINE(HAVE_BROKEN_NICE, 1,
4151 [Define if nice() returns success/failure instead of the new priority.])
4152fi
4153
4154AC_MSG_CHECKING(for broken poll())
4155AC_CACHE_VAL(ac_cv_broken_poll,
4156AC_RUN_IFELSE([AC_LANG_SOURCE([[
4157#include <poll.h>
4158
4159int main()
4160{
4161 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
4162 int poll_test;
4163
4164 close (42);
4165
4166 poll_test = poll(&poll_struct, 1, 0);
4167 if (poll_test < 0)
4168 return 0;
4169 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
4170 return 0;
4171 else
4172 return 1;
4173}
4174]])],
4175[ac_cv_broken_poll=yes],
4176[ac_cv_broken_poll=no],
4177[ac_cv_broken_poll=no]))
4178AC_MSG_RESULT($ac_cv_broken_poll)
4179if test "$ac_cv_broken_poll" = yes
4180then
4181 AC_DEFINE(HAVE_BROKEN_POLL, 1,
4182 [Define if poll() sets errno on invalid file descriptors.])
4183fi
4184
4185# Before we can test tzset, we need to check if struct tm has a tm_zone
4186# (which is not required by ISO C or UNIX spec) and/or if we support
4187# tzname[]
4188AC_STRUCT_TIMEZONE
4189
4190# check tzset(3) exists and works like we expect it to
4191AC_MSG_CHECKING(for working tzset())
4192AC_CACHE_VAL(ac_cv_working_tzset, [
4193AC_RUN_IFELSE([AC_LANG_SOURCE([[
4194#include <stdlib.h>
4195#include <time.h>
4196#include <string.h>
4197
4198#if HAVE_TZNAME
4199extern char *tzname[];
4200#endif
4201
4202int main()
4203{
4204 /* Note that we need to ensure that not only does tzset(3)
4205 do 'something' with localtime, but it works as documented
4206 in the library reference and as expected by the test suite.
4207 This includes making sure that tzname is set properly if
4208 tm->tm_zone does not exist since it is the alternative way
4209 of getting timezone info.
4210
4211 Red Hat 6.2 doesn't understand the southern hemisphere
4212 after New Year's Day.
4213 */
4214
4215 time_t groundhogday = 1044144000; /* GMT-based */
4216 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
4217
4218 putenv("TZ=UTC+0");
4219 tzset();
4220 if (localtime(&groundhogday)->tm_hour != 0)
4221 exit(1);
4222#if HAVE_TZNAME
4223 /* For UTC, tzname[1] is sometimes "", sometimes " " */
4224 if (strcmp(tzname[0], "UTC") ||
4225 (tzname[1][0] != 0 && tzname[1][0] != ' '))
4226 exit(1);
4227#endif
4228
4229 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
4230 tzset();
4231 if (localtime(&groundhogday)->tm_hour != 19)
4232 exit(1);
4233#if HAVE_TZNAME
4234 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
4235 exit(1);
4236#endif
4237
4238 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
4239 tzset();
4240 if (localtime(&groundhogday)->tm_hour != 11)
4241 exit(1);
4242#if HAVE_TZNAME
4243 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
4244 exit(1);
4245#endif
4246
4247#if HAVE_STRUCT_TM_TM_ZONE
4248 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
4249 exit(1);
4250 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
4251 exit(1);
4252#endif
4253
4254 exit(0);
4255}
4256]])],
4257[ac_cv_working_tzset=yes],
4258[ac_cv_working_tzset=no],
4259[ac_cv_working_tzset=no])])
4260AC_MSG_RESULT($ac_cv_working_tzset)
4261if test "$ac_cv_working_tzset" = yes
4262then
4263 AC_DEFINE(HAVE_WORKING_TZSET, 1,
4264 [Define if tzset() actually switches the local timezone in a meaningful way.])
4265fi
4266
4267# Look for subsecond timestamps in struct stat
4268AC_MSG_CHECKING(for tv_nsec in struct stat)
4269AC_CACHE_VAL(ac_cv_stat_tv_nsec,
4270AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
4271struct stat st;
4272st.st_mtim.tv_nsec = 1;
4273]])],
4274[ac_cv_stat_tv_nsec=yes],
4275[ac_cv_stat_tv_nsec=no]))
4276AC_MSG_RESULT($ac_cv_stat_tv_nsec)
4277if test "$ac_cv_stat_tv_nsec" = yes
4278then
4279 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
4280 [Define if you have struct stat.st_mtim.tv_nsec])
4281fi
4282
4283# Look for BSD style subsecond timestamps in struct stat
4284AC_MSG_CHECKING(for tv_nsec2 in struct stat)
4285AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
4286AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
4287struct stat st;
4288st.st_mtimespec.tv_nsec = 1;
4289]])],
4290[ac_cv_stat_tv_nsec2=yes],
4291[ac_cv_stat_tv_nsec2=no]))
4292AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
4293if test "$ac_cv_stat_tv_nsec2" = yes
4294then
4295 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
4296 [Define if you have struct stat.st_mtimensec])
4297fi
4298
4299# On HP/UX 11.0, mvwdelch is a block with a return statement
4300AC_MSG_CHECKING(whether mvwdelch is an expression)
4301AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
4302AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4303 int rtn;
4304 rtn = mvwdelch(0,0,0);
4305]])],
4306[ac_cv_mvwdelch_is_expression=yes],
4307[ac_cv_mvwdelch_is_expression=no]))
4308AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
4309
4310if test "$ac_cv_mvwdelch_is_expression" = yes
4311then
4312 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
4313 [Define if mvwdelch in curses.h is an expression.])
4314fi
4315
4316AC_MSG_CHECKING(whether WINDOW has _flags)
4317AC_CACHE_VAL(ac_cv_window_has_flags,
4318AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4319 WINDOW *w;
4320 w->_flags = 0;
4321]])],
4322[ac_cv_window_has_flags=yes],
4323[ac_cv_window_has_flags=no]))
4324AC_MSG_RESULT($ac_cv_window_has_flags)
4325
4326
4327if test "$ac_cv_window_has_flags" = yes
4328then
4329 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
4330 [Define if WINDOW in curses.h offers a field _flags.])
4331fi
4332
4333AC_MSG_CHECKING(for is_term_resized)
4334AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])],
4335 [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
4336 AC_MSG_RESULT(yes)],
4337 [AC_MSG_RESULT(no)]
4338)
4339
4340AC_MSG_CHECKING(for resize_term)
4341AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])],
4342 [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
4343 AC_MSG_RESULT(yes)],
4344 [AC_MSG_RESULT(no)]
4345)
4346
4347AC_MSG_CHECKING(for resizeterm)
4348AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])],
4349 [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
4350 AC_MSG_RESULT(yes)],
4351 [AC_MSG_RESULT(no)]
4352)
4353
4354AC_MSG_NOTICE([checking for device files])
4355
4356dnl NOTE: Inform user how to proceed with files when cross compiling.
4357if test "x$cross_compiling" = xyes; then
4358 if test "${ac_cv_file__dev_ptmx+set}" != set; then
4359 AC_MSG_CHECKING([for /dev/ptmx])
4360 AC_MSG_RESULT([not set])
4361 AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
4362 fi
4363 if test "${ac_cv_file__dev_ptc+set}" != set; then
4364 AC_MSG_CHECKING([for /dev/ptc])
4365 AC_MSG_RESULT([not set])
4366 AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling])
4367 fi
4368fi
4369
4370AC_CHECK_FILE(/dev/ptmx, [], [])
4371if test "x$ac_cv_file__dev_ptmx" = xyes; then
4372 AC_DEFINE(HAVE_DEV_PTMX, 1,
4373 [Define to 1 if you have the /dev/ptmx device file.])
4374fi
4375AC_CHECK_FILE(/dev/ptc, [], [])
4376if test "x$ac_cv_file__dev_ptc" = xyes; then
4377 AC_DEFINE(HAVE_DEV_PTC, 1,
4378 [Define to 1 if you have the /dev/ptc device file.])
4379fi
4380
4381if test "$have_long_long" = yes
4382then
4383 AC_MSG_CHECKING(for %lld and %llu printf() format support)
4384 AC_CACHE_VAL(ac_cv_have_long_long_format,
4385 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
4386 #include <stdio.h>
4387 #include <stddef.h>
4388 #include <string.h>
4389
4390 #ifdef HAVE_SYS_TYPES_H
4391 #include <sys/types.h>
4392 #endif
4393
4394 int main()
4395 {
4396 char buffer[256];
4397
4398 if (sprintf(buffer, "%lld", (long long)123) < 0)
4399 return 1;
4400 if (strcmp(buffer, "123"))
4401 return 1;
4402
4403 if (sprintf(buffer, "%lld", (long long)-123) < 0)
4404 return 1;
4405 if (strcmp(buffer, "-123"))
4406 return 1;
4407
4408 if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
4409 return 1;
4410 if (strcmp(buffer, "123"))
4411 return 1;
4412
4413 return 0;
4414 }
4415 ]]])],
4416 [ac_cv_have_long_long_format=yes],
4417 [ac_cv_have_long_long_format=no],
4418 [ac_cv_have_long_long_format="cross -- assuming no"
4419 if test x$GCC = xyes; then
4420 save_CFLAGS=$CFLAGS
4421 CFLAGS="$CFLAGS -Werror -Wformat"
4422 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4423 #include <stdio.h>
4424 #include <stddef.h>
4425 ]], [[
4426 char *buffer;
4427 sprintf(buffer, "%lld", (long long)123);
4428 sprintf(buffer, "%lld", (long long)-123);
4429 sprintf(buffer, "%llu", (unsigned long long)123);
4430 ]])],
4431 ac_cv_have_long_long_format=yes
4432 )
4433 CFLAGS=$save_CFLAGS
4434 fi])
4435 )
4436 AC_MSG_RESULT($ac_cv_have_long_long_format)
4437fi
4438
4439if test "$ac_cv_have_long_long_format" = yes
4440then
4441 AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
4442 [Define to printf format modifier for long long type])
4443fi
4444
4445if test $ac_sys_system = Darwin
4446then
4447 LIBS="$LIBS -framework CoreFoundation"
4448fi
4449
4450
4451AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
4452AC_RUN_IFELSE([AC_LANG_SOURCE([[
4453#include <stdio.h>
4454#include <stddef.h>
4455#include <string.h>
4456
4457#ifdef HAVE_SYS_TYPES_H
4458#include <sys/types.h>
4459#endif
4460
4461#ifdef HAVE_SSIZE_T
4462typedef ssize_t Py_ssize_t;
4463#elif SIZEOF_VOID_P == SIZEOF_LONG
4464typedef long Py_ssize_t;
4465#else
4466typedef int Py_ssize_t;
4467#endif
4468
4469int main()
4470{
4471 char buffer[256];
4472
4473 if(sprintf(buffer, "%zd", (size_t)123) < 0)
4474 return 1;
4475
4476 if (strcmp(buffer, "123"))
4477 return 1;
4478
4479 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
4480 return 1;
4481
4482 if (strcmp(buffer, "-123"))
4483 return 1;
4484
4485 return 0;
4486}
4487]])],
4488[ac_cv_have_size_t_format=yes],
4489[ac_cv_have_size_t_format=no],
4490[ac_cv_have_size_t_format="cross -- assuming yes"
4491])])
4492if test "$ac_cv_have_size_t_format" != no ; then
4493 AC_DEFINE(PY_FORMAT_SIZE_T, "z",
4494 [Define to printf format modifier for Py_ssize_t])
4495fi
4496
4497AC_CHECK_TYPE(socklen_t,,
4498 AC_DEFINE(socklen_t,int,
4499 [Define to `int' if <sys/socket.h> does not define.]),[
4500#ifdef HAVE_SYS_TYPES_H
4501#include <sys/types.h>
4502#endif
4503#ifdef HAVE_SYS_SOCKET_H
4504#include <sys/socket.h>
4505#endif
4506])
4507
4508case $ac_sys_system in
4509AIX*)
4510 AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;;
4511esac
4512
4513
4514AC_SUBST(THREADHEADERS)
4515
4516for h in `(cd $srcdir;echo Python/thread_*.h)`
4517do
4518 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4519done
4520
4521AC_SUBST(SRCDIRS)
4522SRCDIRS="Parser Grammar Objects Python Modules Mac"
4523AC_MSG_CHECKING(for build directories)
4524for dir in $SRCDIRS; do
4525 if test ! -d $dir; then
4526 mkdir $dir
4527 fi
4528done
4529AC_MSG_RESULT(done)
4530
4531# generate output files
4532AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
4533AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
4534AC_OUTPUT
4535
4536echo "creating Modules/Setup"
4537if test ! -f Modules/Setup
4538then
4539 cp $srcdir/Modules/Setup.dist Modules/Setup
4540fi
4541
4542echo "creating Modules/Setup.local"
4543if test ! -f Modules/Setup.local
4544then
4545 echo "# Edit this file for local setup changes" >Modules/Setup.local
4546fi
4547
4548echo "creating Makefile"
4549$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4550 -s Modules Modules/Setup.config \
4551 Modules/Setup.local Modules/Setup
4552
4553case $ac_sys_system in
4554BeOS)
4555 AC_MSG_WARN([
4556
4557 Support for BeOS is deprecated as of Python 2.6.
4558 See PEP 11 for the gory details.
4559 ])
4560 ;;
4561*) ;;
4562esac
4563
4564mv config.c Modules
Note: See TracBrowser for help on using the repository browser.