1 dnl ***********************************************
2 dnl * Please run autoreconf to test your changes! *
3 dnl ***********************************************
5 # Set VERSION so we only need to edit in one place (i.e., here)
6 m4_define(PYTHON_VERSION, 2.7)
10 AC_REVISION($Revision$)
11 AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
12 AC_CONFIG_SRCDIR([Include/object.h])
13 AC_CONFIG_HEADER(pyconfig.h)
15 dnl Ensure that if prefix is specified, it does not end in a slash. If
16 dnl it does, we get path names containing '//' which is both ugly and
17 dnl can cause trouble.
19 dnl Last slash shouldn't be stripped if prefix=/
20 if test "$prefix" != "/"; then
21 prefix=`echo "$prefix" | sed -e 's/\/$//g'`
24 dnl This is for stuff that absolutely must end up in pyconfig.h.
25 dnl Please use pyport.h instead, if possible.
31 /* Define the macros needed if on a UnixWare 7.x system. */
32 #if defined(__USLC__) && defined(__SCO_VERSION__)
33 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
36 #endif /*Py_PYCONFIG_H*/
39 # We don't use PACKAGE_ variables, and they cause conflicts
40 # with other autoconf-based packages that include Python.h
41 grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
43 mv confdefs.h.new confdefs.h
46 VERSION=PYTHON_VERSION
51 # The later defininition of _XOPEN_SOURCE disables certain features
52 # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
53 AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
55 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
56 # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
58 AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
60 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
61 # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
63 AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
65 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
66 # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
67 AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
69 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
70 # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
72 AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
75 define_xopen_source=yes
77 # Arguments passed to configure.
79 CONFIG_ARGS="$ac_configure_args"
81 AC_MSG_CHECKING([for --enable-universalsdk])
82 AC_ARG_ENABLE(universalsdk,
83 AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build against Mac OS X 10.4u SDK (ppc/i386)]),
87 enableval=/Developer/SDKs/MacOSX10.4u.sdk
88 if test ! -d "${enableval}"
100 UNIVERSALSDK=$enableval
101 if test ! -d "${UNIVERSALSDK}"
103 AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
112 if test -n "${UNIVERSALSDK}"
114 AC_MSG_RESULT(${UNIVERSALSDK})
118 AC_SUBST(UNIVERSALSDK)
120 AC_SUBST(ARCH_RUN_32BIT)
122 UNIVERSAL_ARCHS="32-bit"
123 AC_SUBST(LIPO_32BIT_FLAGS)
124 AC_MSG_CHECKING(for --with-universal-archs)
125 AC_ARG_WITH(universal-archs,
126 AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")]),
128 AC_MSG_RESULT($withval)
129 UNIVERSAL_ARCHS="$withval"
130 if test "${enable_universalsdk}" ; then
133 AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
137 AC_MSG_RESULT(32-bit)
142 AC_ARG_WITH(framework-name,
143 AS_HELP_STRING([--with-framework-name=FRAMEWORK],
144 [specify an alternate name of the framework built with --enable-framework]),
146 if test "${enable_framework}"; then
149 AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
151 PYTHONFRAMEWORK=${withval}
152 PYTHONFRAMEWORKDIR=${withval}.framework
153 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
155 PYTHONFRAMEWORK=Python
156 PYTHONFRAMEWORKDIR=Python.framework
157 PYTHONFRAMEWORKIDENTIFIER=org.python.python
159 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
160 AC_ARG_ENABLE(framework,
161 AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@], [Build (MacOSX|Darwin) framework]),
165 enableval=/Library/Frameworks
170 PYTHONFRAMEWORKDIR=no-framework
171 PYTHONFRAMEWORKPREFIX=
172 PYTHONFRAMEWORKINSTALLDIR=
173 FRAMEWORKINSTALLFIRST=
174 FRAMEWORKINSTALLLAST=
175 FRAMEWORKALTINSTALLFIRST=
176 FRAMEWORKALTINSTALLLAST=
177 if test "x${prefix}" = "xNONE"; then
178 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
180 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
185 PYTHONFRAMEWORKPREFIX="${enableval}"
186 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
187 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
188 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
189 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
190 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
191 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
193 if test "x${prefix}" = "xNONE" ; then
194 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
197 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
200 case "${enableval}" in
202 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
203 if test "${prefix}" = "NONE" ; then
205 FRAMEWORKUNIXTOOLSPREFIX="/usr"
210 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
213 */Library/Frameworks)
214 MDIR="`dirname "${enableval}"`"
215 MDIR="`dirname "${MDIR}"`"
216 FRAMEWORKINSTALLAPPSPREFIX="${MDIR}/Applications"
218 if test "${prefix}" = "NONE"; then
219 # User hasn't specified the
220 # --prefix option, but wants to install
221 # the framework in a non-default location,
222 # ensure that the compatibility links get
223 # installed relative to that prefix as well
224 # instead of in /usr/local.
225 FRAMEWORKUNIXTOOLSPREFIX="${MDIR}"
230 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
234 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
236 # Add files for Mac specific code to the list of output
238 AC_CONFIG_FILES(Mac/Makefile)
239 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
240 AC_CONFIG_FILES(Mac/IDLE/Makefile)
241 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
242 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
246 PYTHONFRAMEWORKDIR=no-framework
247 PYTHONFRAMEWORKPREFIX=
248 PYTHONFRAMEWORKINSTALLDIR=
249 FRAMEWORKINSTALLFIRST=
250 FRAMEWORKINSTALLLAST=
251 FRAMEWORKALTINSTALLFIRST=
252 FRAMEWORKALTINSTALLLAST=
253 if test "x${prefix}" = "xNONE" ; then
254 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
256 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
261 AC_SUBST(PYTHONFRAMEWORK)
262 AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
263 AC_SUBST(PYTHONFRAMEWORKDIR)
264 AC_SUBST(PYTHONFRAMEWORKPREFIX)
265 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
266 AC_SUBST(FRAMEWORKINSTALLFIRST)
267 AC_SUBST(FRAMEWORKINSTALLLAST)
268 AC_SUBST(FRAMEWORKALTINSTALLFIRST)
269 AC_SUBST(FRAMEWORKALTINSTALLLAST)
270 AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
271 AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
274 ## AS_HELP_STRING([--with-dyld],
275 ## [Use (OpenStep|Rhapsody) dynamic linker]))
277 # Set name for machine-dependent library files
279 AC_MSG_CHECKING(MACHDEP)
280 if test -z "$MACHDEP"
282 ac_sys_system=`uname -s`
283 if test "$ac_sys_system" = "AIX" \
284 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
285 ac_sys_release=`uname -v`
287 ac_sys_release=`uname -r`
289 ac_md_system=`echo $ac_sys_system |
290 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
291 ac_md_release=`echo $ac_sys_release |
292 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
293 MACHDEP="$ac_md_system$ac_md_release"
296 linux*) MACHDEP="linux2";;
297 cygwin*) MACHDEP="cygwin";;
298 darwin*) MACHDEP="darwin";;
299 atheos*) MACHDEP="atheos";;
300 irix646) MACHDEP="irix6";;
301 '') MACHDEP="unknown";;
305 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
306 # disable features if it is defined, without any means to access these
307 # features as extensions. For these systems, we skip the definition of
308 # _XOPEN_SOURCE. Before adding a system to the list to gain access to
309 # some feature, make sure there is no alternative way to access this
310 # feature. Also, when using wildcards, make sure you have verified the
311 # need for not defining _XOPEN_SOURCE on all systems matching the
312 # wildcard, and that the wildcard does not include future systems
313 # (which may remove their limitations).
314 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
315 case $ac_sys_system/$ac_sys_release in
316 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
317 # even though select is a POSIX function. Reported by J. Ribbens.
318 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
319 # In addition, Stefan Krah confirms that issue #1244610 exists through
320 # OpenBSD 4.6, but is fixed in 4.7.
321 OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@)
322 define_xopen_source=no
323 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
324 # also defined. This can be overridden by defining _BSD_SOURCE
325 # As this has a different meaning on Linux, only define it on OpenBSD
326 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
329 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
330 # also defined. This can be overridden by defining _BSD_SOURCE
331 # As this has a different meaning on Linux, only define it on OpenBSD
332 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
334 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
335 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
337 NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
338 define_xopen_source=no;;
339 # From the perspective of Solaris, _XOPEN_SOURCE is not so much a
340 # request to enable features supported by the standard as a request
341 # to disable features not supported by the standard. The best way
342 # for Python to use Solaris is simply to leave _XOPEN_SOURCE out
343 # entirely and define __EXTENSIONS__ instead.
345 define_xopen_source=no;;
346 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
347 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
348 # Reconfirmed for 7.1.4 by Martin v. Loewis.
349 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
350 define_xopen_source=no;;
351 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
352 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
354 define_xopen_source=no;;
355 # On FreeBSD 4, the math functions C89 does not cover are never defined
356 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
358 define_xopen_source=no;;
359 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
360 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
361 # identifies itself as Darwin/7.*
362 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
363 # disables platform specific features beyond repair.
364 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
365 # has no effect, don't bother defining them
366 Darwin/@<:@6789@:>@.*)
367 define_xopen_source=no;;
368 Darwin/1@<:@0-9@:>@.*)
369 define_xopen_source=no;;
370 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
371 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
372 # or has another value. By not (re)defining it, the defaults come in place.
374 define_xopen_source=no;;
376 if test `uname -r` -eq 1; then
377 define_xopen_source=no
380 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
381 # defining NI_NUMERICHOST.
383 define_xopen_source=no
388 if test $define_xopen_source = yes
390 AC_DEFINE(_XOPEN_SOURCE, 600,
391 Define to the level of X/Open that your system supports)
393 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
394 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
395 # several APIs are not declared. Since this is also needed in some
396 # cases for HP-UX, we define it globally.
397 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
398 Define to activate Unix95-and-earlier features)
400 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
405 # SGI compilers allow the specification of the both the ABI and the
406 # ISA on the command line. Depending on the values of these switches,
407 # different and often incompatable code will be generated.
409 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
410 # thus supply support for various ABI/ISA combinations. The MACHDEP
411 # variable is also adjusted.
414 if test ! -z "$SGI_ABI"
417 LDFLAGS="$SGI_ABI $LDFLAGS"
418 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
420 AC_MSG_RESULT($MACHDEP)
422 # And add extra plat-mac for darwin
423 AC_SUBST(EXTRAPLATDIR)
424 AC_SUBST(EXTRAMACHDEPPATH)
425 AC_MSG_CHECKING(EXTRAPLATDIR)
426 if test -z "$EXTRAPLATDIR"
430 EXTRAPLATDIR="\$(PLATMACDIRS)"
431 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
439 AC_MSG_RESULT($EXTRAPLATDIR)
441 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
442 # it may influence the way we can build extensions, so distutils
444 AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
445 AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
446 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
447 EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
449 AC_MSG_CHECKING(machine type as reported by uname -m)
450 ac_sys_machine=`uname -m`
451 AC_MSG_RESULT($ac_sys_machine)
453 # checks for alternative programs
455 # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
456 # for debug/optimization stuff. BASECFLAGS is for flags that are required
457 # just to get things to compile and link. Users are free to override OPT
458 # when running configure or make. The build should not break if they do.
459 # BASECFLAGS should generally not be messed with, however.
461 # XXX shouldn't some/most/all of this code be merged with the stuff later
462 # on that fiddles with OPT and BASECFLAGS?
463 AC_MSG_CHECKING(for --without-gcc)
465 AS_HELP_STRING([--without-gcc], [never use gcc]),
473 without_gcc=$withval;;
475 case $ac_sys_system in
476 AIX*) CC=${CC:-xlc_r}
483 BASECFLAGS="$BASECFLAGS -export pragma"
485 LDFLAGS="$LDFLAGS -nodup"
493 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
496 AR="\$(srcdir)/Modules/ar_beos"
501 AC_MSG_RESULT($without_gcc)
503 # If the user switches compilers, we can't believe the cache
504 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
506 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
507 (it is also a good idea to do 'make clean' before compiling)])
510 # If the user set CFLAGS, use this instead of the automatically
512 preset_cflags="$CFLAGS"
514 if test ! -z "$preset_cflags"
516 CFLAGS=$preset_cflags
521 AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
522 AC_ARG_WITH(cxx_main,
523 AS_HELP_STRING([--with-cxx-main=<compiler>],
524 [compile main() and link python executable with C++ compiler]),
530 yes) with_cxx_main=yes
542 AC_MSG_RESULT($with_cxx_main)
548 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
549 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
551 if test "$CXX" = "notfound"
558 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
559 if test "$CXX" = "notfound"
564 if test "$preset_cxx" != "$CXX"
568 By default, distutils will build C++ extension modules with "$CXX".
569 If this is not intended, then set CXX on the configure command line.
574 # checks for UNIX variants that set C preprocessor variables
575 AC_USE_SYSTEM_EXTENSIONS
577 # Check for unsupported systems
578 case $ac_sys_system/$ac_sys_release in
580 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
581 echo See README for details.
586 AC_MSG_CHECKING(for --with-suffix)
588 AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]),
595 AC_MSG_RESULT($EXEEXT)
597 # Test whether we're running on a non-case-sensitive system, in which
598 # case we give a warning if no ext is given
599 AC_SUBST(BUILDEXEEXT)
600 AC_MSG_CHECKING(for case-insensitive build directory)
601 if test ! -d CaseSensitiveTestDir; then
602 mkdir CaseSensitiveTestDir
605 if test -d casesensitivetestdir
613 rmdir CaseSensitiveTestDir
618 gcc) CC="$CC -D_HAVE_BSDI";;
622 case $ac_sys_system in
625 cc|*/cc) CC="$CC -Ae";;
628 # Some functions have a prototype only with that define, e.g. confstr
629 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
635 AC_MSG_CHECKING(LIBRARY)
636 if test -z "$LIBRARY"
638 LIBRARY='libpython$(VERSION).a'
640 AC_MSG_RESULT($LIBRARY)
642 # LDLIBRARY is the name of the library to link against (as opposed to the
643 # name of the library into which to insert object files). BLDLIBRARY is also
644 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
645 # is blank as the main program is not linked directly against LDLIBRARY.
646 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
647 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
648 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
649 # DLLLIBRARY is the shared (i.e., DLL) library.
651 # RUNSHARED is used to run shared python without installed libraries
653 # INSTSONAME is the name of the shared library that will be use to install
654 # on the system - some systems like version suffix, others don't
658 AC_SUBST(LDLIBRARYDIR)
662 BLDLIBRARY='$(LDLIBRARY)'
663 INSTSONAME='$(LDLIBRARY)'
668 # LINKCC is the command that links the python executable -- default is $(CC).
669 # If CXX is set, and if it is needed to link a main function that was
670 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
671 # python might then depend on the C++ runtime
672 # This is altered for AIX in order to build the export list before
675 AC_MSG_CHECKING(LINKCC)
678 LINKCC='$(PURIFY) $(MAINCC)'
679 case $ac_sys_system in
682 if test $ac_sys_release -ge 5 -o \
683 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
686 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
688 # qcc must be used because the other compilers do not
693 AC_MSG_RESULT($LINKCC)
695 # GNULD is set to "yes" if the GNU linker is used. If this goes wrong
696 # make sure we default having it set to "no": this is used by
697 # distutils.unixccompiler to know if it should add --enable-new-dtags
698 # to linker command lines, and failing to detect GNU ld simply results
699 # in the same bahaviour as before.
701 AC_MSG_CHECKING(for GNU ld)
703 if test "$GCC" = yes; then
704 ac_prog=`$CC -print-prog-name=ld`
706 case `"$ac_prog" -V 2>&1 < /dev/null` in
712 AC_MSG_RESULT($GNULD)
714 AC_MSG_CHECKING(for --enable-shared)
715 AC_ARG_ENABLE(shared,
716 AS_HELP_STRING([--enable-shared], [disable/enable building shared python library]))
718 if test -z "$enable_shared"
720 case $ac_sys_system in
722 enable_shared="yes";;
727 AC_MSG_RESULT($enable_shared)
729 AC_MSG_CHECKING(for --enable-profiling)
730 AC_ARG_ENABLE(profiling,
731 AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]),
734 AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
735 [ac_enable_profiling="yes"],
736 [ac_enable_profiling="no"],
737 [ac_enable_profiling="no"])
739 AC_MSG_RESULT($ac_enable_profiling)
741 case "$ac_enable_profiling" in
743 BASECFLAGS="-pg $BASECFLAGS"
744 LDFLAGS="-pg $LDFLAGS"
748 AC_MSG_CHECKING(LDLIBRARY)
750 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
751 # library that we build, but we do not want to link against it (we
752 # will find it with a -framework option). For this reason there is an
753 # extra variable BLDLIBRARY against which Python and the extension
754 # modules are linked, BLDLIBRARY. This is normally the same as
755 # LDLIBRARY, but empty for MacOSX framework builds.
756 if test "$enable_framework"
758 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
759 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
762 BLDLIBRARY='$(LDLIBRARY)'
765 # Other platforms follow
766 if test $enable_shared = "yes"; then
767 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
768 case $ac_sys_system in
770 LDLIBRARY='libpython$(VERSION).so'
773 LDLIBRARY='libpython$(VERSION).dll.a'
774 DLLLIBRARY='libpython$(VERSION).dll'
777 LDLIBRARY='libpython$(VERSION).so'
778 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
779 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
780 INSTSONAME="$LDLIBRARY".$SOVERSION
782 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
783 LDLIBRARY='libpython$(VERSION).so'
784 BLDLIBRARY='-L. -lpython$(VERSION)'
785 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
786 case $ac_sys_system in
788 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
791 INSTSONAME="$LDLIBRARY".$SOVERSION
796 LDLIBRARY='libpython$(VERSION).so'
799 LDLIBRARY='libpython$(VERSION).sl'
802 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
803 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
806 LDLIBRARY='libpython$(VERSION).so'
807 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
808 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
811 LDLIBRARY='libpython$(VERSION).so'
812 BLDLIBRARY='-L. -lpython$(VERSION)'
813 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
816 LDLIBRARY='libpython$(VERSION).dylib'
817 BLDLIBRARY='-L. -lpython$(VERSION)'
818 RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
821 LDLIBRARY='libpython$(VERSION).so'
822 RUNSHARED=LIBPATH=`pwd`:${LIBPATH}
826 else # shared is disabled
827 case $ac_sys_system in
829 BLDLIBRARY='$(LIBRARY)'
830 LDLIBRARY='libpython$(VERSION).dll.a'
835 AC_MSG_RESULT($LDLIBRARY)
839 AC_CHECK_PROGS(AR, ar aal, ar)
841 # tweak ARFLAGS only if the user didn't set it on the command line
843 if test -z "$ARFLAGS"
849 AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
850 if test $SVNVERSION = found
852 SVNVERSION="svnversion \$(srcdir)"
854 SVNVERSION="echo Unversioned directory"
860 AC_CHECK_PROG(HAS_HG, hg, found, not-found)
861 if test $HAS_HG = found
863 HGVERSION="hg id -i \$(srcdir)"
864 HGTAG="hg id -t \$(srcdir)"
865 HGBRANCH="hg id -b \$(srcdir)"
874 # install -d does not work on BSDI or HP-UX
875 if test -z "$INSTALL"
877 INSTALL="${srcdir}/install-sh -c"
882 # Not every filesystem supports hard links
884 if test -z "$LN" ; then
885 case $ac_sys_system in
887 CYGWIN*) LN="ln -s";;
888 atheos*) LN="ln -s";;
893 # Check for --with-pydebug
894 AC_MSG_CHECKING(for --with-pydebug)
896 AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]),
898 if test "$withval" != no
900 AC_DEFINE(Py_DEBUG, 1,
901 [Define if you want to build an interpreter with many run-time checks.])
904 else AC_MSG_RESULT(no); Py_DEBUG='false'
908 # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
909 # merged with this chunk of code?
911 # Optimizer/debugger flags
912 # ------------------------
913 # (The following bit of code is complicated enough - please keep things
914 # indented properly. Just pretend you're editing Python code. ;-)
916 # There are two parallel sets of case statements below, one that checks to
917 # see if OPT was set and one that does BASECFLAGS setting based upon
918 # compiler and platform. BASECFLAGS tweaks need to be made even if the
921 # tweak OPT based on compiler and platform, only if the user didn't set
922 # it on the command line
924 if test "${OPT-unset}" = "unset"
928 if test "$CC" != 'g++' ; then
929 STRICT_PROTO="-Wstrict-prototypes"
931 # For gcc 4.x we need to use -fwrapv so lets check if its supported
932 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
936 # Clang also needs -fwrapv
938 *clang*) WRAP="-fwrapv"
942 case $ac_cv_prog_cc_g in
944 if test "$Py_DEBUG" = 'true' ; then
945 # Optimization messes up debuggers, so turn it off for
947 OPT="-g -O0 -Wall $STRICT_PROTO"
949 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
953 OPT="-O3 -Wall $STRICT_PROTO"
956 case $ac_sys_system in
957 SCO_SV*) OPT="$OPT -m486 -DSCO5"
970 # The -arch flags for universal builds on OSX
971 UNIVERSAL_ARCH_FLAGS=
972 AC_SUBST(UNIVERSAL_ARCH_FLAGS)
974 # tweak BASECFLAGS based on compiler and platform
977 # Python violates C99 rules, by casting between incompatible
978 # pointer types. GCC may generate bad code as a result of that,
979 # so use -fno-strict-aliasing if supported.
980 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
982 CC="$CC -fno-strict-aliasing"
983 AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
985 [AC_LANG_PROGRAM([[]], [[]])],
986 [ac_cv_no_strict_aliasing_ok=yes],
987 [ac_cv_no_strict_aliasing_ok=no]))
989 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
990 if test $ac_cv_no_strict_aliasing_ok = yes
992 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
995 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
996 # support. Without this, treatment of subnormals doesn't follow
998 case $ac_sys_machine in
1000 BASECFLAGS="$BASECFLAGS -mieee"
1004 case $ac_sys_system in
1006 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
1008 # is there any other compiler on Darwin besides gcc?
1010 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
1011 # used to be here, but non-Apple gcc doesn't accept them.
1012 if test "${CC}" = gcc
1014 AC_MSG_CHECKING(which compiler should be used)
1015 case "${UNIVERSALSDK}" in
1017 # Build using 10.4 SDK, force usage of gcc when the
1018 # compiler is gcc, otherwise the user will get very
1019 # confusing error messages when building on OSX 10.6
1027 # Calculate the right deployment target for this build.
1029 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
1030 if test ${cur_target} '>' 10.2; then
1032 if test ${enable_universalsdk}; then
1033 if test "${UNIVERSAL_ARCHS}" = "all"; then
1034 # Ensure that the default platform for a
1035 # 4-way universal build is OSX 10.5,
1036 # that's the first OS release where
1037 # 4-way builds make sense.
1040 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
1043 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
1046 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
1050 if test `/usr/bin/arch` = "i386"; then
1051 # On Intel macs default to a deployment
1052 # target of 10.4, that's the first OSX
1053 # release with Intel support.
1058 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1060 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1061 # environment with a value that is the same as what we'll use
1062 # in the Makefile to ensure that we'll get the same compiler
1063 # environment during configure and build time.
1064 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1065 export MACOSX_DEPLOYMENT_TARGET
1066 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1068 if test "${enable_universalsdk}"; then
1069 UNIVERSAL_ARCH_FLAGS=""
1070 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
1071 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
1075 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
1076 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
1078 ARCH_RUN_32BIT="true"
1080 elif test "$UNIVERSAL_ARCHS" = "all" ; then
1081 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
1082 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
1083 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
1085 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
1086 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
1087 LIPO_32BIT_FLAGS="-extract i386"
1088 ARCH_RUN_32BIT="/usr/bin/arch -i386"
1090 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
1091 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
1092 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
1093 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
1096 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
1101 CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
1102 if test "${UNIVERSALSDK}" != "/"
1104 CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
1105 LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1106 CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
1114 BASECFLAGS="$BASECFLAGS -mieee"
1120 case $ac_sys_system in
1121 OpenUNIX*|UnixWare*)
1122 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1125 BASECFLAGS="$BASECFLAGS -ieee -std"
1128 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1134 if test "$Py_DEBUG" = 'true'; then
1140 if test "$ac_arch_flags"
1142 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
1145 # disable check for icc since it seems to pass, but generates a warning
1148 ac_cv_opt_olimit_ok=no
1151 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1152 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1154 CC="$CC -OPT:Olimit=0"
1156 [AC_LANG_PROGRAM([[]], [[]])],
1157 [ac_cv_opt_olimit_ok=yes],
1158 [ac_cv_opt_olimit_ok=no]
1161 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
1162 if test $ac_cv_opt_olimit_ok = yes; then
1163 case $ac_sys_system in
1164 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1165 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1170 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1174 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1175 AC_CACHE_VAL(ac_cv_olimit_ok,
1177 CC="$CC -Olimit 1500"
1179 [AC_LANG_PROGRAM([[]], [[]])],
1180 [ac_cv_olimit_ok=yes],
1181 [ac_cv_olimit_ok=no]
1184 AC_MSG_RESULT($ac_cv_olimit_ok)
1185 if test $ac_cv_olimit_ok = yes; then
1186 BASECFLAGS="$BASECFLAGS -Olimit 1500"
1190 # Check whether GCC supports PyArg_ParseTuple format
1191 if test "$GCC" = "yes"
1193 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1195 CFLAGS="$CFLAGS -Werror"
1197 AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
1199 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1,
1200 [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1208 # On some compilers, pthreads are available without further options
1209 # (e.g. MacOS X). On some of these systems, the compiler will not
1210 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1211 # So we have to see first whether pthreads are available without
1212 # options before we can check whether -Kpthread improves anything.
1213 AC_MSG_CHECKING(whether pthreads are available without options)
1214 AC_CACHE_VAL(ac_cv_pthread_is_default,
1215 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
1216 #include <pthread.h>
1218 void* routine(void* p){return NULL;}
1222 if(pthread_create(&p,NULL,routine,NULL)!=0)
1224 (void)pthread_detach(p);
1228 ac_cv_pthread_is_default=yes
1231 ],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no])
1233 AC_MSG_RESULT($ac_cv_pthread_is_default)
1236 if test $ac_cv_pthread_is_default = yes
1240 # -Kpthread, if available, provides the right #defines
1241 # and linker options to make pthread_create available
1242 # Some compilers won't report that they do not support -Kpthread,
1243 # so we need to run a program to see whether it really made the
1244 # function available.
1245 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1246 AC_CACHE_VAL(ac_cv_kpthread,
1249 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1250 #include <pthread.h>
1252 void* routine(void* p){return NULL;}
1256 if(pthread_create(&p,NULL,routine,NULL)!=0)
1258 (void)pthread_detach(p);
1261 ]])],[ac_cv_kpthread=yes],[ac_cv_kpthread=no],[ac_cv_kpthread=no])
1263 AC_MSG_RESULT($ac_cv_kpthread)
1266 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
1268 # -Kthread, if available, provides the right #defines
1269 # and linker options to make pthread_create available
1270 # Some compilers won't report that they do not support -Kthread,
1271 # so we need to run a program to see whether it really made the
1272 # function available.
1273 AC_MSG_CHECKING(whether $CC accepts -Kthread)
1274 AC_CACHE_VAL(ac_cv_kthread,
1277 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1278 #include <pthread.h>
1280 void* routine(void* p){return NULL;}
1284 if(pthread_create(&p,NULL,routine,NULL)!=0)
1286 (void)pthread_detach(p);
1289 ]])],[ac_cv_kthread=yes],[ac_cv_kthread=no],[ac_cv_kthread=no])
1291 AC_MSG_RESULT($ac_cv_kthread)
1294 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
1296 # -pthread, if available, provides the right #defines
1297 # and linker options to make pthread_create available
1298 # Some compilers won't report that they do not support -pthread,
1299 # so we need to run a program to see whether it really made the
1300 # function available.
1301 AC_MSG_CHECKING(whether $CC accepts -pthread)
1302 AC_CACHE_VAL(ac_cv_thread,
1305 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1306 #include <pthread.h>
1308 void* routine(void* p){return NULL;}
1312 if(pthread_create(&p,NULL,routine,NULL)!=0)
1314 (void)pthread_detach(p);
1317 ]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
1319 AC_MSG_RESULT($ac_cv_pthread)
1322 # If we have set a CC compiler flag for thread support then
1323 # check if it works for CXX, too.
1327 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1330 if test "$ac_cv_kpthread" = "yes"
1332 CXX="$CXX -Kpthread"
1333 ac_cv_cxx_thread=yes
1334 elif test "$ac_cv_kthread" = "yes"
1337 ac_cv_cxx_thread=yes
1338 elif test "$ac_cv_pthread" = "yes"
1341 ac_cv_cxx_thread=yes
1344 if test $ac_cv_cxx_thread = yes
1346 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1347 $CXX -c conftest.$ac_ext 2>&5
1348 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1349 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1351 ac_cv_cxx_thread=yes
1357 AC_MSG_RESULT($ac_cv_cxx_thread)
1361 dnl # check for ANSI or K&R ("traditional") preprocessor
1362 dnl AC_MSG_CHECKING(for C preprocessor type)
1363 dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1364 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1366 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1367 dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional])
1368 dnl AC_MSG_RESULT($cpp_type)
1370 # checks for header files
1372 AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1374 ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
1375 shadow.h signal.h stdint.h stropts.h termios.h thread.h \
1377 sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1378 sys/lock.h sys/mkdev.h sys/modem.h \
1379 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
1380 sys/termio.h sys/time.h \
1381 sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
1382 sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1383 bluetooth/bluetooth.h linux/tipc.h spawn.h util.h)
1387 # On Solaris, term.h requires curses.h
1388 AC_CHECK_HEADERS(term.h,,,[
1389 #ifdef HAVE_CURSES_H
1394 # On Linux, netlink.h requires asm/types.h
1395 AC_CHECK_HEADERS(linux/netlink.h,,,[
1396 #ifdef HAVE_ASM_TYPES_H
1397 #include <asm/types.h>
1399 #ifdef HAVE_SYS_SOCKET_H
1400 #include <sys/socket.h>
1404 # checks for typedefs
1406 AC_MSG_CHECKING(for clock_t in time.h)
1407 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1408 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1410 AC_MSG_RESULT($was_it_defined)
1412 # Check whether using makedev requires defining _OSF_SOURCE
1413 AC_MSG_CHECKING(for makedev)
1414 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1415 #if defined(MAJOR_IN_MKDEV)
1416 #include <sys/mkdev.h>
1417 #elif defined(MAJOR_IN_SYSMACROS)
1418 #include <sys/sysmacros.h>
1420 #include <sys/types.h>
1421 #endif ]], [[ makedev(0, 0) ]])],
1422 [ac_cv_has_makedev=yes],
1423 [ac_cv_has_makedev=no])
1424 if test "$ac_cv_has_makedev" = "no"; then
1425 # we didn't link, try if _OSF_SOURCE will allow us to link
1426 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1427 #define _OSF_SOURCE 1
1428 #include <sys/types.h>
1429 ]], [[ makedev(0, 0) ]])],
1430 [ac_cv_has_makedev=yes],
1431 [ac_cv_has_makedev=no])
1432 if test "$ac_cv_has_makedev" = "yes"; then
1433 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1436 AC_MSG_RESULT($ac_cv_has_makedev)
1437 if test "$ac_cv_has_makedev" = "yes"; then
1438 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1441 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1442 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1443 # defined, but the compiler does not support pragma redefine_extname,
1444 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1445 # structures (such as rlimit64) without declaring them. As a
1446 # work-around, disable LFS on such configurations
1449 AC_MSG_CHECKING(Solaris LFS bug)
1450 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1451 #define _LARGEFILE_SOURCE 1
1452 #define _FILE_OFFSET_BITS 64
1453 #include <sys/resource.h>
1454 ]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes])
1455 AC_MSG_RESULT($sol_lfs_bug)
1456 if test "$sol_lfs_bug" = "yes"; then
1460 if test "$use_lfs" = "yes"; then
1461 # Two defines needed to enable largefile support on various platforms
1462 # These may affect some typedefs
1463 case $ac_sys_system/$ac_sys_release in
1465 AC_DEFINE(_LARGE_FILES, 1,
1466 [This must be defined on AIX systems to enable large file support.])
1469 AC_DEFINE(_LARGEFILE_SOURCE, 1,
1470 [This must be defined on some systems to enable large file support.])
1471 AC_DEFINE(_FILE_OFFSET_BITS, 64,
1472 [This must be set to 64 on some systems to enable large file support.])
1475 # Add some code to confdefs.h so that the test for off_t works on SCO
1476 cat >> confdefs.h <<\EOF
1482 # Type availability checks
1486 AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
1493 AC_CHECK_TYPE(ssize_t,
1494 AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
1496 # Sizes of various common basic types
1497 # ANSI C requires sizeof(char) == 1, so no need to check it
1498 AC_CHECK_SIZEOF(int, 4)
1499 AC_CHECK_SIZEOF(long, 4)
1500 AC_CHECK_SIZEOF(void *, 4)
1501 AC_CHECK_SIZEOF(short, 2)
1502 AC_CHECK_SIZEOF(float, 4)
1503 AC_CHECK_SIZEOF(double, 8)
1504 AC_CHECK_SIZEOF(fpos_t, 4)
1505 AC_CHECK_SIZEOF(size_t, 4)
1506 AC_CHECK_SIZEOF(pid_t, 4)
1508 AC_MSG_CHECKING(for long long support)
1510 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
1511 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1514 AC_MSG_RESULT($have_long_long)
1515 if test "$have_long_long" = yes ; then
1516 AC_CHECK_SIZEOF(long long, 8)
1519 AC_MSG_CHECKING(for long double support)
1521 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
1522 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1523 have_long_double=yes
1525 AC_MSG_RESULT($have_long_double)
1526 if test "$have_long_double" = yes ; then
1527 AC_CHECK_SIZEOF(long double, 12)
1530 AC_MSG_CHECKING(for _Bool support)
1532 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Bool x; x = (_Bool)0;]])],[
1533 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1536 AC_MSG_RESULT($have_c99_bool)
1537 if test "$have_c99_bool" = yes ; then
1538 AC_CHECK_SIZEOF(_Bool, 1)
1541 AC_CHECK_TYPES(uintptr_t,
1542 [AC_CHECK_SIZEOF(uintptr_t, 4)],
1543 [], [#ifdef HAVE_STDINT_H
1546 #ifdef HAVE_INTTYPES_H
1547 #include <inttypes.h>
1550 AC_CHECK_SIZEOF(off_t, [], [
1551 #ifdef HAVE_SYS_TYPES_H
1552 #include <sys/types.h>
1556 AC_MSG_CHECKING(whether to enable large file support)
1557 if test "$have_long_long" = yes
1559 if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1560 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1561 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1562 [Defined to enable large file support when an off_t is bigger than a long
1563 and long long is available and at least as big as an off_t. You may need
1564 to add some flags for configuration and compilation to enable this mode.
1565 (For Solaris and Linux, the necessary defines are already defined.)])
1574 AC_CHECK_SIZEOF(time_t, [], [
1575 #ifdef HAVE_SYS_TYPES_H
1576 #include <sys/types.h>
1583 # if have pthread_t then define SIZEOF_PTHREAD_T
1585 if test "$ac_cv_kpthread" = "yes"
1586 then CC="$CC -Kpthread"
1587 elif test "$ac_cv_kthread" = "yes"
1588 then CC="$CC -Kthread"
1589 elif test "$ac_cv_pthread" = "yes"
1590 then CC="$CC -pthread"
1592 AC_MSG_CHECKING(for pthread_t)
1595 AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
1596 ],[have_pthread_t=yes],[])
1597 AC_MSG_RESULT($have_pthread_t)
1598 if test "$have_pthread_t" = yes ; then
1599 AC_CHECK_SIZEOF(pthread_t, [], [
1600 #ifdef HAVE_PTHREAD_H
1601 #include <pthread.h>
1607 AC_MSG_CHECKING(for --enable-toolbox-glue)
1608 AC_ARG_ENABLE(toolbox-glue,
1609 AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions]))
1611 if test -z "$enable_toolbox_glue"
1613 case $ac_sys_system/$ac_sys_release in
1615 enable_toolbox_glue="yes";;
1617 enable_toolbox_glue="no";;
1620 case "$enable_toolbox_glue" in
1622 extra_machdep_objs="Python/mactoolboxglue.o"
1623 extra_undefs="-u _PyMac_Error"
1624 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1625 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
1628 extra_machdep_objs=""
1632 AC_MSG_RESULT($enable_toolbox_glue)
1635 AC_SUBST(OTHER_LIBTOOL_OPT)
1636 case $ac_sys_system/$ac_sys_release in
1637 Darwin/@<:@01567@:>@\..*)
1638 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1641 OTHER_LIBTOOL_OPT=""
1647 AC_SUBST(LIBTOOL_CRUFT)
1648 case $ac_sys_system/$ac_sys_release in
1649 Darwin/@<:@01567@:>@\..*)
1650 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1651 if test "${enable_universalsdk}"; then
1654 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
1656 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1657 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1659 gcc_version=`gcc -dumpversion`
1660 if test ${gcc_version} '<' 4.0
1662 LIBTOOL_CRUFT="-lcc_dynamic"
1666 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1668 int main(int argc, char*argv[])
1670 if (sizeof(long) == 4) {
1676 ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
1678 if test "${ac_osx_32bit}" = "yes"; then
1679 case `/usr/bin/arch` in
1681 MACOSX_DEFAULT_ARCH="i386"
1684 MACOSX_DEFAULT_ARCH="ppc"
1687 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1691 case `/usr/bin/arch` in
1693 MACOSX_DEFAULT_ARCH="x86_64"
1696 MACOSX_DEFAULT_ARCH="ppc64"
1699 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1703 #ARCH_RUN_32BIT="true"
1706 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
1707 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1708 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1711 AC_MSG_CHECKING(for --enable-framework)
1712 if test "$enable_framework"
1714 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
1715 # -F. is needed to allow linking to the framework while
1716 # in the build location.
1717 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1718 [Define if you want to produce an OpenStep/Rhapsody framework
1719 (shared library plus accessory files).])
1721 if test $enable_shared = "yes"
1723 AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.])
1729 AC_MSG_CHECKING(for dyld)
1730 case $ac_sys_system/$ac_sys_release in
1732 AC_DEFINE(WITH_DYLD, 1,
1733 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1734 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1735 linker (rld). Dyld is necessary to support frameworks.])
1736 AC_MSG_RESULT(always on for Darwin)
1743 # Set info about shared libraries.
1746 AC_SUBST(LDCXXSHARED)
1749 AC_SUBST(LINKFORSHARED)
1750 # SO is the extension of shared libraries `(including the dot!)
1751 # -- usually .so, .sl on HP-UX, .dll on Cygwin
1755 case $ac_sys_system in
1766 # this might also be a termcap variable, see #610332
1768 echo '====================================================================='
1770 echo '+ WARNING: You have set SO in your environment. +'
1771 echo '+ Do you really mean to change the extension for shared libraries? +'
1772 echo '+ Continuing in 10 seconds to let you to ponder. +'
1774 echo '====================================================================='
1779 AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
1780 # LDSHARED is the ld *command* used to create shared library
1781 # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
1782 # (Shared libraries in this instance are shared modules to be loaded into
1783 # Python, as opposed to building Python itself as a shared library.)
1784 AC_MSG_CHECKING(LDSHARED)
1785 if test -z "$LDSHARED"
1787 case $ac_sys_system/$ac_sys_release in
1789 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
1790 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
1793 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
1794 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
1796 IRIX/5*) LDSHARED="ld -shared";;
1797 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1799 if test "$GCC" = "yes" ; then
1800 LDSHARED='$(CC) -shared'
1801 LDCXXSHARED='$(CXX) -shared'
1804 LDCXXSHARED='$(CXX) -G'
1807 if test "$GCC" = "yes" ; then
1808 LDSHARED='$(CC) -shared'
1809 LDCXXSHARED='$(CXX) -shared'
1813 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1815 LDSHARED='$(CC) -bundle'
1816 LDCXXSHARED='$(CXX) -bundle'
1817 if test "$enable_framework" ; then
1818 # Link against the framework. All externals should be defined.
1819 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1820 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1821 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1823 # No framework. Ignore undefined symbols, assuming they come from Python
1824 LDSHARED="$LDSHARED -undefined suppress"
1825 LDCXXSHARED="$LDCXXSHARED -undefined suppress"
1827 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
1828 LDSHARED='$(CC) -bundle'
1829 LDCXXSHARED='$(CXX) -bundle'
1830 if test "$enable_framework" ; then
1831 # Link against the framework. All externals should be defined.
1832 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1833 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1834 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1836 # No framework, use the Python app as bundle-loader
1837 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1838 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1839 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1842 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1843 # This allows an extension to be used in any Python
1845 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
1847 if test "${enable_universalsdk}"; then
1848 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1850 LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
1851 LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
1852 BLDSHARED="$LDSHARED"
1854 LDSHARED='$(CC) -bundle'
1855 LDCXXSHARED='$(CXX) -bundle'
1856 if test "$enable_framework" ; then
1857 # Link against the framework. All externals should be defined.
1858 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1859 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1860 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1862 # No framework, use the Python app as bundle-loader
1863 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1864 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1865 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1870 LDSHARED='$(CC) -shared'
1871 LDCXXSHARED='$(CXX) -shared';;
1873 LDSHARED="gcc -shared"
1874 LDCXXSHARED="g++ -shared";;
1876 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1878 LDSHARED='$(CC) -shared'
1879 LDCXXSHARED='$(CXX) -shared'
1881 LDSHARED="ld -Bshareable"
1884 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1886 LDSHARED='$(CC) -shared $(CCSHARED)'
1887 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
1890 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
1891 LDSHARED="ld -Bshareable ${LDFLAGS}"
1894 LDSHARED='$(CC) -shared $(CCSHARED)'
1895 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
1900 LDSHARED='$(CC) -shared'
1901 LDCXXSHARED='$(CXX) -shared';;
1902 OpenUNIX*|UnixWare*)
1903 if test "$GCC" = "yes" ; then
1904 LDSHARED='$(CC) -shared'
1905 LDCXXSHARED='$(CXX) -shared'
1908 LDCXXSHARED='$(CXX) -G'
1911 LDSHARED='$(CC) -Wl,-G,-Bexport'
1912 LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
1914 LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
1915 LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
1917 LDSHARED="gcc -shared"
1918 LDCXXSHARED="g++ -shared";;
1922 AC_MSG_RESULT($LDSHARED)
1923 LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
1924 BLDSHARED=${BLDSHARED-$LDSHARED}
1925 # CCSHARED are the C *flags* used to create objects to go into a shared
1926 # library (module) -- this is only needed for a few systems
1927 AC_MSG_CHECKING(CCSHARED)
1928 if test -z "$CCSHARED"
1930 case $ac_sys_system/$ac_sys_release in
1931 SunOS*) if test "$GCC" = yes;
1932 then CCSHARED="-fPIC";
1933 elif test `uname -p` = sparc;
1934 then CCSHARED="-xcode=pic32";
1935 else CCSHARED="-Kpic";
1937 hp*|HP*) if test "$GCC" = yes;
1938 then CCSHARED="-fPIC";
1941 Linux*|GNU*) CCSHARED="-fPIC";;
1942 BSD/OS*/4*) CCSHARED="-fpic";;
1943 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
1944 OpenUNIX*|UnixWare*)
1945 if test "$GCC" = "yes"
1946 then CCSHARED="-fPIC"
1947 else CCSHARED="-KPIC"
1950 if test "$GCC" = "yes"
1951 then CCSHARED="-fPIC"
1952 else CCSHARED="-Kpic -belf"
1954 IRIX*/6*) case $CC in
1955 *gcc*) CCSHARED="-shared";;
1958 atheos*) CCSHARED="-fPIC";;
1961 AC_MSG_RESULT($CCSHARED)
1962 # LINKFORSHARED are the flags passed to the $(CC) command that links
1963 # the python executable -- this is only needed for a few systems
1964 AC_MSG_CHECKING(LINKFORSHARED)
1965 if test -z "$LINKFORSHARED"
1967 case $ac_sys_system/$ac_sys_release in
1968 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1970 LINKFORSHARED="-Wl,-E -Wl,+s";;
1971 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1972 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1973 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1974 # -u libsys_s pulls in all symbols in libsys
1976 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1978 # not used by the core itself but which needs to be in the core so
1979 # that dynamically loaded extension modules have access to it.
1980 # -prebind is no longer used, because it actually seems to give a
1981 # slowdown in stead of a speedup, maybe due to the large number of
1982 # dynamic loads Python does.
1984 LINKFORSHARED="$extra_undefs"
1985 if test "$enable_framework"
1987 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1989 LINKFORSHARED="$LINKFORSHARED";;
1990 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1991 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1992 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1993 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
1994 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1996 LINKFORSHARED="-Wl,--export-dynamic"
1998 SunOS/5*) case $CC in
2000 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
2002 LINKFORSHARED="-Xlinker --export-dynamic"
2006 if test $enable_shared = "no"
2008 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
2011 # -Wl,-E causes the symbols to be added to the dynamic
2012 # symbol table so that they can be found when a module
2013 # is loaded. -N 2048K causes the stack size to be set
2014 # to 2048 kilobytes so that the stack doesn't overflow
2015 # when running test_compile.py.
2016 LINKFORSHARED='-Wl,-E -N 2048K';;
2019 AC_MSG_RESULT($LINKFORSHARED)
2022 AC_SUBST(CFLAGSFORSHARED)
2023 AC_MSG_CHECKING(CFLAGSFORSHARED)
2024 if test ! "$LIBRARY" = "$LDLIBRARY"
2026 case $ac_sys_system in
2028 # Cygwin needs CCSHARED when building extension DLLs
2029 # but not when building the interpreter DLL.
2030 CFLAGSFORSHARED='';;
2032 CFLAGSFORSHARED='$(CCSHARED)'
2035 AC_MSG_RESULT($CFLAGSFORSHARED)
2037 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
2038 # library (with --enable-shared).
2039 # For platforms on which shared libraries are not allowed to have unresolved
2040 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
2041 # if it is not required, since it creates a dependency of the shared library
2042 # to LIBS. This, in turn, means that applications linking the shared libpython
2043 # don't need to link LIBS explicitly. The default should be only changed
2044 # on systems where this approach causes problems.
2046 AC_MSG_CHECKING(SHLIBS)
2047 case "$ac_sys_system" in
2051 AC_MSG_RESULT($SHLIBS)
2054 # checks for libraries
2055 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
2056 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
2058 # only check for sem_init if thread support is requested
2059 if test "$with_threads" = "yes" -o -z "$with_threads"; then
2060 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
2061 # posix4 on Solaris 2.6
2062 # pthread (first!) on Linux
2065 # check if we need libintl for locale functions
2066 AC_CHECK_LIB(intl, textdomain,
2067 AC_DEFINE(WITH_LIBINTL, 1,
2068 [Define to 1 if libintl is needed for locale functions.]))
2070 # checks for system dependent C++ extensions support
2071 case "$ac_sys_system" in
2072 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
2074 AC_LANG_PROGRAM([[#include <load.h>]],
2075 [[loadAndInit("", 0, "")]])
2077 AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
2078 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
2079 and you want support for AIX C++ shared extension modules.])
2087 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
2088 # BeOS' sockets are stashed in libnet.
2089 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
2090 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
2092 case "$ac_sys_system" in
2094 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
2098 AC_MSG_CHECKING(for --with-libs)
2100 AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
2102 AC_MSG_RESULT($withval)
2103 LIBS="$withval $LIBS"
2105 [AC_MSG_RESULT(no)])
2107 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2109 # Check for use of the system expat library
2110 AC_MSG_CHECKING(for --with-system-expat)
2111 AC_ARG_WITH(system_expat,
2112 AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
2114 [with_system_expat="no"])
2116 AC_MSG_RESULT($with_system_expat)
2118 # Check for use of the system libffi library
2119 AC_MSG_CHECKING(for --with-system-ffi)
2120 AC_ARG_WITH(system_ffi,
2121 AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),
2123 [with_system_ffi="no"])
2125 if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
2126 LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
2128 LIBFFI_INCLUDEDIR=""
2130 AC_SUBST(LIBFFI_INCLUDEDIR)
2132 AC_MSG_RESULT($with_system_ffi)
2134 # Check for --with-dbmliborder
2135 AC_MSG_CHECKING(for --with-dbmliborder)
2136 AC_ARG_WITH(dbmliborder,
2137 AS_HELP_STRING([--with-dbmliborder=db1:db2:...], [order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]),
2139 if test x$with_dbmliborder = xyes
2141 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2143 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
2144 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
2146 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2150 AC_MSG_RESULT($with_dbmliborder)
2152 # Determine if signalmodule should be used.
2153 AC_SUBST(USE_SIGNAL_MODULE)
2154 AC_SUBST(SIGNAL_OBJS)
2155 AC_MSG_CHECKING(for --with-signal-module)
2156 AC_ARG_WITH(signal-module,
2157 AS_HELP_STRING([--with-signal-module], [disable/enable signal module]))
2159 if test -z "$with_signal_module"
2160 then with_signal_module="yes"
2162 AC_MSG_RESULT($with_signal_module)
2164 if test "${with_signal_module}" = "yes"; then
2165 USE_SIGNAL_MODULE=""
2168 USE_SIGNAL_MODULE="#"
2169 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2172 # This is used to generate Setup.config
2173 AC_SUBST(USE_THREAD_MODULE)
2174 USE_THREAD_MODULE=""
2176 AC_MSG_CHECKING(for --with-dec-threads)
2178 AC_ARG_WITH(dec-threads,
2179 AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]),
2181 AC_MSG_RESULT($withval)
2183 if test "${with_thread+set}" != set; then
2184 with_thread="$withval";
2186 [AC_MSG_RESULT(no)])
2188 # Templates for things AC_DEFINEd more than once.
2189 # For a single AC_DEFINE, no template is needed.
2190 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2191 AH_TEMPLATE(_REENTRANT,
2192 [Define to force use of thread-safe errno, h_errno, and other functions])
2193 AH_TEMPLATE(WITH_THREAD,
2194 [Define if you want to compile in rudimentary thread support])
2196 AC_MSG_CHECKING(for --with-threads)
2197 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2198 AC_ARG_WITH(threads,
2199 AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support]))
2201 # --with-thread is deprecated, but check for it anyway
2202 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2204 AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]),
2205 [with_threads=$with_thread])
2207 if test -z "$with_threads"
2208 then with_threads="yes"
2210 AC_MSG_RESULT($with_threads)
2213 if test "$with_threads" = "no"
2215 USE_THREAD_MODULE="#"
2216 elif test "$ac_cv_pthread_is_default" = yes
2218 AC_DEFINE(WITH_THREAD)
2219 # Defining _REENTRANT on system with POSIX threads should not hurt.
2220 AC_DEFINE(_REENTRANT)
2222 THREADOBJ="Python/thread.o"
2223 elif test "$ac_cv_kpthread" = "yes"
2226 if test "$ac_cv_cxx_thread" = "yes"; then
2227 CXX="$CXX -Kpthread"
2229 AC_DEFINE(WITH_THREAD)
2231 THREADOBJ="Python/thread.o"
2232 elif test "$ac_cv_kthread" = "yes"
2235 if test "$ac_cv_cxx_thread" = "yes"; then
2238 AC_DEFINE(WITH_THREAD)
2240 THREADOBJ="Python/thread.o"
2241 elif test "$ac_cv_pthread" = "yes"
2244 if test "$ac_cv_cxx_thread" = "yes"; then
2247 AC_DEFINE(WITH_THREAD)
2249 THREADOBJ="Python/thread.o"
2251 if test ! -z "$with_threads" -a -d "$with_threads"
2252 then LDFLAGS="$LDFLAGS -L$with_threads"
2254 if test ! -z "$withval" -a -d "$withval"
2255 then LDFLAGS="$LDFLAGS -L$withval"
2258 # According to the POSIX spec, a pthreads implementation must
2259 # define _POSIX_THREADS in unistd.h. Some apparently don't
2260 # (e.g. gnu pth with pthread emulation)
2261 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2265 #ifdef _POSIX_THREADS
2268 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2269 AC_MSG_RESULT($unistd_defines_pthreads)
2271 AC_DEFINE(_REENTRANT)
2272 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2273 AC_DEFINE(C_THREADS)
2274 AC_DEFINE(HURD_C_THREADS, 1,
2275 [Define if you are using Mach cthreads directly under /include])
2276 LIBS="$LIBS -lthreads"
2277 THREADOBJ="Python/thread.o"],[
2278 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2279 AC_DEFINE(C_THREADS)
2280 AC_DEFINE(MACH_C_THREADS, 1,
2281 [Define if you are using Mach cthreads under mach /])
2282 THREADOBJ="Python/thread.o"],[
2283 AC_MSG_CHECKING(for --with-pth)
2285 AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]),
2286 [AC_MSG_RESULT($withval)
2287 AC_DEFINE([WITH_THREAD])
2288 AC_DEFINE([HAVE_PTH], 1,
2289 [Define if you have GNU PTH threads.])
2291 THREADOBJ="Python/thread.o"],
2294 # Just looking for pthread_create in libpthread is not enough:
2295 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2296 # So we really have to include pthread.h, and then link.
2298 LIBS="$LIBS -lpthread"
2299 AC_MSG_CHECKING([for pthread_create in -lpthread])
2300 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>
2302 void * start_routine (void *arg) { exit (0); }]], [[
2303 pthread_create (NULL, NULL, start_routine, NULL)]])],[
2305 AC_DEFINE(WITH_THREAD)
2307 THREADOBJ="Python/thread.o"],[
2309 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
2311 THREADOBJ="Python/thread.o"],[
2312 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2313 AC_DEFINE(ATHEOS_THREADS, 1,
2314 [Define this if you have AtheOS threads.])
2315 THREADOBJ="Python/thread.o"],[
2316 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
2317 AC_DEFINE(BEOS_THREADS, 1,
2318 [Define this if you have BeOS threads.])
2319 THREADOBJ="Python/thread.o"],[
2320 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
2322 LIBS="$LIBS -lpthreads"
2323 THREADOBJ="Python/thread.o"], [
2324 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
2327 THREADOBJ="Python/thread.o"], [
2328 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
2330 LIBS="$LIBS -lpthread"
2331 THREADOBJ="Python/thread.o"], [
2332 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
2335 THREADOBJ="Python/thread.o"],[
2336 USE_THREAD_MODULE="#"])
2337 ])])])])])])])])])])
2339 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2341 THREADOBJ="Python/thread.o"
2342 USE_THREAD_MODULE=""])
2344 if test "$posix_threads" != "yes"; then
2345 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2346 LIBS="$LIBS -lthread"
2347 THREADOBJ="Python/thread.o"
2348 USE_THREAD_MODULE=""])
2351 if test "$USE_THREAD_MODULE" != "#"
2353 # If the above checks didn't disable threads, (at least) OSF1
2354 # needs this '-threads' argument during linking.
2355 case $ac_sys_system in
2356 OSF1) LDLAST=-threads;;
2361 if test "$posix_threads" = "yes"; then
2362 if test "$unistd_defines_pthreads" = "no"; then
2363 AC_DEFINE(_POSIX_THREADS, 1,
2364 [Define if you have POSIX threads,
2365 and your system does not define that.])
2368 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2369 case $ac_sys_system/$ac_sys_release in
2370 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
2371 [Defined for Solaris 2.6 bug in pthread header.])
2373 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2374 [Define if the Posix semaphores do not work on your system])
2376 AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2377 [Define if the Posix semaphores do not work on your system])
2381 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2382 AC_CACHE_VAL(ac_cv_pthread_system_supported,
2383 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <pthread.h>
2384 void *foo(void *parm) {
2388 pthread_attr_t attr;
2390 if (pthread_attr_init(&attr)) exit(-1);
2391 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
2392 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
2395 [ac_cv_pthread_system_supported=yes],
2396 [ac_cv_pthread_system_supported=no],
2397 [ac_cv_pthread_system_supported=no])
2399 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2400 if test "$ac_cv_pthread_system_supported" = "yes"; then
2401 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
2403 AC_CHECK_FUNCS(pthread_sigmask,
2404 [case $ac_sys_system in
2406 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2407 [Define if pthread_sigmask() does not work on your system.])
2413 # Check for enable-ipv6
2414 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
2415 AC_MSG_CHECKING([if --enable-ipv6 is specified])
2417 [ --enable-ipv6 Enable ipv6 (with ipv4) support
2418 --disable-ipv6 Disable ipv6 support],
2419 [ case "$enableval" in
2424 *) AC_MSG_RESULT(yes)
2425 AC_DEFINE(ENABLE_IPV6)
2431 dnl the check does not work on cross compilation case...
2432 AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* AF_INET6 available check */
2433 #include <sys/types.h>
2434 #include <sys/socket.h>
2437 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
2453 if test "$ipv6" = "yes"; then
2454 AC_MSG_CHECKING(if RFC2553 API is available)
2456 AC_LANG_PROGRAM([[#include <sys/types.h>
2457 #include <netinet/in.h>]],
2458 [[struct sockaddr_in6 x;
2464 AC_MSG_RESULT(no, IPv6 disabled)
2469 if test "$ipv6" = "yes"; then
2470 AC_DEFINE(ENABLE_IPV6)
2478 if test "$ipv6" = "yes"; then
2479 AC_MSG_CHECKING([ipv6 stack type])
2480 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2484 dnl http://www.kame.net/
2486 #include <netinet/in.h>
2487 #ifdef IPV6_INRIA_VERSION
2493 dnl http://www.kame.net/
2495 #include <netinet/in.h>
2501 ipv6libdir=/usr/local/v6/lib
2505 dnl http://www.v6.linux.or.jp/
2507 #include <features.h>
2508 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2515 dnl http://www.v6.linux.or.jp/
2516 if test -d /usr/inet6; then
2519 ipv6libdir=/usr/inet6/lib
2520 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
2524 if test -f /etc/netconfig; then
2525 if $GREP -q tcp6 /etc/netconfig; then
2533 #include <sys/param.h>
2534 #ifdef _TOSHIBA_INET6
2539 ipv6libdir=/usr/local/v6/lib])
2543 #include </usr/local/v6/include/sys/v6config.h>
2549 ipv6libdir=/usr/local/v6/lib;
2550 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
2554 #include <sys/param.h>
2555 #ifdef _ZETA_MINAMI_INET6
2560 ipv6libdir=/usr/local/v6/lib])
2563 if test "$ipv6type" != "unknown"; then
2567 AC_MSG_RESULT($ipv6type)
2570 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2571 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2572 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2573 echo "using lib$ipv6lib"
2575 if test $ipv6trylibc = "yes"; then
2578 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2579 echo "You need to fetch lib$ipv6lib.a from appropriate"
2580 echo 'ipv6 kit and compile beforehand.'
2586 AC_MSG_CHECKING(for OSX 10.5 SDK or later)
2588 AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
2590 AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.])
2596 # Check for --with-doc-strings
2597 AC_MSG_CHECKING(for --with-doc-strings)
2598 AC_ARG_WITH(doc-strings,
2599 AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings]))
2601 if test -z "$with_doc_strings"
2602 then with_doc_strings="yes"
2604 if test "$with_doc_strings" != "no"
2606 AC_DEFINE(WITH_DOC_STRINGS, 1,
2607 [Define if you want documentation strings in extension modules])
2609 AC_MSG_RESULT($with_doc_strings)
2611 # Check for Python-specific malloc support
2612 AC_MSG_CHECKING(for --with-tsc)
2614 AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[
2615 if test "$withval" != no
2617 AC_DEFINE(WITH_TSC, 1,
2618 [Define to profile with the Pentium timestamp counter])
2620 else AC_MSG_RESULT(no)
2622 [AC_MSG_RESULT(no)])
2624 # Check for Python-specific malloc support
2625 AC_MSG_CHECKING(for --with-pymalloc)
2626 AC_ARG_WITH(pymalloc,
2627 AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs]))
2629 if test -z "$with_pymalloc"
2630 then with_pymalloc="yes"
2632 if test "$with_pymalloc" != "no"
2634 AC_DEFINE(WITH_PYMALLOC, 1,
2635 [Define if you want to compile in Python-specific mallocs])
2637 AC_MSG_RESULT($with_pymalloc)
2639 # Check for Valgrind support
2640 AC_MSG_CHECKING([for --with-valgrind])
2641 AC_ARG_WITH([valgrind],
2642 AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
2644 AC_MSG_RESULT([$with_valgrind])
2645 if test "$with_valgrind" != no; then
2646 AC_CHECK_HEADER([valgrind/valgrind.h],
2647 [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
2648 [AC_MSG_ERROR([Valgrind support requested but headers not available])]
2652 # Check for --with-wctype-functions
2653 AC_MSG_CHECKING(for --with-wctype-functions)
2654 AC_ARG_WITH(wctype-functions,
2655 AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]),
2657 if test "$withval" != no
2659 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2660 [Define if you want wctype.h functions to be used instead of the
2661 one supplied by Python itself. (see Include/unicodectype.h).])
2663 else AC_MSG_RESULT(no)
2665 [AC_MSG_RESULT(no)])
2667 # -I${DLINCLDIR} is added to the compile rule for importdl.o
2671 # the dlopen() function means we might want to use dynload_shlib.o. some
2672 # platforms, such as AIX, have dlopen(), but don't want to use it.
2673 AC_CHECK_FUNCS(dlopen)
2675 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2676 # loading of modules.
2677 AC_SUBST(DYNLOADFILE)
2678 AC_MSG_CHECKING(DYNLOADFILE)
2679 if test -z "$DYNLOADFILE"
2681 case $ac_sys_system/$ac_sys_release in
2682 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2683 if test "$ac_cv_func_dlopen" = yes
2684 then DYNLOADFILE="dynload_shlib.o"
2685 else DYNLOADFILE="dynload_aix.o"
2688 BeOS*) DYNLOADFILE="dynload_beos.o";;
2689 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
2690 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2691 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
2692 atheos*) DYNLOADFILE="dynload_atheos.o";;
2694 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2695 # out any dynamic loading
2696 if test "$ac_cv_func_dlopen" = yes
2697 then DYNLOADFILE="dynload_shlib.o"
2698 else DYNLOADFILE="dynload_stub.o"
2703 AC_MSG_RESULT($DYNLOADFILE)
2704 if test "$DYNLOADFILE" != "dynload_stub.o"
2706 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2707 [Defined when any dynamic module loading is enabled.])
2710 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
2712 AC_SUBST(MACHDEP_OBJS)
2713 AC_MSG_CHECKING(MACHDEP_OBJS)
2714 if test -z "$MACHDEP_OBJS"
2716 MACHDEP_OBJS=$extra_machdep_objs
2718 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
2720 AC_MSG_RESULT(MACHDEP_OBJS)
2722 # checks for library functions
2723 AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2724 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
2725 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2726 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
2727 initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime \
2728 mremap nice pathconf pause plock poll pthread_init \
2729 putenv readlink realpath \
2730 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
2732 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
2733 setlocale setregid setreuid setresuid setresgid \
2734 setsid setpgid setpgrp setuid setvbuf snprintf \
2735 sigaction siginterrupt sigrelse strftime \
2736 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
2737 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
2739 # For some functions, having a definition is not sufficient, since
2740 # we want to take their address.
2741 AC_MSG_CHECKING(for chroot)
2742 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])],
2743 [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2744 AC_MSG_RESULT(yes)],
2747 AC_MSG_CHECKING(for link)
2748 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])],
2749 [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2750 AC_MSG_RESULT(yes)],
2753 AC_MSG_CHECKING(for symlink)
2754 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])],
2755 [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2756 AC_MSG_RESULT(yes)],
2759 AC_MSG_CHECKING(for fchdir)
2760 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])],
2761 [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2762 AC_MSG_RESULT(yes)],
2765 AC_MSG_CHECKING(for fsync)
2766 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])],
2767 [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2768 AC_MSG_RESULT(yes)],
2771 AC_MSG_CHECKING(for fdatasync)
2772 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])],
2773 [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2774 AC_MSG_RESULT(yes)],
2777 AC_MSG_CHECKING(for epoll)
2778 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])],
2779 [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2780 AC_MSG_RESULT(yes)],
2783 AC_MSG_CHECKING(for kqueue)
2784 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2785 #include <sys/types.h>
2786 #include <sys/event.h>
2787 ]], [[int x=kqueue()]])],
2788 [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2789 AC_MSG_RESULT(yes)],
2792 # On some systems (eg. FreeBSD 5), we would find a definition of the
2793 # functions ctermid_r, setgroups in the library, but no prototype
2794 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2795 # address to avoid compiler warnings and potential miscompilations
2796 # because of the missing prototypes.
2798 AC_MSG_CHECKING(for ctermid_r)
2799 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2801 ]], [[void* p = ctermid_r]])],
2802 [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2803 AC_MSG_RESULT(yes)],
2807 AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl],
2810 [#include <sys/file.h>],
2813 [ac_cv_flock_decl=yes],
2814 [ac_cv_flock_decl=no]
2817 if test "x${ac_cv_flock_decl}" = xyes; then
2818 AC_CHECK_FUNCS(flock,,
2819 AC_CHECK_LIB(bsd,flock,
2820 [AC_DEFINE(HAVE_FLOCK)
2821 AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
2826 AC_MSG_CHECKING(for getpagesize)
2827 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2829 ]], [[void* p = getpagesize]])],
2830 [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2831 AC_MSG_RESULT(yes)],
2835 AC_MSG_CHECKING(for broken unsetenv)
2836 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2838 ]], [[int res = unsetenv("DUMMY")]])],
2839 [AC_MSG_RESULT(no)],
2840 [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.)
2845 AC_CHECK_PROGS(TRUE, true, /bin/true)
2847 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2848 dnl On others, they are in the C library, so we to take no action
2849 AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
2850 AC_CHECK_LIB(resolv, inet_aton)
2853 # On Tru64, chflags seems to be present, but calling it will
2855 AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
2856 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2857 #include <sys/stat.h>
2859 int main(int argc, char*argv[])
2861 if(chflags(argv[0], 0) != 0)
2866 [ac_cv_have_chflags=yes],
2867 [ac_cv_have_chflags=no],
2868 [ac_cv_have_chflags=cross])
2870 if test "$ac_cv_have_chflags" = cross ; then
2871 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
2873 if test "$ac_cv_have_chflags" = yes ; then
2874 AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the 'chflags' function.])
2877 AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
2878 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2879 #include <sys/stat.h>
2881 int main(int argc, char*argv[])
2883 if(lchflags(argv[0], 0) != 0)
2887 ]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross])
2889 if test "$ac_cv_have_lchflags" = cross ; then
2890 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
2892 if test "$ac_cv_have_lchflags" = yes ; then
2893 AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.])
2896 dnl Check if system zlib has *Copy() functions
2898 dnl On MacOSX the linker will search for dylibs on the entire linker path
2899 dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
2900 dnl to revert to a more traditional unix behaviour and make it possible to
2901 dnl override the system libz with a local static library of libz. Temporarily
2902 dnl add that flag to our CFLAGS as well to ensure that we check the version
2903 dnl of libz that will be used by setup.py.
2904 dnl The -L/usr/local/lib is needed as wel to get the same compilation
2905 dnl environment as setup.py (and leaving it out can cause configure to use the
2906 dnl wrong version of the library)
2907 case $ac_sys_system/$ac_sys_release in
2909 _CUR_CFLAGS="${CFLAGS}"
2910 _CUR_LDFLAGS="${LDFLAGS}"
2911 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
2912 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
2916 AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
2918 case $ac_sys_system/$ac_sys_release in
2920 CFLAGS="${_CUR_CFLAGS}"
2921 LDFLAGS="${_CUR_LDFLAGS}"
2925 AC_MSG_CHECKING(for hstrerror)
2926 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2928 ]], [[void* p = hstrerror; hstrerror(0)]])],
2929 [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2930 AC_MSG_RESULT(yes)],
2934 AC_MSG_CHECKING(for inet_aton)
2935 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2936 #include <sys/types.h>
2937 #include <sys/socket.h>
2938 #include <netinet/in.h>
2939 #include <arpa/inet.h>
2940 ]], [[void* p = inet_aton;inet_aton(0,0)]])],
2941 [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2942 AC_MSG_RESULT(yes)],
2946 AC_MSG_CHECKING(for inet_pton)
2947 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2948 #include <sys/types.h>
2949 #include <sys/socket.h>
2950 #include <netinet/in.h>
2951 #include <arpa/inet.h>
2952 ]], [[void* p = inet_pton]])],
2953 [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2954 AC_MSG_RESULT(yes)],
2958 # On some systems, setgroups is in unistd.h, on others, in grp.h
2959 AC_MSG_CHECKING(for setgroups)
2960 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2965 ]], [[void* p = setgroups]])],
2966 [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2967 AC_MSG_RESULT(yes)],
2971 # check for openpty and forkpty
2973 AC_CHECK_FUNCS(openpty,,
2974 AC_CHECK_LIB(util,openpty,
2975 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2976 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2979 AC_CHECK_FUNCS(forkpty,,
2980 AC_CHECK_LIB(util,forkpty,
2981 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2982 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2987 AC_CHECK_FUNCS(memmove)
2989 # check for long file support functions
2990 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2992 AC_REPLACE_FUNCS(dup2 getcwd strdup)
2993 AC_CHECK_FUNCS(getpgrp,
2994 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
2995 [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
2998 AC_CHECK_FUNCS(setpgrp,
2999 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])],
3000 [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])],
3003 AC_CHECK_FUNCS(gettimeofday,
3004 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]],
3005 [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])],
3007 [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
3008 [Define if gettimeofday() does not have second (timezone) argument
3009 This is the case on Motorola V4 (R40V4.2)])
3013 AC_MSG_CHECKING(for major, minor, and makedev)
3014 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3015 #if defined(MAJOR_IN_MKDEV)
3016 #include <sys/mkdev.h>
3017 #elif defined(MAJOR_IN_SYSMACROS)
3018 #include <sys/sysmacros.h>
3020 #include <sys/types.h>
3023 makedev(major(0),minor(0));
3025 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
3026 [Define to 1 if you have the device macros.])
3032 # On OSF/1 V5.1, getaddrinfo is available, but a define
3033 # for [no]getaddrinfo in netdb.h.
3034 AC_MSG_CHECKING(for getaddrinfo)
3035 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3036 #include <sys/types.h>
3037 #include <sys/socket.h>
3040 ]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],
3041 [have_getaddrinfo=yes],
3042 [have_getaddrinfo=no])
3043 AC_MSG_RESULT($have_getaddrinfo)
3044 if test $have_getaddrinfo = yes
3046 AC_MSG_CHECKING(getaddrinfo bug)
3047 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
3048 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
3049 #include <sys/types.h>
3052 #include <sys/socket.h>
3053 #include <netinet/in.h>
3057 int passive, gaierr, inet4 = 0, inet6 = 0;
3058 struct addrinfo hints, *ai, *aitop;
3059 char straddr[INET6_ADDRSTRLEN], strport[16];
3061 for (passive = 0; passive <= 1; passive++) {
3062 memset(&hints, 0, sizeof(hints));
3063 hints.ai_family = AF_UNSPEC;
3064 hints.ai_flags = passive ? AI_PASSIVE : 0;
3065 hints.ai_socktype = SOCK_STREAM;
3066 hints.ai_protocol = IPPROTO_TCP;
3067 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
3068 (void)gai_strerror(gaierr);
3071 for (ai = aitop; ai; ai = ai->ai_next) {
3072 if (ai->ai_addr == NULL ||
3073 ai->ai_addrlen == 0 ||
3074 getnameinfo(ai->ai_addr, ai->ai_addrlen,
3075 straddr, sizeof(straddr), strport, sizeof(strport),
3076 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
3079 switch (ai->ai_family) {
3081 if (strcmp(strport, "54321") != 0) {
3085 if (strcmp(straddr, "0.0.0.0") != 0) {
3089 if (strcmp(straddr, "127.0.0.1") != 0) {
3096 if (strcmp(strport, "54321") != 0) {
3100 if (strcmp(straddr, "::") != 0) {
3104 if (strcmp(straddr, "::1") != 0) {
3114 /* another family support? */
3120 if (!(inet4 == 0 || inet4 == 2))
3122 if (!(inet6 == 0 || inet6 == 2))
3126 freeaddrinfo(aitop);
3131 freeaddrinfo(aitop);
3135 [ac_cv_buggy_getaddrinfo=no],
3136 [ac_cv_buggy_getaddrinfo=yes],
3137 [ac_cv_buggy_getaddrinfo=yes]))
3140 AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
3142 if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
3146 echo 'Fatal: You must get working getaddrinfo() function.'
3147 echo ' or you can specify "--disable-ipv6"'.
3151 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
3154 AC_CHECK_FUNCS(getnameinfo)
3156 # checks for structures
3160 AC_CHECK_MEMBERS([struct stat.st_rdev])
3161 AC_CHECK_MEMBERS([struct stat.st_blksize])
3162 AC_CHECK_MEMBERS([struct stat.st_flags])
3163 AC_CHECK_MEMBERS([struct stat.st_gen])
3164 AC_CHECK_MEMBERS([struct stat.st_birthtime])
3167 AC_MSG_CHECKING(for time.h that defines altzone)
3168 AC_CACHE_VAL(ac_cv_header_time_altzone,[
3169 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])],
3170 [ac_cv_header_time_altzone=yes],
3171 [ac_cv_header_time_altzone=no])
3173 AC_MSG_RESULT($ac_cv_header_time_altzone)
3174 if test $ac_cv_header_time_altzone = yes; then
3175 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
3179 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
3180 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3181 #include <sys/types.h>
3182 #include <sys/select.h>
3183 #include <sys/time.h>
3185 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
3186 [Define if you can safely include both <sys/select.h> and <sys/time.h>
3187 (which you can't on SCO ODT 3.0).])
3190 AC_MSG_RESULT($was_it_defined)
3192 AC_MSG_CHECKING(for addrinfo)
3193 AC_CACHE_VAL(ac_cv_struct_addrinfo,
3194 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
3195 [ac_cv_struct_addrinfo=yes],
3196 [ac_cv_struct_addrinfo=no]))
3197 AC_MSG_RESULT($ac_cv_struct_addrinfo)
3198 if test $ac_cv_struct_addrinfo = yes; then
3199 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
3202 AC_MSG_CHECKING(for sockaddr_storage)
3203 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
3204 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3205 # include <sys/types.h>
3206 # include <sys/socket.h>]], [[struct sockaddr_storage s]])],
3207 [ac_cv_struct_sockaddr_storage=yes],
3208 [ac_cv_struct_sockaddr_storage=no]))
3209 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3210 if test $ac_cv_struct_sockaddr_storage = yes; then
3211 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
3214 # checks for compiler characteristics
3220 AC_MSG_CHECKING(for working volatile)
3221 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])],
3223 [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])]
3225 AC_MSG_RESULT($works)
3228 AC_MSG_CHECKING(for working signed char)
3229 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])],
3231 [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])]
3233 AC_MSG_RESULT($works)
3236 AC_MSG_CHECKING(for prototypes)
3237 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])],
3238 [AC_DEFINE(HAVE_PROTOTYPES, 1,
3239 [Define if your compiler supports function prototype])
3240 have_prototypes=yes],
3243 AC_MSG_RESULT($have_prototypes)
3246 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
3247 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3249 int foo(int x, ...) {
3257 ]], [[return foo(10, "", 3.14);]])],[
3258 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3259 [Define if your compiler supports variable length function prototypes
3260 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3263 AC_MSG_RESULT($works)
3265 # check for socketpair
3266 AC_MSG_CHECKING(for socketpair)
3267 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3268 #include <sys/types.h>
3269 #include <sys/socket.h>
3270 ]], [[void *x=socketpair]])],
3271 [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.])
3272 AC_MSG_RESULT(yes)],
3276 # check if sockaddr has sa_len member
3277 AC_MSG_CHECKING(if sockaddr has sa_len member)
3278 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3279 #include <sys/socket.h>]], [[struct sockaddr x;
3282 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])],
3287 AC_MSG_CHECKING(whether va_list is an array)
3288 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3289 #ifdef HAVE_STDARG_PROTOTYPES
3292 #include <varargs.h>
3294 ]], [[va_list list1, list2; list1 = list2;]])],[],[
3295 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3296 va_list_is_array=yes
3298 AC_MSG_RESULT($va_list_is_array)
3300 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
3301 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3302 [Define this if you have some version of gethostbyname_r()])
3304 AC_CHECK_FUNC(gethostbyname_r, [
3305 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3306 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3308 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
3309 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3313 struct hostent *he, *res;
3318 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
3320 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3321 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3322 [Define this if you have the 6-arg version of gethostbyname_r().])
3326 AC_MSG_CHECKING([gethostbyname_r with 5 args])
3327 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3336 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3339 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3340 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3341 [Define this if you have the 5-arg version of gethostbyname_r().])
3345 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3346 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3351 struct hostent_data data;
3353 (void) gethostbyname_r(name, he, &data);
3356 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3357 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3358 [Define this if you have the 3-arg version of gethostbyname_r().])
3367 AC_CHECK_FUNCS(gethostbyname)
3369 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3370 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3371 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
3372 AC_SUBST(HAVE_GETHOSTBYNAME_R)
3373 AC_SUBST(HAVE_GETHOSTBYNAME)
3375 # checks for system services
3378 # Linux requires this for correct f.p. operations
3379 AC_CHECK_FUNC(__fpu_control,
3381 [AC_CHECK_LIB(ieee, __fpu_control)
3384 # Check for --with-fpectl
3385 AC_MSG_CHECKING(for --with-fpectl)
3387 AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]),
3389 if test "$withval" != no
3391 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3392 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3394 else AC_MSG_RESULT(no)
3396 [AC_MSG_RESULT(no)])
3398 # check for --with-libm=...
3400 case $ac_sys_system in
3405 AC_MSG_CHECKING(for --with-libm=STRING)
3407 AS_HELP_STRING([--with-libm=STRING], [math library]),
3409 if test "$withval" = no
3411 AC_MSG_RESULT(force LIBM empty)
3412 elif test "$withval" != yes
3414 AC_MSG_RESULT(set LIBM="$withval")
3415 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
3417 [AC_MSG_RESULT(default LIBM="$LIBM")])
3419 # check for --with-libc=...
3421 AC_MSG_CHECKING(for --with-libc=STRING)
3423 AS_HELP_STRING([--with-libc=STRING], [C library]),
3425 if test "$withval" = no
3427 AC_MSG_RESULT(force LIBC empty)
3428 elif test "$withval" != yes
3430 AC_MSG_RESULT(set LIBC="$withval")
3431 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
3433 [AC_MSG_RESULT(default LIBC="$LIBC")])
3435 # **************************************************
3436 # * Check for various properties of floating point *
3437 # **************************************************
3439 AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3440 AC_CACHE_VAL(ac_cv_little_endian_double, [
3441 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3444 double x = 9006104071832581.0;
3445 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3451 [ac_cv_little_endian_double=yes],
3452 [ac_cv_little_endian_double=no],
3453 [ac_cv_little_endian_double=no])])
3454 AC_MSG_RESULT($ac_cv_little_endian_double)
3455 if test "$ac_cv_little_endian_double" = yes
3457 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3458 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3459 with the least significant byte first])
3462 AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3463 AC_CACHE_VAL(ac_cv_big_endian_double, [
3464 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3467 double x = 9006104071832581.0;
3468 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3474 [ac_cv_big_endian_double=yes],
3475 [ac_cv_big_endian_double=no],
3476 [ac_cv_big_endian_double=no])])
3477 AC_MSG_RESULT($ac_cv_big_endian_double)
3478 if test "$ac_cv_big_endian_double" = yes
3480 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3481 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3482 with the most significant byte first])
3485 # Some ARM platforms use a mixed-endian representation for doubles.
3486 # While Python doesn't currently have full support for these platforms
3487 # (see e.g., issue 1762561), we can at least make sure that float <-> string
3489 AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3490 AC_CACHE_VAL(ac_cv_mixed_endian_double, [
3491 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3494 double x = 9006104071832581.0;
3495 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3501 [ac_cv_mixed_endian_double=yes],
3502 [ac_cv_mixed_endian_double=no],
3503 [ac_cv_mixed_endian_double=no])])
3504 AC_MSG_RESULT($ac_cv_mixed_endian_double)
3505 if test "$ac_cv_mixed_endian_double" = yes
3507 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3508 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3509 in ARM mixed-endian order (byte order 45670123)])
3512 # The short float repr introduced in Python 3.1 requires the
3513 # correctly-rounded string <-> double conversion functions from
3514 # Python/dtoa.c, which in turn require that the FPU uses 53-bit
3515 # rounding; this is a problem on x86, where the x87 FPU has a default
3516 # rounding precision of 64 bits. For gcc/x86, we can fix this by
3517 # using inline assembler to get and set the x87 FPU control word.
3519 # This inline assembler syntax may also work for suncc and icc,
3520 # so we try it on all platforms.
3522 AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
3523 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
3525 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3526 __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
3527 ]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no])
3528 AC_MSG_RESULT($have_gcc_asm_for_x87)
3529 if test "$have_gcc_asm_for_x87" = yes
3531 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3532 [Define if we can use gcc inline assembler to get and set x87 control word])
3535 # Detect whether system arithmetic is subject to x87-style double
3536 # rounding issues. The result of this test has little meaning on non
3537 # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3538 # mode is round-to-nearest and double rounding issues are present, and
3539 # 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3540 AC_MSG_CHECKING(for x87-style double rounding)
3541 # $BASECFLAGS may affect the result
3543 CC="$CC $BASECFLAGS"
3544 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3548 volatile double x, y, z;
3549 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3550 x = 0.99999999999999989; /* 1-2**-53 */
3554 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3560 /* both tests show evidence of double rounding */
3564 [ac_cv_x87_double_rounding=no],
3565 [ac_cv_x87_double_rounding=yes],
3566 [ac_cv_x87_double_rounding=no])
3568 AC_MSG_RESULT($ac_cv_x87_double_rounding)
3569 if test "$ac_cv_x87_double_rounding" = yes
3571 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3572 [Define if arithmetic is subject to x87-style double rounding issue])
3575 # ************************************
3576 # * Check for mathematical functions *
3577 # ************************************
3582 # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3583 # -0. on some architectures.
3584 AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3585 AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
3586 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3590 /* return 0 if either negative zeros don't exist
3591 on this platform or if negative zeros exist
3592 and tanh(-0.) == -0. */
3593 if (atan2(0., -1.) == atan2(-0., -1.) ||
3594 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3598 [ac_cv_tanh_preserves_zero_sign=yes],
3599 [ac_cv_tanh_preserves_zero_sign=no],
3600 [ac_cv_tanh_preserves_zero_sign=no])])
3601 AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3602 if test "$ac_cv_tanh_preserves_zero_sign" = yes
3604 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3605 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3608 AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
3609 AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
3610 AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3614 # For multiprocessing module, check that sem_open
3615 # actually works. For FreeBSD versions <= 7.2,
3616 # the kernel module that provides POSIX semaphores
3617 # isn't loaded by default, so an attempt to call
3618 # sem_open results in a 'Signal 12' error.
3619 AC_MSG_CHECKING(whether POSIX semaphores are enabled)
3620 AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
3621 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3625 #include <semaphore.h>
3626 #include <sys/stat.h>
3629 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3630 if (a == SEM_FAILED) {
3635 sem_unlink("/autoconf");
3639 [ac_cv_posix_semaphores_enabled=yes],
3640 [ac_cv_posix_semaphores_enabled=no],
3641 [ac_cv_posix_semaphores_enabled=yes])
3643 AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
3644 if test $ac_cv_posix_semaphores_enabled = no
3646 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
3647 [Define if POSIX semaphores aren't enabled on your system])
3650 # Multiprocessing check for broken sem_getvalue
3651 AC_MSG_CHECKING(for broken sem_getvalue)
3652 AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
3653 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3657 #include <semaphore.h>
3658 #include <sys/stat.h>
3661 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
3669 res = sem_getvalue(a, &count);
3671 sem_unlink("/autocftw");
3672 return res==-1 ? 1 : 0;
3675 [ac_cv_broken_sem_getvalue=no],
3676 [ac_cv_broken_sem_getvalue=yes],
3677 [ac_cv_broken_sem_getvalue=yes])
3679 AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
3680 if test $ac_cv_broken_sem_getvalue = yes
3682 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
3683 [define to 1 if your sem_getvalue is broken.])
3686 # determine what size digit to use for Python's longs
3687 AC_MSG_CHECKING([digit size for Python's longs])
3688 AC_ARG_ENABLE(big-digits,
3689 AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
3690 [case $enable_big_digits in
3692 enable_big_digits=30 ;;
3694 enable_big_digits=15 ;;
3698 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3700 AC_MSG_RESULT($enable_big_digits)
3701 AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3703 [AC_MSG_RESULT(no value specified)])
3706 AC_CHECK_HEADER(wchar.h, [
3707 AC_DEFINE(HAVE_WCHAR_H, 1,
3708 [Define if the compiler provides a wchar.h header file.])
3714 # determine wchar_t size
3715 if test "$wchar_h" = yes
3717 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
3720 AC_MSG_CHECKING(for UCS-4 tcl)
3722 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3724 #if TCL_UTF_MAX != 6
3725 # error "NOT UCS4_TCL"
3727 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3730 AC_MSG_RESULT($have_ucs4_tcl)
3732 # check whether wchar_t is signed or not
3733 if test "$wchar_h" = yes
3735 # check whether wchar_t is signed or not
3736 AC_MSG_CHECKING(whether wchar_t is signed)
3737 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
3738 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3742 /* Success: exit code 0 */
3743 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
3746 [ac_cv_wchar_t_signed=yes],
3747 [ac_cv_wchar_t_signed=no],
3748 [ac_cv_wchar_t_signed=yes])])
3749 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3752 AC_MSG_CHECKING(what type to use for unicode)
3753 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
3754 AC_ARG_ENABLE(unicode,
3755 AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is ucs2)]),
3757 [enable_unicode=yes])
3759 if test $enable_unicode = yes
3761 # Without any arguments, Py_UNICODE defaults to two-byte mode
3762 case "$have_ucs4_tcl" in
3763 yes) enable_unicode="ucs4"
3765 *) enable_unicode="ucs2"
3770 AH_TEMPLATE(Py_UNICODE_SIZE,
3771 [Define as the size of the unicode type.])
3772 case "$enable_unicode" in
3773 ucs2) unicode_size="2"
3774 AC_DEFINE(Py_UNICODE_SIZE,2)
3776 ucs4) unicode_size="4"
3777 AC_DEFINE(Py_UNICODE_SIZE,4)
3779 *) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
3782 AH_TEMPLATE(PY_UNICODE_TYPE,
3783 [Define as the integral type used for Unicode representation.])
3785 AC_SUBST(UNICODE_OBJS)
3786 if test "$enable_unicode" = "no"
3789 AC_MSG_RESULT(not used)
3791 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
3792 AC_DEFINE(Py_USING_UNICODE, 1,
3793 [Define if you want to have a Unicode type.])
3795 # wchar_t is only usable if it maps to an unsigned type
3796 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
3797 -a "$ac_cv_wchar_t_signed" = "no"
3799 PY_UNICODE_TYPE="wchar_t"
3800 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3801 [Define if you have a useable wchar_t type defined in wchar.h; useable
3802 means wchar_t must be an unsigned type with at least 16 bits. (see
3803 Include/unicodeobject.h).])
3804 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3805 elif test "$ac_cv_sizeof_short" = "$unicode_size"
3807 PY_UNICODE_TYPE="unsigned short"
3808 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3809 elif test "$ac_cv_sizeof_long" = "$unicode_size"
3811 PY_UNICODE_TYPE="unsigned long"
3812 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3814 PY_UNICODE_TYPE="no type found"
3816 AC_MSG_RESULT($PY_UNICODE_TYPE)
3819 # check for endianness
3822 # Check whether right shifting a negative integer extends the sign bit
3823 # or fills with zeros (like the Cray J90, according to Tim Peters).
3824 AC_MSG_CHECKING(whether right shift extends the sign bit)
3825 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
3826 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3829 exit(((-1)>>3 == -1) ? 0 : 1);
3832 [ac_cv_rshift_extends_sign=yes],
3833 [ac_cv_rshift_extends_sign=no],
3834 [ac_cv_rshift_extends_sign=yes])])
3835 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
3836 if test "$ac_cv_rshift_extends_sign" = no
3838 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
3839 [Define if i>>j for signed int i does not extend the sign bit
3843 # check for getc_unlocked and related locking functions
3844 AC_MSG_CHECKING(for getc_unlocked() and friends)
3845 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
3846 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
3847 FILE *f = fopen("/dev/null", "r");
3851 ]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])])
3852 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
3853 if test "$ac_cv_have_getc_unlocked" = yes
3855 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
3856 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
3859 # check where readline lives
3860 # save the value of LIBS so we don't actually link Python with readline
3861 LIBS_no_readline=$LIBS
3863 # On some systems we need to link readline to a termcap compatible
3864 # library. NOTE: Keep the precedence of listed libraries synchronised
3866 py_cv_lib_readline=no
3867 AC_MSG_CHECKING([how to link readline libs])
3868 for py_libtermcap in "" ncursesw ncurses curses termcap; do
3869 if test -z "$py_libtermcap"; then
3870 READLINE_LIBS="-lreadline"
3872 READLINE_LIBS="-lreadline -l$py_libtermcap"
3874 LIBS="$READLINE_LIBS $LIBS_no_readline"
3876 [AC_LANG_CALL([],[readline])],
3877 [py_cv_lib_readline=yes])
3878 if test $py_cv_lib_readline = yes; then
3882 # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3883 #AC_SUBST([READLINE_LIBS])
3884 if test $py_cv_lib_readline = no; then
3885 AC_MSG_RESULT([none])
3887 AC_MSG_RESULT([$READLINE_LIBS])
3888 AC_DEFINE(HAVE_LIBREADLINE, 1,
3889 [Define if you have the readline library (-lreadline).])
3892 # check for readline 2.1
3893 AC_CHECK_LIB(readline, rl_callback_handler_install,
3894 AC_DEFINE(HAVE_RL_CALLBACK, 1,
3895 [Define if you have readline 2.1]), ,$READLINE_LIBS)
3897 # check for readline 2.2
3898 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
3899 [have_readline=yes],
3902 if test $have_readline = yes
3904 AC_EGREP_HEADER([extern int rl_completion_append_character;],
3905 [readline/readline.h],
3906 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
3907 [Define if you have readline 2.2]), )
3908 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
3909 [readline/readline.h],
3910 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
3911 [Define if you have rl_completion_suppress_append]), )
3914 # check for readline 4.0
3915 AC_CHECK_LIB(readline, rl_pre_input_hook,
3916 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
3917 [Define if you have readline 4.0]), ,$READLINE_LIBS)
3920 AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
3921 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
3922 [Define if you have readline 4.0]), ,$READLINE_LIBS)
3924 # check for readline 4.2
3925 AC_CHECK_LIB(readline, rl_completion_matches,
3926 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
3927 [Define if you have readline 4.2]), ,$READLINE_LIBS)
3929 # also in readline 4.2
3930 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
3931 [have_readline=yes],
3934 if test $have_readline = yes
3936 AC_EGREP_HEADER([extern int rl_catch_signals;],
3937 [readline/readline.h],
3938 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3939 [Define if you can turn off readline's signal handling.]), )
3942 # End of readline checks: restore LIBS
3943 LIBS=$LIBS_no_readline
3945 AC_MSG_CHECKING(for broken nice())
3946 AC_CACHE_VAL(ac_cv_broken_nice, [
3947 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3951 if (val1 != -1 && val1 == nice(2))
3956 [ac_cv_broken_nice=yes],
3957 [ac_cv_broken_nice=no],
3958 [ac_cv_broken_nice=no])])
3959 AC_MSG_RESULT($ac_cv_broken_nice)
3960 if test "$ac_cv_broken_nice" = yes
3962 AC_DEFINE(HAVE_BROKEN_NICE, 1,
3963 [Define if nice() returns success/failure instead of the new priority.])
3966 AC_MSG_CHECKING(for broken poll())
3967 AC_CACHE_VAL(ac_cv_broken_poll,
3968 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3973 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
3978 poll_test = poll(&poll_struct, 1, 0);
3981 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
3987 [ac_cv_broken_poll=yes],
3988 [ac_cv_broken_poll=no],
3989 [ac_cv_broken_poll=no]))
3990 AC_MSG_RESULT($ac_cv_broken_poll)
3991 if test "$ac_cv_broken_poll" = yes
3993 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3994 [Define if poll() sets errno on invalid file descriptors.])
3997 # Before we can test tzset, we need to check if struct tm has a tm_zone
3998 # (which is not required by ISO C or UNIX spec) and/or if we support
4002 # check tzset(3) exists and works like we expect it to
4003 AC_MSG_CHECKING(for working tzset())
4004 AC_CACHE_VAL(ac_cv_working_tzset, [
4005 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4011 extern char *tzname[];
4016 /* Note that we need to ensure that not only does tzset(3)
4017 do 'something' with localtime, but it works as documented
4018 in the library reference and as expected by the test suite.
4019 This includes making sure that tzname is set properly if
4020 tm->tm_zone does not exist since it is the alternative way
4021 of getting timezone info.
4023 Red Hat 6.2 doesn't understand the southern hemisphere
4024 after New Year's Day.
4027 time_t groundhogday = 1044144000; /* GMT-based */
4028 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
4032 if (localtime(&groundhogday)->tm_hour != 0)
4035 /* For UTC, tzname[1] is sometimes "", sometimes " " */
4036 if (strcmp(tzname[0], "UTC") ||
4037 (tzname[1][0] != 0 && tzname[1][0] != ' '))
4041 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
4043 if (localtime(&groundhogday)->tm_hour != 19)
4046 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
4050 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
4052 if (localtime(&groundhogday)->tm_hour != 11)
4055 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
4059 #if HAVE_STRUCT_TM_TM_ZONE
4060 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
4062 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
4069 [ac_cv_working_tzset=yes],
4070 [ac_cv_working_tzset=no],
4071 [ac_cv_working_tzset=no])])
4072 AC_MSG_RESULT($ac_cv_working_tzset)
4073 if test "$ac_cv_working_tzset" = yes
4075 AC_DEFINE(HAVE_WORKING_TZSET, 1,
4076 [Define if tzset() actually switches the local timezone in a meaningful way.])
4079 # Look for subsecond timestamps in struct stat
4080 AC_MSG_CHECKING(for tv_nsec in struct stat)
4081 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
4082 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
4084 st.st_mtim.tv_nsec = 1;
4086 [ac_cv_stat_tv_nsec=yes],
4087 [ac_cv_stat_tv_nsec=no]))
4088 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
4089 if test "$ac_cv_stat_tv_nsec" = yes
4091 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
4092 [Define if you have struct stat.st_mtim.tv_nsec])
4095 # Look for BSD style subsecond timestamps in struct stat
4096 AC_MSG_CHECKING(for tv_nsec2 in struct stat)
4097 AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
4098 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
4100 st.st_mtimespec.tv_nsec = 1;
4102 [ac_cv_stat_tv_nsec2=yes],
4103 [ac_cv_stat_tv_nsec2=no]))
4104 AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
4105 if test "$ac_cv_stat_tv_nsec2" = yes
4107 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
4108 [Define if you have struct stat.st_mtimensec])
4111 # On HP/UX 11.0, mvwdelch is a block with a return statement
4112 AC_MSG_CHECKING(whether mvwdelch is an expression)
4113 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
4114 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4116 rtn = mvwdelch(0,0,0);
4118 [ac_cv_mvwdelch_is_expression=yes],
4119 [ac_cv_mvwdelch_is_expression=no]))
4120 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
4122 if test "$ac_cv_mvwdelch_is_expression" = yes
4124 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
4125 [Define if mvwdelch in curses.h is an expression.])
4128 AC_MSG_CHECKING(whether WINDOW has _flags)
4129 AC_CACHE_VAL(ac_cv_window_has_flags,
4130 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4134 [ac_cv_window_has_flags=yes],
4135 [ac_cv_window_has_flags=no]))
4136 AC_MSG_RESULT($ac_cv_window_has_flags)
4139 if test "$ac_cv_window_has_flags" = yes
4141 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
4142 [Define if WINDOW in curses.h offers a field _flags.])
4145 AC_MSG_CHECKING(for is_term_resized)
4146 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])],
4147 [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
4148 AC_MSG_RESULT(yes)],
4152 AC_MSG_CHECKING(for resize_term)
4153 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])],
4154 [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
4155 AC_MSG_RESULT(yes)],
4159 AC_MSG_CHECKING(for resizeterm)
4160 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])],
4161 [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
4162 AC_MSG_RESULT(yes)],
4166 AC_MSG_CHECKING(for /dev/ptmx)
4168 if test -r /dev/ptmx
4171 AC_DEFINE(HAVE_DEV_PTMX, 1,
4172 [Define if we have /dev/ptmx.])
4177 AC_MSG_CHECKING(for /dev/ptc)
4182 AC_DEFINE(HAVE_DEV_PTC, 1,
4183 [Define if we have /dev/ptc.])
4188 if test "$have_long_long" = yes
4190 AC_MSG_CHECKING(for %lld and %llu printf() format support)
4191 AC_CACHE_VAL(ac_cv_have_long_long_format,
4192 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
4197 #ifdef HAVE_SYS_TYPES_H
4198 #include <sys/types.h>
4205 if (sprintf(buffer, "%lld", (long long)123) < 0)
4207 if (strcmp(buffer, "123"))
4210 if (sprintf(buffer, "%lld", (long long)-123) < 0)
4212 if (strcmp(buffer, "-123"))
4215 if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
4217 if (strcmp(buffer, "123"))
4223 [ac_cv_have_long_long_format=yes],
4224 [ac_cv_have_long_long_format=no],
4225 [ac_cv_have_long_long_format=no])
4227 AC_MSG_RESULT($ac_cv_have_long_long_format)
4230 if test "$ac_cv_have_long_long_format" = yes
4232 AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
4233 [Define to printf format modifier for long long type])
4236 if test $ac_sys_system = Darwin
4238 LIBS="$LIBS -framework CoreFoundation"
4242 AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
4243 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4248 #ifdef HAVE_SYS_TYPES_H
4249 #include <sys/types.h>
4253 typedef ssize_t Py_ssize_t;
4254 #elif SIZEOF_VOID_P == SIZEOF_LONG
4255 typedef long Py_ssize_t;
4257 typedef int Py_ssize_t;
4264 if(sprintf(buffer, "%zd", (size_t)123) < 0)
4267 if (strcmp(buffer, "123"))
4270 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
4273 if (strcmp(buffer, "-123"))
4279 [ac_cv_have_size_t_format=yes],
4280 [ac_cv_have_size_t_format=no],
4281 [ac_cv_have_size_t_format="cross -- assuming yes"
4283 if test "$ac_cv_have_size_t_format" != no ; then
4284 AC_DEFINE(PY_FORMAT_SIZE_T, "z",
4285 [Define to printf format modifier for Py_ssize_t])
4288 AC_CHECK_TYPE(socklen_t,,
4289 AC_DEFINE(socklen_t,int,
4290 [Define to `int' if <sys/socket.h> does not define.]),[
4291 #ifdef HAVE_SYS_TYPES_H
4292 #include <sys/types.h>
4294 #ifdef HAVE_SYS_SOCKET_H
4295 #include <sys/socket.h>
4299 case $ac_sys_system in
4301 AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;;
4305 AC_SUBST(THREADHEADERS)
4307 for h in `(cd $srcdir;echo Python/thread_*.h)`
4309 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4313 SRCDIRS="Parser Grammar Objects Python Modules Mac"
4314 AC_MSG_CHECKING(for build directories)
4315 for dir in $SRCDIRS; do
4316 if test ! -d $dir; then
4322 # generate output files
4323 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
4324 AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
4327 echo "creating Modules/Setup"
4328 if test ! -f Modules/Setup
4330 cp $srcdir/Modules/Setup.dist Modules/Setup
4333 echo "creating Modules/Setup.local"
4334 if test ! -f Modules/Setup.local
4336 echo "# Edit this file for local setup changes" >Modules/Setup.local
4339 echo "creating Makefile"
4340 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4341 -s Modules Modules/Setup.config \
4342 Modules/Setup.local Modules/Setup
4344 case $ac_sys_system in
4348 Support for BeOS is deprecated as of Python 2.6.
4349 See PEP 11 for the gory details.