1 dnl ***********************************************
2 dnl * Please run autoreconf to test your changes! *
3 dnl ***********************************************
4 dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.61).
6 # Set VERSION so we only need to edit in one place (i.e., here)
7 m4_define(PYTHON_VERSION, 2.7)
9 dnl Some m4 magic to ensure that the configure script is generated
10 dnl by the correct autoconf version.
11 m4_define([version_required],
12 [m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), 0,
14 [m4_fatal([Autoconf version $1 is required for Python], 63)])
16 version_required(2.61)
18 AC_REVISION($Revision$)
19 AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
20 AC_CONFIG_SRCDIR([Include/object.h])
21 AC_CONFIG_HEADER(pyconfig.h)
23 dnl Ensure that if prefix is specified, it does not end in a slash. If
24 dnl it does, we get path names containing '//' which is both ugly and
25 dnl can cause trouble.
27 dnl Last slash shouldn't be stripped if prefix=/
28 if test "$prefix" != "/"; then
29 prefix=`echo "$prefix" | sed -e 's/\/$//g'`
32 dnl This is for stuff that absolutely must end up in pyconfig.h.
33 dnl Please use pyport.h instead, if possible.
39 /* Define the macros needed if on a UnixWare 7.x system. */
40 #if defined(__USLC__) && defined(__SCO_VERSION__)
41 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
44 #endif /*Py_PYCONFIG_H*/
47 # We don't use PACKAGE_ variables, and they cause conflicts
48 # with other autoconf-based packages that include Python.h
49 grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
51 mv confdefs.h.new confdefs.h
54 VERSION=PYTHON_VERSION
59 # The later defininition of _XOPEN_SOURCE disables certain features
60 # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
61 AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
63 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
64 # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
66 AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
68 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
69 # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
71 AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
73 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
74 # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
75 AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
77 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
78 # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
80 AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
83 define_xopen_source=yes
85 # Arguments passed to configure.
87 CONFIG_ARGS="$ac_configure_args"
89 AC_ARG_ENABLE(universalsdk,
90 AC_HELP_STRING(--enable-universalsdk@<:@=SDKDIR@:>@, Build against Mac OS X 10.4u SDK (ppc/i386)),
94 enableval=/Developer/SDKs/MacOSX10.4u.sdk
103 UNIVERSALSDK=$enableval
110 AC_SUBST(UNIVERSALSDK)
112 AC_SUBST(ARCH_RUN_32BIT)
114 UNIVERSAL_ARCHS="32-bit"
115 AC_SUBST(LIPO_32BIT_FLAGS)
116 AC_MSG_CHECKING(for --with-universal-archs)
117 AC_ARG_WITH(universal-archs,
118 AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")),
120 AC_MSG_RESULT($withval)
121 UNIVERSAL_ARCHS="$withval"
122 if test "${enable_universalsdk}" ; then
125 AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
129 AC_MSG_RESULT(32-bit)
134 AC_ARG_WITH(framework-name,
135 AC_HELP_STRING(--with-framework-name=FRAMEWORK,
136 specify an alternate name of the framework built with --enable-framework),
138 if test "${enable_framework}"; then
141 AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
143 PYTHONFRAMEWORK=${withval}
144 PYTHONFRAMEWORKDIR=${withval}.framework
145 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
147 PYTHONFRAMEWORK=Python
148 PYTHONFRAMEWORKDIR=Python.framework
149 PYTHONFRAMEWORKIDENTIFIER=org.python.python
151 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
152 AC_ARG_ENABLE(framework,
153 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
157 enableval=/Library/Frameworks
162 PYTHONFRAMEWORKDIR=no-framework
163 PYTHONFRAMEWORKPREFIX=
164 PYTHONFRAMEWORKINSTALLDIR=
165 FRAMEWORKINSTALLFIRST=
166 FRAMEWORKINSTALLLAST=
167 FRAMEWORKALTINSTALLFIRST=
168 FRAMEWORKALTINSTALLLAST=
169 if test "x${prefix}" = "xNONE"; then
170 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
172 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
177 PYTHONFRAMEWORKPREFIX=$enableval
178 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
179 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
180 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
181 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
182 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
184 if test "x${prefix}" = "xNONE" ; then
185 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
187 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
189 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
191 # Add files for Mac specific code to the list of output
193 AC_CONFIG_FILES(Mac/Makefile)
194 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
195 AC_CONFIG_FILES(Mac/IDLE/Makefile)
196 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
197 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
201 PYTHONFRAMEWORKDIR=no-framework
202 PYTHONFRAMEWORKPREFIX=
203 PYTHONFRAMEWORKINSTALLDIR=
204 FRAMEWORKINSTALLFIRST=
205 FRAMEWORKINSTALLLAST=
206 FRAMEWORKALTINSTALLFIRST=
207 FRAMEWORKALTINSTALLLAST=
208 if test "x${prefix}" = "xNONE" ; then
209 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
211 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
216 AC_SUBST(PYTHONFRAMEWORK)
217 AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
218 AC_SUBST(PYTHONFRAMEWORKDIR)
219 AC_SUBST(PYTHONFRAMEWORKPREFIX)
220 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
221 AC_SUBST(FRAMEWORKINSTALLFIRST)
222 AC_SUBST(FRAMEWORKINSTALLLAST)
223 AC_SUBST(FRAMEWORKALTINSTALLFIRST)
224 AC_SUBST(FRAMEWORKALTINSTALLLAST)
225 AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
228 ## AC_HELP_STRING(--with-dyld,
229 ## Use (OpenStep|Rhapsody) dynamic linker))
231 # Set name for machine-dependent library files
233 AC_MSG_CHECKING(MACHDEP)
234 if test -z "$MACHDEP"
236 ac_sys_system=`uname -s`
237 if test "$ac_sys_system" = "AIX" \
238 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
239 ac_sys_release=`uname -v`
241 ac_sys_release=`uname -r`
243 ac_md_system=`echo $ac_sys_system |
244 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
245 ac_md_release=`echo $ac_sys_release |
246 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
247 MACHDEP="$ac_md_system$ac_md_release"
250 cygwin*) MACHDEP="cygwin";;
251 darwin*) MACHDEP="darwin";;
252 atheos*) MACHDEP="atheos";;
253 irix646) MACHDEP="irix6";;
254 '') MACHDEP="unknown";;
258 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
259 # disable features if it is defined, without any means to access these
260 # features as extensions. For these systems, we skip the definition of
261 # _XOPEN_SOURCE. Before adding a system to the list to gain access to
262 # some feature, make sure there is no alternative way to access this
263 # feature. Also, when using wildcards, make sure you have verified the
264 # need for not defining _XOPEN_SOURCE on all systems matching the
265 # wildcard, and that the wildcard does not include future systems
266 # (which may remove their limitations).
267 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
268 case $ac_sys_system/$ac_sys_release in
269 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
270 # even though select is a POSIX function. Reported by J. Ribbens.
271 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
272 OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123@:>@)
273 define_xopen_source=no
274 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
275 # also defined. This can be overridden by defining _BSD_SOURCE
276 # As this has a different meaning on Linux, only define it on OpenBSD
277 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
279 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
280 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
282 NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
283 define_xopen_source=no;;
284 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
285 # of union __?sigval. Reported by Stuart Bishop.
287 define_xopen_source=no;;
288 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
289 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
290 # Reconfirmed for 7.1.4 by Martin v. Loewis.
291 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
292 define_xopen_source=no;;
293 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
294 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
296 define_xopen_source=no;;
297 # On FreeBSD 4, the math functions C89 does not cover are never defined
298 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
300 define_xopen_source=no;;
301 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
302 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
303 # identifies itself as Darwin/7.*
304 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
305 # disables platform specific features beyond repair.
306 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
307 # has no effect, don't bother defining them
308 Darwin/@<:@6789@:>@.*)
309 define_xopen_source=no;;
310 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
311 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
312 # or has another value. By not (re)defining it, the defaults come in place.
314 define_xopen_source=no;;
316 if test `uname -r` -eq 1; then
317 define_xopen_source=no
320 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
321 # defining NI_NUMERICHOST.
323 define_xopen_source=no
328 if test $define_xopen_source = yes
330 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
331 # defined precisely as g++ defines it
332 # Furthermore, on Solaris 10, XPG6 requires the use of a C99
334 case $ac_sys_system/$ac_sys_release in
335 SunOS/5.8|SunOS/5.9|SunOS/5.10)
336 AC_DEFINE(_XOPEN_SOURCE, 500,
337 Define to the level of X/Open that your system supports)
340 AC_DEFINE(_XOPEN_SOURCE, 600,
341 Define to the level of X/Open that your system supports)
345 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
346 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
347 # several APIs are not declared. Since this is also needed in some
348 # cases for HP-UX, we define it globally.
349 # except for Solaris 10, where it must not be defined,
350 # as it implies XPG4.2
351 case $ac_sys_system/$ac_sys_release in
355 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
356 Define to activate Unix95-and-earlier features)
360 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
365 # SGI compilers allow the specification of the both the ABI and the
366 # ISA on the command line. Depending on the values of these switches,
367 # different and often incompatable code will be generated.
369 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
370 # thus supply support for various ABI/ISA combinations. The MACHDEP
371 # variable is also adjusted.
374 if test ! -z "$SGI_ABI"
377 LDFLAGS="$SGI_ABI $LDFLAGS"
378 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
380 AC_MSG_RESULT($MACHDEP)
382 # And add extra plat-mac for darwin
383 AC_SUBST(EXTRAPLATDIR)
384 AC_SUBST(EXTRAMACHDEPPATH)
385 AC_MSG_CHECKING(EXTRAPLATDIR)
386 if test -z "$EXTRAPLATDIR"
390 EXTRAPLATDIR="\$(PLATMACDIRS)"
391 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
399 AC_MSG_RESULT($EXTRAPLATDIR)
401 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
402 # it may influence the way we can build extensions, so distutils
404 AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
405 AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
406 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
407 EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
409 AC_MSG_CHECKING(machine type as reported by uname -m)
410 ac_sys_machine=`uname -m`
411 AC_MSG_RESULT($ac_sys_machine)
413 # checks for alternative programs
415 # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
416 # for debug/optimization stuff. BASECFLAGS is for flags that are required
417 # just to get things to compile and link. Users are free to override OPT
418 # when running configure or make. The build should not break if they do.
419 # BASECFLAGS should generally not be messed with, however.
421 # XXX shouldn't some/most/all of this code be merged with the stuff later
422 # on that fiddles with OPT and BASECFLAGS?
423 AC_MSG_CHECKING(for --without-gcc)
425 AC_HELP_STRING(--without-gcc,never use gcc),
433 without_gcc=$withval;;
435 case $ac_sys_system in
443 BASECFLAGS="$BASECFLAGS -export pragma"
445 LDFLAGS="$LDFLAGS -nodup"
453 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
456 AR="\$(srcdir)/Modules/ar_beos"
461 AC_MSG_RESULT($without_gcc)
463 # If the user switches compilers, we can't believe the cache
464 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
466 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
467 (it is also a good idea to do 'make clean' before compiling)])
474 AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
475 AC_ARG_WITH(cxx_main,
476 AC_HELP_STRING([--with-cxx-main=<compiler>],
477 [compile main() and link python executable with C++ compiler]),
483 yes) with_cxx_main=yes
495 AC_MSG_RESULT($with_cxx_main)
501 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
502 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
504 if test "$CXX" = "notfound"
511 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
512 if test "$CXX" = "notfound"
517 if test "$preset_cxx" != "$CXX"
521 By default, distutils will build C++ extension modules with "$CXX".
522 If this is not intended, then set CXX on the configure command line.
527 # checks for UNIX variants that set C preprocessor variables
530 # Check for unsupported systems
531 case $ac_sys_system/$ac_sys_release in
533 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
534 echo See README for details.
539 AC_MSG_CHECKING(for --with-suffix)
541 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
548 AC_MSG_RESULT($EXEEXT)
550 # Test whether we're running on a non-case-sensitive system, in which
551 # case we give a warning if no ext is given
552 AC_SUBST(BUILDEXEEXT)
553 AC_MSG_CHECKING(for case-insensitive build directory)
554 if test ! -d CaseSensitiveTestDir; then
555 mkdir CaseSensitiveTestDir
558 if test -d casesensitivetestdir
566 rmdir CaseSensitiveTestDir
571 gcc) CC="$CC -D_HAVE_BSDI";;
575 case $ac_sys_system in
578 cc|*/cc) CC="$CC -Ae";;
581 # Some functions have a prototype only with that define, e.g. confstr
582 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
588 AC_MSG_CHECKING(LIBRARY)
589 if test -z "$LIBRARY"
591 LIBRARY='libpython$(VERSION).a'
593 AC_MSG_RESULT($LIBRARY)
595 # LDLIBRARY is the name of the library to link against (as opposed to the
596 # name of the library into which to insert object files). BLDLIBRARY is also
597 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
598 # is blank as the main program is not linked directly against LDLIBRARY.
599 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
600 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
601 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
602 # DLLLIBRARY is the shared (i.e., DLL) library.
604 # RUNSHARED is used to run shared python without installed libraries
606 # INSTSONAME is the name of the shared library that will be use to install
607 # on the system - some systems like version suffix, others don't
611 AC_SUBST(LDLIBRARYDIR)
615 BLDLIBRARY='$(LDLIBRARY)'
616 INSTSONAME='$(LDLIBRARY)'
621 # LINKCC is the command that links the python executable -- default is $(CC).
622 # If CXX is set, and if it is needed to link a main function that was
623 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
624 # python might then depend on the C++ runtime
625 # This is altered for AIX in order to build the export list before
628 AC_MSG_CHECKING(LINKCC)
631 LINKCC='$(PURIFY) $(MAINCC)'
632 case $ac_sys_system in
635 if test $ac_sys_release -ge 5 -o \
636 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
639 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
641 # qcc must be used because the other compilers do not
646 AC_MSG_RESULT($LINKCC)
648 # GNULD is set to "yes" if the GNU linker is used. If this goes wrong
649 # make sure we default having it set to "no": this is used by
650 # distutils.unixccompiler to know if it should add --enable-new-dtags
651 # to linker command lines, and failing to detect GNU ld simply results
652 # in the same bahaviour as before.
654 AC_MSG_CHECKING(for GNU ld)
656 if test "$GCC" = yes; then
657 ac_prog=`$CC -print-prog-name=ld`
659 case `"$ac_prog" -V 2>&1 < /dev/null` in
665 AC_MSG_RESULT($GNULD)
667 AC_MSG_CHECKING(for --enable-shared)
668 AC_ARG_ENABLE(shared,
669 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
671 if test -z "$enable_shared"
673 case $ac_sys_system in
675 enable_shared="yes";;
680 AC_MSG_RESULT($enable_shared)
682 AC_MSG_CHECKING(for --enable-profiling)
683 AC_ARG_ENABLE(profiling,
684 AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
687 AC_TRY_RUN([int main() { return 0; }],
688 ac_enable_profiling="yes",
689 ac_enable_profiling="no",
690 ac_enable_profiling="no")
692 AC_MSG_RESULT($ac_enable_profiling)
694 case "$ac_enable_profiling" in
696 BASECFLAGS="-pg $BASECFLAGS"
697 LDFLAGS="-pg $LDFLAGS"
701 AC_MSG_CHECKING(LDLIBRARY)
703 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
704 # library that we build, but we do not want to link against it (we
705 # will find it with a -framework option). For this reason there is an
706 # extra variable BLDLIBRARY against which Python and the extension
707 # modules are linked, BLDLIBRARY. This is normally the same as
708 # LDLIBRARY, but empty for MacOSX framework builds.
709 if test "$enable_framework"
711 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
712 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
715 BLDLIBRARY='$(LDLIBRARY)'
718 # Other platforms follow
719 if test $enable_shared = "yes"; then
720 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
721 case $ac_sys_system in
723 LDLIBRARY='libpython$(VERSION).so'
726 LDLIBRARY='libpython$(VERSION).dll.a'
727 DLLLIBRARY='libpython$(VERSION).dll'
730 LDLIBRARY='libpython$(VERSION).so'
731 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
732 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
733 INSTSONAME="$LDLIBRARY".$SOVERSION
735 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
736 LDLIBRARY='libpython$(VERSION).so'
737 BLDLIBRARY='-L. -lpython$(VERSION)'
738 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
739 case $ac_sys_system in
741 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
744 INSTSONAME="$LDLIBRARY".$SOVERSION
749 LDLIBRARY='libpython$(VERSION).so'
752 LDLIBRARY='libpython$(VERSION).sl'
755 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
756 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
759 LDLIBRARY='libpython$(VERSION).so'
760 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
761 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
764 LDLIBRARY='libpython$(VERSION).so'
765 BLDLIBRARY='-L. -lpython$(VERSION)'
766 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
769 LDLIBRARY='libpython$(VERSION).dylib'
770 BLDLIBRARY='-L. -lpython$(VERSION)'
771 RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
775 else # shared is disabled
776 case $ac_sys_system in
778 BLDLIBRARY='$(LIBRARY)'
779 LDLIBRARY='libpython$(VERSION).dll.a'
784 AC_MSG_RESULT($LDLIBRARY)
788 AC_CHECK_PROGS(AR, ar aal, ar)
790 # tweak ARFLAGS only if the user didn't set it on the command line
792 if test -z "$ARFLAGS"
798 AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
799 if test $SVNVERSION = found
801 SVNVERSION="svnversion \$(srcdir)"
803 SVNVERSION="echo Unversioned directory"
808 # install -d does not work on BSDI or HP-UX
809 if test -z "$INSTALL"
811 INSTALL="${srcdir}/install-sh -c"
816 # Not every filesystem supports hard links
818 if test -z "$LN" ; then
819 case $ac_sys_system in
821 CYGWIN*) LN="ln -s";;
822 atheos*) LN="ln -s";;
827 # Check for --with-pydebug
828 AC_MSG_CHECKING(for --with-pydebug)
830 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
832 if test "$withval" != no
834 AC_DEFINE(Py_DEBUG, 1,
835 [Define if you want to build an interpreter with many run-time checks.])
838 else AC_MSG_RESULT(no); Py_DEBUG='false'
842 # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
843 # merged with this chunk of code?
845 # Optimizer/debugger flags
846 # ------------------------
847 # (The following bit of code is complicated enough - please keep things
848 # indented properly. Just pretend you're editing Python code. ;-)
850 # There are two parallel sets of case statements below, one that checks to
851 # see if OPT was set and one that does BASECFLAGS setting based upon
852 # compiler and platform. BASECFLAGS tweaks need to be made even if the
855 # tweak OPT based on compiler and platform, only if the user didn't set
856 # it on the command line
862 if test "$CC" != 'g++' ; then
863 STRICT_PROTO="-Wstrict-prototypes"
865 # For gcc 4.x we need to use -fwrapv so lets check if its supported
866 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
869 case $ac_cv_prog_cc_g in
871 if test "$Py_DEBUG" = 'true' ; then
872 # Optimization messes up debuggers, so turn it off for
874 OPT="-g -Wall $STRICT_PROTO"
876 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
880 OPT="-O3 -Wall $STRICT_PROTO"
883 case $ac_sys_system in
884 SCO_SV*) OPT="$OPT -m486 -DSCO5"
897 # The -arch flags for universal builds on OSX
898 UNIVERSAL_ARCH_FLAGS=
899 AC_SUBST(UNIVERSAL_ARCH_FLAGS)
901 # tweak BASECFLAGS based on compiler and platform
904 # Python violates C99 rules, by casting between incompatible
905 # pointer types. GCC may generate bad code as a result of that,
906 # so use -fno-strict-aliasing if supported.
907 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
909 CC="$CC -fno-strict-aliasing"
910 AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
911 AC_TRY_COMPILE([],[int main() { return 0; }],
912 ac_cv_no_strict_aliasing_ok=yes,
913 ac_cv_no_strict_aliasing_ok=no))
915 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
916 if test $ac_cv_no_strict_aliasing_ok = yes
918 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
921 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
922 # support. Without this, treatment of subnormals doesn't follow
924 case $ac_sys_machine in
926 BASECFLAGS="$BASECFLAGS -mieee"
930 case $ac_sys_system in
932 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
934 # is there any other compiler on Darwin besides gcc?
936 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
937 # used to be here, but non-Apple gcc doesn't accept them.
940 if test "${enable_universalsdk}"; then
941 UNIVERSAL_ARCH_FLAGS=""
942 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
943 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
945 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
947 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
948 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
950 ARCH_RUN_32BIT="true"
952 elif test "$UNIVERSAL_ARCHS" = "all" ; then
953 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
954 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
955 ARCH_RUN_32BIT="arch -i386 -ppc"
957 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
958 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
959 LIPO_32BIT_FLAGS="-extract i386"
960 ARCH_RUN_32BIT="arch -i386"
962 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
963 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
964 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
965 ARCH_RUN_32BIT="arch -i386 -ppc7400"
968 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
973 BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
974 tgt=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
975 if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
976 CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
980 # Calculate the right deployment target for this build.
982 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
983 if test ${cur_target} '>' 10.2; then
985 if test ${enable_universalsdk}; then
986 if test "${UNIVERSAL_ARCHS}" = "all"; then
987 # Ensure that the default platform for a
988 # 4-way universal build is OSX 10.5,
989 # that's the first OS release where
990 # 4-way builds make sense.
993 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
996 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
999 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
1003 if test `arch` = "i386"; then
1004 # On Intel macs default to a deployment
1005 # target of 10.4, that's the first OSX
1006 # release with Intel support.
1011 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1013 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1014 # environment with a value that is the same as what we'll use
1015 # in the Makefile to ensure that we'll get the same compiler
1016 # environment during configure and build time.
1017 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1018 export MACOSX_DEPLOYMENT_TARGET
1019 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1023 BASECFLAGS="$BASECFLAGS -mieee"
1029 case $ac_sys_system in
1030 OpenUNIX*|UnixWare*)
1031 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1034 BASECFLAGS="$BASECFLAGS -ieee -std"
1037 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1043 if test "$Py_DEBUG" = 'true'; then
1049 if test "$ac_arch_flags"
1051 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
1054 # disable check for icc since it seems to pass, but generates a warning
1057 ac_cv_opt_olimit_ok=no
1060 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1061 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1063 CC="$CC -OPT:Olimit=0"
1064 AC_TRY_COMPILE([],[int main() { return 0; }],
1065 ac_cv_opt_olimit_ok=yes,
1066 ac_cv_opt_olimit_ok=no,
1069 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
1070 if test $ac_cv_opt_olimit_ok = yes; then
1071 case $ac_sys_system in
1072 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1073 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1078 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1082 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1083 AC_CACHE_VAL(ac_cv_olimit_ok,
1085 CC="$CC -Olimit 1500"
1086 AC_TRY_COMPILE([],[int main() { return 0; }],
1087 ac_cv_olimit_ok=yes,
1091 AC_MSG_RESULT($ac_cv_olimit_ok)
1092 if test $ac_cv_olimit_ok = yes; then
1093 BASECFLAGS="$BASECFLAGS -Olimit 1500"
1097 # Check whether GCC supports PyArg_ParseTuple format
1098 if test "$GCC" = "yes"
1100 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1102 CFLAGS="$CFLAGS -Werror"
1104 void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
1106 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1113 # On some compilers, pthreads are available without further options
1114 # (e.g. MacOS X). On some of these systems, the compiler will not
1115 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1116 # So we have to see first whether pthreads are available without
1117 # options before we can check whether -Kpthread improves anything.
1118 AC_MSG_CHECKING(whether pthreads are available without options)
1119 AC_CACHE_VAL(ac_cv_pthread_is_default,
1121 #include <pthread.h>
1123 void* routine(void* p){return NULL;}
1127 if(pthread_create(&p,NULL,routine,NULL)!=0)
1129 (void)pthread_detach(p);
1134 ac_cv_pthread_is_default=yes
1138 ac_cv_pthread_is_default=no,
1139 ac_cv_pthread_is_default=no)
1141 AC_MSG_RESULT($ac_cv_pthread_is_default)
1144 if test $ac_cv_pthread_is_default = yes
1148 # -Kpthread, if available, provides the right #defines
1149 # and linker options to make pthread_create available
1150 # Some compilers won't report that they do not support -Kpthread,
1151 # so we need to run a program to see whether it really made the
1152 # function available.
1153 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1154 AC_CACHE_VAL(ac_cv_kpthread,
1158 #include <pthread.h>
1160 void* routine(void* p){return NULL;}
1164 if(pthread_create(&p,NULL,routine,NULL)!=0)
1166 (void)pthread_detach(p);
1174 AC_MSG_RESULT($ac_cv_kpthread)
1177 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
1179 # -Kthread, if available, provides the right #defines
1180 # and linker options to make pthread_create available
1181 # Some compilers won't report that they do not support -Kthread,
1182 # so we need to run a program to see whether it really made the
1183 # function available.
1184 AC_MSG_CHECKING(whether $CC accepts -Kthread)
1185 AC_CACHE_VAL(ac_cv_kthread,
1189 #include <pthread.h>
1191 void* routine(void* p){return NULL;}
1195 if(pthread_create(&p,NULL,routine,NULL)!=0)
1197 (void)pthread_detach(p);
1205 AC_MSG_RESULT($ac_cv_kthread)
1208 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
1210 # -pthread, if available, provides the right #defines
1211 # and linker options to make pthread_create available
1212 # Some compilers won't report that they do not support -pthread,
1213 # so we need to run a program to see whether it really made the
1214 # function available.
1215 AC_MSG_CHECKING(whether $CC accepts -pthread)
1216 AC_CACHE_VAL(ac_cv_thread,
1220 #include <pthread.h>
1222 void* routine(void* p){return NULL;}
1226 if(pthread_create(&p,NULL,routine,NULL)!=0)
1228 (void)pthread_detach(p);
1236 AC_MSG_RESULT($ac_cv_pthread)
1239 # If we have set a CC compiler flag for thread support then
1240 # check if it works for CXX, too.
1244 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1247 if test "$ac_cv_kpthread" = "yes"
1249 CXX="$CXX -Kpthread"
1250 ac_cv_cxx_thread=yes
1251 elif test "$ac_cv_kthread" = "yes"
1254 ac_cv_cxx_thread=yes
1255 elif test "$ac_cv_pthread" = "yes"
1258 ac_cv_cxx_thread=yes
1261 if test $ac_cv_cxx_thread = yes
1263 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1264 $CXX -c conftest.$ac_ext 2>&5
1265 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1266 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1268 ac_cv_cxx_thread=yes
1274 AC_MSG_RESULT($ac_cv_cxx_thread)
1278 dnl # check for ANSI or K&R ("traditional") preprocessor
1279 dnl AC_MSG_CHECKING(for C preprocessor type)
1280 dnl AC_TRY_COMPILE([
1281 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1283 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1284 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
1285 dnl AC_MSG_RESULT($cpp_type)
1287 # checks for header files
1289 AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1291 ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
1292 shadow.h signal.h stdint.h stropts.h termios.h thread.h \
1294 sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1295 sys/lock.h sys/mkdev.h sys/modem.h \
1296 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
1297 sys/termio.h sys/time.h \
1298 sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
1299 sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1300 bluetooth/bluetooth.h linux/tipc.h)
1304 # On Solaris, term.h requires curses.h
1305 AC_CHECK_HEADERS(term.h,,,[
1306 #ifdef HAVE_CURSES_H
1311 # On Linux, netlink.h requires asm/types.h
1312 AC_CHECK_HEADERS(linux/netlink.h,,,[
1313 #ifdef HAVE_ASM_TYPES_H
1314 #include <asm/types.h>
1316 #ifdef HAVE_SYS_SOCKET_H
1317 #include <sys/socket.h>
1321 # checks for typedefs
1323 AC_MSG_CHECKING(for clock_t in time.h)
1324 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1325 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1327 AC_MSG_RESULT($was_it_defined)
1329 # Check whether using makedev requires defining _OSF_SOURCE
1330 AC_MSG_CHECKING(for makedev)
1331 AC_TRY_LINK([#include <sys/types.h> ],
1333 ac_cv_has_makedev=yes,
1334 ac_cv_has_makedev=no)
1335 if test "$ac_cv_has_makedev" = "no"; then
1336 # we didn't link, try if _OSF_SOURCE will allow us to link
1338 #define _OSF_SOURCE 1
1339 #include <sys/types.h>
1342 ac_cv_has_makedev=yes,
1343 ac_cv_has_makedev=no)
1344 if test "$ac_cv_has_makedev" = "yes"; then
1345 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1348 AC_MSG_RESULT($ac_cv_has_makedev)
1349 if test "$ac_cv_has_makedev" = "yes"; then
1350 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1353 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1354 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1355 # defined, but the compiler does not support pragma redefine_extname,
1356 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1357 # structures (such as rlimit64) without declaring them. As a
1358 # work-around, disable LFS on such configurations
1361 AC_MSG_CHECKING(Solaris LFS bug)
1363 #define _LARGEFILE_SOURCE 1
1364 #define _FILE_OFFSET_BITS 64
1365 #include <sys/resource.h>
1366 ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1367 AC_MSG_RESULT($sol_lfs_bug)
1368 if test "$sol_lfs_bug" = "yes"; then
1372 if test "$use_lfs" = "yes"; then
1373 # Two defines needed to enable largefile support on various platforms
1374 # These may affect some typedefs
1375 AC_DEFINE(_LARGEFILE_SOURCE, 1,
1376 [This must be defined on some systems to enable large file support.])
1377 AC_DEFINE(_FILE_OFFSET_BITS, 64,
1378 [This must be set to 64 on some systems to enable large file support.])
1381 # Add some code to confdefs.h so that the test for off_t works on SCO
1382 cat >> confdefs.h <<\EOF
1388 # Type availability checks
1399 AC_CHECK_TYPE(ssize_t,
1400 AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
1402 # Sizes of various common basic types
1403 # ANSI C requires sizeof(char) == 1, so no need to check it
1404 AC_CHECK_SIZEOF(int, 4)
1405 AC_CHECK_SIZEOF(long, 4)
1406 AC_CHECK_SIZEOF(void *, 4)
1407 AC_CHECK_SIZEOF(short, 2)
1408 AC_CHECK_SIZEOF(float, 4)
1409 AC_CHECK_SIZEOF(double, 8)
1410 AC_CHECK_SIZEOF(fpos_t, 4)
1411 AC_CHECK_SIZEOF(size_t, 4)
1412 AC_CHECK_SIZEOF(pid_t, 4)
1414 AC_MSG_CHECKING(for long long support)
1416 AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1417 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1420 AC_MSG_RESULT($have_long_long)
1421 if test "$have_long_long" = yes ; then
1422 AC_CHECK_SIZEOF(long long, 8)
1425 AC_MSG_CHECKING(for long double support)
1427 AC_TRY_COMPILE([], [long double x; x = (long double)0.;], [
1428 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1429 have_long_double=yes
1431 AC_MSG_RESULT($have_long_double)
1432 if test "$have_long_double" = yes ; then
1433 AC_CHECK_SIZEOF(long double, 12)
1436 AC_MSG_CHECKING(for _Bool support)
1438 AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [
1439 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1442 AC_MSG_RESULT($have_c99_bool)
1443 if test "$have_c99_bool" = yes ; then
1444 AC_CHECK_SIZEOF(_Bool, 1)
1447 AC_CHECK_TYPES(uintptr_t,
1448 [AC_CHECK_SIZEOF(uintptr_t, 4)],
1449 [], [#ifdef HAVE_STDINT_H
1453 AC_CHECK_SIZEOF(off_t, [], [
1454 #ifdef HAVE_SYS_TYPES_H
1455 #include <sys/types.h>
1459 AC_MSG_CHECKING(whether to enable large file support)
1460 if test "$have_long_long" = yes
1462 if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1463 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1464 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1465 [Defined to enable large file support when an off_t is bigger than a long
1466 and long long is available and at least as big as an off_t. You may need
1467 to add some flags for configuration and compilation to enable this mode.
1468 (For Solaris and Linux, the necessary defines are already defined.)])
1477 AC_CHECK_SIZEOF(time_t, [], [
1478 #ifdef HAVE_SYS_TYPES_H
1479 #include <sys/types.h>
1486 # if have pthread_t then define SIZEOF_PTHREAD_T
1488 if test "$ac_cv_kpthread" = "yes"
1489 then CC="$CC -Kpthread"
1490 elif test "$ac_cv_kthread" = "yes"
1491 then CC="$CC -Kthread"
1492 elif test "$ac_cv_pthread" = "yes"
1493 then CC="$CC -pthread"
1495 AC_MSG_CHECKING(for pthread_t)
1497 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
1498 AC_MSG_RESULT($have_pthread_t)
1499 if test "$have_pthread_t" = yes ; then
1500 AC_CHECK_SIZEOF(pthread_t, [], [
1501 #ifdef HAVE_PTHREAD_H
1502 #include <pthread.h>
1508 AC_MSG_CHECKING(for --enable-toolbox-glue)
1509 AC_ARG_ENABLE(toolbox-glue,
1510 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
1512 if test -z "$enable_toolbox_glue"
1514 case $ac_sys_system/$ac_sys_release in
1516 enable_toolbox_glue="yes";;
1518 enable_toolbox_glue="no";;
1521 case "$enable_toolbox_glue" in
1523 extra_machdep_objs="Python/mactoolboxglue.o"
1524 extra_undefs="-u _PyMac_Error"
1525 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1526 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
1529 extra_machdep_objs=""
1533 AC_MSG_RESULT($enable_toolbox_glue)
1536 AC_SUBST(OTHER_LIBTOOL_OPT)
1537 case $ac_sys_system/$ac_sys_release in
1538 Darwin/@<:@01567@:>@\..*)
1539 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1542 OTHER_LIBTOOL_OPT=""
1548 AC_SUBST(LIBTOOL_CRUFT)
1549 case $ac_sys_system/$ac_sys_release in
1550 Darwin/@<:@01567@:>@\..*)
1551 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1552 if test "${enable_universalsdk}"; then
1555 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
1557 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1558 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1560 gcc_version=`gcc -v 2>&1 | grep version | cut -d\ -f3`
1561 if test ${gcc_version} '<' 4.0
1563 LIBTOOL_CRUFT="-lcc_dynamic"
1569 int main(int argc, char*argv[])
1571 if (sizeof(long) == 4) {
1577 ], ac_osx_32bit=yes,
1581 if test "${ac_osx_32bit}" = "yes"; then
1584 MACOSX_DEFAULT_ARCH="i386"
1587 MACOSX_DEFAULT_ARCH="ppc"
1590 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1596 MACOSX_DEFAULT_ARCH="x86_64"
1599 MACOSX_DEFAULT_ARCH="ppc64"
1602 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1606 #ARCH_RUN_32BIT="true"
1609 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
1610 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1611 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1614 AC_MSG_CHECKING(for --enable-framework)
1615 if test "$enable_framework"
1617 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
1618 # -F. is needed to allow linking to the framework while
1619 # in the build location.
1620 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1621 [Define if you want to produce an OpenStep/Rhapsody framework
1622 (shared library plus accessory files).])
1624 if test $enable_shared = "yes"
1626 AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.])
1632 AC_MSG_CHECKING(for dyld)
1633 case $ac_sys_system/$ac_sys_release in
1635 AC_DEFINE(WITH_DYLD, 1,
1636 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1637 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1638 linker (rld). Dyld is necessary to support frameworks.])
1639 AC_MSG_RESULT(always on for Darwin)
1646 # Set info about shared libraries.
1651 AC_SUBST(LINKFORSHARED)
1652 # SO is the extension of shared libraries `(including the dot!)
1653 # -- usually .so, .sl on HP-UX, .dll on Cygwin
1657 case $ac_sys_system in
1668 # this might also be a termcap variable, see #610332
1670 echo '====================================================================='
1672 echo '+ WARNING: You have set SO in your environment. +'
1673 echo '+ Do you really mean to change the extension for shared libraries? +'
1674 echo '+ Continuing in 10 seconds to let you to ponder. +'
1676 echo '====================================================================='
1681 AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
1682 # LDSHARED is the ld *command* used to create shared library
1683 # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
1684 # (Shared libraries in this instance are shared modules to be loaded into
1685 # Python, as opposed to building Python itself as a shared library.)
1686 AC_MSG_CHECKING(LDSHARED)
1687 if test -z "$LDSHARED"
1689 case $ac_sys_system/$ac_sys_release in
1691 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
1692 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
1695 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
1696 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
1698 IRIX/5*) LDSHARED="ld -shared";;
1699 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1701 if test "$GCC" = "yes"
1702 then LDSHARED='$(CC) -shared'
1703 else LDSHARED='$(CC) -G';
1706 if test "$GCC" = "yes"
1707 then LDSHARED='$(CC) -shared'
1708 else LDSHARED='ld -b';
1710 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1712 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1713 if test "$enable_framework" ; then
1714 # Link against the framework. All externals should be defined.
1715 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1716 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1718 # No framework. Ignore undefined symbols, assuming they come from Python
1719 LDSHARED="$LDSHARED -undefined suppress"
1721 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
1722 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1723 if test "$enable_framework" ; then
1724 # Link against the framework. All externals should be defined.
1725 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1726 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1728 # No framework, use the Python app as bundle-loader
1729 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1730 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1733 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1734 # This allows an extension to be used in any Python
1736 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
1738 if test "${enable_universalsdk}"; then
1739 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1741 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1742 BLDSHARED="$LDSHARED"
1744 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1745 if test "$enable_framework" ; then
1746 # Link against the framework. All externals should be defined.
1747 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1748 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1750 # No framework, use the Python app as bundle-loader
1751 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1752 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1756 Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';;
1757 BSD/OS*/4*) LDSHARED="gcc -shared";;
1759 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1761 LDSHARED="$CC -shared ${LDFLAGS}"
1763 LDSHARED="ld -Bshareable ${LDFLAGS}"
1766 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1768 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1771 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
1772 LDSHARED="ld -Bshareable ${LDFLAGS}"
1775 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1779 NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
1780 OpenUNIX*|UnixWare*)
1781 if test "$GCC" = "yes"
1782 then LDSHARED='$(CC) -shared'
1783 else LDSHARED='$(CC) -G'
1785 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1786 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1787 atheos*) LDSHARED="gcc -shared";;
1791 AC_MSG_RESULT($LDSHARED)
1792 BLDSHARED=${BLDSHARED-$LDSHARED}
1793 # CCSHARED are the C *flags* used to create objects to go into a shared
1794 # library (module) -- this is only needed for a few systems
1795 AC_MSG_CHECKING(CCSHARED)
1796 if test -z "$CCSHARED"
1798 case $ac_sys_system/$ac_sys_release in
1799 SunOS*) if test "$GCC" = yes;
1800 then CCSHARED="-fPIC";
1801 elif test `uname -p` = sparc;
1802 then CCSHARED="-xcode=pic32";
1803 else CCSHARED="-Kpic";
1805 hp*|HP*) if test "$GCC" = yes;
1806 then CCSHARED="-fPIC";
1809 Linux*|GNU*) CCSHARED="-fPIC";;
1810 BSD/OS*/4*) CCSHARED="-fpic";;
1811 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
1812 OpenUNIX*|UnixWare*)
1813 if test "$GCC" = "yes"
1814 then CCSHARED="-fPIC"
1815 else CCSHARED="-KPIC"
1818 if test "$GCC" = "yes"
1819 then CCSHARED="-fPIC"
1820 else CCSHARED="-Kpic -belf"
1822 IRIX*/6*) case $CC in
1823 *gcc*) CCSHARED="-shared";;
1826 atheos*) CCSHARED="-fPIC";;
1829 AC_MSG_RESULT($CCSHARED)
1830 # LINKFORSHARED are the flags passed to the $(CC) command that links
1831 # the python executable -- this is only needed for a few systems
1832 AC_MSG_CHECKING(LINKFORSHARED)
1833 if test -z "$LINKFORSHARED"
1835 case $ac_sys_system/$ac_sys_release in
1836 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1838 LINKFORSHARED="-Wl,-E -Wl,+s";;
1839 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1840 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1841 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1842 # -u libsys_s pulls in all symbols in libsys
1844 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1846 # not used by the core itself but which needs to be in the core so
1847 # that dynamically loaded extension modules have access to it.
1848 # -prebind is no longer used, because it actually seems to give a
1849 # slowdown in stead of a speedup, maybe due to the large number of
1850 # dynamic loads Python does.
1852 LINKFORSHARED="$extra_undefs"
1853 if test "$enable_framework"
1855 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1857 LINKFORSHARED="$LINKFORSHARED";;
1858 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1859 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1860 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1861 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
1862 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1864 LINKFORSHARED="-Wl,--export-dynamic"
1866 SunOS/5*) case $CC in
1868 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
1870 LINKFORSHARED="-Xlinker --export-dynamic"
1874 if test $enable_shared = "no"
1876 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1879 # -Wl,-E causes the symbols to be added to the dynamic
1880 # symbol table so that they can be found when a module
1881 # is loaded. -N 2048K causes the stack size to be set
1882 # to 2048 kilobytes so that the stack doesn't overflow
1883 # when running test_compile.py.
1884 LINKFORSHARED='-Wl,-E -N 2048K';;
1887 AC_MSG_RESULT($LINKFORSHARED)
1890 AC_SUBST(CFLAGSFORSHARED)
1891 AC_MSG_CHECKING(CFLAGSFORSHARED)
1892 if test ! "$LIBRARY" = "$LDLIBRARY"
1894 case $ac_sys_system in
1896 # Cygwin needs CCSHARED when building extension DLLs
1897 # but not when building the interpreter DLL.
1898 CFLAGSFORSHARED='';;
1900 CFLAGSFORSHARED='$(CCSHARED)'
1903 AC_MSG_RESULT($CFLAGSFORSHARED)
1905 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
1906 # library (with --enable-shared).
1907 # For platforms on which shared libraries are not allowed to have unresolved
1908 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
1909 # if it is not required, since it creates a dependency of the shared library
1910 # to LIBS. This, in turn, means that applications linking the shared libpython
1911 # don't need to link LIBS explicitly. The default should be only changed
1912 # on systems where this approach causes problems.
1914 AC_MSG_CHECKING(SHLIBS)
1915 case "$ac_sys_system" in
1919 AC_MSG_RESULT($SHLIBS)
1922 # checks for libraries
1923 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1924 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
1926 # only check for sem_init if thread support is requested
1927 if test "$with_threads" = "yes" -o -z "$with_threads"; then
1928 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
1929 # posix4 on Solaris 2.6
1930 # pthread (first!) on Linux
1933 # check if we need libintl for locale functions
1934 AC_CHECK_LIB(intl, textdomain,
1935 AC_DEFINE(WITH_LIBINTL, 1,
1936 [Define to 1 if libintl is needed for locale functions.]))
1938 # checks for system dependent C++ extensions support
1939 case "$ac_sys_system" in
1940 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1941 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1942 [loadAndInit("", 0, "")],
1943 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1944 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1945 and you want support for AIX C++ shared extension modules.])
1946 AC_MSG_RESULT(yes)],
1947 [AC_MSG_RESULT(no)]);;
1951 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1952 # BeOS' sockets are stashed in libnet.
1953 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
1954 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
1956 case "$ac_sys_system" in
1958 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1962 AC_MSG_CHECKING(for --with-libs)
1964 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1966 AC_MSG_RESULT($withval)
1967 LIBS="$withval $LIBS"
1969 [AC_MSG_RESULT(no)])
1971 # Check for use of the system expat library
1972 AC_MSG_CHECKING(for --with-system-expat)
1973 AC_ARG_WITH(system_expat,
1974 AC_HELP_STRING(--with-system-expat, build pyexpat module using an installed expat library))
1976 AC_MSG_RESULT($with_system_expat)
1978 # Check for use of the system libffi library
1979 AC_MSG_CHECKING(for --with-system-ffi)
1980 AC_ARG_WITH(system_ffi,
1981 AC_HELP_STRING(--with-system-ffi, build _ctypes module using an installed ffi library))
1983 AC_MSG_RESULT($with_system_ffi)
1985 # Check for --with-dbmliborder
1986 AC_MSG_CHECKING(for --with-dbmliborder)
1987 AC_ARG_WITH(dbmliborder,
1988 AC_HELP_STRING([--with-dbmliborder=db1:db2:...], [order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]),
1990 if test x$with_dbmliborder = xyes
1992 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
1994 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
1995 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
1997 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2001 AC_MSG_RESULT($with_dbmliborder)
2003 # Determine if signalmodule should be used.
2004 AC_SUBST(USE_SIGNAL_MODULE)
2005 AC_SUBST(SIGNAL_OBJS)
2006 AC_MSG_CHECKING(for --with-signal-module)
2007 AC_ARG_WITH(signal-module,
2008 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
2010 if test -z "$with_signal_module"
2011 then with_signal_module="yes"
2013 AC_MSG_RESULT($with_signal_module)
2015 if test "${with_signal_module}" = "yes"; then
2016 USE_SIGNAL_MODULE=""
2019 USE_SIGNAL_MODULE="#"
2020 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2023 # This is used to generate Setup.config
2024 AC_SUBST(USE_THREAD_MODULE)
2025 USE_THREAD_MODULE=""
2027 AC_MSG_CHECKING(for --with-dec-threads)
2029 AC_ARG_WITH(dec-threads,
2030 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
2032 AC_MSG_RESULT($withval)
2034 if test "${with_thread+set}" != set; then
2035 with_thread="$withval";
2037 [AC_MSG_RESULT(no)])
2039 # Templates for things AC_DEFINEd more than once.
2040 # For a single AC_DEFINE, no template is needed.
2041 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2042 AH_TEMPLATE(_REENTRANT,
2043 [Define to force use of thread-safe errno, h_errno, and other functions])
2044 AH_TEMPLATE(WITH_THREAD,
2045 [Define if you want to compile in rudimentary thread support])
2047 AC_MSG_CHECKING(for --with-threads)
2048 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2049 AC_ARG_WITH(threads,
2050 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
2052 # --with-thread is deprecated, but check for it anyway
2053 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2055 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
2056 [with_threads=$with_thread])
2058 if test -z "$with_threads"
2059 then with_threads="yes"
2061 AC_MSG_RESULT($with_threads)
2064 if test "$with_threads" = "no"
2066 USE_THREAD_MODULE="#"
2067 elif test "$ac_cv_pthread_is_default" = yes
2069 AC_DEFINE(WITH_THREAD)
2070 # Defining _REENTRANT on system with POSIX threads should not hurt.
2071 AC_DEFINE(_REENTRANT)
2073 THREADOBJ="Python/thread.o"
2074 elif test "$ac_cv_kpthread" = "yes"
2077 if test "$ac_cv_cxx_thread" = "yes"; then
2078 CXX="$CXX -Kpthread"
2080 AC_DEFINE(WITH_THREAD)
2082 THREADOBJ="Python/thread.o"
2083 elif test "$ac_cv_kthread" = "yes"
2086 if test "$ac_cv_cxx_thread" = "yes"; then
2089 AC_DEFINE(WITH_THREAD)
2091 THREADOBJ="Python/thread.o"
2092 elif test "$ac_cv_pthread" = "yes"
2095 if test "$ac_cv_cxx_thread" = "yes"; then
2098 AC_DEFINE(WITH_THREAD)
2100 THREADOBJ="Python/thread.o"
2102 if test ! -z "$with_threads" -a -d "$with_threads"
2103 then LDFLAGS="$LDFLAGS -L$with_threads"
2105 if test ! -z "$withval" -a -d "$withval"
2106 then LDFLAGS="$LDFLAGS -L$withval"
2109 # According to the POSIX spec, a pthreads implementation must
2110 # define _POSIX_THREADS in unistd.h. Some apparently don't
2111 # (e.g. gnu pth with pthread emulation)
2112 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2116 #ifdef _POSIX_THREADS
2119 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2120 AC_MSG_RESULT($unistd_defines_pthreads)
2122 AC_DEFINE(_REENTRANT)
2123 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2124 AC_DEFINE(C_THREADS)
2125 AC_DEFINE(HURD_C_THREADS, 1,
2126 [Define if you are using Mach cthreads directly under /include])
2127 LIBS="$LIBS -lthreads"
2128 THREADOBJ="Python/thread.o"],[
2129 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2130 AC_DEFINE(C_THREADS)
2131 AC_DEFINE(MACH_C_THREADS, 1,
2132 [Define if you are using Mach cthreads under mach /])
2133 THREADOBJ="Python/thread.o"],[
2134 AC_MSG_CHECKING(for --with-pth)
2136 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
2137 [AC_MSG_RESULT($withval)
2138 AC_DEFINE([WITH_THREAD])
2139 AC_DEFINE([HAVE_PTH], 1,
2140 [Define if you have GNU PTH threads.])
2142 THREADOBJ="Python/thread.o"],
2145 # Just looking for pthread_create in libpthread is not enough:
2146 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2147 # So we really have to include pthread.h, and then link.
2149 LIBS="$LIBS -lpthread"
2150 AC_MSG_CHECKING([for pthread_create in -lpthread])
2151 AC_TRY_LINK([#include <pthread.h>
2153 void * start_routine (void *arg) { exit (0); }], [
2154 pthread_create (NULL, NULL, start_routine, NULL)], [
2156 AC_DEFINE(WITH_THREAD)
2158 THREADOBJ="Python/thread.o"],[
2160 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
2162 THREADOBJ="Python/thread.o"],[
2163 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2164 AC_DEFINE(ATHEOS_THREADS, 1,
2165 [Define this if you have AtheOS threads.])
2166 THREADOBJ="Python/thread.o"],[
2167 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
2168 AC_DEFINE(BEOS_THREADS, 1,
2169 [Define this if you have BeOS threads.])
2170 THREADOBJ="Python/thread.o"],[
2171 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
2173 LIBS="$LIBS -lpthreads"
2174 THREADOBJ="Python/thread.o"], [
2175 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
2178 THREADOBJ="Python/thread.o"], [
2179 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
2181 LIBS="$LIBS -lpthread"
2182 THREADOBJ="Python/thread.o"], [
2183 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
2186 THREADOBJ="Python/thread.o"],[
2187 USE_THREAD_MODULE="#"])
2188 ])])])])])])])])])])
2190 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2192 THREADOBJ="Python/thread.o"
2193 USE_THREAD_MODULE=""])
2195 if test "$posix_threads" != "yes"; then
2196 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2197 LIBS="$LIBS -lthread"
2198 THREADOBJ="Python/thread.o"
2199 USE_THREAD_MODULE=""])
2202 if test "$USE_THREAD_MODULE" != "#"
2204 # If the above checks didn't disable threads, (at least) OSF1
2205 # needs this '-threads' argument during linking.
2206 case $ac_sys_system in
2207 OSF1) LDLAST=-threads;;
2212 if test "$posix_threads" = "yes"; then
2213 if test "$unistd_defines_pthreads" = "no"; then
2214 AC_DEFINE(_POSIX_THREADS, 1,
2215 [Define if you have POSIX threads,
2216 and your system does not define that.])
2219 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2220 case $ac_sys_system/$ac_sys_release in
2221 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
2222 Defined for Solaris 2.6 bug in pthread header.)
2224 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2225 Define if the Posix semaphores do not work on your system)
2227 AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2228 Define if the Posix semaphores do not work on your system)
2232 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2233 AC_CACHE_VAL(ac_cv_pthread_system_supported,
2234 [AC_TRY_RUN([#include <pthread.h>
2235 void *foo(void *parm) {
2239 pthread_attr_t attr;
2241 if (pthread_attr_init(&attr)) exit(-1);
2242 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
2243 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
2246 ac_cv_pthread_system_supported=yes,
2247 ac_cv_pthread_system_supported=no,
2248 ac_cv_pthread_system_supported=no)
2250 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2251 if test "$ac_cv_pthread_system_supported" = "yes"; then
2252 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
2254 AC_CHECK_FUNCS(pthread_sigmask,
2255 [case $ac_sys_system in
2257 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2258 [Define if pthread_sigmask() does not work on your system.])
2264 # Check for enable-ipv6
2265 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
2266 AC_MSG_CHECKING([if --enable-ipv6 is specified])
2268 [ --enable-ipv6 Enable ipv6 (with ipv4) support
2269 --disable-ipv6 Disable ipv6 support],
2270 [ case "$enableval" in
2275 *) AC_MSG_RESULT(yes)
2276 AC_DEFINE(ENABLE_IPV6)
2282 dnl the check does not work on cross compilation case...
2283 AC_TRY_RUN([ /* AF_INET6 available check */
2284 #include <sys/types.h>
2285 #include <sys/socket.h>
2288 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
2302 if test "$ipv6" = "yes"; then
2303 AC_MSG_CHECKING(if RFC2553 API is available)
2304 AC_TRY_COMPILE([#include <sys/types.h>
2305 #include <netinet/in.h>],
2306 [struct sockaddr_in6 x;
2310 AC_MSG_RESULT(no, IPv6 disabled)
2314 if test "$ipv6" = "yes"; then
2315 AC_DEFINE(ENABLE_IPV6)
2323 if test "$ipv6" = "yes"; then
2324 AC_MSG_CHECKING([ipv6 stack type])
2325 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2329 dnl http://www.kame.net/
2331 #include <netinet/in.h>
2332 #ifdef IPV6_INRIA_VERSION
2338 dnl http://www.kame.net/
2340 #include <netinet/in.h>
2346 ipv6libdir=/usr/local/v6/lib
2350 dnl http://www.v6.linux.or.jp/
2352 #include <features.h>
2353 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2360 dnl http://www.v6.linux.or.jp/
2361 if test -d /usr/inet6; then
2364 ipv6libdir=/usr/inet6/lib
2365 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
2369 if test -f /etc/netconfig; then
2370 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
2378 #include <sys/param.h>
2379 #ifdef _TOSHIBA_INET6
2384 ipv6libdir=/usr/local/v6/lib])
2388 #include </usr/local/v6/include/sys/v6config.h>
2394 ipv6libdir=/usr/local/v6/lib;
2395 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
2399 #include <sys/param.h>
2400 #ifdef _ZETA_MINAMI_INET6
2405 ipv6libdir=/usr/local/v6/lib])
2408 if test "$ipv6type" != "unknown"; then
2412 AC_MSG_RESULT($ipv6type)
2415 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2416 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2417 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2418 echo "using lib$ipv6lib"
2420 if test $ipv6trylibc = "yes"; then
2423 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2424 echo "You need to fetch lib$ipv6lib.a from appropriate"
2425 echo 'ipv6 kit and compile beforehand.'
2431 AC_MSG_CHECKING(for OSX 10.5 SDK or later)
2432 AC_TRY_COMPILE([#include <Carbon/Carbon.h>], FSIORefNum fRef = 0,
2433 AC_DEFINE(HAVE_OSX105_SDK, 1, Define if compiling using MacOS X 10.5 SDK or later.)
2438 # Check for --with-doc-strings
2439 AC_MSG_CHECKING(for --with-doc-strings)
2440 AC_ARG_WITH(doc-strings,
2441 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
2443 if test -z "$with_doc_strings"
2444 then with_doc_strings="yes"
2446 if test "$with_doc_strings" != "no"
2448 AC_DEFINE(WITH_DOC_STRINGS, 1,
2449 [Define if you want documentation strings in extension modules])
2451 AC_MSG_RESULT($with_doc_strings)
2453 # Check for Python-specific malloc support
2454 AC_MSG_CHECKING(for --with-tsc)
2456 [ --with(out)-tsc enable/disable timestamp counter profile], [
2457 if test "$withval" != no
2459 AC_DEFINE(WITH_TSC, 1,
2460 [Define to profile with the Pentium timestamp counter])
2462 else AC_MSG_RESULT(no)
2464 [AC_MSG_RESULT(no)])
2466 # Check for Python-specific malloc support
2467 AC_MSG_CHECKING(for --with-pymalloc)
2468 AC_ARG_WITH(pymalloc,
2469 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
2471 if test -z "$with_pymalloc"
2472 then with_pymalloc="yes"
2474 if test "$with_pymalloc" != "no"
2476 AC_DEFINE(WITH_PYMALLOC, 1,
2477 [Define if you want to compile in Python-specific mallocs])
2479 AC_MSG_RESULT($with_pymalloc)
2481 # Check for Valgrind support
2482 AC_MSG_CHECKING([for --with-valgrind])
2483 AC_ARG_WITH([valgrind],
2484 AC_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
2486 AC_MSG_RESULT([$with_valgrind])
2487 if test "$with_valgrind" != no; then
2488 AC_CHECK_HEADER([valgrind/valgrind.h],
2489 [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
2490 [AC_MSG_ERROR([Valgrind support requested but headers not available])]
2494 # Check for --with-wctype-functions
2495 AC_MSG_CHECKING(for --with-wctype-functions)
2496 AC_ARG_WITH(wctype-functions,
2497 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
2499 if test "$withval" != no
2501 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2502 [Define if you want wctype.h functions to be used instead of the
2503 one supplied by Python itself. (see Include/unicodectype.h).])
2505 else AC_MSG_RESULT(no)
2507 [AC_MSG_RESULT(no)])
2509 # -I${DLINCLDIR} is added to the compile rule for importdl.o
2513 # the dlopen() function means we might want to use dynload_shlib.o. some
2514 # platforms, such as AIX, have dlopen(), but don't want to use it.
2515 AC_CHECK_FUNCS(dlopen)
2517 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2518 # loading of modules.
2519 AC_SUBST(DYNLOADFILE)
2520 AC_MSG_CHECKING(DYNLOADFILE)
2521 if test -z "$DYNLOADFILE"
2523 case $ac_sys_system/$ac_sys_release in
2524 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2525 if test "$ac_cv_func_dlopen" = yes
2526 then DYNLOADFILE="dynload_shlib.o"
2527 else DYNLOADFILE="dynload_aix.o"
2530 BeOS*) DYNLOADFILE="dynload_beos.o";;
2531 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
2532 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2533 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
2534 atheos*) DYNLOADFILE="dynload_atheos.o";;
2536 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2537 # out any dynamic loading
2538 if test "$ac_cv_func_dlopen" = yes
2539 then DYNLOADFILE="dynload_shlib.o"
2540 else DYNLOADFILE="dynload_stub.o"
2545 AC_MSG_RESULT($DYNLOADFILE)
2546 if test "$DYNLOADFILE" != "dynload_stub.o"
2548 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2549 [Defined when any dynamic module loading is enabled.])
2552 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
2554 AC_SUBST(MACHDEP_OBJS)
2555 AC_MSG_CHECKING(MACHDEP_OBJS)
2556 if test -z "$MACHDEP_OBJS"
2558 MACHDEP_OBJS=$extra_machdep_objs
2560 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
2562 AC_MSG_RESULT(MACHDEP_OBJS)
2564 # checks for library functions
2565 AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2566 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
2567 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2568 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
2569 initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime \
2570 mremap nice pathconf pause plock poll pthread_init \
2571 putenv readlink realpath \
2572 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
2574 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
2575 setlocale setregid setreuid setresuid setresgid \
2576 setsid setpgid setpgrp setuid setvbuf snprintf \
2577 sigaction siginterrupt sigrelse strftime \
2578 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
2579 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
2581 # For some functions, having a definition is not sufficient, since
2582 # we want to take their address.
2583 AC_MSG_CHECKING(for chroot)
2584 AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2585 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2589 AC_MSG_CHECKING(for link)
2590 AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2591 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2595 AC_MSG_CHECKING(for symlink)
2596 AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2597 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2601 AC_MSG_CHECKING(for fchdir)
2602 AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2603 AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2607 AC_MSG_CHECKING(for fsync)
2608 AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
2609 AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2613 AC_MSG_CHECKING(for fdatasync)
2614 AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2615 AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2619 AC_MSG_CHECKING(for epoll)
2620 AC_TRY_COMPILE([#include <sys/epoll.h>], void *x=epoll_create,
2621 AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2625 AC_MSG_CHECKING(for kqueue)
2627 #include <sys/types.h>
2628 #include <sys/event.h>
2630 AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2634 # On some systems (eg. FreeBSD 5), we would find a definition of the
2635 # functions ctermid_r, setgroups in the library, but no prototype
2636 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2637 # address to avoid compiler warnings and potential miscompilations
2638 # because of the missing prototypes.
2640 AC_MSG_CHECKING(for ctermid_r)
2642 #include "confdefs.h"
2644 ], void* p = ctermid_r,
2645 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2650 AC_MSG_CHECKING(for flock)
2652 #include "confdefs.h"
2653 #include <sys/file.h>
2655 AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2660 AC_MSG_CHECKING(for getpagesize)
2662 #include "confdefs.h"
2664 ], void* p = getpagesize,
2665 AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2671 AC_CHECK_PROGS(TRUE, true, /bin/true)
2673 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2674 dnl On others, they are in the C library, so we to take no action
2675 AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
2676 AC_CHECK_LIB(resolv, inet_aton)
2679 # On Tru64, chflags seems to be present, but calling it will
2681 AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
2683 #include <sys/stat.h>
2685 int main(int argc, char*argv[])
2687 if(chflags(argv[0], 0) != 0)
2691 ]], ac_cv_have_chflags=yes,
2692 ac_cv_have_chflags=no,
2693 ac_cv_have_chflags=cross)
2695 if test "$ac_cv_have_chflags" = cross ; then
2696 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
2698 if test "$ac_cv_have_chflags" = yes ; then
2699 AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
2702 AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
2704 #include <sys/stat.h>
2706 int main(int argc, char*argv[])
2708 if(lchflags(argv[0], 0) != 0)
2712 ]], ac_cv_have_lchflags=yes,
2713 ac_cv_have_lchflags=no,
2714 ac_cv_have_lchflags=cross)
2716 if test "$ac_cv_have_lchflags" = cross ; then
2717 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
2719 if test "$ac_cv_have_lchflags" = yes ; then
2720 AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
2723 dnl Check if system zlib has *Copy() functions
2725 dnl On MacOSX the linker will search for dylibs on the entire linker path
2726 dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
2727 dnl to revert to a more traditional unix behaviour and make it possible to
2728 dnl override the system libz with a local static library of libz. Temporarily
2729 dnl add that flag to our CFLAGS as well to ensure that we check the version
2730 dnl of libz that will be used by setup.py.
2731 dnl The -L/usr/local/lib is needed as wel to get the same compilation
2732 dnl environment as setup.py (and leaving it out can cause configure to use the
2733 dnl wrong version of the library)
2734 case $ac_sys_system/$ac_sys_release in
2736 _CUR_CFLAGS="${CFLAGS}"
2737 _CUR_LDFLAGS="${LDFLAGS}"
2738 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
2739 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
2743 AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, Define if the zlib library has inflateCopy))
2745 case $ac_sys_system/$ac_sys_release in
2747 CFLAGS="${_CUR_CFLAGS}"
2748 LDFLAGS="${_CUR_LDFLAGS}"
2752 AC_MSG_CHECKING(for hstrerror)
2754 #include "confdefs.h"
2756 ], void* p = hstrerror; hstrerror(0),
2757 AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2762 AC_MSG_CHECKING(for inet_aton)
2764 #include "confdefs.h"
2765 #include <sys/types.h>
2766 #include <sys/socket.h>
2767 #include <netinet/in.h>
2768 #include <arpa/inet.h>
2769 ], void* p = inet_aton;inet_aton(0,0),
2770 AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2775 AC_MSG_CHECKING(for inet_pton)
2777 #include "confdefs.h"
2778 #include <sys/types.h>
2779 #include <sys/socket.h>
2780 #include <netinet/in.h>
2781 #include <arpa/inet.h>
2782 ], void* p = inet_pton,
2783 AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2788 # On some systems, setgroups is in unistd.h, on others, in grp.h
2789 AC_MSG_CHECKING(for setgroups)
2791 #include "confdefs.h"
2797 void* p = setgroups,
2798 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2803 # check for openpty and forkpty
2805 AC_CHECK_FUNCS(openpty,,
2806 AC_CHECK_LIB(util,openpty,
2807 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2808 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2811 AC_CHECK_FUNCS(forkpty,,
2812 AC_CHECK_LIB(util,forkpty,
2813 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2814 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2819 AC_CHECK_FUNCS(memmove)
2821 # check for long file support functions
2822 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2824 AC_REPLACE_FUNCS(dup2 getcwd strdup)
2825 AC_CHECK_FUNCS(getpgrp,
2826 AC_TRY_COMPILE([#include <unistd.h>],
2828 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2829 [Define if getpgrp() must be called as getpgrp(0).])
2832 AC_CHECK_FUNCS(setpgrp,
2833 AC_TRY_COMPILE([#include <unistd.h>],
2835 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2836 [Define if setpgrp() must be called as setpgrp(0, 0).])
2839 AC_CHECK_FUNCS(gettimeofday,
2840 AC_TRY_COMPILE([#include <sys/time.h>],
2841 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2842 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2843 [Define if gettimeofday() does not have second (timezone) argument
2844 This is the case on Motorola V4 (R40V4.2)])
2848 AC_MSG_CHECKING(for major, minor, and makedev)
2850 #if defined(MAJOR_IN_MKDEV)
2851 #include <sys/mkdev.h>
2852 #elif defined(MAJOR_IN_SYSMACROS)
2853 #include <sys/sysmacros.h>
2855 #include <sys/types.h>
2858 makedev(major(0),minor(0));
2860 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2861 [Define to 1 if you have the device macros.])
2867 # On OSF/1 V5.1, getaddrinfo is available, but a define
2868 # for [no]getaddrinfo in netdb.h.
2869 AC_MSG_CHECKING(for getaddrinfo)
2871 #include <sys/types.h>
2872 #include <sys/socket.h>
2875 ], [getaddrinfo(NULL, NULL, NULL, NULL);],
2876 have_getaddrinfo=yes,
2877 have_getaddrinfo=no)
2878 AC_MSG_RESULT($have_getaddrinfo)
2879 if test $have_getaddrinfo = yes
2881 AC_MSG_CHECKING(getaddrinfo bug)
2882 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
2884 #include <sys/types.h>
2887 #include <sys/socket.h>
2888 #include <netinet/in.h>
2892 int passive, gaierr, inet4 = 0, inet6 = 0;
2893 struct addrinfo hints, *ai, *aitop;
2894 char straddr[INET6_ADDRSTRLEN], strport[16];
2896 for (passive = 0; passive <= 1; passive++) {
2897 memset(&hints, 0, sizeof(hints));
2898 hints.ai_family = AF_UNSPEC;
2899 hints.ai_flags = passive ? AI_PASSIVE : 0;
2900 hints.ai_socktype = SOCK_STREAM;
2901 hints.ai_protocol = IPPROTO_TCP;
2902 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2903 (void)gai_strerror(gaierr);
2906 for (ai = aitop; ai; ai = ai->ai_next) {
2907 if (ai->ai_addr == NULL ||
2908 ai->ai_addrlen == 0 ||
2909 getnameinfo(ai->ai_addr, ai->ai_addrlen,
2910 straddr, sizeof(straddr), strport, sizeof(strport),
2911 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2914 switch (ai->ai_family) {
2916 if (strcmp(strport, "54321") != 0) {
2920 if (strcmp(straddr, "0.0.0.0") != 0) {
2924 if (strcmp(straddr, "127.0.0.1") != 0) {
2931 if (strcmp(strport, "54321") != 0) {
2935 if (strcmp(straddr, "::") != 0) {
2939 if (strcmp(straddr, "::1") != 0) {
2949 /* another family support? */
2955 if (!(inet4 == 0 || inet4 == 2))
2957 if (!(inet6 == 0 || inet6 == 2))
2961 freeaddrinfo(aitop);
2966 freeaddrinfo(aitop);
2969 ]], ac_cv_buggy_getaddrinfo=no,
2970 ac_cv_buggy_getaddrinfo=yes,
2971 ac_cv_buggy_getaddrinfo=yes))
2974 if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
2978 echo 'Fatal: You must get working getaddrinfo() function.'
2979 echo ' or you can specify "--disable-ipv6"'.
2983 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
2985 AC_CHECK_FUNCS(getnameinfo)
2987 # checks for structures
2991 AC_CHECK_MEMBERS([struct stat.st_rdev])
2992 AC_CHECK_MEMBERS([struct stat.st_blksize])
2993 AC_CHECK_MEMBERS([struct stat.st_flags])
2994 AC_CHECK_MEMBERS([struct stat.st_gen])
2995 AC_CHECK_MEMBERS([struct stat.st_birthtime])
2998 AC_MSG_CHECKING(for time.h that defines altzone)
2999 AC_CACHE_VAL(ac_cv_header_time_altzone,
3000 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
3001 ac_cv_header_time_altzone=yes,
3002 ac_cv_header_time_altzone=no)])
3003 AC_MSG_RESULT($ac_cv_header_time_altzone)
3004 if test $ac_cv_header_time_altzone = yes; then
3005 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
3009 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
3011 #include <sys/types.h>
3012 #include <sys/select.h>
3013 #include <sys/time.h>
3015 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
3016 [Define if you can safely include both <sys/select.h> and <sys/time.h>
3017 (which you can't on SCO ODT 3.0).])
3020 AC_MSG_RESULT($was_it_defined)
3022 AC_MSG_CHECKING(for addrinfo)
3023 AC_CACHE_VAL(ac_cv_struct_addrinfo,
3025 # include <netdb.h>],
3026 [struct addrinfo a],
3027 ac_cv_struct_addrinfo=yes,
3028 ac_cv_struct_addrinfo=no))
3029 AC_MSG_RESULT($ac_cv_struct_addrinfo)
3030 if test $ac_cv_struct_addrinfo = yes; then
3031 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
3034 AC_MSG_CHECKING(for sockaddr_storage)
3035 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
3037 # include <sys/types.h>
3038 # include <sys/socket.h>],
3039 [struct sockaddr_storage s],
3040 ac_cv_struct_sockaddr_storage=yes,
3041 ac_cv_struct_sockaddr_storage=no))
3042 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3043 if test $ac_cv_struct_sockaddr_storage = yes; then
3044 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
3047 # checks for compiler characteristics
3053 AC_MSG_CHECKING(for working volatile)
3054 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
3055 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
3057 AC_MSG_RESULT($works)
3060 AC_MSG_CHECKING(for working signed char)
3061 AC_TRY_COMPILE([], [signed char c;], works=yes,
3062 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
3064 AC_MSG_RESULT($works)
3067 AC_MSG_CHECKING(for prototypes)
3068 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
3069 AC_DEFINE(HAVE_PROTOTYPES, 1,
3070 [Define if your compiler supports function prototype])
3073 AC_MSG_RESULT($have_prototypes)
3076 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
3079 int foo(int x, ...) {
3087 ], [return foo(10, "", 3.14);], [
3088 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3089 [Define if your compiler supports variable length function prototypes
3090 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3093 AC_MSG_RESULT($works)
3095 # check for socketpair
3096 AC_MSG_CHECKING(for socketpair)
3098 #include <sys/types.h>
3099 #include <sys/socket.h>
3100 ], void *x=socketpair,
3101 AC_DEFINE(HAVE_SOCKETPAIR, 1, Define if you have the 'socketpair' function.)
3106 # check if sockaddr has sa_len member
3107 AC_MSG_CHECKING(if sockaddr has sa_len member)
3108 AC_TRY_COMPILE([#include <sys/types.h>
3109 #include <sys/socket.h>],
3113 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
3117 AC_MSG_CHECKING(whether va_list is an array)
3119 #ifdef HAVE_STDARG_PROTOTYPES
3122 #include <varargs.h>
3124 ], [va_list list1, list2; list1 = list2;], , [
3125 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3126 va_list_is_array=yes
3128 AC_MSG_RESULT($va_list_is_array)
3130 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
3131 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3132 [Define this if you have some version of gethostbyname_r()])
3134 AC_CHECK_FUNC(gethostbyname_r, [
3135 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3136 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3138 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
3143 struct hostent *he, *res;
3148 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
3150 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3151 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3152 [Define this if you have the 6-arg version of gethostbyname_r().])
3156 AC_MSG_CHECKING([gethostbyname_r with 5 args])
3166 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3168 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3169 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3170 [Define this if you have the 5-arg version of gethostbyname_r().])
3174 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3180 struct hostent_data data;
3182 (void) gethostbyname_r(name, he, &data);
3184 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3185 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3186 [Define this if you have the 3-arg version of gethostbyname_r().])
3195 AC_CHECK_FUNCS(gethostbyname)
3197 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3198 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3199 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
3200 AC_SUBST(HAVE_GETHOSTBYNAME_R)
3201 AC_SUBST(HAVE_GETHOSTBYNAME)
3203 # checks for system services
3206 # Linux requires this for correct f.p. operations
3207 AC_CHECK_FUNC(__fpu_control,
3209 [AC_CHECK_LIB(ieee, __fpu_control)
3212 # Check for --with-fpectl
3213 AC_MSG_CHECKING(for --with-fpectl)
3215 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
3217 if test "$withval" != no
3219 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3220 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3222 else AC_MSG_RESULT(no)
3224 [AC_MSG_RESULT(no)])
3226 # check for --with-libm=...
3228 case $ac_sys_system in
3233 AC_MSG_CHECKING(for --with-libm=STRING)
3235 AC_HELP_STRING(--with-libm=STRING, math library),
3237 if test "$withval" = no
3239 AC_MSG_RESULT(force LIBM empty)
3240 elif test "$withval" != yes
3242 AC_MSG_RESULT(set LIBM="$withval")
3243 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
3245 [AC_MSG_RESULT(default LIBM="$LIBM")])
3247 # check for --with-libc=...
3249 AC_MSG_CHECKING(for --with-libc=STRING)
3251 AC_HELP_STRING(--with-libc=STRING, C library),
3253 if test "$withval" = no
3255 AC_MSG_RESULT(force LIBC empty)
3256 elif test "$withval" != yes
3258 AC_MSG_RESULT(set LIBC="$withval")
3259 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
3261 [AC_MSG_RESULT(default LIBC="$LIBC")])
3263 # **************************************************
3264 # * Check for various properties of floating point *
3265 # **************************************************
3267 AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3268 AC_CACHE_VAL(ac_cv_little_endian_double, [
3272 double x = 9006104071832581.0;
3273 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3279 ac_cv_little_endian_double=yes,
3280 ac_cv_little_endian_double=no,
3281 ac_cv_little_endian_double=no)])
3282 AC_MSG_RESULT($ac_cv_little_endian_double)
3283 if test "$ac_cv_little_endian_double" = yes
3285 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3286 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3287 with the least significant byte first])
3290 AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3291 AC_CACHE_VAL(ac_cv_big_endian_double, [
3295 double x = 9006104071832581.0;
3296 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3302 ac_cv_big_endian_double=yes,
3303 ac_cv_big_endian_double=no,
3304 ac_cv_big_endian_double=no)])
3305 AC_MSG_RESULT($ac_cv_big_endian_double)
3306 if test "$ac_cv_big_endian_double" = yes
3308 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3309 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3310 with the most significant byte first])
3313 # Some ARM platforms use a mixed-endian representation for doubles.
3314 # While Python doesn't currently have full support for these platforms
3315 # (see e.g., issue 1762561), we can at least make sure that float <-> string
3317 AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3318 AC_CACHE_VAL(ac_cv_mixed_endian_double, [
3322 double x = 9006104071832581.0;
3323 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3329 ac_cv_mixed_endian_double=yes,
3330 ac_cv_mixed_endian_double=no,
3331 ac_cv_mixed_endian_double=no)])
3332 AC_MSG_RESULT($ac_cv_mixed_endian_double)
3333 if test "$ac_cv_mixed_endian_double" = yes
3335 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3336 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3337 in ARM mixed-endian order (byte order 45670123)])
3340 # The short float repr introduced in Python 3.1 requires the
3341 # correctly-rounded string <-> double conversion functions from
3342 # Python/dtoa.c, which in turn require that the FPU uses 53-bit
3343 # rounding; this is a problem on x86, where the x87 FPU has a default
3344 # rounding precision of 64 bits. For gcc/x86, we can fix this by
3345 # using inline assembler to get and set the x87 FPU control word.
3347 # This inline assembler syntax may also work for suncc and icc,
3348 # so we try it on all platforms.
3350 AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
3351 AC_TRY_COMPILE([], [
3353 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3354 __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
3356 [have_gcc_asm_for_x87=yes], [have_gcc_asm_for_x87=no])
3357 AC_MSG_RESULT($have_gcc_asm_for_x87)
3358 if test "$have_gcc_asm_for_x87" = yes
3360 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3361 [Define if we can use gcc inline assembler to get and set x87 control word])
3364 # Detect whether system arithmetic is subject to x87-style double
3365 # rounding issues. The result of this test has little meaning on non
3366 # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3367 # mode is round-to-nearest and double rounding issues are present, and
3368 # 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3369 AC_MSG_CHECKING(for x87-style double rounding)
3370 # $BASECFLAGS may affect the result
3372 CC="$CC $BASECFLAGS"
3377 volatile double x, y, z;
3378 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3379 x = 0.99999999999999989; /* 1-2**-53 */
3383 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3389 /* both tests show evidence of double rounding */
3393 ac_cv_x87_double_rounding=no,
3394 ac_cv_x87_double_rounding=yes,
3395 ac_cv_x87_double_rounding=no)
3397 AC_MSG_RESULT($ac_cv_x87_double_rounding)
3398 if test "$ac_cv_x87_double_rounding" = yes
3400 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3401 [Define if arithmetic is subject to x87-style double rounding issue])
3404 # ************************************
3405 # * Check for mathematical functions *
3406 # ************************************
3411 # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3412 # -0. on some architectures.
3413 AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3414 AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
3419 /* return 0 if either negative zeros don't exist
3420 on this platform or if negative zeros exist
3421 and tanh(-0.) == -0. */
3422 if (atan2(0., -1.) == atan2(-0., -1.) ||
3423 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3427 ac_cv_tanh_preserves_zero_sign=yes,
3428 ac_cv_tanh_preserves_zero_sign=no,
3429 ac_cv_tanh_preserves_zero_sign=no)])
3430 AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3431 if test "$ac_cv_tanh_preserves_zero_sign" = yes
3433 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3434 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3437 AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
3438 AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
3439 AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3443 # For multiprocessing module, check that sem_open
3444 # actually works. For FreeBSD versions <= 7.2,
3445 # the kernel module that provides POSIX semaphores
3446 # isn't loaded by default, so an attempt to call
3447 # sem_open results in a 'Signal 12' error.
3448 AC_MSG_CHECKING(whether POSIX semaphores are enabled)
3449 AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
3454 #include <semaphore.h>
3455 #include <sys/stat.h>
3458 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3459 if (a == SEM_FAILED) {
3464 sem_unlink("/autoconf");
3467 ], ac_cv_posix_semaphores_enabled=yes,
3468 ac_cv_posix_semaphores_enabled=no,
3469 ac_cv_posix_semaphores_enabled=yes)
3471 AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
3472 if test $ac_cv_posix_semaphores_enabled = no
3474 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
3475 [Define if POSIX semaphores aren't enabled on your system])
3478 # Multiprocessing check for broken sem_getvalue
3479 AC_MSG_CHECKING(for broken sem_getvalue)
3480 AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
3485 #include <semaphore.h>
3486 #include <sys/stat.h>
3489 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
3497 res = sem_getvalue(a, &count);
3499 sem_unlink("/autocftw");
3500 return res==-1 ? 1 : 0;
3502 ], ac_cv_broken_sem_getvalue=no,
3503 ac_cv_broken_sem_getvalue=yes,
3504 ac_cv_broken_sem_getvalue=yes)
3506 AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
3507 if test $ac_cv_broken_sem_getvalue = yes
3509 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
3510 [define to 1 if your sem_getvalue is broken.])
3513 # determine what size digit to use for Python's longs
3514 AC_MSG_CHECKING([digit size for Python's longs])
3515 AC_ARG_ENABLE(big-digits,
3516 AC_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
3517 [case $enable_big_digits in
3519 enable_big_digits=30 ;;
3521 enable_big_digits=15 ;;
3525 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3527 AC_MSG_RESULT($enable_big_digits)
3528 AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3530 [AC_MSG_RESULT(no value specified)])
3533 AC_CHECK_HEADER(wchar.h, [
3534 AC_DEFINE(HAVE_WCHAR_H, 1,
3535 [Define if the compiler provides a wchar.h header file.])
3541 # determine wchar_t size
3542 if test "$wchar_h" = yes
3544 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
3547 AC_MSG_CHECKING(for UCS-4 tcl)
3551 #if TCL_UTF_MAX != 6
3552 # error "NOT UCS4_TCL"
3554 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3557 AC_MSG_RESULT($have_ucs4_tcl)
3559 # check whether wchar_t is signed or not
3560 if test "$wchar_h" = yes
3562 # check whether wchar_t is signed or not
3563 AC_MSG_CHECKING(whether wchar_t is signed)
3564 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
3569 /* Success: exit code 0 */
3570 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
3573 ac_cv_wchar_t_signed=yes,
3574 ac_cv_wchar_t_signed=no,
3575 ac_cv_wchar_t_signed=yes)])
3576 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3579 AC_MSG_CHECKING(what type to use for unicode)
3580 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
3581 AC_ARG_ENABLE(unicode,
3582 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
3584 [enable_unicode=yes])
3586 if test $enable_unicode = yes
3588 # Without any arguments, Py_UNICODE defaults to two-byte mode
3589 case "$have_ucs4_tcl" in
3590 yes) enable_unicode="ucs4"
3592 *) enable_unicode="ucs2"
3597 AH_TEMPLATE(Py_UNICODE_SIZE,
3598 [Define as the size of the unicode type.])
3599 case "$enable_unicode" in
3600 ucs2) unicode_size="2"
3601 AC_DEFINE(Py_UNICODE_SIZE,2)
3603 ucs4) unicode_size="4"
3604 AC_DEFINE(Py_UNICODE_SIZE,4)
3608 AH_TEMPLATE(PY_UNICODE_TYPE,
3609 [Define as the integral type used for Unicode representation.])
3611 AC_SUBST(UNICODE_OBJS)
3612 if test "$enable_unicode" = "no"
3615 AC_MSG_RESULT(not used)
3617 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
3618 AC_DEFINE(Py_USING_UNICODE, 1,
3619 [Define if you want to have a Unicode type.])
3621 # wchar_t is only usable if it maps to an unsigned type
3622 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
3623 -a "$ac_cv_wchar_t_signed" = "no"
3625 PY_UNICODE_TYPE="wchar_t"
3626 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3627 [Define if you have a useable wchar_t type defined in wchar.h; useable
3628 means wchar_t must be an unsigned type with at least 16 bits. (see
3629 Include/unicodeobject.h).])
3630 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3631 elif test "$ac_cv_sizeof_short" = "$unicode_size"
3633 PY_UNICODE_TYPE="unsigned short"
3634 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3635 elif test "$ac_cv_sizeof_long" = "$unicode_size"
3637 PY_UNICODE_TYPE="unsigned long"
3638 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3640 PY_UNICODE_TYPE="no type found"
3642 AC_MSG_RESULT($PY_UNICODE_TYPE)
3645 # check for endianness
3648 # Check whether right shifting a negative integer extends the sign bit
3649 # or fills with zeros (like the Cray J90, according to Tim Peters).
3650 AC_MSG_CHECKING(whether right shift extends the sign bit)
3651 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
3655 exit(((-1)>>3 == -1) ? 0 : 1);
3658 ac_cv_rshift_extends_sign=yes,
3659 ac_cv_rshift_extends_sign=no,
3660 ac_cv_rshift_extends_sign=yes)])
3661 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
3662 if test "$ac_cv_rshift_extends_sign" = no
3664 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
3665 [Define if i>>j for signed int i does not extend the sign bit
3669 # check for getc_unlocked and related locking functions
3670 AC_MSG_CHECKING(for getc_unlocked() and friends)
3671 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
3672 AC_TRY_LINK([#include <stdio.h>],[
3673 FILE *f = fopen("/dev/null", "r");
3677 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
3678 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
3679 if test "$ac_cv_have_getc_unlocked" = yes
3681 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
3682 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
3685 # check where readline lives
3686 # save the value of LIBS so we don't actually link Python with readline
3687 LIBS_no_readline=$LIBS
3689 # On some systems we need to link readline to a termcap compatible
3690 # library. NOTE: Keep the precedence of listed libraries synchronised
3692 py_cv_lib_readline=no
3693 AC_MSG_CHECKING([how to link readline libs])
3694 for py_libtermcap in "" ncursesw ncurses curses termcap; do
3695 if test -z "$py_libtermcap"; then
3696 READLINE_LIBS="-lreadline"
3698 READLINE_LIBS="-lreadline -l$py_libtermcap"
3700 LIBS="$READLINE_LIBS $LIBS_no_readline"
3702 [AC_LANG_CALL([],[readline])],
3703 [py_cv_lib_readline=yes])
3704 if test $py_cv_lib_readline = yes; then
3708 # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3709 #AC_SUBST([READLINE_LIBS])
3710 if test $py_cv_lib_readline = no; then
3711 AC_MSG_RESULT([none])
3713 AC_MSG_RESULT([$READLINE_LIBS])
3714 AC_DEFINE(HAVE_LIBREADLINE, 1,
3715 [Define if you have the readline library (-lreadline).])
3718 # check for readline 2.1
3719 AC_CHECK_LIB(readline, rl_callback_handler_install,
3720 AC_DEFINE(HAVE_RL_CALLBACK, 1,
3721 [Define if you have readline 2.1]), ,$READLINE_LIBS)
3723 # check for readline 2.2
3724 AC_TRY_CPP([#include <readline/readline.h>],
3725 have_readline=yes, have_readline=no)
3726 if test $have_readline = yes
3728 AC_EGREP_HEADER([extern int rl_completion_append_character;],
3729 [readline/readline.h],
3730 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
3731 [Define if you have readline 2.2]), )
3732 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
3733 [readline/readline.h],
3734 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
3735 [Define if you have rl_completion_suppress_append]), )
3738 # check for readline 4.0
3739 AC_CHECK_LIB(readline, rl_pre_input_hook,
3740 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
3741 [Define if you have readline 4.0]), ,$READLINE_LIBS)
3744 AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
3745 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
3746 [Define if you have readline 4.0]), ,$READLINE_LIBS)
3748 # check for readline 4.2
3749 AC_CHECK_LIB(readline, rl_completion_matches,
3750 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
3751 [Define if you have readline 4.2]), ,$READLINE_LIBS)
3753 # also in readline 4.2
3754 AC_TRY_CPP([#include <readline/readline.h>],
3755 have_readline=yes, have_readline=no)
3756 if test $have_readline = yes
3758 AC_EGREP_HEADER([extern int rl_catch_signals;],
3759 [readline/readline.h],
3760 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3761 [Define if you can turn off readline's signal handling.]), )
3764 # End of readline checks: restore LIBS
3765 LIBS=$LIBS_no_readline
3767 AC_MSG_CHECKING(for broken nice())
3768 AC_CACHE_VAL(ac_cv_broken_nice, [
3773 if (val1 != -1 && val1 == nice(2))
3778 ac_cv_broken_nice=yes,
3779 ac_cv_broken_nice=no,
3780 ac_cv_broken_nice=no)])
3781 AC_MSG_RESULT($ac_cv_broken_nice)
3782 if test "$ac_cv_broken_nice" = yes
3784 AC_DEFINE(HAVE_BROKEN_NICE, 1,
3785 [Define if nice() returns success/failure instead of the new priority.])
3788 AC_MSG_CHECKING(for broken poll())
3789 AC_CACHE_VAL(ac_cv_broken_poll,
3795 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
3800 poll_test = poll(&poll_struct, 1, 0);
3803 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
3809 ac_cv_broken_poll=yes,
3810 ac_cv_broken_poll=no,
3811 ac_cv_broken_poll=no))
3812 AC_MSG_RESULT($ac_cv_broken_poll)
3813 if test "$ac_cv_broken_poll" = yes
3815 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3816 [Define if poll() sets errno on invalid file descriptors.])
3819 # Before we can test tzset, we need to check if struct tm has a tm_zone
3820 # (which is not required by ISO C or UNIX spec) and/or if we support
3824 # check tzset(3) exists and works like we expect it to
3825 AC_MSG_CHECKING(for working tzset())
3826 AC_CACHE_VAL(ac_cv_working_tzset, [
3833 extern char *tzname[];
3838 /* Note that we need to ensure that not only does tzset(3)
3839 do 'something' with localtime, but it works as documented
3840 in the library reference and as expected by the test suite.
3841 This includes making sure that tzname is set properly if
3842 tm->tm_zone does not exist since it is the alternative way
3843 of getting timezone info.
3845 Red Hat 6.2 doesn't understand the southern hemisphere
3846 after New Year's Day.
3849 time_t groundhogday = 1044144000; /* GMT-based */
3850 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3854 if (localtime(&groundhogday)->tm_hour != 0)
3857 /* For UTC, tzname[1] is sometimes "", sometimes " " */
3858 if (strcmp(tzname[0], "UTC") ||
3859 (tzname[1][0] != 0 && tzname[1][0] != ' '))
3863 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
3865 if (localtime(&groundhogday)->tm_hour != 19)
3868 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
3872 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
3874 if (localtime(&groundhogday)->tm_hour != 11)
3877 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
3881 #if HAVE_STRUCT_TM_TM_ZONE
3882 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
3884 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
3891 ac_cv_working_tzset=yes,
3892 ac_cv_working_tzset=no,
3893 ac_cv_working_tzset=no)])
3894 AC_MSG_RESULT($ac_cv_working_tzset)
3895 if test "$ac_cv_working_tzset" = yes
3897 AC_DEFINE(HAVE_WORKING_TZSET, 1,
3898 [Define if tzset() actually switches the local timezone in a meaningful way.])
3901 # Look for subsecond timestamps in struct stat
3902 AC_MSG_CHECKING(for tv_nsec in struct stat)
3903 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
3904 AC_TRY_COMPILE([#include <sys/stat.h>], [
3906 st.st_mtim.tv_nsec = 1;
3908 ac_cv_stat_tv_nsec=yes,
3909 ac_cv_stat_tv_nsec=no,
3910 ac_cv_stat_tv_nsec=no))
3911 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
3912 if test "$ac_cv_stat_tv_nsec" = yes
3914 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
3915 [Define if you have struct stat.st_mtim.tv_nsec])
3918 # Look for BSD style subsecond timestamps in struct stat
3919 AC_MSG_CHECKING(for tv_nsec2 in struct stat)
3920 AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
3921 AC_TRY_COMPILE([#include <sys/stat.h>], [
3923 st.st_mtimespec.tv_nsec = 1;
3925 ac_cv_stat_tv_nsec2=yes,
3926 ac_cv_stat_tv_nsec2=no,
3927 ac_cv_stat_tv_nsec2=no))
3928 AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
3929 if test "$ac_cv_stat_tv_nsec2" = yes
3931 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
3932 [Define if you have struct stat.st_mtimensec])
3935 # On HP/UX 11.0, mvwdelch is a block with a return statement
3936 AC_MSG_CHECKING(whether mvwdelch is an expression)
3937 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
3938 AC_TRY_COMPILE([#include <curses.h>], [
3940 rtn = mvwdelch(0,0,0);
3941 ], ac_cv_mvwdelch_is_expression=yes,
3942 ac_cv_mvwdelch_is_expression=no,
3943 ac_cv_mvwdelch_is_expression=yes))
3944 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
3946 if test "$ac_cv_mvwdelch_is_expression" = yes
3948 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
3949 [Define if mvwdelch in curses.h is an expression.])
3952 AC_MSG_CHECKING(whether WINDOW has _flags)
3953 AC_CACHE_VAL(ac_cv_window_has_flags,
3954 AC_TRY_COMPILE([#include <curses.h>], [
3957 ], ac_cv_window_has_flags=yes,
3958 ac_cv_window_has_flags=no,
3959 ac_cv_window_has_flags=no))
3960 AC_MSG_RESULT($ac_cv_window_has_flags)
3963 if test "$ac_cv_window_has_flags" = yes
3965 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
3966 [Define if WINDOW in curses.h offers a field _flags.])
3969 AC_MSG_CHECKING(for is_term_resized)
3970 AC_TRY_COMPILE([#include <curses.h>], void *x=is_term_resized,
3971 AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
3976 AC_MSG_CHECKING(for resize_term)
3977 AC_TRY_COMPILE([#include <curses.h>], void *x=resize_term,
3978 AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
3983 AC_MSG_CHECKING(for resizeterm)
3984 AC_TRY_COMPILE([#include <curses.h>], void *x=resizeterm,
3985 AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
3990 AC_MSG_CHECKING(for /dev/ptmx)
3992 if test -r /dev/ptmx
3995 AC_DEFINE(HAVE_DEV_PTMX, 1,
3996 [Define if we have /dev/ptmx.])
4001 AC_MSG_CHECKING(for /dev/ptc)
4006 AC_DEFINE(HAVE_DEV_PTC, 1,
4007 [Define if we have /dev/ptc.])
4012 if test "$have_long_long" = yes
4014 AC_MSG_CHECKING(for %lld and %llu printf() format support)
4015 AC_CACHE_VAL(ac_cv_have_long_long_format,
4021 #ifdef HAVE_SYS_TYPES_H
4022 #include <sys/types.h>
4029 if (sprintf(buffer, "%lld", (long long)123) < 0)
4031 if (strcmp(buffer, "123"))
4034 if (sprintf(buffer, "%lld", (long long)-123) < 0)
4036 if (strcmp(buffer, "-123"))
4039 if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
4041 if (strcmp(buffer, "123"))
4046 ]], ac_cv_have_long_long_format=yes,
4047 ac_cv_have_long_long_format=no,
4048 ac_cv_have_long_long_format=no)
4050 AC_MSG_RESULT($ac_cv_have_long_long_format)
4053 if test "$ac_cv_have_long_long_format" = yes
4055 AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
4056 [Define to printf format modifier for long long type])
4059 if test $ac_sys_system = Darwin
4061 LIBS="$LIBS -framework CoreFoundation"
4065 AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
4071 #ifdef HAVE_SYS_TYPES_H
4072 #include <sys/types.h>
4076 typedef ssize_t Py_ssize_t;
4077 #elif SIZEOF_VOID_P == SIZEOF_LONG
4078 typedef long Py_ssize_t;
4080 typedef int Py_ssize_t;
4087 if(sprintf(buffer, "%zd", (size_t)123) < 0)
4090 if (strcmp(buffer, "123"))
4093 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
4096 if (strcmp(buffer, "-123"))
4101 ], ac_cv_have_size_t_format=yes,
4102 ac_cv_have_size_t_format=no,
4103 [ac_cv_have_size_t_format="cross -- assuming yes"]
4105 if test "$ac_cv_have_size_t_format" != no ; then
4106 AC_DEFINE(PY_FORMAT_SIZE_T, "z",
4107 [Define to printf format modifier for Py_ssize_t])
4110 AC_CHECK_TYPE(socklen_t,,
4111 AC_DEFINE(socklen_t,int,
4112 Define to `int' if <sys/socket.h> does not define.),[
4113 #ifdef HAVE_SYS_TYPES_H
4114 #include <sys/types.h>
4116 #ifdef HAVE_SYS_SOCKET_H
4117 #include <sys/socket.h>
4121 AC_SUBST(THREADHEADERS)
4123 for h in `(cd $srcdir;echo Python/thread_*.h)`
4125 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4129 SRCDIRS="Parser Grammar Objects Python Modules Mac"
4130 AC_MSG_CHECKING(for build directories)
4131 for dir in $SRCDIRS; do
4132 if test ! -d $dir; then
4138 # generate output files
4139 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
4142 echo "creating Modules/Setup"
4143 if test ! -f Modules/Setup
4145 cp $srcdir/Modules/Setup.dist Modules/Setup
4148 echo "creating Modules/Setup.local"
4149 if test ! -f Modules/Setup.local
4151 echo "# Edit this file for local setup changes" >Modules/Setup.local
4154 echo "creating Makefile"
4155 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4156 -s Modules Modules/Setup.config \
4157 Modules/Setup.local Modules/Setup
4159 case $ac_sys_system in
4163 Support for BeOS is deprecated as of Python 2.6.
4164 See PEP 11 for the gory details.