5 kx dnl ***************************************************
5 kx dnl * Please run autoreconf -if to test your changes! *
5 kx dnl ***************************************************
5 kx dnl
5 kx dnl Python's configure.ac file requires autoconf 2.69 and autoconf-archive.
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, 3.10)
5 kx
5 kx AC_PREREQ([2.69])
5 kx
5 kx AC_INIT([python],[PYTHON_VERSION],[https://github.com/python/cpython/issues/])
5 kx
5 kx m4_ifdef(
5 kx [AX_C_FLOAT_WORDS_BIGENDIAN],
5 kx [],
5 kx [AC_MSG_ERROR([Please install autoconf-archive package and re-run autoreconf])]
5 kx )
5 kx
5 kx AC_SUBST(BASECPPFLAGS)
5 kx if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
5 kx # If we're building out-of-tree, we need to make sure the following
5 kx # resources get picked up before their $srcdir counterparts.
5 kx # Objects/ -> typeslots.inc
5 kx # Include/ -> Python.h
5 kx # Python/ -> importlib.h
5 kx # (A side effect of this is that these resources will automatically be
5 kx # regenerated when building out-of-tree, regardless of whether or not
5 kx # the $srcdir counterpart is up-to-date. This is an acceptable trade
5 kx # off.)
5 kx BASECPPFLAGS="-IObjects -IInclude -IPython"
5 kx else
5 kx BASECPPFLAGS=""
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 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) $(PYTHON3)'
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 # Version number of Python's own shared library file.
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 # 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@:>@],
5 kx [create a universal binary build.
5 kx SDKDIR specifies which macOS SDK should be used to perform the build,
5 kx see Mac/README.rst. (default is no)]),
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_SUBST(LIPO_INTEL64_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],
5 kx [specify the kind of macOS universal binary that should be created.
5 kx This option is only valid when --enable-universalsdk is set; options are:
5 kx ("universal2", "intel-64", "intel-32", "intel", "32-bit",
5 kx "64-bit", "3-way", or "all")
5 kx see Mac/README.rst]),
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 the name for the python framework on macOS
5 kx only valid when --enable-framework is set. see Mac/README.rst
5 kx (default is 'Python')]),
5 kx [
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@:>@],
5 kx [create a Python.framework rather than a traditional Unix install.
5 kx optional INSTALLDIR specifies the installation path. see Mac/README.rst
5 kx (default is no)]),
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 FRAMEWORKPYTHONW=
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 "
5 kx FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
5 kx FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
5 kx FRAMEWORKPYTHONW="frameworkpythonw"
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/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 FRAMEWORKPYTHONW=
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(FRAMEWORKPYTHONW)
5 kx AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
5 kx AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
5 kx
5 kx AC_DEFINE_UNQUOTED(_PYTHONFRAMEWORK, "${PYTHONFRAMEWORK}", [framework name])
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_ARG_VAR([MACHDEP], [name for machine-dependent library files])
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 used for setting
5 kx # a lot of different things including 'define_xopen_source'
5 kx # in the case statement below.
5 kx case "$host" in
5 kx *-*-linux-android*)
5 kx ac_sys_system=Linux-android
5 kx ;;
5 kx *-*-linux*)
5 kx ac_sys_system=Linux
5 kx ;;
5 kx *-*-cygwin*)
5 kx ac_sys_system=Cygwin
5 kx ;;
5 kx *-*-vxworks*)
5 kx ac_sys_system=VxWorks
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 aix*) MACHDEP="aix";;
5 kx linux*) MACHDEP="linux";;
5 kx cygwin*) MACHDEP="cygwin";;
5 kx darwin*) MACHDEP="darwin";;
5 kx '') MACHDEP="unknown";;
5 kx esac
5 kx fi
5 kx AC_MSG_RESULT("$MACHDEP")
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 *-*-vxworks*)
5 kx _host_cpu=$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 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/@<:@[12]@:>@@<:@0-9@:>@.*)
5 kx define_xopen_source=no;;
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 # On VxWorks, defining _XOPEN_SOURCE causes compile failures
5 kx # in network headers still using system V types.
5 kx VxWorks/*)
5 kx define_xopen_source=no
5 kx ;;
5 kx
5 kx # On HP-UX, defining _XOPEN_SOURCE to 600 or greater hides
5 kx # chroot() and other functions
5 kx hp*|HP*)
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 # X/Open 7, incorporating POSIX.1-2008
5 kx AC_DEFINE(_XOPEN_SOURCE, 700,
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, 200809L, Define to activate features from IEEE Stds 1003.1-2008)
5 kx fi
5 kx
5 kx # On HP-UX mbstate_t requires _INCLUDE__STDC_A1_SOURCE
5 kx case $ac_sys_system in
5 kx hp*|HP*)
5 kx define_stdc_a1=yes;;
5 kx *)
5 kx define_stdc_a1=no;;
5 kx esac
5 kx
5 kx if test $define_stdc_a1 = yes
5 kx then
5 kx AC_DEFINE(_INCLUDE__STDC_A1_SOURCE, 1, Define to include mbstate_t for mbrtowc)
5 kx fi
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 # 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 # Don't let AC_PROG_CC set the default CFLAGS. It normally sets -g -O2
5 kx # when the compiler supports them, but we don't always want -O2, and
5 kx # we set -g later.
5 kx if test -z "$CFLAGS"; then
5 kx CFLAGS=
5 kx fi
5 kx
5 kx if test "$ac_sys_system" = "Darwin"
5 kx then
5 kx # Compiler selection on MacOSX is more complicated than
5 kx # AC_PROG_CC can handle, see Mac/README for more
5 kx # information
5 kx if test -z "${CC}"
5 kx then
5 kx found_gcc=
5 kx found_clang=
5 kx as_save_IFS=$IFS; IFS=:
5 kx for as_dir in $PATH
5 kx do
5 kx IFS=$as_save_IFS
5 kx if test -x "${as_dir}/gcc"; then
5 kx if test -z "${found_gcc}"; then
5 kx found_gcc="${as_dir}/gcc"
5 kx fi
5 kx fi
5 kx if test -x "${as_dir}/clang"; then
5 kx if test -z "${found_clang}"; then
5 kx found_clang="${as_dir}/clang"
5 kx fi
5 kx fi
5 kx done
5 kx IFS=$as_save_IFS
5 kx
5 kx if test -n "$found_gcc" -a -n "$found_clang"
5 kx then
5 kx if test -n "`"$found_gcc" --version | grep llvm-gcc`"
5 kx then
5 kx AC_MSG_NOTICE([Detected llvm-gcc, falling back to clang])
5 kx CC="$found_clang"
5 kx CXX="$found_clang++"
5 kx fi
5 kx
5 kx
5 kx elif test -z "$found_gcc" -a -n "$found_clang"
5 kx then
5 kx AC_MSG_NOTICE([No GCC found, use CLANG])
5 kx CC="$found_clang"
5 kx CXX="$found_clang++"
5 kx
5 kx elif test -z "$found_gcc" -a -z "$found_clang"
5 kx then
5 kx found_clang=`/usr/bin/xcrun -find clang 2>/dev/null`
5 kx if test -n "${found_clang}"
5 kx then
5 kx AC_MSG_NOTICE([Using clang from Xcode.app])
5 kx CC="${found_clang}"
5 kx CXX="`/usr/bin/xcrun -find clang++`"
5 kx
5 kx # else: use default behaviour
5 kx fi
5 kx fi
5 kx fi
5 kx fi
5 kx AC_PROG_CC
5 kx AC_PROG_CPP
5 kx AC_PROG_GREP
5 kx AC_PROG_SED
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 specified in COMPILER (default is $CXX)]),
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 clang|*/clang) AC_PATH_TOOL(CXX, [clang++], [clang++], [notfound]) ;;
5 kx icc|*/icc) AC_PATH_TOOL(CXX, [icpc], [icpc], [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_NOTICE([
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
5 kx AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
5 kx cat >> conftest.c <<EOF
5 kx #undef bfin
5 kx #undef cris
5 kx #undef fr30
5 kx #undef linux
5 kx #undef hppa
5 kx #undef hpux
5 kx #undef i386
5 kx #undef mips
5 kx #undef powerpc
5 kx #undef sparc
5 kx #undef unix
5 kx #if defined(__ANDROID__)
5 kx # Android is not a multiarch system.
5 kx #elif defined(__linux__)
5 kx # if defined(__x86_64__) && defined(__LP64__)
5 kx x86_64-linux-gnu
5 kx # elif defined(__x86_64__) && defined(__ILP32__)
5 kx x86_64-linux-gnux32
5 kx # elif defined(__i386__)
5 kx i386-linux-gnu
5 kx # elif defined(__aarch64__) && defined(__AARCH64EL__)
5 kx # if defined(__ILP32__)
5 kx aarch64_ilp32-linux-gnu
5 kx # else
5 kx aarch64-linux-gnu
5 kx # endif
5 kx # elif defined(__aarch64__) && defined(__AARCH64EB__)
5 kx # if defined(__ILP32__)
5 kx aarch64_be_ilp32-linux-gnu
5 kx # else
5 kx aarch64_be-linux-gnu
5 kx # endif
5 kx # elif defined(__alpha__)
5 kx alpha-linux-gnu
5 kx # elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
5 kx # if defined(__ARMEL__)
5 kx arm-linux-gnueabihf
5 kx # else
5 kx armeb-linux-gnueabihf
5 kx # endif
5 kx # elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
5 kx # if defined(__ARMEL__)
5 kx arm-linux-gnueabi
5 kx # else
5 kx armeb-linux-gnueabi
5 kx # endif
5 kx # elif defined(__hppa__)
5 kx hppa-linux-gnu
5 kx # elif defined(__ia64__)
5 kx ia64-linux-gnu
5 kx # elif defined(__m68k__) && !defined(__mcoldfire__)
5 kx m68k-linux-gnu
5 kx # elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL)
5 kx # if _MIPS_SIM == _ABIO32
5 kx mipsisa32r6el-linux-gnu
5 kx # elif _MIPS_SIM == _ABIN32
5 kx mipsisa64r6el-linux-gnuabin32
5 kx # elif _MIPS_SIM == _ABI64
5 kx mipsisa64r6el-linux-gnuabi64
5 kx # else
5 kx # error unknown platform triplet
5 kx # endif
5 kx # elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6)
5 kx # if _MIPS_SIM == _ABIO32
5 kx mipsisa32r6-linux-gnu
5 kx # elif _MIPS_SIM == _ABIN32
5 kx mipsisa64r6-linux-gnuabin32
5 kx # elif _MIPS_SIM == _ABI64
5 kx mipsisa64r6-linux-gnuabi64
5 kx # else
5 kx # error unknown platform triplet
5 kx # endif
5 kx # elif defined(__mips_hard_float) && defined(_MIPSEL)
5 kx # if _MIPS_SIM == _ABIO32
5 kx mipsel-linux-gnu
5 kx # elif _MIPS_SIM == _ABIN32
5 kx mips64el-linux-gnuabin32
5 kx # elif _MIPS_SIM == _ABI64
5 kx mips64el-linux-gnuabi64
5 kx # else
5 kx # error unknown platform triplet
5 kx # endif
5 kx # elif defined(__mips_hard_float)
5 kx # if _MIPS_SIM == _ABIO32
5 kx mips-linux-gnu
5 kx # elif _MIPS_SIM == _ABIN32
5 kx mips64-linux-gnuabin32
5 kx # elif _MIPS_SIM == _ABI64
5 kx mips64-linux-gnuabi64
5 kx # else
5 kx # error unknown platform triplet
5 kx # endif
5 kx # elif defined(__or1k__)
5 kx or1k-linux-gnu
5 kx # elif defined(__powerpc__) && defined(__SPE__)
5 kx powerpc-linux-gnuspe
5 kx # elif defined(__powerpc64__)
5 kx # if defined(__LITTLE_ENDIAN__)
5 kx powerpc64le-linux-gnu
5 kx # else
5 kx powerpc64-linux-gnu
5 kx # endif
5 kx # elif defined(__powerpc__)
5 kx powerpc-linux-gnu
5 kx # elif defined(__s390x__)
5 kx s390x-linux-gnu
5 kx # elif defined(__s390__)
5 kx s390-linux-gnu
5 kx # elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
5 kx sh4-linux-gnu
5 kx # elif defined(__sparc__) && defined(__arch64__)
5 kx sparc64-linux-gnu
5 kx # elif defined(__sparc__)
5 kx sparc-linux-gnu
5 kx # elif defined(__riscv)
5 kx # if __riscv_xlen == 32
5 kx riscv32-linux-gnu
5 kx # elif __riscv_xlen == 64
5 kx riscv64-linux-gnu
5 kx # else
5 kx # error unknown platform triplet
5 kx # endif
5 kx # else
5 kx # error unknown platform triplet
5 kx # endif
5 kx #elif defined(__FreeBSD_kernel__)
5 kx # if defined(__LP64__)
5 kx x86_64-kfreebsd-gnu
5 kx # elif defined(__i386__)
5 kx i386-kfreebsd-gnu
5 kx # else
5 kx # error unknown platform triplet
5 kx # endif
5 kx #elif defined(__gnu_hurd__)
5 kx i386-gnu
5 kx #elif defined(__APPLE__)
5 kx darwin
5 kx #elif defined(__VXWORKS__)
5 kx vxworks
5 kx #else
5 kx # error unknown platform triplet
5 kx #endif
5 kx
5 kx EOF
5 kx
5 kx if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
5 kx PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
5 kx AC_MSG_RESULT([$PLATFORM_TRIPLET])
5 kx else
5 kx AC_MSG_RESULT([none])
5 kx fi
5 kx rm -f conftest.c conftest.out
5 kx
5 kx AC_MSG_CHECKING([for multiarch])
5 kx AS_CASE([$ac_sys_system],
5 kx [Darwin*], [MULTIARCH=""],
5 kx [FreeBSD*], [MULTIARCH=""],
5 kx [MULTIARCH=$($CC --print-multiarch 2>/dev/null)]
5 kx )
5 kx AC_SUBST([MULTIARCH])
5 kx AC_MSG_RESULT([$MULTIARCH])
5 kx
5 kx if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
5 kx if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
5 kx AC_MSG_ERROR([internal configure error for the platform triplet, please file a bug report])
5 kx fi
5 kx elif test x$PLATFORM_TRIPLET != x && test x$MULTIARCH = x; then
5 kx MULTIARCH=$PLATFORM_TRIPLET
5 kx fi
5 kx AC_SUBST(PLATFORM_TRIPLET)
5 kx
5 kx if test x$MULTIARCH != x; then
5 kx MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\""
5 kx fi
5 kx AC_SUBST(MULTIARCH_CPPFLAGS)
5 kx
5 kx AC_MSG_CHECKING([for -Wl,--no-as-needed])
5 kx save_LDFLAGS="$LDFLAGS"
5 kx LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
5 kx [NO_AS_NEEDED="-Wl,--no-as-needed"
5 kx AC_MSG_RESULT([yes])],
5 kx [NO_AS_NEEDED=""
5 kx AC_MSG_RESULT([no])])
5 kx LDFLAGS="$save_LDFLAGS"
5 kx AC_SUBST(NO_AS_NEEDED)
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 AC_MSG_CHECKING([for the Android API level])
5 kx cat >> conftest.c <<EOF
5 kx #ifdef __ANDROID__
5 kx android_api = __ANDROID_API__
5 kx arm_arch = __ARM_ARCH
5 kx #else
5 kx #error not Android
5 kx #endif
5 kx EOF
5 kx
5 kx if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
5 kx ANDROID_API_LEVEL=`sed -n -e '/__ANDROID_API__/d' -e 's/^android_api = //p' conftest.out`
5 kx _arm_arch=`sed -n -e '/__ARM_ARCH/d' -e 's/^arm_arch = //p' conftest.out`
5 kx AC_MSG_RESULT([$ANDROID_API_LEVEL])
5 kx if test -z "$ANDROID_API_LEVEL"; then
5 kx echo 'Fatal: you must define __ANDROID_API__'
5 kx exit 1
5 kx fi
5 kx AC_DEFINE_UNQUOTED(ANDROID_API_LEVEL, $ANDROID_API_LEVEL, [The Android API level.])
5 kx
5 kx AC_MSG_CHECKING([for the Android arm ABI])
5 kx AC_MSG_RESULT([$_arm_arch])
5 kx if test "$_arm_arch" = 7; then
5 kx BASECFLAGS="${BASECFLAGS} -mfloat-abi=softfp -mfpu=vfpv3-d16"
5 kx LDFLAGS="${LDFLAGS} -march=armv7-a -Wl,--fix-cortex-a8"
5 kx fi
5 kx else
5 kx AC_MSG_RESULT([not Android])
5 kx fi
5 kx rm -f conftest.c conftest.out
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=SUFFIX], [set executable suffix to SUFFIX (default is '.exe')]),
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 $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 esac
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)$(ABIFLAGS).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 #
5 kx # LDVERSION is the shared library version number, normally the Python version
5 kx # with the ABI build flags appended.
5 kx AC_SUBST(LDLIBRARY)
5 kx AC_SUBST(DLLLIBRARY)
5 kx AC_SUBST(BLDLIBRARY)
5 kx AC_SUBST(PY3LIBRARY)
5 kx AC_SUBST(LDLIBRARYDIR)
5 kx AC_SUBST(INSTSONAME)
5 kx AC_SUBST(RUNSHARED)
5 kx AC_SUBST(LDVERSION)
5 kx LDLIBRARY="$LIBRARY"
5 kx BLDLIBRARY='$(LDLIBRARY)'
5 kx INSTSONAME='$(LDLIBRARY)'
5 kx DLLLIBRARY=''
5 kx LDLIBRARYDIR=''
5 kx RUNSHARED=''
5 kx LDVERSION="$VERSION"
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 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 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 # EXPORTSYMS holds the list of exported symbols for AIX.
5 kx # EXPORTSFROM holds the module name exporting symbols on AIX.
5 kx EXPORTSYMS=
5 kx EXPORTSFROM=
5 kx AC_SUBST(EXPORTSYMS)
5 kx AC_SUBST(EXPORTSFROM)
5 kx AC_MSG_CHECKING(EXPORTSYMS)
5 kx case $ac_sys_system in
5 kx AIX*)
5 kx EXPORTSYMS="Modules/python.exp"
5 kx EXPORTSFROM=. # the main executable
5 kx ;;
5 kx esac
5 kx AC_MSG_RESULT($EXPORTSYMS)
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], [enable building a shared Python library (default is no)]))
5 kx
5 kx if test -z "$enable_shared"
5 kx then
5 kx case $ac_sys_system in
5 kx CYGWIN*)
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 with gprof (default is no)]))
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 PY_ENABLE_SHARED=1
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 CYGWIN*)
5 kx LDLIBRARY='libpython$(LDVERSION).dll.a'
5 kx DLLLIBRARY='libpython$(LDVERSION).dll'
5 kx ;;
5 kx SunOS*)
5 kx LDLIBRARY='libpython$(LDVERSION).so'
5 kx BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(LDVERSION)'
5 kx RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
5 kx INSTSONAME="$LDLIBRARY".$SOVERSION
5 kx if test "$with_pydebug" != yes
5 kx then
5 kx PY3LIBRARY=libpython3.so
5 kx fi
5 kx ;;
5 kx Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*)
5 kx LDLIBRARY='libpython$(LDVERSION).so'
5 kx BLDLIBRARY='-L. -lpython$(LDVERSION)'
5 kx RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
5 kx INSTSONAME="$LDLIBRARY".$SOVERSION
5 kx if test "$with_pydebug" != yes
5 kx then
5 kx PY3LIBRARY=libpython3.so
5 kx fi
5 kx ;;
5 kx hp*|HP*)
5 kx case `uname -m` in
5 kx ia64)
5 kx LDLIBRARY='libpython$(LDVERSION).so'
5 kx ;;
5 kx *)
5 kx LDLIBRARY='libpython$(LDVERSION).sl'
5 kx ;;
5 kx esac
5 kx BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(LDVERSION)'
5 kx RUNSHARED=SHLIB_PATH=`pwd`${SHLIB_PATH:+:${SHLIB_PATH}}
5 kx ;;
5 kx Darwin*)
5 kx LDLIBRARY='libpython$(LDVERSION).dylib'
5 kx BLDLIBRARY='-L. -lpython$(LDVERSION)'
5 kx RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
5 kx ;;
5 kx AIX*)
5 kx LDLIBRARY='libpython$(LDVERSION).so'
5 kx RUNSHARED=LIBPATH=`pwd`${LIBPATH:+:${LIBPATH}}
5 kx ;;
5 kx
5 kx esac
5 kx else # shared is disabled
5 kx PY_ENABLE_SHARED=0
5 kx case $ac_sys_system in
5 kx CYGWIN*)
5 kx BLDLIBRARY='$(LIBRARY)'
5 kx LDLIBRARY='libpython$(LDVERSION).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_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="rcs"
5 kx fi
5 kx
5 kx AC_CHECK_TOOLS([READELF], [readelf], [:])
5 kx if test "$cross_compiling" = yes; then
5 kx case "$READELF" in
5 kx readelf|:)
5 kx AC_MSG_ERROR([readelf for the host is required for cross builds])
5 kx ;;
5 kx esac
5 kx fi
5 kx AC_SUBST(READELF)
5 kx
5 kx
5 kx case $MACHDEP in
5 kx hp*|HP*)
5 kx # install -d does not work on 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 CYGWIN*) LN="ln -s";;
5 kx *) LN=ln;;
5 kx esac
5 kx fi
5 kx
5 kx # For calculating the .so ABI tag.
5 kx AC_SUBST(ABIFLAGS)
5 kx ABIFLAGS=""
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 (default is no)]),
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 ABIFLAGS="${ABIFLAGS}d"
5 kx else AC_MSG_RESULT(no); Py_DEBUG='false'
5 kx fi],
5 kx [AC_MSG_RESULT(no)])
5 kx
5 kx # Check for --with-trace-refs
5 kx # --with-trace-refs
5 kx AC_MSG_CHECKING(for --with-trace-refs)
5 kx AC_ARG_WITH(trace-refs,
5 kx AS_HELP_STRING(
5 kx [--with-trace-refs],
5 kx [enable tracing references for debugging purpose (default is no)]),,
5 kx with_trace_refs=no)
5 kx AC_MSG_RESULT($with_trace_refs)
5 kx
5 kx if test "$with_trace_refs" = "yes"
5 kx then
5 kx AC_DEFINE(Py_TRACE_REFS, 1, [Define if you want to enable tracing references for debugging purpose])
5 kx fi
5 kx
5 kx # Check for --with-assertions.
5 kx # This allows enabling assertions without Py_DEBUG.
5 kx assertions='false'
5 kx AC_MSG_CHECKING(for --with-assertions)
5 kx AC_ARG_WITH(assertions,
5 kx AS_HELP_STRING([--with-assertions],[build with C assertions enabled (default is no)]),
5 kx [
5 kx if test "$withval" != no
5 kx then
5 kx assertions='true'
5 kx fi],
5 kx [])
5 kx if test "$assertions" = 'true'; then
5 kx AC_MSG_RESULT(yes)
5 kx elif test "$Py_DEBUG" = 'true'; then
5 kx assertions='true'
5 kx AC_MSG_RESULT(implied by --with-pydebug)
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi
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(
5 kx [--enable-optimizations],
5 kx [enable expensive, stable optimizations (PGO, etc.) (default is no)]),
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 manage 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 case $CC in
5 kx *gcc*)
5 kx AX_CHECK_COMPILE_FLAG([-fno-semantic-interposition],[
5 kx CFLAGS_NODIST="$CFLAGS_NODIST -fno-semantic-interposition"
5 kx LDFLAGS_NODIST="$LDFLAGS_NODIST -fno-semantic-interposition"
5 kx ])
5 kx ;;
5 kx esac
5 kx
5 kx
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 AC_ARG_VAR(PROFILE_TASK, Python args for PGO generation task)
5 kx AC_MSG_CHECKING(PROFILE_TASK)
5 kx if test -z "$PROFILE_TASK"
5 kx then
5 kx PROFILE_TASK='-m test --pgo --timeout=$(TESTTIMEOUT)'
5 kx fi
5 kx AC_MSG_RESULT($PROFILE_TASK)
5 kx
5 kx # Make llvm-relatec checks 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
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
5 kx # Enable LTO flags
5 kx AC_MSG_CHECKING(for --with-lto)
5 kx AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [enable Link-Time-Optimization in any build (default is no)]),
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 AC_SUBST(LLVM_AR)
5 kx AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path})
5 kx AC_SUBST(LLVM_AR_FOUND)
5 kx if test -n "${LLVM_AR}" -a -x "${LLVM_AR}"
5 kx then
5 kx LLVM_AR_FOUND="found"
5 kx else
5 kx LLVM_AR_FOUND="not-found"
5 kx fi
5 kx if test "$ac_sys_system" = "Darwin" -a "${LLVM_AR_FOUND}" = "not-found"
5 kx then
5 kx # The Apple-supplied ar in Xcode or the Command Line Tools is apparently sufficient
5 kx found_llvm_ar=`/usr/bin/xcrun -find ar 2>/dev/null`
5 kx if test -n "${found_llvm_ar}"
5 kx then
5 kx LLVM_AR='/usr/bin/xcrun ar'
5 kx LLVM_AR_FOUND=found
5 kx AC_MSG_NOTICE([llvm-ar found via xcrun: ${LLVM_AR}])
5 kx fi
5 kx fi
5 kx if test $LLVM_AR_FOUND = not-found
5 kx then
5 kx LLVM_PROFR_ERR=yes
5 kx AC_MSG_ERROR([llvm-ar is required for a --with-lto build with clang but could not be found.])
5 kx else
5 kx LLVM_AR_ERR=no
5 kx fi
5 kx AR="${LLVM_AR}"
5 kx case $ac_sys_system in
5 kx Darwin*)
5 kx # Any changes made here should be reflected in the GCC+Darwin case below
5 kx LTOFLAGS="-flto -Wl,-export_dynamic"
5 kx LTOCFLAGS="-flto"
5 kx ;;
5 kx *)
5 kx LTOFLAGS="-flto"
5 kx ;;
5 kx esac
5 kx ;;
5 kx *gcc*)
5 kx case $ac_sys_system in
5 kx Darwin*)
5 kx LTOFLAGS="-flto -Wl,-export_dynamic"
5 kx LTOCFLAGS="-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
5 kx CFLAGS_NODIST="$CFLAGS_NODIST ${LTOCFLAGS-$LTOFLAGS}"
5 kx LDFLAGS_NODIST="$LDFLAGS_NODIST $LTOFLAGS"
5 kx fi
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 AC_SUBST(LLVM_PROFDATA)
5 kx AC_PATH_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 # 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 case $CC in
5 kx *clang*)
5 kx cc_is_clang=1
5 kx ;;
5 kx *)
5 kx if $CC --version 2>&1 | grep -q clang
5 kx then
5 kx cc_is_clang=1
5 kx else
5 kx cc_is_clang=
5 kx fi
5 kx esac
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 AC_SUBST(CFLAGS_ALIASING)
5 kx if test "${OPT-unset}" = "unset"
5 kx then
5 kx case $GCC in
5 kx yes)
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 if test -n "${cc_is_clang}"
5 kx then
5 kx # Clang also needs -fwrapv
5 kx WRAP="-fwrapv"
5 kx # bpo-30104: disable strict aliasing to compile correctly dtoa.c,
5 kx # see Makefile.pre.in for more information
5 kx CFLAGS_ALIASING="-fno-strict-aliasing"
5 kx fi
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 if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then
5 kx OPT="-g -Og -Wall"
5 kx else
5 kx OPT="-g -O0 -Wall"
5 kx fi
5 kx else
5 kx OPT="-g $WRAP -O3 -Wall"
5 kx fi
5 kx ;;
5 kx *)
5 kx OPT="-O3 -Wall"
5 kx ;;
5 kx esac
5 kx
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 AC_SUBST(CFLAGS_NODIST)
5 kx AC_SUBST(LDFLAGS_NODIST)
5 kx
5 kx # The -arch flags for universal builds on macOS
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 CFLAGS_NODIST="$CFLAGS_NODIST -std=c99"
5 kx
5 kx AC_MSG_CHECKING(for -Wextra)
5 kx ac_save_cc="$CC"
5 kx CC="$CC -Wextra -Werror"
5 kx AC_CACHE_VAL(ac_cv_extra_warnings,
5 kx AC_COMPILE_IFELSE(
5 kx [
5 kx AC_LANG_PROGRAM([[]], [[]])
5 kx ],[
5 kx ac_cv_extra_warnings=yes
5 kx ],[
5 kx ac_cv_extra_warnings=no
5 kx ]))
5 kx CC="$ac_save_cc"
5 kx AC_MSG_RESULT($ac_cv_extra_warnings)
5 kx
5 kx if test $ac_cv_extra_warnings = yes
5 kx then
5 kx CFLAGS_NODIST="$CFLAGS_NODIST -Wextra"
5 kx fi
5 kx
5 kx # Python doesn't violate C99 aliasing rules, but older versions of
5 kx # GCC produce warnings for legal Python code. Enable
5 kx # -fno-strict-aliasing on versions of GCC that support but produce
5 kx # warnings. See Issue3326
5 kx AC_MSG_CHECKING(whether $CC accepts and needs -fno-strict-aliasing)
5 kx ac_save_cc="$CC"
5 kx CC="$CC -fno-strict-aliasing"
5 kx save_CFLAGS="$CFLAGS"
5 kx AC_CACHE_VAL(ac_cv_no_strict_aliasing,
5 kx AC_COMPILE_IFELSE(
5 kx [
5 kx AC_LANG_PROGRAM([[]], [[]])
5 kx ],[
5 kx CC="$ac_save_cc -fstrict-aliasing"
5 kx CFLAGS="$CFLAGS -Werror -Wstrict-aliasing"
5 kx AC_COMPILE_IFELSE(
5 kx [
5 kx AC_LANG_PROGRAM([[void f(int **x) {}]],
5 kx [[double *x; f((int **) &x);]])
5 kx ],[
5 kx ac_cv_no_strict_aliasing=no
5 kx ],[
5 kx ac_cv_no_strict_aliasing=yes
5 kx ])
5 kx ],[
5 kx ac_cv_no_strict_aliasing=no
5 kx ]))
5 kx CFLAGS="$save_CFLAGS"
5 kx CC="$ac_save_cc"
5 kx AC_MSG_RESULT($ac_cv_no_strict_aliasing)
5 kx if test $ac_cv_no_strict_aliasing = yes
5 kx then
5 kx BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
5 kx fi
5 kx
5 kx # ICC doesn't recognize the option, but only emits a warning
5 kx ## XXX does it emit an unused result warning and can it be disabled?
5 kx case "$CC" in
5 kx *icc*)
5 kx ac_cv_disable_unused_result_warning=no
5 kx ;;
5 kx *)
5 kx AC_MSG_CHECKING(if we can turn off $CC unused result warning)
5 kx ac_save_cc="$CC"
5 kx CC="$CC -Wunused-result -Werror"
5 kx save_CFLAGS="$CFLAGS"
5 kx AC_CACHE_VAL(ac_cv_disable_unused_result_warning,
5 kx AC_COMPILE_IFELSE(
5 kx [
5 kx AC_LANG_PROGRAM([[]], [[]])
5 kx ],[
5 kx ac_cv_disable_unused_result_warning=yes
5 kx ],[
5 kx ac_cv_disable_unused_result_warning=no
5 kx ]))
5 kx CFLAGS="$save_CFLAGS"
5 kx CC="$ac_save_cc"
5 kx AC_MSG_RESULT($ac_cv_disable_unused_result_warning)
5 kx ;;
5 kx esac
5 kx
5 kx if test $ac_cv_disable_unused_result_warning = yes
5 kx then
5 kx BASECFLAGS="$BASECFLAGS -Wno-unused-result"
5 kx CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-result"
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(if we can turn off $CC unused parameter warning)
5 kx ac_save_cc="$CC"
5 kx CC="$CC -Wunused-parameter -Werror"
5 kx AC_CACHE_VAL(ac_cv_disable_unused_parameter_warning,
5 kx AC_COMPILE_IFELSE(
5 kx [
5 kx AC_LANG_PROGRAM([[]], [[]])
5 kx ],[
5 kx ac_cv_disable_unused_parameter_warning=yes
5 kx ],[
5 kx ac_cv_disable_unused_parameter_warning=no
5 kx ]))
5 kx CC="$ac_save_cc"
5 kx AC_MSG_RESULT($ac_cv_disable_unused_parameter_warning)
5 kx
5 kx if test $ac_cv_disable_unused_parameter_warning = yes
5 kx then
5 kx CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-parameter"
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(if we can turn off $CC missing field initializers warning)
5 kx ac_save_cc="$CC"
5 kx CC="$CC -Wmissing-field-initializers -Werror"
5 kx AC_CACHE_VAL(ac_cv_disable_missing_field_initializers,
5 kx AC_COMPILE_IFELSE(
5 kx [
5 kx AC_LANG_PROGRAM([[]], [[]])
5 kx ],[
5 kx ac_cv_disable_missing_field_initializers=yes
5 kx ],[
5 kx ac_cv_disable_missing_field_initializers=no
5 kx ]))
5 kx CC="$ac_save_cc"
5 kx AC_MSG_RESULT($ac_cv_disable_missing_field_initializers)
5 kx
5 kx if test $ac_cv_disable_missing_field_initializers = yes
5 kx then
5 kx CFLAGS_NODIST="$CFLAGS_NODIST -Wno-missing-field-initializers"
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(if we can turn on $CC mixed sign comparison warning)
5 kx ac_save_cc="$CC"
5 kx CC="$CC -Wsign-compare"
5 kx save_CFLAGS="$CFLAGS"
5 kx AC_CACHE_VAL(ac_cv_enable_sign_compare_warning,
5 kx AC_COMPILE_IFELSE(
5 kx [
5 kx AC_LANG_PROGRAM([[]], [[]])
5 kx ],[
5 kx ac_cv_enable_sign_compare_warning=yes
5 kx ],[
5 kx ac_cv_enable_sign_compare_warning=no
5 kx ]))
5 kx CFLAGS="$save_CFLAGS"
5 kx CC="$ac_save_cc"
5 kx AC_MSG_RESULT($ac_cv_enable_sign_compare_warning)
5 kx
5 kx if test $ac_cv_enable_sign_compare_warning = yes
5 kx then
5 kx BASECFLAGS="$BASECFLAGS -Wsign-compare"
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(if we can turn on $CC unreachable code warning)
5 kx ac_save_cc="$CC"
5 kx CC="$CC -Wunreachable-code"
5 kx save_CFLAGS="$CFLAGS"
5 kx AC_CACHE_VAL(ac_cv_enable_unreachable_code_warning,
5 kx AC_COMPILE_IFELSE(
5 kx [
5 kx AC_LANG_PROGRAM([[]], [[]])
5 kx ],[
5 kx ac_cv_enable_unreachable_code_warning=yes
5 kx ],[
5 kx ac_cv_enable_unreachable_code_warning=no
5 kx ]))
5 kx CFLAGS="$save_CFLAGS"
5 kx CC="$ac_save_cc"
5 kx
5 kx # Don't enable unreachable code warning in debug mode, since it usually
5 kx # results in non-standard code paths.
5 kx # Issue #24324: Unfortunately, the unreachable code warning does not work
5 kx # correctly on gcc and has been silently removed from the compiler.
5 kx # It is supported on clang but on OS X systems gcc may be an alias
5 kx # for clang. Try to determine if the compiler is not really gcc and,
5 kx # if so, only then enable the warning.
5 kx if test $ac_cv_enable_unreachable_code_warning = yes && \
5 kx test "$Py_DEBUG" != "true" && \
5 kx test -z "`$CC --version 2>/dev/null | grep 'Free Software Foundation'`"
5 kx then
5 kx BASECFLAGS="$BASECFLAGS -Wunreachable-code"
5 kx else
5 kx ac_cv_enable_unreachable_code_warning=no
5 kx fi
5 kx AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning)
5 kx
5 kx AC_MSG_CHECKING(if we can turn on $CC strict-prototypes warning)
5 kx ac_save_cc="$CC"
5 kx CC="$CC -Werror -Wstrict-prototypes"
5 kx AC_CACHE_VAL(ac_cv_enable_enable_strict_prototypes_warning,
5 kx AC_COMPILE_IFELSE(
5 kx [
5 kx AC_LANG_PROGRAM([[]], [[]])
5 kx ],[
5 kx ac_cv_enable_strict_prototypes_warning=yes
5 kx ],[
5 kx ac_cv_enable_strict_prototypes_warning=no
5 kx ]))
5 kx CC="$ac_save_cc"
5 kx AC_MSG_RESULT($ac_cv_enable_strict_prototypes_warning)
5 kx
5 kx if test $ac_cv_enable_strict_prototypes_warning = yes
5 kx then
5 kx CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(if we can make implicit function declaration an error in $CC)
5 kx ac_save_cc="$CC"
5 kx CC="$CC -Werror=implicit-function-declaration"
5 kx AC_CACHE_VAL(ac_cv_enable_implicit_function_declaration_error,
5 kx AC_COMPILE_IFELSE(
5 kx [
5 kx AC_LANG_PROGRAM([[]], [[]])
5 kx ],[
5 kx ac_cv_enable_implicit_function_declaration_error=yes
5 kx ],[
5 kx ac_cv_enable_implicit_function_declaration_error=no
5 kx ]))
5 kx CC="$ac_save_cc"
5 kx AC_MSG_RESULT($ac_cv_enable_implicit_function_declaration_error)
5 kx
5 kx if test $ac_cv_enable_implicit_function_declaration_error = yes
5 kx then
5 kx CFLAGS_NODIST="$CFLAGS_NODIST -Werror=implicit-function-declaration"
5 kx fi
5 kx
5 kx AC_MSG_CHECKING(if we can use visibility in $CC)
5 kx ac_save_cc="$CC"
5 kx CC="$CC -fvisibility=hidden"
5 kx AC_CACHE_VAL(ac_cv_enable_visibility,
5 kx AC_COMPILE_IFELSE(
5 kx [
5 kx AC_LANG_PROGRAM([[]], [[]])
5 kx ],[
5 kx ac_cv_enable_visibility=yes
5 kx ],[
5 kx ac_cv_enable_visibility=no
5 kx ]))
5 kx CC="$ac_save_cc"
5 kx AC_MSG_RESULT($ac_cv_enable_visibility)
5 kx
5 kx if test $ac_cv_enable_visibility = yes
5 kx then
5 kx CFLAGS_NODIST="$CFLAGS_NODIST -fvisibility=hidden"
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
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 LIPO_INTEL64_FLAGS=""
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="true"
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 universal2)
5 kx UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
5 kx LIPO_32BIT_FLAGS=""
5 kx LIPO_INTEL64_FLAGS="-extract x86_64"
5 kx ARCH_RUN_32BIT="true"
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="true"
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=universal2|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 AC_MSG_CHECKING(if specified universal architectures work)
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[printf("%d", 42);]])],
5 kx [AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx AC_MSG_ERROR(check config.log and use the '--with-universal-archs' option)
5 kx ])
5 kx
5 kx # end of Darwin* tests
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 SCO_SV*)
5 kx BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
5 kx ;;
5 kx esac
5 kx ;;
5 kx esac
5 kx
5 kx case "$CC" in
5 kx *icc*)
5 kx # ICC needs -fp-model strict or floats behave badly
5 kx CFLAGS_NODIST="$CFLAGS_NODIST -fp-model strict"
5 kx ;;
5 kx *xlc*)
5 kx CFLAGS_NODIST="$CFLAGS_NODIST -qalias=noansi -qmaxmem=-1"
5 kx ;;
5 kx esac
5 kx
5 kx if test "$assertions" = '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 # 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 process.h pthread.h \
5 kx sched.h shadow.h signal.h stropts.h termios.h \
5 kx utime.h \
5 kx poll.h sys/devpoll.h sys/epoll.h sys/poll.h \
5 kx sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \
5 kx sys/kern_control.h sys/loadavg.h sys/lock.h sys/mkdev.h sys/modem.h \
5 kx sys/param.h sys/random.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \
5 kx sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \
5 kx sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
5 kx libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
5 kx linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
5 kx sys/endian.h sys/sysmacros.h linux/auxvec.h sys/auxv.h linux/memfd.h linux/wait.h sys/memfd.h \
5 kx sys/mman.h sys/eventfd.h)
5 kx AC_HEADER_DIRENT
5 kx AC_HEADER_MAJOR
5 kx
5 kx # bluetooth/bluetooth.h has been known to not compile with -std=c99.
5 kx # http://permalink.gmane.org/gmane.linux.bluez.kernel/22294
5 kx SAVE_CFLAGS=$CFLAGS
5 kx CFLAGS="-std=c99 $CFLAGS"
5 kx AC_CHECK_HEADERS(bluetooth/bluetooth.h)
5 kx CFLAGS=$SAVE_CFLAGS
5 kx
5 kx # On Darwin (OS X) net/if.h requires sys/socket.h to be imported first.
5 kx AC_CHECK_HEADERS([net/if.h], [], [],
5 kx [#include <stdio.h>
5 kx #ifdef STDC_HEADERS
5 kx # include <stdlib.h>
5 kx # include <stddef.h>
5 kx #else
5 kx # ifdef HAVE_STDLIB_H
5 kx # include <stdlib.h>
5 kx # endif
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 # 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 # On Linux, qrtr.h requires asm/types.h
5 kx AC_CHECK_HEADERS(linux/qrtr.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 AC_CHECK_HEADERS(linux/vm_sockets.h,,,[
5 kx #ifdef HAVE_SYS_SOCKET_H
5 kx #include <sys/socket.h>
5 kx #endif
5 kx ])
5 kx
5 kx # On Linux, can.h, can/bcm.h, can/j1939.h, can/raw.h require sys/socket.h
5 kx AC_CHECK_HEADERS(linux/can.h linux/can/bcm.h linux/can/j1939.h linux/can/raw.h,,,[
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 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
5 kx ]], [[
5 kx makedev(0, 0) ]])
5 kx ],[ac_cv_has_makedev=yes],[ac_cv_has_makedev=no])
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 # byte swapping
5 kx AC_MSG_CHECKING(for le64toh)
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5 kx #ifdef HAVE_ENDIAN_H
5 kx #include <endian.h>
5 kx #elif defined(HAVE_SYS_ENDIAN_H)
5 kx #include <sys/endian.h>
5 kx #endif
5 kx ]], [[
5 kx le64toh(1) ]])
5 kx ],[ac_cv_has_le64toh=yes],[ac_cv_has_le64toh=no])
5 kx AC_MSG_RESULT($ac_cv_has_le64toh)
5 kx if test "$ac_cv_has_le64toh" = "yes"; then
5 kx AC_DEFINE(HAVE_HTOLE64, 1, [Define this if you have le64toh()])
5 kx fi
5 kx
5 kx use_lfs=yes
5 kx # Don't use largefile support for GNU/Hurd
5 kx case $ac_sys_system in GNU*)
5 kx use_lfs=no
5 kx esac
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 AC_CHECK_TYPE(ssize_t,
5 kx AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
5 kx AC_CHECK_TYPE(__uint128_t,
5 kx AC_DEFINE(HAVE_GCC_UINT128_T, 1, [Define if your compiler provides __uint128_t]),,)
5 kx
5 kx # Sizes and alignments 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_ALIGNOF(long)
5 kx AC_CHECK_SIZEOF(long long, 8)
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_ALIGNOF(size_t)
5 kx AC_CHECK_SIZEOF(pid_t, 4)
5 kx AC_CHECK_SIZEOF(uintptr_t)
5 kx
5 kx AC_TYPE_LONG_DOUBLE
5 kx AC_CHECK_SIZEOF(long double, 16)
5 kx
5 kx AC_CHECK_SIZEOF(_Bool, 1)
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 "$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 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
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
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
5 kx # Issue #25658: POSIX hasn't defined that pthread_key_t is compatible with int.
5 kx # This checking will be unnecessary after removing deprecated TLS API.
5 kx AC_CHECK_SIZEOF(pthread_key_t, [], [[#include <pthread.h>]])
5 kx AC_MSG_CHECKING(whether pthread_key_t is compatible with int)
5 kx if test "$ac_cv_sizeof_pthread_key_t" -eq "$ac_cv_sizeof_int" ; then
5 kx AC_COMPILE_IFELSE(
5 kx [AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_key_t k; k * 1;]])],
5 kx [ac_pthread_key_t_is_arithmetic_type=yes],
5 kx [ac_pthread_key_t_is_arithmetic_type=no]
5 kx )
5 kx AC_MSG_RESULT($ac_pthread_key_t_is_arithmetic_type)
5 kx if test "$ac_pthread_key_t_is_arithmetic_type" = yes ; then
5 kx AC_DEFINE(PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT, 1,
5 kx [Define if pthread_key_t is compatible with int.])
5 kx fi
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi
5 kx CC="$ac_save_cc"
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 macOS])
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 arm64)
5 kx MACOSX_DEFAULT_ARCH="arm64"
5 kx ;;
5 kx *)
5 kx AC_MSG_ERROR([Unexpected output of 'arch' on macOS])
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 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])
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 AC_MSG_CHECKING(for --with-address-sanitizer)
5 kx AC_ARG_WITH(address_sanitizer,
5 kx AS_HELP_STRING([--with-address-sanitizer],
5 kx [enable AddressSanitizer memory error detector, 'asan' (default is no)]),
5 kx [
5 kx AC_MSG_RESULT($withval)
5 kx BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS"
5 kx LDFLAGS="-fsanitize=address $LDFLAGS"
5 kx # ASan works by controlling memory allocation, our own malloc interferes.
5 kx with_pymalloc="no"
5 kx ],
5 kx [AC_MSG_RESULT(no)])
5 kx
5 kx AC_MSG_CHECKING(for --with-memory-sanitizer)
5 kx AC_ARG_WITH(memory_sanitizer,
5 kx AS_HELP_STRING([--with-memory-sanitizer],
5 kx [enable MemorySanitizer allocation error detector, 'msan' (default is no)]),
5 kx [
5 kx AC_MSG_RESULT($withval)
5 kx AX_CHECK_COMPILE_FLAG([-fsanitize=memory],[
5 kx BASECFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer $BASECFLAGS"
5 kx LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 $LDFLAGS"
5 kx ],[AC_MSG_ERROR([The selected compiler doesn't support memory sanitizer])])
5 kx # MSan works by controlling memory allocation, our own malloc interferes.
5 kx with_pymalloc="no"
5 kx ],
5 kx [AC_MSG_RESULT(no)])
5 kx
5 kx AC_MSG_CHECKING(for --with-undefined-behavior-sanitizer)
5 kx AC_ARG_WITH(undefined_behavior_sanitizer,
5 kx AS_HELP_STRING([--with-undefined-behavior-sanitizer],
5 kx [enable UndefinedBehaviorSanitizer undefined behaviour detector, 'ubsan' (default is no)]),
5 kx [
5 kx AC_MSG_RESULT($withval)
5 kx BASECFLAGS="-fsanitize=undefined $BASECFLAGS"
5 kx LDFLAGS="-fsanitize=undefined $LDFLAGS"
5 kx with_ubsan="yes"
5 kx ],
5 kx [
5 kx AC_MSG_RESULT(no)
5 kx with_ubsan="no"
5 kx ])
5 kx
5 kx # Set info about shared libraries.
5 kx AC_SUBST(SHLIB_SUFFIX)
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
5 kx # SHLIB_SUFFIX 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(the extension of shared libraries)
5 kx if test -z "$SHLIB_SUFFIX"; then
5 kx case $ac_sys_system in
5 kx hp*|HP*)
5 kx case `uname -m` in
5 kx ia64) SHLIB_SUFFIX=.so;;
5 kx *) SHLIB_SUFFIX=.sl;;
5 kx esac
5 kx ;;
5 kx CYGWIN*) SHLIB_SUFFIX=.dll;;
5 kx *) SHLIB_SUFFIX=.so;;
5 kx esac
5 kx fi
5 kx AC_MSG_RESULT($SHLIB_SUFFIX)
5 kx
5 kx # LDSHARED is the ld *command* used to create shared library
5 kx # -- "cc -G" on SunOS 5.x.
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="\$(LIBPL)/ld_so_aix \$(CC) -bI:\$(LIBPL)/python.exp"
5 kx ;;
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='$(CC) -b'
5 kx LDCXXSHARED='$(CXX) -b'
5 kx fi ;;
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 AC_MSG_ERROR([MACOSX_DEPLOYMENT_TARGET too old ($MACOSX_DEPLOYMENT_TARGET), only 10.3 or later is supported])
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*|VxWorks*)
5 kx LDSHARED='$(CC) -shared'
5 kx LDCXXSHARED='$(CXX) -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 *) 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-android*) ;;
5 kx Linux*|GNU*) 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 VxWorks*)
5 kx CCSHARED="-fpic -D__SO_PICABILINUX__ -ftls-model=global-dynamic"
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 Linux-android*) LINKFORSHARED="-pie -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 LINKFORSHARED="$extra_undefs -framework CoreFoundation"
5 kx
5 kx # Issue #18075: the default maximum stack size (8MBytes) is too
5 kx # small for the default recursion limit. Increase the stack size
5 kx # to ensure that tests don't crash
5 kx stack_size="1000000" # 16 MB
5 kx if test "$with_ubsan" = "yes"
5 kx then
5 kx # Undefined behavior sanitizer requires an even deeper stack
5 kx stack_size="4000000" # 64 MB
5 kx fi
5 kx
5 kx LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED"
5 kx
5 kx AC_DEFINE_UNQUOTED(THREAD_STACK_SIZE,
5 kx 0x$stack_size,
5 kx [Custom thread stack size depending on chosen sanitizer runtimes.])
5 kx
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 VxWorks*)
5 kx LINKFORSHARED='-Wl,-export-dynamic';;
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(sendfile, sendfile)
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 # checks for uuid.h location
5 kx AC_CHECK_HEADERS([uuid/uuid.h uuid.h])
5 kx
5 kx AC_MSG_CHECKING(for uuid_generate_time_safe)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <uuid/uuid.h>]], [[
5 kx #ifndef uuid_generate_time_safe
5 kx void *x = uuid_generate_time_safe
5 kx #endif
5 kx ]])],
5 kx [AC_DEFINE(HAVE_UUID_GENERATE_TIME_SAFE, 1, Define if uuid_generate_time_safe() exists.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx # check for libuuid from util-linux
5 kx save_LIBS=$LIBS
5 kx AC_CHECK_LIB([uuid], [uuid_generate_time])
5 kx LIBS=$save_LIBS
5 kx
5 kx # AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007)
5 kx # FreeBSD and OpenBSD provides support in libc as well.
5 kx AC_MSG_CHECKING(for uuid_create)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <uuid.h>]], [[
5 kx #ifndef uuid_create
5 kx void *x = uuid_create
5 kx #endif
5 kx ]])],
5 kx [AC_DEFINE(HAVE_UUID_CREATE, 1, Define if uuid_create() exists.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx # Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet
5 kx # stream in big-endian byte-order
5 kx AC_MSG_CHECKING(for uuid_enc_be)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <uuid.h>]], [[
5 kx #ifndef uuid_enc_be
5 kx void *x = uuid_enc_be
5 kx #endif
5 kx ]])],
5 kx [AC_DEFINE(HAVE_UUID_ENC_BE, 1, Define if uuid_enc_be() exists.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)]
5 kx )
5 kx
5 kx # 'Real Time' functions on Solaris
5 kx # posix4 on Solaris 2.6
5 kx # pthread (first!) on Linux
5 kx AC_SEARCH_LIBS(sem_init, pthread rt posix4)
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 LIBS="-lintl $LIBS"])
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 dnl The AIX_BUILDDATE is obtained from the kernel fileset - bos.mp64
5 kx # BUILD_GNU_TYPE + AIX_BUILDDATE are used to construct the platform_tag
5 kx # of the AIX system used to build/package Python executable. This tag serves
5 kx # as a baseline for bdist module packages
5 kx AC_MSG_CHECKING(for the system builddate)
5 kx AIX_BUILDDATE=$(lslpp -Lcq bos.mp64 | awk -F: '{ print $NF }')
5 kx AC_DEFINE_UNQUOTED([AIX_BUILDDATE], [$AIX_BUILDDATE],
5 kx [BUILD_GNU_TYPE + AIX_BUILDDATE are used to construct the PEP425 tag of the build system.])
5 kx AC_MSG_RESULT($AIX_BUILDDATE)
5 kx ;;
5 kx *) ;;
5 kx esac
5 kx
5 kx # check for systems that require aligned memory access
5 kx AC_MSG_CHECKING(aligned memory access is required)
5 kx AC_CACHE_VAL(ac_cv_aligned_required,
5 kx [AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx int main()
5 kx {
5 kx char s[16];
5 kx int i, *p1, *p2;
5 kx for (i=0; i < 16; i++)
5 kx s[i] = i;
5 kx p1 = (int*)(s+1);
5 kx p2 = (int*)(s+2);
5 kx if (*p1 == *p2)
5 kx return 1;
5 kx return 0;
5 kx }]])],
5 kx [ac_cv_aligned_required=no],
5 kx [ac_cv_aligned_required=yes],
5 kx [ac_cv_aligned_required=yes])
5 kx ])
5 kx AC_MSG_RESULT($ac_cv_aligned_required)
5 kx if test "$ac_cv_aligned_required" = yes ; then
5 kx AC_DEFINE([HAVE_ALIGNED_REQUIRED], [1],
5 kx [Define if aligned memory access is required])
5 kx fi
5 kx
5 kx # str, bytes and memoryview hash algorithm
5 kx AH_TEMPLATE(Py_HASH_ALGORITHM,
5 kx [Define hash algorithm for str, bytes and memoryview.
5 kx SipHash24: 1, FNV: 2, externally defined: 0])
5 kx
5 kx AC_MSG_CHECKING(for --with-hash-algorithm)
5 kx dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
5 kx AC_ARG_WITH(hash_algorithm,
5 kx AS_HELP_STRING([--with-hash-algorithm=@<:@fnv|siphash24@:>@],
5 kx [select hash algorithm for use in Python/pyhash.c (default is SipHash24)]),
5 kx [
5 kx AC_MSG_RESULT($withval)
5 kx case "$withval" in
5 kx siphash24)
5 kx AC_DEFINE(Py_HASH_ALGORITHM, 1)
5 kx ;;
5 kx fnv)
5 kx AC_DEFINE(Py_HASH_ALGORITHM, 2)
5 kx ;;
5 kx *)
5 kx AC_MSG_ERROR([unknown hash algorithm '$withval'])
5 kx ;;
5 kx esac
5 kx ],
5 kx [AC_MSG_RESULT(default)])
5 kx
5 kx validate_tzpath() {
5 kx # Checks that each element of hte path is an absolute path
5 kx if test -z "$1"; then
5 kx # Empty string is allowed: it indicates no system TZPATH
5 kx return 0
5 kx fi
5 kx
5 kx # Bad paths are those that don't start with /
5 kx dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
5 kx if ( echo $1 | grep '\(^\|:\)\(@<:@^/@:>@\|$\)' > /dev/null); then
5 kx AC_MSG_ERROR([--with-tzpath must contain only absolute paths, not $1])
5 kx return 1;
5 kx fi
5 kx }
5 kx
5 kx TZPATH="/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo"
5 kx AC_MSG_CHECKING(for --with-tzpath)
5 kx AC_ARG_WITH(tzpath,
5 kx AS_HELP_STRING([--with-tzpath=<list of absolute paths separated by pathsep>]
5 kx [Select the default time zone search path for zoneinfo.TZPATH]),
5 kx [
5 kx case "$withval" in
5 kx yes)
5 kx AC_MSG_ERROR([--with-tzpath requires a value])
5 kx ;;
5 kx *)
5 kx validate_tzpath "$withval"
5 kx TZPATH="$withval"
5 kx AC_MSG_RESULT("$withval")
5 kx ;;
5 kx esac
5 kx ],
5 kx [validate_tzpath "$TZPATH"
5 kx AC_MSG_RESULT("$TZPATH")])
5 kx AC_SUBST(TZPATH)
5 kx
5 kx # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
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 AC_MSG_CHECKING(for --with-libs)
5 kx AC_ARG_WITH(libs,
5 kx AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs (default is no)]),
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, see Doc/library/pyexpat.rst (default is no)]),
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, see Doc/library/ctypes.rst (default is system-dependent)]),,,)
5 kx
5 kx if test "$ac_sys_system" = "Darwin"
5 kx then
5 kx case "$with_system_ffi" in
5 kx "")
5 kx with_system_ffi="no"
5 kx ;;
5 kx yes|no)
5 kx ;;
5 kx *)
5 kx AC_MSG_ERROR([--with-system-ffi accepts no arguments])
5 kx ;;
5 kx esac
5 kx AC_MSG_RESULT($with_system_ffi)
5 kx else
5 kx AC_MSG_RESULT(yes)
5 kx if test "$with_system_ffi" != ""
5 kx then
5 kx AC_MSG_WARN([--with(out)-system-ffi is ignored on this platform])
5 kx fi
5 kx with_system_ffi="yes"
5 kx fi
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 # Check for use of the system libmpdec library
5 kx AC_MSG_CHECKING(for --with-system-libmpdec)
5 kx AC_ARG_WITH(system_libmpdec,
5 kx AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library, see Doc/library/decimal.rst (default is no)]),
5 kx [],
5 kx [with_system_libmpdec="no"])
5 kx
5 kx AC_MSG_RESULT($with_system_libmpdec)
5 kx
5 kx # Check whether _decimal should use a coroutine-local or thread-local context
5 kx AC_MSG_CHECKING(for --with-decimal-contextvar)
5 kx AC_ARG_WITH(decimal_contextvar,
5 kx AS_HELP_STRING([--with-decimal-contextvar], [build _decimal module using a coroutine-local rather than a thread-local context (default is yes)]),
5 kx [],
5 kx [with_decimal_contextvar="yes"])
5 kx
5 kx if test "$with_decimal_contextvar" != "no"
5 kx then
5 kx AC_DEFINE(WITH_DECIMAL_CONTEXTVAR, 1,
5 kx [Define if you want build the _decimal module using a coroutine-local rather than a thread-local context])
5 kx fi
5 kx
5 kx AC_MSG_RESULT($with_decimal_contextvar)
5 kx
5 kx # Check for support for loadable sqlite extensions
5 kx AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions)
5 kx AC_ARG_ENABLE(loadable-sqlite-extensions,
5 kx AS_HELP_STRING([--enable-loadable-sqlite-extensions],
5 kx [support loadable extensions in _sqlite module, see Doc/library/sqlite3.rst (default is no)]),
5 kx [],
5 kx [enable_loadable_sqlite_extensions="no"])
5 kx
5 kx AC_MSG_RESULT($enable_loadable_sqlite_extensions)
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 if test -n "$PKG_CONFIG" && "$PKG_CONFIG" --exists tcl tk; then
5 kx TCLTK_INCLUDES="`"$PKG_CONFIG" tcl tk --cflags-only-I 2>/dev/null`"
5 kx TCLTK_LIBS="`"$PKG_CONFIG" tcl tk --libs 2>/dev/null`"
5 kx else
5 kx TCLTK_INCLUDES=""
5 kx TCLTK_LIBS=""
5 kx fi
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:...], [override order to check db backends for dbm; a 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 # Templates for things AC_DEFINEd more than once.
5 kx # For a single AC_DEFINE, no template is needed.
5 kx AH_TEMPLATE(_REENTRANT,
5 kx [Define to force use of thread-safe errno, h_errno, and other functions])
5 kx
5 kx if test "$ac_cv_pthread_is_default" = yes
5 kx then
5 kx # Defining _REENTRANT on system with POSIX threads should not hurt.
5 kx AC_DEFINE(_REENTRANT)
5 kx posix_threads=yes
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 posix_threads=yes
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 posix_threads=yes
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 posix_threads=yes
5 kx else
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 # 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 posix_threads=yes
5 kx ],[
5 kx LIBS=$_libs
5 kx AC_CHECK_FUNC(pthread_detach, [
5 kx posix_threads=yes
5 kx ],[
5 kx AC_CHECK_LIB(pthreads, pthread_create, [
5 kx posix_threads=yes
5 kx LIBS="$LIBS -lpthreads"
5 kx ], [
5 kx AC_CHECK_LIB(c_r, pthread_create, [
5 kx posix_threads=yes
5 kx LIBS="$LIBS -lc_r"
5 kx ], [
5 kx AC_CHECK_LIB(pthread, __pthread_create_system, [
5 kx posix_threads=yes
5 kx LIBS="$LIBS -lpthread"
5 kx ], [
5 kx AC_CHECK_LIB(cma, pthread_create, [
5 kx posix_threads=yes
5 kx LIBS="$LIBS -lcma"
5 kx ],[
5 kx AC_MSG_ERROR([could not find pthreads on your system])
5 kx ])
5 kx ])])])])])
5 kx
5 kx AC_CHECK_LIB(mpc, usconfig, [
5 kx LIBS="$LIBS -lmpc"
5 kx ])
5 kx
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)) return (-1);
5 kx if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
5 kx if (pthread_create(&id, &attr, foo, NULL)) return (-1);
5 kx return (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_getcpuclockid)
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 AS_HELP_STRING([--enable-ipv6],
5 kx [enable ipv6 (with ipv4) support, see Doc/library/socket.rst (default is yes if supported)]),
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 CAN_RAW_FD_FRAMES)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* CAN_RAW_FD_FRAMES available check */
5 kx #include <linux/can/raw.h>]],
5 kx [[int can_raw_fd_frames = CAN_RAW_FD_FRAMES;]])],[
5 kx AC_DEFINE(HAVE_LINUX_CAN_RAW_FD_FRAMES, 1, [Define if compiling using Linux 3.6 or later.])
5 kx AC_MSG_RESULT(yes)
5 kx ],[
5 kx AC_MSG_RESULT(no)
5 kx ])
5 kx
5 kx AC_MSG_CHECKING(for CAN_RAW_JOIN_FILTERS)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <linux/can/raw.h>]],
5 kx [[int can_raw_join_filters = CAN_RAW_JOIN_FILTERS;]])],[
5 kx AC_DEFINE(HAVE_LINUX_CAN_RAW_JOIN_FILTERS, 1, [Define if compiling using Linux 4.1 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-doc-strings], [enable documentation strings (default is yes)]))
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-pymalloc)
5 kx AC_ARG_WITH(pymalloc,
5 kx AS_HELP_STRING([--with-pymalloc], [enable specialized mallocs (default is yes)]))
5 kx
5 kx if test -z "$with_pymalloc"
5 kx then
5 kx 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 --with-c-locale-coercion
5 kx AC_MSG_CHECKING(for --with-c-locale-coercion)
5 kx AC_ARG_WITH(c-locale-coercion,
5 kx AS_HELP_STRING([--with-c-locale-coercion],
5 kx [enable C locale coercion to a UTF-8 based locale (default is yes)]))
5 kx
5 kx if test -z "$with_c_locale_coercion"
5 kx then
5 kx with_c_locale_coercion="yes"
5 kx fi
5 kx if test "$with_c_locale_coercion" != "no"
5 kx then
5 kx AC_DEFINE(PY_COERCE_C_LOCALE, 1,
5 kx [Define if you want to coerce the C locale to a UTF-8 based locale])
5 kx fi
5 kx AC_MSG_RESULT($with_c_locale_coercion)
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 (default is no)]),,
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 OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT"
5 kx fi
5 kx
5 kx # Check for DTrace support
5 kx AC_MSG_CHECKING(for --with-dtrace)
5 kx AC_ARG_WITH(dtrace,
5 kx AS_HELP_STRING([--with-dtrace],[enable DTrace support (default is no)]),,
5 kx with_dtrace=no)
5 kx AC_MSG_RESULT($with_dtrace)
5 kx
5 kx AC_SUBST(DTRACE)
5 kx AC_SUBST(DFLAGS)
5 kx AC_SUBST(DTRACE_HEADERS)
5 kx AC_SUBST(DTRACE_OBJS)
5 kx DTRACE=
5 kx DTRACE_HEADERS=
5 kx DTRACE_OBJS=
5 kx
5 kx if test "$with_dtrace" = "yes"
5 kx then
5 kx AC_PATH_PROG(DTRACE, [dtrace], [not found])
5 kx if test "$DTRACE" = "not found"; then
5 kx AC_MSG_ERROR([dtrace command not found on \$PATH])
5 kx fi
5 kx AC_DEFINE(WITH_DTRACE, 1, [Define if you want to compile in DTrace support])
5 kx DTRACE_HEADERS="Include/pydtrace_probes.h"
5 kx
5 kx # On OS X, DTrace providers do not need to be explicitly compiled and
5 kx # linked into the binary. Correspondingly, dtrace(1) is missing the ELF
5 kx # generation flag '-G'. We check for presence of this flag, rather than
5 kx # hardcoding support by OS, in the interest of robustness.
5 kx AC_CACHE_CHECK([whether DTrace probes require linking],
5 kx [ac_cv_dtrace_link], [dnl
5 kx ac_cv_dtrace_link=no
5 kx echo 'BEGIN{}' > conftest.d
5 kx "$DTRACE" $DFLAGS -G -s conftest.d -o conftest.o > /dev/null 2>&1 && \
5 kx ac_cv_dtrace_link=yes
5 kx ])
5 kx if test "$ac_cv_dtrace_link" = "yes"; then
5 kx DTRACE_OBJS="Python/pydtrace.o"
5 kx fi
5 kx fi
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 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 hp*|HP*) DYNLOADFILE="dynload_hpux.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 if test -z "$MACHDEP_OBJS"; then
5 kx AC_MSG_RESULT([none])
5 kx else
5 kx AC_MSG_RESULT([$MACHDEP_OBJS])
5 kx fi
5 kx
5 kx # checks for library functions
5 kx AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
5 kx clock confstr close_range copy_file_range ctermid dup3 execv explicit_bzero \
5 kx explicit_memset faccessat fchmod fchmodat fchown fchownat \
5 kx fdwalk fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \
5 kx futimens futimes gai_strerror getentropy \
5 kx getgrgid_r getgrnam_r \
5 kx getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \
5 kx getpriority getresuid getresgid getpwent getpwnam_r getpwuid_r getspnam getspent getsid getwd \
5 kx if_nameindex \
5 kx initgroups kill killpg lchown lockf linkat lstat lutimes mmap \
5 kx memrchr mbrtowc mkdirat mkfifo \
5 kx madvise mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \
5 kx posix_fallocate posix_fadvise posix_spawn posix_spawnp pread preadv preadv2 \
5 kx pthread_condattr_setclock pthread_init pthread_kill pwrite pwritev pwritev2 \
5 kx readlink readlinkat readv realpath renameat \
5 kx sem_open sem_timedwait sem_clockwait sem_getvalue sem_unlink sendfile setegid seteuid \
5 kx setgid sethostname \
5 kx setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \
5 kx sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \
5 kx sched_rr_get_interval \
5 kx sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \
5 kx sigtimedwait sigwait sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \
5 kx sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
5 kx truncate uname unlinkat utimensat utimes vfork waitid waitpid wait3 wait4 \
5 kx wcscoll wcsftime wcsxfrm wmemcmp writev _getpty rtpSpawn)
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 AC_CHECK_DECL(dirfd,
5 kx AC_DEFINE(HAVE_DIRFD, 1,
5 kx Define if you have the 'dirfd' function or macro.), ,
5 kx [#include <sys/types.h>
5 kx #include <dirent.h>])
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 epoll_create1)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create1]])],
5 kx [AC_DEFINE(HAVE_EPOLL_CREATE1, 1, Define if you have the 'epoll_create1' function.)
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 AC_MSG_CHECKING(for prlimit)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <sys/time.h>
5 kx #include <sys/resource.h>
5 kx ]], [[void *x=prlimit]])],
5 kx [AC_DEFINE(HAVE_PRLIMIT, 1, Define if you have the 'prlimit' functions.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx AC_MSG_CHECKING(for _dyld_shared_cache_contains_path)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mach-o/dyld.h>]], [[void *x=_dyld_shared_cache_contains_path]])],
5 kx [AC_DEFINE(HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH, 1, Define if you have the '_dyld_shared_cache_contains_path' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx
5 kx AC_MSG_CHECKING(for memfd_create)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #ifdef HAVE_SYS_MMAN_H
5 kx #include <sys/mman.h>
5 kx #endif
5 kx #ifdef HAVE_SYS_MEMFD_H
5 kx #include <sys/memfd.h>
5 kx #endif
5 kx ]], [[void *x=memfd_create]])],
5 kx [AC_DEFINE(HAVE_MEMFD_CREATE, 1, Define if you have the 'memfd_create' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
5 kx
5 kx AC_MSG_CHECKING(for eventfd)
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #ifdef HAVE_SYS_EVENTFD_H
5 kx #include <sys/eventfd.h>
5 kx #endif
5 kx ]], [[int x = eventfd(0, EFD_CLOEXEC)]])],
5 kx [AC_DEFINE(HAVE_EVENTFD, 1, Define if you have the 'eventfd' function.)
5 kx AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)
5 kx ])
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 # 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)
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
5 kx # We search for both crypt and crypt_r as one or the other may be defined
5 kx # This gets us our -lcrypt in LIBS when required on the target platform.
5 kx AC_SEARCH_LIBS(crypt, crypt)
5 kx AC_SEARCH_LIBS(crypt_r, crypt)
5 kx
5 kx AC_CHECK_FUNC(crypt_r,
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx #define _GNU_SOURCE /* Required for crypt_r()'s prototype in glibc. */
5 kx #include <crypt.h>
5 kx ]], [[
5 kx struct crypt_data d;
5 kx char *r = crypt_r("", "", &d);
5 kx ]])],
5 kx [AC_DEFINE(HAVE_CRYPT_R, 1, [Define if you have the crypt_r() function.])],
5 kx [])
5 kx )
5 kx
5 kx AC_CHECK_FUNCS(clock_gettime, [], [
5 kx AC_CHECK_LIB(rt, clock_gettime, [
5 kx LIBS="$LIBS -lrt"
5 kx AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
5 kx AC_DEFINE(TIMEMODULE_LIB, [rt],
5 kx [Library needed by timemodule.c: librt may be needed for clock_gettime()])
5 kx ])
5 kx ])
5 kx
5 kx AC_CHECK_FUNCS(clock_getres, [], [
5 kx AC_CHECK_LIB(rt, clock_getres, [
5 kx AC_DEFINE(HAVE_CLOCK_GETRES, 1)
5 kx ])
5 kx ])
5 kx
5 kx AC_CHECK_FUNCS(clock_settime, [], [
5 kx AC_CHECK_LIB(rt, clock_settime, [
5 kx AC_DEFINE(HAVE_CLOCK_SETTIME, 1)
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 || test "$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 AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_passwd], [], [], [[
5 kx #include <sys/types.h>
5 kx #include <pwd.h>
5 kx ]])
5 kx # Issue #21085: In Cygwin, siginfo_t does not have si_band field.
5 kx AC_CHECK_MEMBERS([siginfo_t.si_band], [], [], [[#include <signal.h>]])
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 AC_MSG_CHECKING(for sockaddr_alg)
5 kx AC_CACHE_VAL(ac_cv_struct_sockaddr_alg,
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5 kx # include <sys/types.h>
5 kx # include <sys/socket.h>
5 kx # include <linux/if_alg.h>]], [[struct sockaddr_alg s]])],
5 kx [ac_cv_struct_sockaddr_alg=yes],
5 kx [ac_cv_struct_sockaddr_alg=no]))
5 kx AC_MSG_RESULT($ac_cv_struct_sockaddr_alg)
5 kx if test $ac_cv_struct_sockaddr_alg = yes; then
5 kx AC_DEFINE(HAVE_SOCKADDR_ALG, 1, [struct sockaddr_alg (linux/if_alg.h)])
5 kx fi
5 kx
5 kx # checks for compiler characteristics
5 kx
5 kx AC_C_CONST
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 # 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-libm=...
5 kx AC_SUBST(LIBM)
5 kx case $ac_sys_system in
5 kx Darwin) ;;
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], [override libm math library to STRING (default is system-dependent)]),
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], [override libc C library to STRING (default is system-dependent)]),
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 gcc x64 inline assembler *
5 kx # **************************************
5 kx
5 kx AC_MSG_CHECKING(for x64 gcc inline assembler)
5 kx AC_LINK_IFELSE( [AC_LANG_PROGRAM([[]], [[
5 kx __asm__ __volatile__ ("movq %rcx, %rax");
5 kx ]])],[have_gcc_asm_for_x64=yes],[have_gcc_asm_for_x64=no])
5 kx AC_MSG_RESULT($have_gcc_asm_for_x64)
5 kx if test "$have_gcc_asm_for_x64" = yes
5 kx then
5 kx AC_DEFINE(HAVE_GCC_ASM_FOR_X64, 1,
5 kx [Define if we can use x64 gcc inline assembler])
5 kx fi
5 kx
5 kx # **************************************************
5 kx # * Check for various properties of floating point *
5 kx # **************************************************
5 kx
5 kx AX_C_FLOAT_WORDS_BIGENDIAN
5 kx if test "$ax_cv_c_float_words_bigendian" = "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 elif test "$ax_cv_c_float_words_bigendian" = "no"
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 else
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 # FLOAT_WORDS_BIGENDIAN doesnt actually detect this case, but if it's not big
5 kx # or little, then it must be this?
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 AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set mc68881 fpcr)
5 kx AC_LINK_IFELSE( [AC_LANG_PROGRAM([[]], [[
5 kx unsigned int fpcr;
5 kx __asm__ __volatile__ ("fmove.l %%fpcr,%0" : "=g" (fpcr));
5 kx __asm__ __volatile__ ("fmove.l %0,%%fpcr" : : "g" (fpcr));
5 kx ]])],[have_gcc_asm_for_mc68881=yes],[have_gcc_asm_for_mc68881=no])
5 kx AC_MSG_RESULT($have_gcc_asm_for_mc68881)
5 kx if test "$have_gcc_asm_for_mc68881" = yes
5 kx then
5 kx AC_DEFINE(HAVE_GCC_ASM_FOR_MC68881, 1,
5 kx [Define if we can use gcc inline assembler to get and set mc68881 fpcr])
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 https://github.com/python/cpython/issues/47186 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 AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
5 kx AC_CHECK_FUNCS([hypot lgamma log1p log2 round tgamma])
5 kx AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
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 AC_CHECK_DECLS([RTLD_LAZY, RTLD_NOW, RTLD_GLOBAL, RTLD_LOCAL, RTLD_NODELETE, RTLD_NOLOAD, RTLD_DEEPBIND, RTLD_MEMBER], [], [], [[#include <dlfcn.h>]])
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@<:@=15|30@:>@],[use big digits (30 or 15 bits) for Python longs (default is system-dependent)]]),
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 return ((((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(whether wchar_t is usable)
5 kx # wchar_t is only usable if it maps to an unsigned type
5 kx if test "$ac_cv_sizeof_wchar_t" -ge 2 \
5 kx -a "$ac_cv_wchar_t_signed" = "no"
5 kx then
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_MSG_RESULT(yes)
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi
5 kx
5 kx case $ac_sys_system/$ac_sys_release in
5 kx SunOS/*)
5 kx if test -f /etc/os-release; then
5 kx OS_NAME=$(awk -F= '/^NAME=/ {print substr($2,2,length($2)-2)}' /etc/os-release)
5 kx if test "x$OS_NAME" = "xOracle Solaris"; then
5 kx # bpo-43667: In Oracle Solaris, the internal form of wchar_t in
5 kx # non-Unicode locales is not Unicode and hence cannot be used directly.
5 kx # https://docs.oracle.com/cd/E37838_01/html/E61053/gmwke.html
5 kx AC_DEFINE(HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION, 1,
5 kx [Define if the internal form of wchar_t in non-Unicode locales
5 kx is not Unicode.])
5 kx fi
5 kx fi
5 kx ;;
5 kx esac
5 kx
5 kx # check for endianness
5 kx AC_C_BIGENDIAN
5 kx
5 kx # ABI version string for Python extension modules. This appears between the
5 kx # periods in shared library file names, e.g. foo.<SOABI>.so. It is calculated
5 kx # from the following attributes which affect the ABI of this Python build (in
5 kx # this order):
5 kx #
5 kx # * The Python implementation (always 'cpython-' for us)
5 kx # * The major and minor version numbers
5 kx # * --with-pydebug (adds a 'd')
5 kx #
5 kx # Thus for example, Python 3.2 built with wide unicode, pydebug, and pymalloc,
5 kx # would get a shared library ABI version tag of 'cpython-32dmu' and shared
5 kx # libraries would be named 'foo.cpython-32dmu.so'.
5 kx #
5 kx # In Python 3.2 and older, --with-wide-unicode added a 'u' flag.
5 kx # In Python 3.7 and older, --with-pymalloc added a 'm' flag.
5 kx AC_SUBST(SOABI)
5 kx AC_MSG_CHECKING(ABIFLAGS)
5 kx AC_MSG_RESULT($ABIFLAGS)
5 kx AC_MSG_CHECKING(SOABI)
5 kx SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}
5 kx AC_MSG_RESULT($SOABI)
5 kx
5 kx # Release and debug (Py_DEBUG) ABI are compatible, but not Py_TRACE_REFS ABI
5 kx if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" != "yes"; then
5 kx # Similar to SOABI but remove "d" flag from ABIFLAGS
5 kx AC_SUBST(ALT_SOABI)
5 kx ALT_SOABI='cpython-'`echo $VERSION | tr -d .``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}
5 kx AC_DEFINE_UNQUOTED(ALT_SOABI, "${ALT_SOABI}",
5 kx [Alternative SOABI used in debug build to load C extensions built in release mode])
5 kx fi
5 kx
5 kx AC_SUBST(EXT_SUFFIX)
5 kx EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX}
5 kx
5 kx AC_MSG_CHECKING(LDVERSION)
5 kx LDVERSION='$(VERSION)$(ABIFLAGS)'
5 kx AC_MSG_RESULT($LDVERSION)
5 kx
5 kx # On Android and Cygwin the shared libraries must be linked with libpython.
5 kx AC_SUBST(LIBPYTHON)
5 kx if test -n "$ANDROID_API_LEVEL" -o "$MACHDEP" = "cygwin"; then
5 kx LIBPYTHON="-lpython${VERSION}${ABIFLAGS}"
5 kx else
5 kx LIBPYTHON=''
5 kx fi
5 kx
5 kx
5 kx AC_SUBST(BINLIBDEST)
5 kx BINLIBDEST='$(LIBDIR)/python$(VERSION)'
5 kx
5 kx
5 kx # Check for --with-platlibdir
5 kx # /usr/$LIDIRNAME/python$VERSION
5 kx AC_SUBST(PLATLIBDIR)
5 kx PLATLIBDIR="lib"
5 kx AC_MSG_CHECKING(for --with-platlibdir)
5 kx AC_ARG_WITH(platlibdir,
5 kx AS_HELP_STRING([--with-platlibdir=DIRNAME],
5 kx [Python library directory name (default is "lib")]),
5 kx [
5 kx # ignore 3 options:
5 kx # --with-platlibdir
5 kx # --with-platlibdir=
5 kx # --without-platlibdir
5 kx if test -n "$withval" -a "$withval" != yes -a "$withval" != no
5 kx then
5 kx AC_MSG_RESULT(yes)
5 kx PLATLIBDIR="$withval"
5 kx BINLIBDEST='${exec_prefix}/${PLATLIBDIR}/python$(VERSION)'
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi],
5 kx [AC_MSG_RESULT(no)])
5 kx
5 kx
5 kx dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
5 kx AC_SUBST(PY_ENABLE_SHARED)
5 kx if test x$PLATFORM_TRIPLET = x; then
5 kx LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}"
5 kx else
5 kx LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
5 kx fi
5 kx AC_SUBST(LIBPL)
5 kx
5 kx # Check for --with-wheel-pkg-dir=PATH
5 kx AC_SUBST(WHEEL_PKG_DIR)
5 kx WHEEL_PKG_DIR=""
5 kx AC_MSG_CHECKING(for --with-wheel-pkg-dir)
5 kx AC_ARG_WITH(wheel-pkg-dir,
5 kx AS_HELP_STRING([--with-wheel-pkg-dir=PATH],
5 kx [Directory of wheel packages used by ensurepip (default: none)]),
5 kx [
5 kx if test -n "$withval"; then
5 kx AC_MSG_RESULT(yes)
5 kx WHEEL_PKG_DIR="$withval"
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi],
5 kx [AC_MSG_RESULT(no)])
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 return (((-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 AC_ARG_WITH([readline],
5 kx [AS_HELP_STRING([--with(out)-readline@<:@=editline@:>@],
5 kx [use Editline for backend or disable readline module])],
5 kx [],
5 kx [with_readline=yes])
5 kx
5 kx # check where readline lives
5 kx py_cv_lib_readline=no
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 if test "$with_readline" != no; then
5 kx case "$with_readline" in
5 kx editline|edit)
5 kx LIBREADLINE=edit
5 kx AC_DEFINE(WITH_EDITLINE, 1,
5 kx [Define to build the readline module against Editline.])
5 kx ;;
5 kx yes|readline)
5 kx LIBREADLINE=readline
5 kx ;;
5 kx *)
5 kx AC_MSG_ERROR([proper usage is --with(out)-readline@<:@=editline@:>@])
5 kx ;;
5 kx esac
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 AC_MSG_CHECKING([how to link readline libs])
5 kx for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
5 kx if test -z "$py_libtermcap"; then
5 kx READLINE_LIBS="-l$LIBREADLINE"
5 kx else
5 kx READLINE_LIBS="-l$LIBREADLINE -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
5 kx # Uncomment this line if you want to use READLINE_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 to build the readline module.])
5 kx fi
5 kx fi
5 kx
5 kx if test "$py_cv_lib_readline" = yes; then
5 kx # check for readline 2.2
5 kx AC_CHECK_DECL(rl_completion_append_character,
5 kx AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
5 kx [Define if you have readline 2.2]),,
5 kx [
5 kx #include <stdio.h> /* Must be first for Gnu Readline */
5 kx #ifdef WITH_EDITLINE
5 kx # include <editline/readline.h>
5 kx #else
5 kx # include <readline/readline.h>
5 kx #endif
5 kx ])
5 kx AC_CHECK_DECL(rl_completion_suppress_append,
5 kx AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
5 kx [Define if you have rl_completion_suppress_append]),,
5 kx [
5 kx #include <stdio.h> /* Must be first for Gnu Readline */
5 kx #ifdef WITH_EDITLINE
5 kx # include <editline/readline.h>
5 kx #else
5 kx # include <readline/readline.h>
5 kx #endif
5 kx ])
5 kx
5 kx # check for readline 4.0
5 kx AC_CHECK_LIB($LIBREADLINE, 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($LIBREADLINE, 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($LIBREADLINE, 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($LIBREADLINE, 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_CHECK_DECL(rl_catch_signals,
5 kx AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
5 kx [Define if you can turn off readline's signal handling.]),,
5 kx [
5 kx #include <stdio.h> /* Must be first for Gnu Readline */
5 kx #ifdef WITH_EDITLINE
5 kx # include <editline/readline.h>
5 kx #else
5 kx # include <readline/readline.h>
5 kx #endif
5 kx ])
5 kx
5 kx AC_CHECK_LIB($LIBREADLINE, append_history,
5 kx AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1,
5 kx [Define if readline supports append_history]),,$READLINE_LIBS)
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 #include <unistd.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 header check
5 kx ac_save_cppflags="$CPPFLAGS"
5 kx if test "$cross_compiling" = no; then
5 kx CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
5 kx fi
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 $ac_sys_system = Darwin
5 kx then
5 kx LIBS="$LIBS -framework CoreFoundation"
5 kx fi
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 AC_MSG_CHECKING(for broken mbstowcs)
5 kx AC_CACHE_VAL(ac_cv_broken_mbstowcs,
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <stdio.h>
5 kx #include<stdlib.h>
5 kx int main() {
5 kx size_t len = -1;
5 kx const char *str = "text";
5 kx len = mbstowcs(NULL, str, 0);
5 kx return (len != 4);
5 kx }
5 kx ]])],
5 kx [ac_cv_broken_mbstowcs=no],
5 kx [ac_cv_broken_mbstowcs=yes],
5 kx [ac_cv_broken_mbstowcs=no]))
5 kx AC_MSG_RESULT($ac_cv_broken_mbstowcs)
5 kx if test "$ac_cv_broken_mbstowcs" = yes
5 kx then
5 kx AC_DEFINE(HAVE_BROKEN_MBSTOWCS, 1,
5 kx [Define if mbstowcs(NULL, "text", 0) does not return the number of
5 kx wide chars that would be converted.])
5 kx fi
5 kx
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-computed-gotos],
5 kx [enable 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
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 Programs"
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 AC_MSG_RESULT(done)
5 kx
5 kx # Availability of -O2:
5 kx AC_MSG_CHECKING(for -O2)
5 kx saved_cflags="$CFLAGS"
5 kx CFLAGS="-O2"
5 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
5 kx ]])],[have_O2=yes],[have_O2=no])
5 kx AC_MSG_RESULT($have_O2)
5 kx CFLAGS="$saved_cflags"
5 kx
5 kx # _FORTIFY_SOURCE wrappers for memmove and bcopy are incorrect:
5 kx # http://sourceware.org/ml/libc-alpha/2010-12/msg00009.html
5 kx AC_MSG_CHECKING(for glibc _FORTIFY_SOURCE/memmove bug)
5 kx saved_cflags="$CFLAGS"
5 kx CFLAGS="-O2 -D_FORTIFY_SOURCE=2"
5 kx if test "$have_O2" = no; then
5 kx CFLAGS=""
5 kx fi
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx #include <stdio.h>
5 kx #include <stdlib.h>
5 kx #include <string.h>
5 kx void foo(void *p, void *q) { memmove(p, q, 19); }
5 kx int main() {
5 kx char a[32] = "123456789000000000";
5 kx foo(&a[9], a);
5 kx if (strcmp(a, "123456789123456789000000000") != 0)
5 kx return 1;
5 kx foo(a, &a[9]);
5 kx if (strcmp(a, "123456789000000000") != 0)
5 kx return 1;
5 kx return 0;
5 kx }
5 kx ]])],
5 kx [have_glibc_memmove_bug=no],
5 kx [have_glibc_memmove_bug=yes],
5 kx [have_glibc_memmove_bug=undefined])
5 kx CFLAGS="$saved_cflags"
5 kx AC_MSG_RESULT($have_glibc_memmove_bug)
5 kx if test "$have_glibc_memmove_bug" = yes; then
5 kx AC_DEFINE(HAVE_GLIBC_MEMMOVE_BUG, 1,
5 kx [Define if glibc has incorrect _FORTIFY_SOURCE wrappers
5 kx for memmove and bcopy.])
5 kx fi
5 kx
5 kx if test "$have_gcc_asm_for_x87" = yes; then
5 kx # Some versions of gcc miscompile inline asm:
5 kx # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
5 kx # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
5 kx case $CC in
5 kx *gcc*)
5 kx AC_MSG_CHECKING(for gcc ipa-pure-const bug)
5 kx saved_cflags="$CFLAGS"
5 kx CFLAGS="-O2"
5 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
5 kx __attribute__((noinline)) int
5 kx foo(int *p) {
5 kx int r;
5 kx asm ( "movl \$6, (%1)\n\t"
5 kx "xorl %0, %0\n\t"
5 kx : "=r" (r) : "r" (p) : "memory"
5 kx );
5 kx return r;
5 kx }
5 kx int main() {
5 kx int p = 8;
5 kx if ((foo(&p) ? : p) != 6)
5 kx return 1;
5 kx return 0;
5 kx }
5 kx ]])],
5 kx [have_ipa_pure_const_bug=no],
5 kx [have_ipa_pure_const_bug=yes],
5 kx [have_ipa_pure_const_bug=undefined])
5 kx CFLAGS="$saved_cflags"
5 kx AC_MSG_RESULT($have_ipa_pure_const_bug)
5 kx if test "$have_ipa_pure_const_bug" = yes; then
5 kx AC_DEFINE(HAVE_IPA_PURE_CONST_BUG, 1,
5 kx [Define if gcc has the ipa-pure-const bug.])
5 kx fi
5 kx ;;
5 kx esac
5 kx fi
5 kx
5 kx # Check for stdatomic.h
5 kx AC_MSG_CHECKING(for stdatomic.h)
5 kx AC_LINK_IFELSE(
5 kx [
5 kx AC_LANG_SOURCE([[
5 kx #include <stdatomic.h>
5 kx atomic_int int_var;
5 kx atomic_uintptr_t uintptr_var;
5 kx int main() {
5 kx atomic_store_explicit(&int_var, 5, memory_order_relaxed);
5 kx atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
5 kx int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
5 kx return 0;
5 kx }
5 kx ]])
5 kx ],[have_stdatomic_h=yes],[have_stdatomic_h=no])
5 kx
5 kx AC_MSG_RESULT($have_stdatomic_h)
5 kx
5 kx if test "$have_stdatomic_h" = yes; then
5 kx AC_DEFINE(HAVE_STD_ATOMIC, 1,
5 kx [Has stdatomic.h with atomic_int and atomic_uintptr_t])
5 kx fi
5 kx
5 kx # Check for GCC >= 4.7 and clang __atomic builtin functions
5 kx AC_MSG_CHECKING(for builtin __atomic_load_n and __atomic_store_n functions)
5 kx AC_LINK_IFELSE(
5 kx [
5 kx AC_LANG_SOURCE([[
5 kx int val;
5 kx int main() {
5 kx __atomic_store_n(&val, 1, __ATOMIC_SEQ_CST);
5 kx (void)__atomic_load_n(&val, __ATOMIC_SEQ_CST);
5 kx return 0;
5 kx }
5 kx ]])
5 kx ],[have_builtin_atomic=yes],[have_builtin_atomic=no])
5 kx
5 kx AC_MSG_RESULT($have_builtin_atomic)
5 kx
5 kx if test "$have_builtin_atomic" = yes; then
5 kx AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Has builtin __atomic_load_n() and __atomic_store_n() functions])
5 kx fi
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-ensurepip@<:@=install|upgrade|no@:>@],
5 kx ["install" or "upgrade" using bundled pip (default is upgrade)])],
5 kx [],
5 kx [with_ensurepip=upgrade])
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 # check if the dirent structure of a d_type field and DT_UNKNOWN is defined
5 kx AC_MSG_CHECKING(if the dirent structure of a d_type field)
5 kx AC_LINK_IFELSE(
5 kx [
5 kx AC_LANG_SOURCE([[
5 kx #include <dirent.h>
5 kx
5 kx int main() {
5 kx struct dirent entry;
5 kx return entry.d_type == DT_UNKNOWN;
5 kx }
5 kx ]])
5 kx ],[have_dirent_d_type=yes],[have_dirent_d_type=no])
5 kx AC_MSG_RESULT($have_dirent_d_type)
5 kx
5 kx if test "$have_dirent_d_type" = yes; then
5 kx AC_DEFINE(HAVE_DIRENT_D_TYPE, 1,
5 kx [Define to 1 if the dirent structure has a d_type field])
5 kx fi
5 kx
5 kx # check if the Linux getrandom() syscall is available
5 kx AC_MSG_CHECKING(for the Linux getrandom() syscall)
5 kx AC_LINK_IFELSE(
5 kx [
5 kx AC_LANG_SOURCE([[
5 kx #include <unistd.h>
5 kx #include <sys/syscall.h>
5 kx #include <linux/random.h>
5 kx
5 kx int main() {
5 kx char buffer[1];
5 kx const size_t buflen = sizeof(buffer);
5 kx const int flags = GRND_NONBLOCK;
5 kx /* ignore the result, Python checks for ENOSYS and EAGAIN at runtime */
5 kx (void)syscall(SYS_getrandom, buffer, buflen, flags);
5 kx return 0;
5 kx }
5 kx ]])
5 kx ],[have_getrandom_syscall=yes],[have_getrandom_syscall=no])
5 kx AC_MSG_RESULT($have_getrandom_syscall)
5 kx
5 kx if test "$have_getrandom_syscall" = yes; then
5 kx AC_DEFINE(HAVE_GETRANDOM_SYSCALL, 1,
5 kx [Define to 1 if the Linux getrandom() syscall is available])
5 kx fi
5 kx
5 kx # check if the getrandom() function is available
5 kx # the test was written for the Solaris function of <sys/random.h>
5 kx AC_MSG_CHECKING(for the getrandom() function)
5 kx AC_LINK_IFELSE(
5 kx [
5 kx AC_LANG_SOURCE([[
5 kx #include <sys/random.h>
5 kx
5 kx int main() {
5 kx char buffer[1];
5 kx const size_t buflen = sizeof(buffer);
5 kx const int flags = 0;
5 kx /* ignore the result, Python checks for ENOSYS at runtime */
5 kx (void)getrandom(buffer, buflen, flags);
5 kx return 0;
5 kx }
5 kx ]])
5 kx ],[have_getrandom=yes],[have_getrandom=no])
5 kx AC_MSG_RESULT($have_getrandom)
5 kx
5 kx if test "$have_getrandom" = yes; then
5 kx AC_DEFINE(HAVE_GETRANDOM, 1,
5 kx [Define to 1 if the getrandom() function is available])
5 kx fi
5 kx
5 kx # checks for POSIX shared memory, used by Modules/_multiprocessing/posixshmem.c
5 kx # shm_* may only be available if linking against librt
5 kx save_LIBS="$LIBS"
5 kx save_includes_default="$ac_includes_default"
5 kx AC_SEARCH_LIBS(shm_open, rt)
5 kx if test "$ac_cv_search_shm_open" = "-lrt"; then
5 kx AC_DEFINE(SHM_NEEDS_LIBRT, 1,
5 kx [Define to 1 if you must link with -lrt for shm_open().])
5 kx fi
5 kx AC_CHECK_HEADERS(sys/mman.h)
5 kx # temporarily override ac_includes_default for AC_CHECK_FUNCS below
5 kx ac_includes_default="\
5 kx ${ac_includes_default}
5 kx #ifndef __cplusplus
5 kx # ifdef HAVE_SYS_MMAN_H
5 kx # include <sys/mman.h>
5 kx # endif
5 kx #endif
5 kx "
5 kx AC_CHECK_FUNCS([shm_open shm_unlink])
5 kx # we don't want to link with librt always, restore LIBS
5 kx LIBS="$save_LIBS"
5 kx ac_includes_default="$save_includes_default"
5 kx
5 kx # Check for usable OpenSSL
5 kx AX_CHECK_OPENSSL([have_openssl=yes],[have_openssl=no])
5 kx
5 kx # rpath to libssl and libcrypto
5 kx AC_MSG_CHECKING(for --with-openssl-rpath)
5 kx AC_ARG_WITH(openssl-rpath,
5 kx AS_HELP_STRING([--with-openssl-rpath=@<:@DIR|auto|no@:>@],
5 kx [Set runtime library directory (rpath) for OpenSSL libraries,
5 kx no (default): don't set rpath,
5 kx auto: auto-detect rpath from --with-openssl and pkg-config,
5 kx DIR: set an explicit rpath
5 kx ]),
5 kx [],
5 kx [with_openssl_rpath=no]
5 kx )
5 kx AS_CASE($with_openssl_rpath,
5 kx [auto|yes],[OPENSSL_RPATH=auto],
5 kx [no],[OPENSSL_RPATH=],
5 kx [AS_IF(
5 kx [test -d "$with_openssl_rpath"],
5 kx [OPENSSL_RPATH="$with_openssl_rpath"],
5 kx AC_MSG_ERROR([--with-openssl-rpath "$with_openssl_rpath" is not a directory]))
5 kx ]
5 kx )
5 kx AC_MSG_RESULT($OPENSSL_RPATH)
5 kx AC_SUBST([OPENSSL_RPATH])
5 kx
5 kx # check if OpenSSL libraries work as expected
5 kx AC_MSG_CHECKING(whether OpenSSL provides required APIs)
5 kx save_LIBS="$LIBS"
5 kx save_CFLAGS="$CFLAGS"
5 kx save_LDFLAGS="$LDFLAGS"
5 kx LIBS="$LIBS $OPENSSL_LIBS"
5 kx CFLAGS="$CFLAGS_NODIST $OPENSSL_INCLUDES"
5 kx LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
5 kx
5 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[
5 kx #include <openssl/opensslv.h>
5 kx #include <openssl/evp.h>
5 kx #include <openssl/ssl.h>
5 kx
5 kx #if OPENSSL_VERSION_NUMBER < 0x10101000L
5 kx #error "OpenSSL >= 1.1.1 is required"
5 kx #endif
5 kx
5 kx static void keylog_cb(const SSL *ssl, const char *line) {}
5 kx ]], [[
5 kx /* SSL APIs */
5 kx SSL_CTX *ctx = SSL_CTX_new(TLS_client_method());
5 kx SSL_CTX_set_keylog_callback(ctx, keylog_cb);
5 kx SSL *ssl = SSL_new(ctx);
5 kx X509_VERIFY_PARAM *param = SSL_get0_param(ssl);
5 kx X509_VERIFY_PARAM_set1_host(param, "python.org", 0);
5 kx SSL_free(ssl);
5 kx SSL_CTX_free(ctx);
5 kx
5 kx /* hashlib APIs */
5 kx OBJ_nid2sn(NID_md5);
5 kx OBJ_nid2sn(NID_sha1);
5 kx OBJ_nid2sn(NID_sha3_512);
5 kx OBJ_nid2sn(NID_blake2b512);
5 kx EVP_PBE_scrypt(NULL, 0, NULL, 0, 2, 8, 1, 0, NULL, 0);
5 kx ]])],
5 kx [AC_MSG_RESULT(yes)],
5 kx [AC_MSG_RESULT(no)])
5 kx LIBS="$save_LIBS"
5 kx CFLAGS="$save_CFLAGS"
5 kx LDFLAGS="$save_LDFLAGS"
5 kx
5 kx # ssl module default cipher suite string
5 kx AH_TEMPLATE(PY_SSL_DEFAULT_CIPHERS,
5 kx [Default cipher suites list for ssl module.
5 kx 1: Python's preferred selection, 2: leave OpenSSL defaults untouched, 0: custom string])
5 kx AH_TEMPLATE(PY_SSL_DEFAULT_CIPHER_STRING,
5 kx [Cipher suite string for PY_SSL_DEFAULT_CIPHERS=0]
5 kx )
5 kx
5 kx AC_MSG_CHECKING(for --with-ssl-default-suites)
5 kx AC_ARG_WITH(ssl-default-suites,
5 kx AS_HELP_STRING([--with-ssl-default-suites=@<:@python|openssl|STRING@:>@],
5 kx [override default cipher suites string,
5 kx python: use Python's preferred selection (default),
5 kx openssl: leave OpenSSL's defaults untouched,
5 kx STRING: use a custom string,
5 kx python and STRING also set TLS 1.2 as minimum TLS version]),
5 kx [
5 kx AC_MSG_RESULT($withval)
5 kx case "$withval" in
5 kx python)
5 kx AC_DEFINE(PY_SSL_DEFAULT_CIPHERS, 1)
5 kx ;;
5 kx openssl)
5 kx AC_DEFINE(PY_SSL_DEFAULT_CIPHERS, 2)
5 kx ;;
5 kx *)
5 kx AC_DEFINE(PY_SSL_DEFAULT_CIPHERS, 0)
5 kx AC_DEFINE_UNQUOTED(PY_SSL_DEFAULT_CIPHER_STRING, "$withval")
5 kx ;;
5 kx esac
5 kx ],
5 kx [
5 kx AC_MSG_RESULT(python)
5 kx AC_DEFINE(PY_SSL_DEFAULT_CIPHERS, 1)
5 kx ])
5 kx
5 kx # builtin hash modules
5 kx default_hashlib_hashes="md5,sha1,sha256,sha512,sha3,blake2"
5 kx AC_DEFINE([PY_BUILTIN_HASHLIB_HASHES], [], [enabled builtin hash modules]
5 kx )
5 kx AC_MSG_CHECKING(for --with-builtin-hashlib-hashes)
5 kx AC_ARG_WITH(builtin-hashlib-hashes,
5 kx AS_HELP_STRING([--with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2],
5 kx [builtin hash modules,
5 kx md5, sha1, sha256, sha512, sha3 (with shake), blake2]),
5 kx [
5 kx case "$withval" in
5 kx yes)
5 kx withval=$default_hashlib_hashes
5 kx ;;
5 kx no)
5 kx withval=""
5 kx ;;
5 kx esac
5 kx AC_MSG_RESULT($withval)
5 kx AC_DEFINE_UNQUOTED(PY_BUILTIN_HASHLIB_HASHES, "$withval")
5 kx ],
5 kx [
5 kx AC_MSG_RESULT($default_hashlib_hashes);
5 kx AC_DEFINE_UNQUOTED(PY_BUILTIN_HASHLIB_HASHES, "$default_hashlib_hashes")
5 kx ])
5 kx
5 kx # --with-experimental-isolated-subinterpreters
5 kx AH_TEMPLATE(EXPERIMENTAL_ISOLATED_SUBINTERPRETERS,
5 kx [Better isolate subinterpreters, experimental build mode.])
5 kx AC_MSG_CHECKING(for --with-experimental-isolated-subinterpreters)
5 kx AC_ARG_WITH(experimental-isolated-subinterpreters,
5 kx AS_HELP_STRING([--with-experimental-isolated-subinterpreters],
5 kx [better isolate subinterpreters, experimental build mode (default is no)]),
5 kx [
5 kx if test "$withval" != no
5 kx then
5 kx AC_MSG_RESULT(yes);
5 kx AC_DEFINE(EXPERIMENTAL_ISOLATED_SUBINTERPRETERS)
5 kx else
5 kx AC_MSG_RESULT(no);
5 kx fi],
5 kx [AC_MSG_RESULT(no)])
5 kx
5 kx # --with-static-libpython
5 kx STATIC_LIBPYTHON=1
5 kx AC_MSG_CHECKING(for --with-static-libpython)
5 kx AC_ARG_WITH(static-libpython,
5 kx AS_HELP_STRING([--without-static-libpython],
5 kx [do not build libpythonMAJOR.MINOR.a and do not install python.o (default is yes)]),
5 kx [
5 kx if test "$withval" = no
5 kx then
5 kx AC_MSG_RESULT(no);
5 kx STATIC_LIBPYTHON=0
5 kx else
5 kx AC_MSG_RESULT(yes);
5 kx fi],
5 kx [AC_MSG_RESULT(yes)])
5 kx LIBRARY_DEPS='$(PY3LIBRARY) $(EXPORTSYMS)'
5 kx if test "$PY_ENABLE_SHARED" = 1 || test "$enable_framework" ; then
5 kx LIBRARY_DEPS="\$(LDLIBRARY) $LIBRARY_DEPS"
5 kx if test "$STATIC_LIBPYTHON" = 1; then
5 kx LIBRARY_DEPS="\$(LIBRARY) $LIBRARY_DEPS"
5 kx fi
5 kx else
5 kx LIBRARY_DEPS="\$(LIBRARY) $LIBRARY_DEPS"
5 kx fi
5 kx AC_SUBST(STATIC_LIBPYTHON)
5 kx AC_SUBST(LIBRARY_DEPS)
5 kx
5 kx # Check whether to disable test modules. Once set, setup.py will not build
5 kx # test extension modules and "make install" will not install test suites.
5 kx AC_MSG_CHECKING(for --disable-test-modules)
5 kx AC_ARG_ENABLE(test-modules,
5 kx AS_HELP_STRING([--disable-test-modules], [don't build nor install test modules]))
5 kx if test "$enable_test_modules" = no; then
5 kx TEST_MODULES=no
5 kx AC_MSG_RESULT(yes)
5 kx else
5 kx TEST_MODULES=yes
5 kx AC_MSG_RESULT(no)
5 kx fi
5 kx AC_SUBST(TEST_MODULES)
5 kx
5 kx
5 kx # generate output files
5 kx AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh)
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.local" >&AS_MESSAGE_FD
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" >&AS_MESSAGE_FD
5 kx $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
5 kx -s Modules \
5 kx Modules/Setup.local $srcdir/Modules/Setup
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 stable optimizations active (PGO, etc)," >&AS_MESSAGE_FD
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