Benjamin Peterson | d7c7784 | 2008-05-26 13:01:25 +0000 | [diff] [blame] | 1 | dnl *********************************************** |
| 2 | dnl * Please run autoreconf to test your changes! * |
| 3 | dnl *********************************************** |
Martin v. Löwis | 88afe66 | 2002-10-26 13:47:44 +0000 | [diff] [blame] | 4 | |
| 5 | # Set VERSION so we only need to edit in one place (i.e., here) |
Martin v. Löwis | 174440b | 2008-10-03 08:59:41 +0000 | [diff] [blame] | 6 | m4_define(PYTHON_VERSION, 2.7) |
Martin v. Löwis | 88afe66 | 2002-10-26 13:47:44 +0000 | [diff] [blame] | 7 | |
Georg Brandl | 71f4fbb | 2011-02-25 11:04:50 +0000 | [diff] [blame] | 8 | AC_PREREQ(2.65) |
Alexandre Vassalotti | 130ae15 | 2009-07-18 00:31:06 +0000 | [diff] [blame] | 9 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 10 | AC_REVISION($Revision$) |
Benjamin Peterson | cc8929b | 2016-08-03 22:01:32 -0700 | [diff] [blame] | 11 | AC_INIT(python, PYTHON_VERSION, https://bugs.python.org/) |
Martin v. Löwis | 88afe66 | 2002-10-26 13:47:44 +0000 | [diff] [blame] | 12 | AC_CONFIG_SRCDIR([Include/object.h]) |
Martin v. Löwis | 4f1cd8b | 2001-07-26 13:41:06 +0000 | [diff] [blame] | 13 | AC_CONFIG_HEADER(pyconfig.h) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 14 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 15 | AC_CANONICAL_HOST |
| 16 | AC_SUBST(build) |
| 17 | AC_SUBST(host) |
| 18 | |
Ned Deily | 983df86 | 2014-08-22 13:30:59 -0700 | [diff] [blame] | 19 | # pybuilddir.txt will be created by --generate-posix-vars in the Makefile |
| 20 | rm -f pybuilddir.txt |
| 21 | |
Victor Stinner | 8a19eb2 | 2017-05-05 03:14:23 +0200 | [diff] [blame] | 22 | AC_CHECK_PROGS(PYTHON_FOR_REGEN, python$PACKAGE_VERSION python3 python, python3) |
| 23 | AC_SUBST(PYTHON_FOR_REGEN) |
| 24 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 25 | if test "$cross_compiling" = yes; then |
| 26 | AC_MSG_CHECKING([for python interpreter for cross build]) |
| 27 | if test -z "$PYTHON_FOR_BUILD"; then |
| 28 | for interp in python$PACKAGE_VERSION python2 python; do |
| 29 | which $interp >/dev/null 2>&1 || continue |
| 30 | if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then |
| 31 | break |
| 32 | fi |
| 33 | interp= |
| 34 | done |
| 35 | if test x$interp = x; then |
| 36 | AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found]) |
| 37 | fi |
| 38 | AC_MSG_RESULT($interp) |
doko@ubuntu.com | 9e7ece2 | 2015-04-13 21:55:08 +0200 | [diff] [blame] | 39 | 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/$(PLATDIR) '$interp |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 40 | fi |
| 41 | elif test "$cross_compiling" = maybe; then |
| 42 | AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) |
| 43 | else |
| 44 | PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' |
| 45 | fi |
| 46 | AC_SUBST(PYTHON_FOR_BUILD) |
| 47 | |
Georg Brandl | bcd64a3 | 2009-03-31 21:45:18 +0000 | [diff] [blame] | 48 | dnl Ensure that if prefix is specified, it does not end in a slash. If |
| 49 | dnl it does, we get path names containing '//' which is both ugly and |
| 50 | dnl can cause trouble. |
| 51 | |
| 52 | dnl Last slash shouldn't be stripped if prefix=/ |
| 53 | if test "$prefix" != "/"; then |
| 54 | prefix=`echo "$prefix" | sed -e 's/\/$//g'` |
| 55 | fi |
| 56 | |
Martin v. Löwis | 8316feb | 2003-06-14 07:48:07 +0000 | [diff] [blame] | 57 | dnl This is for stuff that absolutely must end up in pyconfig.h. |
| 58 | dnl Please use pyport.h instead, if possible. |
Martin v. Löwis | bddf5a5 | 2002-11-11 13:37:28 +0000 | [diff] [blame] | 59 | AH_TOP([ |
| 60 | #ifndef Py_PYCONFIG_H |
| 61 | #define Py_PYCONFIG_H |
| 62 | ]) |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 63 | AH_BOTTOM([ |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 64 | /* Define the macros needed if on a UnixWare 7.x system. */ |
| 65 | #if defined(__USLC__) && defined(__SCO_VERSION__) |
| 66 | #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ |
| 67 | #endif |
Martin v. Löwis | bddf5a5 | 2002-11-11 13:37:28 +0000 | [diff] [blame] | 68 | |
| 69 | #endif /*Py_PYCONFIG_H*/ |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 70 | ]) |
| 71 | |
Martin v. Löwis | 8316feb | 2003-06-14 07:48:07 +0000 | [diff] [blame] | 72 | # We don't use PACKAGE_ variables, and they cause conflicts |
| 73 | # with other autoconf-based packages that include Python.h |
| 74 | grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new |
| 75 | rm confdefs.h |
| 76 | mv confdefs.h.new confdefs.h |
| 77 | |
Guido van Rossum | 642b678 | 1997-07-19 19:35:41 +0000 | [diff] [blame] | 78 | AC_SUBST(VERSION) |
Martin v. Löwis | 88afe66 | 2002-10-26 13:47:44 +0000 | [diff] [blame] | 79 | VERSION=PYTHON_VERSION |
Guido van Rossum | 642b678 | 1997-07-19 19:35:41 +0000 | [diff] [blame] | 80 | |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 81 | AC_SUBST(SOVERSION) |
| 82 | SOVERSION=1.0 |
| 83 | |
Martin v. Löwis | 6f18a3c | 2002-07-20 08:51:52 +0000 | [diff] [blame] | 84 | # The later defininition of _XOPEN_SOURCE disables certain features |
| 85 | # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone). |
| 86 | AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features]) |
| 87 | |
Martin v. Löwis | bcd9396 | 2003-05-03 10:32:18 +0000 | [diff] [blame] | 88 | # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables |
| 89 | # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable |
| 90 | # them. |
| 91 | AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features]) |
| 92 | |
Andrew MacIntyre | abccf41 | 2003-07-02 13:53:25 +0000 | [diff] [blame] | 93 | # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables |
| 94 | # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable |
| 95 | # them. |
| 96 | AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features]) |
| 97 | |
Martin v. Löwis | d632050 | 2004-08-12 13:45:08 +0000 | [diff] [blame] | 98 | # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables |
| 99 | # u_int on Irix 5.3. Defining _BSD_TYPES brings it back. |
| 100 | AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int]) |
| 101 | |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 102 | # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables |
| 103 | # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable |
| 104 | # them. |
| 105 | AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features]) |
| 106 | |
| 107 | |
Martin v. Löwis | e981a4e | 2002-11-11 13:26:51 +0000 | [diff] [blame] | 108 | define_xopen_source=yes |
Martin v. Löwis | 6f18a3c | 2002-07-20 08:51:52 +0000 | [diff] [blame] | 109 | |
Neil Schemenauer | 4edbc2a | 2001-03-22 00:34:03 +0000 | [diff] [blame] | 110 | # Arguments passed to configure. |
| 111 | AC_SUBST(CONFIG_ARGS) |
| 112 | CONFIG_ARGS="$ac_configure_args" |
| 113 | |
Ronald Oussoren | 3c0a126 | 2010-01-17 19:27:57 +0000 | [diff] [blame] | 114 | AC_MSG_CHECKING([for --enable-universalsdk]) |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 115 | AC_ARG_ENABLE(universalsdk, |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 116 | AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build fat binary against Mac OS X SDK]), |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 117 | [ |
| 118 | case $enableval in |
| 119 | yes) |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 120 | # Locate the best usable SDK, see Mac/README.txt for more |
| 121 | # information |
| 122 | enableval="`/usr/bin/xcodebuild -version -sdk macosx Path 2>/dev/null`" |
| 123 | if ! ( echo $enableval | grep -E '\.sdk' 1>/dev/null ) |
Ronald Oussoren | 3c0a126 | 2010-01-17 19:27:57 +0000 | [diff] [blame] | 124 | then |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 125 | enableval=/Developer/SDKs/MacOSX10.4u.sdk |
| 126 | if test ! -d "${enableval}" |
| 127 | then |
| 128 | enableval=/ |
| 129 | fi |
Ronald Oussoren | 3c0a126 | 2010-01-17 19:27:57 +0000 | [diff] [blame] | 130 | fi |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 131 | ;; |
| 132 | esac |
| 133 | case $enableval in |
| 134 | no) |
| 135 | UNIVERSALSDK= |
| 136 | enable_universalsdk= |
| 137 | ;; |
| 138 | *) |
| 139 | UNIVERSALSDK=$enableval |
Ronald Oussoren | 3c0a126 | 2010-01-17 19:27:57 +0000 | [diff] [blame] | 140 | if test ! -d "${UNIVERSALSDK}" |
| 141 | then |
| 142 | AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}]) |
| 143 | fi |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 144 | ;; |
| 145 | esac |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 146 | |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 147 | ],[ |
| 148 | UNIVERSALSDK= |
| 149 | enable_universalsdk= |
| 150 | ]) |
Ronald Oussoren | 3c0a126 | 2010-01-17 19:27:57 +0000 | [diff] [blame] | 151 | if test -n "${UNIVERSALSDK}" |
| 152 | then |
| 153 | AC_MSG_RESULT(${UNIVERSALSDK}) |
| 154 | else |
| 155 | AC_MSG_RESULT(no) |
| 156 | fi |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 157 | AC_SUBST(UNIVERSALSDK) |
| 158 | |
Benjamin Peterson | 0e6ea5d | 2008-07-16 20:17:04 +0000 | [diff] [blame] | 159 | AC_SUBST(ARCH_RUN_32BIT) |
Ned Deily | 8e60f6e | 2013-05-30 00:14:29 -0700 | [diff] [blame] | 160 | ARCH_RUN_32BIT="" |
Benjamin Peterson | 0e6ea5d | 2008-07-16 20:17:04 +0000 | [diff] [blame] | 161 | |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 162 | # For backward compatibility reasons we prefer to select '32-bit' if available, |
| 163 | # otherwise use 'intel' |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 164 | UNIVERSAL_ARCHS="32-bit" |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 165 | if test "`uname -s`" = "Darwin" |
| 166 | then |
| 167 | if test -n "${UNIVERSALSDK}" |
| 168 | then |
| 169 | if test -z "`/usr/bin/file -L "${UNIVERSALSDK}/usr/lib/libSystem.dylib" | grep ppc`" |
| 170 | then |
| 171 | UNIVERSAL_ARCHS="intel" |
| 172 | fi |
| 173 | fi |
| 174 | fi |
| 175 | |
Ronald Oussoren | 92919a6 | 2009-12-24 13:30:58 +0000 | [diff] [blame] | 176 | AC_SUBST(LIPO_32BIT_FLAGS) |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 177 | AC_MSG_CHECKING(for --with-universal-archs) |
| 178 | AC_ARG_WITH(universal-archs, |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 179 | AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel", "intel-32", "intel-64", or "all")]), |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 180 | [ |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 181 | UNIVERSAL_ARCHS="$withval" |
| 182 | ], |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 183 | []) |
| 184 | if test -n "${UNIVERSALSDK}" |
| 185 | then |
| 186 | AC_MSG_RESULT(${UNIVERSAL_ARCHS}) |
| 187 | else |
| 188 | AC_MSG_RESULT(no) |
| 189 | fi |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 190 | |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 191 | AC_ARG_WITH(framework-name, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 192 | AS_HELP_STRING([--with-framework-name=FRAMEWORK], |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 193 | [specify an alternate name of the framework built with --enable-framework]), |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 194 | [ |
Ronald Oussoren | 9ebd242 | 2009-09-29 13:00:44 +0000 | [diff] [blame] | 195 | if test "${enable_framework}"; then |
| 196 | : |
| 197 | else |
| 198 | AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README]) |
| 199 | fi |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 200 | PYTHONFRAMEWORK=${withval} |
| 201 | PYTHONFRAMEWORKDIR=${withval}.framework |
| 202 | PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'` |
| 203 | ],[ |
| 204 | PYTHONFRAMEWORK=Python |
| 205 | PYTHONFRAMEWORKDIR=Python.framework |
| 206 | PYTHONFRAMEWORKIDENTIFIER=org.python.python |
| 207 | ]) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 208 | dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 209 | AC_ARG_ENABLE(framework, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 210 | AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@], [Build (MacOSX|Darwin) framework]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 211 | [ |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 212 | case $enableval in |
| 213 | yes) |
| 214 | enableval=/Library/Frameworks |
Jack Jansen | 127e56e | 2001-09-11 14:41:54 +0000 | [diff] [blame] | 215 | esac |
| 216 | case $enableval in |
| 217 | no) |
| 218 | PYTHONFRAMEWORK= |
| 219 | PYTHONFRAMEWORKDIR=no-framework |
| 220 | PYTHONFRAMEWORKPREFIX= |
| 221 | PYTHONFRAMEWORKINSTALLDIR= |
Ronald Oussoren | 567a8ff | 2006-05-26 11:43:26 +0000 | [diff] [blame] | 222 | FRAMEWORKINSTALLFIRST= |
| 223 | FRAMEWORKINSTALLLAST= |
Ronald Oussoren | 5b78732 | 2006-06-06 19:50:24 +0000 | [diff] [blame] | 224 | FRAMEWORKALTINSTALLFIRST= |
| 225 | FRAMEWORKALTINSTALLLAST= |
Ronald Oussoren | 2db3a8f | 2006-06-07 19:06:01 +0000 | [diff] [blame] | 226 | if test "x${prefix}" = "xNONE"; then |
| 227 | FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" |
| 228 | else |
| 229 | FRAMEWORKUNIXTOOLSPREFIX="${prefix}" |
| 230 | fi |
Jack Jansen | 127e56e | 2001-09-11 14:41:54 +0000 | [diff] [blame] | 231 | enable_framework= |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 232 | ;; |
| 233 | *) |
Ronald Oussoren | 01d149f | 2010-04-30 11:20:14 +0000 | [diff] [blame] | 234 | PYTHONFRAMEWORKPREFIX="${enableval}" |
Jack Jansen | 127e56e | 2001-09-11 14:41:54 +0000 | [diff] [blame] | 235 | PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR |
Ronald Oussoren | 567a8ff | 2006-05-26 11:43:26 +0000 | [diff] [blame] | 236 | FRAMEWORKINSTALLFIRST="frameworkinstallstructure" |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 237 | FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall" |
Ronald Oussoren | 92919a6 | 2009-12-24 13:30:58 +0000 | [diff] [blame] | 238 | FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools" |
| 239 | FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" |
Ronald Oussoren | 01d149f | 2010-04-30 11:20:14 +0000 | [diff] [blame] | 240 | FRAMEWORKINSTALLAPPSPREFIX="/Applications" |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 241 | |
Ronald Oussoren | 2db3a8f | 2006-06-07 19:06:01 +0000 | [diff] [blame] | 242 | if test "x${prefix}" = "xNONE" ; then |
| 243 | FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" |
Ronald Oussoren | 01d149f | 2010-04-30 11:20:14 +0000 | [diff] [blame] | 244 | |
Ronald Oussoren | 2db3a8f | 2006-06-07 19:06:01 +0000 | [diff] [blame] | 245 | else |
| 246 | FRAMEWORKUNIXTOOLSPREFIX="${prefix}" |
| 247 | fi |
Ronald Oussoren | 01d149f | 2010-04-30 11:20:14 +0000 | [diff] [blame] | 248 | |
| 249 | case "${enableval}" in |
| 250 | /System*) |
| 251 | FRAMEWORKINSTALLAPPSPREFIX="/Applications" |
| 252 | if test "${prefix}" = "NONE" ; then |
| 253 | # See below |
| 254 | FRAMEWORKUNIXTOOLSPREFIX="/usr" |
| 255 | fi |
| 256 | ;; |
| 257 | |
| 258 | /Library*) |
| 259 | FRAMEWORKINSTALLAPPSPREFIX="/Applications" |
| 260 | ;; |
| 261 | |
| 262 | */Library/Frameworks) |
| 263 | MDIR="`dirname "${enableval}"`" |
| 264 | MDIR="`dirname "${MDIR}"`" |
| 265 | FRAMEWORKINSTALLAPPSPREFIX="${MDIR}/Applications" |
| 266 | |
| 267 | if test "${prefix}" = "NONE"; then |
| 268 | # User hasn't specified the |
| 269 | # --prefix option, but wants to install |
| 270 | # the framework in a non-default location, |
| 271 | # ensure that the compatibility links get |
| 272 | # installed relative to that prefix as well |
| 273 | # instead of in /usr/local. |
| 274 | FRAMEWORKUNIXTOOLSPREFIX="${MDIR}" |
| 275 | fi |
| 276 | ;; |
| 277 | |
| 278 | *) |
| 279 | FRAMEWORKINSTALLAPPSPREFIX="/Applications" |
| 280 | ;; |
| 281 | esac |
| 282 | |
Jack Jansen | 127e56e | 2001-09-11 14:41:54 +0000 | [diff] [blame] | 283 | prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 284 | |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 285 | # Add files for Mac specific code to the list of output |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 286 | # files: |
Ronald Oussoren | 2db3a8f | 2006-06-07 19:06:01 +0000 | [diff] [blame] | 287 | AC_CONFIG_FILES(Mac/Makefile) |
| 288 | AC_CONFIG_FILES(Mac/PythonLauncher/Makefile) |
| 289 | AC_CONFIG_FILES(Mac/IDLE/Makefile) |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 290 | AC_CONFIG_FILES(Mac/Resources/framework/Info.plist) |
| 291 | AC_CONFIG_FILES(Mac/Resources/app/Info.plist) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 292 | esac |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 293 | ],[ |
| 294 | PYTHONFRAMEWORK= |
Jack Jansen | 127e56e | 2001-09-11 14:41:54 +0000 | [diff] [blame] | 295 | PYTHONFRAMEWORKDIR=no-framework |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 296 | PYTHONFRAMEWORKPREFIX= |
| 297 | PYTHONFRAMEWORKINSTALLDIR= |
Ronald Oussoren | 567a8ff | 2006-05-26 11:43:26 +0000 | [diff] [blame] | 298 | FRAMEWORKINSTALLFIRST= |
| 299 | FRAMEWORKINSTALLLAST= |
Ronald Oussoren | 5b78732 | 2006-06-06 19:50:24 +0000 | [diff] [blame] | 300 | FRAMEWORKALTINSTALLFIRST= |
| 301 | FRAMEWORKALTINSTALLLAST= |
Ronald Oussoren | 2db3a8f | 2006-06-07 19:06:01 +0000 | [diff] [blame] | 302 | if test "x${prefix}" = "xNONE" ; then |
| 303 | FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" |
| 304 | else |
| 305 | FRAMEWORKUNIXTOOLSPREFIX="${prefix}" |
| 306 | fi |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 307 | enable_framework= |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 308 | |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 309 | ]) |
| 310 | AC_SUBST(PYTHONFRAMEWORK) |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 311 | AC_SUBST(PYTHONFRAMEWORKIDENTIFIER) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 312 | AC_SUBST(PYTHONFRAMEWORKDIR) |
| 313 | AC_SUBST(PYTHONFRAMEWORKPREFIX) |
| 314 | AC_SUBST(PYTHONFRAMEWORKINSTALLDIR) |
Ronald Oussoren | 567a8ff | 2006-05-26 11:43:26 +0000 | [diff] [blame] | 315 | AC_SUBST(FRAMEWORKINSTALLFIRST) |
| 316 | AC_SUBST(FRAMEWORKINSTALLLAST) |
Ronald Oussoren | 5b78732 | 2006-06-06 19:50:24 +0000 | [diff] [blame] | 317 | AC_SUBST(FRAMEWORKALTINSTALLFIRST) |
| 318 | AC_SUBST(FRAMEWORKALTINSTALLLAST) |
| 319 | AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX) |
Ronald Oussoren | 01d149f | 2010-04-30 11:20:14 +0000 | [diff] [blame] | 320 | AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX) |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 321 | |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 322 | ##AC_ARG_WITH(dyld, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 323 | ## AS_HELP_STRING([--with-dyld], |
| 324 | ## [Use (OpenStep|Rhapsody) dynamic linker])) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 325 | ## |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 326 | # Set name for machine-dependent library files |
| 327 | AC_SUBST(MACHDEP) |
| 328 | AC_MSG_CHECKING(MACHDEP) |
| 329 | if test -z "$MACHDEP" |
| 330 | then |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 331 | # avoid using uname for cross builds |
| 332 | if test "$cross_compiling" = yes; then |
| 333 | # ac_sys_system and ac_sys_release are only used for setting |
| 334 | # `define_xopen_source' in the case statement below. For the |
| 335 | # current supported cross builds, this macro is not adjusted. |
| 336 | case "$host" in |
| 337 | *-*-linux*) |
| 338 | ac_sys_system=Linux |
| 339 | ;; |
| 340 | *-*-cygwin*) |
| 341 | ac_sys_system=Cygwin |
| 342 | ;; |
| 343 | *) |
| 344 | # for now, limit cross builds to known configurations |
| 345 | MACHDEP="unknown" |
| 346 | AC_MSG_ERROR([cross build not supported for $host]) |
| 347 | esac |
| 348 | ac_sys_release= |
| 349 | else |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 350 | ac_sys_system=`uname -s` |
Georg Brandl | fe18a11 | 2009-09-04 07:55:14 +0000 | [diff] [blame] | 351 | if test "$ac_sys_system" = "AIX" \ |
Martin v. Löwis | 21ee409 | 2002-09-30 16:19:48 +0000 | [diff] [blame] | 352 | -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 353 | ac_sys_release=`uname -v` |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 354 | else |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 355 | ac_sys_release=`uname -r` |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 356 | fi |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 357 | fi |
| 358 | ac_md_system=`echo $ac_sys_system | |
| 359 | tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'` |
| 360 | ac_md_release=`echo $ac_sys_release | |
| 361 | tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'` |
| 362 | MACHDEP="$ac_md_system$ac_md_release" |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 363 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 364 | case $MACHDEP in |
Victor Stinner | acacbaa | 2011-08-20 14:02:38 +0200 | [diff] [blame] | 365 | linux*) MACHDEP="linux2";; |
Andrew M. Kuchling | 5a3e4cb | 2001-07-20 19:29:04 +0000 | [diff] [blame] | 366 | cygwin*) MACHDEP="cygwin";; |
Jack Jansen | 8a97f4a | 2001-12-05 23:27:32 +0000 | [diff] [blame] | 367 | darwin*) MACHDEP="darwin";; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 368 | atheos*) MACHDEP="atheos";; |
Martin v. Löwis | f332228 | 2003-07-13 09:46:13 +0000 | [diff] [blame] | 369 | irix646) MACHDEP="irix6";; |
Guido van Rossum | b97ef17 | 1997-09-28 05:44:03 +0000 | [diff] [blame] | 370 | '') MACHDEP="unknown";; |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 371 | esac |
| 372 | fi |
| 373 | |
| 374 | AC_SUBST(_PYTHON_HOST_PLATFORM) |
| 375 | if test "$cross_compiling" = yes; then |
| 376 | case "$host" in |
| 377 | *-*-linux*) |
| 378 | case "$host_cpu" in |
| 379 | arm*) |
| 380 | _host_cpu=arm |
| 381 | ;; |
| 382 | *) |
| 383 | _host_cpu=$host_cpu |
| 384 | esac |
| 385 | ;; |
| 386 | *-*-cygwin*) |
| 387 | _host_cpu= |
| 388 | ;; |
| 389 | *) |
| 390 | # for now, limit cross builds to known configurations |
| 391 | MACHDEP="unknown" |
| 392 | AC_MSG_ERROR([cross build not supported for $host]) |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 393 | esac |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 394 | _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 395 | fi |
Jack Jansen | 83f898c | 2002-12-30 22:23:40 +0000 | [diff] [blame] | 396 | |
Martin v. Löwis | e981a4e | 2002-11-11 13:26:51 +0000 | [diff] [blame] | 397 | # Some systems cannot stand _XOPEN_SOURCE being defined at all; they |
| 398 | # disable features if it is defined, without any means to access these |
| 399 | # features as extensions. For these systems, we skip the definition of |
| 400 | # _XOPEN_SOURCE. Before adding a system to the list to gain access to |
| 401 | # some feature, make sure there is no alternative way to access this |
| 402 | # feature. Also, when using wildcards, make sure you have verified the |
| 403 | # need for not defining _XOPEN_SOURCE on all systems matching the |
| 404 | # wildcard, and that the wildcard does not include future systems |
| 405 | # (which may remove their limitations). |
| 406 | dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output |
| 407 | case $ac_sys_system/$ac_sys_release in |
| 408 | # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, |
| 409 | # even though select is a POSIX function. Reported by J. Ribbens. |
Martin v. Löwis | 76bafc6 | 2003-10-03 13:47:44 +0000 | [diff] [blame] | 410 | # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. |
Martin v. Löwis | 7875ef6 | 2010-02-15 21:41:12 +0000 | [diff] [blame] | 411 | # In addition, Stefan Krah confirms that issue #1244610 exists through |
| 412 | # OpenBSD 4.6, but is fixed in 4.7. |
Charles-François Natali | 97781b0 | 2011-07-22 23:43:42 +0200 | [diff] [blame] | 413 | OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@) |
Martin v. Löwis | cb78de6 | 2007-12-29 18:49:21 +0000 | [diff] [blame] | 414 | define_xopen_source=no |
| 415 | # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is |
| 416 | # also defined. This can be overridden by defining _BSD_SOURCE |
| 417 | # As this has a different meaning on Linux, only define it on OpenBSD |
| 418 | AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features]) |
| 419 | ;; |
Charles-François Natali | 97781b0 | 2011-07-22 23:43:42 +0200 | [diff] [blame] | 420 | OpenBSD/*) |
Martin v. Löwis | 5e2dd86 | 2010-02-15 08:32:00 +0000 | [diff] [blame] | 421 | # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is |
| 422 | # also defined. This can be overridden by defining _BSD_SOURCE |
| 423 | # As this has a different meaning on Linux, only define it on OpenBSD |
| 424 | AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features]) |
| 425 | ;; |
Martin v. Löwis | 4d542ec | 2006-11-25 15:39:19 +0000 | [diff] [blame] | 426 | # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of |
| 427 | # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by |
| 428 | # Marc Recht |
Georg Brandl | 4b9bcfc | 2008-11-16 08:00:17 +0000 | [diff] [blame] | 429 | NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@) |
Martin v. Löwis | 4d542ec | 2006-11-25 15:39:19 +0000 | [diff] [blame] | 430 | define_xopen_source=no;; |
Martin v. Löwis | b41afb5 | 2010-05-28 15:28:47 +0000 | [diff] [blame] | 431 | # From the perspective of Solaris, _XOPEN_SOURCE is not so much a |
| 432 | # request to enable features supported by the standard as a request |
| 433 | # to disable features not supported by the standard. The best way |
| 434 | # for Python to use Solaris is simply to leave _XOPEN_SOURCE out |
| 435 | # entirely and define __EXTENSIONS__ instead. |
| 436 | SunOS/*) |
Martin v. Löwis | a9d7142 | 2003-03-28 18:43:31 +0000 | [diff] [blame] | 437 | define_xopen_source=no;; |
Martin v. Löwis | c2409b4 | 2003-05-11 05:53:41 +0000 | [diff] [blame] | 438 | # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, |
| 439 | # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. |
Martin v. Löwis | 253d1f4 | 2004-05-07 19:14:14 +0000 | [diff] [blame] | 440 | # Reconfirmed for 7.1.4 by Martin v. Loewis. |
| 441 | OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@) |
Martin v. Löwis | c2409b4 | 2003-05-11 05:53:41 +0000 | [diff] [blame] | 442 | define_xopen_source=no;; |
| 443 | # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, |
Martin v. Löwis | 53e73c3 | 2003-05-05 05:13:18 +0000 | [diff] [blame] | 444 | # but used in struct sockaddr.sa_family. Reported by Tim Rice. |
Martin v. Löwis | c2409b4 | 2003-05-11 05:53:41 +0000 | [diff] [blame] | 445 | SCO_SV/3.2) |
Martin v. Löwis | 53e73c3 | 2003-05-05 05:13:18 +0000 | [diff] [blame] | 446 | define_xopen_source=no;; |
Martin v. Löwis | bb86d83 | 2008-11-04 20:40:09 +0000 | [diff] [blame] | 447 | # On FreeBSD 4, the math functions C89 does not cover are never defined |
| 448 | # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. |
| 449 | FreeBSD/4.*) |
| 450 | define_xopen_source=no;; |
| 451 | # On MacOS X 10.2, a bug in ncurses.h means that it craps out if |
| 452 | # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which |
| 453 | # identifies itself as Darwin/7.* |
| 454 | # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE |
| 455 | # disables platform specific features beyond repair. |
| 456 | # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE |
| 457 | # has no effect, don't bother defining them |
| 458 | Darwin/@<:@6789@:>@.*) |
Anthony Baxter | 6169c6b | 2003-10-04 07:46:23 +0000 | [diff] [blame] | 459 | define_xopen_source=no;; |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 460 | Darwin/1@<:@0-9@:>@.*) |
| 461 | define_xopen_source=no;; |
Trent Mick | af16e8c | 2004-08-25 23:55:59 +0000 | [diff] [blame] | 462 | # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but |
| 463 | # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined |
| 464 | # or has another value. By not (re)defining it, the defaults come in place. |
Martin v. Löwis | c19c5a6 | 2003-11-18 20:00:44 +0000 | [diff] [blame] | 465 | AIX/4) |
| 466 | define_xopen_source=no;; |
Trent Mick | af16e8c | 2004-08-25 23:55:59 +0000 | [diff] [blame] | 467 | AIX/5) |
| 468 | if test `uname -r` -eq 1; then |
| 469 | define_xopen_source=no |
| 470 | fi |
| 471 | ;; |
Martin v. Löwis | 8c255e4 | 2008-05-23 15:06:50 +0000 | [diff] [blame] | 472 | # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from |
| 473 | # defining NI_NUMERICHOST. |
| 474 | QNX/6.3.2) |
| 475 | define_xopen_source=no |
| 476 | ;; |
Martin v. Löwis | a058836 | 2006-04-04 06:03:50 +0000 | [diff] [blame] | 477 | |
Martin v. Löwis | e981a4e | 2002-11-11 13:26:51 +0000 | [diff] [blame] | 478 | esac |
| 479 | |
| 480 | if test $define_xopen_source = yes |
| 481 | then |
Martin v. Löwis | b41afb5 | 2010-05-28 15:28:47 +0000 | [diff] [blame] | 482 | AC_DEFINE(_XOPEN_SOURCE, 600, |
| 483 | Define to the level of X/Open that your system supports) |
Martin v. Löwis | 678fc1e | 2002-11-12 06:04:39 +0000 | [diff] [blame] | 484 | |
| 485 | # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires |
| 486 | # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else |
| 487 | # several APIs are not declared. Since this is also needed in some |
| 488 | # cases for HP-UX, we define it globally. |
Martin v. Löwis | b41afb5 | 2010-05-28 15:28:47 +0000 | [diff] [blame] | 489 | AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, |
| 490 | Define to activate Unix95-and-earlier features) |
Martin v. Löwis | 678fc1e | 2002-11-12 06:04:39 +0000 | [diff] [blame] | 491 | |
Bob Ippolito | 7026a0a | 2005-03-28 23:23:47 +0000 | [diff] [blame] | 492 | AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001) |
| 493 | |
Martin v. Löwis | e981a4e | 2002-11-11 13:26:51 +0000 | [diff] [blame] | 494 | fi |
| 495 | |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 496 | # |
| 497 | # SGI compilers allow the specification of the both the ABI and the |
| 498 | # ISA on the command line. Depending on the values of these switches, |
Martin Panter | b1d867f | 2016-05-26 05:28:50 +0000 | [diff] [blame] | 499 | # different and often incompatible code will be generated. |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 500 | # |
| 501 | # The SGI_ABI variable can be used to modify the CC and LDFLAGS and |
| 502 | # thus supply support for various ABI/ISA combinations. The MACHDEP |
| 503 | # variable is also adjusted. |
| 504 | # |
| 505 | AC_SUBST(SGI_ABI) |
| 506 | if test ! -z "$SGI_ABI" |
| 507 | then |
| 508 | CC="cc $SGI_ABI" |
| 509 | LDFLAGS="$SGI_ABI $LDFLAGS" |
| 510 | MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'` |
| 511 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 512 | AC_MSG_RESULT($MACHDEP) |
| 513 | |
doko@ubuntu.com | 9e7ece2 | 2015-04-13 21:55:08 +0200 | [diff] [blame] | 514 | AC_SUBST(PLATDIR) |
| 515 | PLATDIR=plat-$MACHDEP |
| 516 | |
Jack Jansen | 83f898c | 2002-12-30 22:23:40 +0000 | [diff] [blame] | 517 | # And add extra plat-mac for darwin |
| 518 | AC_SUBST(EXTRAPLATDIR) |
Jack Jansen | 7b59b42 | 2003-03-17 15:44:10 +0000 | [diff] [blame] | 519 | AC_SUBST(EXTRAMACHDEPPATH) |
Jack Jansen | 83f898c | 2002-12-30 22:23:40 +0000 | [diff] [blame] | 520 | AC_MSG_CHECKING(EXTRAPLATDIR) |
| 521 | if test -z "$EXTRAPLATDIR" |
| 522 | then |
| 523 | case $MACHDEP in |
Jack Jansen | 7b59b42 | 2003-03-17 15:44:10 +0000 | [diff] [blame] | 524 | darwin) |
| 525 | EXTRAPLATDIR="\$(PLATMACDIRS)" |
| 526 | EXTRAMACHDEPPATH="\$(PLATMACPATH)" |
| 527 | ;; |
| 528 | *) |
| 529 | EXTRAPLATDIR="" |
| 530 | EXTRAMACHDEPPATH="" |
| 531 | ;; |
Jack Jansen | 83f898c | 2002-12-30 22:23:40 +0000 | [diff] [blame] | 532 | esac |
| 533 | fi |
| 534 | AC_MSG_RESULT($EXTRAPLATDIR) |
| 535 | |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 536 | # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET, |
| 537 | # it may influence the way we can build extensions, so distutils |
| 538 | # needs to check it |
| 539 | AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET) |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 540 | AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET) |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 541 | CONFIGURE_MACOSX_DEPLOYMENT_TARGET= |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 542 | EXPORT_MACOSX_DEPLOYMENT_TARGET='#' |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 543 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 544 | # checks for alternative programs |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 545 | |
| 546 | # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just |
| 547 | # for debug/optimization stuff. BASECFLAGS is for flags that are required |
| 548 | # just to get things to compile and link. Users are free to override OPT |
| 549 | # when running configure or make. The build should not break if they do. |
| 550 | # BASECFLAGS should generally not be messed with, however. |
| 551 | |
| 552 | # XXX shouldn't some/most/all of this code be merged with the stuff later |
| 553 | # on that fiddles with OPT and BASECFLAGS? |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 554 | AC_MSG_CHECKING(for --without-gcc) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 555 | AC_ARG_WITH(gcc, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 556 | AS_HELP_STRING([--without-gcc], [never use gcc]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 557 | [ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 558 | case $withval in |
Skip Montanaro | 516144f | 2009-01-04 10:36:58 +0000 | [diff] [blame] | 559 | no) CC=${CC:-cc} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 560 | without_gcc=yes;; |
| 561 | yes) CC=gcc |
| 562 | without_gcc=no;; |
| 563 | *) CC=$withval |
| 564 | without_gcc=$withval;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 565 | esac], [ |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 566 | case $ac_sys_system in |
Antoine Pitrou | 285cd16 | 2010-09-21 15:23:17 +0000 | [diff] [blame] | 567 | AIX*) CC=${CC:-xlc_r} |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 568 | without_gcc=;; |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 569 | BeOS*) |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 570 | case $BE_HOST_CPU in |
| 571 | ppc) |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 572 | CC=mwcc |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 573 | without_gcc=yes |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 574 | BASECFLAGS="$BASECFLAGS -export pragma" |
| 575 | OPT="$OPT -O" |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 576 | LDFLAGS="$LDFLAGS -nodup" |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 577 | ;; |
| 578 | x86) |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 579 | CC=gcc |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 580 | without_gcc=no |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 581 | OPT="$OPT -O" |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 582 | ;; |
| 583 | *) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 584 | AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"]) |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 585 | ;; |
| 586 | esac |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 587 | AR="\$(srcdir)/Modules/ar_beos" |
| 588 | RANLIB=: |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 589 | ;; |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 590 | *) without_gcc=no;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 591 | esac]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 592 | AC_MSG_RESULT($without_gcc) |
| 593 | |
Zachary Ware | 6ed42ea | 2015-12-21 11:43:03 -0600 | [diff] [blame] | 594 | AC_MSG_CHECKING(for --with-icc) |
| 595 | AC_ARG_WITH(icc, |
| 596 | AS_HELP_STRING([--with-icc], [build with icc]), |
| 597 | [ |
| 598 | case $withval in |
| 599 | no) CC=${CC:-cc} |
| 600 | with_icc=no;; |
| 601 | yes) CC=icc |
| 602 | CXX=icpc |
| 603 | with_icc=yes;; |
| 604 | *) CC=$withval |
| 605 | with_icc=$withval;; |
| 606 | esac], [ |
| 607 | with_icc=no]) |
| 608 | AC_MSG_RESULT($with_icc) |
| 609 | |
Guido van Rossum | 03ad99f | 1995-03-09 14:09:54 +0000 | [diff] [blame] | 610 | # If the user switches compilers, we can't believe the cache |
| 611 | if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" |
| 612 | then |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 613 | AC_MSG_ERROR([cached CC is different -- throw away $cache_file |
| 614 | (it is also a good idea to do 'make clean' before compiling)]) |
Guido van Rossum | 03ad99f | 1995-03-09 14:09:54 +0000 | [diff] [blame] | 615 | fi |
| 616 | |
Trent Nelson | 15daa35 | 2012-12-13 06:46:39 +0000 | [diff] [blame] | 617 | if test "$MACHDEP" = "irix6" && test "$CC" != "gcc"; then |
| 618 | # Normally, MIPSpro CC treats #error directives as warnings, which means |
| 619 | # a successful exit code is returned (0). This is a problem because IRIX |
| 620 | # has a bunch of system headers with this guard at the top: |
| 621 | # |
| 622 | # #ifndef __c99 |
| 623 | # #error This header file is to be used only for c99 mode compilations |
| 624 | # #else |
| 625 | # |
| 626 | # When autoconf tests for such a header, like stdint.h, this happens: |
| 627 | # |
| 628 | # configure:4619: cc -c conftest.c >&5 |
| 629 | # cc-1035 cc: WARNING File = /usr/include/stdint.h, Line = 5 |
| 630 | # #error directive: This header file is to be used only for c99 mode |
| 631 | # compilations |
| 632 | # |
| 633 | # #error This header file is to be used only for c99 mode compilations |
| 634 | # ^ |
| 635 | # |
| 636 | # configure:4619: $? = 0 |
| 637 | # configure:4619: result: yes |
| 638 | # |
| 639 | # Therefore, we use `-diag_error 1035` to have the compiler treat the |
| 640 | # warning as an error, which causes cc to return a non-zero result, |
| 641 | # which autoconf can interpret correctly. |
| 642 | CFLAGS="$CFLAGS -diag_error 1035" |
| 643 | # Whilst we're here, we might as well make sure CXX defaults to something |
| 644 | # sensible if we're not using gcc. |
| 645 | if test -z "$CXX"; then |
| 646 | CXX="CC" |
| 647 | fi |
| 648 | fi |
| 649 | |
Marc-André Lemburg | 6d5e579 | 2010-04-30 17:20:14 +0000 | [diff] [blame] | 650 | # If the user set CFLAGS, use this instead of the automatically |
| 651 | # determined setting |
| 652 | preset_cflags="$CFLAGS" |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 653 | AC_PROG_CC |
Marc-André Lemburg | 6d5e579 | 2010-04-30 17:20:14 +0000 | [diff] [blame] | 654 | if test ! -z "$preset_cflags" |
| 655 | then |
| 656 | CFLAGS=$preset_cflags |
| 657 | fi |
Martin v. Löwis | 1d5ecb7 | 2001-08-09 10:29:44 +0000 | [diff] [blame] | 658 | |
Martin v. Löwis | 0f48d98 | 2006-04-14 14:34:26 +0000 | [diff] [blame] | 659 | AC_SUBST(CXX) |
| 660 | AC_SUBST(MAINCC) |
| 661 | AC_MSG_CHECKING(for --with-cxx-main=<compiler>) |
| 662 | AC_ARG_WITH(cxx_main, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 663 | AS_HELP_STRING([--with-cxx-main=<compiler>], |
Martin v. Löwis | 0f48d98 | 2006-04-14 14:34:26 +0000 | [diff] [blame] | 664 | [compile main() and link python executable with C++ compiler]), |
| 665 | [ |
| 666 | |
| 667 | case $withval in |
| 668 | no) with_cxx_main=no |
| 669 | MAINCC='$(CC)';; |
| 670 | yes) with_cxx_main=yes |
| 671 | MAINCC='$(CXX)';; |
| 672 | *) with_cxx_main=yes |
| 673 | MAINCC=$withval |
| 674 | if test -z "$CXX" |
| 675 | then |
| 676 | CXX=$withval |
| 677 | fi;; |
| 678 | esac], [ |
| 679 | with_cxx_main=no |
| 680 | MAINCC='$(CC)' |
| 681 | ]) |
| 682 | AC_MSG_RESULT($with_cxx_main) |
| 683 | |
| 684 | preset_cxx="$CXX" |
| 685 | if test -z "$CXX" |
| 686 | then |
| 687 | case "$CC" in |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 688 | gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;; |
| 689 | cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;; |
Martin v. Löwis | 0f48d98 | 2006-04-14 14:34:26 +0000 | [diff] [blame] | 690 | esac |
| 691 | if test "$CXX" = "notfound" |
| 692 | then |
| 693 | CXX="" |
| 694 | fi |
| 695 | fi |
| 696 | if test -z "$CXX" |
| 697 | then |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 698 | AC_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound) |
Martin v. Löwis | 0f48d98 | 2006-04-14 14:34:26 +0000 | [diff] [blame] | 699 | if test "$CXX" = "notfound" |
| 700 | then |
| 701 | CXX="" |
| 702 | fi |
| 703 | fi |
| 704 | if test "$preset_cxx" != "$CXX" |
| 705 | then |
| 706 | AC_MSG_WARN([ |
| 707 | |
| 708 | By default, distutils will build C++ extension modules with "$CXX". |
| 709 | If this is not intended, then set CXX on the configure command line. |
| 710 | ]) |
| 711 | fi |
| 712 | |
doko@python.org | 4e63fbe | 2013-01-25 13:08:27 +0100 | [diff] [blame] | 713 | MULTIARCH=$($CC --print-multiarch 2>/dev/null) |
| 714 | AC_SUBST(MULTIARCH) |
| 715 | |
Martin v. Löwis | 0f48d98 | 2006-04-14 14:34:26 +0000 | [diff] [blame] | 716 | |
Martin v. Löwis | 1d5ecb7 | 2001-08-09 10:29:44 +0000 | [diff] [blame] | 717 | # checks for UNIX variants that set C preprocessor variables |
Matthias Klose | 9f8e0c1 | 2010-05-08 10:17:27 +0000 | [diff] [blame] | 718 | AC_USE_SYSTEM_EXTENSIONS |
Martin v. Löwis | 1d5ecb7 | 2001-08-09 10:29:44 +0000 | [diff] [blame] | 719 | |
Martin v. Löwis | 779ffc0 | 2002-12-02 22:17:01 +0000 | [diff] [blame] | 720 | # Check for unsupported systems |
| 721 | case $ac_sys_system/$ac_sys_release in |
Brett Cannon | 19fab76 | 2007-06-02 03:02:29 +0000 | [diff] [blame] | 722 | atheos*|Linux*/1*) |
Martin v. Löwis | 779ffc0 | 2002-12-02 22:17:01 +0000 | [diff] [blame] | 723 | echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported. |
| 724 | echo See README for details. |
| 725 | exit 1;; |
| 726 | esac |
| 727 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 728 | AC_EXEEXT |
Neil Schemenauer | 3ae1d0a | 2001-01-27 06:54:42 +0000 | [diff] [blame] | 729 | AC_MSG_CHECKING(for --with-suffix) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 730 | AC_ARG_WITH(suffix, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 731 | AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 732 | [ |
Neil Schemenauer | 3ae1d0a | 2001-01-27 06:54:42 +0000 | [diff] [blame] | 733 | case $withval in |
| 734 | no) EXEEXT=;; |
| 735 | yes) EXEEXT=.exe;; |
| 736 | *) EXEEXT=$withval;; |
| 737 | esac]) |
| 738 | AC_MSG_RESULT($EXEEXT) |
Jack Jansen | 1999ef4 | 2001-12-06 21:47:20 +0000 | [diff] [blame] | 739 | |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 740 | # Test whether we're running on a non-case-sensitive system, in which |
| 741 | # case we give a warning if no ext is given |
Jack Jansen | 1999ef4 | 2001-12-06 21:47:20 +0000 | [diff] [blame] | 742 | AC_SUBST(BUILDEXEEXT) |
| 743 | AC_MSG_CHECKING(for case-insensitive build directory) |
Jack Jansen | 3c2c433 | 2002-11-06 13:33:32 +0000 | [diff] [blame] | 744 | if test ! -d CaseSensitiveTestDir; then |
| 745 | mkdir CaseSensitiveTestDir |
| 746 | fi |
| 747 | |
| 748 | if test -d casesensitivetestdir |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 749 | then |
Jack Jansen | 1999ef4 | 2001-12-06 21:47:20 +0000 | [diff] [blame] | 750 | AC_MSG_RESULT(yes) |
| 751 | BUILDEXEEXT=.exe |
| 752 | else |
| 753 | AC_MSG_RESULT(no) |
Jack Jansen | dd19cf8 | 2001-12-06 22:36:17 +0000 | [diff] [blame] | 754 | BUILDEXEEXT=$EXEEXT |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 755 | fi |
Jack Jansen | 3c2c433 | 2002-11-06 13:33:32 +0000 | [diff] [blame] | 756 | rmdir CaseSensitiveTestDir |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 757 | |
Guido van Rossum | dd997f7 | 1998-10-07 19:58:26 +0000 | [diff] [blame] | 758 | case $MACHDEP in |
| 759 | bsdos*) |
| 760 | case $CC in |
| 761 | gcc) CC="$CC -D_HAVE_BSDI";; |
| 762 | esac;; |
| 763 | esac |
| 764 | |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 765 | case $ac_sys_system in |
| 766 | hp*|HP*) |
| 767 | case $CC in |
Guido van Rossum | cd5ff9f | 2000-09-22 16:15:54 +0000 | [diff] [blame] | 768 | cc|*/cc) CC="$CC -Ae";; |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 769 | esac;; |
Martin v. Löwis | e8964d4 | 2001-03-06 12:09:07 +0000 | [diff] [blame] | 770 | SunOS*) |
| 771 | # Some functions have a prototype only with that define, e.g. confstr |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 772 | AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.]) |
Martin v. Löwis | e8964d4 | 2001-03-06 12:09:07 +0000 | [diff] [blame] | 773 | ;; |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 774 | esac |
| 775 | |
Martin v. Löwis | e8964d4 | 2001-03-06 12:09:07 +0000 | [diff] [blame] | 776 | |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 777 | AC_SUBST(LIBRARY) |
| 778 | AC_MSG_CHECKING(LIBRARY) |
| 779 | if test -z "$LIBRARY" |
| 780 | then |
| 781 | LIBRARY='libpython$(VERSION).a' |
| 782 | fi |
| 783 | AC_MSG_RESULT($LIBRARY) |
| 784 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 785 | # LDLIBRARY is the name of the library to link against (as opposed to the |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 786 | # name of the library into which to insert object files). BLDLIBRARY is also |
| 787 | # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY |
| 788 | # is blank as the main program is not linked directly against LDLIBRARY. |
| 789 | # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On |
| 790 | # systems without shared libraries, LDLIBRARY is the same as LIBRARY |
| 791 | # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library, |
| 792 | # DLLLIBRARY is the shared (i.e., DLL) library. |
| 793 | # |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 794 | # RUNSHARED is used to run shared python without installed libraries |
| 795 | # |
| 796 | # INSTSONAME is the name of the shared library that will be use to install |
| 797 | # on the system - some systems like version suffix, others don't |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 798 | AC_SUBST(LDLIBRARY) |
Guido van Rossum | 2755290 | 2001-01-23 01:52:26 +0000 | [diff] [blame] | 799 | AC_SUBST(DLLLIBRARY) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 800 | AC_SUBST(BLDLIBRARY) |
| 801 | AC_SUBST(LDLIBRARYDIR) |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 802 | AC_SUBST(INSTSONAME) |
| 803 | AC_SUBST(RUNSHARED) |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 804 | LDLIBRARY="$LIBRARY" |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 805 | BLDLIBRARY='$(LDLIBRARY)' |
Martin v. Löwis | 09bdf72 | 2002-05-08 08:51:29 +0000 | [diff] [blame] | 806 | INSTSONAME='$(LDLIBRARY)' |
Guido van Rossum | 2755290 | 2001-01-23 01:52:26 +0000 | [diff] [blame] | 807 | DLLLIBRARY='' |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 808 | LDLIBRARYDIR='' |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 809 | RUNSHARED='' |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 810 | |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 811 | # LINKCC is the command that links the python executable -- default is $(CC). |
Martin v. Löwis | b7da67a | 2001-10-18 15:35:38 +0000 | [diff] [blame] | 812 | # If CXX is set, and if it is needed to link a main function that was |
| 813 | # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable: |
| 814 | # python might then depend on the C++ runtime |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 815 | # This is altered for AIX in order to build the export list before |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 816 | # linking. |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 817 | AC_SUBST(LINKCC) |
| 818 | AC_MSG_CHECKING(LINKCC) |
| 819 | if test -z "$LINKCC" |
| 820 | then |
Martin v. Löwis | 0f48d98 | 2006-04-14 14:34:26 +0000 | [diff] [blame] | 821 | LINKCC='$(PURIFY) $(MAINCC)' |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 822 | case $ac_sys_system in |
| 823 | AIX*) |
Neal Norwitz | 0b27ff9 | 2003-03-31 15:53:49 +0000 | [diff] [blame] | 824 | exp_extra="\"\"" |
| 825 | if test $ac_sys_release -ge 5 -o \ |
| 826 | $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then |
| 827 | exp_extra="." |
| 828 | fi |
| 829 | LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";; |
Martin v. Löwis | 8c255e4 | 2008-05-23 15:06:50 +0000 | [diff] [blame] | 830 | QNX*) |
| 831 | # qcc must be used because the other compilers do not |
| 832 | # support -N. |
| 833 | LINKCC=qcc;; |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 834 | esac |
| 835 | fi |
| 836 | AC_MSG_RESULT($LINKCC) |
| 837 | |
Tarek Ziadé | e2be83d | 2009-05-09 08:28:53 +0000 | [diff] [blame] | 838 | # GNULD is set to "yes" if the GNU linker is used. If this goes wrong |
| 839 | # make sure we default having it set to "no": this is used by |
| 840 | # distutils.unixccompiler to know if it should add --enable-new-dtags |
| 841 | # to linker command lines, and failing to detect GNU ld simply results |
| 842 | # in the same bahaviour as before. |
| 843 | AC_SUBST(GNULD) |
| 844 | AC_MSG_CHECKING(for GNU ld) |
| 845 | ac_prog=ld |
| 846 | if test "$GCC" = yes; then |
| 847 | ac_prog=`$CC -print-prog-name=ld` |
| 848 | fi |
| 849 | case `"$ac_prog" -V 2>&1 < /dev/null` in |
| 850 | *GNU*) |
| 851 | GNULD=yes;; |
| 852 | *) |
| 853 | GNULD=no;; |
| 854 | esac |
| 855 | AC_MSG_RESULT($GNULD) |
| 856 | |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 857 | AC_MSG_CHECKING(for --enable-shared) |
| 858 | AC_ARG_ENABLE(shared, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 859 | AS_HELP_STRING([--enable-shared], [disable/enable building shared python library])) |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 860 | |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 861 | if test -z "$enable_shared" |
| 862 | then |
Martin v. Löwis | b51033d | 2002-05-03 05:53:15 +0000 | [diff] [blame] | 863 | case $ac_sys_system in |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 864 | CYGWIN* | atheos*) |
Martin v. Löwis | b51033d | 2002-05-03 05:53:15 +0000 | [diff] [blame] | 865 | enable_shared="yes";; |
| 866 | *) |
| 867 | enable_shared="no";; |
| 868 | esac |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 869 | fi |
| 870 | AC_MSG_RESULT($enable_shared) |
| 871 | |
Skip Montanaro | 56f6a4f | 2004-06-18 02:47:22 +0000 | [diff] [blame] | 872 | AC_MSG_CHECKING(for --enable-profiling) |
| 873 | AC_ARG_ENABLE(profiling, |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 874 | AS_HELP_STRING([--enable-profiling], [enable C-level code profiling])) |
| 875 | if test "x$enable_profiling" = xyes; then |
| 876 | ac_save_cc="$CC" |
Benjamin Peterson | b9be7bb | 2013-03-26 08:55:37 -0400 | [diff] [blame] | 877 | CC="$CC -pg" |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 878 | AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], |
| 879 | [], |
| 880 | [enable_profiling=no]) |
| 881 | CC="$ac_save_cc" |
| 882 | else |
| 883 | enable_profiling=no |
| 884 | fi |
| 885 | AC_MSG_RESULT($enable_profiling) |
Skip Montanaro | 56f6a4f | 2004-06-18 02:47:22 +0000 | [diff] [blame] | 886 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 887 | if test "x$enable_profiling" = xyes; then |
| 888 | BASECFLAGS="-pg $BASECFLAGS" |
| 889 | LDFLAGS="-pg $LDFLAGS" |
| 890 | fi |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 891 | |
| 892 | AC_MSG_CHECKING(LDLIBRARY) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 893 | |
Guido van Rossum | b855216 | 2001-09-05 14:58:11 +0000 | [diff] [blame] | 894 | # MacOSX framework builds need more magic. LDLIBRARY is the dynamic |
| 895 | # library that we build, but we do not want to link against it (we |
| 896 | # will find it with a -framework option). For this reason there is an |
| 897 | # extra variable BLDLIBRARY against which Python and the extension |
| 898 | # modules are linked, BLDLIBRARY. This is normally the same as |
| 899 | # LDLIBRARY, but empty for MacOSX framework builds. |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 900 | if test "$enable_framework" |
| 901 | then |
| 902 | LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 903 | RUNSHARED=DYLD_FRAMEWORK_PATH=`pwd`${DYLD_FRAMEWORK_PATH:+:${DYLD_FRAMEWORK_PATH}} |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 904 | BLDLIBRARY='' |
| 905 | else |
| 906 | BLDLIBRARY='$(LDLIBRARY)' |
| 907 | fi |
| 908 | |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 909 | # Other platforms follow |
| 910 | if test $enable_shared = "yes"; then |
Mark Hammond | 8235ea1 | 2002-07-19 06:55:41 +0000 | [diff] [blame] | 911 | AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.]) |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 912 | case $ac_sys_system in |
| 913 | BeOS*) |
| 914 | LDLIBRARY='libpython$(VERSION).so' |
| 915 | ;; |
| 916 | CYGWIN*) |
| 917 | LDLIBRARY='libpython$(VERSION).dll.a' |
| 918 | DLLLIBRARY='libpython$(VERSION).dll' |
| 919 | ;; |
| 920 | SunOS*) |
| 921 | LDLIBRARY='libpython$(VERSION).so' |
Martin v. Löwis | d141a8c | 2003-06-14 15:20:28 +0000 | [diff] [blame] | 922 | BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 923 | RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} |
Martin v. Löwis | 2389c41 | 2003-10-31 15:42:07 +0000 | [diff] [blame] | 924 | INSTSONAME="$LDLIBRARY".$SOVERSION |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 925 | ;; |
Charles-François Natali | 3de8c73 | 2011-07-24 22:33:35 +0200 | [diff] [blame] | 926 | Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 927 | LDLIBRARY='libpython$(VERSION).so' |
| 928 | BLDLIBRARY='-L. -lpython$(VERSION)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 929 | RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} |
Hye-Shik Chang | 3376149 | 2004-10-26 09:53:46 +0000 | [diff] [blame] | 930 | case $ac_sys_system in |
| 931 | FreeBSD*) |
| 932 | SOVERSION=`echo $SOVERSION|cut -d "." -f 1` |
| 933 | ;; |
| 934 | esac |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 935 | INSTSONAME="$LDLIBRARY".$SOVERSION |
| 936 | ;; |
| 937 | hp*|HP*) |
Neal Norwitz | 58e2888 | 2006-05-19 07:00:58 +0000 | [diff] [blame] | 938 | case `uname -m` in |
| 939 | ia64) |
| 940 | LDLIBRARY='libpython$(VERSION).so' |
| 941 | ;; |
| 942 | *) |
| 943 | LDLIBRARY='libpython$(VERSION).sl' |
| 944 | ;; |
| 945 | esac |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 946 | BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 947 | RUNSHARED=SHLIB_PATH=`pwd`${SHLIB_PATH:+:${SHLIB_PATH}} |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 948 | ;; |
| 949 | OSF*) |
| 950 | LDLIBRARY='libpython$(VERSION).so' |
Neal Norwitz | 671b9e3 | 2006-01-09 07:07:12 +0000 | [diff] [blame] | 951 | BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 952 | RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 953 | ;; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 954 | atheos*) |
| 955 | LDLIBRARY='libpython$(VERSION).so' |
| 956 | BLDLIBRARY='-L. -lpython$(VERSION)' |
| 957 | RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib} |
| 958 | ;; |
Ronald Oussoren | 79f9049 | 2009-01-02 10:44:46 +0000 | [diff] [blame] | 959 | Darwin*) |
| 960 | LDLIBRARY='libpython$(VERSION).dylib' |
| 961 | BLDLIBRARY='-L. -lpython$(VERSION)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 962 | RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}} |
Ronald Oussoren | 79f9049 | 2009-01-02 10:44:46 +0000 | [diff] [blame] | 963 | ;; |
Antoine Pitrou | aabdceb | 2010-09-10 20:03:17 +0000 | [diff] [blame] | 964 | AIX*) |
| 965 | LDLIBRARY='libpython$(VERSION).so' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 966 | RUNSHARED=LIBPATH=`pwd`${LIBPATH:+:${LIBPATH}} |
Antoine Pitrou | aabdceb | 2010-09-10 20:03:17 +0000 | [diff] [blame] | 967 | ;; |
Ronald Oussoren | 79f9049 | 2009-01-02 10:44:46 +0000 | [diff] [blame] | 968 | |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 969 | esac |
Jason Tishler | 3076559 | 2003-09-04 11:04:06 +0000 | [diff] [blame] | 970 | else # shared is disabled |
| 971 | case $ac_sys_system in |
| 972 | CYGWIN*) |
| 973 | BLDLIBRARY='$(LIBRARY)' |
| 974 | LDLIBRARY='libpython$(VERSION).dll.a' |
| 975 | ;; |
| 976 | esac |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 977 | fi |
| 978 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 979 | if test "$cross_compiling" = yes; then |
| 980 | RUNSHARED= |
| 981 | fi |
| 982 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 983 | AC_MSG_RESULT($LDLIBRARY) |
| 984 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 985 | AC_PROG_RANLIB |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 986 | AC_SUBST(AR) |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 987 | AC_CHECK_TOOLS(AR, ar aal, ar) |
Neil Schemenauer | a42c827 | 2001-03-31 00:01:55 +0000 | [diff] [blame] | 988 | |
Tarek Ziadé | 99f660a | 2009-05-07 21:20:34 +0000 | [diff] [blame] | 989 | # tweak ARFLAGS only if the user didn't set it on the command line |
| 990 | AC_SUBST(ARFLAGS) |
| 991 | if test -z "$ARFLAGS" |
| 992 | then |
| 993 | ARFLAGS="rc" |
| 994 | fi |
| 995 | |
Victor Stinner | 2c7085f | 2017-05-02 16:55:50 +0200 | [diff] [blame] | 996 | AC_SUBST(GITVERSION) |
| 997 | AC_SUBST(GITTAG) |
| 998 | AC_SUBST(GITBRANCH) |
Martin v. Löwis | dea59e5 | 2006-01-05 10:00:36 +0000 | [diff] [blame] | 999 | |
Victor Stinner | df56925 | 2017-05-03 00:05:45 +0200 | [diff] [blame] | 1000 | if test -e $srcdir/.git |
Georg Brandl | 3a5508e | 2011-03-06 10:42:21 +0100 | [diff] [blame] | 1001 | then |
Victor Stinner | 2c7085f | 2017-05-02 16:55:50 +0200 | [diff] [blame] | 1002 | AC_CHECK_PROG(HAS_GIT, git, found, not-found) |
Georg Brandl | 3a5508e | 2011-03-06 10:42:21 +0100 | [diff] [blame] | 1003 | else |
Victor Stinner | 2c7085f | 2017-05-02 16:55:50 +0200 | [diff] [blame] | 1004 | HAS_GIT=no-repository |
| 1005 | fi |
| 1006 | if test $HAS_GIT = found |
| 1007 | then |
| 1008 | GITVERSION="git -C \$(srcdir) rev-parse --short HEAD" |
| 1009 | GITTAG="git -C \$(srcdir) describe --all --always --dirty" |
| 1010 | GITBRANCH="git -C \$(srcdir) name-rev --name-only HEAD" |
| 1011 | else |
| 1012 | GITVERSION="" |
| 1013 | GITTAG="" |
| 1014 | GITBRANCH="" |
Georg Brandl | 3a5508e | 2011-03-06 10:42:21 +0100 | [diff] [blame] | 1015 | fi |
| 1016 | |
Neil Schemenauer | a42c827 | 2001-03-31 00:01:55 +0000 | [diff] [blame] | 1017 | case $MACHDEP in |
Neil Schemenauer | af5567f | 2001-10-21 22:32:04 +0000 | [diff] [blame] | 1018 | bsdos*|hp*|HP*) |
| 1019 | # install -d does not work on BSDI or HP-UX |
Neil Schemenauer | a42c827 | 2001-03-31 00:01:55 +0000 | [diff] [blame] | 1020 | if test -z "$INSTALL" |
| 1021 | then |
| 1022 | INSTALL="${srcdir}/install-sh -c" |
| 1023 | fi |
| 1024 | esac |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 1025 | AC_PROG_INSTALL |
Trent Nelson | f6407a1 | 2012-08-30 14:56:13 +0000 | [diff] [blame] | 1026 | AC_PROG_MKDIR_P |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 1027 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1028 | # Not every filesystem supports hard links |
| 1029 | AC_SUBST(LN) |
| 1030 | if test -z "$LN" ; then |
| 1031 | case $ac_sys_system in |
| 1032 | BeOS*) LN="ln -s";; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 1033 | CYGWIN*) LN="ln -s";; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 1034 | atheos*) LN="ln -s";; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1035 | *) LN=ln;; |
| 1036 | esac |
| 1037 | fi |
| 1038 | |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1039 | # Check for --with-pydebug |
| 1040 | AC_MSG_CHECKING(for --with-pydebug) |
| 1041 | AC_ARG_WITH(pydebug, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 1042 | AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 1043 | [ |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1044 | if test "$withval" != no |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 1045 | then |
| 1046 | AC_DEFINE(Py_DEBUG, 1, |
| 1047 | [Define if you want to build an interpreter with many run-time checks.]) |
| 1048 | AC_MSG_RESULT(yes); |
| 1049 | Py_DEBUG='true' |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1050 | else AC_MSG_RESULT(no); Py_DEBUG='false' |
| 1051 | fi], |
| 1052 | [AC_MSG_RESULT(no)]) |
| 1053 | |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1054 | # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be |
| 1055 | # merged with this chunk of code? |
| 1056 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 1057 | # Optimizer/debugger flags |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1058 | # ------------------------ |
| 1059 | # (The following bit of code is complicated enough - please keep things |
| 1060 | # indented properly. Just pretend you're editing Python code. ;-) |
| 1061 | |
| 1062 | # There are two parallel sets of case statements below, one that checks to |
| 1063 | # see if OPT was set and one that does BASECFLAGS setting based upon |
| 1064 | # compiler and platform. BASECFLAGS tweaks need to be made even if the |
| 1065 | # user set OPT. |
| 1066 | |
| 1067 | # tweak OPT based on compiler and platform, only if the user didn't set |
| 1068 | # it on the command line |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 1069 | AC_SUBST(OPT) |
Benjamin Peterson | d4b721b | 2010-03-23 20:58:37 +0000 | [diff] [blame] | 1070 | if test "${OPT-unset}" = "unset" |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 1071 | then |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1072 | case $GCC in |
| 1073 | yes) |
Skip Montanaro | 288a5be | 2006-04-13 02:00:56 +0000 | [diff] [blame] | 1074 | if test "$CC" != 'g++' ; then |
| 1075 | STRICT_PROTO="-Wstrict-prototypes" |
| 1076 | fi |
Guido van Rossum | 7c862f8 | 2007-12-13 20:50:10 +0000 | [diff] [blame] | 1077 | # For gcc 4.x we need to use -fwrapv so lets check if its supported |
| 1078 | if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then |
| 1079 | WRAP="-fwrapv" |
| 1080 | fi |
Stefan Krah | 503e5e1 | 2011-09-14 15:19:42 +0200 | [diff] [blame] | 1081 | |
| 1082 | # Clang also needs -fwrapv |
Stefan Krah | 2bc1e8f | 2011-12-08 22:26:06 +0100 | [diff] [blame] | 1083 | case $CC in |
| 1084 | *clang*) WRAP="-fwrapv" |
| 1085 | ;; |
| 1086 | esac |
Stefan Krah | 503e5e1 | 2011-09-14 15:19:42 +0200 | [diff] [blame] | 1087 | |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1088 | case $ac_cv_prog_cc_g in |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 1089 | yes) |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1090 | if test "$Py_DEBUG" = 'true' ; then |
| 1091 | # Optimization messes up debuggers, so turn it off for |
| 1092 | # debug builds. |
Mark Dickinson | d2f3e3f | 2010-05-05 22:23:58 +0000 | [diff] [blame] | 1093 | OPT="-g -O0 -Wall $STRICT_PROTO" |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1094 | else |
Guido van Rossum | 7c862f8 | 2007-12-13 20:50:10 +0000 | [diff] [blame] | 1095 | OPT="-g $WRAP -O3 -Wall $STRICT_PROTO" |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1096 | fi |
| 1097 | ;; |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 1098 | *) |
Skip Montanaro | 288a5be | 2006-04-13 02:00:56 +0000 | [diff] [blame] | 1099 | OPT="-O3 -Wall $STRICT_PROTO" |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1100 | ;; |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1101 | esac |
Martin v. Löwis | 21ee409 | 2002-09-30 16:19:48 +0000 | [diff] [blame] | 1102 | case $ac_sys_system in |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1103 | SCO_SV*) OPT="$OPT -m486 -DSCO5" |
| 1104 | ;; |
| 1105 | esac |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1106 | ;; |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1107 | |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 1108 | *) |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1109 | OPT="-O" |
| 1110 | ;; |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 1111 | esac |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 1112 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1113 | |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1114 | AC_SUBST(BASECFLAGS) |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 1115 | |
| 1116 | # The -arch flags for universal builds on OSX |
| 1117 | UNIVERSAL_ARCH_FLAGS= |
| 1118 | AC_SUBST(UNIVERSAL_ARCH_FLAGS) |
| 1119 | |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1120 | # tweak BASECFLAGS based on compiler and platform |
| 1121 | case $GCC in |
| 1122 | yes) |
Martin v. Löwis | 70fedcd | 2003-07-07 21:26:19 +0000 | [diff] [blame] | 1123 | # Python violates C99 rules, by casting between incompatible |
| 1124 | # pointer types. GCC may generate bad code as a result of that, |
| 1125 | # so use -fno-strict-aliasing if supported. |
| 1126 | AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing) |
| 1127 | ac_save_cc="$CC" |
| 1128 | CC="$CC -fno-strict-aliasing" |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 1129 | AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1130 | AC_COMPILE_IFELSE( |
Mark Dickinson | 5e13e29 | 2010-05-11 08:55:06 +0000 | [diff] [blame] | 1131 | [AC_LANG_PROGRAM([[]], [[]])], |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1132 | [ac_cv_no_strict_aliasing_ok=yes], |
| 1133 | [ac_cv_no_strict_aliasing_ok=no])) |
Martin v. Löwis | 70fedcd | 2003-07-07 21:26:19 +0000 | [diff] [blame] | 1134 | CC="$ac_save_cc" |
| 1135 | AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok) |
| 1136 | if test $ac_cv_no_strict_aliasing_ok = yes |
| 1137 | then |
| 1138 | BASECFLAGS="$BASECFLAGS -fno-strict-aliasing" |
| 1139 | fi |
Mark Dickinson | 6513466 | 2008-04-25 16:11:04 +0000 | [diff] [blame] | 1140 | |
| 1141 | # if using gcc on alpha, use -mieee to get (near) full IEEE 754 |
| 1142 | # support. Without this, treatment of subnormals doesn't follow |
| 1143 | # the standard. |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 1144 | case $host in |
Mark Dickinson | 6513466 | 2008-04-25 16:11:04 +0000 | [diff] [blame] | 1145 | alpha*) |
| 1146 | BASECFLAGS="$BASECFLAGS -mieee" |
| 1147 | ;; |
| 1148 | esac |
| 1149 | |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1150 | case $ac_sys_system in |
| 1151 | SCO_SV*) |
| 1152 | BASECFLAGS="$BASECFLAGS -m486 -DSCO5" |
| 1153 | ;; |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 1154 | # is there any other compiler on Darwin besides gcc? |
| 1155 | Darwin*) |
| 1156 | # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd |
| 1157 | # used to be here, but non-Apple gcc doesn't accept them. |
| 1158 | if test "${CC}" = gcc |
| 1159 | then |
| 1160 | AC_MSG_CHECKING(which compiler should be used) |
| 1161 | case "${UNIVERSALSDK}" in |
| 1162 | */MacOSX10.4u.sdk) |
| 1163 | # Build using 10.4 SDK, force usage of gcc when the |
| 1164 | # compiler is gcc, otherwise the user will get very |
| 1165 | # confusing error messages when building on OSX 10.6 |
| 1166 | CC=gcc-4.0 |
| 1167 | CPP=cpp-4.0 |
| 1168 | ;; |
| 1169 | esac |
| 1170 | AC_MSG_RESULT($CC) |
| 1171 | fi |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 1172 | |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 1173 | if test "${enable_universalsdk}" |
| 1174 | then |
| 1175 | case "$UNIVERSAL_ARCHS" in |
| 1176 | 32-bit) |
| 1177 | UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386" |
| 1178 | LIPO_32BIT_FLAGS="" |
| 1179 | ARCH_RUN_32BIT="" |
| 1180 | ;; |
| 1181 | 64-bit) |
| 1182 | UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64" |
| 1183 | LIPO_32BIT_FLAGS="" |
| 1184 | ARCH_RUN_32BIT="" |
| 1185 | ;; |
| 1186 | all) |
| 1187 | UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64" |
| 1188 | LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386" |
| 1189 | ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc" |
| 1190 | ;; |
| 1191 | intel) |
| 1192 | UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64" |
| 1193 | LIPO_32BIT_FLAGS="-extract i386" |
| 1194 | ARCH_RUN_32BIT="/usr/bin/arch -i386" |
| 1195 | ;; |
| 1196 | intel-32) |
| 1197 | UNIVERSAL_ARCH_FLAGS="-arch i386" |
| 1198 | LIPO_32BIT_FLAGS="" |
| 1199 | ARCH_RUN_32BIT="" |
| 1200 | ;; |
| 1201 | intel-64) |
| 1202 | UNIVERSAL_ARCH_FLAGS="-arch x86_64" |
| 1203 | LIPO_32BIT_FLAGS="" |
| 1204 | ARCH_RUN_32BIT="" |
| 1205 | ;; |
| 1206 | 3-way) |
| 1207 | UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64" |
| 1208 | LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386" |
| 1209 | ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc" |
| 1210 | ;; |
| 1211 | *) |
| 1212 | AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way]) |
| 1213 | ;; |
| 1214 | esac |
Ronald Oussoren | 23d9253 | 2009-09-07 06:12:00 +0000 | [diff] [blame] | 1215 | |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 1216 | if test "${UNIVERSALSDK}" != "/" |
| 1217 | then |
| 1218 | CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}" |
| 1219 | LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" |
| 1220 | CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}" |
| 1221 | else |
| 1222 | CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}" |
| 1223 | LDFLAGS="${UNIVERSAL_ARCH_FLAGS} ${LDFLAGS}" |
| 1224 | fi |
| 1225 | fi |
Ronald Oussoren | 23d9253 | 2009-09-07 06:12:00 +0000 | [diff] [blame] | 1226 | |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 1227 | # Calculate an appropriate deployment target for this build: |
| 1228 | # The deployment target value is used explicitly to enable certain |
| 1229 | # features are enabled (such as builtin libedit support for readline) |
| 1230 | # through the use of Apple's Availability Macros and is used as a |
| 1231 | # component of the string returned by distutils.get_platform(). |
| 1232 | # |
| 1233 | # Use the value from: |
| 1234 | # 1. the MACOSX_DEPLOYMENT_TARGET environment variable if specified |
| 1235 | # 2. the operating system version of the build machine if >= 10.6 |
| 1236 | # 3. If running on OS X 10.3 through 10.5, use the legacy tests |
| 1237 | # below to pick either 10.3, 10.4, or 10.5 as the target. |
| 1238 | # 4. If we are running on OS X 10.2 or earlier, good luck! |
Ronald Oussoren | 23d9253 | 2009-09-07 06:12:00 +0000 | [diff] [blame] | 1239 | |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 1240 | AC_MSG_CHECKING(which MACOSX_DEPLOYMENT_TARGET to use) |
| 1241 | cur_target_major=`sw_vers -productVersion | \ |
| 1242 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` |
| 1243 | cur_target_minor=`sw_vers -productVersion | \ |
| 1244 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` |
| 1245 | cur_target="${cur_target_major}.${cur_target_minor}" |
| 1246 | if test ${cur_target_major} -eq 10 && \ |
| 1247 | test ${cur_target_minor} -ge 3 && \ |
| 1248 | test ${cur_target_minor} -le 5 |
| 1249 | then |
| 1250 | # OS X 10.3 through 10.5 |
| 1251 | cur_target=10.3 |
| 1252 | if test ${enable_universalsdk} |
| 1253 | then |
| 1254 | case "$UNIVERSAL_ARCHS" in |
| 1255 | all|3-way|intel|64-bit) |
| 1256 | # These configurations were first supported in 10.5 |
| 1257 | cur_target='10.5' |
| 1258 | ;; |
| 1259 | esac |
| 1260 | else |
| 1261 | if test `/usr/bin/arch` = "i386" |
| 1262 | then |
| 1263 | # 10.4 was the first release to support Intel archs |
| 1264 | cur_target="10.4" |
| 1265 | fi |
| 1266 | fi |
| 1267 | fi |
| 1268 | CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}} |
Benjamin Peterson | 4347c44 | 2008-07-17 15:59:24 +0000 | [diff] [blame] | 1269 | |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 1270 | # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the |
| 1271 | # environment with a value that is the same as what we'll use |
| 1272 | # in the Makefile to ensure that we'll get the same compiler |
| 1273 | # environment during configure and build time. |
| 1274 | MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET" |
| 1275 | export MACOSX_DEPLOYMENT_TARGET |
| 1276 | EXPORT_MACOSX_DEPLOYMENT_TARGET='' |
| 1277 | AC_MSG_RESULT($MACOSX_DEPLOYMENT_TARGET) |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 1278 | |
Ned Deily | ee8e4b6 | 2018-04-14 10:37:28 -0400 | [diff] [blame] | 1279 | # end of Darwin* tests |
| 1280 | ;; |
Neal Norwitz | dedeeaa | 2006-03-31 06:54:45 +0000 | [diff] [blame] | 1281 | OSF*) |
| 1282 | BASECFLAGS="$BASECFLAGS -mieee" |
| 1283 | ;; |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1284 | esac |
| 1285 | ;; |
| 1286 | |
| 1287 | *) |
| 1288 | case $ac_sys_system in |
| 1289 | OpenUNIX*|UnixWare*) |
| 1290 | BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca " |
| 1291 | ;; |
Neal Norwitz | b44f165 | 2003-05-26 14:11:55 +0000 | [diff] [blame] | 1292 | OSF*) |
| 1293 | BASECFLAGS="$BASECFLAGS -ieee -std" |
| 1294 | ;; |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1295 | SCO_SV*) |
| 1296 | BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5" |
| 1297 | ;; |
| 1298 | esac |
| 1299 | ;; |
| 1300 | esac |
| 1301 | |
Zachary Ware | 6ed42ea | 2015-12-21 11:43:03 -0600 | [diff] [blame] | 1302 | # ICC needs -fp-model strict or floats behave badly |
| 1303 | case "$CC" in |
| 1304 | *icc*) |
| 1305 | BASECFLAGS="$BASECFLAGS -fp-model strict" |
| 1306 | ;; |
| 1307 | esac |
| 1308 | |
Fred Drake | e1ceaa0 | 2001-12-04 20:55:47 +0000 | [diff] [blame] | 1309 | if test "$Py_DEBUG" = 'true'; then |
| 1310 | : |
| 1311 | else |
| 1312 | OPT="-DNDEBUG $OPT" |
| 1313 | fi |
| 1314 | |
Guido van Rossum | 6f2260e | 1996-09-09 16:21:03 +0000 | [diff] [blame] | 1315 | if test "$ac_arch_flags" |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 1316 | then |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1317 | BASECFLAGS="$BASECFLAGS $ac_arch_flags" |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 1318 | fi |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1319 | |
Neal Norwitz | 020c46a | 2006-01-07 21:39:28 +0000 | [diff] [blame] | 1320 | # disable check for icc since it seems to pass, but generates a warning |
| 1321 | if test "$CC" = icc |
| 1322 | then |
| 1323 | ac_cv_opt_olimit_ok=no |
| 1324 | fi |
| 1325 | |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 1326 | AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0) |
| 1327 | AC_CACHE_VAL(ac_cv_opt_olimit_ok, |
| 1328 | [ac_save_cc="$CC" |
| 1329 | CC="$CC -OPT:Olimit=0" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1330 | AC_COMPILE_IFELSE( |
Mark Dickinson | 5e13e29 | 2010-05-11 08:55:06 +0000 | [diff] [blame] | 1331 | [AC_LANG_PROGRAM([[]], [[]])], |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1332 | [ac_cv_opt_olimit_ok=yes], |
| 1333 | [ac_cv_opt_olimit_ok=no] |
Gregory P. Smith | ec3b8bd | 2009-11-01 21:02:52 +0000 | [diff] [blame] | 1334 | ) |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 1335 | CC="$ac_save_cc"]) |
| 1336 | AC_MSG_RESULT($ac_cv_opt_olimit_ok) |
Guido van Rossum | 2efa34b | 1997-10-23 17:43:11 +0000 | [diff] [blame] | 1337 | if test $ac_cv_opt_olimit_ok = yes; then |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 1338 | case $ac_sys_system in |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1339 | # XXX is this branch needed? On MacOSX 10.2.2 the result of the |
| 1340 | # olimit_ok test is "no". Is it "yes" in some other Darwin-esque |
| 1341 | # environment? |
| 1342 | Darwin*) |
| 1343 | ;; |
Trent Nelson | 34562e1 | 2012-10-17 18:01:12 -0400 | [diff] [blame] | 1344 | # XXX thankfully this useless troublemaker of a flag has been |
| 1345 | # eradicated in the 3.x line. For now, make sure it isn't picked |
| 1346 | # up by any of our other platforms that use CC. |
| 1347 | AIX*|SunOS*|HP-UX*|IRIX*) |
| 1348 | ;; |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1349 | *) |
| 1350 | BASECFLAGS="$BASECFLAGS -OPT:Olimit=0" |
| 1351 | ;; |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 1352 | esac |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 1353 | else |
| 1354 | AC_MSG_CHECKING(whether $CC accepts -Olimit 1500) |
| 1355 | AC_CACHE_VAL(ac_cv_olimit_ok, |
| 1356 | [ac_save_cc="$CC" |
| 1357 | CC="$CC -Olimit 1500" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1358 | AC_COMPILE_IFELSE( |
Mark Dickinson | 5e13e29 | 2010-05-11 08:55:06 +0000 | [diff] [blame] | 1359 | [AC_LANG_PROGRAM([[]], [[]])], |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1360 | [ac_cv_olimit_ok=yes], |
| 1361 | [ac_cv_olimit_ok=no] |
Gregory P. Smith | ec3b8bd | 2009-11-01 21:02:52 +0000 | [diff] [blame] | 1362 | ) |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 1363 | CC="$ac_save_cc"]) |
| 1364 | AC_MSG_RESULT($ac_cv_olimit_ok) |
| 1365 | if test $ac_cv_olimit_ok = yes; then |
Stefan Krah | 6747326 | 2012-11-29 00:17:05 +0100 | [diff] [blame] | 1366 | case $ac_sys_system in |
| 1367 | # Issue #16534: On HP-UX ac_cv_olimit_ok=yes is a false positive. |
| 1368 | HP-UX*) |
| 1369 | ;; |
| 1370 | *) |
| 1371 | BASECFLAGS="$BASECFLAGS -Olimit 1500" |
| 1372 | ;; |
| 1373 | esac |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 1374 | fi |
Guido van Rossum | 201afe5 | 1997-05-14 21:14:44 +0000 | [diff] [blame] | 1375 | fi |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 1376 | |
Martin v. Löwis | aac1316 | 2006-10-19 10:58:46 +0000 | [diff] [blame] | 1377 | # Check whether GCC supports PyArg_ParseTuple format |
| 1378 | if test "$GCC" = "yes" |
| 1379 | then |
| 1380 | AC_MSG_CHECKING(whether gcc supports ParseTuple __format__) |
| 1381 | save_CFLAGS=$CFLAGS |
Benjamin Peterson | c875966 | 2013-05-11 13:00:05 -0500 | [diff] [blame] | 1382 | CFLAGS="$CFLAGS -Werror -Wformat" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1383 | AC_COMPILE_IFELSE([ |
| 1384 | AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]]) |
| 1385 | ],[ |
| 1386 | AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, |
| 1387 | [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))]) |
| 1388 | AC_MSG_RESULT(yes) |
| 1389 | ],[ |
| 1390 | AC_MSG_RESULT(no) |
| 1391 | ]) |
Martin v. Löwis | c1d7597 | 2006-10-19 16:01:37 +0000 | [diff] [blame] | 1392 | CFLAGS=$save_CFLAGS |
Martin v. Löwis | aac1316 | 2006-10-19 10:58:46 +0000 | [diff] [blame] | 1393 | fi |
| 1394 | |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1395 | |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 1396 | # Enable optimization flags |
| 1397 | AC_SUBST(DEF_MAKE_ALL_RULE) |
| 1398 | AC_SUBST(DEF_MAKE_RULE) |
| 1399 | Py_OPT='false' |
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) | b999915 | 2016-11-20 21:19:36 +0000 | [diff] [blame] | 1400 | AC_MSG_CHECKING(for --enable-optimizations) |
| 1401 | AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--enable-optimizations], [Enable expensive optimizations (PGO, maybe LTO, etc). Disabled by default.]), |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 1402 | [ |
INADA Naoki | 6a04ef7 | 2017-03-29 01:50:48 +0900 | [diff] [blame] | 1403 | if test "$enableval" != no |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 1404 | then |
| 1405 | Py_OPT='true' |
| 1406 | AC_MSG_RESULT(yes); |
| 1407 | else |
| 1408 | Py_OPT='false' |
| 1409 | AC_MSG_RESULT(no); |
| 1410 | fi], |
| 1411 | [AC_MSG_RESULT(no)]) |
| 1412 | if test "$Py_OPT" = 'true' ; then |
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) | 9cbfa79 | 2016-09-08 22:44:44 +0000 | [diff] [blame] | 1413 | # Intentionally not forcing Py_LTO='true' here. Too many toolchains do not |
| 1414 | # compile working code using it and both test_distutils and test_gdb are |
| 1415 | # broken when you do managed to get a toolchain that works with it. People |
| 1416 | # who want LTO need to use --with-lto themselves. |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 1417 | DEF_MAKE_ALL_RULE="profile-opt" |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1418 | REQUIRE_PGO="yes" |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 1419 | DEF_MAKE_RULE="build_all" |
| 1420 | else |
| 1421 | DEF_MAKE_ALL_RULE="build_all" |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1422 | REQUIRE_PGO="no" |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 1423 | DEF_MAKE_RULE="all" |
| 1424 | fi |
| 1425 | |
| 1426 | |
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) | c543a0f | 2016-06-02 23:44:40 +0000 | [diff] [blame] | 1427 | # Enable LTO flags |
| 1428 | AC_SUBST(LTOFLAGS) |
| 1429 | AC_MSG_CHECKING(for --with-lto) |
| 1430 | AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable Link Time Optimization in PGO builds. Disabled by default.]), |
| 1431 | [ |
| 1432 | if test "$withval" != no |
| 1433 | then |
| 1434 | Py_LTO='true' |
| 1435 | AC_MSG_RESULT(yes); |
| 1436 | else |
| 1437 | Py_LTO='false' |
| 1438 | AC_MSG_RESULT(no); |
| 1439 | fi], |
| 1440 | [AC_MSG_RESULT(no)]) |
| 1441 | if test "$Py_LTO" = 'true' ; then |
| 1442 | case $CC in |
| 1443 | *clang*) |
| 1444 | # Any changes made here should be reflected in the GCC+Darwin case below |
| 1445 | LTOFLAGS="-flto" |
| 1446 | ;; |
| 1447 | *gcc*) |
| 1448 | case $ac_sys_system in |
| 1449 | Darwin*) |
| 1450 | LTOFLAGS="-flto" |
| 1451 | ;; |
| 1452 | *) |
| 1453 | LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none" |
| 1454 | ;; |
| 1455 | esac |
| 1456 | ;; |
| 1457 | esac |
| 1458 | fi |
| 1459 | |
| 1460 | |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1461 | # Enable PGO flags. |
| 1462 | AC_SUBST(PGO_PROF_GEN_FLAG) |
| 1463 | AC_SUBST(PGO_PROF_USE_FLAG) |
| 1464 | AC_SUBST(LLVM_PROF_MERGER) |
| 1465 | AC_SUBST(LLVM_PROF_FILE) |
| 1466 | AC_SUBST(LLVM_PROF_ERR) |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1467 | # Make this work on systems where llvm tools are not installed with their |
| 1468 | # normal names in the default $PATH (ie: Ubuntu). They exist under the |
| 1469 | # non-suffixed name in their versioned llvm directory. |
| 1470 | llvm_bin_dir='' |
| 1471 | llvm_path="${PATH}" |
| 1472 | if test "${CC}" = "clang" |
| 1473 | then |
| 1474 | clang_bin=`which clang` |
| 1475 | # Some systems install clang elsewhere as a symlink to the real path |
| 1476 | # which is where the related llvm tools are located. |
| 1477 | if test -L "${clang_bin}" |
| 1478 | then |
| 1479 | clang_dir=`dirname "${clang_bin}"` |
| 1480 | clang_bin=`readlink "${clang_bin}"` |
| 1481 | llvm_bin_dir="${clang_dir}/"`dirname "${clang_bin}"` |
| 1482 | llvm_path="${llvm_path}${PATH_SEPARATOR}${llvm_bin_dir}" |
| 1483 | fi |
| 1484 | fi |
| 1485 | AC_SUBST(LLVM_PROFDATA) |
| 1486 | AC_PATH_TARGET_TOOL(LLVM_PROFDATA, llvm-profdata, '', ${llvm_path}) |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1487 | AC_SUBST(LLVM_PROF_FOUND) |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1488 | if test -n "${LLVM_PROFDATA}" -a -x "${LLVM_PROFDATA}" |
| 1489 | then |
| 1490 | LLVM_PROF_FOUND="found" |
| 1491 | else |
| 1492 | LLVM_PROF_FOUND="not-found" |
| 1493 | fi |
| 1494 | if test "$ac_sys_system" = "Darwin" -a "${LLVM_PROF_FOUND}" = "not-found" |
| 1495 | then |
| 1496 | found_llvm_profdata=`/usr/bin/xcrun -find llvm-profdata 2>/dev/null` |
| 1497 | if test -n "${found_llvm_profdata}" |
| 1498 | then |
| 1499 | # llvm-profdata isn't directly in $PATH in some cases. |
| 1500 | # https://apple.stackexchange.com/questions/197053/ |
| 1501 | LLVM_PROFDATA='/usr/bin/xcrun llvm-profdata' |
| 1502 | LLVM_PROF_FOUND=found |
| 1503 | AC_MSG_NOTICE([llvm-profdata found via xcrun: ${LLVM_PROFDATA}]) |
| 1504 | fi |
| 1505 | fi |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1506 | LLVM_PROF_ERR=no |
| 1507 | case $CC in |
| 1508 | *clang*) |
| 1509 | # Any changes made here should be reflected in the GCC+Darwin case below |
| 1510 | PGO_PROF_GEN_FLAG="-fprofile-instr-generate" |
| 1511 | PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd" |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1512 | LLVM_PROF_MERGER="${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr" |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1513 | LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\"" |
| 1514 | if test $LLVM_PROF_FOUND = not-found |
| 1515 | then |
| 1516 | LLVM_PROF_ERR=yes |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1517 | if test "${REQUIRE_PGO}" = "yes" |
| 1518 | then |
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) | b999915 | 2016-11-20 21:19:36 +0000 | [diff] [blame] | 1519 | AC_MSG_ERROR([llvm-profdata is required for a --enable-optimizations build but could not be found.]) |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1520 | fi |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1521 | fi |
| 1522 | ;; |
| 1523 | *gcc*) |
| 1524 | case $ac_sys_system in |
| 1525 | Darwin*) |
| 1526 | PGO_PROF_GEN_FLAG="-fprofile-instr-generate" |
| 1527 | PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd" |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1528 | LLVM_PROF_MERGER="${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr" |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1529 | LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\"" |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1530 | if test "${LLVM_PROF_FOUND}" = "not-found" |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1531 | then |
| 1532 | LLVM_PROF_ERR=yes |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1533 | if test "${REQUIRE_PGO}" = "yes" |
| 1534 | then |
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) | b999915 | 2016-11-20 21:19:36 +0000 | [diff] [blame] | 1535 | AC_MSG_ERROR([llvm-profdata is required for a --enable-optimizations build but could not be found.]) |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1536 | fi |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1537 | fi |
| 1538 | ;; |
| 1539 | *) |
| 1540 | PGO_PROF_GEN_FLAG="-fprofile-generate" |
| 1541 | PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction" |
| 1542 | LLVM_PROF_MERGER="true" |
| 1543 | LLVM_PROF_FILE="" |
| 1544 | ;; |
| 1545 | esac |
| 1546 | ;; |
Zachary Ware | 6ed42ea | 2015-12-21 11:43:03 -0600 | [diff] [blame] | 1547 | *icc*) |
| 1548 | PGO_PROF_GEN_FLAG="-prof-gen" |
| 1549 | PGO_PROF_USE_FLAG="-prof-use" |
| 1550 | LLVM_PROF_MERGER="true" |
| 1551 | LLVM_PROF_FILE="" |
| 1552 | ;; |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1553 | esac |
| 1554 | |
| 1555 | |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 1556 | # On some compilers, pthreads are available without further options |
| 1557 | # (e.g. MacOS X). On some of these systems, the compiler will not |
| 1558 | # complain if unaccepted options are passed (e.g. gcc on Mac OS X). |
| 1559 | # So we have to see first whether pthreads are available without |
| 1560 | # options before we can check whether -Kpthread improves anything. |
| 1561 | AC_MSG_CHECKING(whether pthreads are available without options) |
| 1562 | AC_CACHE_VAL(ac_cv_pthread_is_default, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1563 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 1564 | #include <stdio.h> |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 1565 | #include <pthread.h> |
| 1566 | |
| 1567 | void* routine(void* p){return NULL;} |
| 1568 | |
| 1569 | int main(){ |
| 1570 | pthread_t p; |
| 1571 | if(pthread_create(&p,NULL,routine,NULL)!=0) |
| 1572 | return 1; |
Jack Jansen | 4f8d054 | 2002-03-08 13:43:01 +0000 | [diff] [blame] | 1573 | (void)pthread_detach(p); |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 1574 | return 0; |
| 1575 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1576 | ]])],[ |
Skip Montanaro | d8d39a0 | 2003-07-10 20:44:10 +0000 | [diff] [blame] | 1577 | ac_cv_pthread_is_default=yes |
| 1578 | ac_cv_kthread=no |
| 1579 | ac_cv_pthread=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1580 | ],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no]) |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 1581 | ]) |
| 1582 | AC_MSG_RESULT($ac_cv_pthread_is_default) |
| 1583 | |
| 1584 | |
| 1585 | if test $ac_cv_pthread_is_default = yes |
| 1586 | then |
| 1587 | ac_cv_kpthread=no |
| 1588 | else |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 1589 | # -Kpthread, if available, provides the right #defines |
| 1590 | # and linker options to make pthread_create available |
Martin v. Löwis | 260aecc | 2001-10-07 08:14:41 +0000 | [diff] [blame] | 1591 | # Some compilers won't report that they do not support -Kpthread, |
| 1592 | # so we need to run a program to see whether it really made the |
| 1593 | # function available. |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 1594 | AC_MSG_CHECKING(whether $CC accepts -Kpthread) |
| 1595 | AC_CACHE_VAL(ac_cv_kpthread, |
| 1596 | [ac_save_cc="$CC" |
| 1597 | CC="$CC -Kpthread" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1598 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 1599 | #include <stdio.h> |
Martin v. Löwis | 260aecc | 2001-10-07 08:14:41 +0000 | [diff] [blame] | 1600 | #include <pthread.h> |
| 1601 | |
| 1602 | void* routine(void* p){return NULL;} |
| 1603 | |
| 1604 | int main(){ |
| 1605 | pthread_t p; |
| 1606 | if(pthread_create(&p,NULL,routine,NULL)!=0) |
| 1607 | return 1; |
Jack Jansen | 4f8d054 | 2002-03-08 13:43:01 +0000 | [diff] [blame] | 1608 | (void)pthread_detach(p); |
Martin v. Löwis | 260aecc | 2001-10-07 08:14:41 +0000 | [diff] [blame] | 1609 | return 0; |
| 1610 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1611 | ]])],[ac_cv_kpthread=yes],[ac_cv_kpthread=no],[ac_cv_kpthread=no]) |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 1612 | CC="$ac_save_cc"]) |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 1613 | AC_MSG_RESULT($ac_cv_kpthread) |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 1614 | fi |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 1615 | |
Skip Montanaro | d8d39a0 | 2003-07-10 20:44:10 +0000 | [diff] [blame] | 1616 | if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no |
Martin v. Löwis | 5f433f0 | 2003-05-05 05:05:30 +0000 | [diff] [blame] | 1617 | then |
| 1618 | # -Kthread, if available, provides the right #defines |
| 1619 | # and linker options to make pthread_create available |
| 1620 | # Some compilers won't report that they do not support -Kthread, |
| 1621 | # so we need to run a program to see whether it really made the |
| 1622 | # function available. |
| 1623 | AC_MSG_CHECKING(whether $CC accepts -Kthread) |
| 1624 | AC_CACHE_VAL(ac_cv_kthread, |
| 1625 | [ac_save_cc="$CC" |
| 1626 | CC="$CC -Kthread" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1627 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 1628 | #include <stdio.h> |
Martin v. Löwis | 5f433f0 | 2003-05-05 05:05:30 +0000 | [diff] [blame] | 1629 | #include <pthread.h> |
| 1630 | |
| 1631 | void* routine(void* p){return NULL;} |
| 1632 | |
| 1633 | int main(){ |
| 1634 | pthread_t p; |
| 1635 | if(pthread_create(&p,NULL,routine,NULL)!=0) |
| 1636 | return 1; |
| 1637 | (void)pthread_detach(p); |
| 1638 | return 0; |
| 1639 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1640 | ]])],[ac_cv_kthread=yes],[ac_cv_kthread=no],[ac_cv_kthread=no]) |
Martin v. Löwis | 5f433f0 | 2003-05-05 05:05:30 +0000 | [diff] [blame] | 1641 | CC="$ac_save_cc"]) |
| 1642 | AC_MSG_RESULT($ac_cv_kthread) |
| 1643 | fi |
| 1644 | |
Skip Montanaro | d8d39a0 | 2003-07-10 20:44:10 +0000 | [diff] [blame] | 1645 | if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 1646 | then |
| 1647 | # -pthread, if available, provides the right #defines |
| 1648 | # and linker options to make pthread_create available |
| 1649 | # Some compilers won't report that they do not support -pthread, |
| 1650 | # so we need to run a program to see whether it really made the |
| 1651 | # function available. |
| 1652 | AC_MSG_CHECKING(whether $CC accepts -pthread) |
doko@python.org | fa3f9a3 | 2013-01-25 15:32:31 +0100 | [diff] [blame] | 1653 | AC_CACHE_VAL(ac_cv_pthread, |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 1654 | [ac_save_cc="$CC" |
| 1655 | CC="$CC -pthread" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1656 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 1657 | #include <stdio.h> |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 1658 | #include <pthread.h> |
| 1659 | |
| 1660 | void* routine(void* p){return NULL;} |
| 1661 | |
| 1662 | int main(){ |
| 1663 | pthread_t p; |
| 1664 | if(pthread_create(&p,NULL,routine,NULL)!=0) |
| 1665 | return 1; |
| 1666 | (void)pthread_detach(p); |
| 1667 | return 0; |
| 1668 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1669 | ]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no]) |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 1670 | CC="$ac_save_cc"]) |
| 1671 | AC_MSG_RESULT($ac_cv_pthread) |
| 1672 | fi |
| 1673 | |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1674 | # If we have set a CC compiler flag for thread support then |
| 1675 | # check if it works for CXX, too. |
| 1676 | ac_cv_cxx_thread=no |
| 1677 | if test ! -z "$CXX" |
| 1678 | then |
| 1679 | AC_MSG_CHECKING(whether $CXX also accepts flags for thread support) |
| 1680 | ac_save_cxx="$CXX" |
| 1681 | |
| 1682 | if test "$ac_cv_kpthread" = "yes" |
| 1683 | then |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 1684 | CXX="$CXX -Kpthread" |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1685 | ac_cv_cxx_thread=yes |
| 1686 | elif test "$ac_cv_kthread" = "yes" |
| 1687 | then |
| 1688 | CXX="$CXX -Kthread" |
| 1689 | ac_cv_cxx_thread=yes |
| 1690 | elif test "$ac_cv_pthread" = "yes" |
| 1691 | then |
| 1692 | CXX="$CXX -pthread" |
| 1693 | ac_cv_cxx_thread=yes |
| 1694 | fi |
| 1695 | |
| 1696 | if test $ac_cv_cxx_thread = yes |
| 1697 | then |
| 1698 | echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext |
| 1699 | $CXX -c conftest.$ac_ext 2>&5 |
| 1700 | if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \ |
| 1701 | && test -s conftest$ac_exeext && ./conftest$ac_exeext |
| 1702 | then |
| 1703 | ac_cv_cxx_thread=yes |
| 1704 | else |
| 1705 | ac_cv_cxx_thread=no |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1706 | fi |
| 1707 | rm -fr conftest* |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1708 | fi |
Brett Cannon | c601e0f | 2004-11-07 01:24:12 +0000 | [diff] [blame] | 1709 | AC_MSG_RESULT($ac_cv_cxx_thread) |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1710 | fi |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 1711 | CXX="$ac_save_cxx" |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1712 | |
Fred Drake | ce81d59 | 2000-07-09 14:39:29 +0000 | [diff] [blame] | 1713 | dnl # check for ANSI or K&R ("traditional") preprocessor |
| 1714 | dnl AC_MSG_CHECKING(for C preprocessor type) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1715 | dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Fred Drake | ce81d59 | 2000-07-09 14:39:29 +0000 | [diff] [blame] | 1716 | dnl #define spam(name, doc) {#name, &name, #name "() -- " doc} |
| 1717 | dnl int foo; |
| 1718 | dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something"); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1719 | dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional]) |
Fred Drake | ce81d59 | 2000-07-09 14:39:29 +0000 | [diff] [blame] | 1720 | dnl AC_MSG_RESULT($cpp_type) |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 1721 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1722 | # checks for header files |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1723 | AC_HEADER_STDC |
Miss Islington (bot) | 6ccdad7 | 2018-01-24 01:51:39 -0800 | [diff] [blame] | 1724 | AC_CHECK_HEADERS(asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \ |
Martin v. Löwis | 0e8bd7e | 2006-06-10 12:23:46 +0000 | [diff] [blame] | 1725 | fcntl.h grp.h \ |
doko@ubuntu.com | f27ec3e | 2014-04-17 20:11:19 +0200 | [diff] [blame] | 1726 | ieeefp.h io.h langinfo.h libintl.h poll.h process.h pthread.h \ |
Martin v. Löwis | 40e9aed | 2006-10-02 15:20:37 +0000 | [diff] [blame] | 1727 | shadow.h signal.h stdint.h stropts.h termios.h thread.h \ |
Martin v. Löwis | 14e73b1 | 2003-01-01 09:51:12 +0000 | [diff] [blame] | 1728 | unistd.h utime.h \ |
Christian Heimes | 0e9ab5f | 2008-03-21 23:49:44 +0000 | [diff] [blame] | 1729 | sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ |
| 1730 | sys/lock.h sys/mkdev.h sys/modem.h \ |
Benjamin Peterson | 6b1c909 | 2016-12-19 23:54:25 -0800 | [diff] [blame] | 1731 | sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ |
Martin v. Löwis | 8c255e4 | 2008-05-23 15:06:50 +0000 | [diff] [blame] | 1732 | sys/termio.h sys/time.h \ |
Martin v. Löwis | 0e8bd7e | 2006-06-10 12:23:46 +0000 | [diff] [blame] | 1733 | sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ |
Martin v. Löwis | 0347a9a | 2006-10-27 07:06:52 +0000 | [diff] [blame] | 1734 | sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ |
Christian Heimes | ffa7011 | 2017-09-05 17:08:45 +0200 | [diff] [blame] | 1735 | bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1736 | AC_HEADER_DIRENT |
Martin v. Löwis | dbe3f76 | 2002-10-10 14:27:30 +0000 | [diff] [blame] | 1737 | AC_HEADER_MAJOR |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1738 | |
Martin v. Löwis | 11017b1 | 2006-01-14 18:12:57 +0000 | [diff] [blame] | 1739 | # On Linux, netlink.h requires asm/types.h |
| 1740 | AC_CHECK_HEADERS(linux/netlink.h,,,[ |
| 1741 | #ifdef HAVE_ASM_TYPES_H |
| 1742 | #include <asm/types.h> |
| 1743 | #endif |
| 1744 | #ifdef HAVE_SYS_SOCKET_H |
| 1745 | #include <sys/socket.h> |
| 1746 | #endif |
| 1747 | ]) |
| 1748 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1749 | # checks for typedefs |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1750 | was_it_defined=no |
| 1751 | AC_MSG_CHECKING(for clock_t in time.h) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 1752 | AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [ |
| 1753 | AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.]) |
| 1754 | ]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1755 | AC_MSG_RESULT($was_it_defined) |
| 1756 | |
Neal Norwitz | 1169011 | 2002-07-30 01:08:28 +0000 | [diff] [blame] | 1757 | # Check whether using makedev requires defining _OSF_SOURCE |
| 1758 | AC_MSG_CHECKING(for makedev) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1759 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Jesus Cea | 616de77 | 2010-04-28 10:32:30 +0000 | [diff] [blame] | 1760 | #if defined(MAJOR_IN_MKDEV) |
| 1761 | #include <sys/mkdev.h> |
| 1762 | #elif defined(MAJOR_IN_SYSMACROS) |
| 1763 | #include <sys/sysmacros.h> |
| 1764 | #else |
| 1765 | #include <sys/types.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1766 | #endif ]], [[ makedev(0, 0) ]])], |
| 1767 | [ac_cv_has_makedev=yes], |
| 1768 | [ac_cv_has_makedev=no]) |
Neal Norwitz | 1169011 | 2002-07-30 01:08:28 +0000 | [diff] [blame] | 1769 | if test "$ac_cv_has_makedev" = "no"; then |
| 1770 | # we didn't link, try if _OSF_SOURCE will allow us to link |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1771 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Neal Norwitz | 6eb37f0 | 2003-02-23 23:28:15 +0000 | [diff] [blame] | 1772 | #define _OSF_SOURCE 1 |
| 1773 | #include <sys/types.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1774 | ]], [[ makedev(0, 0) ]])], |
| 1775 | [ac_cv_has_makedev=yes], |
| 1776 | [ac_cv_has_makedev=no]) |
Neal Norwitz | 1169011 | 2002-07-30 01:08:28 +0000 | [diff] [blame] | 1777 | if test "$ac_cv_has_makedev" = "yes"; then |
| 1778 | AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.]) |
| 1779 | fi |
| 1780 | fi |
| 1781 | AC_MSG_RESULT($ac_cv_has_makedev) |
| 1782 | if test "$ac_cv_has_makedev" = "yes"; then |
| 1783 | AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.]) |
| 1784 | fi |
| 1785 | |
Martin v. Löwis | 399a689 | 2002-10-04 10:22:02 +0000 | [diff] [blame] | 1786 | # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in |
| 1787 | # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are |
| 1788 | # defined, but the compiler does not support pragma redefine_extname, |
| 1789 | # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit |
| 1790 | # structures (such as rlimit64) without declaring them. As a |
| 1791 | # work-around, disable LFS on such configurations |
| 1792 | |
| 1793 | use_lfs=yes |
| 1794 | AC_MSG_CHECKING(Solaris LFS bug) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1795 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | 399a689 | 2002-10-04 10:22:02 +0000 | [diff] [blame] | 1796 | #define _LARGEFILE_SOURCE 1 |
| 1797 | #define _FILE_OFFSET_BITS 64 |
| 1798 | #include <sys/resource.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1799 | ]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes]) |
Martin v. Löwis | 399a689 | 2002-10-04 10:22:02 +0000 | [diff] [blame] | 1800 | AC_MSG_RESULT($sol_lfs_bug) |
| 1801 | if test "$sol_lfs_bug" = "yes"; then |
| 1802 | use_lfs=no |
| 1803 | fi |
| 1804 | |
| 1805 | if test "$use_lfs" = "yes"; then |
Guido van Rossum | 810cc51 | 2001-09-09 23:51:39 +0000 | [diff] [blame] | 1806 | # Two defines needed to enable largefile support on various platforms |
| 1807 | # These may affect some typedefs |
Georg Brandl | 94800df | 2011-02-25 11:09:02 +0000 | [diff] [blame] | 1808 | case $ac_sys_system/$ac_sys_release in |
| 1809 | AIX*) |
| 1810 | AC_DEFINE(_LARGE_FILES, 1, |
| 1811 | [This must be defined on AIX systems to enable large file support.]) |
| 1812 | ;; |
| 1813 | esac |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 1814 | AC_DEFINE(_LARGEFILE_SOURCE, 1, |
| 1815 | [This must be defined on some systems to enable large file support.]) |
| 1816 | AC_DEFINE(_FILE_OFFSET_BITS, 64, |
| 1817 | [This must be set to 64 on some systems to enable large file support.]) |
Martin v. Löwis | 399a689 | 2002-10-04 10:22:02 +0000 | [diff] [blame] | 1818 | fi |
Guido van Rossum | 810cc51 | 2001-09-09 23:51:39 +0000 | [diff] [blame] | 1819 | |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 1820 | # Add some code to confdefs.h so that the test for off_t works on SCO |
| 1821 | cat >> confdefs.h <<\EOF |
| 1822 | #if defined(SCO_DS) |
| 1823 | #undef _OFF_T |
| 1824 | #endif |
| 1825 | EOF |
| 1826 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 1827 | # Type availability checks |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1828 | AC_TYPE_MODE_T |
| 1829 | AC_TYPE_OFF_T |
| 1830 | AC_TYPE_PID_T |
Matthias Klose | cbf54b1 | 2010-05-08 11:04:18 +0000 | [diff] [blame] | 1831 | AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void]) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1832 | AC_TYPE_SIZE_T |
| 1833 | AC_TYPE_UID_T |
Mark Dickinson | 17c50cd | 2012-12-02 13:13:56 +0000 | [diff] [blame] | 1834 | |
| 1835 | # There are two separate checks for each of the exact-width integer types we |
| 1836 | # need. First we check whether the type is available using the usual |
| 1837 | # AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h> |
| 1838 | # and <stdint.h> where available). We then also use the special type checks of |
| 1839 | # the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available |
| 1840 | # directly, #define's uint32_t to be a suitable type. |
| 1841 | |
| 1842 | AC_CHECK_TYPE(uint32_t, |
| 1843 | AC_DEFINE(HAVE_UINT32_T, 1, [Define if your compiler provides uint32_t.]),,) |
Mark Dickinson | efc82f7 | 2009-03-20 15:51:55 +0000 | [diff] [blame] | 1844 | AC_TYPE_UINT32_T |
Mark Dickinson | 17c50cd | 2012-12-02 13:13:56 +0000 | [diff] [blame] | 1845 | |
| 1846 | AC_CHECK_TYPE(uint64_t, |
| 1847 | AC_DEFINE(HAVE_UINT64_T, 1, [Define if your compiler provides uint64_t.]),,) |
Mark Dickinson | efc82f7 | 2009-03-20 15:51:55 +0000 | [diff] [blame] | 1848 | AC_TYPE_UINT64_T |
Mark Dickinson | 17c50cd | 2012-12-02 13:13:56 +0000 | [diff] [blame] | 1849 | |
| 1850 | AC_CHECK_TYPE(int32_t, |
| 1851 | AC_DEFINE(HAVE_INT32_T, 1, [Define if your compiler provides int32_t.]),,) |
Mark Dickinson | efc82f7 | 2009-03-20 15:51:55 +0000 | [diff] [blame] | 1852 | AC_TYPE_INT32_T |
Mark Dickinson | 17c50cd | 2012-12-02 13:13:56 +0000 | [diff] [blame] | 1853 | |
| 1854 | AC_CHECK_TYPE(int64_t, |
| 1855 | AC_DEFINE(HAVE_INT64_T, 1, [Define if your compiler provides int64_t.]),,) |
Mark Dickinson | efc82f7 | 2009-03-20 15:51:55 +0000 | [diff] [blame] | 1856 | AC_TYPE_INT64_T |
Mark Dickinson | 17c50cd | 2012-12-02 13:13:56 +0000 | [diff] [blame] | 1857 | |
Christian Heimes | 951cc0f | 2008-01-31 23:08:23 +0000 | [diff] [blame] | 1858 | AC_CHECK_TYPE(ssize_t, |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 1859 | AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1860 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 1861 | # Sizes of various common basic types |
Skip Montanaro | b9820a3 | 2004-01-17 00:16:12 +0000 | [diff] [blame] | 1862 | # ANSI C requires sizeof(char) == 1, so no need to check it |
Guido van Rossum | 3065c94 | 2001-09-17 04:03:14 +0000 | [diff] [blame] | 1863 | AC_CHECK_SIZEOF(int, 4) |
| 1864 | AC_CHECK_SIZEOF(long, 4) |
| 1865 | AC_CHECK_SIZEOF(void *, 4) |
Guido van Rossum | 3065c94 | 2001-09-17 04:03:14 +0000 | [diff] [blame] | 1866 | AC_CHECK_SIZEOF(short, 2) |
| 1867 | AC_CHECK_SIZEOF(float, 4) |
| 1868 | AC_CHECK_SIZEOF(double, 8) |
| 1869 | AC_CHECK_SIZEOF(fpos_t, 4) |
Martin v. Löwis | 18e1655 | 2006-02-15 17:27:45 +0000 | [diff] [blame] | 1870 | AC_CHECK_SIZEOF(size_t, 4) |
Christian Heimes | 951cc0f | 2008-01-31 23:08:23 +0000 | [diff] [blame] | 1871 | AC_CHECK_SIZEOF(pid_t, 4) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 1872 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1873 | AC_MSG_CHECKING(for long long support) |
| 1874 | have_long_long=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1875 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[ |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 1876 | AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.]) |
| 1877 | have_long_long=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1878 | ],[]) |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1879 | AC_MSG_RESULT($have_long_long) |
Guido van Rossum | 8bc1dfd | 1999-04-10 16:01:48 +0000 | [diff] [blame] | 1880 | if test "$have_long_long" = yes ; then |
Guido van Rossum | 3065c94 | 2001-09-17 04:03:14 +0000 | [diff] [blame] | 1881 | AC_CHECK_SIZEOF(long long, 8) |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1882 | fi |
| 1883 | |
Travis E. Oliphant | 711c9e9 | 2008-06-06 22:33:21 +0000 | [diff] [blame] | 1884 | AC_MSG_CHECKING(for long double support) |
| 1885 | have_long_double=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1886 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[ |
Travis E. Oliphant | 711c9e9 | 2008-06-06 22:33:21 +0000 | [diff] [blame] | 1887 | AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.]) |
| 1888 | have_long_double=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1889 | ],[]) |
Travis E. Oliphant | 711c9e9 | 2008-06-06 22:33:21 +0000 | [diff] [blame] | 1890 | AC_MSG_RESULT($have_long_double) |
Mark Dickinson | dc1688a | 2008-06-27 22:20:14 +0000 | [diff] [blame] | 1891 | if test "$have_long_double" = yes ; then |
Travis E. Oliphant | 711c9e9 | 2008-06-06 22:33:21 +0000 | [diff] [blame] | 1892 | AC_CHECK_SIZEOF(long double, 12) |
| 1893 | fi |
| 1894 | |
Martin v. Löwis | aef4c6b | 2007-01-21 09:33:07 +0000 | [diff] [blame] | 1895 | AC_MSG_CHECKING(for _Bool support) |
| 1896 | have_c99_bool=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1897 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Bool x; x = (_Bool)0;]])],[ |
Martin v. Löwis | aef4c6b | 2007-01-21 09:33:07 +0000 | [diff] [blame] | 1898 | AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.]) |
| 1899 | have_c99_bool=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1900 | ],[]) |
Martin v. Löwis | aef4c6b | 2007-01-21 09:33:07 +0000 | [diff] [blame] | 1901 | AC_MSG_RESULT($have_c99_bool) |
| 1902 | if test "$have_c99_bool" = yes ; then |
| 1903 | AC_CHECK_SIZEOF(_Bool, 1) |
| 1904 | fi |
| 1905 | |
Martin v. Löwis | ebe2670 | 2006-10-02 14:55:51 +0000 | [diff] [blame] | 1906 | AC_CHECK_TYPES(uintptr_t, |
| 1907 | [AC_CHECK_SIZEOF(uintptr_t, 4)], |
Martin v. Löwis | 40e9aed | 2006-10-02 15:20:37 +0000 | [diff] [blame] | 1908 | [], [#ifdef HAVE_STDINT_H |
| 1909 | #include <stdint.h> |
Antoine Pitrou | 7be5a65 | 2010-10-10 08:14:41 +0000 | [diff] [blame] | 1910 | #endif |
| 1911 | #ifdef HAVE_INTTYPES_H |
| 1912 | #include <inttypes.h> |
Martin v. Löwis | 40e9aed | 2006-10-02 15:20:37 +0000 | [diff] [blame] | 1913 | #endif]) |
Martin v. Löwis | ebe2670 | 2006-10-02 14:55:51 +0000 | [diff] [blame] | 1914 | |
Alexandre Vassalotti | 856782e | 2009-07-17 04:59:05 +0000 | [diff] [blame] | 1915 | AC_CHECK_SIZEOF(off_t, [], [ |
| 1916 | #ifdef HAVE_SYS_TYPES_H |
| 1917 | #include <sys/types.h> |
| 1918 | #endif |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1919 | ]) |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1920 | |
| 1921 | AC_MSG_CHECKING(whether to enable large file support) |
Mark Dickinson | 0ef0b91 | 2009-12-31 21:11:48 +0000 | [diff] [blame] | 1922 | if test "$have_long_long" = yes |
| 1923 | then |
| 1924 | if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \ |
Guido van Rossum | 8bc1dfd | 1999-04-10 16:01:48 +0000 | [diff] [blame] | 1925 | "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 1926 | AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1, |
| 1927 | [Defined to enable large file support when an off_t is bigger than a long |
| 1928 | and long long is available and at least as big as an off_t. You may need |
| 1929 | to add some flags for configuration and compilation to enable this mode. |
| 1930 | (For Solaris and Linux, the necessary defines are already defined.)]) |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1931 | AC_MSG_RESULT(yes) |
| 1932 | else |
| 1933 | AC_MSG_RESULT(no) |
| 1934 | fi |
Mark Dickinson | 0ef0b91 | 2009-12-31 21:11:48 +0000 | [diff] [blame] | 1935 | else |
| 1936 | AC_MSG_RESULT(no) |
| 1937 | fi |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1938 | |
Alexandre Vassalotti | 856782e | 2009-07-17 04:59:05 +0000 | [diff] [blame] | 1939 | AC_CHECK_SIZEOF(time_t, [], [ |
| 1940 | #ifdef HAVE_SYS_TYPES_H |
| 1941 | #include <sys/types.h> |
| 1942 | #endif |
| 1943 | #ifdef HAVE_TIME_H |
| 1944 | #include <time.h> |
| 1945 | #endif |
Fred Drake | a3f6e91 | 2000-06-29 20:44:47 +0000 | [diff] [blame] | 1946 | ]) |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1947 | |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1948 | # if have pthread_t then define SIZEOF_PTHREAD_T |
Martin v. Löwis | 123cbd2 | 2001-07-19 14:21:10 +0000 | [diff] [blame] | 1949 | ac_save_cc="$CC" |
| 1950 | if test "$ac_cv_kpthread" = "yes" |
| 1951 | then CC="$CC -Kpthread" |
Martin v. Löwis | 5f433f0 | 2003-05-05 05:05:30 +0000 | [diff] [blame] | 1952 | elif test "$ac_cv_kthread" = "yes" |
| 1953 | then CC="$CC -Kthread" |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 1954 | elif test "$ac_cv_pthread" = "yes" |
| 1955 | then CC="$CC -pthread" |
Martin v. Löwis | 123cbd2 | 2001-07-19 14:21:10 +0000 | [diff] [blame] | 1956 | fi |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1957 | AC_MSG_CHECKING(for pthread_t) |
| 1958 | have_pthread_t=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1959 | AC_COMPILE_IFELSE([ |
| 1960 | AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]]) |
| 1961 | ],[have_pthread_t=yes],[]) |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1962 | AC_MSG_RESULT($have_pthread_t) |
| 1963 | if test "$have_pthread_t" = yes ; then |
Alexandre Vassalotti | 856782e | 2009-07-17 04:59:05 +0000 | [diff] [blame] | 1964 | AC_CHECK_SIZEOF(pthread_t, [], [ |
| 1965 | #ifdef HAVE_PTHREAD_H |
| 1966 | #include <pthread.h> |
| 1967 | #endif |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1968 | ]) |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1969 | fi |
Martin v. Löwis | 123cbd2 | 2001-07-19 14:21:10 +0000 | [diff] [blame] | 1970 | CC="$ac_save_cc" |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1971 | |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 1972 | AC_MSG_CHECKING(for --enable-toolbox-glue) |
| 1973 | AC_ARG_ENABLE(toolbox-glue, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 1974 | AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions])) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 1975 | |
| 1976 | if test -z "$enable_toolbox_glue" |
| 1977 | then |
| 1978 | case $ac_sys_system/$ac_sys_release in |
| 1979 | Darwin/*) |
| 1980 | enable_toolbox_glue="yes";; |
| 1981 | *) |
| 1982 | enable_toolbox_glue="no";; |
| 1983 | esac |
| 1984 | fi |
| 1985 | case "$enable_toolbox_glue" in |
| 1986 | yes) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 1987 | extra_machdep_objs="Python/mactoolboxglue.o" |
Raymond Hettinger | ec6eb36 | 2004-11-05 07:02:59 +0000 | [diff] [blame] | 1988 | extra_undefs="-u _PyMac_Error" |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 1989 | AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1, |
| 1990 | [Define if you want to use MacPython modules on MacOSX in unix-Python.]) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 1991 | ;; |
| 1992 | *) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 1993 | extra_machdep_objs="" |
Jack Jansen | 591cbed | 2001-08-15 13:55:15 +0000 | [diff] [blame] | 1994 | extra_undefs="" |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 1995 | ;; |
| 1996 | esac |
| 1997 | AC_MSG_RESULT($enable_toolbox_glue) |
| 1998 | |
Ronald Oussoren | 0d236eb | 2008-06-06 21:31:33 +0000 | [diff] [blame] | 1999 | |
Bob Ippolito | 7026a0a | 2005-03-28 23:23:47 +0000 | [diff] [blame] | 2000 | AC_SUBST(OTHER_LIBTOOL_OPT) |
| 2001 | case $ac_sys_system/$ac_sys_release in |
Anthony Baxter | 8220174 | 2006-04-09 15:07:40 +0000 | [diff] [blame] | 2002 | Darwin/@<:@01567@:>@\..*) |
Bob Ippolito | 7026a0a | 2005-03-28 23:23:47 +0000 | [diff] [blame] | 2003 | OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000" |
| 2004 | ;; |
| 2005 | Darwin/*) |
| 2006 | OTHER_LIBTOOL_OPT="" |
| 2007 | ;; |
| 2008 | esac |
| 2009 | |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 2010 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2011 | AC_SUBST(LIBTOOL_CRUFT) |
| 2012 | case $ac_sys_system/$ac_sys_release in |
Anthony Baxter | 8220174 | 2006-04-09 15:07:40 +0000 | [diff] [blame] | 2013 | Darwin/@<:@01567@:>@\..*) |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 2014 | LIBTOOL_CRUFT="-framework System -lcc_dynamic" |
| 2015 | if test "${enable_universalsdk}"; then |
| 2016 | : |
| 2017 | else |
Ronald Oussoren | bc0e83c | 2010-02-11 13:26:54 +0000 | [diff] [blame] | 2018 | LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`" |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 2019 | fi |
Jack Jansen | b36687a | 2004-07-16 08:43:47 +0000 | [diff] [blame] | 2020 | LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Jack Jansen | a3891ea | 2001-09-07 14:25:12 +0000 | [diff] [blame] | 2021 | LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 2022 | Darwin/*) |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 2023 | gcc_version=`gcc -dumpversion` |
Bob Ippolito | 7026a0a | 2005-03-28 23:23:47 +0000 | [diff] [blame] | 2024 | if test ${gcc_version} '<' 4.0 |
| 2025 | then |
| 2026 | LIBTOOL_CRUFT="-lcc_dynamic" |
| 2027 | else |
| 2028 | LIBTOOL_CRUFT="" |
| 2029 | fi |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2030 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 2031 | #include <unistd.h> |
| 2032 | int main(int argc, char*argv[]) |
| 2033 | { |
| 2034 | if (sizeof(long) == 4) { |
| 2035 | return 0; |
| 2036 | } else { |
| 2037 | return 1; |
| 2038 | } |
Ronald Oussoren | 84ddd72 | 2009-09-08 07:17:10 +0000 | [diff] [blame] | 2039 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2040 | ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes]) |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 2041 | |
| 2042 | if test "${ac_osx_32bit}" = "yes"; then |
Ronald Oussoren | bc0e83c | 2010-02-11 13:26:54 +0000 | [diff] [blame] | 2043 | case `/usr/bin/arch` in |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 2044 | i386) |
| 2045 | MACOSX_DEFAULT_ARCH="i386" |
| 2046 | ;; |
| 2047 | ppc) |
| 2048 | MACOSX_DEFAULT_ARCH="ppc" |
| 2049 | ;; |
| 2050 | *) |
| 2051 | AC_MSG_ERROR([Unexpected output of 'arch' on OSX]) |
| 2052 | ;; |
| 2053 | esac |
| 2054 | else |
Ronald Oussoren | bc0e83c | 2010-02-11 13:26:54 +0000 | [diff] [blame] | 2055 | case `/usr/bin/arch` in |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 2056 | i386) |
| 2057 | MACOSX_DEFAULT_ARCH="x86_64" |
| 2058 | ;; |
| 2059 | ppc) |
| 2060 | MACOSX_DEFAULT_ARCH="ppc64" |
| 2061 | ;; |
| 2062 | *) |
| 2063 | AC_MSG_ERROR([Unexpected output of 'arch' on OSX]) |
| 2064 | ;; |
| 2065 | esac |
| 2066 | |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 2067 | fi |
| 2068 | |
| 2069 | LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}" |
Jack Jansen | b36687a | 2004-07-16 08:43:47 +0000 | [diff] [blame] | 2070 | LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2071 | LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2072 | esac |
| 2073 | |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2074 | AC_MSG_CHECKING(for --enable-framework) |
| 2075 | if test "$enable_framework" |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2076 | then |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 2077 | BASECFLAGS="$BASECFLAGS -fno-common -dynamic" |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2078 | # -F. is needed to allow linking to the framework while |
| 2079 | # in the build location. |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2080 | AC_DEFINE(WITH_NEXT_FRAMEWORK, 1, |
| 2081 | [Define if you want to produce an OpenStep/Rhapsody framework |
| 2082 | (shared library plus accessory files).]) |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2083 | AC_MSG_RESULT(yes) |
Ronald Oussoren | 450d561 | 2009-06-08 21:12:41 +0000 | [diff] [blame] | 2084 | if test $enable_shared = "yes" |
| 2085 | then |
Ronald Oussoren | 9ebd242 | 2009-09-29 13:00:44 +0000 | [diff] [blame] | 2086 | AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.]) |
Ronald Oussoren | 450d561 | 2009-06-08 21:12:41 +0000 | [diff] [blame] | 2087 | fi |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2088 | else |
| 2089 | AC_MSG_RESULT(no) |
| 2090 | fi |
| 2091 | |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2092 | AC_MSG_CHECKING(for dyld) |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 2093 | case $ac_sys_system/$ac_sys_release in |
| 2094 | Darwin/*) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2095 | AC_DEFINE(WITH_DYLD, 1, |
| 2096 | [Define if you want to use the new-style (Openstep, Rhapsody, MacOS) |
| 2097 | dynamic linker (dyld) instead of the old-style (NextStep) dynamic |
| 2098 | linker (rld). Dyld is necessary to support frameworks.]) |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 2099 | AC_MSG_RESULT(always on for Darwin) |
| 2100 | ;; |
| 2101 | *) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2102 | AC_MSG_RESULT(no) |
| 2103 | ;; |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 2104 | esac |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2105 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2106 | # Set info about shared libraries. |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2107 | AC_SUBST(SO) |
| 2108 | AC_SUBST(LDSHARED) |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2109 | AC_SUBST(LDCXXSHARED) |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2110 | AC_SUBST(BLDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2111 | AC_SUBST(CCSHARED) |
| 2112 | AC_SUBST(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2113 | # SO is the extension of shared libraries `(including the dot!) |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 2114 | # -- usually .so, .sl on HP-UX, .dll on Cygwin |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2115 | AC_MSG_CHECKING(SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2116 | if test -z "$SO" |
| 2117 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2118 | case $ac_sys_system in |
Neal Norwitz | 58e2888 | 2006-05-19 07:00:58 +0000 | [diff] [blame] | 2119 | hp*|HP*) |
| 2120 | case `uname -m` in |
| 2121 | ia64) SO=.so;; |
| 2122 | *) SO=.sl;; |
| 2123 | esac |
| 2124 | ;; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 2125 | CYGWIN*) SO=.dll;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 2126 | *) SO=.so;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2127 | esac |
Martin v. Löwis | 368de8f | 2003-06-14 14:46:38 +0000 | [diff] [blame] | 2128 | else |
| 2129 | # this might also be a termcap variable, see #610332 |
| 2130 | echo |
| 2131 | echo '=====================================================================' |
| 2132 | echo '+ +' |
| 2133 | echo '+ WARNING: You have set SO in your environment. +' |
| 2134 | echo '+ Do you really mean to change the extension for shared libraries? +' |
| 2135 | echo '+ Continuing in 10 seconds to let you to ponder. +' |
| 2136 | echo '+ +' |
| 2137 | echo '=====================================================================' |
| 2138 | sleep 10 |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2139 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2140 | AC_MSG_RESULT($SO) |
Ronald Oussoren | 79f9049 | 2009-01-02 10:44:46 +0000 | [diff] [blame] | 2141 | |
Neal Norwitz | 58e2888 | 2006-05-19 07:00:58 +0000 | [diff] [blame] | 2142 | AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).]) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2143 | # LDSHARED is the ld *command* used to create shared library |
Skip Montanaro | ce59c04 | 2004-01-17 14:19:44 +0000 | [diff] [blame] | 2144 | # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2145 | # (Shared libraries in this instance are shared modules to be loaded into |
| 2146 | # Python, as opposed to building Python itself as a shared library.) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2147 | AC_MSG_CHECKING(LDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2148 | if test -z "$LDSHARED" |
| 2149 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2150 | case $ac_sys_system/$ac_sys_release in |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2151 | AIX*) |
Martin Panter | f75a2eb | 2016-11-20 09:31:41 +0000 | [diff] [blame] | 2152 | BLDSHARED="Modules/ld_so_aix \$(CC) -bI:Modules/python.exp" |
Guido van Rossum | ce608b0 | 2001-09-28 15:59:38 +0000 | [diff] [blame] | 2153 | LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp" |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2154 | ;; |
| 2155 | BeOS*) |
| 2156 | BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY" |
Guido van Rossum | ce608b0 | 2001-09-28 15:59:38 +0000 | [diff] [blame] | 2157 | LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY" |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2158 | ;; |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 2159 | IRIX/5*) LDSHARED="ld -shared";; |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 2160 | IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";; |
Greg Ward | 57c9a66 | 2000-05-26 12:22:54 +0000 | [diff] [blame] | 2161 | SunOS/5*) |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2162 | if test "$GCC" = "yes" ; then |
| 2163 | LDSHARED='$(CC) -shared' |
| 2164 | LDCXXSHARED='$(CXX) -shared' |
| 2165 | else |
| 2166 | LDSHARED='$(CC) -G' |
| 2167 | LDCXXSHARED='$(CXX) -G' |
Greg Ward | 57c9a66 | 2000-05-26 12:22:54 +0000 | [diff] [blame] | 2168 | fi ;; |
Thomas Heller | dc96a77 | 2008-04-04 10:07:55 +0000 | [diff] [blame] | 2169 | hp*|HP*) |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2170 | if test "$GCC" = "yes" ; then |
| 2171 | LDSHARED='$(CC) -shared' |
| 2172 | LDCXXSHARED='$(CXX) -shared' |
| 2173 | else |
| 2174 | LDSHARED='ld -b' |
Thomas Heller | dc96a77 | 2008-04-04 10:07:55 +0000 | [diff] [blame] | 2175 | fi ;; |
Guido van Rossum | 71001e4 | 1995-01-26 00:44:03 +0000 | [diff] [blame] | 2176 | OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; |
Jack Jansen | 418c3b1 | 2001-11-14 10:59:57 +0000 | [diff] [blame] | 2177 | Darwin/1.3*) |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2178 | LDSHARED='$(CC) -bundle' |
| 2179 | LDCXXSHARED='$(CXX) -bundle' |
Jack Jansen | a3891ea | 2001-09-07 14:25:12 +0000 | [diff] [blame] | 2180 | if test "$enable_framework" ; then |
| 2181 | # Link against the framework. All externals should be defined. |
Jack Jansen | da49e19 | 2005-01-07 13:08:22 +0000 | [diff] [blame] | 2182 | BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
| 2183 | LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2184 | LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Jack Jansen | a3891ea | 2001-09-07 14:25:12 +0000 | [diff] [blame] | 2185 | else |
| 2186 | # No framework. Ignore undefined symbols, assuming they come from Python |
Jack Jansen | 418c3b1 | 2001-11-14 10:59:57 +0000 | [diff] [blame] | 2187 | LDSHARED="$LDSHARED -undefined suppress" |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2188 | LDCXXSHARED="$LDCXXSHARED -undefined suppress" |
Jack Jansen | a3891ea | 2001-09-07 14:25:12 +0000 | [diff] [blame] | 2189 | fi ;; |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2190 | Darwin/1.4*|Darwin/5.*|Darwin/6.*) |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2191 | LDSHARED='$(CC) -bundle' |
| 2192 | LDCXXSHARED='$(CXX) -bundle' |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2193 | if test "$enable_framework" ; then |
| 2194 | # Link against the framework. All externals should be defined. |
Jack Jansen | da49e19 | 2005-01-07 13:08:22 +0000 | [diff] [blame] | 2195 | BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
| 2196 | LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2197 | LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2198 | else |
Michael W. Hudson | 0c46c0c | 2002-03-07 09:58:56 +0000 | [diff] [blame] | 2199 | # No framework, use the Python app as bundle-loader |
| 2200 | BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' |
Jack Jansen | c28fc37 | 2003-02-25 13:14:43 +0000 | [diff] [blame] | 2201 | LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2202 | LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2203 | fi ;; |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2204 | Darwin/*) |
| 2205 | # Use -undefined dynamic_lookup whenever possible (10.3 and later). |
| 2206 | # This allows an extension to be used in any Python |
Ronald Oussoren | 38f1b98 | 2007-09-02 09:46:07 +0000 | [diff] [blame] | 2207 | |
Ned Deily | c40b903 | 2014-06-25 13:48:46 -0700 | [diff] [blame] | 2208 | dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ |
| 2209 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` |
| 2210 | dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ |
| 2211 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` |
| 2212 | if test ${dep_target_major} -eq 10 && \ |
| 2213 | test ${dep_target_minor} -le 2 |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2214 | then |
Ned Deily | c40b903 | 2014-06-25 13:48:46 -0700 | [diff] [blame] | 2215 | # building for OS X 10.0 through 10.2 |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2216 | LDSHARED='$(CC) -bundle' |
| 2217 | LDCXXSHARED='$(CXX) -bundle' |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2218 | if test "$enable_framework" ; then |
| 2219 | # Link against the framework. All externals should be defined. |
Jack Jansen | da49e19 | 2005-01-07 13:08:22 +0000 | [diff] [blame] | 2220 | BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
| 2221 | LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2222 | LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2223 | else |
| 2224 | # No framework, use the Python app as bundle-loader |
| 2225 | BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' |
| 2226 | LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2227 | LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2228 | fi |
Ned Deily | c40b903 | 2014-06-25 13:48:46 -0700 | [diff] [blame] | 2229 | else |
| 2230 | # building for OS X 10.3 and later |
Ned Deily | c40b903 | 2014-06-25 13:48:46 -0700 | [diff] [blame] | 2231 | LDSHARED='$(CC) -bundle -undefined dynamic_lookup' |
| 2232 | LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' |
| 2233 | BLDSHARED="$LDSHARED" |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2234 | fi |
| 2235 | ;; |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2236 | Linux*|GNU*|QNX*) |
| 2237 | LDSHARED='$(CC) -shared' |
| 2238 | LDCXXSHARED='$(CXX) -shared';; |
| 2239 | BSD/OS*/4*) |
| 2240 | LDSHARED="gcc -shared" |
| 2241 | LDCXXSHARED="g++ -shared";; |
Martin v. Löwis | 222c515 | 2006-06-03 07:37:13 +0000 | [diff] [blame] | 2242 | FreeBSD*) |
Jeremy Hylton | 4bcc7c5 | 2000-08-31 17:45:35 +0000 | [diff] [blame] | 2243 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 2244 | then |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2245 | LDSHARED='$(CC) -shared' |
| 2246 | LDCXXSHARED='$(CXX) -shared' |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 2247 | else |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2248 | LDSHARED="ld -Bshareable" |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 2249 | fi;; |
Martin v. Löwis | 222c515 | 2006-06-03 07:37:13 +0000 | [diff] [blame] | 2250 | OpenBSD*) |
| 2251 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
| 2252 | then |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2253 | LDSHARED='$(CC) -shared $(CCSHARED)' |
| 2254 | LDCXXSHARED='$(CXX) -shared $(CCSHARED)' |
Martin v. Löwis | 222c515 | 2006-06-03 07:37:13 +0000 | [diff] [blame] | 2255 | else |
| 2256 | case `uname -r` in |
| 2257 | [[01]].* | 2.[[0-7]] | 2.[[0-7]].*) |
| 2258 | LDSHARED="ld -Bshareable ${LDFLAGS}" |
| 2259 | ;; |
| 2260 | *) |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2261 | LDSHARED='$(CC) -shared $(CCSHARED)' |
| 2262 | LDCXXSHARED='$(CXX) -shared $(CCSHARED)' |
Martin v. Löwis | 222c515 | 2006-06-03 07:37:13 +0000 | [diff] [blame] | 2263 | ;; |
| 2264 | esac |
| 2265 | fi;; |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2266 | NetBSD*|DragonFly*) |
Antoine Pitrou | cb40277 | 2011-01-02 20:51:34 +0000 | [diff] [blame] | 2267 | LDSHARED='$(CC) -shared' |
| 2268 | LDCXXSHARED='$(CXX) -shared';; |
Martin v. Löwis | 25ae43b | 2001-10-07 08:39:18 +0000 | [diff] [blame] | 2269 | OpenUNIX*|UnixWare*) |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2270 | if test "$GCC" = "yes" ; then |
| 2271 | LDSHARED='$(CC) -shared' |
| 2272 | LDCXXSHARED='$(CXX) -shared' |
| 2273 | else |
| 2274 | LDSHARED='$(CC) -G' |
| 2275 | LDCXXSHARED='$(CXX) -G' |
Martin v. Löwis | bec1958 | 2001-03-21 15:57:54 +0000 | [diff] [blame] | 2276 | fi;; |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2277 | SCO_SV*) |
| 2278 | LDSHARED='$(CC) -Wl,-G,-Bexport' |
| 2279 | LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';; |
| 2280 | CYGWIN*) |
| 2281 | LDSHARED="gcc -shared -Wl,--enable-auto-image-base" |
| 2282 | LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";; |
| 2283 | atheos*) |
| 2284 | LDSHARED="gcc -shared" |
| 2285 | LDCXXSHARED="g++ -shared";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2286 | *) LDSHARED="ld";; |
| 2287 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2288 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2289 | AC_MSG_RESULT($LDSHARED) |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2290 | LDCXXSHARED=${LDCXXSHARED-$LDSHARED} |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2291 | BLDSHARED=${BLDSHARED-$LDSHARED} |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2292 | # CCSHARED are the C *flags* used to create objects to go into a shared |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2293 | # library (module) -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2294 | AC_MSG_CHECKING(CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2295 | if test -z "$CCSHARED" |
| 2296 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 2297 | case $ac_sys_system/$ac_sys_release in |
Neil Schemenauer | 6625216 | 2001-02-19 04:47:42 +0000 | [diff] [blame] | 2298 | SunOS*) if test "$GCC" = yes; |
Martin v. Löwis | eb62357 | 2007-03-12 10:50:39 +0000 | [diff] [blame] | 2299 | then CCSHARED="-fPIC"; |
| 2300 | elif test `uname -p` = sparc; |
| 2301 | then CCSHARED="-xcode=pic32"; |
| 2302 | else CCSHARED="-Kpic"; |
| 2303 | fi;; |
Guido van Rossum | af07a44 | 1995-02-13 19:45:27 +0000 | [diff] [blame] | 2304 | hp*|HP*) if test "$GCC" = yes; |
Martin v. Löwis | 703ad70 | 2001-09-05 08:36:52 +0000 | [diff] [blame] | 2305 | then CCSHARED="-fPIC"; |
Guido van Rossum | af07a44 | 1995-02-13 19:45:27 +0000 | [diff] [blame] | 2306 | else CCSHARED="+z"; |
| 2307 | fi;; |
Martin v. Löwis | a6e9758 | 2002-01-01 18:41:33 +0000 | [diff] [blame] | 2308 | Linux*|GNU*) CCSHARED="-fPIC";; |
Guido van Rossum | f5957ea | 1999-10-05 21:59:33 +0000 | [diff] [blame] | 2309 | BSD/OS*/4*) CCSHARED="-fpic";; |
Martin v. Löwis | 86d6626 | 2006-02-17 08:40:11 +0000 | [diff] [blame] | 2310 | FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; |
Martin v. Löwis | 25ae43b | 2001-10-07 08:39:18 +0000 | [diff] [blame] | 2311 | OpenUNIX*|UnixWare*) |
Martin v. Löwis | bec1958 | 2001-03-21 15:57:54 +0000 | [diff] [blame] | 2312 | if test "$GCC" = "yes" |
| 2313 | then CCSHARED="-fPIC" |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2314 | else CCSHARED="-KPIC" |
Martin v. Löwis | bec1958 | 2001-03-21 15:57:54 +0000 | [diff] [blame] | 2315 | fi;; |
Martin v. Löwis | 21ee409 | 2002-09-30 16:19:48 +0000 | [diff] [blame] | 2316 | SCO_SV*) |
| 2317 | if test "$GCC" = "yes" |
| 2318 | then CCSHARED="-fPIC" |
| 2319 | else CCSHARED="-Kpic -belf" |
| 2320 | fi;; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 2321 | IRIX*/6*) case $CC in |
| 2322 | *gcc*) CCSHARED="-shared";; |
Guido van Rossum | ee21f41 | 1998-04-20 18:51:54 +0000 | [diff] [blame] | 2323 | *) CCSHARED="";; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 2324 | esac;; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2325 | atheos*) CCSHARED="-fPIC";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2326 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2327 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2328 | AC_MSG_RESULT($CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2329 | # LINKFORSHARED are the flags passed to the $(CC) command that links |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 2330 | # the python executable -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2331 | AC_MSG_CHECKING(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2332 | if test -z "$LINKFORSHARED" |
| 2333 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 2334 | case $ac_sys_system/$ac_sys_release in |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2335 | AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';; |
Guido van Rossum | 5dab3d8 | 1996-12-06 21:18:18 +0000 | [diff] [blame] | 2336 | hp*|HP*) |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 2337 | LINKFORSHARED="-Wl,-E -Wl,+s";; |
| 2338 | # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; |
Guido van Rossum | f5957ea | 1999-10-05 21:59:33 +0000 | [diff] [blame] | 2339 | BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Martin v. Löwis | a6e9758 | 2002-01-01 18:41:33 +0000 | [diff] [blame] | 2340 | Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2341 | # -u libsys_s pulls in all symbols in libsys |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2342 | Darwin/*) |
Raymond Hettinger | ec6eb36 | 2004-11-05 07:02:59 +0000 | [diff] [blame] | 2343 | # -u _PyMac_Error is needed to pull in the mac toolbox glue, |
| 2344 | # which is |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2345 | # not used by the core itself but which needs to be in the core so |
| 2346 | # that dynamically loaded extension modules have access to it. |
Jack Jansen | 97e3f00 | 2003-02-23 22:59:01 +0000 | [diff] [blame] | 2347 | # -prebind is no longer used, because it actually seems to give a |
| 2348 | # slowdown in stead of a speedup, maybe due to the large number of |
| 2349 | # dynamic loads Python does. |
Raymond Hettinger | ec6eb36 | 2004-11-05 07:02:59 +0000 | [diff] [blame] | 2350 | |
| 2351 | LINKFORSHARED="$extra_undefs" |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2352 | if test "$enable_framework" |
| 2353 | then |
Jack Jansen | da49e19 | 2005-01-07 13:08:22 +0000 | [diff] [blame] | 2354 | LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2355 | fi |
Raymond Hettinger | ec6eb36 | 2004-11-05 07:02:59 +0000 | [diff] [blame] | 2356 | LINKFORSHARED="$LINKFORSHARED";; |
Martin v. Löwis | 25ae43b | 2001-10-07 08:39:18 +0000 | [diff] [blame] | 2357 | OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";; |
Martin v. Löwis | 21ee409 | 2002-09-30 16:19:48 +0000 | [diff] [blame] | 2358 | SCO_SV*) LINKFORSHARED="-Wl,-Bexport";; |
Fred Drake | 02706f5 | 2000-09-25 15:08:46 +0000 | [diff] [blame] | 2359 | ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";; |
Martin v. Löwis | 86d6626 | 2006-02-17 08:40:11 +0000 | [diff] [blame] | 2360 | FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) |
Guido van Rossum | df69365 | 1999-01-07 21:50:41 +0000 | [diff] [blame] | 2361 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
| 2362 | then |
| 2363 | LINKFORSHARED="-Wl,--export-dynamic" |
| 2364 | fi;; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 2365 | SunOS/5*) case $CC in |
| 2366 | *gcc*) |
Martin v. Löwis | a454857 | 2002-04-18 14:51:36 +0000 | [diff] [blame] | 2367 | if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null |
Guido van Rossum | 8f4ceb1 | 1997-12-18 23:42:19 +0000 | [diff] [blame] | 2368 | then |
| 2369 | LINKFORSHARED="-Xlinker --export-dynamic" |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 2370 | fi;; |
| 2371 | esac;; |
Jason Tishler | 3076559 | 2003-09-04 11:04:06 +0000 | [diff] [blame] | 2372 | CYGWIN*) |
| 2373 | if test $enable_shared = "no" |
| 2374 | then |
| 2375 | LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)' |
| 2376 | fi;; |
Martin v. Löwis | 8c255e4 | 2008-05-23 15:06:50 +0000 | [diff] [blame] | 2377 | QNX*) |
| 2378 | # -Wl,-E causes the symbols to be added to the dynamic |
| 2379 | # symbol table so that they can be found when a module |
| 2380 | # is loaded. -N 2048K causes the stack size to be set |
| 2381 | # to 2048 kilobytes so that the stack doesn't overflow |
| 2382 | # when running test_compile.py. |
| 2383 | LINKFORSHARED='-Wl,-E -N 2048K';; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2384 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2385 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2386 | AC_MSG_RESULT($LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2387 | |
Ronald Oussoren | 0d236eb | 2008-06-06 21:31:33 +0000 | [diff] [blame] | 2388 | |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 2389 | AC_SUBST(CFLAGSFORSHARED) |
| 2390 | AC_MSG_CHECKING(CFLAGSFORSHARED) |
| 2391 | if test ! "$LIBRARY" = "$LDLIBRARY" |
| 2392 | then |
Neil Schemenauer | d9cf41c | 2001-01-27 21:39:17 +0000 | [diff] [blame] | 2393 | case $ac_sys_system in |
| 2394 | CYGWIN*) |
| 2395 | # Cygwin needs CCSHARED when building extension DLLs |
| 2396 | # but not when building the interpreter DLL. |
| 2397 | CFLAGSFORSHARED='';; |
| 2398 | *) |
| 2399 | CFLAGSFORSHARED='$(CCSHARED)' |
| 2400 | esac |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 2401 | fi |
| 2402 | AC_MSG_RESULT($CFLAGSFORSHARED) |
| 2403 | |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2404 | # SHLIBS are libraries (except -lc and -lm) to link to the python shared |
| 2405 | # library (with --enable-shared). |
| 2406 | # For platforms on which shared libraries are not allowed to have unresolved |
Martin v. Löwis | d6359c5 | 2002-08-04 12:38:50 +0000 | [diff] [blame] | 2407 | # symbols, this must be set to $(LIBS) (expanded by make). We do this even |
| 2408 | # if it is not required, since it creates a dependency of the shared library |
| 2409 | # to LIBS. This, in turn, means that applications linking the shared libpython |
| 2410 | # don't need to link LIBS explicitly. The default should be only changed |
| 2411 | # on systems where this approach causes problems. |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2412 | AC_SUBST(SHLIBS) |
| 2413 | AC_MSG_CHECKING(SHLIBS) |
| 2414 | case "$ac_sys_system" in |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2415 | *) |
Martin v. Löwis | d6359c5 | 2002-08-04 12:38:50 +0000 | [diff] [blame] | 2416 | SHLIBS='$(LIBS)';; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2417 | esac |
| 2418 | AC_MSG_RESULT($SHLIBS) |
| 2419 | |
| 2420 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 2421 | # checks for libraries |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2422 | AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV |
| 2423 | AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 2424 | |
Skip Montanaro | 4d756af | 2008-12-01 01:55:22 +0000 | [diff] [blame] | 2425 | # only check for sem_init if thread support is requested |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 2426 | if test "$with_threads" = "yes" -o -z "$with_threads"; then |
| 2427 | AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris |
| 2428 | # posix4 on Solaris 2.6 |
| 2429 | # pthread (first!) on Linux |
| 2430 | fi |
| 2431 | |
Martin v. Löwis | 19d1734 | 2003-06-14 21:03:05 +0000 | [diff] [blame] | 2432 | # check if we need libintl for locale functions |
| 2433 | AC_CHECK_LIB(intl, textdomain, |
| 2434 | AC_DEFINE(WITH_LIBINTL, 1, |
| 2435 | [Define to 1 if libintl is needed for locale functions.])) |
Guido van Rossum | 0eefa3f | 1999-11-16 15:57:37 +0000 | [diff] [blame] | 2436 | |
| 2437 | # checks for system dependent C++ extensions support |
| 2438 | case "$ac_sys_system" in |
| 2439 | AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2440 | AC_LINK_IFELSE([ |
Georg Brandl | 94800df | 2011-02-25 11:09:02 +0000 | [diff] [blame] | 2441 | AC_LANG_PROGRAM([[#include <load.h>]], |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2442 | [[loadAndInit("", 0, "")]]) |
| 2443 | ],[ |
| 2444 | AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1, |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2445 | [Define for AIX if your compiler is a genuine IBM xlC/xlC_r |
| 2446 | and you want support for AIX C++ shared extension modules.]) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2447 | AC_MSG_RESULT(yes) |
| 2448 | ],[ |
| 2449 | AC_MSG_RESULT(no) |
| 2450 | ]);; |
Guido van Rossum | 0eefa3f | 1999-11-16 15:57:37 +0000 | [diff] [blame] | 2451 | *) ;; |
| 2452 | esac |
| 2453 | |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 2454 | # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 2455 | # BeOS' sockets are stashed in libnet. |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 2456 | AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 2457 | AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets |
Skip Montanaro | b9949db | 2004-01-17 04:04:13 +0000 | [diff] [blame] | 2458 | |
Jeremy Hylton | cb25d5e | 2000-07-27 21:23:28 +0000 | [diff] [blame] | 2459 | case "$ac_sys_system" in |
| 2460 | BeOS*) |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 2461 | AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS |
| 2462 | ;; |
| 2463 | esac |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 2464 | |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 2465 | AC_MSG_CHECKING(for --with-libs) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2466 | AC_ARG_WITH(libs, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2467 | AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2468 | [ |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 2469 | AC_MSG_RESULT($withval) |
| 2470 | LIBS="$withval $LIBS" |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2471 | ], |
| 2472 | [AC_MSG_RESULT(no)]) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 2473 | |
Benjamin Peterson | 64e8f6e | 2014-12-15 00:00:23 -0500 | [diff] [blame] | 2474 | PKG_PROG_PKG_CONFIG |
Benjamin Peterson | e9e07bf | 2010-03-09 21:46:54 +0000 | [diff] [blame] | 2475 | |
Benjamin Peterson | 2c19674 | 2009-12-31 03:17:18 +0000 | [diff] [blame] | 2476 | # Check for use of the system expat library |
| 2477 | AC_MSG_CHECKING(for --with-system-expat) |
| 2478 | AC_ARG_WITH(system_expat, |
Benjamin Peterson | f2d1b2a | 2010-10-31 16:53:53 +0000 | [diff] [blame] | 2479 | AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]), |
| 2480 | [], |
| 2481 | [with_system_expat="no"]) |
Benjamin Peterson | 2c19674 | 2009-12-31 03:17:18 +0000 | [diff] [blame] | 2482 | |
| 2483 | AC_MSG_RESULT($with_system_expat) |
| 2484 | |
Martin v. Löwis | 9176fc1 | 2006-04-11 11:12:43 +0000 | [diff] [blame] | 2485 | # Check for use of the system libffi library |
| 2486 | AC_MSG_CHECKING(for --with-system-ffi) |
| 2487 | AC_ARG_WITH(system_ffi, |
Benjamin Peterson | f2d1b2a | 2010-10-31 16:53:53 +0000 | [diff] [blame] | 2488 | AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]), |
| 2489 | [], |
| 2490 | [with_system_ffi="no"]) |
Martin v. Löwis | 9176fc1 | 2006-04-11 11:12:43 +0000 | [diff] [blame] | 2491 | |
Benjamin Peterson | e9e07bf | 2010-03-09 21:46:54 +0000 | [diff] [blame] | 2492 | if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then |
Benjamin Peterson | 1c335e6 | 2010-01-01 15:16:29 +0000 | [diff] [blame] | 2493 | LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`" |
| 2494 | else |
| 2495 | LIBFFI_INCLUDEDIR="" |
| 2496 | fi |
| 2497 | AC_SUBST(LIBFFI_INCLUDEDIR) |
| 2498 | |
Martin v. Löwis | 9176fc1 | 2006-04-11 11:12:43 +0000 | [diff] [blame] | 2499 | AC_MSG_RESULT($with_system_ffi) |
| 2500 | |
Ned Deily | a2a9f57 | 2013-10-25 00:30:10 -0700 | [diff] [blame] | 2501 | # Check for --with-tcltk-includes=path and --with-tcltk-libs=path |
| 2502 | AC_SUBST(TCLTK_INCLUDES) |
| 2503 | AC_SUBST(TCLTK_LIBS) |
| 2504 | AC_MSG_CHECKING(for --with-tcltk-includes) |
| 2505 | AC_ARG_WITH(tcltk-includes, |
| 2506 | AS_HELP_STRING([--with-tcltk-includes='-I...'], [override search for Tcl and Tk include files]), |
| 2507 | [], |
| 2508 | [with_tcltk_includes="default"]) |
| 2509 | AC_MSG_RESULT($with_tcltk_includes) |
| 2510 | AC_MSG_CHECKING(for --with-tcltk-libs) |
| 2511 | AC_ARG_WITH(tcltk-libs, |
| 2512 | AS_HELP_STRING([--with-tcltk-libs='-L...'], [override search for Tcl and Tk libs]), |
| 2513 | [], |
| 2514 | [with_tcltk_libs="default"]) |
| 2515 | AC_MSG_RESULT($with_tcltk_libs) |
| 2516 | if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault |
| 2517 | then |
| 2518 | if test "x$with_tcltk_includes" != "x$with_tcltk_libs" |
| 2519 | then |
| 2520 | AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither]) |
| 2521 | fi |
| 2522 | TCLTK_INCLUDES="" |
| 2523 | TCLTK_LIBS="" |
| 2524 | else |
| 2525 | TCLTK_INCLUDES="$with_tcltk_includes" |
| 2526 | TCLTK_LIBS="$with_tcltk_libs" |
| 2527 | fi |
| 2528 | |
Matthias Klose | 10cbe48 | 2009-04-29 17:18:19 +0000 | [diff] [blame] | 2529 | # Check for --with-dbmliborder |
| 2530 | AC_MSG_CHECKING(for --with-dbmliborder) |
| 2531 | AC_ARG_WITH(dbmliborder, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2532 | AS_HELP_STRING([--with-dbmliborder=db1:db2:...], [order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]), |
Matthias Klose | 10cbe48 | 2009-04-29 17:18:19 +0000 | [diff] [blame] | 2533 | [ |
| 2534 | if test x$with_dbmliborder = xyes |
| 2535 | then |
| 2536 | AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...]) |
| 2537 | else |
| 2538 | for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do |
| 2539 | if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb |
| 2540 | then |
| 2541 | AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...]) |
| 2542 | fi |
| 2543 | done |
Matthias Klose | 61dbdb9 | 2009-04-29 20:09:50 +0000 | [diff] [blame] | 2544 | fi]) |
| 2545 | AC_MSG_RESULT($with_dbmliborder) |
Matthias Klose | 10cbe48 | 2009-04-29 17:18:19 +0000 | [diff] [blame] | 2546 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 2547 | # Determine if signalmodule should be used. |
| 2548 | AC_SUBST(USE_SIGNAL_MODULE) |
| 2549 | AC_SUBST(SIGNAL_OBJS) |
| 2550 | AC_MSG_CHECKING(for --with-signal-module) |
| 2551 | AC_ARG_WITH(signal-module, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2552 | AS_HELP_STRING([--with-signal-module], [disable/enable signal module])) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 2553 | |
| 2554 | if test -z "$with_signal_module" |
| 2555 | then with_signal_module="yes" |
| 2556 | fi |
| 2557 | AC_MSG_RESULT($with_signal_module) |
| 2558 | |
| 2559 | if test "${with_signal_module}" = "yes"; then |
| 2560 | USE_SIGNAL_MODULE="" |
| 2561 | SIGNAL_OBJS="" |
| 2562 | else |
| 2563 | USE_SIGNAL_MODULE="#" |
| 2564 | SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o" |
| 2565 | fi |
| 2566 | |
Guido van Rossum | 3d15bd8 | 2001-01-10 18:53:48 +0000 | [diff] [blame] | 2567 | # This is used to generate Setup.config |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 2568 | AC_SUBST(USE_THREAD_MODULE) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2569 | USE_THREAD_MODULE="" |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 2570 | |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2571 | AC_MSG_CHECKING(for --with-dec-threads) |
| 2572 | AC_SUBST(LDLAST) |
| 2573 | AC_ARG_WITH(dec-threads, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2574 | AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2575 | [ |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2576 | AC_MSG_RESULT($withval) |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2577 | LDLAST=-threads |
Guido van Rossum | f78abae | 1997-01-21 22:02:36 +0000 | [diff] [blame] | 2578 | if test "${with_thread+set}" != set; then |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2579 | with_thread="$withval"; |
| 2580 | fi], |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2581 | [AC_MSG_RESULT(no)]) |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2582 | |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 2583 | # Templates for things AC_DEFINEd more than once. |
| 2584 | # For a single AC_DEFINE, no template is needed. |
| 2585 | AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package]) |
| 2586 | AH_TEMPLATE(_REENTRANT, |
| 2587 | [Define to force use of thread-safe errno, h_errno, and other functions]) |
| 2588 | AH_TEMPLATE(WITH_THREAD, |
| 2589 | [Define if you want to compile in rudimentary thread support]) |
| 2590 | |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2591 | AC_MSG_CHECKING(for --with-threads) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2592 | dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2593 | AC_ARG_WITH(threads, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2594 | AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support])) |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2595 | |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2596 | # --with-thread is deprecated, but check for it anyway |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2597 | dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output |
Barry Warsaw | a0f3c5c | 2000-06-30 16:39:35 +0000 | [diff] [blame] | 2598 | AC_ARG_WITH(thread, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2599 | AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2600 | [with_threads=$with_thread]) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2601 | |
| 2602 | if test -z "$with_threads" |
| 2603 | then with_threads="yes" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 2604 | fi |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2605 | AC_MSG_RESULT($with_threads) |
Guido van Rossum | 6400c26 | 1997-05-22 20:34:27 +0000 | [diff] [blame] | 2606 | |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2607 | AC_SUBST(THREADOBJ) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2608 | if test "$with_threads" = "no" |
| 2609 | then |
| 2610 | USE_THREAD_MODULE="#" |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2611 | elif test "$ac_cv_pthread_is_default" = yes |
| 2612 | then |
| 2613 | AC_DEFINE(WITH_THREAD) |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2614 | # Defining _REENTRANT on system with POSIX threads should not hurt. |
| 2615 | AC_DEFINE(_REENTRANT) |
| 2616 | posix_threads=yes |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2617 | THREADOBJ="Python/thread.o" |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2618 | elif test "$ac_cv_kpthread" = "yes" |
| 2619 | then |
| 2620 | CC="$CC -Kpthread" |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 2621 | if test "$ac_cv_cxx_thread" = "yes"; then |
| 2622 | CXX="$CXX -Kpthread" |
| 2623 | fi |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2624 | AC_DEFINE(WITH_THREAD) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2625 | posix_threads=yes |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2626 | THREADOBJ="Python/thread.o" |
Martin v. Löwis | 5f433f0 | 2003-05-05 05:05:30 +0000 | [diff] [blame] | 2627 | elif test "$ac_cv_kthread" = "yes" |
| 2628 | then |
| 2629 | CC="$CC -Kthread" |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 2630 | if test "$ac_cv_cxx_thread" = "yes"; then |
| 2631 | CXX="$CXX -Kthread" |
| 2632 | fi |
Martin v. Löwis | 5f433f0 | 2003-05-05 05:05:30 +0000 | [diff] [blame] | 2633 | AC_DEFINE(WITH_THREAD) |
| 2634 | posix_threads=yes |
| 2635 | THREADOBJ="Python/thread.o" |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 2636 | elif test "$ac_cv_pthread" = "yes" |
| 2637 | then |
| 2638 | CC="$CC -pthread" |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 2639 | if test "$ac_cv_cxx_thread" = "yes"; then |
| 2640 | CXX="$CXX -pthread" |
| 2641 | fi |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 2642 | AC_DEFINE(WITH_THREAD) |
| 2643 | posix_threads=yes |
| 2644 | THREADOBJ="Python/thread.o" |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2645 | else |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2646 | if test ! -z "$with_threads" -a -d "$with_threads" |
| 2647 | then LDFLAGS="$LDFLAGS -L$with_threads" |
| 2648 | fi |
| 2649 | if test ! -z "$withval" -a -d "$withval" |
| 2650 | then LDFLAGS="$LDFLAGS -L$withval" |
| 2651 | fi |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2652 | |
| 2653 | # According to the POSIX spec, a pthreads implementation must |
Matthias Klose | a2542be | 2004-08-16 11:35:51 +0000 | [diff] [blame] | 2654 | # define _POSIX_THREADS in unistd.h. Some apparently don't |
| 2655 | # (e.g. gnu pth with pthread emulation) |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2656 | AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h) |
| 2657 | AC_EGREP_CPP(yes, |
Neal Norwitz | 6eb37f0 | 2003-02-23 23:28:15 +0000 | [diff] [blame] | 2658 | [ |
| 2659 | #include <unistd.h> |
| 2660 | #ifdef _POSIX_THREADS |
| 2661 | yes |
| 2662 | #endif |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2663 | ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no) |
| 2664 | AC_MSG_RESULT($unistd_defines_pthreads) |
| 2665 | |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2666 | AC_DEFINE(_REENTRANT) |
Martin v. Löwis | a6e9758 | 2002-01-01 18:41:33 +0000 | [diff] [blame] | 2667 | AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD) |
| 2668 | AC_DEFINE(C_THREADS) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2669 | AC_DEFINE(HURD_C_THREADS, 1, |
| 2670 | [Define if you are using Mach cthreads directly under /include]) |
Martin v. Löwis | a6e9758 | 2002-01-01 18:41:33 +0000 | [diff] [blame] | 2671 | LIBS="$LIBS -lthreads" |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2672 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2673 | AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) |
| 2674 | AC_DEFINE(C_THREADS) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2675 | AC_DEFINE(MACH_C_THREADS, 1, |
| 2676 | [Define if you are using Mach cthreads under mach /]) |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2677 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2678 | AC_MSG_CHECKING(for --with-pth) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2679 | AC_ARG_WITH([pth], |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2680 | AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2681 | [AC_MSG_RESULT($withval) |
| 2682 | AC_DEFINE([WITH_THREAD]) |
| 2683 | AC_DEFINE([HAVE_PTH], 1, |
| 2684 | [Define if you have GNU PTH threads.]) |
| 2685 | LIBS="-lpth $LIBS" |
| 2686 | THREADOBJ="Python/thread.o"], |
| 2687 | [AC_MSG_RESULT(no) |
Martin v. Löwis | 8158b5a | 2001-10-08 13:17:28 +0000 | [diff] [blame] | 2688 | |
| 2689 | # Just looking for pthread_create in libpthread is not enough: |
| 2690 | # on HP/UX, pthread.h renames pthread_create to a different symbol name. |
| 2691 | # So we really have to include pthread.h, and then link. |
| 2692 | _libs=$LIBS |
| 2693 | LIBS="$LIBS -lpthread" |
| 2694 | AC_MSG_CHECKING([for pthread_create in -lpthread]) |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 2695 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 2696 | #include <stdio.h> |
| 2697 | #include <pthread.h> |
Martin v. Löwis | 8158b5a | 2001-10-08 13:17:28 +0000 | [diff] [blame] | 2698 | |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2699 | void * start_routine (void *arg) { exit (0); }]], [[ |
| 2700 | pthread_create (NULL, NULL, start_routine, NULL)]])],[ |
Martin v. Löwis | 8158b5a | 2001-10-08 13:17:28 +0000 | [diff] [blame] | 2701 | AC_MSG_RESULT(yes) |
| 2702 | AC_DEFINE(WITH_THREAD) |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2703 | posix_threads=yes |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2704 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 8158b5a | 2001-10-08 13:17:28 +0000 | [diff] [blame] | 2705 | LIBS=$_libs |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2706 | AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2707 | posix_threads=yes |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2708 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2709 | AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD) |
| 2710 | AC_DEFINE(ATHEOS_THREADS, 1, |
| 2711 | [Define this if you have AtheOS threads.]) |
| 2712 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2713 | AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2714 | AC_DEFINE(BEOS_THREADS, 1, |
| 2715 | [Define this if you have BeOS threads.]) |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2716 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2717 | AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2718 | posix_threads=yes |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2719 | LIBS="$LIBS -lpthreads" |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2720 | THREADOBJ="Python/thread.o"], [ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2721 | AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2722 | posix_threads=yes |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2723 | LIBS="$LIBS -lc_r" |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2724 | THREADOBJ="Python/thread.o"], [ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2725 | AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2726 | posix_threads=yes |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2727 | LIBS="$LIBS -lpthread" |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2728 | THREADOBJ="Python/thread.o"], [ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2729 | AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2730 | posix_threads=yes |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2731 | LIBS="$LIBS -lcma" |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2732 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2733 | USE_THREAD_MODULE="#"]) |
Skip Montanaro | f8712e5 | 2004-01-17 03:04:46 +0000 | [diff] [blame] | 2734 | ])])])])])])])])])]) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2735 | |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 2736 | AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) |
| 2737 | LIBS="$LIBS -lmpc" |
| 2738 | THREADOBJ="Python/thread.o" |
| 2739 | USE_THREAD_MODULE=""]) |
| 2740 | |
| 2741 | if test "$posix_threads" != "yes"; then |
| 2742 | AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) |
| 2743 | LIBS="$LIBS -lthread" |
| 2744 | THREADOBJ="Python/thread.o" |
| 2745 | USE_THREAD_MODULE=""]) |
| 2746 | fi |
| 2747 | |
| 2748 | if test "$USE_THREAD_MODULE" != "#" |
| 2749 | then |
| 2750 | # If the above checks didn't disable threads, (at least) OSF1 |
| 2751 | # needs this '-threads' argument during linking. |
| 2752 | case $ac_sys_system in |
| 2753 | OSF1) LDLAST=-threads;; |
| 2754 | esac |
| 2755 | fi |
| 2756 | fi |
| 2757 | |
| 2758 | if test "$posix_threads" = "yes"; then |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2759 | if test "$unistd_defines_pthreads" = "no"; then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2760 | AC_DEFINE(_POSIX_THREADS, 1, |
| 2761 | [Define if you have POSIX threads, |
| 2762 | and your system does not define that.]) |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2763 | fi |
| 2764 | |
Martin v. Löwis | dfc33fd | 2003-01-21 10:14:41 +0000 | [diff] [blame] | 2765 | # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. |
| 2766 | case $ac_sys_system/$ac_sys_release in |
Charles-François Natali | 4929eb9 | 2011-07-21 19:41:04 +0200 | [diff] [blame] | 2767 | SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 2768 | [Defined for Solaris 2.6 bug in pthread header.]) |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 2769 | ;; |
Martin v. Löwis | dfc33fd | 2003-01-21 10:14:41 +0000 | [diff] [blame] | 2770 | SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 2771 | [Define if the Posix semaphores do not work on your system]) |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 2772 | ;; |
Charles-François Natali | 4929eb9 | 2011-07-21 19:41:04 +0200 | [diff] [blame] | 2773 | AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 2774 | [Define if the Posix semaphores do not work on your system]) |
Christian Heimes | cba36bb | 2008-01-30 22:54:18 +0000 | [diff] [blame] | 2775 | ;; |
Martin v. Löwis | dfc33fd | 2003-01-21 10:14:41 +0000 | [diff] [blame] | 2776 | esac |
| 2777 | |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2778 | AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported) |
| 2779 | AC_CACHE_VAL(ac_cv_pthread_system_supported, |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 2780 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
| 2781 | #include <stdio.h> |
| 2782 | #include <pthread.h> |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2783 | void *foo(void *parm) { |
| 2784 | return NULL; |
| 2785 | } |
| 2786 | main() { |
| 2787 | pthread_attr_t attr; |
Martin v. Löwis | a82d347 | 2002-02-24 16:05:05 +0000 | [diff] [blame] | 2788 | pthread_t id; |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2789 | if (pthread_attr_init(&attr)) exit(-1); |
| 2790 | if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1); |
Martin v. Löwis | a82d347 | 2002-02-24 16:05:05 +0000 | [diff] [blame] | 2791 | if (pthread_create(&id, &attr, foo, NULL)) exit(-1); |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2792 | exit(0); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2793 | }]])], |
| 2794 | [ac_cv_pthread_system_supported=yes], |
| 2795 | [ac_cv_pthread_system_supported=no], |
| 2796 | [ac_cv_pthread_system_supported=no]) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2797 | ]) |
| 2798 | AC_MSG_RESULT($ac_cv_pthread_system_supported) |
| 2799 | if test "$ac_cv_pthread_system_supported" = "yes"; then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2800 | AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.]) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2801 | fi |
Jason Tishler | fac083d | 2003-07-22 15:20:49 +0000 | [diff] [blame] | 2802 | AC_CHECK_FUNCS(pthread_sigmask, |
| 2803 | [case $ac_sys_system in |
| 2804 | CYGWIN*) |
| 2805 | AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1, |
| 2806 | [Define if pthread_sigmask() does not work on your system.]) |
| 2807 | ;; |
| 2808 | esac]) |
Christian Heimes | 0d604cf | 2013-08-21 13:26:05 +0200 | [diff] [blame] | 2809 | AC_CHECK_FUNCS(pthread_atfork) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2810 | fi |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 2811 | |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 2812 | |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2813 | # Check for enable-ipv6 |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 2814 | AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) |
Martin v. Löwis | a5f8bb5 | 2001-09-05 08:22:34 +0000 | [diff] [blame] | 2815 | AC_MSG_CHECKING([if --enable-ipv6 is specified]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2816 | AC_ARG_ENABLE(ipv6, |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2817 | [ --enable-ipv6 Enable ipv6 (with ipv4) support |
| 2818 | --disable-ipv6 Disable ipv6 support], |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2819 | [ case "$enableval" in |
| 2820 | no) |
| 2821 | AC_MSG_RESULT(no) |
| 2822 | ipv6=no |
| 2823 | ;; |
| 2824 | *) AC_MSG_RESULT(yes) |
| 2825 | AC_DEFINE(ENABLE_IPV6) |
| 2826 | ipv6=yes |
| 2827 | ;; |
| 2828 | esac ], |
| 2829 | |
Martin v. Löwis | a5f8bb5 | 2001-09-05 08:22:34 +0000 | [diff] [blame] | 2830 | [ |
| 2831 | dnl the check does not work on cross compilation case... |
Charles-François Natali | be2b907 | 2013-01-08 19:47:00 +0100 | [diff] [blame] | 2832 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* AF_INET6 available check */ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2833 | #include <sys/types.h> |
Charles-François Natali | be2b907 | 2013-01-08 19:47:00 +0100 | [diff] [blame] | 2834 | #include <sys/socket.h>]], |
| 2835 | [[int domain = AF_INET6;]])],[ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2836 | AC_MSG_RESULT(yes) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2837 | ipv6=yes |
| 2838 | ],[ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2839 | AC_MSG_RESULT(no) |
| 2840 | ipv6=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2841 | ]) |
Martin v. Löwis | a5f8bb5 | 2001-09-05 08:22:34 +0000 | [diff] [blame] | 2842 | |
| 2843 | if test "$ipv6" = "yes"; then |
| 2844 | AC_MSG_CHECKING(if RFC2553 API is available) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2845 | AC_COMPILE_IFELSE([ |
| 2846 | AC_LANG_PROGRAM([[#include <sys/types.h> |
| 2847 | #include <netinet/in.h>]], |
| 2848 | [[struct sockaddr_in6 x; |
| 2849 | x.sin6_scope_id;]]) |
| 2850 | ],[ |
| 2851 | AC_MSG_RESULT(yes) |
| 2852 | ipv6=yes |
| 2853 | ],[ |
| 2854 | AC_MSG_RESULT(no, IPv6 disabled) |
| 2855 | ipv6=no |
| 2856 | ]) |
Martin v. Löwis | a5f8bb5 | 2001-09-05 08:22:34 +0000 | [diff] [blame] | 2857 | fi |
| 2858 | |
| 2859 | if test "$ipv6" = "yes"; then |
| 2860 | AC_DEFINE(ENABLE_IPV6) |
| 2861 | fi |
| 2862 | ]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2863 | |
| 2864 | ipv6type=unknown |
| 2865 | ipv6lib=none |
| 2866 | ipv6trylibc=no |
| 2867 | |
| 2868 | if test "$ipv6" = "yes"; then |
| 2869 | AC_MSG_CHECKING([ipv6 stack type]) |
Guido van Rossum | b855216 | 2001-09-05 14:58:11 +0000 | [diff] [blame] | 2870 | for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta; |
| 2871 | do |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2872 | case $i in |
| 2873 | inria) |
| 2874 | dnl http://www.kame.net/ |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2875 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2876 | #include <netinet/in.h> |
| 2877 | #ifdef IPV6_INRIA_VERSION |
| 2878 | yes |
| 2879 | #endif], |
Martin v. Löwis | 44ddbde | 2001-12-02 10:15:37 +0000 | [diff] [blame] | 2880 | [ipv6type=$i]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2881 | ;; |
| 2882 | kame) |
| 2883 | dnl http://www.kame.net/ |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2884 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2885 | #include <netinet/in.h> |
| 2886 | #ifdef __KAME__ |
| 2887 | yes |
| 2888 | #endif], |
| 2889 | [ipv6type=$i; |
| 2890 | ipv6lib=inet6 |
| 2891 | ipv6libdir=/usr/local/v6/lib |
Martin v. Löwis | 44ddbde | 2001-12-02 10:15:37 +0000 | [diff] [blame] | 2892 | ipv6trylibc=yes]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2893 | ;; |
| 2894 | linux-glibc) |
| 2895 | dnl http://www.v6.linux.or.jp/ |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2896 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2897 | #include <features.h> |
| 2898 | #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)) |
| 2899 | yes |
| 2900 | #endif], |
| 2901 | [ipv6type=$i; |
Martin v. Löwis | 44ddbde | 2001-12-02 10:15:37 +0000 | [diff] [blame] | 2902 | ipv6trylibc=yes]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2903 | ;; |
| 2904 | linux-inet6) |
| 2905 | dnl http://www.v6.linux.or.jp/ |
| 2906 | if test -d /usr/inet6; then |
| 2907 | ipv6type=$i |
| 2908 | ipv6lib=inet6 |
| 2909 | ipv6libdir=/usr/inet6/lib |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 2910 | BASECFLAGS="-I/usr/inet6/include $BASECFLAGS" |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2911 | fi |
| 2912 | ;; |
| 2913 | solaris) |
| 2914 | if test -f /etc/netconfig; then |
Antoine Pitrou | 31e8595 | 2011-01-03 18:57:14 +0000 | [diff] [blame] | 2915 | if $GREP -q tcp6 /etc/netconfig; then |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2916 | ipv6type=$i |
| 2917 | ipv6trylibc=yes |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2918 | fi |
| 2919 | fi |
| 2920 | ;; |
| 2921 | toshiba) |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2922 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2923 | #include <sys/param.h> |
| 2924 | #ifdef _TOSHIBA_INET6 |
| 2925 | yes |
| 2926 | #endif], |
| 2927 | [ipv6type=$i; |
| 2928 | ipv6lib=inet6; |
Martin v. Löwis | 44ddbde | 2001-12-02 10:15:37 +0000 | [diff] [blame] | 2929 | ipv6libdir=/usr/local/v6/lib]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2930 | ;; |
| 2931 | v6d) |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2932 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2933 | #include </usr/local/v6/include/sys/v6config.h> |
| 2934 | #ifdef __V6D__ |
| 2935 | yes |
| 2936 | #endif], |
| 2937 | [ipv6type=$i; |
| 2938 | ipv6lib=v6; |
| 2939 | ipv6libdir=/usr/local/v6/lib; |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 2940 | BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2941 | ;; |
| 2942 | zeta) |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2943 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2944 | #include <sys/param.h> |
| 2945 | #ifdef _ZETA_MINAMI_INET6 |
| 2946 | yes |
| 2947 | #endif], |
| 2948 | [ipv6type=$i; |
| 2949 | ipv6lib=inet6; |
Martin v. Löwis | 44ddbde | 2001-12-02 10:15:37 +0000 | [diff] [blame] | 2950 | ipv6libdir=/usr/local/v6/lib]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2951 | ;; |
| 2952 | esac |
| 2953 | if test "$ipv6type" != "unknown"; then |
| 2954 | break |
| 2955 | fi |
| 2956 | done |
| 2957 | AC_MSG_RESULT($ipv6type) |
| 2958 | fi |
| 2959 | |
| 2960 | if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then |
| 2961 | if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then |
| 2962 | LIBS="-L$ipv6libdir -l$ipv6lib $LIBS" |
| 2963 | echo "using lib$ipv6lib" |
| 2964 | else |
| 2965 | if test $ipv6trylibc = "yes"; then |
| 2966 | echo "using libc" |
| 2967 | else |
| 2968 | echo 'Fatal: no $ipv6lib library found. cannot continue.' |
| 2969 | echo "You need to fetch lib$ipv6lib.a from appropriate" |
| 2970 | echo 'ipv6 kit and compile beforehand.' |
| 2971 | exit 1 |
| 2972 | fi |
| 2973 | fi |
| 2974 | fi |
| 2975 | |
Ronald Oussoren | 0d236eb | 2008-06-06 21:31:33 +0000 | [diff] [blame] | 2976 | AC_MSG_CHECKING(for OSX 10.5 SDK or later) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2977 | AC_COMPILE_IFELSE([ |
Mark Dickinson | 0712b56 | 2010-05-08 19:13:21 +0000 | [diff] [blame] | 2978 | AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]]) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2979 | ],[ |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 2980 | AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.]) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2981 | AC_MSG_RESULT(yes) |
| 2982 | ],[ |
Ronald Oussoren | 0d236eb | 2008-06-06 21:31:33 +0000 | [diff] [blame] | 2983 | AC_MSG_RESULT(no) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2984 | ]) |
Ronald Oussoren | 0d236eb | 2008-06-06 21:31:33 +0000 | [diff] [blame] | 2985 | |
Martin v. Löwis | a3fb4f7 | 2002-06-09 13:33:54 +0000 | [diff] [blame] | 2986 | # Check for --with-doc-strings |
| 2987 | AC_MSG_CHECKING(for --with-doc-strings) |
| 2988 | AC_ARG_WITH(doc-strings, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2989 | AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings])) |
Martin v. Löwis | a3fb4f7 | 2002-06-09 13:33:54 +0000 | [diff] [blame] | 2990 | |
| 2991 | if test -z "$with_doc_strings" |
| 2992 | then with_doc_strings="yes" |
| 2993 | fi |
| 2994 | if test "$with_doc_strings" != "no" |
| 2995 | then |
| 2996 | AC_DEFINE(WITH_DOC_STRINGS, 1, |
| 2997 | [Define if you want documentation strings in extension modules]) |
| 2998 | fi |
| 2999 | AC_MSG_RESULT($with_doc_strings) |
| 3000 | |
Neil Schemenauer | a35c688 | 2001-02-27 04:45:05 +0000 | [diff] [blame] | 3001 | # Check for Python-specific malloc support |
Martin v. Löwis | f30d60e | 2004-06-08 08:17:44 +0000 | [diff] [blame] | 3002 | AC_MSG_CHECKING(for --with-tsc) |
| 3003 | AC_ARG_WITH(tsc, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3004 | AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[ |
Martin v. Löwis | f30d60e | 2004-06-08 08:17:44 +0000 | [diff] [blame] | 3005 | if test "$withval" != no |
| 3006 | then |
| 3007 | AC_DEFINE(WITH_TSC, 1, |
| 3008 | [Define to profile with the Pentium timestamp counter]) |
| 3009 | AC_MSG_RESULT(yes) |
| 3010 | else AC_MSG_RESULT(no) |
| 3011 | fi], |
| 3012 | [AC_MSG_RESULT(no)]) |
| 3013 | |
| 3014 | # Check for Python-specific malloc support |
Neil Schemenauer | a35c688 | 2001-02-27 04:45:05 +0000 | [diff] [blame] | 3015 | AC_MSG_CHECKING(for --with-pymalloc) |
| 3016 | AC_ARG_WITH(pymalloc, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3017 | AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs])) |
Neil Schemenauer | 16c2297 | 2002-03-22 15:34:49 +0000 | [diff] [blame] | 3018 | |
| 3019 | if test -z "$with_pymalloc" |
| 3020 | then with_pymalloc="yes" |
| 3021 | fi |
| 3022 | if test "$with_pymalloc" != "no" |
| 3023 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3024 | AC_DEFINE(WITH_PYMALLOC, 1, |
| 3025 | [Define if you want to compile in Python-specific mallocs]) |
Neil Schemenauer | 16c2297 | 2002-03-22 15:34:49 +0000 | [diff] [blame] | 3026 | fi |
| 3027 | AC_MSG_RESULT($with_pymalloc) |
Neil Schemenauer | a35c688 | 2001-02-27 04:45:05 +0000 | [diff] [blame] | 3028 | |
Benjamin Peterson | 91c12eb | 2009-12-03 02:52:39 +0000 | [diff] [blame] | 3029 | # Check for Valgrind support |
| 3030 | AC_MSG_CHECKING([for --with-valgrind]) |
| 3031 | AC_ARG_WITH([valgrind], |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3032 | AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),, |
Benjamin Peterson | 91c12eb | 2009-12-03 02:52:39 +0000 | [diff] [blame] | 3033 | with_valgrind=no) |
| 3034 | AC_MSG_RESULT([$with_valgrind]) |
| 3035 | if test "$with_valgrind" != no; then |
| 3036 | AC_CHECK_HEADER([valgrind/valgrind.h], |
| 3037 | [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])], |
| 3038 | [AC_MSG_ERROR([Valgrind support requested but headers not available])] |
| 3039 | ) |
| 3040 | fi |
| 3041 | |
Barry Warsaw | ef82cd7 | 2000-06-30 16:21:01 +0000 | [diff] [blame] | 3042 | # Check for --with-wctype-functions |
| 3043 | AC_MSG_CHECKING(for --with-wctype-functions) |
| 3044 | AC_ARG_WITH(wctype-functions, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3045 | AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3046 | [ |
Barry Warsaw | ef82cd7 | 2000-06-30 16:21:01 +0000 | [diff] [blame] | 3047 | if test "$withval" != no |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3048 | then |
| 3049 | AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1, |
| 3050 | [Define if you want wctype.h functions to be used instead of the |
| 3051 | one supplied by Python itself. (see Include/unicodectype.h).]) |
| 3052 | AC_MSG_RESULT(yes) |
Barry Warsaw | ef82cd7 | 2000-06-30 16:21:01 +0000 | [diff] [blame] | 3053 | else AC_MSG_RESULT(no) |
| 3054 | fi], |
| 3055 | [AC_MSG_RESULT(no)]) |
| 3056 | |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 3057 | # -I${DLINCLDIR} is added to the compile rule for importdl.o |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3058 | AC_SUBST(DLINCLDIR) |
Guido van Rossum | 98935bf | 2001-09-05 19:13:16 +0000 | [diff] [blame] | 3059 | DLINCLDIR=. |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3060 | |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 3061 | # the dlopen() function means we might want to use dynload_shlib.o. some |
| 3062 | # platforms, such as AIX, have dlopen(), but don't want to use it. |
Thomas Wouters | 3a58420 | 2000-08-05 23:28:51 +0000 | [diff] [blame] | 3063 | AC_CHECK_FUNCS(dlopen) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 3064 | |
| 3065 | # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic |
| 3066 | # loading of modules. |
| 3067 | AC_SUBST(DYNLOADFILE) |
| 3068 | AC_MSG_CHECKING(DYNLOADFILE) |
| 3069 | if test -z "$DYNLOADFILE" |
| 3070 | then |
| 3071 | case $ac_sys_system/$ac_sys_release in |
Martin v. Löwis | c19c5a6 | 2003-11-18 20:00:44 +0000 | [diff] [blame] | 3072 | AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c |
| 3073 | if test "$ac_cv_func_dlopen" = yes |
| 3074 | then DYNLOADFILE="dynload_shlib.o" |
| 3075 | else DYNLOADFILE="dynload_aix.o" |
| 3076 | fi |
| 3077 | ;; |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 3078 | BeOS*) DYNLOADFILE="dynload_beos.o";; |
| 3079 | hp*|HP*) DYNLOADFILE="dynload_hpux.o";; |
Anthony Baxter | 8220174 | 2006-04-09 15:07:40 +0000 | [diff] [blame] | 3080 | # Use dynload_next.c only on 10.2 and below, which don't have native dlopen() |
| 3081 | Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 3082 | atheos*) DYNLOADFILE="dynload_atheos.o";; |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 3083 | *) |
| 3084 | # use dynload_shlib.c and dlopen() if we have it; otherwise stub |
| 3085 | # out any dynamic loading |
| 3086 | if test "$ac_cv_func_dlopen" = yes |
| 3087 | then DYNLOADFILE="dynload_shlib.o" |
| 3088 | else DYNLOADFILE="dynload_stub.o" |
| 3089 | fi |
| 3090 | ;; |
| 3091 | esac |
| 3092 | fi |
| 3093 | AC_MSG_RESULT($DYNLOADFILE) |
| 3094 | if test "$DYNLOADFILE" != "dynload_stub.o" |
| 3095 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3096 | AC_DEFINE(HAVE_DYNAMIC_LOADING, 1, |
| 3097 | [Defined when any dynamic module loading is enabled.]) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 3098 | fi |
| 3099 | |
Jack Jansen | c49e5b7 | 2001-06-19 15:00:23 +0000 | [diff] [blame] | 3100 | # MACHDEP_OBJS can be set to platform-specific object files needed by Python |
| 3101 | |
| 3102 | AC_SUBST(MACHDEP_OBJS) |
| 3103 | AC_MSG_CHECKING(MACHDEP_OBJS) |
| 3104 | if test -z "$MACHDEP_OBJS" |
| 3105 | then |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 3106 | MACHDEP_OBJS=$extra_machdep_objs |
| 3107 | else |
| 3108 | MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs" |
Jack Jansen | c49e5b7 | 2001-06-19 15:00:23 +0000 | [diff] [blame] | 3109 | fi |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 3110 | AC_MSG_RESULT(MACHDEP_OBJS) |
Jack Jansen | c49e5b7 | 2001-06-19 15:00:23 +0000 | [diff] [blame] | 3111 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3112 | # checks for library functions |
Martin v. Löwis | aef18b1 | 2008-03-24 13:31:16 +0000 | [diff] [blame] | 3113 | AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \ |
| 3114 | clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \ |
Martin v. Löwis | 438b534 | 2002-12-27 10:16:42 +0000 | [diff] [blame] | 3115 | gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ |
Benjamin Peterson | 27c269a | 2014-12-26 11:09:00 -0600 | [diff] [blame] | 3116 | getentropy \ |
Martin v. Löwis | 50ea456 | 2009-11-27 13:56:01 +0000 | [diff] [blame] | 3117 | getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ |
Benjamin Peterson | d16e01c | 2014-02-04 10:20:26 -0500 | [diff] [blame] | 3118 | initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime mmap \ |
Martin v. Löwis | a5f0907 | 2002-10-11 05:37:59 +0000 | [diff] [blame] | 3119 | mremap nice pathconf pause plock poll pthread_init \ |
Guido van Rossum | 162e38c | 2003-02-19 15:25:10 +0000 | [diff] [blame] | 3120 | putenv readlink realpath \ |
Jesse Noller | 355b126 | 2009-04-02 00:03:28 +0000 | [diff] [blame] | 3121 | select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \ |
| 3122 | setgid \ |
Martin v. Löwis | 4daacb1 | 2003-03-28 18:37:01 +0000 | [diff] [blame] | 3123 | setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \ |
Martin v. Löwis | 50ea456 | 2009-11-27 13:56:01 +0000 | [diff] [blame] | 3124 | setlocale setregid setreuid setresuid setresgid \ |
| 3125 | setsid setpgid setpgrp setuid setvbuf snprintf \ |
Skip Montanaro | 7e11a01 | 2004-02-07 12:55:46 +0000 | [diff] [blame] | 3126 | sigaction siginterrupt sigrelse strftime \ |
Michael W. Hudson | 34f20ea | 2002-05-27 15:08:24 +0000 | [diff] [blame] | 3127 | sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ |
Neal Norwitz | 05a4559 | 2006-03-20 06:30:08 +0000 | [diff] [blame] | 3128 | truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty) |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 3129 | |
Martin v. Löwis | c8ad7cc | 2002-11-11 13:23:45 +0000 | [diff] [blame] | 3130 | # For some functions, having a definition is not sufficient, since |
| 3131 | # we want to take their address. |
| 3132 | AC_MSG_CHECKING(for chroot) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3133 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])], |
| 3134 | [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.) |
| 3135 | AC_MSG_RESULT(yes)], |
| 3136 | [AC_MSG_RESULT(no) |
| 3137 | ]) |
Martin v. Löwis | c8ad7cc | 2002-11-11 13:23:45 +0000 | [diff] [blame] | 3138 | AC_MSG_CHECKING(for link) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3139 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])], |
| 3140 | [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.) |
| 3141 | AC_MSG_RESULT(yes)], |
| 3142 | [AC_MSG_RESULT(no) |
| 3143 | ]) |
Martin v. Löwis | c8ad7cc | 2002-11-11 13:23:45 +0000 | [diff] [blame] | 3144 | AC_MSG_CHECKING(for symlink) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3145 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])], |
| 3146 | [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.) |
| 3147 | AC_MSG_RESULT(yes)], |
| 3148 | [AC_MSG_RESULT(no) |
| 3149 | ]) |
Martin v. Löwis | a64988c | 2003-09-20 15:30:20 +0000 | [diff] [blame] | 3150 | AC_MSG_CHECKING(for fchdir) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3151 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])], |
| 3152 | [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.) |
| 3153 | AC_MSG_RESULT(yes)], |
| 3154 | [AC_MSG_RESULT(no) |
| 3155 | ]) |
Martin v. Löwis | a64988c | 2003-09-20 15:30:20 +0000 | [diff] [blame] | 3156 | AC_MSG_CHECKING(for fsync) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3157 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])], |
| 3158 | [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.) |
| 3159 | AC_MSG_RESULT(yes)], |
| 3160 | [AC_MSG_RESULT(no) |
| 3161 | ]) |
Martin v. Löwis | a64988c | 2003-09-20 15:30:20 +0000 | [diff] [blame] | 3162 | AC_MSG_CHECKING(for fdatasync) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3163 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])], |
| 3164 | [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.) |
| 3165 | AC_MSG_RESULT(yes)], |
| 3166 | [AC_MSG_RESULT(no) |
| 3167 | ]) |
Christian Heimes | 0e9ab5f | 2008-03-21 23:49:44 +0000 | [diff] [blame] | 3168 | AC_MSG_CHECKING(for epoll) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3169 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])], |
| 3170 | [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.) |
| 3171 | AC_MSG_RESULT(yes)], |
| 3172 | [AC_MSG_RESULT(no) |
| 3173 | ]) |
Christian Heimes | 0e9ab5f | 2008-03-21 23:49:44 +0000 | [diff] [blame] | 3174 | AC_MSG_CHECKING(for kqueue) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3175 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Christian Heimes | 0e9ab5f | 2008-03-21 23:49:44 +0000 | [diff] [blame] | 3176 | #include <sys/types.h> |
| 3177 | #include <sys/event.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3178 | ]], [[int x=kqueue()]])], |
| 3179 | [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.) |
| 3180 | AC_MSG_RESULT(yes)], |
| 3181 | [AC_MSG_RESULT(no) |
| 3182 | ]) |
Martin v. Löwis | d584368 | 2002-11-21 20:41:28 +0000 | [diff] [blame] | 3183 | # On some systems (eg. FreeBSD 5), we would find a definition of the |
| 3184 | # functions ctermid_r, setgroups in the library, but no prototype |
| 3185 | # (e.g. because we use _XOPEN_SOURCE). See whether we can take their |
| 3186 | # address to avoid compiler warnings and potential miscompilations |
| 3187 | # because of the missing prototypes. |
| 3188 | |
| 3189 | AC_MSG_CHECKING(for ctermid_r) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3190 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | d584368 | 2002-11-21 20:41:28 +0000 | [diff] [blame] | 3191 | #include <stdio.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3192 | ]], [[void* p = ctermid_r]])], |
| 3193 | [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.) |
| 3194 | AC_MSG_RESULT(yes)], |
| 3195 | [AC_MSG_RESULT(no) |
| 3196 | ]) |
Martin v. Löwis | d584368 | 2002-11-21 20:41:28 +0000 | [diff] [blame] | 3197 | |
Antoine Pitrou | b170f17 | 2010-09-10 18:47:36 +0000 | [diff] [blame] | 3198 | AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl], |
| 3199 | [AC_COMPILE_IFELSE( |
| 3200 | [AC_LANG_PROGRAM( |
| 3201 | [#include <sys/file.h>], |
| 3202 | [void* p = flock] |
| 3203 | )], |
| 3204 | [ac_cv_flock_decl=yes], |
| 3205 | [ac_cv_flock_decl=no] |
| 3206 | ) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3207 | ]) |
Antoine Pitrou | b170f17 | 2010-09-10 18:47:36 +0000 | [diff] [blame] | 3208 | if test "x${ac_cv_flock_decl}" = xyes; then |
| 3209 | AC_CHECK_FUNCS(flock,, |
| 3210 | AC_CHECK_LIB(bsd,flock, |
| 3211 | [AC_DEFINE(HAVE_FLOCK) |
| 3212 | AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.) |
| 3213 | ]) |
| 3214 | ) |
Antoine Pitrou | 8572981 | 2010-09-07 14:55:24 +0000 | [diff] [blame] | 3215 | fi |
Martin v. Löwis | f26d63b | 2003-03-30 17:23:49 +0000 | [diff] [blame] | 3216 | |
| 3217 | AC_MSG_CHECKING(for getpagesize) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3218 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | f26d63b | 2003-03-30 17:23:49 +0000 | [diff] [blame] | 3219 | #include <unistd.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3220 | ]], [[void* p = getpagesize]])], |
| 3221 | [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.) |
| 3222 | AC_MSG_RESULT(yes)], |
| 3223 | [AC_MSG_RESULT(no) |
| 3224 | ]) |
Martin v. Löwis | f26d63b | 2003-03-30 17:23:49 +0000 | [diff] [blame] | 3225 | |
Charles-François Natali | 93a1175 | 2011-11-27 13:01:35 +0100 | [diff] [blame] | 3226 | AC_MSG_CHECKING(for broken unsetenv) |
| 3227 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 3228 | #include <stdlib.h> |
| 3229 | ]], [[int res = unsetenv("DUMMY")]])], |
| 3230 | [AC_MSG_RESULT(no)], |
| 3231 | [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.) |
| 3232 | AC_MSG_RESULT(yes) |
| 3233 | ]) |
| 3234 | |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 3235 | dnl check for true |
| 3236 | AC_CHECK_PROGS(TRUE, true, /bin/true) |
| 3237 | |
Martin v. Löwis | 95c419b | 2003-05-03 12:10:48 +0000 | [diff] [blame] | 3238 | dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv |
| 3239 | dnl On others, they are in the C library, so we to take no action |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 3240 | AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE], |
Martin v. Löwis | 95c419b | 2003-05-03 12:10:48 +0000 | [diff] [blame] | 3241 | AC_CHECK_LIB(resolv, inet_aton) |
| 3242 | ) |
| 3243 | |
Martin v. Löwis | a51d5c8 | 2007-12-04 08:37:59 +0000 | [diff] [blame] | 3244 | # On Tru64, chflags seems to be present, but calling it will |
| 3245 | # exit Python |
Gregory P. Smith | bb21389 | 2009-11-02 01:37:37 +0000 | [diff] [blame] | 3246 | AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl |
Ned Deily | 43e1054 | 2011-06-27 23:41:53 -0700 | [diff] [blame] | 3247 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Martin v. Löwis | a51d5c8 | 2007-12-04 08:37:59 +0000 | [diff] [blame] | 3248 | #include <sys/stat.h> |
| 3249 | #include <unistd.h> |
| 3250 | int main(int argc, char*argv[]) |
| 3251 | { |
| 3252 | if(chflags(argv[0], 0) != 0) |
| 3253 | return 1; |
| 3254 | return 0; |
| 3255 | } |
Ned Deily | 43e1054 | 2011-06-27 23:41:53 -0700 | [diff] [blame] | 3256 | ]])], |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3257 | [ac_cv_have_chflags=yes], |
| 3258 | [ac_cv_have_chflags=no], |
| 3259 | [ac_cv_have_chflags=cross]) |
Gregory P. Smith | bb21389 | 2009-11-02 01:37:37 +0000 | [diff] [blame] | 3260 | ]) |
| 3261 | if test "$ac_cv_have_chflags" = cross ; then |
| 3262 | AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"]) |
| 3263 | fi |
| 3264 | if test "$ac_cv_have_chflags" = yes ; then |
Ned Deily | 43e1054 | 2011-06-27 23:41:53 -0700 | [diff] [blame] | 3265 | AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the 'chflags' function.]) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3266 | fi |
Martin v. Löwis | a51d5c8 | 2007-12-04 08:37:59 +0000 | [diff] [blame] | 3267 | |
Gregory P. Smith | bb21389 | 2009-11-02 01:37:37 +0000 | [diff] [blame] | 3268 | AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl |
Ned Deily | 43e1054 | 2011-06-27 23:41:53 -0700 | [diff] [blame] | 3269 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Martin v. Löwis | a51d5c8 | 2007-12-04 08:37:59 +0000 | [diff] [blame] | 3270 | #include <sys/stat.h> |
| 3271 | #include <unistd.h> |
| 3272 | int main(int argc, char*argv[]) |
| 3273 | { |
| 3274 | if(lchflags(argv[0], 0) != 0) |
| 3275 | return 1; |
| 3276 | return 0; |
| 3277 | } |
Ned Deily | 43e1054 | 2011-06-27 23:41:53 -0700 | [diff] [blame] | 3278 | ]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross]) |
Gregory P. Smith | bb21389 | 2009-11-02 01:37:37 +0000 | [diff] [blame] | 3279 | ]) |
| 3280 | if test "$ac_cv_have_lchflags" = cross ; then |
| 3281 | AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"]) |
| 3282 | fi |
| 3283 | if test "$ac_cv_have_lchflags" = yes ; then |
Ned Deily | 43e1054 | 2011-06-27 23:41:53 -0700 | [diff] [blame] | 3284 | AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.]) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3285 | fi |
Martin v. Löwis | a51d5c8 | 2007-12-04 08:37:59 +0000 | [diff] [blame] | 3286 | |
Neal Norwitz | 6e73aaa | 2006-06-12 03:33:09 +0000 | [diff] [blame] | 3287 | dnl Check if system zlib has *Copy() functions |
Ronald Oussoren | f875264 | 2006-07-06 10:13:35 +0000 | [diff] [blame] | 3288 | dnl |
| 3289 | dnl On MacOSX the linker will search for dylibs on the entire linker path |
| 3290 | dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first |
| 3291 | dnl to revert to a more traditional unix behaviour and make it possible to |
| 3292 | dnl override the system libz with a local static library of libz. Temporarily |
| 3293 | dnl add that flag to our CFLAGS as well to ensure that we check the version |
| 3294 | dnl of libz that will be used by setup.py. |
| 3295 | dnl The -L/usr/local/lib is needed as wel to get the same compilation |
| 3296 | dnl environment as setup.py (and leaving it out can cause configure to use the |
| 3297 | dnl wrong version of the library) |
| 3298 | case $ac_sys_system/$ac_sys_release in |
| 3299 | Darwin/*) |
| 3300 | _CUR_CFLAGS="${CFLAGS}" |
| 3301 | _CUR_LDFLAGS="${LDFLAGS}" |
| 3302 | CFLAGS="${CFLAGS} -Wl,-search_paths_first" |
| 3303 | LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib" |
| 3304 | ;; |
| 3305 | esac |
| 3306 | |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 3307 | AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy])) |
Neal Norwitz | 6e73aaa | 2006-06-12 03:33:09 +0000 | [diff] [blame] | 3308 | |
Ronald Oussoren | f875264 | 2006-07-06 10:13:35 +0000 | [diff] [blame] | 3309 | case $ac_sys_system/$ac_sys_release in |
| 3310 | Darwin/*) |
| 3311 | CFLAGS="${_CUR_CFLAGS}" |
| 3312 | LDFLAGS="${_CUR_LDFLAGS}" |
| 3313 | ;; |
| 3314 | esac |
| 3315 | |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3316 | AC_MSG_CHECKING(for hstrerror) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3317 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3318 | #include <netdb.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3319 | ]], [[void* p = hstrerror; hstrerror(0)]])], |
| 3320 | [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.) |
| 3321 | AC_MSG_RESULT(yes)], |
| 3322 | [AC_MSG_RESULT(no) |
| 3323 | ]) |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3324 | |
| 3325 | AC_MSG_CHECKING(for inet_aton) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3326 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | 86d6626 | 2006-02-17 08:40:11 +0000 | [diff] [blame] | 3327 | #include <sys/types.h> |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3328 | #include <sys/socket.h> |
| 3329 | #include <netinet/in.h> |
| 3330 | #include <arpa/inet.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3331 | ]], [[void* p = inet_aton;inet_aton(0,0)]])], |
| 3332 | [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.) |
| 3333 | AC_MSG_RESULT(yes)], |
| 3334 | [AC_MSG_RESULT(no) |
| 3335 | ]) |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3336 | |
| 3337 | AC_MSG_CHECKING(for inet_pton) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3338 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | f2e488d | 2003-05-05 22:00:11 +0000 | [diff] [blame] | 3339 | #include <sys/types.h> |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3340 | #include <sys/socket.h> |
| 3341 | #include <netinet/in.h> |
| 3342 | #include <arpa/inet.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3343 | ]], [[void* p = inet_pton]])], |
| 3344 | [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.) |
| 3345 | AC_MSG_RESULT(yes)], |
| 3346 | [AC_MSG_RESULT(no) |
| 3347 | ]) |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3348 | |
Martin v. Löwis | d6640d4 | 2003-07-06 09:29:52 +0000 | [diff] [blame] | 3349 | # On some systems, setgroups is in unistd.h, on others, in grp.h |
Martin v. Löwis | d584368 | 2002-11-21 20:41:28 +0000 | [diff] [blame] | 3350 | AC_MSG_CHECKING(for setgroups) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3351 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | f2e488d | 2003-05-05 22:00:11 +0000 | [diff] [blame] | 3352 | #include <unistd.h> |
Martin v. Löwis | d6640d4 | 2003-07-06 09:29:52 +0000 | [diff] [blame] | 3353 | #ifdef HAVE_GRP_H |
| 3354 | #include <grp.h> |
| 3355 | #endif |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3356 | ]], [[void* p = setgroups]])], |
| 3357 | [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.) |
| 3358 | AC_MSG_RESULT(yes)], |
| 3359 | [AC_MSG_RESULT(no) |
| 3360 | ]) |
Martin v. Löwis | d584368 | 2002-11-21 20:41:28 +0000 | [diff] [blame] | 3361 | |
Fred Drake | 8cef4cf | 2000-06-28 16:40:38 +0000 | [diff] [blame] | 3362 | # check for openpty and forkpty |
| 3363 | |
Martin v. Löwis | fd9a72a | 2006-01-08 10:07:33 +0000 | [diff] [blame] | 3364 | AC_CHECK_FUNCS(openpty,, |
| 3365 | AC_CHECK_LIB(util,openpty, |
| 3366 | [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"], |
| 3367 | AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"]) |
| 3368 | ) |
| 3369 | ) |
| 3370 | AC_CHECK_FUNCS(forkpty,, |
| 3371 | AC_CHECK_LIB(util,forkpty, |
| 3372 | [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"], |
| 3373 | AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"]) |
| 3374 | ) |
| 3375 | ) |
Fred Drake | 8cef4cf | 2000-06-28 16:40:38 +0000 | [diff] [blame] | 3376 | |
Brett Cannon | aa5778d | 2008-03-18 04:09:00 +0000 | [diff] [blame] | 3377 | # Stuff for expat. |
| 3378 | AC_CHECK_FUNCS(memmove) |
| 3379 | |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 3380 | # check for long file support functions |
| 3381 | AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs) |
| 3382 | |
Brett Cannon | aa5778d | 2008-03-18 04:09:00 +0000 | [diff] [blame] | 3383 | AC_REPLACE_FUNCS(dup2 getcwd strdup) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3384 | AC_CHECK_FUNCS(getpgrp, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3385 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])], |
| 3386 | [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])], |
| 3387 | []) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3388 | ) |
Jack Jansen | 150753c | 2003-03-29 22:07:47 +0000 | [diff] [blame] | 3389 | AC_CHECK_FUNCS(setpgrp, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3390 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])], |
| 3391 | [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])], |
| 3392 | []) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3393 | ) |
| 3394 | AC_CHECK_FUNCS(gettimeofday, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3395 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]], |
| 3396 | [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])], |
| 3397 | [], |
| 3398 | [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1, |
| 3399 | [Define if gettimeofday() does not have second (timezone) argument |
| 3400 | This is the case on Motorola V4 (R40V4.2)]) |
| 3401 | ]) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3402 | ) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3403 | |
Martin v. Löwis | dbe3f76 | 2002-10-10 14:27:30 +0000 | [diff] [blame] | 3404 | AC_MSG_CHECKING(for major, minor, and makedev) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3405 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Neal Norwitz | 6eb37f0 | 2003-02-23 23:28:15 +0000 | [diff] [blame] | 3406 | #if defined(MAJOR_IN_MKDEV) |
| 3407 | #include <sys/mkdev.h> |
| 3408 | #elif defined(MAJOR_IN_SYSMACROS) |
| 3409 | #include <sys/sysmacros.h> |
| 3410 | #else |
| 3411 | #include <sys/types.h> |
| 3412 | #endif |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3413 | ]], [[ |
Martin v. Löwis | dbe3f76 | 2002-10-10 14:27:30 +0000 | [diff] [blame] | 3414 | makedev(major(0),minor(0)); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3415 | ]])],[ |
Martin v. Löwis | dbe3f76 | 2002-10-10 14:27:30 +0000 | [diff] [blame] | 3416 | AC_DEFINE(HAVE_DEVICE_MACROS, 1, |
| 3417 | [Define to 1 if you have the device macros.]) |
| 3418 | AC_MSG_RESULT(yes) |
| 3419 | ],[ |
| 3420 | AC_MSG_RESULT(no) |
| 3421 | ]) |
Martin v. Löwis | 861a65b | 2001-10-24 14:36:00 +0000 | [diff] [blame] | 3422 | |
| 3423 | # On OSF/1 V5.1, getaddrinfo is available, but a define |
| 3424 | # for [no]getaddrinfo in netdb.h. |
| 3425 | AC_MSG_CHECKING(for getaddrinfo) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3426 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | c010b6d | 2001-11-09 17:50:52 +0000 | [diff] [blame] | 3427 | #include <sys/types.h> |
Martin v. Löwis | 861a65b | 2001-10-24 14:36:00 +0000 | [diff] [blame] | 3428 | #include <sys/socket.h> |
| 3429 | #include <netdb.h> |
Martin v. Löwis | c010b6d | 2001-11-09 17:50:52 +0000 | [diff] [blame] | 3430 | #include <stdio.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3431 | ]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], |
| 3432 | [have_getaddrinfo=yes], |
| 3433 | [have_getaddrinfo=no]) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3434 | AC_MSG_RESULT($have_getaddrinfo) |
| 3435 | if test $have_getaddrinfo = yes |
| 3436 | then |
| 3437 | AC_MSG_CHECKING(getaddrinfo bug) |
| 3438 | AC_CACHE_VAL(ac_cv_buggy_getaddrinfo, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3439 | AC_RUN_IFELSE([AC_LANG_SOURCE([[[ |
Stefan Krah | 0afe4e4 | 2012-11-22 23:56:51 +0100 | [diff] [blame] | 3440 | #include <stdio.h> |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3441 | #include <sys/types.h> |
| 3442 | #include <netdb.h> |
| 3443 | #include <string.h> |
| 3444 | #include <sys/socket.h> |
| 3445 | #include <netinet/in.h> |
| 3446 | |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3447 | int main() |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3448 | { |
| 3449 | int passive, gaierr, inet4 = 0, inet6 = 0; |
| 3450 | struct addrinfo hints, *ai, *aitop; |
| 3451 | char straddr[INET6_ADDRSTRLEN], strport[16]; |
| 3452 | |
| 3453 | for (passive = 0; passive <= 1; passive++) { |
| 3454 | memset(&hints, 0, sizeof(hints)); |
| 3455 | hints.ai_family = AF_UNSPEC; |
| 3456 | hints.ai_flags = passive ? AI_PASSIVE : 0; |
| 3457 | hints.ai_socktype = SOCK_STREAM; |
Hye-Shik Chang | 54f9439 | 2004-04-14 07:55:31 +0000 | [diff] [blame] | 3458 | hints.ai_protocol = IPPROTO_TCP; |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3459 | if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) { |
| 3460 | (void)gai_strerror(gaierr); |
| 3461 | goto bad; |
| 3462 | } |
| 3463 | for (ai = aitop; ai; ai = ai->ai_next) { |
| 3464 | if (ai->ai_addr == NULL || |
| 3465 | ai->ai_addrlen == 0 || |
| 3466 | getnameinfo(ai->ai_addr, ai->ai_addrlen, |
| 3467 | straddr, sizeof(straddr), strport, sizeof(strport), |
| 3468 | NI_NUMERICHOST|NI_NUMERICSERV) != 0) { |
| 3469 | goto bad; |
| 3470 | } |
| 3471 | switch (ai->ai_family) { |
| 3472 | case AF_INET: |
| 3473 | if (strcmp(strport, "54321") != 0) { |
| 3474 | goto bad; |
| 3475 | } |
| 3476 | if (passive) { |
| 3477 | if (strcmp(straddr, "0.0.0.0") != 0) { |
| 3478 | goto bad; |
| 3479 | } |
| 3480 | } else { |
| 3481 | if (strcmp(straddr, "127.0.0.1") != 0) { |
| 3482 | goto bad; |
| 3483 | } |
| 3484 | } |
| 3485 | inet4++; |
| 3486 | break; |
| 3487 | case AF_INET6: |
| 3488 | if (strcmp(strport, "54321") != 0) { |
| 3489 | goto bad; |
| 3490 | } |
| 3491 | if (passive) { |
| 3492 | if (strcmp(straddr, "::") != 0) { |
| 3493 | goto bad; |
| 3494 | } |
| 3495 | } else { |
| 3496 | if (strcmp(straddr, "::1") != 0) { |
| 3497 | goto bad; |
| 3498 | } |
| 3499 | } |
| 3500 | inet6++; |
| 3501 | break; |
| 3502 | case AF_UNSPEC: |
| 3503 | goto bad; |
| 3504 | break; |
| 3505 | default: |
| 3506 | /* another family support? */ |
| 3507 | break; |
| 3508 | } |
| 3509 | } |
Benjamin Peterson | d34677c | 2016-09-06 15:54:24 -0700 | [diff] [blame] | 3510 | freeaddrinfo(aitop); |
| 3511 | aitop = NULL; |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3512 | } |
| 3513 | |
| 3514 | if (!(inet4 == 0 || inet4 == 2)) |
| 3515 | goto bad; |
| 3516 | if (!(inet6 == 0 || inet6 == 2)) |
| 3517 | goto bad; |
| 3518 | |
| 3519 | if (aitop) |
| 3520 | freeaddrinfo(aitop); |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3521 | return 0; |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3522 | |
| 3523 | bad: |
| 3524 | if (aitop) |
| 3525 | freeaddrinfo(aitop); |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3526 | return 1; |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3527 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3528 | ]]])], |
| 3529 | [ac_cv_buggy_getaddrinfo=no], |
| 3530 | [ac_cv_buggy_getaddrinfo=yes], |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 3531 | [ |
| 3532 | if test "${enable_ipv6+set}" = set; then |
| 3533 | ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6" |
| 3534 | else |
| 3535 | ac_cv_buggy_getaddrinfo=yes |
| 3536 | fi])) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3537 | fi |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3538 | |
Benjamin Peterson | 75fed81 | 2010-11-01 01:47:19 +0000 | [diff] [blame] | 3539 | AC_MSG_RESULT($ac_cv_buggy_getaddrinfo) |
| 3540 | |
Mark Dickinson | 0ef0b91 | 2009-12-31 21:11:48 +0000 | [diff] [blame] | 3541 | if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3542 | then |
| 3543 | if test $ipv6 = yes |
| 3544 | then |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3545 | echo 'Fatal: You must get working getaddrinfo() function.' |
| 3546 | echo ' or you can specify "--disable-ipv6"'. |
| 3547 | exit 1 |
| 3548 | fi |
Martin v. Löwis | 861a65b | 2001-10-24 14:36:00 +0000 | [diff] [blame] | 3549 | else |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3550 | AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.]) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3551 | fi |
Benjamin Peterson | 75fed81 | 2010-11-01 01:47:19 +0000 | [diff] [blame] | 3552 | |
Thomas Wouters | b0db85a | 2001-08-08 10:39:03 +0000 | [diff] [blame] | 3553 | AC_CHECK_FUNCS(getnameinfo) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3554 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3555 | # checks for structures |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3556 | AC_HEADER_TIME |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3557 | AC_STRUCT_TM |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3558 | AC_STRUCT_TIMEZONE |
Martin v. Löwis | 60a5d72 | 2002-10-16 20:28:25 +0000 | [diff] [blame] | 3559 | AC_CHECK_MEMBERS([struct stat.st_rdev]) |
| 3560 | AC_CHECK_MEMBERS([struct stat.st_blksize]) |
Hye-Shik Chang | 5f937a7 | 2005-06-02 13:09:30 +0000 | [diff] [blame] | 3561 | AC_CHECK_MEMBERS([struct stat.st_flags]) |
Martin v. Löwis | ebd9d5b | 2005-08-09 15:00:59 +0000 | [diff] [blame] | 3562 | AC_CHECK_MEMBERS([struct stat.st_gen]) |
| 3563 | AC_CHECK_MEMBERS([struct stat.st_birthtime]) |
Martin Panter | a45120d | 2016-03-18 02:36:41 +0000 | [diff] [blame] | 3564 | AC_CHECK_MEMBERS([struct stat.st_blocks]) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3565 | |
| 3566 | AC_MSG_CHECKING(for time.h that defines altzone) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3567 | AC_CACHE_VAL(ac_cv_header_time_altzone,[ |
| 3568 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])], |
| 3569 | [ac_cv_header_time_altzone=yes], |
| 3570 | [ac_cv_header_time_altzone=no]) |
| 3571 | ]) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3572 | AC_MSG_RESULT($ac_cv_header_time_altzone) |
| 3573 | if test $ac_cv_header_time_altzone = yes; then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3574 | AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.]) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3575 | fi |
| 3576 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3577 | was_it_defined=no |
| 3578 | AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3579 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3580 | #include <sys/types.h> |
| 3581 | #include <sys/select.h> |
| 3582 | #include <sys/time.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3583 | ]], [[;]])],[ |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3584 | AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1, |
| 3585 | [Define if you can safely include both <sys/select.h> and <sys/time.h> |
| 3586 | (which you can't on SCO ODT 3.0).]) |
| 3587 | was_it_defined=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3588 | ],[]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3589 | AC_MSG_RESULT($was_it_defined) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3590 | |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3591 | AC_MSG_CHECKING(for addrinfo) |
| 3592 | AC_CACHE_VAL(ac_cv_struct_addrinfo, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3593 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])], |
| 3594 | [ac_cv_struct_addrinfo=yes], |
| 3595 | [ac_cv_struct_addrinfo=no])) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3596 | AC_MSG_RESULT($ac_cv_struct_addrinfo) |
| 3597 | if test $ac_cv_struct_addrinfo = yes; then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3598 | AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)]) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3599 | fi |
| 3600 | |
| 3601 | AC_MSG_CHECKING(for sockaddr_storage) |
| 3602 | AC_CACHE_VAL(ac_cv_struct_sockaddr_storage, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3603 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3604 | # include <sys/types.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3605 | # include <sys/socket.h>]], [[struct sockaddr_storage s]])], |
| 3606 | [ac_cv_struct_sockaddr_storage=yes], |
| 3607 | [ac_cv_struct_sockaddr_storage=no])) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3608 | AC_MSG_RESULT($ac_cv_struct_sockaddr_storage) |
| 3609 | if test $ac_cv_struct_sockaddr_storage = yes; then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3610 | AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)]) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3611 | fi |
| 3612 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3613 | # checks for compiler characteristics |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3614 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3615 | AC_C_CHAR_UNSIGNED |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3616 | AC_C_CONST |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3617 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3618 | works=no |
| 3619 | AC_MSG_CHECKING(for working volatile) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3620 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])], |
| 3621 | [works=yes], |
| 3622 | [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])] |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3623 | ) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3624 | AC_MSG_RESULT($works) |
Guido van Rossum | dabb11b | 1994-10-11 15:04:27 +0000 | [diff] [blame] | 3625 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3626 | works=no |
| 3627 | AC_MSG_CHECKING(for working signed char) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3628 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])], |
| 3629 | [works=yes], |
| 3630 | [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])] |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3631 | ) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3632 | AC_MSG_RESULT($works) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3633 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3634 | have_prototypes=no |
| 3635 | AC_MSG_CHECKING(for prototypes) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3636 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])], |
| 3637 | [AC_DEFINE(HAVE_PROTOTYPES, 1, |
| 3638 | [Define if your compiler supports function prototype]) |
| 3639 | have_prototypes=yes], |
| 3640 | [] |
| 3641 | ) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3642 | AC_MSG_RESULT($have_prototypes) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3643 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3644 | works=no |
| 3645 | AC_MSG_CHECKING(for variable length prototypes and stdarg.h) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3646 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3647 | #include <stdarg.h> |
Guido van Rossum | 3f13e48 | 1996-08-30 20:58:11 +0000 | [diff] [blame] | 3648 | int foo(int x, ...) { |
| 3649 | va_list va; |
| 3650 | va_start(va, x); |
| 3651 | va_arg(va, int); |
| 3652 | va_arg(va, char *); |
| 3653 | va_arg(va, double); |
| 3654 | return 0; |
| 3655 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3656 | ]], [[return foo(10, "", 3.14);]])],[ |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3657 | AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1, |
| 3658 | [Define if your compiler supports variable length function prototypes |
| 3659 | (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>]) |
| 3660 | works=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3661 | ],[]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3662 | AC_MSG_RESULT($works) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3663 | |
Dave Cole | 331708b | 2004-08-09 04:51:41 +0000 | [diff] [blame] | 3664 | # check for socketpair |
| 3665 | AC_MSG_CHECKING(for socketpair) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3666 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Dave Cole | 331708b | 2004-08-09 04:51:41 +0000 | [diff] [blame] | 3667 | #include <sys/types.h> |
| 3668 | #include <sys/socket.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3669 | ]], [[void *x=socketpair]])], |
| 3670 | [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.]) |
| 3671 | AC_MSG_RESULT(yes)], |
| 3672 | [AC_MSG_RESULT(no)] |
Dave Cole | 331708b | 2004-08-09 04:51:41 +0000 | [diff] [blame] | 3673 | ) |
| 3674 | |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3675 | # check if sockaddr has sa_len member |
| 3676 | AC_MSG_CHECKING(if sockaddr has sa_len member) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3677 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
| 3678 | #include <sys/socket.h>]], [[struct sockaddr x; |
| 3679 | x.sa_len = 0;]])], |
| 3680 | [AC_MSG_RESULT(yes) |
| 3681 | AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])], |
| 3682 | [AC_MSG_RESULT(no)] |
| 3683 | ) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3684 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3685 | va_list_is_array=no |
| 3686 | AC_MSG_CHECKING(whether va_list is an array) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3687 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3688 | #ifdef HAVE_STDARG_PROTOTYPES |
| 3689 | #include <stdarg.h> |
| 3690 | #else |
| 3691 | #include <varargs.h> |
| 3692 | #endif |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3693 | ]], [[va_list list1, list2; list1 = list2;]])],[],[ |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3694 | AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind]) |
| 3695 | va_list_is_array=yes |
| 3696 | ]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3697 | AC_MSG_RESULT($va_list_is_array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3698 | |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3699 | # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-( |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 3700 | AH_TEMPLATE(HAVE_GETHOSTBYNAME_R, |
| 3701 | [Define this if you have some version of gethostbyname_r()]) |
| 3702 | |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3703 | AC_CHECK_FUNC(gethostbyname_r, [ |
| 3704 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
| 3705 | AC_MSG_CHECKING([gethostbyname_r with 6 args]) |
| 3706 | OLD_CFLAGS=$CFLAGS |
| 3707 | CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3708 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3709 | # include <netdb.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3710 | ]], [[ |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3711 | char *name; |
| 3712 | struct hostent *he, *res; |
| 3713 | char buffer[2048]; |
| 3714 | int buflen = 2048; |
| 3715 | int h_errnop; |
| 3716 | |
| 3717 | (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3718 | ]])],[ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 3719 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3720 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1, |
| 3721 | [Define this if you have the 6-arg version of gethostbyname_r().]) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3722 | AC_MSG_RESULT(yes) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3723 | ],[ |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3724 | AC_MSG_RESULT(no) |
| 3725 | AC_MSG_CHECKING([gethostbyname_r with 5 args]) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3726 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3727 | # include <netdb.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3728 | ]], [[ |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3729 | char *name; |
| 3730 | struct hostent *he; |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3731 | char buffer[2048]; |
| 3732 | int buflen = 2048; |
| 3733 | int h_errnop; |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3734 | |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3735 | (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop) |
| 3736 | ]])], |
| 3737 | [ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 3738 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3739 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1, |
| 3740 | [Define this if you have the 5-arg version of gethostbyname_r().]) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3741 | AC_MSG_RESULT(yes) |
| 3742 | ], [ |
| 3743 | AC_MSG_RESULT(no) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3744 | AC_MSG_CHECKING([gethostbyname_r with 3 args]) |
| 3745 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 3746 | # include <netdb.h> |
| 3747 | ]], [[ |
| 3748 | char *name; |
| 3749 | struct hostent *he; |
| 3750 | struct hostent_data data; |
| 3751 | |
| 3752 | (void) gethostbyname_r(name, he, &data); |
| 3753 | ]])], |
| 3754 | [ |
| 3755 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
| 3756 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1, |
| 3757 | [Define this if you have the 3-arg version of gethostbyname_r().]) |
| 3758 | AC_MSG_RESULT(yes) |
| 3759 | ], [ |
| 3760 | AC_MSG_RESULT(no) |
| 3761 | ]) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3762 | ]) |
| 3763 | ]) |
| 3764 | CFLAGS=$OLD_CFLAGS |
| 3765 | ], [ |
Thomas Wouters | 3a58420 | 2000-08-05 23:28:51 +0000 | [diff] [blame] | 3766 | AC_CHECK_FUNCS(gethostbyname) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3767 | ]) |
| 3768 | AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG) |
| 3769 | AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG) |
| 3770 | AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG) |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 3771 | AC_SUBST(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3772 | AC_SUBST(HAVE_GETHOSTBYNAME) |
| 3773 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3774 | # checks for system services |
| 3775 | # (none yet) |
| 3776 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3777 | # Linux requires this for correct f.p. operations |
Jeremy Hylton | be28f5b | 2000-07-27 21:03:04 +0000 | [diff] [blame] | 3778 | AC_CHECK_FUNC(__fpu_control, |
| 3779 | [], |
| 3780 | [AC_CHECK_LIB(ieee, __fpu_control) |
| 3781 | ]) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3782 | |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3783 | # Check for --with-fpectl |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3784 | AC_MSG_CHECKING(for --with-fpectl) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 3785 | AC_ARG_WITH(fpectl, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3786 | AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3787 | [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3788 | if test "$withval" != no |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3789 | then |
| 3790 | AC_DEFINE(WANT_SIGFPE_HANDLER, 1, |
| 3791 | [Define if you want SIGFPE handled (see Include/pyfpe.h).]) |
| 3792 | AC_MSG_RESULT(yes) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3793 | else AC_MSG_RESULT(no) |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 3794 | fi], |
| 3795 | [AC_MSG_RESULT(no)]) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3796 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3797 | # check for --with-libm=... |
| 3798 | AC_SUBST(LIBM) |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 3799 | case $ac_sys_system in |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 3800 | Darwin) ;; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 3801 | BeOS) ;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 3802 | *) LIBM=-lm |
| 3803 | esac |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3804 | AC_MSG_CHECKING(for --with-libm=STRING) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3805 | AC_ARG_WITH(libm, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3806 | AS_HELP_STRING([--with-libm=STRING], [math library]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3807 | [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3808 | if test "$withval" = no |
| 3809 | then LIBM= |
| 3810 | AC_MSG_RESULT(force LIBM empty) |
| 3811 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3812 | then LIBM=$withval |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3813 | AC_MSG_RESULT(set LIBM="$withval") |
| 3814 | else AC_MSG_ERROR([proper usage is --with-libm=STRING]) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3815 | fi], |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3816 | [AC_MSG_RESULT(default LIBM="$LIBM")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3817 | |
| 3818 | # check for --with-libc=... |
| 3819 | AC_SUBST(LIBC) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3820 | AC_MSG_CHECKING(for --with-libc=STRING) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3821 | AC_ARG_WITH(libc, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3822 | AS_HELP_STRING([--with-libc=STRING], [C library]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3823 | [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3824 | if test "$withval" = no |
| 3825 | then LIBC= |
| 3826 | AC_MSG_RESULT(force LIBC empty) |
| 3827 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3828 | then LIBC=$withval |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3829 | AC_MSG_RESULT(set LIBC="$withval") |
| 3830 | else AC_MSG_ERROR([proper usage is --with-libc=STRING]) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3831 | fi], |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3832 | [AC_MSG_RESULT(default LIBC="$LIBC")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3833 | |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3834 | # ************************************************** |
| 3835 | # * Check for various properties of floating point * |
| 3836 | # ************************************************** |
Mark Dickinson | 265d738 | 2008-04-21 22:32:24 +0000 | [diff] [blame] | 3837 | |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3838 | AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64) |
| 3839 | AC_CACHE_VAL(ac_cv_little_endian_double, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3840 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3841 | #include <string.h> |
| 3842 | int main() { |
| 3843 | double x = 9006104071832581.0; |
| 3844 | if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0) |
| 3845 | return 0; |
| 3846 | else |
| 3847 | return 1; |
| 3848 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3849 | ]])], |
| 3850 | [ac_cv_little_endian_double=yes], |
| 3851 | [ac_cv_little_endian_double=no], |
| 3852 | [ac_cv_little_endian_double=no])]) |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3853 | AC_MSG_RESULT($ac_cv_little_endian_double) |
| 3854 | if test "$ac_cv_little_endian_double" = yes |
| 3855 | then |
| 3856 | AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1, |
| 3857 | [Define if C doubles are 64-bit IEEE 754 binary format, stored |
| 3858 | with the least significant byte first]) |
| 3859 | fi |
| 3860 | |
| 3861 | AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64) |
| 3862 | AC_CACHE_VAL(ac_cv_big_endian_double, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3863 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3864 | #include <string.h> |
| 3865 | int main() { |
| 3866 | double x = 9006104071832581.0; |
| 3867 | if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0) |
| 3868 | return 0; |
| 3869 | else |
| 3870 | return 1; |
| 3871 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3872 | ]])], |
| 3873 | [ac_cv_big_endian_double=yes], |
| 3874 | [ac_cv_big_endian_double=no], |
| 3875 | [ac_cv_big_endian_double=no])]) |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3876 | AC_MSG_RESULT($ac_cv_big_endian_double) |
| 3877 | if test "$ac_cv_big_endian_double" = yes |
| 3878 | then |
| 3879 | AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1, |
| 3880 | [Define if C doubles are 64-bit IEEE 754 binary format, stored |
| 3881 | with the most significant byte first]) |
| 3882 | fi |
| 3883 | |
| 3884 | # Some ARM platforms use a mixed-endian representation for doubles. |
| 3885 | # While Python doesn't currently have full support for these platforms |
| 3886 | # (see e.g., issue 1762561), we can at least make sure that float <-> string |
| 3887 | # conversions work. |
| 3888 | AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64) |
| 3889 | AC_CACHE_VAL(ac_cv_mixed_endian_double, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3890 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3891 | #include <string.h> |
| 3892 | int main() { |
| 3893 | double x = 9006104071832581.0; |
| 3894 | if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0) |
| 3895 | return 0; |
| 3896 | else |
| 3897 | return 1; |
| 3898 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3899 | ]])], |
| 3900 | [ac_cv_mixed_endian_double=yes], |
| 3901 | [ac_cv_mixed_endian_double=no], |
| 3902 | [ac_cv_mixed_endian_double=no])]) |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3903 | AC_MSG_RESULT($ac_cv_mixed_endian_double) |
| 3904 | if test "$ac_cv_mixed_endian_double" = yes |
| 3905 | then |
| 3906 | AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1, |
| 3907 | [Define if C doubles are 64-bit IEEE 754 binary format, stored |
| 3908 | in ARM mixed-endian order (byte order 45670123)]) |
| 3909 | fi |
| 3910 | |
| 3911 | # The short float repr introduced in Python 3.1 requires the |
| 3912 | # correctly-rounded string <-> double conversion functions from |
| 3913 | # Python/dtoa.c, which in turn require that the FPU uses 53-bit |
| 3914 | # rounding; this is a problem on x86, where the x87 FPU has a default |
Mark Dickinson | a548dee | 2009-11-15 13:12:43 +0000 | [diff] [blame] | 3915 | # rounding precision of 64 bits. For gcc/x86, we can fix this by |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3916 | # using inline assembler to get and set the x87 FPU control word. |
Mark Dickinson | a548dee | 2009-11-15 13:12:43 +0000 | [diff] [blame] | 3917 | |
| 3918 | # This inline assembler syntax may also work for suncc and icc, |
| 3919 | # so we try it on all platforms. |
| 3920 | |
| 3921 | AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word) |
Stefan Krah | 99e36b9 | 2015-07-03 15:30:54 +0200 | [diff] [blame] | 3922 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ |
Mark Dickinson | a548dee | 2009-11-15 13:12:43 +0000 | [diff] [blame] | 3923 | unsigned short cw; |
| 3924 | __asm__ __volatile__ ("fnstcw %0" : "=m" (cw)); |
| 3925 | __asm__ __volatile__ ("fldcw %0" : : "m" (cw)); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3926 | ]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no]) |
Mark Dickinson | a548dee | 2009-11-15 13:12:43 +0000 | [diff] [blame] | 3927 | AC_MSG_RESULT($have_gcc_asm_for_x87) |
| 3928 | if test "$have_gcc_asm_for_x87" = yes |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3929 | then |
Mark Dickinson | a548dee | 2009-11-15 13:12:43 +0000 | [diff] [blame] | 3930 | AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1, |
| 3931 | [Define if we can use gcc inline assembler to get and set x87 control word]) |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3932 | fi |
Mark Dickinson | 7a3d864 | 2008-04-22 00:54:27 +0000 | [diff] [blame] | 3933 | |
Mark Dickinson | 04b2723 | 2009-01-04 12:29:36 +0000 | [diff] [blame] | 3934 | # Detect whether system arithmetic is subject to x87-style double |
| 3935 | # rounding issues. The result of this test has little meaning on non |
| 3936 | # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding |
| 3937 | # mode is round-to-nearest and double rounding issues are present, and |
| 3938 | # 0 otherwise. See http://bugs.python.org/issue2937 for more info. |
| 3939 | AC_MSG_CHECKING(for x87-style double rounding) |
Mark Dickinson | 99abd14 | 2009-10-24 13:44:16 +0000 | [diff] [blame] | 3940 | # $BASECFLAGS may affect the result |
| 3941 | ac_save_cc="$CC" |
| 3942 | CC="$CC $BASECFLAGS" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3943 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | 04b2723 | 2009-01-04 12:29:36 +0000 | [diff] [blame] | 3944 | #include <stdlib.h> |
| 3945 | #include <math.h> |
| 3946 | int main() { |
| 3947 | volatile double x, y, z; |
| 3948 | /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */ |
| 3949 | x = 0.99999999999999989; /* 1-2**-53 */ |
| 3950 | y = 1./x; |
| 3951 | if (y != 1.) |
| 3952 | exit(0); |
| 3953 | /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */ |
| 3954 | x = 1e16; |
| 3955 | y = 2.99999; |
| 3956 | z = x + y; |
| 3957 | if (z != 1e16+4.) |
| 3958 | exit(0); |
| 3959 | /* both tests show evidence of double rounding */ |
| 3960 | exit(1); |
| 3961 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3962 | ]])], |
| 3963 | [ac_cv_x87_double_rounding=no], |
| 3964 | [ac_cv_x87_double_rounding=yes], |
| 3965 | [ac_cv_x87_double_rounding=no]) |
Mark Dickinson | 99abd14 | 2009-10-24 13:44:16 +0000 | [diff] [blame] | 3966 | CC="$ac_save_cc" |
Mark Dickinson | 04b2723 | 2009-01-04 12:29:36 +0000 | [diff] [blame] | 3967 | AC_MSG_RESULT($ac_cv_x87_double_rounding) |
| 3968 | if test "$ac_cv_x87_double_rounding" = yes |
| 3969 | then |
| 3970 | AC_DEFINE(X87_DOUBLE_ROUNDING, 1, |
| 3971 | [Define if arithmetic is subject to x87-style double rounding issue]) |
| 3972 | fi |
| 3973 | |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3974 | # ************************************ |
| 3975 | # * Check for mathematical functions * |
| 3976 | # ************************************ |
| 3977 | |
| 3978 | LIBS_SAVE=$LIBS |
| 3979 | LIBS="$LIBS $LIBM" |
| 3980 | |
Mark Dickinson | c63392c | 2009-11-28 13:13:13 +0000 | [diff] [blame] | 3981 | # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of |
| 3982 | # -0. on some architectures. |
| 3983 | AC_MSG_CHECKING(whether tanh preserves the sign of zero) |
| 3984 | AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3985 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | c63392c | 2009-11-28 13:13:13 +0000 | [diff] [blame] | 3986 | #include <math.h> |
| 3987 | #include <stdlib.h> |
| 3988 | int main() { |
| 3989 | /* return 0 if either negative zeros don't exist |
| 3990 | on this platform or if negative zeros exist |
| 3991 | and tanh(-0.) == -0. */ |
| 3992 | if (atan2(0., -1.) == atan2(-0., -1.) || |
| 3993 | atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0); |
| 3994 | else exit(1); |
| 3995 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3996 | ]])], |
| 3997 | [ac_cv_tanh_preserves_zero_sign=yes], |
| 3998 | [ac_cv_tanh_preserves_zero_sign=no], |
| 3999 | [ac_cv_tanh_preserves_zero_sign=no])]) |
Mark Dickinson | c63392c | 2009-11-28 13:13:13 +0000 | [diff] [blame] | 4000 | AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign) |
| 4001 | if test "$ac_cv_tanh_preserves_zero_sign" = yes |
| 4002 | then |
| 4003 | AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1, |
| 4004 | [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros]) |
| 4005 | fi |
| 4006 | |
| 4007 | AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma]) |
| 4008 | AC_CHECK_FUNCS([hypot lgamma log1p round tgamma]) |
| 4009 | AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]]) |
| 4010 | |
| 4011 | LIBS=$LIBS_SAVE |
| 4012 | |
Mark Dickinson | c4920e8 | 2009-11-20 19:30:22 +0000 | [diff] [blame] | 4013 | # For multiprocessing module, check that sem_open |
| 4014 | # actually works. For FreeBSD versions <= 7.2, |
| 4015 | # the kernel module that provides POSIX semaphores |
| 4016 | # isn't loaded by default, so an attempt to call |
| 4017 | # sem_open results in a 'Signal 12' error. |
| 4018 | AC_MSG_CHECKING(whether POSIX semaphores are enabled) |
| 4019 | AC_CACHE_VAL(ac_cv_posix_semaphores_enabled, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4020 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | c4920e8 | 2009-11-20 19:30:22 +0000 | [diff] [blame] | 4021 | #include <unistd.h> |
| 4022 | #include <fcntl.h> |
| 4023 | #include <stdio.h> |
| 4024 | #include <semaphore.h> |
| 4025 | #include <sys/stat.h> |
| 4026 | |
| 4027 | int main(void) { |
| 4028 | sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0); |
| 4029 | if (a == SEM_FAILED) { |
| 4030 | perror("sem_open"); |
| 4031 | return 1; |
| 4032 | } |
| 4033 | sem_close(a); |
Mark Dickinson | 59dc89e | 2009-12-13 21:06:06 +0000 | [diff] [blame] | 4034 | sem_unlink("/autoconf"); |
Mark Dickinson | c4920e8 | 2009-11-20 19:30:22 +0000 | [diff] [blame] | 4035 | return 0; |
| 4036 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4037 | ]])], |
| 4038 | [ac_cv_posix_semaphores_enabled=yes], |
| 4039 | [ac_cv_posix_semaphores_enabled=no], |
| 4040 | [ac_cv_posix_semaphores_enabled=yes]) |
Mark Dickinson | c4920e8 | 2009-11-20 19:30:22 +0000 | [diff] [blame] | 4041 | ) |
| 4042 | AC_MSG_RESULT($ac_cv_posix_semaphores_enabled) |
| 4043 | if test $ac_cv_posix_semaphores_enabled = no |
| 4044 | then |
Mark Dickinson | 5afa6d4 | 2009-11-28 10:44:20 +0000 | [diff] [blame] | 4045 | AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1, |
| 4046 | [Define if POSIX semaphores aren't enabled on your system]) |
Mark Dickinson | c4920e8 | 2009-11-20 19:30:22 +0000 | [diff] [blame] | 4047 | fi |
| 4048 | |
Jesse Noller | 355b126 | 2009-04-02 00:03:28 +0000 | [diff] [blame] | 4049 | # Multiprocessing check for broken sem_getvalue |
| 4050 | AC_MSG_CHECKING(for broken sem_getvalue) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 4051 | AC_CACHE_VAL(ac_cv_broken_sem_getvalue, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4052 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Jesse Noller | 355b126 | 2009-04-02 00:03:28 +0000 | [diff] [blame] | 4053 | #include <unistd.h> |
| 4054 | #include <fcntl.h> |
| 4055 | #include <stdio.h> |
| 4056 | #include <semaphore.h> |
| 4057 | #include <sys/stat.h> |
| 4058 | |
| 4059 | int main(void){ |
Mark Dickinson | 59dc89e | 2009-12-13 21:06:06 +0000 | [diff] [blame] | 4060 | sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0); |
Jesse Noller | 355b126 | 2009-04-02 00:03:28 +0000 | [diff] [blame] | 4061 | int count; |
| 4062 | int res; |
| 4063 | if(a==SEM_FAILED){ |
| 4064 | perror("sem_open"); |
| 4065 | return 1; |
| 4066 | |
| 4067 | } |
| 4068 | res = sem_getvalue(a, &count); |
| 4069 | sem_close(a); |
Mark Dickinson | 59dc89e | 2009-12-13 21:06:06 +0000 | [diff] [blame] | 4070 | sem_unlink("/autocftw"); |
Jesse Noller | 355b126 | 2009-04-02 00:03:28 +0000 | [diff] [blame] | 4071 | return res==-1 ? 1 : 0; |
| 4072 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4073 | ]])], |
| 4074 | [ac_cv_broken_sem_getvalue=no], |
| 4075 | [ac_cv_broken_sem_getvalue=yes], |
| 4076 | [ac_cv_broken_sem_getvalue=yes]) |
Jesse Noller | 355b126 | 2009-04-02 00:03:28 +0000 | [diff] [blame] | 4077 | ) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 4078 | AC_MSG_RESULT($ac_cv_broken_sem_getvalue) |
| 4079 | if test $ac_cv_broken_sem_getvalue = yes |
| 4080 | then |
| 4081 | AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1, |
| 4082 | [define to 1 if your sem_getvalue is broken.]) |
| 4083 | fi |
Mark Dickinson | 04b2723 | 2009-01-04 12:29:36 +0000 | [diff] [blame] | 4084 | |
Mark Dickinson | efc82f7 | 2009-03-20 15:51:55 +0000 | [diff] [blame] | 4085 | # determine what size digit to use for Python's longs |
| 4086 | AC_MSG_CHECKING([digit size for Python's longs]) |
| 4087 | AC_ARG_ENABLE(big-digits, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 4088 | AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]), |
Mark Dickinson | efc82f7 | 2009-03-20 15:51:55 +0000 | [diff] [blame] | 4089 | [case $enable_big_digits in |
| 4090 | yes) |
| 4091 | enable_big_digits=30 ;; |
| 4092 | no) |
| 4093 | enable_big_digits=15 ;; |
| 4094 | [15|30]) |
| 4095 | ;; |
| 4096 | *) |
| 4097 | AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;; |
| 4098 | esac |
| 4099 | AC_MSG_RESULT($enable_big_digits) |
| 4100 | AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits]) |
| 4101 | ], |
| 4102 | [AC_MSG_RESULT(no value specified)]) |
| 4103 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 4104 | # check for wchar.h |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4105 | AC_CHECK_HEADER(wchar.h, [ |
| 4106 | AC_DEFINE(HAVE_WCHAR_H, 1, |
| 4107 | [Define if the compiler provides a wchar.h header file.]) |
| 4108 | wchar_h="yes" |
| 4109 | ], |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 4110 | wchar_h="no" |
| 4111 | ) |
| 4112 | |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4113 | # determine wchar_t size |
| 4114 | if test "$wchar_h" = yes |
| 4115 | then |
Guido van Rossum | 67b2659 | 2001-10-20 14:21:45 +0000 | [diff] [blame] | 4116 | AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>]) |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4117 | fi |
| 4118 | |
Martin v. Löwis | fa3bdea | 2003-09-04 18:50:54 +0000 | [diff] [blame] | 4119 | AC_MSG_CHECKING(for UCS-4 tcl) |
| 4120 | have_ucs4_tcl=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4121 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | fa3bdea | 2003-09-04 18:50:54 +0000 | [diff] [blame] | 4122 | #include <tcl.h> |
| 4123 | #if TCL_UTF_MAX != 6 |
| 4124 | # error "NOT UCS4_TCL" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4125 | #endif]], [[]])],[ |
Martin v. Löwis | fa3bdea | 2003-09-04 18:50:54 +0000 | [diff] [blame] | 4126 | AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6]) |
| 4127 | have_ucs4_tcl=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4128 | ],[]) |
Martin v. Löwis | fa3bdea | 2003-09-04 18:50:54 +0000 | [diff] [blame] | 4129 | AC_MSG_RESULT($have_ucs4_tcl) |
| 4130 | |
Marc-André Lemburg | d7160f8 | 2003-09-22 11:14:40 +0000 | [diff] [blame] | 4131 | # check whether wchar_t is signed or not |
| 4132 | if test "$wchar_h" = yes |
| 4133 | then |
| 4134 | # check whether wchar_t is signed or not |
| 4135 | AC_MSG_CHECKING(whether wchar_t is signed) |
| 4136 | AC_CACHE_VAL(ac_cv_wchar_t_signed, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4137 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Marc-André Lemburg | d7160f8 | 2003-09-22 11:14:40 +0000 | [diff] [blame] | 4138 | #include <wchar.h> |
| 4139 | int main() |
| 4140 | { |
Martin v. Löwis | 44fe0e4 | 2006-04-11 07:15:30 +0000 | [diff] [blame] | 4141 | /* Success: exit code 0 */ |
| 4142 | exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1); |
Marc-André Lemburg | d7160f8 | 2003-09-22 11:14:40 +0000 | [diff] [blame] | 4143 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4144 | ]])], |
| 4145 | [ac_cv_wchar_t_signed=yes], |
| 4146 | [ac_cv_wchar_t_signed=no], |
| 4147 | [ac_cv_wchar_t_signed=yes])]) |
Marc-André Lemburg | d7160f8 | 2003-09-22 11:14:40 +0000 | [diff] [blame] | 4148 | AC_MSG_RESULT($ac_cv_wchar_t_signed) |
| 4149 | fi |
| 4150 | |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4151 | AC_MSG_CHECKING(what type to use for unicode) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 4152 | dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4153 | AC_ARG_ENABLE(unicode, |
Benjamin Peterson | 66556b0 | 2010-05-25 02:23:32 +0000 | [diff] [blame] | 4154 | AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is ucs2)]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 4155 | [], |
| 4156 | [enable_unicode=yes]) |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4157 | |
| 4158 | if test $enable_unicode = yes |
| 4159 | then |
Martin v. Löwis | fd91779 | 2001-06-27 20:22:04 +0000 | [diff] [blame] | 4160 | # Without any arguments, Py_UNICODE defaults to two-byte mode |
Martin v. Löwis | fa3bdea | 2003-09-04 18:50:54 +0000 | [diff] [blame] | 4161 | case "$have_ucs4_tcl" in |
| 4162 | yes) enable_unicode="ucs4" |
| 4163 | ;; |
| 4164 | *) enable_unicode="ucs2" |
| 4165 | ;; |
| 4166 | esac |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4167 | fi |
| 4168 | |
Martin v. Löwis | 0036cba | 2002-04-12 09:58:45 +0000 | [diff] [blame] | 4169 | AH_TEMPLATE(Py_UNICODE_SIZE, |
| 4170 | [Define as the size of the unicode type.]) |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4171 | case "$enable_unicode" in |
| 4172 | ucs2) unicode_size="2" |
| 4173 | AC_DEFINE(Py_UNICODE_SIZE,2) |
| 4174 | ;; |
| 4175 | ucs4) unicode_size="4" |
| 4176 | AC_DEFINE(Py_UNICODE_SIZE,4) |
| 4177 | ;; |
Martin v. Löwis | ed11a5d | 2012-05-20 10:42:17 +0200 | [diff] [blame] | 4178 | no) ;; # To allow --disable-unicode |
Ezio Melotti | 5820efb | 2010-02-27 00:05:42 +0000 | [diff] [blame] | 4179 | *) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;; |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4180 | esac |
| 4181 | |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 4182 | AH_TEMPLATE(PY_UNICODE_TYPE, |
| 4183 | [Define as the integral type used for Unicode representation.]) |
Martin v. Löwis | 0036cba | 2002-04-12 09:58:45 +0000 | [diff] [blame] | 4184 | |
Martin v. Löwis | 339d0f7 | 2001-08-17 18:39:25 +0000 | [diff] [blame] | 4185 | AC_SUBST(UNICODE_OBJS) |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4186 | if test "$enable_unicode" = "no" |
| 4187 | then |
Martin v. Löwis | 339d0f7 | 2001-08-17 18:39:25 +0000 | [diff] [blame] | 4188 | UNICODE_OBJS="" |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4189 | AC_MSG_RESULT(not used) |
| 4190 | else |
Martin v. Löwis | 339d0f7 | 2001-08-17 18:39:25 +0000 | [diff] [blame] | 4191 | UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o" |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4192 | AC_DEFINE(Py_USING_UNICODE, 1, |
| 4193 | [Define if you want to have a Unicode type.]) |
Marc-André Lemburg | d7160f8 | 2003-09-22 11:14:40 +0000 | [diff] [blame] | 4194 | |
| 4195 | # wchar_t is only usable if it maps to an unsigned type |
| 4196 | if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \ |
Matthias Klose | 7dbeed7 | 2004-12-24 08:22:17 +0000 | [diff] [blame] | 4197 | -a "$ac_cv_wchar_t_signed" = "no" |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4198 | then |
| 4199 | PY_UNICODE_TYPE="wchar_t" |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4200 | AC_DEFINE(HAVE_USABLE_WCHAR_T, 1, |
| 4201 | [Define if you have a useable wchar_t type defined in wchar.h; useable |
Marc-André Lemburg | d7160f8 | 2003-09-22 11:14:40 +0000 | [diff] [blame] | 4202 | means wchar_t must be an unsigned type with at least 16 bits. (see |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4203 | Include/unicodeobject.h).]) |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4204 | AC_DEFINE(PY_UNICODE_TYPE,wchar_t) |
| 4205 | elif test "$ac_cv_sizeof_short" = "$unicode_size" |
| 4206 | then |
| 4207 | PY_UNICODE_TYPE="unsigned short" |
| 4208 | AC_DEFINE(PY_UNICODE_TYPE,unsigned short) |
| 4209 | elif test "$ac_cv_sizeof_long" = "$unicode_size" |
| 4210 | then |
| 4211 | PY_UNICODE_TYPE="unsigned long" |
| 4212 | AC_DEFINE(PY_UNICODE_TYPE,unsigned long) |
| 4213 | else |
| 4214 | PY_UNICODE_TYPE="no type found" |
| 4215 | fi |
| 4216 | AC_MSG_RESULT($PY_UNICODE_TYPE) |
| 4217 | fi |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 4218 | |
| 4219 | # check for endianness |
| 4220 | AC_C_BIGENDIAN |
| 4221 | |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 4222 | # Check whether right shifting a negative integer extends the sign bit |
| 4223 | # or fills with zeros (like the Cray J90, according to Tim Peters). |
| 4224 | AC_MSG_CHECKING(whether right shift extends the sign bit) |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 4225 | AC_CACHE_VAL(ac_cv_rshift_extends_sign, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4226 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 4227 | int main() |
| 4228 | { |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 4229 | exit(((-1)>>3 == -1) ? 0 : 1); |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 4230 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4231 | ]])], |
| 4232 | [ac_cv_rshift_extends_sign=yes], |
| 4233 | [ac_cv_rshift_extends_sign=no], |
| 4234 | [ac_cv_rshift_extends_sign=yes])]) |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 4235 | AC_MSG_RESULT($ac_cv_rshift_extends_sign) |
| 4236 | if test "$ac_cv_rshift_extends_sign" = no |
| 4237 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4238 | AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1, |
| 4239 | [Define if i>>j for signed int i does not extend the sign bit |
| 4240 | when i < 0]) |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 4241 | fi |
| 4242 | |
Guido van Rossum | cadfaec | 2001-01-05 14:45:49 +0000 | [diff] [blame] | 4243 | # check for getc_unlocked and related locking functions |
| 4244 | AC_MSG_CHECKING(for getc_unlocked() and friends) |
| 4245 | AC_CACHE_VAL(ac_cv_have_getc_unlocked, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4246 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[ |
Guido van Rossum | cadfaec | 2001-01-05 14:45:49 +0000 | [diff] [blame] | 4247 | FILE *f = fopen("/dev/null", "r"); |
| 4248 | flockfile(f); |
| 4249 | getc_unlocked(f); |
| 4250 | funlockfile(f); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4251 | ]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])]) |
Guido van Rossum | cadfaec | 2001-01-05 14:45:49 +0000 | [diff] [blame] | 4252 | AC_MSG_RESULT($ac_cv_have_getc_unlocked) |
| 4253 | if test "$ac_cv_have_getc_unlocked" = yes |
| 4254 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4255 | AC_DEFINE(HAVE_GETC_UNLOCKED, 1, |
| 4256 | [Define this if you have flockfile(), getc_unlocked(), and funlockfile()]) |
Guido van Rossum | cadfaec | 2001-01-05 14:45:49 +0000 | [diff] [blame] | 4257 | fi |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 4258 | |
Neal Norwitz | fe8e3d9 | 2006-01-07 21:07:20 +0000 | [diff] [blame] | 4259 | # check where readline lives |
Martin v. Löwis | 82bca63 | 2006-02-10 20:49:30 +0000 | [diff] [blame] | 4260 | # save the value of LIBS so we don't actually link Python with readline |
| 4261 | LIBS_no_readline=$LIBS |
Gregory P. Smith | 980b99b | 2008-09-07 05:15:18 +0000 | [diff] [blame] | 4262 | |
| 4263 | # On some systems we need to link readline to a termcap compatible |
| 4264 | # library. NOTE: Keep the precedence of listed libraries synchronised |
| 4265 | # with setup.py. |
| 4266 | py_cv_lib_readline=no |
| 4267 | AC_MSG_CHECKING([how to link readline libs]) |
| 4268 | for py_libtermcap in "" ncursesw ncurses curses termcap; do |
| 4269 | if test -z "$py_libtermcap"; then |
| 4270 | READLINE_LIBS="-lreadline" |
| 4271 | else |
| 4272 | READLINE_LIBS="-lreadline -l$py_libtermcap" |
| 4273 | fi |
| 4274 | LIBS="$READLINE_LIBS $LIBS_no_readline" |
| 4275 | AC_LINK_IFELSE( |
| 4276 | [AC_LANG_CALL([],[readline])], |
| 4277 | [py_cv_lib_readline=yes]) |
| 4278 | if test $py_cv_lib_readline = yes; then |
| 4279 | break |
| 4280 | fi |
| 4281 | done |
| 4282 | # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts |
| 4283 | #AC_SUBST([READLINE_LIBS]) |
Gregory P. Smith | 29ec750 | 2008-09-07 19:18:16 +0000 | [diff] [blame] | 4284 | if test $py_cv_lib_readline = no; then |
Gregory P. Smith | 980b99b | 2008-09-07 05:15:18 +0000 | [diff] [blame] | 4285 | AC_MSG_RESULT([none]) |
| 4286 | else |
| 4287 | AC_MSG_RESULT([$READLINE_LIBS]) |
| 4288 | AC_DEFINE(HAVE_LIBREADLINE, 1, |
| 4289 | [Define if you have the readline library (-lreadline).]) |
Neal Norwitz | fe8e3d9 | 2006-01-07 21:07:20 +0000 | [diff] [blame] | 4290 | fi |
| 4291 | |
Michael W. Hudson | 30ea2f2 | 2004-07-07 17:44:12 +0000 | [diff] [blame] | 4292 | # check for readline 2.1 |
| 4293 | AC_CHECK_LIB(readline, rl_callback_handler_install, |
| 4294 | AC_DEFINE(HAVE_RL_CALLBACK, 1, |
Gregory P. Smith | ff7b2d5 | 2008-09-03 05:57:48 +0000 | [diff] [blame] | 4295 | [Define if you have readline 2.1]), ,$READLINE_LIBS) |
Michael W. Hudson | 30ea2f2 | 2004-07-07 17:44:12 +0000 | [diff] [blame] | 4296 | |
Guido van Rossum | faf5e4d | 2002-12-30 16:25:41 +0000 | [diff] [blame] | 4297 | # check for readline 2.2 |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4298 | AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])], |
| 4299 | [have_readline=yes], |
| 4300 | [have_readline=no] |
| 4301 | ) |
Guido van Rossum | faf5e4d | 2002-12-30 16:25:41 +0000 | [diff] [blame] | 4302 | if test $have_readline = yes |
| 4303 | then |
| 4304 | AC_EGREP_HEADER([extern int rl_completion_append_character;], |
| 4305 | [readline/readline.h], |
| 4306 | AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1, |
| 4307 | [Define if you have readline 2.2]), ) |
Antoine Pitrou | d9ff74e | 2009-10-26 19:16:46 +0000 | [diff] [blame] | 4308 | AC_EGREP_HEADER([extern int rl_completion_suppress_append;], |
| 4309 | [readline/readline.h], |
| 4310 | AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1, |
| 4311 | [Define if you have rl_completion_suppress_append]), ) |
Guido van Rossum | faf5e4d | 2002-12-30 16:25:41 +0000 | [diff] [blame] | 4312 | fi |
| 4313 | |
Martin v. Löwis | 0daad59 | 2001-09-30 21:09:59 +0000 | [diff] [blame] | 4314 | # check for readline 4.0 |
| 4315 | AC_CHECK_LIB(readline, rl_pre_input_hook, |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4316 | AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1, |
Gregory P. Smith | ff7b2d5 | 2008-09-03 05:57:48 +0000 | [diff] [blame] | 4317 | [Define if you have readline 4.0]), ,$READLINE_LIBS) |
Martin v. Löwis | 0daad59 | 2001-09-30 21:09:59 +0000 | [diff] [blame] | 4318 | |
Martin v. Löwis | 58bd49f | 2007-09-04 13:13:14 +0000 | [diff] [blame] | 4319 | # also in 4.0 |
| 4320 | AC_CHECK_LIB(readline, rl_completion_display_matches_hook, |
| 4321 | AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1, |
Gregory P. Smith | ff7b2d5 | 2008-09-03 05:57:48 +0000 | [diff] [blame] | 4322 | [Define if you have readline 4.0]), ,$READLINE_LIBS) |
Martin v. Löwis | 58bd49f | 2007-09-04 13:13:14 +0000 | [diff] [blame] | 4323 | |
Martin Panter | a70c323 | 2016-04-03 02:54:58 +0000 | [diff] [blame] | 4324 | # also in 4.0, but not in editline |
| 4325 | AC_CHECK_LIB(readline, rl_resize_terminal, |
| 4326 | AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1, |
| 4327 | [Define if you have readline 4.0]), ,$READLINE_LIBS) |
| 4328 | |
Guido van Rossum | 353ae58 | 2001-07-10 16:45:32 +0000 | [diff] [blame] | 4329 | # check for readline 4.2 |
| 4330 | AC_CHECK_LIB(readline, rl_completion_matches, |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4331 | AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, |
Gregory P. Smith | ff7b2d5 | 2008-09-03 05:57:48 +0000 | [diff] [blame] | 4332 | [Define if you have readline 4.2]), ,$READLINE_LIBS) |
Guido van Rossum | 353ae58 | 2001-07-10 16:45:32 +0000 | [diff] [blame] | 4333 | |
Michael W. Hudson | 30ea2f2 | 2004-07-07 17:44:12 +0000 | [diff] [blame] | 4334 | # also in readline 4.2 |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4335 | AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])], |
| 4336 | [have_readline=yes], |
| 4337 | [have_readline=no] |
| 4338 | ) |
Michael W. Hudson | 30ea2f2 | 2004-07-07 17:44:12 +0000 | [diff] [blame] | 4339 | if test $have_readline = yes |
| 4340 | then |
| 4341 | AC_EGREP_HEADER([extern int rl_catch_signals;], |
| 4342 | [readline/readline.h], |
| 4343 | AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1, |
| 4344 | [Define if you can turn off readline's signal handling.]), ) |
| 4345 | fi |
| 4346 | |
Martin v. Löwis | 82bca63 | 2006-02-10 20:49:30 +0000 | [diff] [blame] | 4347 | # End of readline checks: restore LIBS |
| 4348 | LIBS=$LIBS_no_readline |
| 4349 | |
Thomas Wouters | e38b2f1 | 2001-07-11 22:35:31 +0000 | [diff] [blame] | 4350 | AC_MSG_CHECKING(for broken nice()) |
| 4351 | AC_CACHE_VAL(ac_cv_broken_nice, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4352 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Thomas Wouters | e38b2f1 | 2001-07-11 22:35:31 +0000 | [diff] [blame] | 4353 | int main() |
| 4354 | { |
| 4355 | int val1 = nice(1); |
| 4356 | if (val1 != -1 && val1 == nice(2)) |
| 4357 | exit(0); |
| 4358 | exit(1); |
| 4359 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4360 | ]])], |
| 4361 | [ac_cv_broken_nice=yes], |
| 4362 | [ac_cv_broken_nice=no], |
| 4363 | [ac_cv_broken_nice=no])]) |
Thomas Wouters | e38b2f1 | 2001-07-11 22:35:31 +0000 | [diff] [blame] | 4364 | AC_MSG_RESULT($ac_cv_broken_nice) |
| 4365 | if test "$ac_cv_broken_nice" = yes |
| 4366 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4367 | AC_DEFINE(HAVE_BROKEN_NICE, 1, |
| 4368 | [Define if nice() returns success/failure instead of the new priority.]) |
Thomas Wouters | e38b2f1 | 2001-07-11 22:35:31 +0000 | [diff] [blame] | 4369 | fi |
| 4370 | |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4371 | AC_MSG_CHECKING(for broken poll()) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 4372 | AC_CACHE_VAL(ac_cv_broken_poll, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4373 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4374 | #include <poll.h> |
| 4375 | |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4376 | int main() |
| 4377 | { |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4378 | struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 }; |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4379 | int poll_test; |
| 4380 | |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4381 | close (42); |
| 4382 | |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4383 | poll_test = poll(&poll_struct, 1, 0); |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4384 | if (poll_test < 0) |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4385 | return 0; |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4386 | else if (poll_test == 0 && poll_struct.revents != POLLNVAL) |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4387 | return 0; |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4388 | else |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4389 | return 1; |
| 4390 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4391 | ]])], |
| 4392 | [ac_cv_broken_poll=yes], |
| 4393 | [ac_cv_broken_poll=no], |
| 4394 | [ac_cv_broken_poll=no])) |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4395 | AC_MSG_RESULT($ac_cv_broken_poll) |
| 4396 | if test "$ac_cv_broken_poll" = yes |
| 4397 | then |
| 4398 | AC_DEFINE(HAVE_BROKEN_POLL, 1, |
| 4399 | [Define if poll() sets errno on invalid file descriptors.]) |
| 4400 | fi |
| 4401 | |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4402 | # Before we can test tzset, we need to check if struct tm has a tm_zone |
| 4403 | # (which is not required by ISO C or UNIX spec) and/or if we support |
| 4404 | # tzname[] |
| 4405 | AC_STRUCT_TIMEZONE |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4406 | |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4407 | # check tzset(3) exists and works like we expect it to |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4408 | AC_MSG_CHECKING(for working tzset()) |
| 4409 | AC_CACHE_VAL(ac_cv_working_tzset, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4410 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4411 | #include <stdlib.h> |
| 4412 | #include <time.h> |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4413 | #include <string.h> |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4414 | |
| 4415 | #if HAVE_TZNAME |
| 4416 | extern char *tzname[]; |
| 4417 | #endif |
| 4418 | |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4419 | int main() |
| 4420 | { |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4421 | /* Note that we need to ensure that not only does tzset(3) |
| 4422 | do 'something' with localtime, but it works as documented |
| 4423 | in the library reference and as expected by the test suite. |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4424 | This includes making sure that tzname is set properly if |
| 4425 | tm->tm_zone does not exist since it is the alternative way |
| 4426 | of getting timezone info. |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4427 | |
| 4428 | Red Hat 6.2 doesn't understand the southern hemisphere |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4429 | after New Year's Day. |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4430 | */ |
| 4431 | |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4432 | time_t groundhogday = 1044144000; /* GMT-based */ |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4433 | time_t midyear = groundhogday + (365 * 24 * 3600 / 2); |
| 4434 | |
Neal Norwitz | 7f2588c | 2003-04-11 15:35:53 +0000 | [diff] [blame] | 4435 | putenv("TZ=UTC+0"); |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4436 | tzset(); |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4437 | if (localtime(&groundhogday)->tm_hour != 0) |
| 4438 | exit(1); |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4439 | #if HAVE_TZNAME |
| 4440 | /* For UTC, tzname[1] is sometimes "", sometimes " " */ |
| 4441 | if (strcmp(tzname[0], "UTC") || |
| 4442 | (tzname[1][0] != 0 && tzname[1][0] != ' ')) |
| 4443 | exit(1); |
| 4444 | #endif |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4445 | |
Neal Norwitz | 7f2588c | 2003-04-11 15:35:53 +0000 | [diff] [blame] | 4446 | putenv("TZ=EST+5EDT,M4.1.0,M10.5.0"); |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4447 | tzset(); |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4448 | if (localtime(&groundhogday)->tm_hour != 19) |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4449 | exit(1); |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4450 | #if HAVE_TZNAME |
| 4451 | if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT")) |
| 4452 | exit(1); |
| 4453 | #endif |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4454 | |
| 4455 | putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0"); |
| 4456 | tzset(); |
| 4457 | if (localtime(&groundhogday)->tm_hour != 11) |
| 4458 | exit(1); |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4459 | #if HAVE_TZNAME |
| 4460 | if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT")) |
| 4461 | exit(1); |
| 4462 | #endif |
| 4463 | |
| 4464 | #if HAVE_STRUCT_TM_TM_ZONE |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4465 | if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT")) |
| 4466 | exit(1); |
| 4467 | if (strcmp(localtime(&midyear)->tm_zone, "AEST")) |
| 4468 | exit(1); |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4469 | #endif |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4470 | |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4471 | exit(0); |
| 4472 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4473 | ]])], |
| 4474 | [ac_cv_working_tzset=yes], |
| 4475 | [ac_cv_working_tzset=no], |
| 4476 | [ac_cv_working_tzset=no])]) |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4477 | AC_MSG_RESULT($ac_cv_working_tzset) |
| 4478 | if test "$ac_cv_working_tzset" = yes |
| 4479 | then |
| 4480 | AC_DEFINE(HAVE_WORKING_TZSET, 1, |
| 4481 | [Define if tzset() actually switches the local timezone in a meaningful way.]) |
| 4482 | fi |
| 4483 | |
Martin v. Löwis | 94717ed | 2002-09-09 14:24:16 +0000 | [diff] [blame] | 4484 | # Look for subsecond timestamps in struct stat |
| 4485 | AC_MSG_CHECKING(for tv_nsec in struct stat) |
| 4486 | AC_CACHE_VAL(ac_cv_stat_tv_nsec, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4487 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[ |
Martin v. Löwis | 94717ed | 2002-09-09 14:24:16 +0000 | [diff] [blame] | 4488 | struct stat st; |
| 4489 | st.st_mtim.tv_nsec = 1; |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4490 | ]])], |
| 4491 | [ac_cv_stat_tv_nsec=yes], |
| 4492 | [ac_cv_stat_tv_nsec=no])) |
Martin v. Löwis | 94717ed | 2002-09-09 14:24:16 +0000 | [diff] [blame] | 4493 | AC_MSG_RESULT($ac_cv_stat_tv_nsec) |
| 4494 | if test "$ac_cv_stat_tv_nsec" = yes |
| 4495 | then |
| 4496 | AC_DEFINE(HAVE_STAT_TV_NSEC, 1, |
| 4497 | [Define if you have struct stat.st_mtim.tv_nsec]) |
| 4498 | fi |
| 4499 | |
Martin v. Löwis | ebd9d5b | 2005-08-09 15:00:59 +0000 | [diff] [blame] | 4500 | # Look for BSD style subsecond timestamps in struct stat |
| 4501 | AC_MSG_CHECKING(for tv_nsec2 in struct stat) |
| 4502 | AC_CACHE_VAL(ac_cv_stat_tv_nsec2, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4503 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[ |
Martin v. Löwis | ebd9d5b | 2005-08-09 15:00:59 +0000 | [diff] [blame] | 4504 | struct stat st; |
| 4505 | st.st_mtimespec.tv_nsec = 1; |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4506 | ]])], |
| 4507 | [ac_cv_stat_tv_nsec2=yes], |
| 4508 | [ac_cv_stat_tv_nsec2=no])) |
Martin v. Löwis | ebd9d5b | 2005-08-09 15:00:59 +0000 | [diff] [blame] | 4509 | AC_MSG_RESULT($ac_cv_stat_tv_nsec2) |
| 4510 | if test "$ac_cv_stat_tv_nsec2" = yes |
| 4511 | then |
| 4512 | AC_DEFINE(HAVE_STAT_TV_NSEC2, 1, |
| 4513 | [Define if you have struct stat.st_mtimensec]) |
| 4514 | fi |
| 4515 | |
doko@ubuntu.com | f27ec3e | 2014-04-17 20:11:19 +0200 | [diff] [blame] | 4516 | # first curses configure check |
| 4517 | ac_save_cppflags="$CPPFLAGS" |
| 4518 | CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" |
| 4519 | |
| 4520 | AC_CHECK_HEADERS(curses.h ncurses.h) |
| 4521 | |
| 4522 | # On Solaris, term.h requires curses.h |
| 4523 | AC_CHECK_HEADERS(term.h,,,[ |
| 4524 | #ifdef HAVE_CURSES_H |
| 4525 | #include <curses.h> |
| 4526 | #endif |
| 4527 | ]) |
| 4528 | |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4529 | # On HP/UX 11.0, mvwdelch is a block with a return statement |
| 4530 | AC_MSG_CHECKING(whether mvwdelch is an expression) |
| 4531 | AC_CACHE_VAL(ac_cv_mvwdelch_is_expression, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4532 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4533 | int rtn; |
| 4534 | rtn = mvwdelch(0,0,0); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4535 | ]])], |
| 4536 | [ac_cv_mvwdelch_is_expression=yes], |
| 4537 | [ac_cv_mvwdelch_is_expression=no])) |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4538 | AC_MSG_RESULT($ac_cv_mvwdelch_is_expression) |
| 4539 | |
| 4540 | if test "$ac_cv_mvwdelch_is_expression" = yes |
| 4541 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4542 | AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1, |
| 4543 | [Define if mvwdelch in curses.h is an expression.]) |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4544 | fi |
| 4545 | |
Miss Islington (bot) | 6ba0b58 | 2017-11-01 05:36:48 -0700 | [diff] [blame] | 4546 | # Issue #25720: ncurses has introduced the NCURSES_OPAQUE symbol making opaque |
| 4547 | # structs since version 5.7. If the macro is defined as zero before including |
| 4548 | # [n]curses.h, ncurses will expose fields of the structs regardless of the |
| 4549 | # configuration. |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4550 | AC_MSG_CHECKING(whether WINDOW has _flags) |
| 4551 | AC_CACHE_VAL(ac_cv_window_has_flags, |
Miss Islington (bot) | 6ba0b58 | 2017-11-01 05:36:48 -0700 | [diff] [blame] | 4552 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4553 | #define NCURSES_OPAQUE 0 |
| 4554 | #include <curses.h> |
| 4555 | ]], [[ |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4556 | WINDOW *w; |
| 4557 | w->_flags = 0; |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4558 | ]])], |
| 4559 | [ac_cv_window_has_flags=yes], |
| 4560 | [ac_cv_window_has_flags=no])) |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4561 | AC_MSG_RESULT($ac_cv_window_has_flags) |
| 4562 | |
| 4563 | |
| 4564 | if test "$ac_cv_window_has_flags" = yes |
| 4565 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4566 | AC_DEFINE(WINDOW_HAS_FLAGS, 1, |
| 4567 | [Define if WINDOW in curses.h offers a field _flags.]) |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4568 | fi |
| 4569 | |
Miss Islington (bot) | 6ba0b58 | 2017-11-01 05:36:48 -0700 | [diff] [blame] | 4570 | AC_MSG_CHECKING(for is_pad) |
| 4571 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ |
| 4572 | #ifndef is_pad |
| 4573 | void *x=is_pad |
| 4574 | #endif |
| 4575 | ]])], |
| 4576 | [AC_DEFINE(HAVE_CURSES_IS_PAD, 1, Define if you have the 'is_pad' function or macro.) |
| 4577 | AC_MSG_RESULT(yes)], |
| 4578 | [AC_MSG_RESULT(no)] |
| 4579 | ) |
| 4580 | |
Walter Dörwald | 4994d95 | 2006-06-19 08:07:50 +0000 | [diff] [blame] | 4581 | AC_MSG_CHECKING(for is_term_resized) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4582 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])], |
| 4583 | [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.) |
| 4584 | AC_MSG_RESULT(yes)], |
| 4585 | [AC_MSG_RESULT(no)] |
Walter Dörwald | 4994d95 | 2006-06-19 08:07:50 +0000 | [diff] [blame] | 4586 | ) |
| 4587 | |
Walter Dörwald | 05fdbf1 | 2006-06-19 08:14:09 +0000 | [diff] [blame] | 4588 | AC_MSG_CHECKING(for resize_term) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4589 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])], |
| 4590 | [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.) |
| 4591 | AC_MSG_RESULT(yes)], |
| 4592 | [AC_MSG_RESULT(no)] |
Walter Dörwald | 4994d95 | 2006-06-19 08:07:50 +0000 | [diff] [blame] | 4593 | ) |
| 4594 | |
Walter Dörwald | 05fdbf1 | 2006-06-19 08:14:09 +0000 | [diff] [blame] | 4595 | AC_MSG_CHECKING(for resizeterm) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4596 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])], |
| 4597 | [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.) |
| 4598 | AC_MSG_RESULT(yes)], |
| 4599 | [AC_MSG_RESULT(no)] |
Walter Dörwald | 4994d95 | 2006-06-19 08:07:50 +0000 | [diff] [blame] | 4600 | ) |
Serhiy Storchaka | e0fc1af | 2017-10-31 16:12:35 +0200 | [diff] [blame] | 4601 | |
| 4602 | AC_MSG_CHECKING(for immedok) |
| 4603 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ |
| 4604 | #ifndef immedok |
| 4605 | void *x=immedok |
| 4606 | #endif |
| 4607 | ]])], |
| 4608 | [AC_DEFINE(HAVE_CURSES_IMMEDOK, 1, Define if you have the 'immedok' function.) |
| 4609 | AC_MSG_RESULT(yes)], |
| 4610 | [AC_MSG_RESULT(no)] |
| 4611 | ) |
| 4612 | |
| 4613 | AC_MSG_CHECKING(for syncok) |
| 4614 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ |
| 4615 | #ifndef syncok |
| 4616 | void *x=syncok |
| 4617 | #endif |
| 4618 | ]])], |
| 4619 | [AC_DEFINE(HAVE_CURSES_SYNCOK, 1, Define if you have the 'syncok' function.) |
| 4620 | AC_MSG_RESULT(yes)], |
| 4621 | [AC_MSG_RESULT(no)] |
| 4622 | ) |
| 4623 | |
Miss Islington (bot) | 87c66e4 | 2017-11-01 06:11:18 -0700 | [diff] [blame] | 4624 | AC_MSG_CHECKING(for wchgat) |
| 4625 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ |
| 4626 | #ifndef wchgat |
| 4627 | void *x=wchgat |
| 4628 | #endif |
| 4629 | ]])], |
| 4630 | [AC_DEFINE(HAVE_CURSES_WCHGAT, 1, Define if you have the 'wchgat' function.) |
| 4631 | AC_MSG_RESULT(yes)], |
| 4632 | [AC_MSG_RESULT(no)] |
| 4633 | ) |
| 4634 | |
Serhiy Storchaka | e0fc1af | 2017-10-31 16:12:35 +0200 | [diff] [blame] | 4635 | AC_MSG_CHECKING(for filter) |
| 4636 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ |
| 4637 | #ifndef filter |
| 4638 | void *x=filter |
| 4639 | #endif |
| 4640 | ]])], |
| 4641 | [AC_DEFINE(HAVE_CURSES_FILTER, 1, Define if you have the 'filter' function.) |
| 4642 | AC_MSG_RESULT(yes)], |
| 4643 | [AC_MSG_RESULT(no)] |
| 4644 | ) |
| 4645 | |
| 4646 | AC_MSG_CHECKING(for has_key) |
| 4647 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ |
| 4648 | #ifndef has_key |
| 4649 | void *x=has_key |
| 4650 | #endif |
| 4651 | ]])], |
| 4652 | [AC_DEFINE(HAVE_CURSES_HAS_KEY, 1, Define if you have the 'has_key' function.) |
| 4653 | AC_MSG_RESULT(yes)], |
| 4654 | [AC_MSG_RESULT(no)] |
| 4655 | ) |
| 4656 | |
| 4657 | AC_MSG_CHECKING(for typeahead) |
| 4658 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ |
| 4659 | #ifndef typeahead |
| 4660 | void *x=typeahead |
| 4661 | #endif |
| 4662 | ]])], |
| 4663 | [AC_DEFINE(HAVE_CURSES_TYPEAHEAD, 1, Define if you have the 'typeahead' function.) |
| 4664 | AC_MSG_RESULT(yes)], |
| 4665 | [AC_MSG_RESULT(no)] |
| 4666 | ) |
| 4667 | |
| 4668 | AC_MSG_CHECKING(for use_env) |
| 4669 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ |
| 4670 | #ifndef use_env |
| 4671 | void *x=use_env |
| 4672 | #endif |
| 4673 | ]])], |
| 4674 | [AC_DEFINE(HAVE_CURSES_USE_ENV, 1, Define if you have the 'use_env' function.) |
| 4675 | AC_MSG_RESULT(yes)], |
| 4676 | [AC_MSG_RESULT(no)] |
| 4677 | ) |
doko@ubuntu.com | f27ec3e | 2014-04-17 20:11:19 +0200 | [diff] [blame] | 4678 | # last curses configure check |
| 4679 | CPPFLAGS=$ac_save_cppflags |
Walter Dörwald | 4994d95 | 2006-06-19 08:07:50 +0000 | [diff] [blame] | 4680 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 4681 | AC_MSG_NOTICE([checking for device files]) |
Martin v. Löwis | fefbc20 | 2006-10-17 18:59:23 +0000 | [diff] [blame] | 4682 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 4683 | dnl NOTE: Inform user how to proceed with files when cross compiling. |
| 4684 | if test "x$cross_compiling" = xyes; then |
| 4685 | if test "${ac_cv_file__dev_ptmx+set}" != set; then |
| 4686 | AC_MSG_CHECKING([for /dev/ptmx]) |
| 4687 | AC_MSG_RESULT([not set]) |
| 4688 | AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling]) |
| 4689 | fi |
| 4690 | if test "${ac_cv_file__dev_ptc+set}" != set; then |
| 4691 | AC_MSG_CHECKING([for /dev/ptc]) |
| 4692 | AC_MSG_RESULT([not set]) |
| 4693 | AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling]) |
| 4694 | fi |
Martin v. Löwis | fefbc20 | 2006-10-17 18:59:23 +0000 | [diff] [blame] | 4695 | fi |
| 4696 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 4697 | AC_CHECK_FILE(/dev/ptmx, [], []) |
| 4698 | if test "x$ac_cv_file__dev_ptmx" = xyes; then |
| 4699 | AC_DEFINE(HAVE_DEV_PTMX, 1, |
| 4700 | [Define to 1 if you have the /dev/ptmx device file.]) |
| 4701 | fi |
| 4702 | AC_CHECK_FILE(/dev/ptc, [], []) |
| 4703 | if test "x$ac_cv_file__dev_ptc" = xyes; then |
Martin v. Löwis | fefbc20 | 2006-10-17 18:59:23 +0000 | [diff] [blame] | 4704 | AC_DEFINE(HAVE_DEV_PTC, 1, |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 4705 | [Define to 1 if you have the /dev/ptc device file.]) |
Martin v. Löwis | fefbc20 | 2006-10-17 18:59:23 +0000 | [diff] [blame] | 4706 | fi |
Neal Norwitz | 865400f | 2003-03-21 01:42:58 +0000 | [diff] [blame] | 4707 | |
Mark Dickinson | 82864d1 | 2009-11-15 16:18:58 +0000 | [diff] [blame] | 4708 | if test "$have_long_long" = yes |
| 4709 | then |
| 4710 | AC_MSG_CHECKING(for %lld and %llu printf() format support) |
| 4711 | AC_CACHE_VAL(ac_cv_have_long_long_format, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4712 | AC_RUN_IFELSE([AC_LANG_SOURCE([[[ |
Mark Dickinson | 82864d1 | 2009-11-15 16:18:58 +0000 | [diff] [blame] | 4713 | #include <stdio.h> |
| 4714 | #include <stddef.h> |
| 4715 | #include <string.h> |
| 4716 | |
| 4717 | #ifdef HAVE_SYS_TYPES_H |
| 4718 | #include <sys/types.h> |
| 4719 | #endif |
| 4720 | |
| 4721 | int main() |
| 4722 | { |
| 4723 | char buffer[256]; |
| 4724 | |
| 4725 | if (sprintf(buffer, "%lld", (long long)123) < 0) |
| 4726 | return 1; |
| 4727 | if (strcmp(buffer, "123")) |
| 4728 | return 1; |
| 4729 | |
| 4730 | if (sprintf(buffer, "%lld", (long long)-123) < 0) |
| 4731 | return 1; |
| 4732 | if (strcmp(buffer, "-123")) |
| 4733 | return 1; |
| 4734 | |
| 4735 | if (sprintf(buffer, "%llu", (unsigned long long)123) < 0) |
| 4736 | return 1; |
| 4737 | if (strcmp(buffer, "123")) |
| 4738 | return 1; |
| 4739 | |
| 4740 | return 0; |
| 4741 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4742 | ]]])], |
| 4743 | [ac_cv_have_long_long_format=yes], |
| 4744 | [ac_cv_have_long_long_format=no], |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 4745 | [ac_cv_have_long_long_format="cross -- assuming no" |
| 4746 | if test x$GCC = xyes; then |
| 4747 | save_CFLAGS=$CFLAGS |
| 4748 | CFLAGS="$CFLAGS -Werror -Wformat" |
| 4749 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4750 | #include <stdio.h> |
| 4751 | #include <stddef.h> |
| 4752 | ]], [[ |
| 4753 | char *buffer; |
| 4754 | sprintf(buffer, "%lld", (long long)123); |
| 4755 | sprintf(buffer, "%lld", (long long)-123); |
| 4756 | sprintf(buffer, "%llu", (unsigned long long)123); |
| 4757 | ]])], |
| 4758 | ac_cv_have_long_long_format=yes |
| 4759 | ) |
| 4760 | CFLAGS=$save_CFLAGS |
| 4761 | fi]) |
Mark Dickinson | 82864d1 | 2009-11-15 16:18:58 +0000 | [diff] [blame] | 4762 | ) |
| 4763 | AC_MSG_RESULT($ac_cv_have_long_long_format) |
| 4764 | fi |
| 4765 | |
Mark Dickinson | 5ce8474 | 2009-12-31 20:48:04 +0000 | [diff] [blame] | 4766 | if test "$ac_cv_have_long_long_format" = yes |
Mark Dickinson | 82864d1 | 2009-11-15 16:18:58 +0000 | [diff] [blame] | 4767 | then |
| 4768 | AC_DEFINE(PY_FORMAT_LONG_LONG, "ll", |
| 4769 | [Define to printf format modifier for long long type]) |
| 4770 | fi |
| 4771 | |
Ronald Oussoren | 315cd0c | 2009-11-19 16:25:21 +0000 | [diff] [blame] | 4772 | if test $ac_sys_system = Darwin |
| 4773 | then |
| 4774 | LIBS="$LIBS -framework CoreFoundation" |
| 4775 | fi |
| 4776 | |
Mark Dickinson | 82864d1 | 2009-11-15 16:18:58 +0000 | [diff] [blame] | 4777 | |
Gregory P. Smith | d8cb2d9 | 2009-11-02 02:02:38 +0000 | [diff] [blame] | 4778 | AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4779 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Alexandre Vassalotti | e7cf118 | 2009-07-17 06:33:51 +0000 | [diff] [blame] | 4780 | #include <stdio.h> |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4781 | #include <stddef.h> |
| 4782 | #include <string.h> |
| 4783 | |
Christian Heimes | db3d6cb | 2007-12-16 21:39:43 +0000 | [diff] [blame] | 4784 | #ifdef HAVE_SYS_TYPES_H |
| 4785 | #include <sys/types.h> |
| 4786 | #endif |
Neal Norwitz | 4a8fbdb | 2006-09-22 08:16:26 +0000 | [diff] [blame] | 4787 | |
| 4788 | #ifdef HAVE_SSIZE_T |
| 4789 | typedef ssize_t Py_ssize_t; |
| 4790 | #elif SIZEOF_VOID_P == SIZEOF_LONG |
| 4791 | typedef long Py_ssize_t; |
| 4792 | #else |
| 4793 | typedef int Py_ssize_t; |
| 4794 | #endif |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4795 | |
Christian Heimes | db3d6cb | 2007-12-16 21:39:43 +0000 | [diff] [blame] | 4796 | int main() |
| 4797 | { |
| 4798 | char buffer[256]; |
| 4799 | |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4800 | if(sprintf(buffer, "%zd", (size_t)123) < 0) |
| 4801 | return 1; |
| 4802 | |
Neal Norwitz | 4a8fbdb | 2006-09-22 08:16:26 +0000 | [diff] [blame] | 4803 | if (strcmp(buffer, "123")) |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4804 | return 1; |
Neal Norwitz | 4a8fbdb | 2006-09-22 08:16:26 +0000 | [diff] [blame] | 4805 | |
| 4806 | if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0) |
| 4807 | return 1; |
| 4808 | |
| 4809 | if (strcmp(buffer, "-123")) |
| 4810 | return 1; |
| 4811 | |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4812 | return 0; |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 4813 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4814 | ]])], |
| 4815 | [ac_cv_have_size_t_format=yes], |
| 4816 | [ac_cv_have_size_t_format=no], |
| 4817 | [ac_cv_have_size_t_format="cross -- assuming yes" |
| 4818 | ])]) |
Gregory P. Smith | d8cb2d9 | 2009-11-02 02:02:38 +0000 | [diff] [blame] | 4819 | if test "$ac_cv_have_size_t_format" != no ; then |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 4820 | AC_DEFINE(PY_FORMAT_SIZE_T, "z", |
| 4821 | [Define to printf format modifier for Py_ssize_t]) |
| 4822 | fi |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4823 | |
Martin v. Löwis | 01c0401 | 2002-11-11 14:58:44 +0000 | [diff] [blame] | 4824 | AC_CHECK_TYPE(socklen_t,, |
| 4825 | AC_DEFINE(socklen_t,int, |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 4826 | [Define to `int' if <sys/socket.h> does not define.]),[ |
Martin v. Löwis | 01c0401 | 2002-11-11 14:58:44 +0000 | [diff] [blame] | 4827 | #ifdef HAVE_SYS_TYPES_H |
| 4828 | #include <sys/types.h> |
| 4829 | #endif |
Guido van Rossum | 95713eb | 2000-05-18 20:53:31 +0000 | [diff] [blame] | 4830 | #ifdef HAVE_SYS_SOCKET_H |
| 4831 | #include <sys/socket.h> |
| 4832 | #endif |
Martin v. Löwis | 01c0401 | 2002-11-11 14:58:44 +0000 | [diff] [blame] | 4833 | ]) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 4834 | |
R. David Murray | 1d9d16e | 2010-10-16 00:43:13 +0000 | [diff] [blame] | 4835 | case $ac_sys_system in |
| 4836 | AIX*) |
| 4837 | AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;; |
| 4838 | esac |
| 4839 | |
| 4840 | |
Martin v. Löwis | 06f15bb | 2001-12-02 13:02:32 +0000 | [diff] [blame] | 4841 | AC_SUBST(THREADHEADERS) |
| 4842 | |
| 4843 | for h in `(cd $srcdir;echo Python/thread_*.h)` |
| 4844 | do |
| 4845 | THREADHEADERS="$THREADHEADERS \$(srcdir)/$h" |
| 4846 | done |
| 4847 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 4848 | AC_SUBST(SRCDIRS) |
Victor Stinner | 5f4056a | 2017-04-28 03:41:40 +0200 | [diff] [blame] | 4849 | SRCDIRS="Parser Objects Python Modules" |
Andrew M. Kuchling | 8abedde | 2001-01-26 22:55:24 +0000 | [diff] [blame] | 4850 | AC_MSG_CHECKING(for build directories) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 4851 | for dir in $SRCDIRS; do |
| 4852 | if test ! -d $dir; then |
| 4853 | mkdir $dir |
Fred Drake | 884d3ba | 2000-11-02 17:52:56 +0000 | [diff] [blame] | 4854 | fi |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 4855 | done |
Benjamin Peterson | 2c992a0 | 2015-05-28 12:45:31 -0500 | [diff] [blame] | 4856 | |
| 4857 | # BEGIN_COMPUTED_GOTO |
| 4858 | # Check for --with-computed-gotos |
| 4859 | AC_MSG_CHECKING(for --with-computed-gotos) |
| 4860 | AC_ARG_WITH(computed-gotos, |
| 4861 | AS_HELP_STRING([--with(out)-computed-gotos], |
| 4862 | [Use computed gotos in evaluation loop (enabled by default on supported compilers)]), |
| 4863 | [ |
| 4864 | if test "$withval" = yes |
| 4865 | then |
| 4866 | AC_DEFINE(USE_COMPUTED_GOTOS, 1, |
| 4867 | [Define if you want to use computed gotos in ceval.c.]) |
| 4868 | AC_MSG_RESULT(yes) |
| 4869 | fi |
| 4870 | if test "$withval" = no |
| 4871 | then |
| 4872 | AC_DEFINE(USE_COMPUTED_GOTOS, 0, |
| 4873 | [Define if you want to use computed gotos in ceval.c.]) |
| 4874 | AC_MSG_RESULT(no) |
| 4875 | fi |
| 4876 | ], |
| 4877 | [AC_MSG_RESULT(no value specified)]) |
| 4878 | |
| 4879 | AC_MSG_CHECKING(whether $CC supports computed gotos) |
| 4880 | AC_CACHE_VAL(ac_cv_computed_gotos, |
| 4881 | AC_RUN_IFELSE([AC_LANG_SOURCE([[[ |
| 4882 | int main(int argc, char **argv) |
| 4883 | { |
| 4884 | static void *targets[1] = { &&LABEL1 }; |
| 4885 | goto LABEL2; |
| 4886 | LABEL1: |
| 4887 | return 0; |
| 4888 | LABEL2: |
| 4889 | goto *targets[0]; |
| 4890 | return 1; |
| 4891 | } |
| 4892 | ]]])], |
| 4893 | [ac_cv_computed_gotos=yes], |
| 4894 | [ac_cv_computed_gotos=no], |
| 4895 | [if test "${with_computed_gotos+set}" = set; then |
| 4896 | ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos" |
| 4897 | else |
| 4898 | ac_cv_computed_gotos=no |
| 4899 | fi])) |
| 4900 | AC_MSG_RESULT($ac_cv_computed_gotos) |
| 4901 | case "$ac_cv_computed_gotos" in yes*) |
| 4902 | AC_DEFINE(HAVE_COMPUTED_GOTOS, 1, |
| 4903 | [Define if the C compiler supports computed gotos.]) |
| 4904 | esac |
| 4905 | # END_COMPUTED_GOTO |
| 4906 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 4907 | AC_MSG_RESULT(done) |
Fred Drake | 036144d | 2000-10-26 17:09:35 +0000 | [diff] [blame] | 4908 | |
Ned Deily | 3f1d0b3 | 2014-11-20 02:11:03 -0800 | [diff] [blame] | 4909 | # ensurepip option |
| 4910 | AC_MSG_CHECKING(for ensurepip) |
| 4911 | AC_ARG_WITH(ensurepip, |
| 4912 | [AS_HELP_STRING([--with(out)-ensurepip=@<:@=OPTION@:>@], |
| 4913 | ["install" or "upgrade" using bundled pip, default is "no"])], |
| 4914 | [], |
| 4915 | [with_ensurepip=no]) |
| 4916 | AS_CASE($with_ensurepip, |
| 4917 | [yes|upgrade],[ENSUREPIP=upgrade], |
| 4918 | [install],[ENSUREPIP=install], |
| 4919 | [no],[ENSUREPIP=no], |
| 4920 | [AC_MSG_ERROR([--with-ensurepip=upgrade|install|no])]) |
| 4921 | AC_MSG_RESULT($ENSUREPIP) |
| 4922 | AC_SUBST(ENSUREPIP) |
| 4923 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 4924 | # generate output files |
Antoine Pitrou | f2caeed | 2009-05-24 20:23:57 +0000 | [diff] [blame] | 4925 | AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc) |
Antoine Pitrou | aabdceb | 2010-09-10 20:03:17 +0000 | [diff] [blame] | 4926 | AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix]) |
Martin v. Löwis | 88afe66 | 2002-10-26 13:47:44 +0000 | [diff] [blame] | 4927 | AC_OUTPUT |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 4928 | |
Martin v. Löwis | f7afe95 | 2006-04-14 15:16:15 +0000 | [diff] [blame] | 4929 | echo "creating Modules/Setup" |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 4930 | if test ! -f Modules/Setup |
| 4931 | then |
| 4932 | cp $srcdir/Modules/Setup.dist Modules/Setup |
| 4933 | fi |
| 4934 | |
Martin v. Löwis | f7afe95 | 2006-04-14 15:16:15 +0000 | [diff] [blame] | 4935 | echo "creating Modules/Setup.local" |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 4936 | if test ! -f Modules/Setup.local |
| 4937 | then |
| 4938 | echo "# Edit this file for local setup changes" >Modules/Setup.local |
| 4939 | fi |
| 4940 | |
| 4941 | echo "creating Makefile" |
| 4942 | $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ |
| 4943 | -s Modules Modules/Setup.config \ |
Neil Schemenauer | f8b71c5 | 2001-04-21 17:41:16 +0000 | [diff] [blame] | 4944 | Modules/Setup.local Modules/Setup |
Skip Montanaro | 7221d93 | 2007-08-22 19:02:16 +0000 | [diff] [blame] | 4945 | |
| 4946 | case $ac_sys_system in |
| 4947 | BeOS) |
| 4948 | AC_MSG_WARN([ |
| 4949 | |
| 4950 | Support for BeOS is deprecated as of Python 2.6. |
| 4951 | See PEP 11 for the gory details. |
| 4952 | ]) |
| 4953 | ;; |
| 4954 | *) ;; |
| 4955 | esac |
| 4956 | |
Neil Schemenauer | 6625216 | 2001-02-19 04:47:42 +0000 | [diff] [blame] | 4957 | mv config.c Modules |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 4958 | |
| 4959 | if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then |
| 4960 | echo "" >&AS_MESSAGE_FD |
| 4961 | echo "" >&AS_MESSAGE_FD |
| 4962 | echo "If you want a release build with all optimizations active (LTO, PGO, etc)," |
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) | b999915 | 2016-11-20 21:19:36 +0000 | [diff] [blame] | 4963 | echo "please run ./configure --enable-optimizations" >&AS_MESSAGE_FD |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 4964 | echo "" >&AS_MESSAGE_FD |
| 4965 | echo "" >&AS_MESSAGE_FD |
| 4966 | fi |