5 kx dnl ***********************************************
5 kx dnl * Please run autoreconf to test your changes! *
5 kx dnl ***********************************************
5 kx
5 kx # Set VERSION so we only need to edit in one place (i.e., here)
5 kx m4_define(PYTHON_VERSION, 2.7)
5 kx
5 kx AC_PREREQ(2.65)
5 kx
5 kx AC_REVISION($Revision$)
5 kx AC_INIT(python, PYTHON_VERSION, https://bugs.python.org/)
5 kx AC_CONFIG_SRCDIR([Include/object.h])
5 kx AC_CONFIG_HEADER(pyconfig.h)
5 kx
5 kx AC_CANONICAL_HOST
5 kx AC_SUBST(build)
5 kx AC_SUBST(host)
5 kx
5 kx # pybuilddir.txt will be created by --generate-posix-vars in the Makefile
5 kx rm -f pybuilddir.txt
5 kx
5 kx AC_CHECK_PROGS(PYTHON_FOR_REGEN, python$PACKAGE_VERSION python3 python, python3)
5 kx AC_SUBST(PYTHON_FOR_REGEN)
5 kx
5 kx if test "$cross_compiling" = yes; then
5 kx AC_MSG_CHECKING([for python interpreter for cross build])
5 kx PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) $(PYTHON2)'
5 kx elif test "$cross_compiling" = maybe; then
5 kx AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
5 kx else
5 kx PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
5 kx fi
5 kx AC_SUBST(PYTHON_FOR_BUILD)
5 kx
5 kx dnl Ensure that if prefix is specified, it does not end in a slash. If
5 kx dnl it does, we get path names containing '//' which is both ugly and
5 kx dnl can cause trouble.
5 kx
5 kx dnl Last slash shouldn't be stripped if prefix=/
5 kx if test "$prefix" != "/"; then
5 kx prefix=`echo "$prefix" | sed -e 's/\/$//g'`
5 kx fi
5 kx
5 kx dnl This is for stuff that absolutely must end up in pyconfig.h.
5 kx dnl Please use pyport.h instead, if possible.
5 kx AH_TOP([
5 kx #ifndef Py_PYCONFIG_H
5 kx #define Py_PYCONFIG_H
5 kx ])
5 kx AH_BOTTOM([
5 kx /* Define the macros needed if on a UnixWare 7.x system. */
5 kx #if defined(__USLC__) && defined(__SCO_VERSION__)
5 kx #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
5 kx #endif
5 kx
5 kx #endif /*Py_PYCONFIG_H*/
5 kx ])
5 kx
5 kx # We don't use PACKAGE_ variables, and they cause conflicts
5 kx # with other autoconf-based packages that include Python.h
5 kx grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
5 kx rm confdefs.h
5 kx mv confdefs.h.new confdefs.h
5 kx
5 kx AC_SUBST(VERSION)
5 kx VERSION=PYTHON_VERSION
5 kx
5 kx AC_SUBST(SOVERSION)
5 kx SOVERSION=1.0
5 kx
5 kx # The later defininition of _XOPEN_SOURCE disables certain features
5 kx # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
5 kx AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
5 kx
5 kx # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
5 kx # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
5 kx # them.
5 kx AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
5 kx
5 kx # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
5 kx # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
5 kx # them.
5 kx AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
5 kx
5 kx # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
5 kx # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
5 kx AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
5 kx
5 kx # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
5 kx # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
5 kx # them.
5 kx AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
5 kx
5 kx
5 kx define_xopen_source=yes
5 kx
5 kx # Arguments passed to configure.
5 kx AC_SUBST(CONFIG_ARGS)
5 kx CONFIG_ARGS="$ac_configure_args"
5 kx
5 kx AC_MSG_CHECKING([for --enable-universalsdk])
5 kx AC_ARG_ENABLE(universalsdk,
5 kx AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build fat binary against Mac OS X SDK]),
5 kx [
5 kx case $enableval in
5 kx yes)
5 kx # Locate the best usable SDK, see Mac/README for more
5 kx # information
5 kx enableval="`/usr/bin/xcodebuild -version -sdk macosx Path 2>/dev/null`"
5 kx if ! ( echo $enableval | grep -E '\.sdk' 1>/dev/null )
5 kx then
5 kx enableval=/Developer/SDKs/MacOSX10.4u.sdk
5 kx if test ! -d "${enableval}"
5 kx then
5 kx enableval=/
5 kx fi
5 kx fi
5 kx ;;
5 kx esac
5 kx case $enableval in
5 kx no)
5 kx UNIVERSALSDK=
5 kx enable_universalsdk=
5 kx ;;
5 kx *)
5 kx UNIVERSALSDK=$enableval
5 kx if test ! -d "${UNIVERSALSDK}"
5 kx then
5 kx AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
5 kx fi
5 kx ;;
5 kx esac
5 kx
5 kx ],[
5 kx UNIVERSALSDK=
5 kx enable_universalsdk=
5 kx ])
5 kx if test -n "${UNIVERSALSDK}"
5 kx then
5 kx AC_MSG_RESULT(${UNIVERSALSDK})
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi
5 kx AC_SUBST(UNIVERSALSDK)
5 kx
5 kx AC_SUBST(ARCH_RUN_32BIT)
5 kx ARCH_RUN_32BIT=""
5 kx
5 kx # For backward compatibility reasons we prefer to select '32-bit' if available,
5 kx # otherwise use 'intel'
5 kx UNIVERSAL_ARCHS="32-bit"
5 kx if test "`uname -s`" = "Darwin"
5 kx then
5 kx if test -n "${UNIVERSALSDK}"
5 kx then
5 kx if test -z "`/usr/bin/file -L "${UNIVERSALSDK}/usr/lib/libSystem.dylib" | grep ppc`"
5 kx then
5 kx UNIVERSAL_ARCHS="intel"
5 kx fi
5 kx fi
5 kx fi
5 kx
5 kx AC_SUBST(LIPO_32BIT_FLAGS)
5 kx AC_MSG_CHECKING(for --with-universal-archs)
5 kx AC_ARG_WITH(universal-archs,
5 kx AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel", "intel-32", "intel-64", or "all")]),
5 kx [
5 kx UNIVERSAL_ARCHS="$withval"
5 kx ],
5 kx [])
5 kx if test -n "${UNIVERSALSDK}"
5 kx then
5 kx AC_MSG_RESULT(${UNIVERSAL_ARCHS})
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi
5 kx
5 kx AC_ARG_WITH(framework-name,
5 kx AS_HELP_STRING([--with-framework-name=FRAMEWORK],
5 kx [specify an alternate name of the framework built with --enable-framework]),
5 kx [
5 kx if test "${enable_framework}"; then
5 kx :
5 kx else
5 kx AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
5 kx fi
5 kx PYTHONFRAMEWORK=${withval}
5 kx PYTHONFRAMEWORKDIR=${withval}.framework
5 kx PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
5 kx ],[
5 kx PYTHONFRAMEWORK=Python
5 kx PYTHONFRAMEWORKDIR=Python.framework
5 kx PYTHONFRAMEWORKIDENTIFIER=org.python.python
5 kx ])
5 kx dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
5 kx AC_ARG_ENABLE(framework,
5 kx AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@], [Build (MacOSX|Darwin) framework]),
5 kx [
5 kx case $enableval in
5 kx yes)
5 kx enableval=/Library/Frameworks
5 kx esac
5 kx case $enableval in
5 kx no)
5 kx PYTHONFRAMEWORK=
5 kx PYTHONFRAMEWORKDIR=no-framework
5 kx PYTHONFRAMEWORKPREFIX=
5 kx PYTHONFRAMEWORKINSTALLDIR=
5 kx FRAMEWORKINSTALLFIRST=
5 kx FRAMEWORKINSTALLLAST=
5 kx FRAMEWORKALTINSTALLFIRST=
5 kx FRAMEWORKALTINSTALLLAST=
5 kx if test "x${prefix}" = "xNONE"; then
5 kx FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
5 kx else
5 kx FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
5 kx fi
5 kx enable_framework=
5 kx ;;
5 kx *)
5 kx PYTHONFRAMEWORKPREFIX="${enableval}"
5 kx PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
5 kx FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
5 kx FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
5 kx FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
5 kx FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
5 kx FRAMEWORKINSTALLAPPSPREFIX="/Applications"
5 kx
5 kx if test "x${prefix}" = "xNONE" ; then
5 kx FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
5 kx
5 kx else
5 kx FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
5 kx fi
5 kx
5 kx case "${enableval}" in
5 kx /System*)
5 kx FRAMEWORKINSTALLAPPSPREFIX="/Applications"
5 kx if test "${prefix}" = "NONE" ; then
5 kx # See below
5 kx FRAMEWORKUNIXTOOLSPREFIX="/usr"
5 kx fi
5 kx ;;
5 kx
5 kx /Library*)
5 kx FRAMEWORKINSTALLAPPSPREFIX="/Applications"
5 kx ;;
5 kx
5 kx */Library/Frameworks)
5 kx MDIR="`dirname "${enableval}"`"
5 kx MDIR="`dirname "${MDIR}"`"
5 kx FRAMEWORKINSTALLAPPSPREFIX="${MDIR}/Applications"
5 kx
5 kx if test "${prefix}" = "NONE"; then
5 kx # User hasn't specified the
5 kx # --prefix option, but wants to install
5 kx # the framework in a non-default location,
5 kx # ensure that the compatibility links get
5 kx # installed relative to that prefix as well
5 kx # instead of in /usr/local.
5 kx FRAMEWORKUNIXTOOLSPREFIX="${MDIR}"
5 kx fi
5 kx ;;
5 kx
5 kx *)
5 kx FRAMEWORKINSTALLAPPSPREFIX="/Applications"
5 kx ;;
5 kx esac
5 kx
5 kx prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
5 kx
5 kx # Add files for Mac specific code to the list of output
5 kx # files:
5 kx AC_CONFIG_FILES(Mac/Makefile)
5 kx AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
5 kx AC_CONFIG_FILES(Mac/IDLE/Makefile)
5 kx AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
5 kx AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
5 kx esac
5 kx ],[
5 kx PYTHONFRAMEWORK=
5 kx PYTHONFRAMEWORKDIR=no-framework
5 kx PYTHONFRAMEWORKPREFIX=
5 kx PYTHONFRAMEWORKINSTALLDIR=
5 kx FRAMEWORKINSTALLFIRST=
5 kx FRAMEWORKINSTALLLAST=
5 kx FRAMEWORKALTINSTALLFIRST=
5 kx FRAMEWORKALTINSTALLLAST=
5 kx if test "x${prefix}" = "xNONE" ; then
5 kx FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
5 kx else
5 kx FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
5 kx fi
5 kx enable_framework=
5 kx
5 kx ])
5 kx AC_SUBST(PYTHONFRAMEWORK)
5 kx AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
5 kx AC_SUBST(PYTHONFRAMEWORKDIR)
5 kx AC_SUBST(PYTHONFRAMEWORKPREFIX)
5 kx AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
5 kx AC_SUBST(FRAMEWORKINSTALLFIRST)
5 kx AC_SUBST(FRAMEWORKINSTALLLAST)
5 kx AC_SUBST(FRAMEWORKALTINSTALLFIRST)
5 kx AC_SUBST(FRAMEWORKALTINSTALLLAST)
5 kx AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
5 kx AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
5 kx
5 kx ##AC_ARG_WITH(dyld,
5 kx ## AS_HELP_STRING([--with-dyld],
5 kx ## [Use (OpenStep|Rhapsody) dynamic linker]))
5 kx ##
5 kx # Set name for machine-dependent library files
5 kx AC_SUBST(MACHDEP)
5 kx AC_MSG_CHECKING(MACHDEP)
5 kx if test -z "$MACHDEP"
5 kx then
5 kx # avoid using uname for cross builds
5 kx if test "$cross_compiling" = yes; then
5 kx # ac_sys_system and ac_sys_release are only used for setting
5 kx # `define_xopen_source' in the case statement below. For the
5 kx # current supported cross builds, this macro is not adjusted.
5 kx case "$host" in
5 kx *-*-linux*)
5 kx ac_sys_system=Linux
5 kx ;;
5 kx *-*-cygwin*)
5 kx ac_sys_system=Cygwin
5 kx ;;
5 kx *)
5 kx # for now, limit cross builds to known configurations
5 kx MACHDEP="unknown"
5 kx AC_MSG_ERROR([cross build not supported for $host])
5 kx esac
5 kx ac_sys_release=
5 kx else
5 kx ac_sys_system=`uname -s`
5 kx if test "$ac_sys_system" = "AIX" \
5 kx -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
5 kx ac_sys_release=`uname -v`
5 kx else
5 kx ac_sys_release=`uname -r`
5 kx fi
5 kx fi
5 kx ac_md_system=`echo $ac_sys_system |
5 kx tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
5 kx ac_md_release=`echo $ac_sys_release |
5 kx tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
5 kx MACHDEP="$ac_md_system$ac_md_release"
5 kx
5 kx case $MACHDEP in
5 kx linux*) MACHDEP="linux2";;
5 kx cygwin*) MACHDEP="cygwin";;
5 kx darwin*) MACHDEP="darwin";;
5 kx atheos*) MACHDEP="atheos";;
5 kx irix646) MACHDEP="irix6";;
5 kx '') MACHDEP="unknown";;
5 kx esac
5 kx fi
5 kx
5 kx AC_SUBST(_PYTHON_HOST_PLATFORM)
5 kx if test "$cross_compiling" = yes; then
5 kx case "$host" in
5 kx *-*-linux*)
5 kx case "$host_cpu" in
5 kx arm*)
5 kx _host_cpu=arm
5 kx ;;
5 kx *)
5 kx _host_cpu=$host_cpu
5 kx esac
5 kx ;;
5 kx *-*-cygwin*)
5 kx _host_cpu=
5 kx ;;
5 kx *)
5 kx # for now, limit cross builds to known configurations
5 kx MACHDEP="unknown"
5 kx AC_MSG_ERROR([cross build not supported for $host])
5 kx esac
5 kx _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
5 kx fi
5 kx
5 kx # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
5 kx # disable features if it is defined, without any means to access these
5 kx # features as extensions. For these systems, we skip the definition of
5 kx # _XOPEN_SOURCE. Before adding a system to the list to gain access to
5 kx # some feature, make sure there is no alternative way to access this
5 kx # feature. Also, when using wildcards, make sure you have verified the
5 kx # need for not defining _XOPEN_SOURCE on all systems matching the
5 kx # wildcard, and that the wildcard does not include future systems
5 kx # (which may remove their limitations).
5 kx dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
5 kx case $ac_sys_system/$ac_sys_release in
5 kx # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
5 kx # even though select is a POSIX function. Reported by J. Ribbens.
5 kx # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
5 kx # In addition, Stefan Krah confirms that issue #1244610 exists through
5 kx # OpenBSD 4.6, but is fixed in 4.7.
5 kx OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@)
5 kx define_xopen_source=no
5 kx # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
5 kx # also defined. This can be overridden by defining _BSD_SOURCE
5 kx # As this has a different meaning on Linux, only define it on OpenBSD
5 kx AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
5 kx ;;
5 kx OpenBSD/*)
5 kx # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
5 kx # also defined. This can be overridden by defining _BSD_SOURCE
5 kx # As this has a different meaning on Linux, only define it on OpenBSD
5 kx AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
5 kx ;;
5 kx # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
5 kx # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
5 kx # Marc Recht
5 kx NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
5 kx define_xopen_source=no;;
5 kx # From the perspective of Solaris, _XOPEN_SOURCE is not so much a
5 kx # request to enable features supported by the standard as a request
5 kx # to disable features not supported by the standard. The best way
5 kx # for Python to use Solaris is simply to leave _XOPEN_SOURCE out
5 kx # entirely and define __EXTENSIONS__ instead.
5 kx SunOS/*)
5 kx define_xopen_source=no;;
5 kx # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
5 kx # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
5 kx # Reconfirmed for 7.1.4 by Martin v. Loewis.
5 kx OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
5 kx define_xopen_source=no;;
5 kx # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
5 kx # but used in struct sockaddr.sa_family. Reported by Tim Rice.
5 kx SCO_SV/3.2)
5 kx define_xopen_source=no;;
5 kx # On FreeBSD 4, the math functions C89 does not cover are never defined
5 kx # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
5 kx FreeBSD/4.*)
5 kx define_xopen_source=no;;
5 kx # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
5 kx # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
5 kx # identifies itself as Darwin/7.*
5 kx # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
5 kx # disables platform specific features beyond repair.
5 kx # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
5 kx # has no effect, don't bother defining them
5 kx Darwin/@<:@6789@:>@.*)
5 kx define_xopen_source=no;;
5 kx Darwin/1@<:@0-9@:>@.*)
5 kx define_xopen_source=no;;
5 kx # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
5 kx # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
5 kx # or has another value. By not (re)defining it, the defaults come in place.
5 kx AIX/4)
5 kx define_xopen_source=no;;
5 kx AIX/5)
5 kx if test `uname -r` -eq 1; then
5 kx define_xopen_source=no
5 kx fi
5 kx ;;
5 kx # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
5 kx # defining NI_NUMERICHOST.
5 kx QNX/6.3.2)
5 kx define_xopen_source=no
5 kx ;;
5 kx
5 kx esac
5 kx
5 kx if test $define_xopen_source = yes
5 kx then
5 kx AC_DEFINE(_XOPEN_SOURCE, 600,
5 kx Define to the level of X/Open that your system supports)
5 kx
5 kx # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
5 kx # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
5 kx # several APIs are not declared. Since this is also needed in some
5 kx # cases for HP-UX, we define it globally.
5 kx AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
5 kx Define to activate Unix95-and-earlier features)
5 kx
5 kx AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
5 kx
5 kx fi
5 kx
5 kx #
5 kx # SGI compilers allow the specification of the both the ABI and the
5 kx # ISA on the command line. Depending on the values of these switches,
5 kx # different and often incompatible code will be generated.
5 kx #
5 kx # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
5 kx # thus supply support for various ABI/ISA combinations. The MACHDEP
5 kx # variable is also adjusted.
5 kx #
5 kx AC_SUBST(SGI_ABI)
5 kx if test ! -z "$SGI_ABI"
5 kx then
5 kx CC="cc $SGI_ABI"
5 kx LDFLAGS="$SGI_ABI $LDFLAGS"
5 kx MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
5 kx fi
5 kx AC_MSG_RESULT($MACHDEP)
5 kx
5 kx AC_SUBST(PLATDIR)
5 kx PLATDIR=plat-$MACHDEP
5 kx
5 kx # And add extra plat-mac for darwin
5 kx AC_SUBST(EXTRAPLATDIR)
5 kx AC_SUBST(EXTRAMACHDEPPATH)
5 kx AC_MSG_CHECKING(EXTRAPLATDIR)
5 kx if test -z "$EXTRAPLATDIR"
5 kx then
5 kx case $MACHDEP in
5 kx darwin)
5 kx EXTRAPLATDIR="\$(PLATMACDIRS)"
5 kx EXTRAMACHDEPPATH="\$(PLATMACPATH)"
5 kx ;;
5 kx *)
5 kx EXTRAPLATDIR=""
5 kx EXTRAMACHDEPPATH=""
5 kx ;;
5 kx esac
5 kx fi
5 kx AC_MSG_RESULT($EXTRAPLATDIR)
5 kx
5 kx # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
5 kx # it may influence the way we can build extensions, so distutils
5 kx # needs to check it
5 kx AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
5 kx AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
5 kx CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
5 kx EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
5 kx
5 kx # checks for alternative programs
5 kx
5 kx # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
5 kx # for debug/optimization stuff. BASECFLAGS is for flags that are required
5 kx # just to get things to compile and link. Users are free to override OPT
5 kx # when running configure or make. The build should not break if they do.
5 kx # BASECFLAGS should generally not be messed with, however.
5 kx
5 kx # XXX shouldn't some/most/all of this code be merged with the stuff later
5 kx # on that fiddles with OPT and BASECFLAGS?
5 kx AC_MSG_CHECKING(for --without-gcc)
5 kx AC_ARG_WITH(gcc,
5 kx AS_HELP_STRING([--without-gcc], [never use gcc]),
5 kx [
5 kx case $withval in
5 kx no) CC=${CC:-cc}
5 kx without_gcc=yes;;
5 kx yes) CC=gcc
5 kx without_gcc=no;;
5 kx *) CC=$withval
5 kx without_gcc=$withval;;
5 kx esac], [
5 kx case $ac_sys_system in
5 kx AIX*) CC=${CC:-xlc_r}
5 kx without_gcc=;;
5 kx BeOS*)
5 kx case $BE_HOST_CPU in
5 kx ppc)
5 kx CC=mwcc
5 kx without_gcc=yes
5 kx BASECFLAGS="$BASECFLAGS -export pragma"
5 kx OPT="$OPT -O"
5 kx LDFLAGS="$LDFLAGS -nodup"
5 kx ;;
5 kx x86)
5 kx CC=gcc
5 kx without_gcc=no
5 kx OPT="$OPT -O"
5 kx ;;
5 kx *)
5 kx AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
5 kx ;;
5 kx esac
5 kx AR="\$(srcdir)/Modules/ar_beos"
5 kx RANLIB=:
5 kx ;;
5 kx *) without_gcc=no;;
5 kx esac])
5 kx AC_MSG_RESULT($without_gcc)
5 kx
5 kx AC_MSG_CHECKING(for --with-icc)
5 kx AC_ARG_WITH(icc,
5 kx AS_HELP_STRING([--with-icc], [build with icc]),
5 kx [
5 kx case $withval in
5 kx no) CC=${CC:-cc}
5 kx with_icc=no;;
5 kx yes) CC=icc
5 kx CXX=icpc
5 kx with_icc=yes;;
5 kx *) CC=$withval
5 kx with_icc=$withval;;
5 kx esac], [
5 kx with_icc=no])
5 kx AC_MSG_RESULT($with_icc)
5 kx
5 kx # If the user switches compilers, we can't believe the cache
5 kx if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
5 kx then
5 kx AC_MSG_ERROR([cached CC is different -- throw away $cache_file
5 kx (it is also a good idea to do 'make clean' before compiling)])
5 kx fi
5 kx
5 kx if test "$MACHDEP" = "irix6" && test "$CC" != "gcc"; then
5 kx # Normally, MIPSpro CC treats #error directives as warnings, which means
5 kx # a successful exit code is returned (0). This is a problem because IRIX
5 kx # has a bunch of system headers with this guard at the top:
5 kx #
5 kx # #ifndef __c99
5 kx # #error This header file is to be used only for c99 mode compilations
5 kx # #else
5 kx #
5 kx # When autoconf tests for such a header, like stdint.h, this happens:
5 kx #
5 kx # configure:4619: cc -c conftest.c >&5
5 kx # cc-1035 cc: WARNING File = /usr/include/stdint.h, Line = 5
5 kx # #error directive: This header file is to be used only for c99 mode
5 kx # compilations
5 kx #
5 kx # #error This header file is to be used only for c99 mode compilations
5 kx # ^
5 kx #
5 kx # configure:4619: $? = 0
5 kx # configure:4619: result: yes
5 kx #
5 kx # Therefore, we use `-diag_error 1035` to have the compiler treat the
5 kx # warning as an error, which causes cc to return a non-zero result,
5 kx # which autoconf can interpret correctly.
5 kx CFLAGS="$CFLAGS -diag_error 1035"
5 kx # Whilst we're here, we might as well make sure CXX defaults to something
5 kx # sensible if we're not using gcc.
5 kx if test -z "$CXX"; then
5 kx CXX="CC"
5 kx fi
5 kx fi
5 kx
5 kx # If the user set CFLAGS, use this instead of the automatically
5 kx # determined setting
5 kx preset_cflags="$CFLAGS"
5 kx AC_PROG_CC
5 kx if test ! -z "$preset_cflags"
5 kx then
5 kx CFLAGS=$preset_cflags
5 kx fi
5 kx
5 kx AC_SUBST(CXX)
5 kx AC_SUBST(MAINCC)
5 kx AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
5 kx AC_ARG_WITH(cxx_main,
5 kx AS_HELP_STRING([--with-cxx-main=<compiler>],
5 kx [compile main() and link python executable with C++ compiler]),
5 kx [
5 kx
5 kx case $withval in
5 kx no) with_cxx_main=no
5 kx MAINCC='$(CC)';;
5 kx yes) with_cxx_main=yes
5 kx MAINCC='$(CXX)';;
5 kx *) with_cxx_main=yes
5 kx MAINCC=$withval
5 kx if test -z "$CXX"
5 kx then
5 kx CXX=$withval
5 kx fi;;
5 kx esac], [
5 kx with_cxx_main=no
5 kx MAINCC='$(CC)'
5 kx ])
5 kx AC_MSG_RESULT($with_cxx_main)
5 kx
5 kx preset_cxx="$CXX"
5 kx if test -z "$CXX"
5 kx then
5 kx case "$CC" in
5 kx gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
5 kx cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
5 kx esac
5 kx if test "$CXX" = "notfound"
5 kx then
5 kx CXX=""
5 kx fi
5 kx fi
5 kx if test -z "$CXX"
5 kx then
5 kx AC_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
5 kx if test "$CXX" = "notfound"
5 kx then
5 kx CXX=""
5 kx fi
5 kx fi
5 kx if test "$preset_cxx" != "$CXX"
5 kx then
5 kx AC_MSG_WARN([
5 kx
5 kx By default, distutils will build C++ extension modules with "$CXX".
5 kx If this is not intended, then set CXX on the configure command line.
5 kx ])
5 kx fi
5 kx
5 kx MULTIARCH=$($CC --print-multiarch 2>/dev/null)
5 kx AC_SUBST(MULTIARCH)
5 kx
5 kx
5 kx # checks for UNIX variants that set C preprocessor variables
5 kx AC_USE_SYSTEM_EXTENSIONS
5 kx
5 kx # Check for unsupported systems
5 kx case $ac_sys_system/$ac_sys_release in
5 kx atheos*|Linux*/1*)
5 kx echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
5 kx echo See README for details.
5 kx exit 1;;
5 kx esac
5 kx
5 kx AC_EXEEXT
5 kx AC_MSG_CHECKING(for --with-suffix)
5 kx AC_ARG_WITH(suffix,
5 kx AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]),
5 kx [
5 kx case $withval in
5 kx no) EXEEXT=;;
5 kx yes) EXEEXT=.exe;;
5 kx *) EXEEXT=$withval;;
5 kx esac])
5 kx AC_MSG_RESULT($EXEEXT)
5 kx
5 kx # Test whether we're running on a non-case-sensitive system, in which
5 kx # case we give a warning if no ext is given
5 kx AC_SUBST(BUILDEXEEXT)
5 kx AC_MSG_CHECKING(for case-insensitive build directory)
5 kx if test ! -d CaseSensitiveTestDir; then
5 kx mkdir CaseSensitiveTestDir
5 kx fi
5 kx
5 kx if test -d casesensitivetestdir
5 kx then
5 kx AC_MSG_RESULT(yes)
5 kx BUILDEXEEXT=.exe
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx BUILDEXEEXT=$EXEEXT
5 kx fi
5 kx rmdir CaseSensitiveTestDir
5 kx
5 kx case $MACHDEP in
5 kx bsdos*)
5 kx case $CC in
5 kx gcc) CC="$CC -D_HAVE_BSDI";;
5 kx esac;;
5 kx esac
5 kx
5 kx case $ac_sys_system in
5 kx hp*|HP*)
5 kx case $CC in
5 kx cc|*/cc) CC="$CC -Ae";;
5 kx esac;;
5 kx SunOS*)
5 kx # Some functions have a prototype only with that define, e.g. confstr
5 kx AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
5 kx ;;
5 kx esac
5 kx
5 kx
5 kx AC_SUBST(LIBRARY)
5 kx AC_MSG_CHECKING(LIBRARY)
5 kx if test -z "$LIBRARY"
5 kx then
5 kx LIBRARY='libpython$(VERSION).a'
5 kx fi
5 kx AC_MSG_RESULT($LIBRARY)
5 kx
5 kx # LDLIBRARY is the name of the library to link against (as opposed to the
5 kx # name of the library into which to insert object files). BLDLIBRARY is also
5 kx # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
5 kx # is blank as the main program is not linked directly against LDLIBRARY.
5 kx # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
5 kx # systems without shared libraries, LDLIBRARY is the same as LIBRARY
5 kx # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
5 kx # DLLLIBRARY is the shared (i.e., DLL) library.
5 kx #
5 kx # RUNSHARED is used to run shared python without installed libraries
5 kx #
5 kx # INSTSONAME is the name of the shared library that will be use to install
5 kx # on the system - some systems like version suffix, others don't
5 kx AC_SUBST(LDLIBRARY)
5 kx AC_SUBST(DLLLIBRARY)
5 kx AC_SUBST(BLDLIBRARY)
5 kx AC_SUBST(LDLIBRARYDIR)
5 kx AC_SUBST(INSTSONAME)
5 kx AC_SUBST(RUNSHARED)
5 kx LDLIBRARY="$LIBRARY"
5 kx BLDLIBRARY='$(LDLIBRARY)'
5 kx INSTSONAME='$(LDLIBRARY)'
5 kx DLLLIBRARY=''
5 kx LDLIBRARYDIR=''
5 kx RUNSHARED=''
5 kx
5 kx # LINKCC is the command that links the python executable -- default is $(CC).
5 kx # If CXX is set, and if it is needed to link a main function that was
5 kx # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
5 kx # python might then depend on the C++ runtime
5 kx # This is altered for AIX in order to build the export list before
5 kx # linking.
5 kx AC_SUBST(LINKCC)
5 kx AC_MSG_CHECKING(LINKCC)
5 kx if test -z "$LINKCC"
5 kx then
5 kx LINKCC='$(PURIFY) $(MAINCC)'
5 kx case $ac_sys_system in
5 kx AIX*)
5 kx exp_extra="\"\""
5 kx if test $ac_sys_release -ge 5 -o \
5 kx $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
5 kx exp_extra="."
5 kx fi
5 kx LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
5 kx QNX*)
5 kx # qcc must be used because the other compilers do not
5 kx # support -N.
5 kx LINKCC=qcc;;
5 kx esac
5 kx fi
5 kx AC_MSG_RESULT($LINKCC)
5 kx
5 kx # GNULD is set to "yes" if the GNU linker is used. If this goes wrong
5 kx # make sure we default having it set to "no": this is used by
5 kx # distutils.unixccompiler to know if it should add --enable-new-dtags
5 kx # to linker command lines, and failing to detect GNU ld simply results
5 kx # in the same bahaviour as before.
5 kx AC_SUBST(GNULD)
5 kx AC_MSG_CHECKING(for GNU ld)
5 kx ac_prog=ld
5 kx if test "$GCC" = yes; then
5 kx ac_prog=`$CC -print-prog-name=ld`
5 kx fi
5 kx case `"$ac_prog" -V 2>&1 < /dev/null` in
5 kx *GNU*)
5 kx GNULD=yes;;
5 kx *)
5 kx GNULD=no;;
5 kx esac
5 kx AC_MSG_RESULT($GNULD)
5 kx
5 kx AC_MSG_CHECKING(for --enable-shared)
5 kx AC_ARG_ENABLE(shared,
5 kx AS_HELP_STRING([--enable-shared], [disable/enable building shared python library]))
5 kx
5 kx if test -z "$enable_shared"
5 kx then
5 kx case $ac_sys_system in
5 kx CYGWIN* | atheos*)
5 kx enable_shared="yes";;
5 kx *)
5 kx enable_shared="no";;
5 kx esac
5 kx fi
5 kx AC_MSG_RESULT($enable_shared)
5 kx
5 kx AC_MSG_CHECKING(for --enable-profiling)
5 kx AC_ARG_ENABLE(profiling,
5 kx AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]))
5 kx if test "x$enable_profiling" = xyes; then
5 kx ac_save_cc="$CC"
5 kx CC="$CC -pg"
5 kx AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
5 kx [],
5 kx [enable_profiling=no])
5 kx CC="$ac_save_cc"
5 kx else
5 kx enable_profiling=no
5 kx fi
5 kx AC_MSG_RESULT($enable_profiling)
5 kx
5 kx if test "x$enable_profiling" = xyes; then
5 kx BASECFLAGS="-pg $BASECFLAGS"
5 kx LDFLAGS="-pg $LDFLAGS"
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(LDLIBRARY)
5 kx
5 kx # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
5 kx # library that we build, but we do not want to link against it (we
5 kx # will find it with a -framework option). For this reason there is an
5 kx # extra variable BLDLIBRARY against which Python and the extension
5 kx # modules are linked, BLDLIBRARY. This is normally the same as
5 kx # LDLIBRARY, but empty for MacOSX framework builds.
5 kx if test "$enable_framework"
5 kx then
5 kx LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx RUNSHARED=DYLD_FRAMEWORK_PATH=`pwd`${DYLD_FRAMEWORK_PATH:+:${DYLD_FRAMEWORK_PATH}}
5 kx BLDLIBRARY=''
5 kx else
5 kx BLDLIBRARY='$(LDLIBRARY)'
5 kx fi
5 kx
5 kx # Other platforms follow
5 kx if test $enable_shared = "yes"; then
5 kx AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
5 kx case $ac_sys_system in
5 kx BeOS*)
5 kx LDLIBRARY='libpython$(VERSION).so'
5 kx ;;
5 kx CYGWIN*)
5 kx LDLIBRARY='libpython$(VERSION).dll.a'
5 kx DLLLIBRARY='libpython$(VERSION).dll'
5 kx ;;
5 kx SunOS*)
5 kx LDLIBRARY='libpython$(VERSION).so'
5 kx BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
5 kx RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
5 kx INSTSONAME="$LDLIBRARY".$SOVERSION
5 kx ;;
5 kx Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
5 kx LDLIBRARY='libpython$(VERSION).so'
5 kx BLDLIBRARY='-L. -lpython$(VERSION)'
5 kx RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
5 kx case $ac_sys_system in
5 kx FreeBSD*)
5 kx SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
5 kx ;;
5 kx esac
5 kx INSTSONAME="$LDLIBRARY".$SOVERSION
5 kx ;;
5 kx hp*|HP*)
5 kx case `uname -m` in
5 kx ia64)
5 kx LDLIBRARY='libpython$(VERSION).so'
5 kx ;;
5 kx *)
5 kx LDLIBRARY='libpython$(VERSION).sl'
5 kx ;;
5 kx esac
5 kx BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
5 kx RUNSHARED=SHLIB_PATH=`pwd`${SHLIB_PATH:+:${SHLIB_PATH}}
5 kx ;;
5 kx OSF*)
5 kx LDLIBRARY='libpython$(VERSION).so'
5 kx BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
5 kx RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
5 kx ;;
5 kx atheos*)
5 kx LDLIBRARY='libpython$(VERSION).so'
5 kx BLDLIBRARY='-L. -lpython$(VERSION)'
5 kx RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
5 kx ;;
5 kx Darwin*)
5 kx LDLIBRARY='libpython$(VERSION).dylib'
5 kx BLDLIBRARY='-L. -lpython$(VERSION)'
5 kx RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
5 kx ;;
5 kx AIX*)
5 kx LDLIBRARY='libpython$(VERSION).so'
5 kx RUNSHARED=LIBPATH=`pwd`${LIBPATH:+:${LIBPATH}}
5 kx ;;
5 kx
5 kx esac
5 kx else # shared is disabled
5 kx case $ac_sys_system in
5 kx CYGWIN*)
5 kx BLDLIBRARY='$(LIBRARY)'
5 kx LDLIBRARY='libpython$(VERSION).dll.a'
5 kx ;;
5 kx esac
5 kx fi
5 kx
5 kx if test "$cross_compiling" = yes; then
5 kx RUNSHARED=
5 kx fi
5 kx
5 kx AC_MSG_RESULT($LDLIBRARY)
5 kx
5 kx AC_PROG_RANLIB
5 kx AC_SUBST(AR)
5 kx AC_CHECK_TOOLS(AR, ar aal, ar)
5 kx
5 kx # tweak ARFLAGS only if the user didn't set it on the command line
5 kx AC_SUBST(ARFLAGS)
5 kx if test -z "$ARFLAGS"
5 kx then
5 kx ARFLAGS="rc"
5 kx fi
5 kx
5 kx AC_SUBST(GITVERSION)
5 kx AC_SUBST(GITTAG)
5 kx AC_SUBST(GITBRANCH)
5 kx
5 kx if test -e $srcdir/.git
5 kx then
5 kx AC_CHECK_PROG(HAS_GIT, git, found, not-found)
5 kx else
5 kx HAS_GIT=no-repository
5 kx fi
5 kx if test $HAS_GIT = found
5 kx then
5 kx GITVERSION="git --git-dir \$(srcdir)/.git rev-parse --short HEAD"
5 kx GITTAG="git --git-dir \$(srcdir)/.git describe --all --always --dirty"
5 kx GITBRANCH="git --git-dir \$(srcdir)/.git name-rev --name-only HEAD"
5 kx else
5 kx GITVERSION=""
5 kx GITTAG=""
5 kx GITBRANCH=""
5 kx fi
5 kx
5 kx case $MACHDEP in
5 kx bsdos*|hp*|HP*)
5 kx # install -d does not work on BSDI or HP-UX
5 kx if test -z "$INSTALL"
5 kx then
5 kx INSTALL="${srcdir}/install-sh -c"
5 kx fi
5 kx esac
5 kx AC_PROG_INSTALL
5 kx AC_PROG_MKDIR_P
5 kx
5 kx # Not every filesystem supports hard links
5 kx AC_SUBST(LN)
5 kx if test -z "$LN" ; then
5 kx case $ac_sys_system in
5 kx BeOS*) LN="ln -s";;
5 kx CYGWIN*) LN="ln -s";;
5 kx atheos*) LN="ln -s";;
5 kx *) LN=ln;;
5 kx esac
5 kx fi
5 kx
5 kx # Check for --with-pydebug
5 kx AC_MSG_CHECKING(for --with-pydebug)
5 kx AC_ARG_WITH(pydebug,
5 kx AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]),
5 kx [
5 kx if test "$withval" != no
5 kx then
5 kx AC_DEFINE(Py_DEBUG, 1,
5 kx [Define if you want to build an interpreter with many run-time checks.])
5 kx AC_MSG_RESULT(yes);
5 kx Py_DEBUG='true'
5 kx else AC_MSG_RESULT(no); Py_DEBUG='false'
5 kx fi],
5 kx [AC_MSG_RESULT(no)])
5 kx
5 kx # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
5 kx # merged with this chunk of code?
5 kx
5 kx # Optimizer/debugger flags
5 kx # ------------------------
5 kx # (The following bit of code is complicated enough - please keep things
5 kx # indented properly. Just pretend you're editing Python code. ;-)
5 kx
5 kx # There are two parallel sets of case statements below, one that checks to
5 kx # see if OPT was set and one that does BASECFLAGS setting based upon
5 kx # compiler and platform. BASECFLAGS tweaks need to be made even if the
5 kx # user set OPT.
5 kx
5 kx # tweak OPT based on compiler and platform, only if the user didn't set
5 kx # it on the command line
5 kx AC_SUBST(OPT)
5 kx if test "${OPT-unset}" = "unset"
5 kx then
5 kx case $GCC in
5 kx yes)
5 kx if test "$CC" != 'g++' ; then
5 kx STRICT_PROTO="-Wstrict-prototypes"
5 kx fi
5 kx # For gcc 4.x we need to use -fwrapv so lets check if its supported
5 kx if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
5 kx WRAP="-fwrapv"
5 kx fi
5 kx
5 kx # Clang also needs -fwrapv
5 kx case $CC in
5 kx *clang*) WRAP="-fwrapv"
5 kx ;;
5 kx esac
5 kx
5 kx case $ac_cv_prog_cc_g in
5 kx yes)
5 kx if test "$Py_DEBUG" = 'true' ; then
5 kx # Optimization messes up debuggers, so turn it off for
5 kx # debug builds.
5 kx OPT="-g -O0 -Wall $STRICT_PROTO"
5 kx else
5 kx OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
5 kx fi
5 kx ;;
5 kx *)
5 kx OPT="-O3 -Wall $STRICT_PROTO"
5 kx ;;
5 kx esac
5 kx case $ac_sys_system in
5 kx SCO_SV*) OPT="$OPT -m486 -DSCO5"
5 kx ;;
5 kx esac
5 kx ;;
5 kx
5 kx *)
5 kx OPT="-O"
5 kx ;;
5 kx esac
5 kx fi
5 kx
5 kx AC_SUBST(BASECFLAGS)
5 kx
5 kx # The -arch flags for universal builds on OSX
5 kx UNIVERSAL_ARCH_FLAGS=
5 kx AC_SUBST(UNIVERSAL_ARCH_FLAGS)
5 kx
5 kx # tweak BASECFLAGS based on compiler and platform
5 kx case $GCC in
5 kx yes)
5 kx # Python violates C99 rules, by casting between incompatible
5 kx # pointer types. GCC may generate bad code as a result of that,
5 kx # so use -fno-strict-aliasing if supported.
5 kx AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
5 kx ac_save_cc="$CC"
5 kx CC="$CC -fno-strict-aliasing"
5 kx AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
5 kx AC_COMPILE_IFELSE(
5 kx [AC_LANG_PROGRAM([[]], [[]])],
5 kx [ac_cv_no_strict_aliasing_ok=yes],
5 kx [ac_cv_no_strict_aliasing_ok=no]))
5 kx CC="$ac_save_cc"
5 kx AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
5 kx if test $ac_cv_no_strict_aliasing_ok = yes
5 kx then
5 kx BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
5 kx fi
5 kx
5 kx # if using gcc on alpha, use -mieee to get (near) full IEEE 754
5 kx # support. Without this, treatment of subnormals doesn't follow
5 kx # the standard.
5 kx case $host in
5 kx alpha*)
5 kx BASECFLAGS="$BASECFLAGS -mieee"
5 kx ;;
5 kx esac
5 kx
5 kx case $ac_sys_system in
5 kx SCO_SV*)
5 kx BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
5 kx ;;
5 kx # is there any other compiler on Darwin besides gcc?
5 kx Darwin*)
5 kx # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
5 kx # used to be here, but non-Apple gcc doesn't accept them.
5 kx if test "${CC}" = gcc
5 kx then
5 kx AC_MSG_CHECKING(which compiler should be used)
5 kx case "${UNIVERSALSDK}" in
5 kx */MacOSX10.4u.sdk)
5 kx # Build using 10.4 SDK, force usage of gcc when the
5 kx # compiler is gcc, otherwise the user will get very
5 kx # confusing error messages when building on OSX 10.6
5 kx CC=gcc-4.0
5 kx CPP=cpp-4.0
5 kx ;;
5 kx esac
5 kx AC_MSG_RESULT($CC)
5 kx fi
5 kx
5 kx if test "${enable_universalsdk}"
5 kx then
5 kx case "$UNIVERSAL_ARCHS" in
5 kx 32-bit)
5 kx UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
5 kx LIPO_32BIT_FLAGS=""
5 kx ARCH_RUN_32BIT=""
5 kx ;;
5 kx 64-bit)
5 kx UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
5 kx LIPO_32BIT_FLAGS=""
5 kx ARCH_RUN_32BIT=""
5 kx ;;
5 kx all)
5 kx UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
5 kx LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
5 kx ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
5 kx ;;
5 kx intel)
5 kx UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
5 kx LIPO_32BIT_FLAGS="-extract i386"
5 kx ARCH_RUN_32BIT="/usr/bin/arch -i386"
5 kx ;;
5 kx intel-32)
5 kx UNIVERSAL_ARCH_FLAGS="-arch i386"
5 kx LIPO_32BIT_FLAGS=""
5 kx ARCH_RUN_32BIT=""
5 kx ;;
5 kx intel-64)
5 kx UNIVERSAL_ARCH_FLAGS="-arch x86_64"
5 kx LIPO_32BIT_FLAGS=""
5 kx ARCH_RUN_32BIT=""
5 kx ;;
5 kx 3-way)
5 kx UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
5 kx LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
5 kx ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
5 kx ;;
5 kx *)
5 kx AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
5 kx ;;
5 kx esac
5 kx
5 kx if test "${UNIVERSALSDK}" != "/"
5 kx then
5 kx CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
5 kx LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
5 kx CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
5 kx else
5 kx CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
5 kx LDFLAGS="${UNIVERSAL_ARCH_FLAGS} ${LDFLAGS}"
5 kx fi
5 kx fi
5 kx
5 kx # Calculate an appropriate deployment target for this build:
5 kx # The deployment target value is used explicitly to enable certain
5 kx # features are enabled (such as builtin libedit support for readline)
5 kx # through the use of Apple's Availability Macros and is used as a
5 kx # component of the string returned by distutils.get_platform().
5 kx #
5 kx # Use the value from:
5 kx # 1. the MACOSX_DEPLOYMENT_TARGET environment variable if specified
5 kx # 2. the operating system version of the build machine if >= 10.6
5 kx # 3. If running on OS X 10.3 through 10.5, use the legacy tests
5 kx # below to pick either 10.3, 10.4, or 10.5 as the target.
5 kx # 4. If we are running on OS X 10.2 or earlier, good luck!
5 kx
5 kx AC_MSG_CHECKING(which MACOSX_DEPLOYMENT_TARGET to use)
5 kx cur_target_major=`sw_vers -productVersion | \
5 kx sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
5 kx cur_target_minor=`sw_vers -productVersion | \
5 kx sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
5 kx cur_target="${cur_target_major}.${cur_target_minor}"
5 kx if test ${cur_target_major} -eq 10 && \
5 kx test ${cur_target_minor} -ge 3 && \
5 kx test ${cur_target_minor} -le 5
5 kx then
5 kx # OS X 10.3 through 10.5
5 kx cur_target=10.3
5 kx if test ${enable_universalsdk}
5 kx then
5 kx case "$UNIVERSAL_ARCHS" in
5 kx all|3-way|intel|64-bit)
5 kx # These configurations were first supported in 10.5
5 kx cur_target='10.5'
5 kx ;;
5 kx esac
5 kx else
5 kx if test `/usr/bin/arch` = "i386"
5 kx then
5 kx # 10.4 was the first release to support Intel archs
5 kx cur_target="10.4"
5 kx fi
5 kx fi
5 kx fi
5 kx CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
5 kx
5 kx # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
5 kx # environment with a value that is the same as what we'll use
5 kx # in the Makefile to ensure that we'll get the same compiler
5 kx # environment during configure and build time.
5 kx MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
5 kx export MACOSX_DEPLOYMENT_TARGET
5 kx EXPORT_MACOSX_DEPLOYMENT_TARGET=''
5 kx AC_MSG_RESULT($MACOSX_DEPLOYMENT_TARGET)
5 kx
5 kx # end of Darwin* tests
5 kx ;;
5 kx OSF*)
5 kx BASECFLAGS="$BASECFLAGS -mieee"
5 kx ;;
5 kx esac
5 kx ;;
5 kx
5 kx *)
5 kx case $ac_sys_system in
5 kx OpenUNIX*|UnixWare*)
5 kx BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
5 kx ;;
5 kx OSF*)
5 kx BASECFLAGS="$BASECFLAGS -ieee -std"
5 kx ;;
5 kx SCO_SV*)
5 kx BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx
5 kx # ICC needs -fp-model strict or floats behave badly
5 kx case "$CC" in
5 kx *icc*)
5 kx BASECFLAGS="$BASECFLAGS -fp-model strict"
5 kx ;;
5 kx esac
5 kx
5 kx if test "$Py_DEBUG" = 'true'; then
5 kx :
5 kx else
5 kx OPT="-DNDEBUG $OPT"
5 kx fi
5 kx
5 kx if test "$ac_arch_flags"
5 kx then
5 kx BASECFLAGS="$BASECFLAGS $ac_arch_flags"
5 kx fi
5 kx
5 kx # disable check for icc since it seems to pass, but generates a warning
5 kx if test "$CC" = icc
5 kx then
5 kx ac_cv_opt_olimit_ok=no
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
5 kx AC_CACHE_VAL(ac_cv_opt_olimit_ok,
5 kx [ac_save_cc="$CC"
5 kx CC="$CC -OPT:Olimit=0"
5 kx AC_COMPILE_IFELSE(
5 kx [AC_LANG_PROGRAM([[]], [[]])],
5 kx [ac_cv_opt_olimit_ok=yes],
5 kx [ac_cv_opt_olimit_ok=no]
5 kx )
5 kx CC="$ac_save_cc"])
5 kx AC_MSG_RESULT($ac_cv_opt_olimit_ok)
5 kx if test $ac_cv_opt_olimit_ok = yes; then
5 kx case $ac_sys_system in
5 kx # XXX is this branch needed? On MacOSX 10.2.2 the result of the
5 kx # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
5 kx # environment?
5 kx Darwin*)
5 kx ;;
5 kx # XXX thankfully this useless troublemaker of a flag has been
5 kx # eradicated in the 3.x line. For now, make sure it isn't picked
5 kx # up by any of our other platforms that use CC.
5 kx AIX*|SunOS*|HP-UX*|IRIX*)
5 kx ;;
5 kx *)
5 kx BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
5 kx ;;
5 kx esac
5 kx else
5 kx AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
5 kx AC_CACHE_VAL(ac_cv_olimit_ok,
5 kx [ac_save_cc="$CC"
5 kx CC="$CC -Olimit 1500"
5 kx AC_COMPILE_IFELSE(
5 kx [AC_LANG_PROGRAM([[]], [[]])],
5 kx [ac_cv_olimit_ok=yes],
5 kx [ac_cv_olimit_ok=no]
5 kx )
5 kx CC="$ac_save_cc"])
5 kx AC_MSG_RESULT($ac_cv_olimit_ok)
5 kx if test $ac_cv_olimit_ok = yes; then
5 kx case $ac_sys_system in
5 kx # Issue #16534: On HP-UX ac_cv_olimit_ok=yes is a false positive.
5 kx HP-UX*)
5 kx ;;
5 kx *)
5 kx BASECFLAGS="$BASECFLAGS -Olimit 1500"
5 kx ;;
5 kx esac
5 kx fi
5 kx fi
5 kx
5 kx # Check whether GCC supports PyArg_ParseTuple format
5 kx if test "$GCC" = "yes"
5 kx then
5 kx AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
5 kx save_CFLAGS=$CFLAGS
5 kx CFLAGS="$CFLAGS -Werror -Wformat"
5 kx AC_COMPILE_IFELSE([
5 kx AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
5 kx ],[
5 kx AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1,
5 kx [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
5 kx AC_MSG_RESULT(yes)
5 kx ],[
5 kx AC_MSG_RESULT(no)
5 kx ])
5 kx CFLAGS=$save_CFLAGS
5 kx fi
5 kx
5 kx
5 kx # Enable optimization flags
5 kx AC_SUBST(DEF_MAKE_ALL_RULE)
5 kx AC_SUBST(DEF_MAKE_RULE)
5 kx Py_OPT='false'
5 kx AC_MSG_CHECKING(for --enable-optimizations)
5 kx AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--enable-optimizations], [Enable expensive optimizations (PGO, maybe LTO, etc). Disabled by default.]),
5 kx [
5 kx if test "$enableval" != no
5 kx then
5 kx Py_OPT='true'
5 kx AC_MSG_RESULT(yes);
5 kx else
5 kx Py_OPT='false'
5 kx AC_MSG_RESULT(no);
5 kx fi],
5 kx [AC_MSG_RESULT(no)])
5 kx if test "$Py_OPT" = 'true' ; then
5 kx # Intentionally not forcing Py_LTO='true' here. Too many toolchains do not
5 kx # compile working code using it and both test_distutils and test_gdb are
5 kx # broken when you do managed to get a toolchain that works with it. People
5 kx # who want LTO need to use --with-lto themselves.
5 kx DEF_MAKE_ALL_RULE="profile-opt"
5 kx REQUIRE_PGO="yes"
5 kx DEF_MAKE_RULE="build_all"
5 kx else
5 kx DEF_MAKE_ALL_RULE="build_all"
5 kx REQUIRE_PGO="no"
5 kx DEF_MAKE_RULE="all"
5 kx fi
5 kx
5 kx
5 kx # Enable LTO flags
5 kx AC_SUBST(LTOFLAGS)
5 kx AC_MSG_CHECKING(for --with-lto)
5 kx AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable Link Time Optimization in PGO builds. Disabled by default.]),
5 kx [
5 kx if test "$withval" != no
5 kx then
5 kx Py_LTO='true'
5 kx AC_MSG_RESULT(yes);
5 kx else
5 kx Py_LTO='false'
5 kx AC_MSG_RESULT(no);
5 kx fi],
5 kx [AC_MSG_RESULT(no)])
5 kx if test "$Py_LTO" = 'true' ; then
5 kx case $CC in
5 kx *clang*)
5 kx # Any changes made here should be reflected in the GCC+Darwin case below
5 kx LTOFLAGS="-flto"
5 kx ;;
5 kx *gcc*)
5 kx case $ac_sys_system in
5 kx Darwin*)
5 kx LTOFLAGS="-flto"
5 kx ;;
5 kx *)
5 kx LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx
5 kx if test "$ac_cv_prog_cc_g" = "yes"
5 kx then
5 kx # bpo-30345: Add -g to LDFLAGS when compiling with LTO
5 kx # to get debug symbols.
5 kx LTOFLAGS="$LTOFLAGS -g"
5 kx fi
5 kx fi
5 kx
5 kx
5 kx # Enable PGO flags.
5 kx AC_SUBST(PGO_PROF_GEN_FLAG)
5 kx AC_SUBST(PGO_PROF_USE_FLAG)
5 kx AC_SUBST(LLVM_PROF_MERGER)
5 kx AC_SUBST(LLVM_PROF_FILE)
5 kx AC_SUBST(LLVM_PROF_ERR)
5 kx # Make this work on systems where llvm tools are not installed with their
5 kx # normal names in the default $PATH (ie: Ubuntu). They exist under the
5 kx # non-suffixed name in their versioned llvm directory.
5 kx llvm_bin_dir=''
5 kx llvm_path="${PATH}"
5 kx if test "${CC}" = "clang"
5 kx then
5 kx clang_bin=`which clang`
5 kx # Some systems install clang elsewhere as a symlink to the real path
5 kx # which is where the related llvm tools are located.
5 kx if test -L "${clang_bin}"
5 kx then
5 kx clang_dir=`dirname "${clang_bin}"`
5 kx clang_bin=`readlink "${clang_bin}"`
5 kx llvm_bin_dir="${clang_dir}/"`dirname "${clang_bin}"`
5 kx llvm_path="${llvm_path}${PATH_SEPARATOR}${llvm_bin_dir}"
5 kx fi
5 kx fi
5 kx AC_SUBST(LLVM_PROFDATA)
5 kx AC_PATH_TARGET_TOOL(LLVM_PROFDATA, llvm-profdata, '', ${llvm_path})
5 kx AC_SUBST(LLVM_PROF_FOUND)
5 kx if test -n "${LLVM_PROFDATA}" -a -x "${LLVM_PROFDATA}"
5 kx then
5 kx LLVM_PROF_FOUND="found"
5 kx else
5 kx LLVM_PROF_FOUND="not-found"
5 kx fi
5 kx if test "$ac_sys_system" = "Darwin" -a "${LLVM_PROF_FOUND}" = "not-found"
5 kx then
5 kx found_llvm_profdata=`/usr/bin/xcrun -find llvm-profdata 2>/dev/null`
5 kx if test -n "${found_llvm_profdata}"
5 kx then
5 kx # llvm-profdata isn't directly in $PATH in some cases.
5 kx # https://apple.stackexchange.com/questions/197053/
5 kx LLVM_PROFDATA='/usr/bin/xcrun llvm-profdata'
5 kx LLVM_PROF_FOUND=found
5 kx AC_MSG_NOTICE([llvm-profdata found via xcrun: ${LLVM_PROFDATA}])
5 kx fi
5 kx fi
5 kx LLVM_PROF_ERR=no
5 kx case $CC in
5 kx *clang*)
5 kx # Any changes made here should be reflected in the GCC+Darwin case below
5 kx PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
5 kx PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
5 kx LLVM_PROF_MERGER="${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr"
5 kx LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
5 kx if test $LLVM_PROF_FOUND = not-found
5 kx then
5 kx LLVM_PROF_ERR=yes
5 kx if test "${REQUIRE_PGO}" = "yes"
5 kx then
5 kx AC_MSG_ERROR([llvm-profdata is required for a --enable-optimizations build but could not be found.])
5 kx fi
5 kx fi
5 kx ;;
5 kx *gcc*)
5 kx case $ac_sys_system in
5 kx Darwin*)
5 kx PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
5 kx PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
5 kx LLVM_PROF_MERGER="${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr"
5 kx LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
5 kx if test "${LLVM_PROF_FOUND}" = "not-found"
5 kx then
5 kx LLVM_PROF_ERR=yes
5 kx if test "${REQUIRE_PGO}" = "yes"
5 kx then
5 kx AC_MSG_ERROR([llvm-profdata is required for a --enable-optimizations build but could not be found.])
5 kx fi
5 kx fi
5 kx ;;
5 kx *)
5 kx PGO_PROF_GEN_FLAG="-fprofile-generate"
5 kx PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
5 kx LLVM_PROF_MERGER="true"
5 kx LLVM_PROF_FILE=""
5 kx ;;
5 kx esac
5 kx ;;
5 kx *icc*)
5 kx PGO_PROF_GEN_FLAG="-prof-gen"
5 kx PGO_PROF_USE_FLAG="-prof-use"
5 kx LLVM_PROF_MERGER="true"
5 kx LLVM_PROF_FILE=""
5 kx ;;
5 kx esac
5 kx
5 kx
5 kx # On some compilers, pthreads are available without further options
5 kx # (e.g. MacOS X). On some of these systems, the compiler will not
5 kx # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
5 kx # So we have to see first whether pthreads are available without
5 kx # options before we can check whether -Kpthread improves anything.
5 kx AC_MSG_CHECKING(whether pthreads are available without options)
5 kx AC_CACHE_VAL(ac_cv_pthread_is_default,
5 kx [AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <stdio.h>
5 kx #include <pthread.h>
5 kx
5 kx void* routine(void* p){return NULL;}
5 kx
5 kx int main(){
5 kx pthread_t p;
5 kx if(pthread_create(&p,NULL,routine,NULL)!=0)
5 kx return 1;
5 kx (void)pthread_detach(p);
5 kx return 0;
5 kx }
5 kx ]])],[
5 kx ac_cv_pthread_is_default=yes
5 kx ac_cv_kthread=no
5 kx ac_cv_pthread=no
5 kx ],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no])
5 kx ])
5 kx AC_MSG_RESULT($ac_cv_pthread_is_default)
5 kx
5 kx
5 kx if test $ac_cv_pthread_is_default = yes
5 kx then
5 kx ac_cv_kpthread=no
5 kx else
5 kx # -Kpthread, if available, provides the right #defines
5 kx # and linker options to make pthread_create available
5 kx # Some compilers won't report that they do not support -Kpthread,
5 kx # so we need to run a program to see whether it really made the
5 kx # function available.
5 kx AC_MSG_CHECKING(whether $CC accepts -Kpthread)
5 kx AC_CACHE_VAL(ac_cv_kpthread,
5 kx [ac_save_cc="$CC"
5 kx CC="$CC -Kpthread"
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <stdio.h>
5 kx #include <pthread.h>
5 kx
5 kx void* routine(void* p){return NULL;}
5 kx
5 kx int main(){
5 kx pthread_t p;
5 kx if(pthread_create(&p,NULL,routine,NULL)!=0)
5 kx return 1;
5 kx (void)pthread_detach(p);
5 kx return 0;
5 kx }
5 kx ]])],[ac_cv_kpthread=yes],[ac_cv_kpthread=no],[ac_cv_kpthread=no])
5 kx CC="$ac_save_cc"])
5 kx AC_MSG_RESULT($ac_cv_kpthread)
5 kx fi
5 kx
5 kx if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
5 kx then
5 kx # -Kthread, if available, provides the right #defines
5 kx # and linker options to make pthread_create available
5 kx # Some compilers won't report that they do not support -Kthread,
5 kx # so we need to run a program to see whether it really made the
5 kx # function available.
5 kx AC_MSG_CHECKING(whether $CC accepts -Kthread)
5 kx AC_CACHE_VAL(ac_cv_kthread,
5 kx [ac_save_cc="$CC"
5 kx CC="$CC -Kthread"
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <stdio.h>
5 kx #include <pthread.h>
5 kx
5 kx void* routine(void* p){return NULL;}
5 kx
5 kx int main(){
5 kx pthread_t p;
5 kx if(pthread_create(&p,NULL,routine,NULL)!=0)
5 kx return 1;
5 kx (void)pthread_detach(p);
5 kx return 0;
5 kx }
5 kx ]])],[ac_cv_kthread=yes],[ac_cv_kthread=no],[ac_cv_kthread=no])
5 kx CC="$ac_save_cc"])
5 kx AC_MSG_RESULT($ac_cv_kthread)
5 kx fi
5 kx
5 kx if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
5 kx then
5 kx # -pthread, if available, provides the right #defines
5 kx # and linker options to make pthread_create available
5 kx # Some compilers won't report that they do not support -pthread,
5 kx # so we need to run a program to see whether it really made the
5 kx # function available.
5 kx AC_MSG_CHECKING(whether $CC accepts -pthread)
5 kx AC_CACHE_VAL(ac_cv_pthread,
5 kx [ac_save_cc="$CC"
5 kx CC="$CC -pthread"
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <stdio.h>
5 kx #include <pthread.h>
5 kx
5 kx void* routine(void* p){return NULL;}
5 kx
5 kx int main(){
5 kx pthread_t p;
5 kx if(pthread_create(&p,NULL,routine,NULL)!=0)
5 kx return 1;
5 kx (void)pthread_detach(p);
5 kx return 0;
5 kx }
5 kx ]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
5 kx CC="$ac_save_cc"])
5 kx AC_MSG_RESULT($ac_cv_pthread)
5 kx fi
5 kx
5 kx # If we have set a CC compiler flag for thread support then
5 kx # check if it works for CXX, too.
5 kx ac_cv_cxx_thread=no
5 kx if test ! -z "$CXX"
5 kx then
5 kx AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
5 kx ac_save_cxx="$CXX"
5 kx
5 kx if test "$ac_cv_kpthread" = "yes"
5 kx then
5 kx CXX="$CXX -Kpthread"
5 kx ac_cv_cxx_thread=yes
5 kx elif test "$ac_cv_kthread" = "yes"
5 kx then
5 kx CXX="$CXX -Kthread"
5 kx ac_cv_cxx_thread=yes
5 kx elif test "$ac_cv_pthread" = "yes"
5 kx then
5 kx CXX="$CXX -pthread"
5 kx ac_cv_cxx_thread=yes
5 kx fi
5 kx
5 kx if test $ac_cv_cxx_thread = yes
5 kx then
5 kx echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
5 kx $CXX -c conftest.$ac_ext 2>&5
5 kx if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
5 kx && test -s conftest$ac_exeext && ./conftest$ac_exeext
5 kx then
5 kx ac_cv_cxx_thread=yes
5 kx else
5 kx ac_cv_cxx_thread=no
5 kx fi
5 kx rm -fr conftest*
5 kx fi
5 kx AC_MSG_RESULT($ac_cv_cxx_thread)
5 kx fi
5 kx CXX="$ac_save_cxx"
5 kx
5 kx dnl # check for ANSI or K&R ("traditional") preprocessor
5 kx dnl AC_MSG_CHECKING(for C preprocessor type)
5 kx dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
5 kx dnl int foo;
5 kx dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
5 kx dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional])
5 kx dnl AC_MSG_RESULT($cpp_type)
5 kx
5 kx # checks for header files
5 kx AC_HEADER_STDC
5 kx AC_CHECK_HEADERS(asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \
5 kx fcntl.h grp.h \
5 kx ieeefp.h io.h langinfo.h libintl.h poll.h process.h pthread.h \
5 kx shadow.h signal.h stdint.h stropts.h termios.h thread.h \
5 kx unistd.h utime.h \
5 kx sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
5 kx sys/lock.h sys/mkdev.h sys/modem.h \
5 kx sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
5 kx sys/termio.h sys/time.h \
5 kx sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
5 kx sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
5 kx bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h)
5 kx AC_HEADER_DIRENT
5 kx AC_HEADER_MAJOR
5 kx
5 kx # On Linux, netlink.h requires asm/types.h
5 kx AC_CHECK_HEADERS(linux/netlink.h,,,[
5 kx #ifdef HAVE_ASM_TYPES_H
5 kx #include <asm/types.h>
5 kx #endif
5 kx #ifdef HAVE_SYS_SOCKET_H
5 kx #include <sys/socket.h>
5 kx #endif
5 kx ])
5 kx
5 kx # checks for typedefs
5 kx was_it_defined=no
5 kx AC_MSG_CHECKING(for clock_t in time.h)
5 kx AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
5 kx AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
5 kx ])
5 kx AC_MSG_RESULT($was_it_defined)
5 kx
5 kx # Check whether using makedev requires defining _OSF_SOURCE
5 kx AC_MSG_CHECKING(for makedev)
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5 kx #if defined(MAJOR_IN_MKDEV)
5 kx #include <sys/mkdev.h>
5 kx #elif defined(MAJOR_IN_SYSMACROS)
5 kx #include <sys/sysmacros.h>
5 kx #else
5 kx #include <sys/types.h>
5 kx #endif ]], [[ makedev(0, 0) ]])],
5 kx [ac_cv_has_makedev=yes],
5 kx [ac_cv_has_makedev=no])
5 kx if test "$ac_cv_has_makedev" = "no"; then
5 kx # we didn't link, try if _OSF_SOURCE will allow us to link
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5 kx #define _OSF_SOURCE 1
5 kx #include <sys/types.h>
5 kx ]], [[ makedev(0, 0) ]])],
5 kx [ac_cv_has_makedev=yes],
5 kx [ac_cv_has_makedev=no])
5 kx if test "$ac_cv_has_makedev" = "yes"; then
5 kx AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
5 kx fi
5 kx fi
5 kx AC_MSG_RESULT($ac_cv_has_makedev)
5 kx if test "$ac_cv_has_makedev" = "yes"; then
5 kx AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
5 kx fi
5 kx
5 kx # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
5 kx # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
5 kx # defined, but the compiler does not support pragma redefine_extname,
5 kx # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
5 kx # structures (such as rlimit64) without declaring them. As a
5 kx # work-around, disable LFS on such configurations
5 kx
5 kx use_lfs=yes
5 kx AC_MSG_CHECKING(Solaris LFS bug)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #define _LARGEFILE_SOURCE 1
5 kx #define _FILE_OFFSET_BITS 64
5 kx #include <sys/resource.h>
5 kx ]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes])
5 kx AC_MSG_RESULT($sol_lfs_bug)
5 kx if test "$sol_lfs_bug" = "yes"; then
5 kx use_lfs=no
5 kx fi
5 kx
5 kx if test "$use_lfs" = "yes"; then
5 kx # Two defines needed to enable largefile support on various platforms
5 kx # These may affect some typedefs
5 kx case $ac_sys_system/$ac_sys_release in
5 kx AIX*)
5 kx AC_DEFINE(_LARGE_FILES, 1,
5 kx [This must be defined on AIX systems to enable large file support.])
5 kx ;;
5 kx esac
5 kx AC_DEFINE(_LARGEFILE_SOURCE, 1,
5 kx [This must be defined on some systems to enable large file support.])
5 kx AC_DEFINE(_FILE_OFFSET_BITS, 64,
5 kx [This must be set to 64 on some systems to enable large file support.])
5 kx fi
5 kx
5 kx # Add some code to confdefs.h so that the test for off_t works on SCO
5 kx cat >> confdefs.h <<\EOF
5 kx #if defined(SCO_DS)
5 kx #undef _OFF_T
5 kx #endif
5 kx EOF
5 kx
5 kx # Type availability checks
5 kx AC_TYPE_MODE_T
5 kx AC_TYPE_OFF_T
5 kx AC_TYPE_PID_T
5 kx AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
5 kx AC_TYPE_SIZE_T
5 kx AC_TYPE_UID_T
5 kx
5 kx # There are two separate checks for each of the exact-width integer types we
5 kx # need. First we check whether the type is available using the usual
5 kx # AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h>
5 kx # and <stdint.h> where available). We then also use the special type checks of
5 kx # the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available
5 kx # directly, #define's uint32_t to be a suitable type.
5 kx
5 kx AC_CHECK_TYPE(uint32_t,
5 kx AC_DEFINE(HAVE_UINT32_T, 1, [Define if your compiler provides uint32_t.]),,)
5 kx AC_TYPE_UINT32_T
5 kx
5 kx AC_CHECK_TYPE(uint64_t,
5 kx AC_DEFINE(HAVE_UINT64_T, 1, [Define if your compiler provides uint64_t.]),,)
5 kx AC_TYPE_UINT64_T
5 kx
5 kx AC_CHECK_TYPE(int32_t,
5 kx AC_DEFINE(HAVE_INT32_T, 1, [Define if your compiler provides int32_t.]),,)
5 kx AC_TYPE_INT32_T
5 kx
5 kx AC_CHECK_TYPE(int64_t,
5 kx AC_DEFINE(HAVE_INT64_T, 1, [Define if your compiler provides int64_t.]),,)
5 kx AC_TYPE_INT64_T
5 kx
5 kx AC_CHECK_TYPE(ssize_t,
5 kx AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
5 kx
5 kx # Sizes of various common basic types
5 kx # ANSI C requires sizeof(char) == 1, so no need to check it
5 kx AC_CHECK_SIZEOF(int, 4)
5 kx AC_CHECK_SIZEOF(long, 4)
5 kx AC_CHECK_SIZEOF(void *, 4)
5 kx AC_CHECK_SIZEOF(short, 2)
5 kx AC_CHECK_SIZEOF(float, 4)
5 kx AC_CHECK_SIZEOF(double, 8)
5 kx AC_CHECK_SIZEOF(fpos_t, 4)
5 kx AC_CHECK_SIZEOF(size_t, 4)
5 kx AC_CHECK_SIZEOF(pid_t, 4)
5 kx
5 kx AC_MSG_CHECKING(for long long support)
5 kx have_long_long=no
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
5 kx AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
5 kx have_long_long=yes
5 kx ],[])
5 kx AC_MSG_RESULT($have_long_long)
5 kx if test "$have_long_long" = yes ; then
5 kx AC_CHECK_SIZEOF(long long, 8)
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(for long double support)
5 kx have_long_double=no
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
5 kx AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
5 kx have_long_double=yes
5 kx ],[])
5 kx AC_MSG_RESULT($have_long_double)
5 kx if test "$have_long_double" = yes ; then
5 kx AC_CHECK_SIZEOF(long double, 12)
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(for _Bool support)
5 kx have_c99_bool=no
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Bool x; x = (_Bool)0;]])],[
5 kx AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
5 kx have_c99_bool=yes
5 kx ],[])
5 kx AC_MSG_RESULT($have_c99_bool)
5 kx if test "$have_c99_bool" = yes ; then
5 kx AC_CHECK_SIZEOF(_Bool, 1)
5 kx fi
5 kx
5 kx AC_CHECK_TYPES(uintptr_t,
5 kx [AC_CHECK_SIZEOF(uintptr_t, 4)],
5 kx [], [#ifdef HAVE_STDINT_H
5 kx #include <stdint.h>
5 kx #endif
5 kx #ifdef HAVE_INTTYPES_H
5 kx #include <inttypes.h>
5 kx #endif])
5 kx
5 kx AC_CHECK_SIZEOF(off_t, [], [
5 kx #ifdef HAVE_SYS_TYPES_H
5 kx #include <sys/types.h>
5 kx #endif
5 kx ])
5 kx
5 kx AC_MSG_CHECKING(whether to enable large file support)
5 kx if test "$have_long_long" = yes
5 kx then
5 kx if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
5 kx "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
5 kx AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
5 kx [Defined to enable large file support when an off_t is bigger than a long
5 kx and long long is available and at least as big as an off_t. You may need
5 kx to add some flags for configuration and compilation to enable this mode.
5 kx (For Solaris and Linux, the necessary defines are already defined.)])
5 kx AC_MSG_RESULT(yes)
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi
5 kx
5 kx AC_CHECK_SIZEOF(time_t, [], [
5 kx #ifdef HAVE_SYS_TYPES_H
5 kx #include <sys/types.h>
5 kx #endif
5 kx #ifdef HAVE_TIME_H
5 kx #include <time.h>
5 kx #endif
5 kx ])
5 kx
5 kx # if have pthread_t then define SIZEOF_PTHREAD_T
5 kx ac_save_cc="$CC"
5 kx if test "$ac_cv_kpthread" = "yes"
5 kx then CC="$CC -Kpthread"
5 kx elif test "$ac_cv_kthread" = "yes"
5 kx then CC="$CC -Kthread"
5 kx elif test "$ac_cv_pthread" = "yes"
5 kx then CC="$CC -pthread"
5 kx fi
5 kx AC_MSG_CHECKING(for pthread_t)
5 kx have_pthread_t=no
5 kx AC_COMPILE_IFELSE([
5 kx AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
5 kx ],[have_pthread_t=yes],[])
5 kx AC_MSG_RESULT($have_pthread_t)
5 kx if test "$have_pthread_t" = yes ; then
5 kx AC_CHECK_SIZEOF(pthread_t, [], [
5 kx #ifdef HAVE_PTHREAD_H
5 kx #include <pthread.h>
5 kx #endif
5 kx ])
5 kx fi
5 kx CC="$ac_save_cc"
5 kx
5 kx AC_MSG_CHECKING(for --enable-toolbox-glue)
5 kx AC_ARG_ENABLE(toolbox-glue,
5 kx AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions]))
5 kx
5 kx if test -z "$enable_toolbox_glue"
5 kx then
5 kx case $ac_sys_system/$ac_sys_release in
5 kx Darwin/*)
5 kx enable_toolbox_glue="yes";;
5 kx *)
5 kx enable_toolbox_glue="no";;
5 kx esac
5 kx fi
5 kx case "$enable_toolbox_glue" in
5 kx yes)
5 kx extra_machdep_objs="Python/mactoolboxglue.o"
5 kx extra_undefs="-u _PyMac_Error"
5 kx AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
5 kx [Define if you want to use MacPython modules on MacOSX in unix-Python.])
5 kx ;;
5 kx *)
5 kx extra_machdep_objs=""
5 kx extra_undefs=""
5 kx ;;
5 kx esac
5 kx AC_MSG_RESULT($enable_toolbox_glue)
5 kx
5 kx
5 kx AC_SUBST(OTHER_LIBTOOL_OPT)
5 kx case $ac_sys_system/$ac_sys_release in
5 kx Darwin/@<:@01567@:>@\..*)
5 kx OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
5 kx ;;
5 kx Darwin/*)
5 kx OTHER_LIBTOOL_OPT=""
5 kx ;;
5 kx esac
5 kx
5 kx
5 kx AC_SUBST(LIBTOOL_CRUFT)
5 kx case $ac_sys_system/$ac_sys_release in
5 kx Darwin/@<:@01567@:>@\..*)
5 kx LIBTOOL_CRUFT="-framework System -lcc_dynamic"
5 kx if test "${enable_universalsdk}"; then
5 kx :
5 kx else
5 kx LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
5 kx fi
5 kx LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
5 kx Darwin/*)
5 kx gcc_version=`gcc -dumpversion`
5 kx if test ${gcc_version} '<' 4.0
5 kx then
5 kx LIBTOOL_CRUFT="-lcc_dynamic"
5 kx else
5 kx LIBTOOL_CRUFT=""
5 kx fi
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <unistd.h>
5 kx int main(int argc, char*argv[])
5 kx {
5 kx if (sizeof(long) == 4) {
5 kx return 0;
5 kx } else {
5 kx return 1;
5 kx }
5 kx }
5 kx ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
5 kx
5 kx if test "${ac_osx_32bit}" = "yes"; then
5 kx case `/usr/bin/arch` in
5 kx i386)
5 kx MACOSX_DEFAULT_ARCH="i386"
5 kx ;;
5 kx ppc)
5 kx MACOSX_DEFAULT_ARCH="ppc"
5 kx ;;
5 kx *)
5 kx AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
5 kx ;;
5 kx esac
5 kx else
5 kx case `/usr/bin/arch` in
5 kx i386)
5 kx MACOSX_DEFAULT_ARCH="x86_64"
5 kx ;;
5 kx ppc)
5 kx MACOSX_DEFAULT_ARCH="ppc64"
5 kx ;;
5 kx *)
5 kx AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
5 kx ;;
5 kx esac
5 kx
5 kx fi
5 kx
5 kx LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
5 kx LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
5 kx esac
5 kx
5 kx AC_MSG_CHECKING(for --enable-framework)
5 kx if test "$enable_framework"
5 kx then
5 kx BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
5 kx # -F. is needed to allow linking to the framework while
5 kx # in the build location.
5 kx AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
5 kx [Define if you want to produce an OpenStep/Rhapsody framework
5 kx (shared library plus accessory files).])
5 kx AC_MSG_RESULT(yes)
5 kx if test $enable_shared = "yes"
5 kx then
5 kx AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.])
5 kx fi
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(for dyld)
5 kx case $ac_sys_system/$ac_sys_release in
5 kx Darwin/*)
5 kx AC_DEFINE(WITH_DYLD, 1,
5 kx [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
5 kx dynamic linker (dyld) instead of the old-style (NextStep) dynamic
5 kx linker (rld). Dyld is necessary to support frameworks.])
5 kx AC_MSG_RESULT(always on for Darwin)
5 kx ;;
5 kx *)
5 kx AC_MSG_RESULT(no)
5 kx ;;
5 kx esac
5 kx
5 kx # Set info about shared libraries.
5 kx AC_SUBST(SO)
5 kx AC_SUBST(LDSHARED)
5 kx AC_SUBST(LDCXXSHARED)
5 kx AC_SUBST(BLDSHARED)
5 kx AC_SUBST(CCSHARED)
5 kx AC_SUBST(LINKFORSHARED)
5 kx # SO is the extension of shared libraries `(including the dot!)
5 kx # -- usually .so, .sl on HP-UX, .dll on Cygwin
5 kx AC_MSG_CHECKING(SO)
5 kx if test -z "$SO"
5 kx then
5 kx case $ac_sys_system in
5 kx hp*|HP*)
5 kx case `uname -m` in
5 kx ia64) SO=.so;;
5 kx *) SO=.sl;;
5 kx esac
5 kx ;;
5 kx CYGWIN*) SO=.dll;;
5 kx *) SO=.so;;
5 kx esac
5 kx else
5 kx # this might also be a termcap variable, see #610332
5 kx echo
5 kx echo '====================================================================='
5 kx echo '+ +'
5 kx echo '+ WARNING: You have set SO in your environment. +'
5 kx echo '+ Do you really mean to change the extension for shared libraries? +'
5 kx echo '+ Continuing in 10 seconds to let you to ponder. +'
5 kx echo '+ +'
5 kx echo '====================================================================='
5 kx sleep 10
5 kx fi
5 kx AC_MSG_RESULT($SO)
5 kx
5 kx AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
5 kx # LDSHARED is the ld *command* used to create shared library
5 kx # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
5 kx # (Shared libraries in this instance are shared modules to be loaded into
5 kx # Python, as opposed to building Python itself as a shared library.)
5 kx AC_MSG_CHECKING(LDSHARED)
5 kx if test -z "$LDSHARED"
5 kx then
5 kx case $ac_sys_system/$ac_sys_release in
5 kx AIX*)
5 kx BLDSHARED="Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
5 kx LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
5 kx ;;
5 kx BeOS*)
5 kx BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
5 kx LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
5 kx ;;
5 kx IRIX/5*) LDSHARED="ld -shared";;
5 kx IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
5 kx SunOS/5*)
5 kx if test "$GCC" = "yes" ; then
5 kx LDSHARED='$(CC) -shared'
5 kx LDCXXSHARED='$(CXX) -shared'
5 kx else
5 kx LDSHARED='$(CC) -G'
5 kx LDCXXSHARED='$(CXX) -G'
5 kx fi ;;
5 kx hp*|HP*)
5 kx if test "$GCC" = "yes" ; then
5 kx LDSHARED='$(CC) -shared'
5 kx LDCXXSHARED='$(CXX) -shared'
5 kx else
5 kx LDSHARED='ld -b'
5 kx fi ;;
5 kx OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
5 kx Darwin/1.3*)
5 kx LDSHARED='$(CC) -bundle'
5 kx LDCXXSHARED='$(CXX) -bundle'
5 kx if test "$enable_framework" ; then
5 kx # Link against the framework. All externals should be defined.
5 kx BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx else
5 kx # No framework. Ignore undefined symbols, assuming they come from Python
5 kx LDSHARED="$LDSHARED -undefined suppress"
5 kx LDCXXSHARED="$LDCXXSHARED -undefined suppress"
5 kx fi ;;
5 kx Darwin/1.4*|Darwin/5.*|Darwin/6.*)
5 kx LDSHARED='$(CC) -bundle'
5 kx LDCXXSHARED='$(CXX) -bundle'
5 kx if test "$enable_framework" ; then
5 kx # Link against the framework. All externals should be defined.
5 kx BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx else
5 kx # No framework, use the Python app as bundle-loader
5 kx BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
5 kx LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
5 kx LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
5 kx fi ;;
5 kx Darwin/*)
5 kx # Use -undefined dynamic_lookup whenever possible (10.3 and later).
5 kx # This allows an extension to be used in any Python
5 kx
5 kx dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
5 kx sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
5 kx dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
5 kx sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
5 kx if test ${dep_target_major} -eq 10 && \
5 kx test ${dep_target_minor} -le 2
5 kx then
5 kx # building for OS X 10.0 through 10.2
5 kx LDSHARED='$(CC) -bundle'
5 kx LDCXXSHARED='$(CXX) -bundle'
5 kx if test "$enable_framework" ; then
5 kx # Link against the framework. All externals should be defined.
5 kx BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx else
5 kx # No framework, use the Python app as bundle-loader
5 kx BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
5 kx LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
5 kx LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
5 kx fi
5 kx else
5 kx # building for OS X 10.3 and later
5 kx LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
5 kx LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
5 kx BLDSHARED="$LDSHARED"
5 kx fi
5 kx ;;
5 kx Linux*|GNU*|QNX*)
5 kx LDSHARED='$(CC) -shared'
5 kx LDCXXSHARED='$(CXX) -shared';;
5 kx BSD/OS*/4*)
5 kx LDSHARED="gcc -shared"
5 kx LDCXXSHARED="g++ -shared";;
5 kx FreeBSD*)
5 kx if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
5 kx then
5 kx LDSHARED='$(CC) -shared'
5 kx LDCXXSHARED='$(CXX) -shared'
5 kx else
5 kx LDSHARED="ld -Bshareable"
5 kx fi;;
5 kx OpenBSD*)
5 kx if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
5 kx then
5 kx LDSHARED='$(CC) -shared $(CCSHARED)'
5 kx LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
5 kx else
5 kx case `uname -r` in
5 kx [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
5 kx LDSHARED="ld -Bshareable ${LDFLAGS}"
5 kx ;;
5 kx *)
5 kx LDSHARED='$(CC) -shared $(CCSHARED)'
5 kx LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
5 kx ;;
5 kx esac
5 kx fi;;
5 kx NetBSD*|DragonFly*)
5 kx LDSHARED='$(CC) -shared'
5 kx LDCXXSHARED='$(CXX) -shared';;
5 kx OpenUNIX*|UnixWare*)
5 kx if test "$GCC" = "yes" ; then
5 kx LDSHARED='$(CC) -shared'
5 kx LDCXXSHARED='$(CXX) -shared'
5 kx else
5 kx LDSHARED='$(CC) -G'
5 kx LDCXXSHARED='$(CXX) -G'
5 kx fi;;
5 kx SCO_SV*)
5 kx LDSHARED='$(CC) -Wl,-G,-Bexport'
5 kx LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
5 kx CYGWIN*)
5 kx LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
5 kx LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
5 kx atheos*)
5 kx LDSHARED="gcc -shared"
5 kx LDCXXSHARED="g++ -shared";;
5 kx *) LDSHARED="ld";;
5 kx esac
5 kx fi
5 kx AC_MSG_RESULT($LDSHARED)
5 kx LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
5 kx BLDSHARED=${BLDSHARED-$LDSHARED}
5 kx # CCSHARED are the C *flags* used to create objects to go into a shared
5 kx # library (module) -- this is only needed for a few systems
5 kx AC_MSG_CHECKING(CCSHARED)
5 kx if test -z "$CCSHARED"
5 kx then
5 kx case $ac_sys_system/$ac_sys_release in
5 kx SunOS*) if test "$GCC" = yes;
5 kx then CCSHARED="-fPIC";
5 kx elif test `uname -p` = sparc;
5 kx then CCSHARED="-xcode=pic32";
5 kx else CCSHARED="-Kpic";
5 kx fi;;
5 kx hp*|HP*) if test "$GCC" = yes;
5 kx then CCSHARED="-fPIC";
5 kx else CCSHARED="+z";
5 kx fi;;
5 kx Linux*|GNU*) CCSHARED="-fPIC";;
5 kx BSD/OS*/4*) CCSHARED="-fpic";;
5 kx FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
5 kx OpenUNIX*|UnixWare*)
5 kx if test "$GCC" = "yes"
5 kx then CCSHARED="-fPIC"
5 kx else CCSHARED="-KPIC"
5 kx fi;;
5 kx SCO_SV*)
5 kx if test "$GCC" = "yes"
5 kx then CCSHARED="-fPIC"
5 kx else CCSHARED="-Kpic -belf"
5 kx fi;;
5 kx IRIX*/6*) case $CC in
5 kx *gcc*) CCSHARED="-shared";;
5 kx *) CCSHARED="";;
5 kx esac;;
5 kx atheos*) CCSHARED="-fPIC";;
5 kx esac
5 kx fi
5 kx AC_MSG_RESULT($CCSHARED)
5 kx # LINKFORSHARED are the flags passed to the $(CC) command that links
5 kx # the python executable -- this is only needed for a few systems
5 kx AC_MSG_CHECKING(LINKFORSHARED)
5 kx if test -z "$LINKFORSHARED"
5 kx then
5 kx case $ac_sys_system/$ac_sys_release in
5 kx AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
5 kx hp*|HP*)
5 kx LINKFORSHARED="-Wl,-E -Wl,+s";;
5 kx # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
5 kx BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
5 kx Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
5 kx # -u libsys_s pulls in all symbols in libsys
5 kx Darwin/*)
5 kx # -u _PyMac_Error is needed to pull in the mac toolbox glue,
5 kx # which is
5 kx # not used by the core itself but which needs to be in the core so
5 kx # that dynamically loaded extension modules have access to it.
5 kx # -prebind is no longer used, because it actually seems to give a
5 kx # slowdown in stead of a speedup, maybe due to the large number of
5 kx # dynamic loads Python does.
5 kx
5 kx LINKFORSHARED="$extra_undefs"
5 kx if test "$enable_framework"
5 kx then
5 kx LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
5 kx fi
5 kx LINKFORSHARED="$LINKFORSHARED";;
5 kx OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
5 kx SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
5 kx ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
5 kx FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
5 kx if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
5 kx then
5 kx LINKFORSHARED="-Wl,--export-dynamic"
5 kx fi;;
5 kx SunOS/5*) case $CC in
5 kx *gcc*)
5 kx if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
5 kx then
5 kx LINKFORSHARED="-Xlinker --export-dynamic"
5 kx fi;;
5 kx esac;;
5 kx CYGWIN*)
5 kx if test $enable_shared = "no"
5 kx then
5 kx LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
5 kx fi;;
5 kx QNX*)
5 kx # -Wl,-E causes the symbols to be added to the dynamic
5 kx # symbol table so that they can be found when a module
5 kx # is loaded. -N 2048K causes the stack size to be set
5 kx # to 2048 kilobytes so that the stack doesn't overflow
5 kx # when running test_compile.py.
5 kx LINKFORSHARED='-Wl,-E -N 2048K';;
5 kx esac
5 kx fi
5 kx AC_MSG_RESULT($LINKFORSHARED)
5 kx
5 kx
5 kx AC_SUBST(CFLAGSFORSHARED)
5 kx AC_MSG_CHECKING(CFLAGSFORSHARED)
5 kx if test ! "$LIBRARY" = "$LDLIBRARY"
5 kx then
5 kx case $ac_sys_system in
5 kx CYGWIN*)
5 kx # Cygwin needs CCSHARED when building extension DLLs
5 kx # but not when building the interpreter DLL.
5 kx CFLAGSFORSHARED='';;
5 kx *)
5 kx CFLAGSFORSHARED='$(CCSHARED)'
5 kx esac
5 kx fi
5 kx AC_MSG_RESULT($CFLAGSFORSHARED)
5 kx
5 kx # SHLIBS are libraries (except -lc and -lm) to link to the python shared
5 kx # library (with --enable-shared).
5 kx # For platforms on which shared libraries are not allowed to have unresolved
5 kx # symbols, this must be set to $(LIBS) (expanded by make). We do this even
5 kx # if it is not required, since it creates a dependency of the shared library
5 kx # to LIBS. This, in turn, means that applications linking the shared libpython
5 kx # don't need to link LIBS explicitly. The default should be only changed
5 kx # on systems where this approach causes problems.
5 kx AC_SUBST(SHLIBS)
5 kx AC_MSG_CHECKING(SHLIBS)
5 kx case "$ac_sys_system" in
5 kx *)
5 kx SHLIBS='$(LIBS)';;
5 kx esac
5 kx AC_MSG_RESULT($SHLIBS)
5 kx
5 kx
5 kx # checks for libraries
5 kx AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
5 kx AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
5 kx
5 kx # only check for sem_init if thread support is requested
5 kx if test "$with_threads" = "yes" -o -z "$with_threads"; then
5 kx AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
5 kx # posix4 on Solaris 2.6
5 kx # pthread (first!) on Linux
5 kx fi
5 kx
5 kx # check if we need libintl for locale functions
5 kx AC_CHECK_LIB(intl, textdomain,
5 kx AC_DEFINE(WITH_LIBINTL, 1,
5 kx [Define to 1 if libintl is needed for locale functions.]))
5 kx AC_SEARCH_LIBS(bind_textdomain_codeset, intl,
5 kx AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET, 1,
5 kx [Define to 1 if bind_textdomain_codeset is available.]))
5 kx
5 kx # checks for system dependent C++ extensions support
5 kx case "$ac_sys_system" in
5 kx AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
5 kx AC_LINK_IFELSE([
5 kx AC_LANG_PROGRAM([[#include <load.h>]],
5 kx [[loadAndInit("", 0, "")]])
5 kx ],[
5 kx AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
5 kx [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
5 kx and you want support for AIX C++ shared extension modules.])
5 kx AC_MSG_RESULT(yes)
5 kx ],[
5 kx AC_MSG_RESULT(no)
5 kx ]);;
5 kx *) ;;
5 kx esac
5 kx
5 kx # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
5 kx # BeOS' sockets are stashed in libnet.
5 kx AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
5 kx AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
5 kx
5 kx case "$ac_sys_system" in
5 kx BeOS*)
5 kx AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
5 kx ;;
5 kx esac
5 kx
5 kx AC_MSG_CHECKING(for --with-libs)
5 kx AC_ARG_WITH(libs,
5 kx AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
5 kx [
5 kx AC_MSG_RESULT($withval)
5 kx LIBS="$withval $LIBS"
5 kx ],
5 kx [AC_MSG_RESULT(no)])
5 kx
5 kx PKG_PROG_PKG_CONFIG
5 kx
5 kx # Check for use of the system expat library
5 kx AC_MSG_CHECKING(for --with-system-expat)
5 kx AC_ARG_WITH(system_expat,
5 kx AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
5 kx [],
5 kx [with_system_expat="no"])
5 kx
5 kx AC_MSG_RESULT($with_system_expat)
5 kx
5 kx # Check for use of the system libffi library
5 kx AC_MSG_CHECKING(for --with-system-ffi)
5 kx AC_ARG_WITH(system_ffi,
5 kx AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),
5 kx [],
5 kx [with_system_ffi="no"])
5 kx
5 kx if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
5 kx LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
5 kx else
5 kx LIBFFI_INCLUDEDIR=""
5 kx fi
5 kx AC_SUBST(LIBFFI_INCLUDEDIR)
5 kx
5 kx AC_MSG_RESULT($with_system_ffi)
5 kx
5 kx # Check for --with-tcltk-includes=path and --with-tcltk-libs=path
5 kx AC_SUBST(TCLTK_INCLUDES)
5 kx AC_SUBST(TCLTK_LIBS)
5 kx AC_MSG_CHECKING(for --with-tcltk-includes)
5 kx AC_ARG_WITH(tcltk-includes,
5 kx AS_HELP_STRING([--with-tcltk-includes='-I...'], [override search for Tcl and Tk include files]),
5 kx [],
5 kx [with_tcltk_includes="default"])
5 kx AC_MSG_RESULT($with_tcltk_includes)
5 kx AC_MSG_CHECKING(for --with-tcltk-libs)
5 kx AC_ARG_WITH(tcltk-libs,
5 kx AS_HELP_STRING([--with-tcltk-libs='-L...'], [override search for Tcl and Tk libs]),
5 kx [],
5 kx [with_tcltk_libs="default"])
5 kx AC_MSG_RESULT($with_tcltk_libs)
5 kx if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault
5 kx then
5 kx if test "x$with_tcltk_includes" != "x$with_tcltk_libs"
5 kx then
5 kx AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither])
5 kx fi
5 kx TCLTK_INCLUDES=""
5 kx TCLTK_LIBS=""
5 kx else
5 kx TCLTK_INCLUDES="$with_tcltk_includes"
5 kx TCLTK_LIBS="$with_tcltk_libs"
5 kx fi
5 kx
5 kx # Check for --with-dbmliborder
5 kx AC_MSG_CHECKING(for --with-dbmliborder)
5 kx AC_ARG_WITH(dbmliborder,
5 kx 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'.]),
5 kx [
5 kx if test x$with_dbmliborder = xyes
5 kx then
5 kx AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
5 kx else
5 kx for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
5 kx if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
5 kx then
5 kx AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
5 kx fi
5 kx done
5 kx fi])
5 kx AC_MSG_RESULT($with_dbmliborder)
5 kx
5 kx # Determine if signalmodule should be used.
5 kx AC_SUBST(USE_SIGNAL_MODULE)
5 kx AC_SUBST(SIGNAL_OBJS)
5 kx AC_MSG_CHECKING(for --with-signal-module)
5 kx AC_ARG_WITH(signal-module,
5 kx AS_HELP_STRING([--with-signal-module], [disable/enable signal module]))
5 kx
5 kx if test -z "$with_signal_module"
5 kx then with_signal_module="yes"
5 kx fi
5 kx AC_MSG_RESULT($with_signal_module)
5 kx
5 kx if test "${with_signal_module}" = "yes"; then
5 kx USE_SIGNAL_MODULE=""
5 kx SIGNAL_OBJS=""
5 kx else
5 kx USE_SIGNAL_MODULE="#"
5 kx SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
5 kx fi
5 kx
5 kx # This is used to generate Setup.config
5 kx AC_SUBST(USE_THREAD_MODULE)
5 kx USE_THREAD_MODULE=""
5 kx
5 kx AC_MSG_CHECKING(for --with-dec-threads)
5 kx AC_SUBST(LDLAST)
5 kx AC_ARG_WITH(dec-threads,
5 kx AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]),
5 kx [
5 kx AC_MSG_RESULT($withval)
5 kx LDLAST=-threads
5 kx if test "${with_thread+set}" != set; then
5 kx with_thread="$withval";
5 kx fi],
5 kx [AC_MSG_RESULT(no)])
5 kx
5 kx # Templates for things AC_DEFINEd more than once.
5 kx # For a single AC_DEFINE, no template is needed.
5 kx AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
5 kx AH_TEMPLATE(_REENTRANT,
5 kx [Define to force use of thread-safe errno, h_errno, and other functions])
5 kx AH_TEMPLATE(WITH_THREAD,
5 kx [Define if you want to compile in rudimentary thread support])
5 kx
5 kx AC_MSG_CHECKING(for --with-threads)
5 kx dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
5 kx AC_ARG_WITH(threads,
5 kx AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support]))
5 kx
5 kx # --with-thread is deprecated, but check for it anyway
5 kx dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
5 kx AC_ARG_WITH(thread,
5 kx AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]),
5 kx [with_threads=$with_thread])
5 kx
5 kx if test -z "$with_threads"
5 kx then with_threads="yes"
5 kx fi
5 kx AC_MSG_RESULT($with_threads)
5 kx
5 kx AC_SUBST(THREADOBJ)
5 kx if test "$with_threads" = "no"
5 kx then
5 kx USE_THREAD_MODULE="#"
5 kx elif test "$ac_cv_pthread_is_default" = yes
5 kx then
5 kx AC_DEFINE(WITH_THREAD)
5 kx # Defining _REENTRANT on system with POSIX threads should not hurt.
5 kx AC_DEFINE(_REENTRANT)
5 kx posix_threads=yes
5 kx THREADOBJ="Python/thread.o"
5 kx if test "$ac_sys_system" = "SunOS"; then
5 kx CFLAGS="$CFLAGS -D_REENTRANT"
5 kx fi
5 kx elif test "$ac_cv_kpthread" = "yes"
5 kx then
5 kx CC="$CC -Kpthread"
5 kx if test "$ac_cv_cxx_thread" = "yes"; then
5 kx CXX="$CXX -Kpthread"
5 kx fi
5 kx AC_DEFINE(WITH_THREAD)
5 kx posix_threads=yes
5 kx THREADOBJ="Python/thread.o"
5 kx elif test "$ac_cv_kthread" = "yes"
5 kx then
5 kx CC="$CC -Kthread"
5 kx if test "$ac_cv_cxx_thread" = "yes"; then
5 kx CXX="$CXX -Kthread"
5 kx fi
5 kx AC_DEFINE(WITH_THREAD)
5 kx posix_threads=yes
5 kx THREADOBJ="Python/thread.o"
5 kx elif test "$ac_cv_pthread" = "yes"
5 kx then
5 kx CC="$CC -pthread"
5 kx if test "$ac_cv_cxx_thread" = "yes"; then
5 kx CXX="$CXX -pthread"
5 kx fi
5 kx AC_DEFINE(WITH_THREAD)
5 kx posix_threads=yes
5 kx THREADOBJ="Python/thread.o"
5 kx else
5 kx if test ! -z "$with_threads" -a -d "$with_threads"
5 kx then LDFLAGS="$LDFLAGS -L$with_threads"
5 kx fi
5 kx if test ! -z "$withval" -a -d "$withval"
5 kx then LDFLAGS="$LDFLAGS -L$withval"
5 kx fi
5 kx
5 kx # According to the POSIX spec, a pthreads implementation must
5 kx # define _POSIX_THREADS in unistd.h. Some apparently don't
5 kx # (e.g. gnu pth with pthread emulation)
5 kx AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
5 kx AC_EGREP_CPP(yes,
5 kx [
5 kx #include <unistd.h>
5 kx #ifdef _POSIX_THREADS
5 kx yes
5 kx #endif
5 kx ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
5 kx AC_MSG_RESULT($unistd_defines_pthreads)
5 kx
5 kx AC_DEFINE(_REENTRANT)
5 kx AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
5 kx AC_DEFINE(C_THREADS)
5 kx AC_DEFINE(HURD_C_THREADS, 1,
5 kx [Define if you are using Mach cthreads directly under /include])
5 kx LIBS="$LIBS -lthreads"
5 kx THREADOBJ="Python/thread.o"],[
5 kx AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
5 kx AC_DEFINE(C_THREADS)
5 kx AC_DEFINE(MACH_C_THREADS, 1,
5 kx [Define if you are using Mach cthreads under mach /])
5 kx THREADOBJ="Python/thread.o"],[
5 kx AC_MSG_CHECKING(for --with-pth)
5 kx AC_ARG_WITH([pth],
5 kx AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]),
5 kx [AC_MSG_RESULT($withval)
5 kx AC_DEFINE([WITH_THREAD])
5 kx AC_DEFINE([HAVE_PTH], 1,
5 kx [Define if you have GNU PTH threads.])
5 kx LIBS="-lpth $LIBS"
5 kx THREADOBJ="Python/thread.o"],
5 kx [AC_MSG_RESULT(no)
5 kx
5 kx # Just looking for pthread_create in libpthread is not enough:
5 kx # on HP/UX, pthread.h renames pthread_create to a different symbol name.
5 kx # So we really have to include pthread.h, and then link.
5 kx _libs=$LIBS
5 kx LIBS="$LIBS -lpthread"
5 kx AC_MSG_CHECKING([for pthread_create in -lpthread])
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <stdio.h>
5 kx #include <pthread.h>
5 kx
5 kx void * start_routine (void *arg) { exit (0); }]], [[
5 kx pthread_create (NULL, NULL, start_routine, NULL)]])],[
5 kx AC_MSG_RESULT(yes)
5 kx AC_DEFINE(WITH_THREAD)
5 kx posix_threads=yes
5 kx THREADOBJ="Python/thread.o"],[
5 kx LIBS=$_libs
5 kx AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
5 kx posix_threads=yes
5 kx THREADOBJ="Python/thread.o"],[
5 kx AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
5 kx AC_DEFINE(ATHEOS_THREADS, 1,
5 kx [Define this if you have AtheOS threads.])
5 kx THREADOBJ="Python/thread.o"],[
5 kx AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
5 kx AC_DEFINE(BEOS_THREADS, 1,
5 kx [Define this if you have BeOS threads.])
5 kx THREADOBJ="Python/thread.o"],[
5 kx AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
5 kx posix_threads=yes
5 kx LIBS="$LIBS -lpthreads"
5 kx THREADOBJ="Python/thread.o"], [
5 kx AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
5 kx posix_threads=yes
5 kx LIBS="$LIBS -lc_r"
5 kx THREADOBJ="Python/thread.o"], [
5 kx AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
5 kx posix_threads=yes
5 kx LIBS="$LIBS -lpthread"
5 kx THREADOBJ="Python/thread.o"], [
5 kx AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
5 kx posix_threads=yes
5 kx LIBS="$LIBS -lcma"
5 kx THREADOBJ="Python/thread.o"],[
5 kx USE_THREAD_MODULE="#"])
5 kx ])])])])])])])])])])
5 kx
5 kx AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
5 kx LIBS="$LIBS -lmpc"
5 kx THREADOBJ="Python/thread.o"
5 kx USE_THREAD_MODULE=""])
5 kx
5 kx if test "$posix_threads" != "yes"; then
5 kx AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
5 kx LIBS="$LIBS -lthread"
5 kx THREADOBJ="Python/thread.o"
5 kx USE_THREAD_MODULE=""])
5 kx fi
5 kx
5 kx if test "$USE_THREAD_MODULE" != "#"
5 kx then
5 kx # If the above checks didn't disable threads, (at least) OSF1
5 kx # needs this '-threads' argument during linking.
5 kx case $ac_sys_system in
5 kx OSF1) LDLAST=-threads;;
5 kx esac
5 kx fi
5 kx fi
5 kx
5 kx if test "$posix_threads" = "yes"; then
5 kx if test "$unistd_defines_pthreads" = "no"; then
5 kx AC_DEFINE(_POSIX_THREADS, 1,
5 kx [Define if you have POSIX threads,
5 kx and your system does not define that.])
5 kx fi
5 kx
5 kx # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
5 kx case $ac_sys_system/$ac_sys_release in
5 kx SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
5 kx [Defined for Solaris 2.6 bug in pthread header.])
5 kx ;;
5 kx SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
5 kx [Define if the Posix semaphores do not work on your system])
5 kx ;;
5 kx AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
5 kx [Define if the Posix semaphores do not work on your system])
5 kx ;;
5 kx esac
5 kx
5 kx AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
5 kx AC_CACHE_VAL(ac_cv_pthread_system_supported,
5 kx [AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <stdio.h>
5 kx #include <pthread.h>
5 kx void *foo(void *parm) {
5 kx return NULL;
5 kx }
5 kx main() {
5 kx pthread_attr_t attr;
5 kx pthread_t id;
5 kx if (pthread_attr_init(&attr)) exit(-1);
5 kx if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
5 kx if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
5 kx exit(0);
5 kx }]])],
5 kx [ac_cv_pthread_system_supported=yes],
5 kx [ac_cv_pthread_system_supported=no],
5 kx [ac_cv_pthread_system_supported=no])
5 kx ])
5 kx AC_MSG_RESULT($ac_cv_pthread_system_supported)
5 kx if test "$ac_cv_pthread_system_supported" = "yes"; then
5 kx AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
5 kx fi
5 kx AC_CHECK_FUNCS(pthread_sigmask,
5 kx [case $ac_sys_system in
5 kx CYGWIN*)
5 kx AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
5 kx [Define if pthread_sigmask() does not work on your system.])
5 kx ;;
5 kx esac])
5 kx AC_CHECK_FUNCS(pthread_atfork)
5 kx fi
5 kx
5 kx
5 kx # Check for enable-ipv6
5 kx AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
5 kx AC_MSG_CHECKING([if --enable-ipv6 is specified])
5 kx AC_ARG_ENABLE(ipv6,
5 kx [ --enable-ipv6 Enable ipv6 (with ipv4) support
5 kx --disable-ipv6 Disable ipv6 support],
5 kx [ case "$enableval" in
5 kx no)
5 kx AC_MSG_RESULT(no)
5 kx ipv6=no
5 kx ;;
5 kx *) AC_MSG_RESULT(yes)
5 kx AC_DEFINE(ENABLE_IPV6)
5 kx ipv6=yes
5 kx ;;
5 kx esac ],
5 kx
5 kx [
5 kx dnl the check does not work on cross compilation case...
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* AF_INET6 available check */
5 kx #include <sys/types.h>
5 kx #include <sys/socket.h>]],
5 kx [[int domain = AF_INET6;]])],[
5 kx AC_MSG_RESULT(yes)
5 kx ipv6=yes
5 kx ],[
5 kx AC_MSG_RESULT(no)
5 kx ipv6=no
5 kx ])
5 kx
5 kx if test "$ipv6" = "yes"; then
5 kx AC_MSG_CHECKING(if RFC2553 API is available)
5 kx AC_COMPILE_IFELSE([
5 kx AC_LANG_PROGRAM([[#include <sys/types.h>
5 kx #include <netinet/in.h>]],
5 kx [[struct sockaddr_in6 x;
5 kx x.sin6_scope_id;]])
5 kx ],[
5 kx AC_MSG_RESULT(yes)
5 kx ipv6=yes
5 kx ],[
5 kx AC_MSG_RESULT(no, IPv6 disabled)
5 kx ipv6=no
5 kx ])
5 kx fi
5 kx
5 kx if test "$ipv6" = "yes"; then
5 kx AC_DEFINE(ENABLE_IPV6)
5 kx fi
5 kx ])
5 kx
5 kx ipv6type=unknown
5 kx ipv6lib=none
5 kx ipv6trylibc=no
5 kx
5 kx if test "$ipv6" = "yes"; then
5 kx AC_MSG_CHECKING([ipv6 stack type])
5 kx for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
5 kx do
5 kx case $i in
5 kx inria)
5 kx dnl http://www.kame.net/
5 kx AC_EGREP_CPP(yes, [
5 kx #include <netinet/in.h>
5 kx #ifdef IPV6_INRIA_VERSION
5 kx yes
5 kx #endif],
5 kx [ipv6type=$i])
5 kx ;;
5 kx kame)
5 kx dnl http://www.kame.net/
5 kx AC_EGREP_CPP(yes, [
5 kx #include <netinet/in.h>
5 kx #ifdef __KAME__
5 kx yes
5 kx #endif],
5 kx [ipv6type=$i;
5 kx ipv6lib=inet6
5 kx ipv6libdir=/usr/local/v6/lib
5 kx ipv6trylibc=yes])
5 kx ;;
5 kx linux-glibc)
5 kx dnl http://www.v6.linux.or.jp/
5 kx AC_EGREP_CPP(yes, [
5 kx #include <features.h>
5 kx #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
5 kx yes
5 kx #endif],
5 kx [ipv6type=$i;
5 kx ipv6trylibc=yes])
5 kx ;;
5 kx linux-inet6)
5 kx dnl http://www.v6.linux.or.jp/
5 kx if test -d /usr/inet6; then
5 kx ipv6type=$i
5 kx ipv6lib=inet6
5 kx ipv6libdir=/usr/inet6/lib
5 kx BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
5 kx fi
5 kx ;;
5 kx solaris)
5 kx if test -f /etc/netconfig; then
5 kx if $GREP -q tcp6 /etc/netconfig; then
5 kx ipv6type=$i
5 kx ipv6trylibc=yes
5 kx fi
5 kx fi
5 kx ;;
5 kx toshiba)
5 kx AC_EGREP_CPP(yes, [
5 kx #include <sys/param.h>
5 kx #ifdef _TOSHIBA_INET6
5 kx yes
5 kx #endif],
5 kx [ipv6type=$i;
5 kx ipv6lib=inet6;
5 kx ipv6libdir=/usr/local/v6/lib])
5 kx ;;
5 kx v6d)
5 kx AC_EGREP_CPP(yes, [
5 kx #include </usr/local/v6/include/sys/v6config.h>
5 kx #ifdef __V6D__
5 kx yes
5 kx #endif],
5 kx [ipv6type=$i;
5 kx ipv6lib=v6;
5 kx ipv6libdir=/usr/local/v6/lib;
5 kx BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
5 kx ;;
5 kx zeta)
5 kx AC_EGREP_CPP(yes, [
5 kx #include <sys/param.h>
5 kx #ifdef _ZETA_MINAMI_INET6
5 kx yes
5 kx #endif],
5 kx [ipv6type=$i;
5 kx ipv6lib=inet6;
5 kx ipv6libdir=/usr/local/v6/lib])
5 kx ;;
5 kx esac
5 kx if test "$ipv6type" != "unknown"; then
5 kx break
5 kx fi
5 kx done
5 kx AC_MSG_RESULT($ipv6type)
5 kx fi
5 kx
5 kx if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
5 kx if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
5 kx LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
5 kx echo "using lib$ipv6lib"
5 kx else
5 kx if test $ipv6trylibc = "yes"; then
5 kx echo "using libc"
5 kx else
5 kx echo 'Fatal: no $ipv6lib library found. cannot continue.'
5 kx echo "You need to fetch lib$ipv6lib.a from appropriate"
5 kx echo 'ipv6 kit and compile beforehand.'
5 kx exit 1
5 kx fi
5 kx fi
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(for OSX 10.5 SDK or later)
5 kx AC_COMPILE_IFELSE([
5 kx AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
5 kx ],[
5 kx AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.])
5 kx AC_MSG_RESULT(yes)
5 kx ],[
5 kx AC_MSG_RESULT(no)
5 kx ])
5 kx
5 kx # Check for --with-doc-strings
5 kx AC_MSG_CHECKING(for --with-doc-strings)
5 kx AC_ARG_WITH(doc-strings,
5 kx AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings]))
5 kx
5 kx if test -z "$with_doc_strings"
5 kx then with_doc_strings="yes"
5 kx fi
5 kx if test "$with_doc_strings" != "no"
5 kx then
5 kx AC_DEFINE(WITH_DOC_STRINGS, 1,
5 kx [Define if you want documentation strings in extension modules])
5 kx fi
5 kx AC_MSG_RESULT($with_doc_strings)
5 kx
5 kx # Check for Python-specific malloc support
5 kx AC_MSG_CHECKING(for --with-tsc)
5 kx AC_ARG_WITH(tsc,
5 kx AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[
5 kx if test "$withval" != no
5 kx then
5 kx AC_DEFINE(WITH_TSC, 1,
5 kx [Define to profile with the Pentium timestamp counter])
5 kx AC_MSG_RESULT(yes)
5 kx else AC_MSG_RESULT(no)
5 kx fi],
5 kx [AC_MSG_RESULT(no)])
5 kx
5 kx # Check for Python-specific malloc support
5 kx AC_MSG_CHECKING(for --with-pymalloc)
5 kx AC_ARG_WITH(pymalloc,
5 kx AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs]))
5 kx
5 kx if test -z "$with_pymalloc"
5 kx then with_pymalloc="yes"
5 kx fi
5 kx if test "$with_pymalloc" != "no"
5 kx then
5 kx AC_DEFINE(WITH_PYMALLOC, 1,
5 kx [Define if you want to compile in Python-specific mallocs])
5 kx fi
5 kx AC_MSG_RESULT($with_pymalloc)
5 kx
5 kx # Check for Valgrind support
5 kx AC_MSG_CHECKING([for --with-valgrind])
5 kx AC_ARG_WITH([valgrind],
5 kx AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
5 kx with_valgrind=no)
5 kx AC_MSG_RESULT([$with_valgrind])
5 kx if test "$with_valgrind" != no; then
5 kx AC_CHECK_HEADER([valgrind/valgrind.h],
5 kx [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
5 kx [AC_MSG_ERROR([Valgrind support requested but headers not available])]
5 kx )
5 kx fi
5 kx
5 kx # Check for --with-wctype-functions
5 kx AC_MSG_CHECKING(for --with-wctype-functions)
5 kx AC_ARG_WITH(wctype-functions,
5 kx AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]),
5 kx [
5 kx if test "$withval" != no
5 kx then
5 kx AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
5 kx [Define if you want wctype.h functions to be used instead of the
5 kx one supplied by Python itself. (see Include/unicodectype.h).])
5 kx AC_MSG_RESULT(yes)
5 kx else AC_MSG_RESULT(no)
5 kx fi],
5 kx [AC_MSG_RESULT(no)])
5 kx
5 kx # -I${DLINCLDIR} is added to the compile rule for importdl.o
5 kx AC_SUBST(DLINCLDIR)
5 kx DLINCLDIR=.
5 kx
5 kx # the dlopen() function means we might want to use dynload_shlib.o. some
5 kx # platforms, such as AIX, have dlopen(), but don't want to use it.
5 kx AC_CHECK_FUNCS(dlopen)
5 kx
5 kx # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
5 kx # loading of modules.
5 kx AC_SUBST(DYNLOADFILE)
5 kx AC_MSG_CHECKING(DYNLOADFILE)
5 kx if test -z "$DYNLOADFILE"
5 kx then
5 kx case $ac_sys_system/$ac_sys_release in
5 kx AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
5 kx if test "$ac_cv_func_dlopen" = yes
5 kx then DYNLOADFILE="dynload_shlib.o"
5 kx else DYNLOADFILE="dynload_aix.o"
5 kx fi
5 kx ;;
5 kx BeOS*) DYNLOADFILE="dynload_beos.o";;
5 kx hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
5 kx # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
5 kx Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
5 kx atheos*) DYNLOADFILE="dynload_atheos.o";;
5 kx *)
5 kx # use dynload_shlib.c and dlopen() if we have it; otherwise stub
5 kx # out any dynamic loading
5 kx if test "$ac_cv_func_dlopen" = yes
5 kx then DYNLOADFILE="dynload_shlib.o"
5 kx else DYNLOADFILE="dynload_stub.o"
5 kx fi
5 kx ;;
5 kx esac
5 kx fi
5 kx AC_MSG_RESULT($DYNLOADFILE)
5 kx if test "$DYNLOADFILE" != "dynload_stub.o"
5 kx then
5 kx AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
5 kx [Defined when any dynamic module loading is enabled.])
5 kx fi
5 kx
5 kx # MACHDEP_OBJS can be set to platform-specific object files needed by Python
5 kx
5 kx AC_SUBST(MACHDEP_OBJS)
5 kx AC_MSG_CHECKING(MACHDEP_OBJS)
5 kx if test -z "$MACHDEP_OBJS"
5 kx then
5 kx MACHDEP_OBJS=$extra_machdep_objs
5 kx else
5 kx MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
5 kx fi
5 kx AC_MSG_RESULT(MACHDEP_OBJS)
5 kx
5 kx # checks for library functions
5 kx AC_CHECK_FUNCS(alarm setitimer getitimer chown \
5 kx clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
5 kx gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
5 kx getentropy \
5 kx getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
5 kx initgroups kill killpg lchown lstat mkfifo mknod mktime mmap \
5 kx mremap nice pathconf pause plock poll pthread_init \
5 kx putenv readlink realpath \
5 kx select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
5 kx setgid \
5 kx setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
5 kx setlocale setregid setreuid setresuid setresgid \
5 kx setsid setpgid setpgrp setuid setvbuf snprintf \
5 kx sigaction siginterrupt sigrelse strftime \
5 kx sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
5 kx truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
5 kx
5 kx # Force lchmod off for Linux. Linux disallows changing the mode of symbolic
5 kx # links. Some libc implementations have a stub lchmod implementation that always
5 kx # returns an error.
5 kx if test "$MACHDEP" != linux; then
5 kx AC_CHECK_FUNCS(lchmod)
5 kx fi
5 kx
5 kx # For some functions, having a definition is not sufficient, since
5 kx # we want to take their address.
5 kx AC_MSG_CHECKING(for chroot)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])],
5 kx [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx AC_MSG_CHECKING(for link)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])],
5 kx [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx AC_MSG_CHECKING(for symlink)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])],
5 kx [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx AC_MSG_CHECKING(for fchdir)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])],
5 kx [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx AC_MSG_CHECKING(for fsync)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])],
5 kx [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx AC_MSG_CHECKING(for fdatasync)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])],
5 kx [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx AC_MSG_CHECKING(for epoll)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])],
5 kx [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx AC_MSG_CHECKING(for kqueue)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <sys/types.h>
5 kx #include <sys/event.h>
5 kx ]], [[int x=kqueue()]])],
5 kx [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx # On some systems (eg. FreeBSD 5), we would find a definition of the
5 kx # functions ctermid_r, setgroups in the library, but no prototype
5 kx # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
5 kx # address to avoid compiler warnings and potential miscompilations
5 kx # because of the missing prototypes.
5 kx
5 kx AC_MSG_CHECKING(for ctermid_r)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <stdio.h>
5 kx ]], [[void* p = ctermid_r]])],
5 kx [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx
5 kx AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl],
5 kx [AC_COMPILE_IFELSE(
5 kx [AC_LANG_PROGRAM(
5 kx [#include <sys/file.h>],
5 kx [void* p = flock]
5 kx )],
5 kx [ac_cv_flock_decl=yes],
5 kx [ac_cv_flock_decl=no]
5 kx )
5 kx ])
5 kx if test "x${ac_cv_flock_decl}" = xyes; then
5 kx AC_CHECK_FUNCS(flock,,
5 kx AC_CHECK_LIB(bsd,flock,
5 kx [AC_DEFINE(HAVE_FLOCK)
5 kx AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
5 kx ])
5 kx )
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(for getpagesize)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <unistd.h>
5 kx ]], [[void* p = getpagesize]])],
5 kx [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx
5 kx AC_MSG_CHECKING(for broken unsetenv)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <stdlib.h>
5 kx ]], [[int res = unsetenv("DUMMY")]])],
5 kx [AC_MSG_RESULT(no)],
5 kx [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.)
5 kx AC_MSG_RESULT(yes)
5 kx ])
5 kx
5 kx dnl check for true
5 kx AC_CHECK_PROGS(TRUE, true, /bin/true)
5 kx
5 kx dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
5 kx dnl On others, they are in the C library, so we to take no action
5 kx AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
5 kx AC_CHECK_LIB(resolv, inet_aton)
5 kx )
5 kx
5 kx # On Tru64, chflags seems to be present, but calling it will
5 kx # exit Python
5 kx AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <sys/stat.h>
5 kx #include <unistd.h>
5 kx int main(int argc, char*argv[])
5 kx {
5 kx if(chflags(argv[0], 0) != 0)
5 kx return 1;
5 kx return 0;
5 kx }
5 kx ]])],
5 kx [ac_cv_have_chflags=yes],
5 kx [ac_cv_have_chflags=no],
5 kx [ac_cv_have_chflags=cross])
5 kx ])
5 kx if test "$ac_cv_have_chflags" = cross ; then
5 kx AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
5 kx fi
5 kx if test "$ac_cv_have_chflags" = yes ; then
5 kx AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the 'chflags' function.])
5 kx fi
5 kx
5 kx AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <sys/stat.h>
5 kx #include <unistd.h>
5 kx int main(int argc, char*argv[])
5 kx {
5 kx if(lchflags(argv[0], 0) != 0)
5 kx return 1;
5 kx return 0;
5 kx }
5 kx ]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross])
5 kx ])
5 kx if test "$ac_cv_have_lchflags" = cross ; then
5 kx AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
5 kx fi
5 kx if test "$ac_cv_have_lchflags" = yes ; then
5 kx AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.])
5 kx fi
5 kx
5 kx dnl Check if system zlib has *Copy() functions
5 kx dnl
5 kx dnl On MacOSX the linker will search for dylibs on the entire linker path
5 kx dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
5 kx dnl to revert to a more traditional unix behaviour and make it possible to
5 kx dnl override the system libz with a local static library of libz. Temporarily
5 kx dnl add that flag to our CFLAGS as well to ensure that we check the version
5 kx dnl of libz that will be used by setup.py.
5 kx dnl The -L/usr/local/lib is needed as wel to get the same compilation
5 kx dnl environment as setup.py (and leaving it out can cause configure to use the
5 kx dnl wrong version of the library)
5 kx case $ac_sys_system/$ac_sys_release in
5 kx Darwin/*)
5 kx _CUR_CFLAGS="${CFLAGS}"
5 kx _CUR_LDFLAGS="${LDFLAGS}"
5 kx CFLAGS="${CFLAGS} -Wl,-search_paths_first"
5 kx LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
5 kx ;;
5 kx esac
5 kx
5 kx AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
5 kx
5 kx case $ac_sys_system/$ac_sys_release in
5 kx Darwin/*)
5 kx CFLAGS="${_CUR_CFLAGS}"
5 kx LDFLAGS="${_CUR_LDFLAGS}"
5 kx ;;
5 kx esac
5 kx
5 kx AC_MSG_CHECKING(for hstrerror)
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <netdb.h>
5 kx ]], [[void* p = hstrerror; hstrerror(0)]])],
5 kx [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx
5 kx AC_MSG_CHECKING(for inet_aton)
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <sys/types.h>
5 kx #include <sys/socket.h>
5 kx #include <netinet/in.h>
5 kx #include <arpa/inet.h>
5 kx ]], [[void* p = inet_aton;inet_aton(0,0)]])],
5 kx [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx
5 kx AC_MSG_CHECKING(for inet_pton)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <sys/types.h>
5 kx #include <sys/socket.h>
5 kx #include <netinet/in.h>
5 kx #include <arpa/inet.h>
5 kx ]], [[void* p = inet_pton]])],
5 kx [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx
5 kx # On some systems, setgroups is in unistd.h, on others, in grp.h
5 kx AC_MSG_CHECKING(for setgroups)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <unistd.h>
5 kx #ifdef HAVE_GRP_H
5 kx #include <grp.h>
5 kx #endif
5 kx ]], [[void* p = setgroups]])],
5 kx [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx
5 kx # check for openpty and forkpty
5 kx
5 kx AC_CHECK_FUNCS(openpty,,
5 kx AC_CHECK_LIB(util,openpty,
5 kx [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
5 kx AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
5 kx )
5 kx )
5 kx AC_CHECK_FUNCS(forkpty,,
5 kx AC_CHECK_LIB(util,forkpty,
5 kx [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
5 kx AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
5 kx )
5 kx )
5 kx
5 kx # Stuff for expat.
5 kx AC_CHECK_FUNCS(memmove)
5 kx
5 kx # check for long file support functions
5 kx AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
5 kx
5 kx AC_REPLACE_FUNCS(dup2 getcwd strdup)
5 kx AC_CHECK_FUNCS(getpgrp,
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
5 kx [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
5 kx [])
5 kx )
5 kx AC_CHECK_FUNCS(setpgrp,
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])],
5 kx [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])],
5 kx [])
5 kx )
5 kx AC_CHECK_FUNCS(gettimeofday,
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]],
5 kx [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])],
5 kx [],
5 kx [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
5 kx [Define if gettimeofday() does not have second (timezone) argument
5 kx This is the case on Motorola V4 (R40V4.2)])
5 kx ])
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for major, minor, and makedev)
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5 kx #if defined(MAJOR_IN_MKDEV)
5 kx #include <sys/mkdev.h>
5 kx #elif defined(MAJOR_IN_SYSMACROS)
5 kx #include <sys/sysmacros.h>
5 kx #else
5 kx #include <sys/types.h>
5 kx #endif
5 kx ]], [[
5 kx makedev(major(0),minor(0));
5 kx ]])],[
5 kx AC_DEFINE(HAVE_DEVICE_MACROS, 1,
5 kx [Define to 1 if you have the device macros.])
5 kx AC_MSG_RESULT(yes)
5 kx ],[
5 kx AC_MSG_RESULT(no)
5 kx ])
5 kx
5 kx # On OSF/1 V5.1, getaddrinfo is available, but a define
5 kx # for [no]getaddrinfo in netdb.h.
5 kx AC_MSG_CHECKING(for getaddrinfo)
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <sys/types.h>
5 kx #include <sys/socket.h>
5 kx #include <netdb.h>
5 kx #include <stdio.h>
5 kx ]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],
5 kx [have_getaddrinfo=yes],
5 kx [have_getaddrinfo=no])
5 kx AC_MSG_RESULT($have_getaddrinfo)
5 kx if test $have_getaddrinfo = yes
5 kx then
5 kx AC_MSG_CHECKING(getaddrinfo bug)
5 kx AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[[
5 kx #include <stdio.h>
5 kx #include <sys/types.h>
5 kx #include <netdb.h>
5 kx #include <string.h>
5 kx #include <sys/socket.h>
5 kx #include <netinet/in.h>
5 kx
5 kx int main()
5 kx {
5 kx int passive, gaierr, inet4 = 0, inet6 = 0;
5 kx struct addrinfo hints, *ai, *aitop;
5 kx char straddr[INET6_ADDRSTRLEN], strport[16];
5 kx
5 kx for (passive = 0; passive <= 1; passive++) {
5 kx memset(&hints, 0, sizeof(hints));
5 kx hints.ai_family = AF_UNSPEC;
5 kx hints.ai_flags = passive ? AI_PASSIVE : 0;
5 kx hints.ai_socktype = SOCK_STREAM;
5 kx hints.ai_protocol = IPPROTO_TCP;
5 kx if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
5 kx (void)gai_strerror(gaierr);
5 kx goto bad;
5 kx }
5 kx for (ai = aitop; ai; ai = ai->ai_next) {
5 kx if (ai->ai_addr == NULL ||
5 kx ai->ai_addrlen == 0 ||
5 kx getnameinfo(ai->ai_addr, ai->ai_addrlen,
5 kx straddr, sizeof(straddr), strport, sizeof(strport),
5 kx NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
5 kx goto bad;
5 kx }
5 kx switch (ai->ai_family) {
5 kx case AF_INET:
5 kx if (strcmp(strport, "54321") != 0) {
5 kx goto bad;
5 kx }
5 kx if (passive) {
5 kx if (strcmp(straddr, "0.0.0.0") != 0) {
5 kx goto bad;
5 kx }
5 kx } else {
5 kx if (strcmp(straddr, "127.0.0.1") != 0) {
5 kx goto bad;
5 kx }
5 kx }
5 kx inet4++;
5 kx break;
5 kx case AF_INET6:
5 kx if (strcmp(strport, "54321") != 0) {
5 kx goto bad;
5 kx }
5 kx if (passive) {
5 kx if (strcmp(straddr, "::") != 0) {
5 kx goto bad;
5 kx }
5 kx } else {
5 kx if (strcmp(straddr, "::1") != 0) {
5 kx goto bad;
5 kx }
5 kx }
5 kx inet6++;
5 kx break;
5 kx case AF_UNSPEC:
5 kx goto bad;
5 kx break;
5 kx default:
5 kx /* another family support? */
5 kx break;
5 kx }
5 kx }
5 kx freeaddrinfo(aitop);
5 kx aitop = NULL;
5 kx }
5 kx
5 kx if (!(inet4 == 0 || inet4 == 2))
5 kx goto bad;
5 kx if (!(inet6 == 0 || inet6 == 2))
5 kx goto bad;
5 kx
5 kx if (aitop)
5 kx freeaddrinfo(aitop);
5 kx return 0;
5 kx
5 kx bad:
5 kx if (aitop)
5 kx freeaddrinfo(aitop);
5 kx return 1;
5 kx }
5 kx ]]])],
5 kx [ac_cv_buggy_getaddrinfo=no],
5 kx [ac_cv_buggy_getaddrinfo=yes],
5 kx [
5 kx if test "${enable_ipv6+set}" = set; then
5 kx ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6"
5 kx else
5 kx ac_cv_buggy_getaddrinfo=yes
5 kx fi]))
5 kx fi
5 kx
5 kx AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
5 kx
5 kx if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
5 kx then
5 kx if test $ipv6 = yes
5 kx then
5 kx echo 'Fatal: You must get working getaddrinfo() function.'
5 kx echo ' or you can specify "--disable-ipv6"'.
5 kx exit 1
5 kx fi
5 kx else
5 kx AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
5 kx fi
5 kx
5 kx AC_CHECK_FUNCS(getnameinfo)
5 kx
5 kx # checks for structures
5 kx AC_HEADER_TIME
5 kx AC_STRUCT_TM
5 kx AC_STRUCT_TIMEZONE
5 kx AC_CHECK_MEMBERS([struct stat.st_rdev])
5 kx AC_CHECK_MEMBERS([struct stat.st_blksize])
5 kx AC_CHECK_MEMBERS([struct stat.st_flags])
5 kx AC_CHECK_MEMBERS([struct stat.st_gen])
5 kx AC_CHECK_MEMBERS([struct stat.st_birthtime])
5 kx AC_CHECK_MEMBERS([struct stat.st_blocks])
5 kx
5 kx AC_MSG_CHECKING(for time.h that defines altzone)
5 kx AC_CACHE_VAL(ac_cv_header_time_altzone,[
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])],
5 kx [ac_cv_header_time_altzone=yes],
5 kx [ac_cv_header_time_altzone=no])
5 kx ])
5 kx AC_MSG_RESULT($ac_cv_header_time_altzone)
5 kx if test $ac_cv_header_time_altzone = yes; then
5 kx AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
5 kx fi
5 kx
5 kx was_it_defined=no
5 kx AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <sys/types.h>
5 kx #include <sys/select.h>
5 kx #include <sys/time.h>
5 kx ]], [[;]])],[
5 kx AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
5 kx [Define if you can safely include both <sys/select.h> and <sys/time.h>
5 kx (which you can't on SCO ODT 3.0).])
5 kx was_it_defined=yes
5 kx ],[])
5 kx AC_MSG_RESULT($was_it_defined)
5 kx
5 kx AC_MSG_CHECKING(for addrinfo)
5 kx AC_CACHE_VAL(ac_cv_struct_addrinfo,
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
5 kx [ac_cv_struct_addrinfo=yes],
5 kx [ac_cv_struct_addrinfo=no]))
5 kx AC_MSG_RESULT($ac_cv_struct_addrinfo)
5 kx if test $ac_cv_struct_addrinfo = yes; then
5 kx AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(for sockaddr_storage)
5 kx AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx # include <sys/types.h>
5 kx # include <sys/socket.h>]], [[struct sockaddr_storage s]])],
5 kx [ac_cv_struct_sockaddr_storage=yes],
5 kx [ac_cv_struct_sockaddr_storage=no]))
5 kx AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
5 kx if test $ac_cv_struct_sockaddr_storage = yes; then
5 kx AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
5 kx fi
5 kx
5 kx # checks for compiler characteristics
5 kx
5 kx AC_C_CHAR_UNSIGNED
5 kx AC_C_CONST
5 kx
5 kx works=no
5 kx AC_MSG_CHECKING(for working volatile)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])],
5 kx [works=yes],
5 kx [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])]
5 kx )
5 kx AC_MSG_RESULT($works)
5 kx
5 kx works=no
5 kx AC_MSG_CHECKING(for working signed char)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])],
5 kx [works=yes],
5 kx [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])]
5 kx )
5 kx AC_MSG_RESULT($works)
5 kx
5 kx have_prototypes=no
5 kx AC_MSG_CHECKING(for prototypes)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])],
5 kx [AC_DEFINE(HAVE_PROTOTYPES, 1,
5 kx [Define if your compiler supports function prototype])
5 kx have_prototypes=yes],
5 kx []
5 kx )
5 kx AC_MSG_RESULT($have_prototypes)
5 kx
5 kx works=no
5 kx AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <stdarg.h>
5 kx int foo(int x, ...) {
5 kx va_list va;
5 kx va_start(va, x);
5 kx va_arg(va, int);
5 kx va_arg(va, char *);
5 kx va_arg(va, double);
5 kx return 0;
5 kx }
5 kx ]], [[return foo(10, "", 3.14);]])],[
5 kx AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
5 kx [Define if your compiler supports variable length function prototypes
5 kx (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
5 kx works=yes
5 kx ],[])
5 kx AC_MSG_RESULT($works)
5 kx
5 kx # check for socketpair
5 kx AC_MSG_CHECKING(for socketpair)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <sys/types.h>
5 kx #include <sys/socket.h>
5 kx ]], [[void *x=socketpair]])],
5 kx [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.])
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx # check if sockaddr has sa_len member
5 kx AC_MSG_CHECKING(if sockaddr has sa_len member)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
5 kx #include <sys/socket.h>]], [[struct sockaddr x;
5 kx x.sa_len = 0;]])],
5 kx [AC_MSG_RESULT(yes)
5 kx AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx va_list_is_array=no
5 kx AC_MSG_CHECKING(whether va_list is an array)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #ifdef HAVE_STDARG_PROTOTYPES
5 kx #include <stdarg.h>
5 kx #else
5 kx #include <varargs.h>
5 kx #endif
5 kx ]], [[va_list list1, list2; list1 = list2;]])],[],[
5 kx AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
5 kx va_list_is_array=yes
5 kx ])
5 kx AC_MSG_RESULT($va_list_is_array)
5 kx
5 kx # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
5 kx AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
5 kx [Define this if you have some version of gethostbyname_r()])
5 kx
5 kx AC_CHECK_FUNC(gethostbyname_r, [
5 kx AC_DEFINE(HAVE_GETHOSTBYNAME_R)
5 kx AC_MSG_CHECKING([gethostbyname_r with 6 args])
5 kx OLD_CFLAGS=$CFLAGS
5 kx CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx # include <netdb.h>
5 kx ]], [[
5 kx char *name;
5 kx struct hostent *he, *res;
5 kx char buffer[2048];
5 kx int buflen = 2048;
5 kx int h_errnop;
5 kx
5 kx (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
5 kx ]])],[
5 kx AC_DEFINE(HAVE_GETHOSTBYNAME_R)
5 kx AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
5 kx [Define this if you have the 6-arg version of gethostbyname_r().])
5 kx AC_MSG_RESULT(yes)
5 kx ],[
5 kx AC_MSG_RESULT(no)
5 kx AC_MSG_CHECKING([gethostbyname_r with 5 args])
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx # include <netdb.h>
5 kx ]], [[
5 kx char *name;
5 kx struct hostent *he;
5 kx char buffer[2048];
5 kx int buflen = 2048;
5 kx int h_errnop;
5 kx
5 kx (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
5 kx ]])],
5 kx [
5 kx AC_DEFINE(HAVE_GETHOSTBYNAME_R)
5 kx AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
5 kx [Define this if you have the 5-arg version of gethostbyname_r().])
5 kx AC_MSG_RESULT(yes)
5 kx ], [
5 kx AC_MSG_RESULT(no)
5 kx AC_MSG_CHECKING([gethostbyname_r with 3 args])
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx # include <netdb.h>
5 kx ]], [[
5 kx char *name;
5 kx struct hostent *he;
5 kx struct hostent_data data;
5 kx
5 kx (void) gethostbyname_r(name, he, &data);
5 kx ]])],
5 kx [
5 kx AC_DEFINE(HAVE_GETHOSTBYNAME_R)
5 kx AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
5 kx [Define this if you have the 3-arg version of gethostbyname_r().])
5 kx AC_MSG_RESULT(yes)
5 kx ], [
5 kx AC_MSG_RESULT(no)
5 kx ])
5 kx ])
5 kx ])
5 kx CFLAGS=$OLD_CFLAGS
5 kx ], [
5 kx AC_CHECK_FUNCS(gethostbyname)
5 kx ])
5 kx AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
5 kx AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
5 kx AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
5 kx AC_SUBST(HAVE_GETHOSTBYNAME_R)
5 kx AC_SUBST(HAVE_GETHOSTBYNAME)
5 kx
5 kx # checks for system services
5 kx # (none yet)
5 kx
5 kx # Linux requires this for correct f.p. operations
5 kx AC_CHECK_FUNC(__fpu_control,
5 kx [],
5 kx [AC_CHECK_LIB(ieee, __fpu_control)
5 kx ])
5 kx
5 kx # Check for --with-fpectl
5 kx AC_MSG_CHECKING(for --with-fpectl)
5 kx AC_ARG_WITH(fpectl,
5 kx AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]),
5 kx [
5 kx if test "$withval" != no
5 kx then
5 kx AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
5 kx [Define if you want SIGFPE handled (see Include/pyfpe.h).])
5 kx AC_MSG_RESULT(yes)
5 kx else AC_MSG_RESULT(no)
5 kx fi],
5 kx [AC_MSG_RESULT(no)])
5 kx
5 kx # check for --with-libm=...
5 kx AC_SUBST(LIBM)
5 kx case $ac_sys_system in
5 kx Darwin) ;;
5 kx BeOS) ;;
5 kx *) LIBM=-lm
5 kx esac
5 kx AC_MSG_CHECKING(for --with-libm=STRING)
5 kx AC_ARG_WITH(libm,
5 kx AS_HELP_STRING([--with-libm=STRING], [math library]),
5 kx [
5 kx if test "$withval" = no
5 kx then LIBM=
5 kx AC_MSG_RESULT(force LIBM empty)
5 kx elif test "$withval" != yes
5 kx then LIBM=$withval
5 kx AC_MSG_RESULT(set LIBM="$withval")
5 kx else AC_MSG_ERROR([proper usage is --with-libm=STRING])
5 kx fi],
5 kx [AC_MSG_RESULT(default LIBM="$LIBM")])
5 kx
5 kx # check for --with-libc=...
5 kx AC_SUBST(LIBC)
5 kx AC_MSG_CHECKING(for --with-libc=STRING)
5 kx AC_ARG_WITH(libc,
5 kx AS_HELP_STRING([--with-libc=STRING], [C library]),
5 kx [
5 kx if test "$withval" = no
5 kx then LIBC=
5 kx AC_MSG_RESULT(force LIBC empty)
5 kx elif test "$withval" != yes
5 kx then LIBC=$withval
5 kx AC_MSG_RESULT(set LIBC="$withval")
5 kx else AC_MSG_ERROR([proper usage is --with-libc=STRING])
5 kx fi],
5 kx [AC_MSG_RESULT(default LIBC="$LIBC")])
5 kx
5 kx # **************************************************
5 kx # * Check for various properties of floating point *
5 kx # **************************************************
5 kx
5 kx AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
5 kx AC_CACHE_VAL(ac_cv_little_endian_double, [
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <string.h>
5 kx int main() {
5 kx double x = 9006104071832581.0;
5 kx if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
5 kx return 0;
5 kx else
5 kx return 1;
5 kx }
5 kx ]])],
5 kx [ac_cv_little_endian_double=yes],
5 kx [ac_cv_little_endian_double=no],
5 kx [ac_cv_little_endian_double=no])])
5 kx AC_MSG_RESULT($ac_cv_little_endian_double)
5 kx if test "$ac_cv_little_endian_double" = yes
5 kx then
5 kx AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
5 kx [Define if C doubles are 64-bit IEEE 754 binary format, stored
5 kx with the least significant byte first])
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
5 kx AC_CACHE_VAL(ac_cv_big_endian_double, [
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <string.h>
5 kx int main() {
5 kx double x = 9006104071832581.0;
5 kx if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
5 kx return 0;
5 kx else
5 kx return 1;
5 kx }
5 kx ]])],
5 kx [ac_cv_big_endian_double=yes],
5 kx [ac_cv_big_endian_double=no],
5 kx [ac_cv_big_endian_double=no])])
5 kx AC_MSG_RESULT($ac_cv_big_endian_double)
5 kx if test "$ac_cv_big_endian_double" = yes
5 kx then
5 kx AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
5 kx [Define if C doubles are 64-bit IEEE 754 binary format, stored
5 kx with the most significant byte first])
5 kx fi
5 kx
5 kx # Some ARM platforms use a mixed-endian representation for doubles.
5 kx # While Python doesn't currently have full support for these platforms
5 kx # (see e.g., issue 1762561), we can at least make sure that float <-> string
5 kx # conversions work.
5 kx AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
5 kx AC_CACHE_VAL(ac_cv_mixed_endian_double, [
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <string.h>
5 kx int main() {
5 kx double x = 9006104071832581.0;
5 kx if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
5 kx return 0;
5 kx else
5 kx return 1;
5 kx }
5 kx ]])],
5 kx [ac_cv_mixed_endian_double=yes],
5 kx [ac_cv_mixed_endian_double=no],
5 kx [ac_cv_mixed_endian_double=no])])
5 kx AC_MSG_RESULT($ac_cv_mixed_endian_double)
5 kx if test "$ac_cv_mixed_endian_double" = yes
5 kx then
5 kx AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
5 kx [Define if C doubles are 64-bit IEEE 754 binary format, stored
5 kx in ARM mixed-endian order (byte order 45670123)])
5 kx fi
5 kx
5 kx # The short float repr introduced in Python 3.1 requires the
5 kx # correctly-rounded string <-> double conversion functions from
5 kx # Python/dtoa.c, which in turn require that the FPU uses 53-bit
5 kx # rounding; this is a problem on x86, where the x87 FPU has a default
5 kx # rounding precision of 64 bits. For gcc/x86, we can fix this by
5 kx # using inline assembler to get and set the x87 FPU control word.
5 kx
5 kx # This inline assembler syntax may also work for suncc and icc,
5 kx # so we try it on all platforms.
5 kx
5 kx AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
5 kx unsigned short cw;
5 kx __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
5 kx __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
5 kx ]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no])
5 kx AC_MSG_RESULT($have_gcc_asm_for_x87)
5 kx if test "$have_gcc_asm_for_x87" = yes
5 kx then
5 kx AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
5 kx [Define if we can use gcc inline assembler to get and set x87 control word])
5 kx fi
5 kx
5 kx # Detect whether system arithmetic is subject to x87-style double
5 kx # rounding issues. The result of this test has little meaning on non
5 kx # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
5 kx # mode is round-to-nearest and double rounding issues are present, and
5 kx # 0 otherwise. See http://bugs.python.org/issue2937 for more info.
5 kx AC_MSG_CHECKING(for x87-style double rounding)
5 kx # $BASECFLAGS may affect the result
5 kx ac_save_cc="$CC"
5 kx CC="$CC $BASECFLAGS"
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <stdlib.h>
5 kx #include <math.h>
5 kx int main() {
5 kx volatile double x, y, z;
5 kx /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
5 kx x = 0.99999999999999989; /* 1-2**-53 */
5 kx y = 1./x;
5 kx if (y != 1.)
5 kx exit(0);
5 kx /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
5 kx x = 1e16;
5 kx y = 2.99999;
5 kx z = x + y;
5 kx if (z != 1e16+4.)
5 kx exit(0);
5 kx /* both tests show evidence of double rounding */
5 kx exit(1);
5 kx }
5 kx ]])],
5 kx [ac_cv_x87_double_rounding=no],
5 kx [ac_cv_x87_double_rounding=yes],
5 kx [ac_cv_x87_double_rounding=no])
5 kx CC="$ac_save_cc"
5 kx AC_MSG_RESULT($ac_cv_x87_double_rounding)
5 kx if test "$ac_cv_x87_double_rounding" = yes
5 kx then
5 kx AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
5 kx [Define if arithmetic is subject to x87-style double rounding issue])
5 kx fi
5 kx
5 kx # ************************************
5 kx # * Check for mathematical functions *
5 kx # ************************************
5 kx
5 kx LIBS_SAVE=$LIBS
5 kx LIBS="$LIBS $LIBM"
5 kx
5 kx # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
5 kx # -0. on some architectures.
5 kx AC_MSG_CHECKING(whether tanh preserves the sign of zero)
5 kx AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <math.h>
5 kx #include <stdlib.h>
5 kx int main() {
5 kx /* return 0 if either negative zeros don't exist
5 kx on this platform or if negative zeros exist
5 kx and tanh(-0.) == -0. */
5 kx if (atan2(0., -1.) == atan2(-0., -1.) ||
5 kx atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
5 kx else exit(1);
5 kx }
5 kx ]])],
5 kx [ac_cv_tanh_preserves_zero_sign=yes],
5 kx [ac_cv_tanh_preserves_zero_sign=no],
5 kx [ac_cv_tanh_preserves_zero_sign=no])])
5 kx AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
5 kx if test "$ac_cv_tanh_preserves_zero_sign" = yes
5 kx then
5 kx AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
5 kx [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
5 kx fi
5 kx
5 kx AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
5 kx AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
5 kx AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
5 kx
5 kx LIBS=$LIBS_SAVE
5 kx
5 kx # For multiprocessing module, check that sem_open
5 kx # actually works. For FreeBSD versions <= 7.2,
5 kx # the kernel module that provides POSIX semaphores
5 kx # isn't loaded by default, so an attempt to call
5 kx # sem_open results in a 'Signal 12' error.
5 kx AC_MSG_CHECKING(whether POSIX semaphores are enabled)
5 kx AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <unistd.h>
5 kx #include <fcntl.h>
5 kx #include <stdio.h>
5 kx #include <semaphore.h>
5 kx #include <sys/stat.h>
5 kx
5 kx int main(void) {
5 kx sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
5 kx if (a == SEM_FAILED) {
5 kx perror("sem_open");
5 kx return 1;
5 kx }
5 kx sem_close(a);
5 kx sem_unlink("/autoconf");
5 kx return 0;
5 kx }
5 kx ]])],
5 kx [ac_cv_posix_semaphores_enabled=yes],
5 kx [ac_cv_posix_semaphores_enabled=no],
5 kx [ac_cv_posix_semaphores_enabled=yes])
5 kx )
5 kx AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
5 kx if test $ac_cv_posix_semaphores_enabled = no
5 kx then
5 kx AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
5 kx [Define if POSIX semaphores aren't enabled on your system])
5 kx fi
5 kx
5 kx # Multiprocessing check for broken sem_getvalue
5 kx AC_MSG_CHECKING(for broken sem_getvalue)
5 kx AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <unistd.h>
5 kx #include <fcntl.h>
5 kx #include <stdio.h>
5 kx #include <semaphore.h>
5 kx #include <sys/stat.h>
5 kx
5 kx int main(void){
5 kx sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
5 kx int count;
5 kx int res;
5 kx if(a==SEM_FAILED){
5 kx perror("sem_open");
5 kx return 1;
5 kx
5 kx }
5 kx res = sem_getvalue(a, &count);
5 kx sem_close(a);
5 kx sem_unlink("/autocftw");
5 kx return res==-1 ? 1 : 0;
5 kx }
5 kx ]])],
5 kx [ac_cv_broken_sem_getvalue=no],
5 kx [ac_cv_broken_sem_getvalue=yes],
5 kx [ac_cv_broken_sem_getvalue=yes])
5 kx )
5 kx AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
5 kx if test $ac_cv_broken_sem_getvalue = yes
5 kx then
5 kx AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
5 kx [define to 1 if your sem_getvalue is broken.])
5 kx fi
5 kx
5 kx # determine what size digit to use for Python's longs
5 kx AC_MSG_CHECKING([digit size for Python's longs])
5 kx AC_ARG_ENABLE(big-digits,
5 kx AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
5 kx [case $enable_big_digits in
5 kx yes)
5 kx enable_big_digits=30 ;;
5 kx no)
5 kx enable_big_digits=15 ;;
5 kx [15|30])
5 kx ;;
5 kx *)
5 kx AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
5 kx esac
5 kx AC_MSG_RESULT($enable_big_digits)
5 kx AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
5 kx ],
5 kx [AC_MSG_RESULT(no value specified)])
5 kx
5 kx # check for wchar.h
5 kx AC_CHECK_HEADER(wchar.h, [
5 kx AC_DEFINE(HAVE_WCHAR_H, 1,
5 kx [Define if the compiler provides a wchar.h header file.])
5 kx wchar_h="yes"
5 kx ],
5 kx wchar_h="no"
5 kx )
5 kx
5 kx # determine wchar_t size
5 kx if test "$wchar_h" = yes
5 kx then
5 kx AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(for UCS-4 tcl)
5 kx have_ucs4_tcl=no
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <tcl.h>
5 kx #if TCL_UTF_MAX != 6
5 kx # error "NOT UCS4_TCL"
5 kx #endif]], [[]])],[
5 kx AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
5 kx have_ucs4_tcl=yes
5 kx ],[])
5 kx AC_MSG_RESULT($have_ucs4_tcl)
5 kx
5 kx # check whether wchar_t is signed or not
5 kx if test "$wchar_h" = yes
5 kx then
5 kx # check whether wchar_t is signed or not
5 kx AC_MSG_CHECKING(whether wchar_t is signed)
5 kx AC_CACHE_VAL(ac_cv_wchar_t_signed, [
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <wchar.h>
5 kx int main()
5 kx {
5 kx /* Success: exit code 0 */
5 kx exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
5 kx }
5 kx ]])],
5 kx [ac_cv_wchar_t_signed=yes],
5 kx [ac_cv_wchar_t_signed=no],
5 kx [ac_cv_wchar_t_signed=yes])])
5 kx AC_MSG_RESULT($ac_cv_wchar_t_signed)
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(what type to use for unicode)
5 kx dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
5 kx AC_ARG_ENABLE(unicode,
5 kx AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is ucs2)]),
5 kx [],
5 kx [enable_unicode=yes])
5 kx
5 kx if test $enable_unicode = yes
5 kx then
5 kx # Without any arguments, Py_UNICODE defaults to two-byte mode
5 kx case "$have_ucs4_tcl" in
5 kx yes) enable_unicode="ucs4"
5 kx ;;
5 kx *) enable_unicode="ucs2"
5 kx ;;
5 kx esac
5 kx fi
5 kx
5 kx AH_TEMPLATE(Py_UNICODE_SIZE,
5 kx [Define as the size of the unicode type.])
5 kx case "$enable_unicode" in
5 kx ucs2) unicode_size="2"
5 kx AC_DEFINE(Py_UNICODE_SIZE,2)
5 kx ;;
5 kx ucs4) unicode_size="4"
5 kx AC_DEFINE(Py_UNICODE_SIZE,4)
5 kx ;;
5 kx no) ;; # To allow --disable-unicode
5 kx *) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
5 kx esac
5 kx
5 kx AH_TEMPLATE(PY_UNICODE_TYPE,
5 kx [Define as the integral type used for Unicode representation.])
5 kx
5 kx AC_SUBST(UNICODE_OBJS)
5 kx if test "$enable_unicode" = "no"
5 kx then
5 kx UNICODE_OBJS=""
5 kx AC_MSG_RESULT(not used)
5 kx else
5 kx UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
5 kx AC_DEFINE(Py_USING_UNICODE, 1,
5 kx [Define if you want to have a Unicode type.])
5 kx
5 kx # wchar_t is only usable if it maps to an unsigned type
5 kx if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
5 kx -a "$ac_cv_wchar_t_signed" = "no"
5 kx then
5 kx PY_UNICODE_TYPE="wchar_t"
5 kx AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
5 kx [Define if you have a useable wchar_t type defined in wchar.h; useable
5 kx means wchar_t must be an unsigned type with at least 16 bits. (see
5 kx Include/unicodeobject.h).])
5 kx AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
5 kx elif test "$ac_cv_sizeof_short" = "$unicode_size"
5 kx then
5 kx PY_UNICODE_TYPE="unsigned short"
5 kx AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
5 kx elif test "$ac_cv_sizeof_long" = "$unicode_size"
5 kx then
5 kx PY_UNICODE_TYPE="unsigned long"
5 kx AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
5 kx else
5 kx PY_UNICODE_TYPE="no type found"
5 kx fi
5 kx AC_MSG_RESULT($PY_UNICODE_TYPE)
5 kx fi
5 kx
5 kx # check for endianness
5 kx AC_C_BIGENDIAN
5 kx
5 kx # Check whether right shifting a negative integer extends the sign bit
5 kx # or fills with zeros (like the Cray J90, according to Tim Peters).
5 kx AC_MSG_CHECKING(whether right shift extends the sign bit)
5 kx AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx int main()
5 kx {
5 kx exit(((-1)>>3 == -1) ? 0 : 1);
5 kx }
5 kx ]])],
5 kx [ac_cv_rshift_extends_sign=yes],
5 kx [ac_cv_rshift_extends_sign=no],
5 kx [ac_cv_rshift_extends_sign=yes])])
5 kx AC_MSG_RESULT($ac_cv_rshift_extends_sign)
5 kx if test "$ac_cv_rshift_extends_sign" = no
5 kx then
5 kx AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
5 kx [Define if i>>j for signed int i does not extend the sign bit
5 kx when i < 0])
5 kx fi
5 kx
5 kx # check for getc_unlocked and related locking functions
5 kx AC_MSG_CHECKING(for getc_unlocked() and friends)
5 kx AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
5 kx FILE *f = fopen("/dev/null", "r");
5 kx flockfile(f);
5 kx getc_unlocked(f);
5 kx funlockfile(f);
5 kx ]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])])
5 kx AC_MSG_RESULT($ac_cv_have_getc_unlocked)
5 kx if test "$ac_cv_have_getc_unlocked" = yes
5 kx then
5 kx AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
5 kx [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
5 kx fi
5 kx
5 kx # check where readline lives
5 kx # save the value of LIBS so we don't actually link Python with readline
5 kx LIBS_no_readline=$LIBS
5 kx
5 kx # On some systems we need to link readline to a termcap compatible
5 kx # library. NOTE: Keep the precedence of listed libraries synchronised
5 kx # with setup.py.
5 kx py_cv_lib_readline=no
5 kx AC_MSG_CHECKING([how to link readline libs])
5 kx for py_libtermcap in "" ncursesw ncurses curses termcap; do
5 kx if test -z "$py_libtermcap"; then
5 kx READLINE_LIBS="-lreadline"
5 kx else
5 kx READLINE_LIBS="-lreadline -l$py_libtermcap"
5 kx fi
5 kx LIBS="$READLINE_LIBS $LIBS_no_readline"
5 kx AC_LINK_IFELSE(
5 kx [AC_LANG_CALL([],[readline])],
5 kx [py_cv_lib_readline=yes])
5 kx if test $py_cv_lib_readline = yes; then
5 kx break
5 kx fi
5 kx done
5 kx # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
5 kx #AC_SUBST([READLINE_LIBS])
5 kx if test $py_cv_lib_readline = no; then
5 kx AC_MSG_RESULT([none])
5 kx else
5 kx AC_MSG_RESULT([$READLINE_LIBS])
5 kx AC_DEFINE(HAVE_LIBREADLINE, 1,
5 kx [Define if you have the readline library (-lreadline).])
5 kx fi
5 kx
5 kx # check for readline 2.1
5 kx AC_CHECK_LIB(readline, rl_callback_handler_install,
5 kx AC_DEFINE(HAVE_RL_CALLBACK, 1,
5 kx [Define if you have readline 2.1]), ,$READLINE_LIBS)
5 kx
5 kx # check for readline 2.2
5 kx AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
5 kx [have_readline=yes],
5 kx [have_readline=no]
5 kx )
5 kx if test $have_readline = yes
5 kx then
5 kx AC_EGREP_HEADER([extern int rl_completion_append_character;],
5 kx [readline/readline.h],
5 kx AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
5 kx [Define if you have readline 2.2]), )
5 kx AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
5 kx [readline/readline.h],
5 kx AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
5 kx [Define if you have rl_completion_suppress_append]), )
5 kx fi
5 kx
5 kx # check for readline 4.0
5 kx AC_CHECK_LIB(readline, rl_pre_input_hook,
5 kx AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
5 kx [Define if you have readline 4.0]), ,$READLINE_LIBS)
5 kx
5 kx # also in 4.0
5 kx AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
5 kx AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
5 kx [Define if you have readline 4.0]), ,$READLINE_LIBS)
5 kx
5 kx # also in 4.0, but not in editline
5 kx AC_CHECK_LIB(readline, rl_resize_terminal,
5 kx AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1,
5 kx [Define if you have readline 4.0]), ,$READLINE_LIBS)
5 kx
5 kx # check for readline 4.2
5 kx AC_CHECK_LIB(readline, rl_completion_matches,
5 kx AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
5 kx [Define if you have readline 4.2]), ,$READLINE_LIBS)
5 kx
5 kx # also in readline 4.2
5 kx AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
5 kx [have_readline=yes],
5 kx [have_readline=no]
5 kx )
5 kx if test $have_readline = yes
5 kx then
5 kx AC_EGREP_HEADER([extern int rl_catch_signals;],
5 kx [readline/readline.h],
5 kx AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
5 kx [Define if you can turn off readline's signal handling.]), )
5 kx fi
5 kx
5 kx # End of readline checks: restore LIBS
5 kx LIBS=$LIBS_no_readline
5 kx
5 kx AC_MSG_CHECKING(for broken nice())
5 kx AC_CACHE_VAL(ac_cv_broken_nice, [
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <stdlib.h>
5 kx #include <unistd.h>
5 kx int main()
5 kx {
5 kx int val1 = nice(1);
5 kx if (val1 != -1 && val1 == nice(2))
5 kx exit(0);
5 kx exit(1);
5 kx }
5 kx ]])],
5 kx [ac_cv_broken_nice=yes],
5 kx [ac_cv_broken_nice=no],
5 kx [ac_cv_broken_nice=no])])
5 kx AC_MSG_RESULT($ac_cv_broken_nice)
5 kx if test "$ac_cv_broken_nice" = yes
5 kx then
5 kx AC_DEFINE(HAVE_BROKEN_NICE, 1,
5 kx [Define if nice() returns success/failure instead of the new priority.])
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(for broken poll())
5 kx AC_CACHE_VAL(ac_cv_broken_poll,
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <poll.h>
5 kx
5 kx int main()
5 kx {
5 kx struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
5 kx int poll_test;
5 kx
5 kx close (42);
5 kx
5 kx poll_test = poll(&poll_struct, 1, 0);
5 kx if (poll_test < 0)
5 kx return 0;
5 kx else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
5 kx return 0;
5 kx else
5 kx return 1;
5 kx }
5 kx ]])],
5 kx [ac_cv_broken_poll=yes],
5 kx [ac_cv_broken_poll=no],
5 kx [ac_cv_broken_poll=no]))
5 kx AC_MSG_RESULT($ac_cv_broken_poll)
5 kx if test "$ac_cv_broken_poll" = yes
5 kx then
5 kx AC_DEFINE(HAVE_BROKEN_POLL, 1,
5 kx [Define if poll() sets errno on invalid file descriptors.])
5 kx fi
5 kx
5 kx # check tzset(3) exists and works like we expect it to
5 kx AC_MSG_CHECKING(for working tzset())
5 kx AC_CACHE_VAL(ac_cv_working_tzset, [
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <stdlib.h>
5 kx #include <time.h>
5 kx #include <string.h>
5 kx
5 kx #if HAVE_TZNAME
5 kx extern char *tzname[];
5 kx #endif
5 kx
5 kx int main()
5 kx {
5 kx /* Note that we need to ensure that not only does tzset(3)
5 kx do 'something' with localtime, but it works as documented
5 kx in the library reference and as expected by the test suite.
5 kx This includes making sure that tzname is set properly if
5 kx tm->tm_zone does not exist since it is the alternative way
5 kx of getting timezone info.
5 kx
5 kx Red Hat 6.2 doesn't understand the southern hemisphere
5 kx after New Year's Day.
5 kx */
5 kx
5 kx time_t groundhogday = 1044144000; /* GMT-based */
5 kx time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
5 kx
5 kx putenv("TZ=UTC+0");
5 kx tzset();
5 kx if (localtime(&groundhogday)->tm_hour != 0)
5 kx exit(1);
5 kx #if HAVE_TZNAME
5 kx /* For UTC, tzname[1] is sometimes "", sometimes " " */
5 kx if (strcmp(tzname[0], "UTC") ||
5 kx (tzname[1][0] != 0 && tzname[1][0] != ' '))
5 kx exit(1);
5 kx #endif
5 kx
5 kx putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
5 kx tzset();
5 kx if (localtime(&groundhogday)->tm_hour != 19)
5 kx exit(1);
5 kx #if HAVE_TZNAME
5 kx if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
5 kx exit(1);
5 kx #endif
5 kx
5 kx putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
5 kx tzset();
5 kx if (localtime(&groundhogday)->tm_hour != 11)
5 kx exit(1);
5 kx #if HAVE_TZNAME
5 kx if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
5 kx exit(1);
5 kx #endif
5 kx
5 kx #if HAVE_STRUCT_TM_TM_ZONE
5 kx if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
5 kx exit(1);
5 kx if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
5 kx exit(1);
5 kx #endif
5 kx
5 kx exit(0);
5 kx }
5 kx ]])],
5 kx [ac_cv_working_tzset=yes],
5 kx [ac_cv_working_tzset=no],
5 kx [ac_cv_working_tzset=no])])
5 kx AC_MSG_RESULT($ac_cv_working_tzset)
5 kx if test "$ac_cv_working_tzset" = yes
5 kx then
5 kx AC_DEFINE(HAVE_WORKING_TZSET, 1,
5 kx [Define if tzset() actually switches the local timezone in a meaningful way.])
5 kx fi
5 kx
5 kx # Look for subsecond timestamps in struct stat
5 kx AC_MSG_CHECKING(for tv_nsec in struct stat)
5 kx AC_CACHE_VAL(ac_cv_stat_tv_nsec,
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
5 kx struct stat st;
5 kx st.st_mtim.tv_nsec = 1;
5 kx ]])],
5 kx [ac_cv_stat_tv_nsec=yes],
5 kx [ac_cv_stat_tv_nsec=no]))
5 kx AC_MSG_RESULT($ac_cv_stat_tv_nsec)
5 kx if test "$ac_cv_stat_tv_nsec" = yes
5 kx then
5 kx AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
5 kx [Define if you have struct stat.st_mtim.tv_nsec])
5 kx fi
5 kx
5 kx # Look for BSD style subsecond timestamps in struct stat
5 kx AC_MSG_CHECKING(for tv_nsec2 in struct stat)
5 kx AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
5 kx struct stat st;
5 kx st.st_mtimespec.tv_nsec = 1;
5 kx ]])],
5 kx [ac_cv_stat_tv_nsec2=yes],
5 kx [ac_cv_stat_tv_nsec2=no]))
5 kx AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
5 kx if test "$ac_cv_stat_tv_nsec2" = yes
5 kx then
5 kx AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
5 kx [Define if you have struct stat.st_mtimensec])
5 kx fi
5 kx
5 kx # first curses configure check
5 kx ac_save_cppflags="$CPPFLAGS"
5 kx CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
5 kx
5 kx AC_CHECK_HEADERS(curses.h ncurses.h)
5 kx
5 kx # On Solaris, term.h requires curses.h
5 kx AC_CHECK_HEADERS(term.h,,,[
5 kx #ifdef HAVE_CURSES_H
5 kx #include <curses.h>
5 kx #endif
5 kx ])
5 kx
5 kx # On HP/UX 11.0, mvwdelch is a block with a return statement
5 kx AC_MSG_CHECKING(whether mvwdelch is an expression)
5 kx AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
5 kx int rtn;
5 kx rtn = mvwdelch(0,0,0);
5 kx ]])],
5 kx [ac_cv_mvwdelch_is_expression=yes],
5 kx [ac_cv_mvwdelch_is_expression=no]))
5 kx AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
5 kx
5 kx if test "$ac_cv_mvwdelch_is_expression" = yes
5 kx then
5 kx AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
5 kx [Define if mvwdelch in curses.h is an expression.])
5 kx fi
5 kx
5 kx # Issue #25720: ncurses has introduced the NCURSES_OPAQUE symbol making opaque
5 kx # structs since version 5.7. If the macro is defined as zero before including
5 kx # [n]curses.h, ncurses will expose fields of the structs regardless of the
5 kx # configuration.
5 kx AC_MSG_CHECKING(whether WINDOW has _flags)
5 kx AC_CACHE_VAL(ac_cv_window_has_flags,
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #define NCURSES_OPAQUE 0
5 kx #include <curses.h>
5 kx ]], [[
5 kx WINDOW *w;
5 kx w->_flags = 0;
5 kx ]])],
5 kx [ac_cv_window_has_flags=yes],
5 kx [ac_cv_window_has_flags=no]))
5 kx AC_MSG_RESULT($ac_cv_window_has_flags)
5 kx
5 kx
5 kx if test "$ac_cv_window_has_flags" = yes
5 kx then
5 kx AC_DEFINE(WINDOW_HAS_FLAGS, 1,
5 kx [Define if WINDOW in curses.h offers a field _flags.])
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(for is_pad)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
5 kx #ifndef is_pad
5 kx void *x=is_pad
5 kx #endif
5 kx ]])],
5 kx [AC_DEFINE(HAVE_CURSES_IS_PAD, 1, Define if you have the 'is_pad' function or macro.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for is_term_resized)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])],
5 kx [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for resize_term)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])],
5 kx [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for resizeterm)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])],
5 kx [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for immedok)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
5 kx #ifndef immedok
5 kx void *x=immedok
5 kx #endif
5 kx ]])],
5 kx [AC_DEFINE(HAVE_CURSES_IMMEDOK, 1, Define if you have the 'immedok' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for syncok)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
5 kx #ifndef syncok
5 kx void *x=syncok
5 kx #endif
5 kx ]])],
5 kx [AC_DEFINE(HAVE_CURSES_SYNCOK, 1, Define if you have the 'syncok' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for wchgat)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
5 kx #ifndef wchgat
5 kx void *x=wchgat
5 kx #endif
5 kx ]])],
5 kx [AC_DEFINE(HAVE_CURSES_WCHGAT, 1, Define if you have the 'wchgat' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for filter)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
5 kx #ifndef filter
5 kx void *x=filter
5 kx #endif
5 kx ]])],
5 kx [AC_DEFINE(HAVE_CURSES_FILTER, 1, Define if you have the 'filter' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for has_key)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
5 kx #ifndef has_key
5 kx void *x=has_key
5 kx #endif
5 kx ]])],
5 kx [AC_DEFINE(HAVE_CURSES_HAS_KEY, 1, Define if you have the 'has_key' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for typeahead)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
5 kx #ifndef typeahead
5 kx void *x=typeahead
5 kx #endif
5 kx ]])],
5 kx [AC_DEFINE(HAVE_CURSES_TYPEAHEAD, 1, Define if you have the 'typeahead' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for use_env)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
5 kx #ifndef use_env
5 kx void *x=use_env
5 kx #endif
5 kx ]])],
5 kx [AC_DEFINE(HAVE_CURSES_USE_ENV, 1, Define if you have the 'use_env' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx # last curses configure check
5 kx CPPFLAGS=$ac_save_cppflags
5 kx
5 kx AC_MSG_NOTICE([checking for device files])
5 kx
5 kx dnl NOTE: Inform user how to proceed with files when cross compiling.
5 kx if test "x$cross_compiling" = xyes; then
5 kx if test "${ac_cv_file__dev_ptmx+set}" != set; then
5 kx AC_MSG_CHECKING([for /dev/ptmx])
5 kx AC_MSG_RESULT([not set])
5 kx AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
5 kx fi
5 kx if test "${ac_cv_file__dev_ptc+set}" != set; then
5 kx AC_MSG_CHECKING([for /dev/ptc])
5 kx AC_MSG_RESULT([not set])
5 kx AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling])
5 kx fi
5 kx fi
5 kx
5 kx AC_CHECK_FILE(/dev/ptmx, [], [])
5 kx if test "x$ac_cv_file__dev_ptmx" = xyes; then
5 kx AC_DEFINE(HAVE_DEV_PTMX, 1,
5 kx [Define to 1 if you have the /dev/ptmx device file.])
5 kx fi
5 kx AC_CHECK_FILE(/dev/ptc, [], [])
5 kx if test "x$ac_cv_file__dev_ptc" = xyes; then
5 kx AC_DEFINE(HAVE_DEV_PTC, 1,
5 kx [Define to 1 if you have the /dev/ptc device file.])
5 kx fi
5 kx
5 kx if test "$have_long_long" = yes
5 kx then
5 kx AC_MSG_CHECKING(for %lld and %llu printf() format support)
5 kx AC_CACHE_VAL(ac_cv_have_long_long_format,
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[[
5 kx #include <stdio.h>
5 kx #include <stddef.h>
5 kx #include <string.h>
5 kx
5 kx #ifdef HAVE_SYS_TYPES_H
5 kx #include <sys/types.h>
5 kx #endif
5 kx
5 kx int main()
5 kx {
5 kx char buffer[256];
5 kx
5 kx if (sprintf(buffer, "%lld", (long long)123) < 0)
5 kx return 1;
5 kx if (strcmp(buffer, "123"))
5 kx return 1;
5 kx
5 kx if (sprintf(buffer, "%lld", (long long)-123) < 0)
5 kx return 1;
5 kx if (strcmp(buffer, "-123"))
5 kx return 1;
5 kx
5 kx if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
5 kx return 1;
5 kx if (strcmp(buffer, "123"))
5 kx return 1;
5 kx
5 kx return 0;
5 kx }
5 kx ]]])],
5 kx [ac_cv_have_long_long_format=yes],
5 kx [ac_cv_have_long_long_format=no],
5 kx [ac_cv_have_long_long_format="cross -- assuming no"
5 kx if test x$GCC = xyes; then
5 kx save_CFLAGS=$CFLAGS
5 kx CFLAGS="$CFLAGS -Werror -Wformat"
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <stdio.h>
5 kx #include <stddef.h>
5 kx ]], [[
5 kx char *buffer;
5 kx sprintf(buffer, "%lld", (long long)123);
5 kx sprintf(buffer, "%lld", (long long)-123);
5 kx sprintf(buffer, "%llu", (unsigned long long)123);
5 kx ]])],
5 kx ac_cv_have_long_long_format=yes
5 kx )
5 kx CFLAGS=$save_CFLAGS
5 kx fi])
5 kx )
5 kx AC_MSG_RESULT($ac_cv_have_long_long_format)
5 kx fi
5 kx
5 kx if test "$ac_cv_have_long_long_format" = yes
5 kx then
5 kx AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
5 kx [Define to printf format modifier for long long type])
5 kx fi
5 kx
5 kx if test $ac_sys_system = Darwin
5 kx then
5 kx LIBS="$LIBS -framework CoreFoundation"
5 kx fi
5 kx
5 kx
5 kx AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <stdio.h>
5 kx #include <stddef.h>
5 kx #include <string.h>
5 kx
5 kx #ifdef HAVE_SYS_TYPES_H
5 kx #include <sys/types.h>
5 kx #endif
5 kx
5 kx #ifdef HAVE_SSIZE_T
5 kx typedef ssize_t Py_ssize_t;
5 kx #elif SIZEOF_VOID_P == SIZEOF_LONG
5 kx typedef long Py_ssize_t;
5 kx #else
5 kx typedef int Py_ssize_t;
5 kx #endif
5 kx
5 kx int main()
5 kx {
5 kx char buffer[256];
5 kx
5 kx if(sprintf(buffer, "%zd", (size_t)123) < 0)
5 kx return 1;
5 kx
5 kx if (strcmp(buffer, "123"))
5 kx return 1;
5 kx
5 kx if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
5 kx return 1;
5 kx
5 kx if (strcmp(buffer, "-123"))
5 kx return 1;
5 kx
5 kx return 0;
5 kx }
5 kx ]])],
5 kx [ac_cv_have_size_t_format=yes],
5 kx [ac_cv_have_size_t_format=no],
5 kx [ac_cv_have_size_t_format="cross -- assuming yes"
5 kx ])])
5 kx if test "$ac_cv_have_size_t_format" != no ; then
5 kx AC_DEFINE(PY_FORMAT_SIZE_T, "z",
5 kx [Define to printf format modifier for Py_ssize_t])
5 kx fi
5 kx
5 kx AC_CHECK_TYPE(socklen_t,,
5 kx AC_DEFINE(socklen_t,int,
5 kx [Define to `int' if <sys/socket.h> does not define.]),[
5 kx #ifdef HAVE_SYS_TYPES_H
5 kx #include <sys/types.h>
5 kx #endif
5 kx #ifdef HAVE_SYS_SOCKET_H
5 kx #include <sys/socket.h>
5 kx #endif
5 kx ])
5 kx
5 kx case $ac_sys_system in
5 kx AIX*)
5 kx AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;;
5 kx esac
5 kx
5 kx
5 kx AC_SUBST(THREADHEADERS)
5 kx
5 kx for h in `(cd $srcdir;echo Python/thread_*.h)`
5 kx do
5 kx THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
5 kx done
5 kx
5 kx AC_SUBST(SRCDIRS)
5 kx SRCDIRS="Parser Objects Python Modules Modules/_io"
5 kx AC_MSG_CHECKING(for build directories)
5 kx for dir in $SRCDIRS; do
5 kx if test ! -d $dir; then
5 kx mkdir $dir
5 kx fi
5 kx done
5 kx
5 kx # BEGIN_COMPUTED_GOTO
5 kx # Check for --with-computed-gotos
5 kx AC_MSG_CHECKING(for --with-computed-gotos)
5 kx AC_ARG_WITH(computed-gotos,
5 kx AS_HELP_STRING([--with(out)-computed-gotos],
5 kx [Use computed gotos in evaluation loop (enabled by default on supported compilers)]),
5 kx [
5 kx if test "$withval" = yes
5 kx then
5 kx AC_DEFINE(USE_COMPUTED_GOTOS, 1,
5 kx [Define if you want to use computed gotos in ceval.c.])
5 kx AC_MSG_RESULT(yes)
5 kx fi
5 kx if test "$withval" = no
5 kx then
5 kx AC_DEFINE(USE_COMPUTED_GOTOS, 0,
5 kx [Define if you want to use computed gotos in ceval.c.])
5 kx AC_MSG_RESULT(no)
5 kx fi
5 kx ],
5 kx [AC_MSG_RESULT(no value specified)])
5 kx
5 kx AC_MSG_CHECKING(whether $CC supports computed gotos)
5 kx AC_CACHE_VAL(ac_cv_computed_gotos,
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[[
5 kx int main(int argc, char **argv)
5 kx {
5 kx static void *targets[1] = { &&LABEL1 };
5 kx goto LABEL2;
5 kx LABEL1:
5 kx return 0;
5 kx LABEL2:
5 kx goto *targets[0];
5 kx return 1;
5 kx }
5 kx ]]])],
5 kx [ac_cv_computed_gotos=yes],
5 kx [ac_cv_computed_gotos=no],
5 kx [if test "${with_computed_gotos+set}" = set; then
5 kx ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos"
5 kx else
5 kx ac_cv_computed_gotos=no
5 kx fi]))
5 kx AC_MSG_RESULT($ac_cv_computed_gotos)
5 kx case "$ac_cv_computed_gotos" in yes*)
5 kx AC_DEFINE(HAVE_COMPUTED_GOTOS, 1,
5 kx [Define if the C compiler supports computed gotos.])
5 kx esac
5 kx # END_COMPUTED_GOTO
5 kx
5 kx AC_MSG_RESULT(done)
5 kx
5 kx # ensurepip option
5 kx AC_MSG_CHECKING(for ensurepip)
5 kx AC_ARG_WITH(ensurepip,
5 kx [AS_HELP_STRING([--with(out)-ensurepip=@<:@=OPTION@:>@],
5 kx ["install" or "upgrade" using bundled pip, default is "no"])],
5 kx [],
5 kx [with_ensurepip=no])
5 kx AS_CASE($with_ensurepip,
5 kx [yes|upgrade],[ENSUREPIP=upgrade],
5 kx [install],[ENSUREPIP=install],
5 kx [no],[ENSUREPIP=no],
5 kx [AC_MSG_ERROR([--with-ensurepip=upgrade|install|no])])
5 kx AC_MSG_RESULT($ENSUREPIP)
5 kx AC_SUBST(ENSUREPIP)
5 kx
5 kx # generate output files
5 kx AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
5 kx AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
5 kx AC_OUTPUT
5 kx
5 kx echo "creating Modules/Setup"
5 kx if test ! -f Modules/Setup
5 kx then
5 kx cp $srcdir/Modules/Setup.dist Modules/Setup
5 kx fi
5 kx
5 kx echo "creating Modules/Setup.local"
5 kx if test ! -f Modules/Setup.local
5 kx then
5 kx echo "# Edit this file for local setup changes" >Modules/Setup.local
5 kx fi
5 kx
5 kx echo "creating Makefile"
5 kx $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
5 kx -s Modules Modules/Setup.config \
5 kx Modules/Setup.local Modules/Setup
5 kx
5 kx case $ac_sys_system in
5 kx BeOS)
5 kx AC_MSG_WARN([
5 kx
5 kx Support for BeOS is deprecated as of Python 2.6.
5 kx See PEP 11 for the gory details.
5 kx ])
5 kx ;;
5 kx *) ;;
5 kx esac
5 kx
5 kx mv config.c Modules
5 kx
5 kx if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then
5 kx echo "" >&AS_MESSAGE_FD
5 kx echo "" >&AS_MESSAGE_FD
5 kx echo "If you want a release build with all optimizations active (LTO, PGO, etc),"
5 kx echo "please run ./configure --enable-optimizations" >&AS_MESSAGE_FD
5 kx echo "" >&AS_MESSAGE_FD
5 kx echo "" >&AS_MESSAGE_FD
5 kx fi