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 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 22 | if test "$cross_compiling" = yes; then |
| 23 | AC_MSG_CHECKING([for python interpreter for cross build]) |
| 24 | if test -z "$PYTHON_FOR_BUILD"; then |
| 25 | for interp in python$PACKAGE_VERSION python2 python; do |
| 26 | which $interp >/dev/null 2>&1 || continue |
| 27 | if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then |
| 28 | break |
| 29 | fi |
| 30 | interp= |
| 31 | done |
| 32 | if test x$interp = x; then |
| 33 | AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found]) |
| 34 | fi |
| 35 | AC_MSG_RESULT($interp) |
doko@ubuntu.com | 9e7ece2 | 2015-04-13 21:55:08 +0200 | [diff] [blame] | 36 | 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] | 37 | fi |
Martin Panter | bc82de0 | 2016-07-29 05:52:32 +0000 | [diff] [blame] | 38 | # Used to comment out stuff for rebuilding generated files |
| 39 | GENERATED_COMMENT='#' |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 40 | elif test "$cross_compiling" = maybe; then |
| 41 | AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) |
| 42 | else |
| 43 | PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' |
Martin Panter | bc82de0 | 2016-07-29 05:52:32 +0000 | [diff] [blame] | 44 | GENERATED_COMMENT='' |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 45 | fi |
| 46 | AC_SUBST(PYTHON_FOR_BUILD) |
Martin Panter | bc82de0 | 2016-07-29 05:52:32 +0000 | [diff] [blame] | 47 | AC_SUBST(GENERATED_COMMENT) |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 48 | |
Georg Brandl | bcd64a3 | 2009-03-31 21:45:18 +0000 | [diff] [blame] | 49 | dnl Ensure that if prefix is specified, it does not end in a slash. If |
| 50 | dnl it does, we get path names containing '//' which is both ugly and |
| 51 | dnl can cause trouble. |
| 52 | |
| 53 | dnl Last slash shouldn't be stripped if prefix=/ |
| 54 | if test "$prefix" != "/"; then |
| 55 | prefix=`echo "$prefix" | sed -e 's/\/$//g'` |
| 56 | fi |
| 57 | |
Martin v. Löwis | 8316feb | 2003-06-14 07:48:07 +0000 | [diff] [blame] | 58 | dnl This is for stuff that absolutely must end up in pyconfig.h. |
| 59 | dnl Please use pyport.h instead, if possible. |
Martin v. Löwis | bddf5a5 | 2002-11-11 13:37:28 +0000 | [diff] [blame] | 60 | AH_TOP([ |
| 61 | #ifndef Py_PYCONFIG_H |
| 62 | #define Py_PYCONFIG_H |
| 63 | ]) |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 64 | AH_BOTTOM([ |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 65 | /* Define the macros needed if on a UnixWare 7.x system. */ |
| 66 | #if defined(__USLC__) && defined(__SCO_VERSION__) |
| 67 | #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ |
| 68 | #endif |
Martin v. Löwis | bddf5a5 | 2002-11-11 13:37:28 +0000 | [diff] [blame] | 69 | |
| 70 | #endif /*Py_PYCONFIG_H*/ |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 71 | ]) |
| 72 | |
Martin v. Löwis | 8316feb | 2003-06-14 07:48:07 +0000 | [diff] [blame] | 73 | # We don't use PACKAGE_ variables, and they cause conflicts |
| 74 | # with other autoconf-based packages that include Python.h |
| 75 | grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new |
| 76 | rm confdefs.h |
| 77 | mv confdefs.h.new confdefs.h |
| 78 | |
Guido van Rossum | 642b678 | 1997-07-19 19:35:41 +0000 | [diff] [blame] | 79 | AC_SUBST(VERSION) |
Martin v. Löwis | 88afe66 | 2002-10-26 13:47:44 +0000 | [diff] [blame] | 80 | VERSION=PYTHON_VERSION |
Guido van Rossum | 642b678 | 1997-07-19 19:35:41 +0000 | [diff] [blame] | 81 | |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 82 | AC_SUBST(SOVERSION) |
| 83 | SOVERSION=1.0 |
| 84 | |
Martin v. Löwis | 6f18a3c | 2002-07-20 08:51:52 +0000 | [diff] [blame] | 85 | # The later defininition of _XOPEN_SOURCE disables certain features |
| 86 | # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone). |
| 87 | AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features]) |
| 88 | |
Martin v. Löwis | bcd9396 | 2003-05-03 10:32:18 +0000 | [diff] [blame] | 89 | # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables |
| 90 | # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable |
| 91 | # them. |
| 92 | AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features]) |
| 93 | |
Andrew MacIntyre | abccf41 | 2003-07-02 13:53:25 +0000 | [diff] [blame] | 94 | # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables |
| 95 | # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable |
| 96 | # them. |
| 97 | AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features]) |
| 98 | |
Martin v. Löwis | d632050 | 2004-08-12 13:45:08 +0000 | [diff] [blame] | 99 | # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables |
| 100 | # u_int on Irix 5.3. Defining _BSD_TYPES brings it back. |
| 101 | AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int]) |
| 102 | |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 103 | # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables |
| 104 | # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable |
| 105 | # them. |
| 106 | AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features]) |
| 107 | |
| 108 | |
Martin v. Löwis | e981a4e | 2002-11-11 13:26:51 +0000 | [diff] [blame] | 109 | define_xopen_source=yes |
Martin v. Löwis | 6f18a3c | 2002-07-20 08:51:52 +0000 | [diff] [blame] | 110 | |
Neil Schemenauer | 4edbc2a | 2001-03-22 00:34:03 +0000 | [diff] [blame] | 111 | # Arguments passed to configure. |
| 112 | AC_SUBST(CONFIG_ARGS) |
| 113 | CONFIG_ARGS="$ac_configure_args" |
| 114 | |
Ronald Oussoren | 3c0a126 | 2010-01-17 19:27:57 +0000 | [diff] [blame] | 115 | AC_MSG_CHECKING([for --enable-universalsdk]) |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 116 | AC_ARG_ENABLE(universalsdk, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 117 | AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build against Mac OS X 10.4u SDK (ppc/i386)]), |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 118 | [ |
| 119 | case $enableval in |
| 120 | yes) |
| 121 | enableval=/Developer/SDKs/MacOSX10.4u.sdk |
Ronald Oussoren | 3c0a126 | 2010-01-17 19:27:57 +0000 | [diff] [blame] | 122 | if test ! -d "${enableval}" |
| 123 | then |
| 124 | enableval=/ |
| 125 | fi |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 126 | ;; |
| 127 | esac |
| 128 | case $enableval in |
| 129 | no) |
| 130 | UNIVERSALSDK= |
| 131 | enable_universalsdk= |
| 132 | ;; |
| 133 | *) |
| 134 | UNIVERSALSDK=$enableval |
Ronald Oussoren | 3c0a126 | 2010-01-17 19:27:57 +0000 | [diff] [blame] | 135 | if test ! -d "${UNIVERSALSDK}" |
| 136 | then |
| 137 | AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}]) |
| 138 | fi |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 139 | ;; |
| 140 | esac |
Ronald Oussoren | 3c0a126 | 2010-01-17 19:27:57 +0000 | [diff] [blame] | 141 | |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 142 | ],[ |
| 143 | UNIVERSALSDK= |
| 144 | enable_universalsdk= |
| 145 | ]) |
Ronald Oussoren | 3c0a126 | 2010-01-17 19:27:57 +0000 | [diff] [blame] | 146 | if test -n "${UNIVERSALSDK}" |
| 147 | then |
| 148 | AC_MSG_RESULT(${UNIVERSALSDK}) |
| 149 | else |
| 150 | AC_MSG_RESULT(no) |
| 151 | fi |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 152 | AC_SUBST(UNIVERSALSDK) |
| 153 | |
Benjamin Peterson | 0e6ea5d | 2008-07-16 20:17:04 +0000 | [diff] [blame] | 154 | AC_SUBST(ARCH_RUN_32BIT) |
Ned Deily | 8e60f6e | 2013-05-30 00:14:29 -0700 | [diff] [blame] | 155 | ARCH_RUN_32BIT="" |
Benjamin Peterson | 0e6ea5d | 2008-07-16 20:17:04 +0000 | [diff] [blame] | 156 | |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 157 | UNIVERSAL_ARCHS="32-bit" |
Ronald Oussoren | 92919a6 | 2009-12-24 13:30:58 +0000 | [diff] [blame] | 158 | AC_SUBST(LIPO_32BIT_FLAGS) |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 159 | AC_MSG_CHECKING(for --with-universal-archs) |
| 160 | AC_ARG_WITH(universal-archs, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 161 | AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")]), |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 162 | [ |
| 163 | AC_MSG_RESULT($withval) |
| 164 | UNIVERSAL_ARCHS="$withval" |
Ronald Oussoren | 9ebd242 | 2009-09-29 13:00:44 +0000 | [diff] [blame] | 165 | if test "${enable_universalsdk}" ; then |
| 166 | : |
| 167 | else |
| 168 | AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README]) |
| 169 | fi |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 170 | ], |
| 171 | [ |
| 172 | AC_MSG_RESULT(32-bit) |
| 173 | ]) |
| 174 | |
| 175 | |
| 176 | |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 177 | AC_ARG_WITH(framework-name, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 178 | AS_HELP_STRING([--with-framework-name=FRAMEWORK], |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 179 | [specify an alternate name of the framework built with --enable-framework]), |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 180 | [ |
Ronald Oussoren | 9ebd242 | 2009-09-29 13:00:44 +0000 | [diff] [blame] | 181 | if test "${enable_framework}"; then |
| 182 | : |
| 183 | else |
| 184 | AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README]) |
| 185 | fi |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 186 | PYTHONFRAMEWORK=${withval} |
| 187 | PYTHONFRAMEWORKDIR=${withval}.framework |
| 188 | PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'` |
| 189 | ],[ |
| 190 | PYTHONFRAMEWORK=Python |
| 191 | PYTHONFRAMEWORKDIR=Python.framework |
| 192 | PYTHONFRAMEWORKIDENTIFIER=org.python.python |
| 193 | ]) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 194 | dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 195 | AC_ARG_ENABLE(framework, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 196 | AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@], [Build (MacOSX|Darwin) framework]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 197 | [ |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 198 | case $enableval in |
| 199 | yes) |
| 200 | enableval=/Library/Frameworks |
Jack Jansen | 127e56e | 2001-09-11 14:41:54 +0000 | [diff] [blame] | 201 | esac |
| 202 | case $enableval in |
| 203 | no) |
| 204 | PYTHONFRAMEWORK= |
| 205 | PYTHONFRAMEWORKDIR=no-framework |
| 206 | PYTHONFRAMEWORKPREFIX= |
| 207 | PYTHONFRAMEWORKINSTALLDIR= |
Ronald Oussoren | 567a8ff | 2006-05-26 11:43:26 +0000 | [diff] [blame] | 208 | FRAMEWORKINSTALLFIRST= |
| 209 | FRAMEWORKINSTALLLAST= |
Ronald Oussoren | 5b78732 | 2006-06-06 19:50:24 +0000 | [diff] [blame] | 210 | FRAMEWORKALTINSTALLFIRST= |
| 211 | FRAMEWORKALTINSTALLLAST= |
Ronald Oussoren | 2db3a8f | 2006-06-07 19:06:01 +0000 | [diff] [blame] | 212 | if test "x${prefix}" = "xNONE"; then |
| 213 | FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" |
| 214 | else |
| 215 | FRAMEWORKUNIXTOOLSPREFIX="${prefix}" |
| 216 | fi |
Jack Jansen | 127e56e | 2001-09-11 14:41:54 +0000 | [diff] [blame] | 217 | enable_framework= |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 218 | ;; |
| 219 | *) |
Ronald Oussoren | 01d149f | 2010-04-30 11:20:14 +0000 | [diff] [blame] | 220 | PYTHONFRAMEWORKPREFIX="${enableval}" |
Jack Jansen | 127e56e | 2001-09-11 14:41:54 +0000 | [diff] [blame] | 221 | PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR |
Ronald Oussoren | 567a8ff | 2006-05-26 11:43:26 +0000 | [diff] [blame] | 222 | FRAMEWORKINSTALLFIRST="frameworkinstallstructure" |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 223 | FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall" |
Ronald Oussoren | 92919a6 | 2009-12-24 13:30:58 +0000 | [diff] [blame] | 224 | FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools" |
| 225 | FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" |
Ronald Oussoren | 01d149f | 2010-04-30 11:20:14 +0000 | [diff] [blame] | 226 | FRAMEWORKINSTALLAPPSPREFIX="/Applications" |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 227 | |
Ronald Oussoren | 2db3a8f | 2006-06-07 19:06:01 +0000 | [diff] [blame] | 228 | if test "x${prefix}" = "xNONE" ; then |
| 229 | FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" |
Ronald Oussoren | 01d149f | 2010-04-30 11:20:14 +0000 | [diff] [blame] | 230 | |
Ronald Oussoren | 2db3a8f | 2006-06-07 19:06:01 +0000 | [diff] [blame] | 231 | else |
| 232 | FRAMEWORKUNIXTOOLSPREFIX="${prefix}" |
| 233 | fi |
Ronald Oussoren | 01d149f | 2010-04-30 11:20:14 +0000 | [diff] [blame] | 234 | |
| 235 | case "${enableval}" in |
| 236 | /System*) |
| 237 | FRAMEWORKINSTALLAPPSPREFIX="/Applications" |
| 238 | if test "${prefix}" = "NONE" ; then |
| 239 | # See below |
| 240 | FRAMEWORKUNIXTOOLSPREFIX="/usr" |
| 241 | fi |
| 242 | ;; |
| 243 | |
| 244 | /Library*) |
| 245 | FRAMEWORKINSTALLAPPSPREFIX="/Applications" |
| 246 | ;; |
| 247 | |
| 248 | */Library/Frameworks) |
| 249 | MDIR="`dirname "${enableval}"`" |
| 250 | MDIR="`dirname "${MDIR}"`" |
| 251 | FRAMEWORKINSTALLAPPSPREFIX="${MDIR}/Applications" |
| 252 | |
| 253 | if test "${prefix}" = "NONE"; then |
| 254 | # User hasn't specified the |
| 255 | # --prefix option, but wants to install |
| 256 | # the framework in a non-default location, |
| 257 | # ensure that the compatibility links get |
| 258 | # installed relative to that prefix as well |
| 259 | # instead of in /usr/local. |
| 260 | FRAMEWORKUNIXTOOLSPREFIX="${MDIR}" |
| 261 | fi |
| 262 | ;; |
| 263 | |
| 264 | *) |
| 265 | FRAMEWORKINSTALLAPPSPREFIX="/Applications" |
| 266 | ;; |
| 267 | esac |
| 268 | |
Jack Jansen | 127e56e | 2001-09-11 14:41:54 +0000 | [diff] [blame] | 269 | prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 270 | |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 271 | # Add files for Mac specific code to the list of output |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 272 | # files: |
Ronald Oussoren | 2db3a8f | 2006-06-07 19:06:01 +0000 | [diff] [blame] | 273 | AC_CONFIG_FILES(Mac/Makefile) |
| 274 | AC_CONFIG_FILES(Mac/PythonLauncher/Makefile) |
| 275 | AC_CONFIG_FILES(Mac/IDLE/Makefile) |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 276 | AC_CONFIG_FILES(Mac/Resources/framework/Info.plist) |
| 277 | AC_CONFIG_FILES(Mac/Resources/app/Info.plist) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 278 | esac |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 279 | ],[ |
| 280 | PYTHONFRAMEWORK= |
Jack Jansen | 127e56e | 2001-09-11 14:41:54 +0000 | [diff] [blame] | 281 | PYTHONFRAMEWORKDIR=no-framework |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 282 | PYTHONFRAMEWORKPREFIX= |
| 283 | PYTHONFRAMEWORKINSTALLDIR= |
Ronald Oussoren | 567a8ff | 2006-05-26 11:43:26 +0000 | [diff] [blame] | 284 | FRAMEWORKINSTALLFIRST= |
| 285 | FRAMEWORKINSTALLLAST= |
Ronald Oussoren | 5b78732 | 2006-06-06 19:50:24 +0000 | [diff] [blame] | 286 | FRAMEWORKALTINSTALLFIRST= |
| 287 | FRAMEWORKALTINSTALLLAST= |
Ronald Oussoren | 2db3a8f | 2006-06-07 19:06:01 +0000 | [diff] [blame] | 288 | if test "x${prefix}" = "xNONE" ; then |
| 289 | FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" |
| 290 | else |
| 291 | FRAMEWORKUNIXTOOLSPREFIX="${prefix}" |
| 292 | fi |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 293 | enable_framework= |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 294 | |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 295 | ]) |
| 296 | AC_SUBST(PYTHONFRAMEWORK) |
Ronald Oussoren | 580c7fe | 2008-05-02 19:45:11 +0000 | [diff] [blame] | 297 | AC_SUBST(PYTHONFRAMEWORKIDENTIFIER) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 298 | AC_SUBST(PYTHONFRAMEWORKDIR) |
| 299 | AC_SUBST(PYTHONFRAMEWORKPREFIX) |
| 300 | AC_SUBST(PYTHONFRAMEWORKINSTALLDIR) |
Ronald Oussoren | 567a8ff | 2006-05-26 11:43:26 +0000 | [diff] [blame] | 301 | AC_SUBST(FRAMEWORKINSTALLFIRST) |
| 302 | AC_SUBST(FRAMEWORKINSTALLLAST) |
Ronald Oussoren | 5b78732 | 2006-06-06 19:50:24 +0000 | [diff] [blame] | 303 | AC_SUBST(FRAMEWORKALTINSTALLFIRST) |
| 304 | AC_SUBST(FRAMEWORKALTINSTALLLAST) |
| 305 | AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX) |
Ronald Oussoren | 01d149f | 2010-04-30 11:20:14 +0000 | [diff] [blame] | 306 | AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX) |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 307 | |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 308 | ##AC_ARG_WITH(dyld, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 309 | ## AS_HELP_STRING([--with-dyld], |
| 310 | ## [Use (OpenStep|Rhapsody) dynamic linker])) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 311 | ## |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 312 | # Set name for machine-dependent library files |
| 313 | AC_SUBST(MACHDEP) |
| 314 | AC_MSG_CHECKING(MACHDEP) |
| 315 | if test -z "$MACHDEP" |
| 316 | then |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 317 | # avoid using uname for cross builds |
| 318 | if test "$cross_compiling" = yes; then |
| 319 | # ac_sys_system and ac_sys_release are only used for setting |
| 320 | # `define_xopen_source' in the case statement below. For the |
| 321 | # current supported cross builds, this macro is not adjusted. |
| 322 | case "$host" in |
| 323 | *-*-linux*) |
| 324 | ac_sys_system=Linux |
| 325 | ;; |
| 326 | *-*-cygwin*) |
| 327 | ac_sys_system=Cygwin |
| 328 | ;; |
| 329 | *) |
| 330 | # for now, limit cross builds to known configurations |
| 331 | MACHDEP="unknown" |
| 332 | AC_MSG_ERROR([cross build not supported for $host]) |
| 333 | esac |
| 334 | ac_sys_release= |
| 335 | else |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 336 | ac_sys_system=`uname -s` |
Georg Brandl | fe18a11 | 2009-09-04 07:55:14 +0000 | [diff] [blame] | 337 | if test "$ac_sys_system" = "AIX" \ |
Martin v. Löwis | 21ee409 | 2002-09-30 16:19:48 +0000 | [diff] [blame] | 338 | -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 339 | ac_sys_release=`uname -v` |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 340 | else |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 341 | ac_sys_release=`uname -r` |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 342 | fi |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 343 | fi |
| 344 | ac_md_system=`echo $ac_sys_system | |
| 345 | tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'` |
| 346 | ac_md_release=`echo $ac_sys_release | |
| 347 | tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'` |
| 348 | MACHDEP="$ac_md_system$ac_md_release" |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 349 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 350 | case $MACHDEP in |
Victor Stinner | acacbaa | 2011-08-20 14:02:38 +0200 | [diff] [blame] | 351 | linux*) MACHDEP="linux2";; |
Andrew M. Kuchling | 5a3e4cb | 2001-07-20 19:29:04 +0000 | [diff] [blame] | 352 | cygwin*) MACHDEP="cygwin";; |
Jack Jansen | 8a97f4a | 2001-12-05 23:27:32 +0000 | [diff] [blame] | 353 | darwin*) MACHDEP="darwin";; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 354 | atheos*) MACHDEP="atheos";; |
Martin v. Löwis | f332228 | 2003-07-13 09:46:13 +0000 | [diff] [blame] | 355 | irix646) MACHDEP="irix6";; |
Guido van Rossum | b97ef17 | 1997-09-28 05:44:03 +0000 | [diff] [blame] | 356 | '') MACHDEP="unknown";; |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 357 | esac |
| 358 | fi |
| 359 | |
| 360 | AC_SUBST(_PYTHON_HOST_PLATFORM) |
| 361 | if test "$cross_compiling" = yes; then |
| 362 | case "$host" in |
| 363 | *-*-linux*) |
| 364 | case "$host_cpu" in |
| 365 | arm*) |
| 366 | _host_cpu=arm |
| 367 | ;; |
| 368 | *) |
| 369 | _host_cpu=$host_cpu |
| 370 | esac |
| 371 | ;; |
| 372 | *-*-cygwin*) |
| 373 | _host_cpu= |
| 374 | ;; |
| 375 | *) |
| 376 | # for now, limit cross builds to known configurations |
| 377 | MACHDEP="unknown" |
| 378 | AC_MSG_ERROR([cross build not supported for $host]) |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 379 | esac |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 380 | _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 381 | fi |
Jack Jansen | 83f898c | 2002-12-30 22:23:40 +0000 | [diff] [blame] | 382 | |
Martin v. Löwis | e981a4e | 2002-11-11 13:26:51 +0000 | [diff] [blame] | 383 | # Some systems cannot stand _XOPEN_SOURCE being defined at all; they |
| 384 | # disable features if it is defined, without any means to access these |
| 385 | # features as extensions. For these systems, we skip the definition of |
| 386 | # _XOPEN_SOURCE. Before adding a system to the list to gain access to |
| 387 | # some feature, make sure there is no alternative way to access this |
| 388 | # feature. Also, when using wildcards, make sure you have verified the |
| 389 | # need for not defining _XOPEN_SOURCE on all systems matching the |
| 390 | # wildcard, and that the wildcard does not include future systems |
| 391 | # (which may remove their limitations). |
| 392 | dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output |
| 393 | case $ac_sys_system/$ac_sys_release in |
| 394 | # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, |
| 395 | # 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] | 396 | # 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] | 397 | # In addition, Stefan Krah confirms that issue #1244610 exists through |
| 398 | # OpenBSD 4.6, but is fixed in 4.7. |
Charles-François Natali | 97781b0 | 2011-07-22 23:43:42 +0200 | [diff] [blame] | 399 | OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@) |
Martin v. Löwis | cb78de6 | 2007-12-29 18:49:21 +0000 | [diff] [blame] | 400 | define_xopen_source=no |
| 401 | # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is |
| 402 | # also defined. This can be overridden by defining _BSD_SOURCE |
| 403 | # As this has a different meaning on Linux, only define it on OpenBSD |
| 404 | AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features]) |
| 405 | ;; |
Charles-François Natali | 97781b0 | 2011-07-22 23:43:42 +0200 | [diff] [blame] | 406 | OpenBSD/*) |
Martin v. Löwis | 5e2dd86 | 2010-02-15 08:32:00 +0000 | [diff] [blame] | 407 | # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is |
| 408 | # also defined. This can be overridden by defining _BSD_SOURCE |
| 409 | # As this has a different meaning on Linux, only define it on OpenBSD |
| 410 | AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features]) |
| 411 | ;; |
Martin v. Löwis | 4d542ec | 2006-11-25 15:39:19 +0000 | [diff] [blame] | 412 | # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of |
| 413 | # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by |
| 414 | # Marc Recht |
Georg Brandl | 4b9bcfc | 2008-11-16 08:00:17 +0000 | [diff] [blame] | 415 | 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] | 416 | define_xopen_source=no;; |
Martin v. Löwis | b41afb5 | 2010-05-28 15:28:47 +0000 | [diff] [blame] | 417 | # From the perspective of Solaris, _XOPEN_SOURCE is not so much a |
| 418 | # request to enable features supported by the standard as a request |
| 419 | # to disable features not supported by the standard. The best way |
| 420 | # for Python to use Solaris is simply to leave _XOPEN_SOURCE out |
| 421 | # entirely and define __EXTENSIONS__ instead. |
| 422 | SunOS/*) |
Martin v. Löwis | a9d7142 | 2003-03-28 18:43:31 +0000 | [diff] [blame] | 423 | define_xopen_source=no;; |
Martin v. Löwis | c2409b4 | 2003-05-11 05:53:41 +0000 | [diff] [blame] | 424 | # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, |
| 425 | # 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] | 426 | # Reconfirmed for 7.1.4 by Martin v. Loewis. |
| 427 | OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@) |
Martin v. Löwis | c2409b4 | 2003-05-11 05:53:41 +0000 | [diff] [blame] | 428 | define_xopen_source=no;; |
| 429 | # 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] | 430 | # 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] | 431 | SCO_SV/3.2) |
Martin v. Löwis | 53e73c3 | 2003-05-05 05:13:18 +0000 | [diff] [blame] | 432 | define_xopen_source=no;; |
Martin v. Löwis | bb86d83 | 2008-11-04 20:40:09 +0000 | [diff] [blame] | 433 | # On FreeBSD 4, the math functions C89 does not cover are never defined |
| 434 | # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. |
| 435 | FreeBSD/4.*) |
| 436 | define_xopen_source=no;; |
| 437 | # On MacOS X 10.2, a bug in ncurses.h means that it craps out if |
| 438 | # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which |
| 439 | # identifies itself as Darwin/7.* |
| 440 | # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE |
| 441 | # disables platform specific features beyond repair. |
| 442 | # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE |
| 443 | # has no effect, don't bother defining them |
| 444 | Darwin/@<:@6789@:>@.*) |
Anthony Baxter | 6169c6b | 2003-10-04 07:46:23 +0000 | [diff] [blame] | 445 | define_xopen_source=no;; |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 446 | Darwin/1@<:@0-9@:>@.*) |
| 447 | define_xopen_source=no;; |
Trent Mick | af16e8c | 2004-08-25 23:55:59 +0000 | [diff] [blame] | 448 | # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but |
| 449 | # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined |
| 450 | # 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] | 451 | AIX/4) |
| 452 | define_xopen_source=no;; |
Trent Mick | af16e8c | 2004-08-25 23:55:59 +0000 | [diff] [blame] | 453 | AIX/5) |
| 454 | if test `uname -r` -eq 1; then |
| 455 | define_xopen_source=no |
| 456 | fi |
| 457 | ;; |
Martin v. Löwis | 8c255e4 | 2008-05-23 15:06:50 +0000 | [diff] [blame] | 458 | # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from |
| 459 | # defining NI_NUMERICHOST. |
| 460 | QNX/6.3.2) |
| 461 | define_xopen_source=no |
| 462 | ;; |
Martin v. Löwis | a058836 | 2006-04-04 06:03:50 +0000 | [diff] [blame] | 463 | |
Martin v. Löwis | e981a4e | 2002-11-11 13:26:51 +0000 | [diff] [blame] | 464 | esac |
| 465 | |
| 466 | if test $define_xopen_source = yes |
| 467 | then |
Martin v. Löwis | b41afb5 | 2010-05-28 15:28:47 +0000 | [diff] [blame] | 468 | AC_DEFINE(_XOPEN_SOURCE, 600, |
| 469 | 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] | 470 | |
| 471 | # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires |
| 472 | # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else |
| 473 | # several APIs are not declared. Since this is also needed in some |
| 474 | # cases for HP-UX, we define it globally. |
Martin v. Löwis | b41afb5 | 2010-05-28 15:28:47 +0000 | [diff] [blame] | 475 | AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, |
| 476 | Define to activate Unix95-and-earlier features) |
Martin v. Löwis | 678fc1e | 2002-11-12 06:04:39 +0000 | [diff] [blame] | 477 | |
Bob Ippolito | 7026a0a | 2005-03-28 23:23:47 +0000 | [diff] [blame] | 478 | AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001) |
| 479 | |
Martin v. Löwis | e981a4e | 2002-11-11 13:26:51 +0000 | [diff] [blame] | 480 | fi |
| 481 | |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 482 | # |
| 483 | # SGI compilers allow the specification of the both the ABI and the |
| 484 | # ISA on the command line. Depending on the values of these switches, |
Martin Panter | b1d867f | 2016-05-26 05:28:50 +0000 | [diff] [blame] | 485 | # different and often incompatible code will be generated. |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 486 | # |
| 487 | # The SGI_ABI variable can be used to modify the CC and LDFLAGS and |
| 488 | # thus supply support for various ABI/ISA combinations. The MACHDEP |
| 489 | # variable is also adjusted. |
| 490 | # |
| 491 | AC_SUBST(SGI_ABI) |
| 492 | if test ! -z "$SGI_ABI" |
| 493 | then |
| 494 | CC="cc $SGI_ABI" |
| 495 | LDFLAGS="$SGI_ABI $LDFLAGS" |
| 496 | MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'` |
| 497 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 498 | AC_MSG_RESULT($MACHDEP) |
| 499 | |
doko@ubuntu.com | 9e7ece2 | 2015-04-13 21:55:08 +0200 | [diff] [blame] | 500 | AC_SUBST(PLATDIR) |
| 501 | PLATDIR=plat-$MACHDEP |
| 502 | |
Jack Jansen | 83f898c | 2002-12-30 22:23:40 +0000 | [diff] [blame] | 503 | # And add extra plat-mac for darwin |
| 504 | AC_SUBST(EXTRAPLATDIR) |
Jack Jansen | 7b59b42 | 2003-03-17 15:44:10 +0000 | [diff] [blame] | 505 | AC_SUBST(EXTRAMACHDEPPATH) |
Jack Jansen | 83f898c | 2002-12-30 22:23:40 +0000 | [diff] [blame] | 506 | AC_MSG_CHECKING(EXTRAPLATDIR) |
| 507 | if test -z "$EXTRAPLATDIR" |
| 508 | then |
| 509 | case $MACHDEP in |
Jack Jansen | 7b59b42 | 2003-03-17 15:44:10 +0000 | [diff] [blame] | 510 | darwin) |
| 511 | EXTRAPLATDIR="\$(PLATMACDIRS)" |
| 512 | EXTRAMACHDEPPATH="\$(PLATMACPATH)" |
| 513 | ;; |
| 514 | *) |
| 515 | EXTRAPLATDIR="" |
| 516 | EXTRAMACHDEPPATH="" |
| 517 | ;; |
Jack Jansen | 83f898c | 2002-12-30 22:23:40 +0000 | [diff] [blame] | 518 | esac |
| 519 | fi |
| 520 | AC_MSG_RESULT($EXTRAPLATDIR) |
| 521 | |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 522 | # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET, |
| 523 | # it may influence the way we can build extensions, so distutils |
| 524 | # needs to check it |
| 525 | AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET) |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 526 | AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET) |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 527 | CONFIGURE_MACOSX_DEPLOYMENT_TARGET= |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 528 | EXPORT_MACOSX_DEPLOYMENT_TARGET='#' |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 529 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 530 | # checks for alternative programs |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 531 | |
| 532 | # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just |
| 533 | # for debug/optimization stuff. BASECFLAGS is for flags that are required |
| 534 | # just to get things to compile and link. Users are free to override OPT |
| 535 | # when running configure or make. The build should not break if they do. |
| 536 | # BASECFLAGS should generally not be messed with, however. |
| 537 | |
| 538 | # XXX shouldn't some/most/all of this code be merged with the stuff later |
| 539 | # on that fiddles with OPT and BASECFLAGS? |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 540 | AC_MSG_CHECKING(for --without-gcc) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 541 | AC_ARG_WITH(gcc, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 542 | AS_HELP_STRING([--without-gcc], [never use gcc]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 543 | [ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 544 | case $withval in |
Skip Montanaro | 516144f | 2009-01-04 10:36:58 +0000 | [diff] [blame] | 545 | no) CC=${CC:-cc} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 546 | without_gcc=yes;; |
| 547 | yes) CC=gcc |
| 548 | without_gcc=no;; |
| 549 | *) CC=$withval |
| 550 | without_gcc=$withval;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 551 | esac], [ |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 552 | case $ac_sys_system in |
Antoine Pitrou | 285cd16 | 2010-09-21 15:23:17 +0000 | [diff] [blame] | 553 | AIX*) CC=${CC:-xlc_r} |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 554 | without_gcc=;; |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 555 | BeOS*) |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 556 | case $BE_HOST_CPU in |
| 557 | ppc) |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 558 | CC=mwcc |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 559 | without_gcc=yes |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 560 | BASECFLAGS="$BASECFLAGS -export pragma" |
| 561 | OPT="$OPT -O" |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 562 | LDFLAGS="$LDFLAGS -nodup" |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 563 | ;; |
| 564 | x86) |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 565 | CC=gcc |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 566 | without_gcc=no |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 567 | OPT="$OPT -O" |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 568 | ;; |
| 569 | *) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 570 | AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"]) |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 571 | ;; |
| 572 | esac |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 573 | AR="\$(srcdir)/Modules/ar_beos" |
| 574 | RANLIB=: |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 575 | ;; |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 576 | *) without_gcc=no;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 577 | esac]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 578 | AC_MSG_RESULT($without_gcc) |
| 579 | |
Zachary Ware | 6ed42ea | 2015-12-21 11:43:03 -0600 | [diff] [blame] | 580 | AC_MSG_CHECKING(for --with-icc) |
| 581 | AC_ARG_WITH(icc, |
| 582 | AS_HELP_STRING([--with-icc], [build with icc]), |
| 583 | [ |
| 584 | case $withval in |
| 585 | no) CC=${CC:-cc} |
| 586 | with_icc=no;; |
| 587 | yes) CC=icc |
| 588 | CXX=icpc |
| 589 | with_icc=yes;; |
| 590 | *) CC=$withval |
| 591 | with_icc=$withval;; |
| 592 | esac], [ |
| 593 | with_icc=no]) |
| 594 | AC_MSG_RESULT($with_icc) |
| 595 | |
Guido van Rossum | 03ad99f | 1995-03-09 14:09:54 +0000 | [diff] [blame] | 596 | # If the user switches compilers, we can't believe the cache |
| 597 | if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" |
| 598 | then |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 599 | AC_MSG_ERROR([cached CC is different -- throw away $cache_file |
| 600 | (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] | 601 | fi |
| 602 | |
Trent Nelson | 15daa35 | 2012-12-13 06:46:39 +0000 | [diff] [blame] | 603 | if test "$MACHDEP" = "irix6" && test "$CC" != "gcc"; then |
| 604 | # Normally, MIPSpro CC treats #error directives as warnings, which means |
| 605 | # a successful exit code is returned (0). This is a problem because IRIX |
| 606 | # has a bunch of system headers with this guard at the top: |
| 607 | # |
| 608 | # #ifndef __c99 |
| 609 | # #error This header file is to be used only for c99 mode compilations |
| 610 | # #else |
| 611 | # |
| 612 | # When autoconf tests for such a header, like stdint.h, this happens: |
| 613 | # |
| 614 | # configure:4619: cc -c conftest.c >&5 |
| 615 | # cc-1035 cc: WARNING File = /usr/include/stdint.h, Line = 5 |
| 616 | # #error directive: This header file is to be used only for c99 mode |
| 617 | # compilations |
| 618 | # |
| 619 | # #error This header file is to be used only for c99 mode compilations |
| 620 | # ^ |
| 621 | # |
| 622 | # configure:4619: $? = 0 |
| 623 | # configure:4619: result: yes |
| 624 | # |
| 625 | # Therefore, we use `-diag_error 1035` to have the compiler treat the |
| 626 | # warning as an error, which causes cc to return a non-zero result, |
| 627 | # which autoconf can interpret correctly. |
| 628 | CFLAGS="$CFLAGS -diag_error 1035" |
| 629 | # Whilst we're here, we might as well make sure CXX defaults to something |
| 630 | # sensible if we're not using gcc. |
| 631 | if test -z "$CXX"; then |
| 632 | CXX="CC" |
| 633 | fi |
| 634 | fi |
| 635 | |
Marc-André Lemburg | 6d5e579 | 2010-04-30 17:20:14 +0000 | [diff] [blame] | 636 | # If the user set CFLAGS, use this instead of the automatically |
| 637 | # determined setting |
| 638 | preset_cflags="$CFLAGS" |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 639 | AC_PROG_CC |
Marc-André Lemburg | 6d5e579 | 2010-04-30 17:20:14 +0000 | [diff] [blame] | 640 | if test ! -z "$preset_cflags" |
| 641 | then |
| 642 | CFLAGS=$preset_cflags |
| 643 | fi |
Martin v. Löwis | 1d5ecb7 | 2001-08-09 10:29:44 +0000 | [diff] [blame] | 644 | |
Martin v. Löwis | 0f48d98 | 2006-04-14 14:34:26 +0000 | [diff] [blame] | 645 | AC_SUBST(CXX) |
| 646 | AC_SUBST(MAINCC) |
| 647 | AC_MSG_CHECKING(for --with-cxx-main=<compiler>) |
| 648 | AC_ARG_WITH(cxx_main, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 649 | AS_HELP_STRING([--with-cxx-main=<compiler>], |
Martin v. Löwis | 0f48d98 | 2006-04-14 14:34:26 +0000 | [diff] [blame] | 650 | [compile main() and link python executable with C++ compiler]), |
| 651 | [ |
| 652 | |
| 653 | case $withval in |
| 654 | no) with_cxx_main=no |
| 655 | MAINCC='$(CC)';; |
| 656 | yes) with_cxx_main=yes |
| 657 | MAINCC='$(CXX)';; |
| 658 | *) with_cxx_main=yes |
| 659 | MAINCC=$withval |
| 660 | if test -z "$CXX" |
| 661 | then |
| 662 | CXX=$withval |
| 663 | fi;; |
| 664 | esac], [ |
| 665 | with_cxx_main=no |
| 666 | MAINCC='$(CC)' |
| 667 | ]) |
| 668 | AC_MSG_RESULT($with_cxx_main) |
| 669 | |
| 670 | preset_cxx="$CXX" |
| 671 | if test -z "$CXX" |
| 672 | then |
| 673 | case "$CC" in |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 674 | gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;; |
| 675 | cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;; |
Martin v. Löwis | 0f48d98 | 2006-04-14 14:34:26 +0000 | [diff] [blame] | 676 | esac |
| 677 | if test "$CXX" = "notfound" |
| 678 | then |
| 679 | CXX="" |
| 680 | fi |
| 681 | fi |
| 682 | if test -z "$CXX" |
| 683 | then |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 684 | 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] | 685 | if test "$CXX" = "notfound" |
| 686 | then |
| 687 | CXX="" |
| 688 | fi |
| 689 | fi |
| 690 | if test "$preset_cxx" != "$CXX" |
| 691 | then |
| 692 | AC_MSG_WARN([ |
| 693 | |
| 694 | By default, distutils will build C++ extension modules with "$CXX". |
| 695 | If this is not intended, then set CXX on the configure command line. |
| 696 | ]) |
| 697 | fi |
| 698 | |
doko@python.org | 4e63fbe | 2013-01-25 13:08:27 +0100 | [diff] [blame] | 699 | MULTIARCH=$($CC --print-multiarch 2>/dev/null) |
| 700 | AC_SUBST(MULTIARCH) |
| 701 | |
Martin v. Löwis | 0f48d98 | 2006-04-14 14:34:26 +0000 | [diff] [blame] | 702 | |
Martin v. Löwis | 1d5ecb7 | 2001-08-09 10:29:44 +0000 | [diff] [blame] | 703 | # checks for UNIX variants that set C preprocessor variables |
Matthias Klose | 9f8e0c1 | 2010-05-08 10:17:27 +0000 | [diff] [blame] | 704 | AC_USE_SYSTEM_EXTENSIONS |
Martin v. Löwis | 1d5ecb7 | 2001-08-09 10:29:44 +0000 | [diff] [blame] | 705 | |
Martin v. Löwis | 779ffc0 | 2002-12-02 22:17:01 +0000 | [diff] [blame] | 706 | # Check for unsupported systems |
| 707 | case $ac_sys_system/$ac_sys_release in |
Brett Cannon | 19fab76 | 2007-06-02 03:02:29 +0000 | [diff] [blame] | 708 | atheos*|Linux*/1*) |
Martin v. Löwis | 779ffc0 | 2002-12-02 22:17:01 +0000 | [diff] [blame] | 709 | echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported. |
| 710 | echo See README for details. |
| 711 | exit 1;; |
| 712 | esac |
| 713 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 714 | AC_EXEEXT |
Neil Schemenauer | 3ae1d0a | 2001-01-27 06:54:42 +0000 | [diff] [blame] | 715 | AC_MSG_CHECKING(for --with-suffix) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 716 | AC_ARG_WITH(suffix, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 717 | AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 718 | [ |
Neil Schemenauer | 3ae1d0a | 2001-01-27 06:54:42 +0000 | [diff] [blame] | 719 | case $withval in |
| 720 | no) EXEEXT=;; |
| 721 | yes) EXEEXT=.exe;; |
| 722 | *) EXEEXT=$withval;; |
| 723 | esac]) |
| 724 | AC_MSG_RESULT($EXEEXT) |
Jack Jansen | 1999ef4 | 2001-12-06 21:47:20 +0000 | [diff] [blame] | 725 | |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 726 | # Test whether we're running on a non-case-sensitive system, in which |
| 727 | # case we give a warning if no ext is given |
Jack Jansen | 1999ef4 | 2001-12-06 21:47:20 +0000 | [diff] [blame] | 728 | AC_SUBST(BUILDEXEEXT) |
| 729 | AC_MSG_CHECKING(for case-insensitive build directory) |
Jack Jansen | 3c2c433 | 2002-11-06 13:33:32 +0000 | [diff] [blame] | 730 | if test ! -d CaseSensitiveTestDir; then |
| 731 | mkdir CaseSensitiveTestDir |
| 732 | fi |
| 733 | |
| 734 | if test -d casesensitivetestdir |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 735 | then |
Jack Jansen | 1999ef4 | 2001-12-06 21:47:20 +0000 | [diff] [blame] | 736 | AC_MSG_RESULT(yes) |
| 737 | BUILDEXEEXT=.exe |
| 738 | else |
| 739 | AC_MSG_RESULT(no) |
Jack Jansen | dd19cf8 | 2001-12-06 22:36:17 +0000 | [diff] [blame] | 740 | BUILDEXEEXT=$EXEEXT |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 741 | fi |
Jack Jansen | 3c2c433 | 2002-11-06 13:33:32 +0000 | [diff] [blame] | 742 | rmdir CaseSensitiveTestDir |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 743 | |
Guido van Rossum | dd997f7 | 1998-10-07 19:58:26 +0000 | [diff] [blame] | 744 | case $MACHDEP in |
| 745 | bsdos*) |
| 746 | case $CC in |
| 747 | gcc) CC="$CC -D_HAVE_BSDI";; |
| 748 | esac;; |
| 749 | esac |
| 750 | |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 751 | case $ac_sys_system in |
| 752 | hp*|HP*) |
| 753 | case $CC in |
Guido van Rossum | cd5ff9f | 2000-09-22 16:15:54 +0000 | [diff] [blame] | 754 | cc|*/cc) CC="$CC -Ae";; |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 755 | esac;; |
Martin v. Löwis | e8964d4 | 2001-03-06 12:09:07 +0000 | [diff] [blame] | 756 | SunOS*) |
| 757 | # 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] | 758 | 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] | 759 | ;; |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 760 | esac |
| 761 | |
Martin v. Löwis | e8964d4 | 2001-03-06 12:09:07 +0000 | [diff] [blame] | 762 | |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 763 | AC_SUBST(LIBRARY) |
| 764 | AC_MSG_CHECKING(LIBRARY) |
| 765 | if test -z "$LIBRARY" |
| 766 | then |
| 767 | LIBRARY='libpython$(VERSION).a' |
| 768 | fi |
| 769 | AC_MSG_RESULT($LIBRARY) |
| 770 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 771 | # 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] | 772 | # name of the library into which to insert object files). BLDLIBRARY is also |
| 773 | # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY |
| 774 | # is blank as the main program is not linked directly against LDLIBRARY. |
| 775 | # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On |
| 776 | # systems without shared libraries, LDLIBRARY is the same as LIBRARY |
| 777 | # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library, |
| 778 | # DLLLIBRARY is the shared (i.e., DLL) library. |
| 779 | # |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 780 | # RUNSHARED is used to run shared python without installed libraries |
| 781 | # |
| 782 | # INSTSONAME is the name of the shared library that will be use to install |
| 783 | # on the system - some systems like version suffix, others don't |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 784 | AC_SUBST(LDLIBRARY) |
Guido van Rossum | 2755290 | 2001-01-23 01:52:26 +0000 | [diff] [blame] | 785 | AC_SUBST(DLLLIBRARY) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 786 | AC_SUBST(BLDLIBRARY) |
| 787 | AC_SUBST(LDLIBRARYDIR) |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 788 | AC_SUBST(INSTSONAME) |
| 789 | AC_SUBST(RUNSHARED) |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 790 | LDLIBRARY="$LIBRARY" |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 791 | BLDLIBRARY='$(LDLIBRARY)' |
Martin v. Löwis | 09bdf72 | 2002-05-08 08:51:29 +0000 | [diff] [blame] | 792 | INSTSONAME='$(LDLIBRARY)' |
Guido van Rossum | 2755290 | 2001-01-23 01:52:26 +0000 | [diff] [blame] | 793 | DLLLIBRARY='' |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 794 | LDLIBRARYDIR='' |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 795 | RUNSHARED='' |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 796 | |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 797 | # 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] | 798 | # If CXX is set, and if it is needed to link a main function that was |
| 799 | # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable: |
| 800 | # python might then depend on the C++ runtime |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 801 | # 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] | 802 | # linking. |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 803 | AC_SUBST(LINKCC) |
| 804 | AC_MSG_CHECKING(LINKCC) |
| 805 | if test -z "$LINKCC" |
| 806 | then |
Martin v. Löwis | 0f48d98 | 2006-04-14 14:34:26 +0000 | [diff] [blame] | 807 | LINKCC='$(PURIFY) $(MAINCC)' |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 808 | case $ac_sys_system in |
| 809 | AIX*) |
Neal Norwitz | 0b27ff9 | 2003-03-31 15:53:49 +0000 | [diff] [blame] | 810 | exp_extra="\"\"" |
| 811 | if test $ac_sys_release -ge 5 -o \ |
| 812 | $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then |
| 813 | exp_extra="." |
| 814 | fi |
| 815 | 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] | 816 | QNX*) |
| 817 | # qcc must be used because the other compilers do not |
| 818 | # support -N. |
| 819 | LINKCC=qcc;; |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 820 | esac |
| 821 | fi |
| 822 | AC_MSG_RESULT($LINKCC) |
| 823 | |
Tarek Ziadé | e2be83d | 2009-05-09 08:28:53 +0000 | [diff] [blame] | 824 | # GNULD is set to "yes" if the GNU linker is used. If this goes wrong |
| 825 | # make sure we default having it set to "no": this is used by |
| 826 | # distutils.unixccompiler to know if it should add --enable-new-dtags |
| 827 | # to linker command lines, and failing to detect GNU ld simply results |
| 828 | # in the same bahaviour as before. |
| 829 | AC_SUBST(GNULD) |
| 830 | AC_MSG_CHECKING(for GNU ld) |
| 831 | ac_prog=ld |
| 832 | if test "$GCC" = yes; then |
| 833 | ac_prog=`$CC -print-prog-name=ld` |
| 834 | fi |
| 835 | case `"$ac_prog" -V 2>&1 < /dev/null` in |
| 836 | *GNU*) |
| 837 | GNULD=yes;; |
| 838 | *) |
| 839 | GNULD=no;; |
| 840 | esac |
| 841 | AC_MSG_RESULT($GNULD) |
| 842 | |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 843 | AC_MSG_CHECKING(for --enable-shared) |
| 844 | AC_ARG_ENABLE(shared, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 845 | AS_HELP_STRING([--enable-shared], [disable/enable building shared python library])) |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 846 | |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 847 | if test -z "$enable_shared" |
| 848 | then |
Martin v. Löwis | b51033d | 2002-05-03 05:53:15 +0000 | [diff] [blame] | 849 | case $ac_sys_system in |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 850 | CYGWIN* | atheos*) |
Martin v. Löwis | b51033d | 2002-05-03 05:53:15 +0000 | [diff] [blame] | 851 | enable_shared="yes";; |
| 852 | *) |
| 853 | enable_shared="no";; |
| 854 | esac |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 855 | fi |
| 856 | AC_MSG_RESULT($enable_shared) |
| 857 | |
Skip Montanaro | 56f6a4f | 2004-06-18 02:47:22 +0000 | [diff] [blame] | 858 | AC_MSG_CHECKING(for --enable-profiling) |
| 859 | AC_ARG_ENABLE(profiling, |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 860 | AS_HELP_STRING([--enable-profiling], [enable C-level code profiling])) |
| 861 | if test "x$enable_profiling" = xyes; then |
| 862 | ac_save_cc="$CC" |
Benjamin Peterson | b9be7bb | 2013-03-26 08:55:37 -0400 | [diff] [blame] | 863 | CC="$CC -pg" |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 864 | AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], |
| 865 | [], |
| 866 | [enable_profiling=no]) |
| 867 | CC="$ac_save_cc" |
| 868 | else |
| 869 | enable_profiling=no |
| 870 | fi |
| 871 | AC_MSG_RESULT($enable_profiling) |
Skip Montanaro | 56f6a4f | 2004-06-18 02:47:22 +0000 | [diff] [blame] | 872 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 873 | if test "x$enable_profiling" = xyes; then |
| 874 | BASECFLAGS="-pg $BASECFLAGS" |
| 875 | LDFLAGS="-pg $LDFLAGS" |
| 876 | fi |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 877 | |
| 878 | AC_MSG_CHECKING(LDLIBRARY) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 879 | |
Guido van Rossum | b855216 | 2001-09-05 14:58:11 +0000 | [diff] [blame] | 880 | # MacOSX framework builds need more magic. LDLIBRARY is the dynamic |
| 881 | # library that we build, but we do not want to link against it (we |
| 882 | # will find it with a -framework option). For this reason there is an |
| 883 | # extra variable BLDLIBRARY against which Python and the extension |
| 884 | # modules are linked, BLDLIBRARY. This is normally the same as |
| 885 | # LDLIBRARY, but empty for MacOSX framework builds. |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 886 | if test "$enable_framework" |
| 887 | then |
| 888 | LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 889 | RUNSHARED=DYLD_FRAMEWORK_PATH=`pwd`${DYLD_FRAMEWORK_PATH:+:${DYLD_FRAMEWORK_PATH}} |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 890 | BLDLIBRARY='' |
| 891 | else |
| 892 | BLDLIBRARY='$(LDLIBRARY)' |
| 893 | fi |
| 894 | |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 895 | # Other platforms follow |
| 896 | if test $enable_shared = "yes"; then |
Mark Hammond | 8235ea1 | 2002-07-19 06:55:41 +0000 | [diff] [blame] | 897 | 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] | 898 | case $ac_sys_system in |
| 899 | BeOS*) |
| 900 | LDLIBRARY='libpython$(VERSION).so' |
| 901 | ;; |
| 902 | CYGWIN*) |
| 903 | LDLIBRARY='libpython$(VERSION).dll.a' |
| 904 | DLLLIBRARY='libpython$(VERSION).dll' |
| 905 | ;; |
| 906 | SunOS*) |
| 907 | LDLIBRARY='libpython$(VERSION).so' |
Martin v. Löwis | d141a8c | 2003-06-14 15:20:28 +0000 | [diff] [blame] | 908 | BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 909 | 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] | 910 | INSTSONAME="$LDLIBRARY".$SOVERSION |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 911 | ;; |
Charles-François Natali | 3de8c73 | 2011-07-24 22:33:35 +0200 | [diff] [blame] | 912 | Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 913 | LDLIBRARY='libpython$(VERSION).so' |
| 914 | BLDLIBRARY='-L. -lpython$(VERSION)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 915 | RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} |
Hye-Shik Chang | 3376149 | 2004-10-26 09:53:46 +0000 | [diff] [blame] | 916 | case $ac_sys_system in |
| 917 | FreeBSD*) |
| 918 | SOVERSION=`echo $SOVERSION|cut -d "." -f 1` |
| 919 | ;; |
| 920 | esac |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 921 | INSTSONAME="$LDLIBRARY".$SOVERSION |
| 922 | ;; |
| 923 | hp*|HP*) |
Neal Norwitz | 58e2888 | 2006-05-19 07:00:58 +0000 | [diff] [blame] | 924 | case `uname -m` in |
| 925 | ia64) |
| 926 | LDLIBRARY='libpython$(VERSION).so' |
| 927 | ;; |
| 928 | *) |
| 929 | LDLIBRARY='libpython$(VERSION).sl' |
| 930 | ;; |
| 931 | esac |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 932 | BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 933 | RUNSHARED=SHLIB_PATH=`pwd`${SHLIB_PATH:+:${SHLIB_PATH}} |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 934 | ;; |
| 935 | OSF*) |
| 936 | LDLIBRARY='libpython$(VERSION).so' |
Neal Norwitz | 671b9e3 | 2006-01-09 07:07:12 +0000 | [diff] [blame] | 937 | BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 938 | 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] | 939 | ;; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 940 | atheos*) |
| 941 | LDLIBRARY='libpython$(VERSION).so' |
| 942 | BLDLIBRARY='-L. -lpython$(VERSION)' |
| 943 | RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib} |
| 944 | ;; |
Ronald Oussoren | 79f9049 | 2009-01-02 10:44:46 +0000 | [diff] [blame] | 945 | Darwin*) |
| 946 | LDLIBRARY='libpython$(VERSION).dylib' |
| 947 | BLDLIBRARY='-L. -lpython$(VERSION)' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 948 | RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}} |
Ronald Oussoren | 79f9049 | 2009-01-02 10:44:46 +0000 | [diff] [blame] | 949 | ;; |
Antoine Pitrou | aabdceb | 2010-09-10 20:03:17 +0000 | [diff] [blame] | 950 | AIX*) |
| 951 | LDLIBRARY='libpython$(VERSION).so' |
doko@ubuntu.com | 9ba90c9 | 2014-05-07 04:41:26 +0200 | [diff] [blame] | 952 | RUNSHARED=LIBPATH=`pwd`${LIBPATH:+:${LIBPATH}} |
Antoine Pitrou | aabdceb | 2010-09-10 20:03:17 +0000 | [diff] [blame] | 953 | ;; |
Ronald Oussoren | 79f9049 | 2009-01-02 10:44:46 +0000 | [diff] [blame] | 954 | |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 955 | esac |
Jason Tishler | 3076559 | 2003-09-04 11:04:06 +0000 | [diff] [blame] | 956 | else # shared is disabled |
| 957 | case $ac_sys_system in |
| 958 | CYGWIN*) |
| 959 | BLDLIBRARY='$(LIBRARY)' |
| 960 | LDLIBRARY='libpython$(VERSION).dll.a' |
| 961 | ;; |
| 962 | esac |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 963 | fi |
| 964 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 965 | if test "$cross_compiling" = yes; then |
| 966 | RUNSHARED= |
| 967 | fi |
| 968 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 969 | AC_MSG_RESULT($LDLIBRARY) |
| 970 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 971 | AC_PROG_RANLIB |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 972 | AC_SUBST(AR) |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 973 | AC_CHECK_TOOLS(AR, ar aal, ar) |
Neil Schemenauer | a42c827 | 2001-03-31 00:01:55 +0000 | [diff] [blame] | 974 | |
Tarek Ziadé | 99f660a | 2009-05-07 21:20:34 +0000 | [diff] [blame] | 975 | # tweak ARFLAGS only if the user didn't set it on the command line |
| 976 | AC_SUBST(ARFLAGS) |
| 977 | if test -z "$ARFLAGS" |
| 978 | then |
| 979 | ARFLAGS="rc" |
| 980 | fi |
| 981 | |
Martin v. Löwis | dea59e5 | 2006-01-05 10:00:36 +0000 | [diff] [blame] | 982 | AC_SUBST(SVNVERSION) |
Martin v. Löwis | ff60023 | 2006-04-03 19:12:32 +0000 | [diff] [blame] | 983 | AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found) |
Martin v. Löwis | c5bf5a0 | 2006-01-05 10:33:59 +0000 | [diff] [blame] | 984 | if test $SVNVERSION = found |
| 985 | then |
| 986 | SVNVERSION="svnversion \$(srcdir)" |
| 987 | else |
Benjamin Peterson | e5afa3b | 2009-05-23 19:24:37 +0000 | [diff] [blame] | 988 | SVNVERSION="echo Unversioned directory" |
Martin v. Löwis | c5bf5a0 | 2006-01-05 10:33:59 +0000 | [diff] [blame] | 989 | fi |
Martin v. Löwis | dea59e5 | 2006-01-05 10:00:36 +0000 | [diff] [blame] | 990 | |
Georg Brandl | 3a5508e | 2011-03-06 10:42:21 +0100 | [diff] [blame] | 991 | AC_SUBST(HGVERSION) |
| 992 | AC_SUBST(HGTAG) |
| 993 | AC_SUBST(HGBRANCH) |
| 994 | AC_CHECK_PROG(HAS_HG, hg, found, not-found) |
| 995 | if test $HAS_HG = found |
| 996 | then |
| 997 | HGVERSION="hg id -i \$(srcdir)" |
| 998 | HGTAG="hg id -t \$(srcdir)" |
| 999 | HGBRANCH="hg id -b \$(srcdir)" |
| 1000 | else |
| 1001 | HGVERSION="" |
| 1002 | HGTAG="" |
| 1003 | HGBRANCH="" |
| 1004 | fi |
| 1005 | |
Neil Schemenauer | a42c827 | 2001-03-31 00:01:55 +0000 | [diff] [blame] | 1006 | case $MACHDEP in |
Neil Schemenauer | af5567f | 2001-10-21 22:32:04 +0000 | [diff] [blame] | 1007 | bsdos*|hp*|HP*) |
| 1008 | # install -d does not work on BSDI or HP-UX |
Neil Schemenauer | a42c827 | 2001-03-31 00:01:55 +0000 | [diff] [blame] | 1009 | if test -z "$INSTALL" |
| 1010 | then |
| 1011 | INSTALL="${srcdir}/install-sh -c" |
| 1012 | fi |
| 1013 | esac |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 1014 | AC_PROG_INSTALL |
Trent Nelson | f6407a1 | 2012-08-30 14:56:13 +0000 | [diff] [blame] | 1015 | AC_PROG_MKDIR_P |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 1016 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1017 | # Not every filesystem supports hard links |
| 1018 | AC_SUBST(LN) |
| 1019 | if test -z "$LN" ; then |
| 1020 | case $ac_sys_system in |
| 1021 | BeOS*) LN="ln -s";; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 1022 | CYGWIN*) LN="ln -s";; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 1023 | atheos*) LN="ln -s";; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1024 | *) LN=ln;; |
| 1025 | esac |
| 1026 | fi |
| 1027 | |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1028 | # Check for --with-pydebug |
| 1029 | AC_MSG_CHECKING(for --with-pydebug) |
| 1030 | AC_ARG_WITH(pydebug, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 1031 | AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 1032 | [ |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1033 | if test "$withval" != no |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 1034 | then |
| 1035 | AC_DEFINE(Py_DEBUG, 1, |
| 1036 | [Define if you want to build an interpreter with many run-time checks.]) |
| 1037 | AC_MSG_RESULT(yes); |
| 1038 | Py_DEBUG='true' |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1039 | else AC_MSG_RESULT(no); Py_DEBUG='false' |
| 1040 | fi], |
| 1041 | [AC_MSG_RESULT(no)]) |
| 1042 | |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1043 | # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be |
| 1044 | # merged with this chunk of code? |
| 1045 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 1046 | # Optimizer/debugger flags |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1047 | # ------------------------ |
| 1048 | # (The following bit of code is complicated enough - please keep things |
| 1049 | # indented properly. Just pretend you're editing Python code. ;-) |
| 1050 | |
| 1051 | # There are two parallel sets of case statements below, one that checks to |
| 1052 | # see if OPT was set and one that does BASECFLAGS setting based upon |
| 1053 | # compiler and platform. BASECFLAGS tweaks need to be made even if the |
| 1054 | # user set OPT. |
| 1055 | |
| 1056 | # tweak OPT based on compiler and platform, only if the user didn't set |
| 1057 | # it on the command line |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 1058 | AC_SUBST(OPT) |
Benjamin Peterson | d4b721b | 2010-03-23 20:58:37 +0000 | [diff] [blame] | 1059 | if test "${OPT-unset}" = "unset" |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 1060 | then |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1061 | case $GCC in |
| 1062 | yes) |
Skip Montanaro | 288a5be | 2006-04-13 02:00:56 +0000 | [diff] [blame] | 1063 | if test "$CC" != 'g++' ; then |
| 1064 | STRICT_PROTO="-Wstrict-prototypes" |
| 1065 | fi |
Guido van Rossum | 7c862f8 | 2007-12-13 20:50:10 +0000 | [diff] [blame] | 1066 | # For gcc 4.x we need to use -fwrapv so lets check if its supported |
| 1067 | if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then |
| 1068 | WRAP="-fwrapv" |
| 1069 | fi |
Stefan Krah | 503e5e1 | 2011-09-14 15:19:42 +0200 | [diff] [blame] | 1070 | |
| 1071 | # Clang also needs -fwrapv |
Stefan Krah | 2bc1e8f | 2011-12-08 22:26:06 +0100 | [diff] [blame] | 1072 | case $CC in |
| 1073 | *clang*) WRAP="-fwrapv" |
| 1074 | ;; |
| 1075 | esac |
Stefan Krah | 503e5e1 | 2011-09-14 15:19:42 +0200 | [diff] [blame] | 1076 | |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1077 | case $ac_cv_prog_cc_g in |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 1078 | yes) |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1079 | if test "$Py_DEBUG" = 'true' ; then |
| 1080 | # Optimization messes up debuggers, so turn it off for |
| 1081 | # debug builds. |
Mark Dickinson | d2f3e3f | 2010-05-05 22:23:58 +0000 | [diff] [blame] | 1082 | OPT="-g -O0 -Wall $STRICT_PROTO" |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1083 | else |
Guido van Rossum | 7c862f8 | 2007-12-13 20:50:10 +0000 | [diff] [blame] | 1084 | OPT="-g $WRAP -O3 -Wall $STRICT_PROTO" |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1085 | fi |
| 1086 | ;; |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 1087 | *) |
Skip Montanaro | 288a5be | 2006-04-13 02:00:56 +0000 | [diff] [blame] | 1088 | OPT="-O3 -Wall $STRICT_PROTO" |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1089 | ;; |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1090 | esac |
Martin v. Löwis | 21ee409 | 2002-09-30 16:19:48 +0000 | [diff] [blame] | 1091 | case $ac_sys_system in |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1092 | SCO_SV*) OPT="$OPT -m486 -DSCO5" |
| 1093 | ;; |
| 1094 | esac |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 1095 | ;; |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1096 | |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 1097 | *) |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1098 | OPT="-O" |
| 1099 | ;; |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 1100 | esac |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 1101 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1102 | |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1103 | AC_SUBST(BASECFLAGS) |
Ronald Oussoren | 5640ce2 | 2008-06-05 12:58:24 +0000 | [diff] [blame] | 1104 | |
| 1105 | # The -arch flags for universal builds on OSX |
| 1106 | UNIVERSAL_ARCH_FLAGS= |
| 1107 | AC_SUBST(UNIVERSAL_ARCH_FLAGS) |
| 1108 | |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1109 | # tweak BASECFLAGS based on compiler and platform |
| 1110 | case $GCC in |
| 1111 | yes) |
Martin v. Löwis | 70fedcd | 2003-07-07 21:26:19 +0000 | [diff] [blame] | 1112 | # Python violates C99 rules, by casting between incompatible |
| 1113 | # pointer types. GCC may generate bad code as a result of that, |
| 1114 | # so use -fno-strict-aliasing if supported. |
| 1115 | AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing) |
| 1116 | ac_save_cc="$CC" |
| 1117 | CC="$CC -fno-strict-aliasing" |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 1118 | AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1119 | AC_COMPILE_IFELSE( |
Mark Dickinson | 5e13e29 | 2010-05-11 08:55:06 +0000 | [diff] [blame] | 1120 | [AC_LANG_PROGRAM([[]], [[]])], |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1121 | [ac_cv_no_strict_aliasing_ok=yes], |
| 1122 | [ac_cv_no_strict_aliasing_ok=no])) |
Martin v. Löwis | 70fedcd | 2003-07-07 21:26:19 +0000 | [diff] [blame] | 1123 | CC="$ac_save_cc" |
| 1124 | AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok) |
| 1125 | if test $ac_cv_no_strict_aliasing_ok = yes |
| 1126 | then |
| 1127 | BASECFLAGS="$BASECFLAGS -fno-strict-aliasing" |
| 1128 | fi |
Mark Dickinson | 6513466 | 2008-04-25 16:11:04 +0000 | [diff] [blame] | 1129 | |
| 1130 | # if using gcc on alpha, use -mieee to get (near) full IEEE 754 |
| 1131 | # support. Without this, treatment of subnormals doesn't follow |
| 1132 | # the standard. |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 1133 | case $host in |
Mark Dickinson | 6513466 | 2008-04-25 16:11:04 +0000 | [diff] [blame] | 1134 | alpha*) |
| 1135 | BASECFLAGS="$BASECFLAGS -mieee" |
| 1136 | ;; |
| 1137 | esac |
| 1138 | |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1139 | case $ac_sys_system in |
| 1140 | SCO_SV*) |
| 1141 | BASECFLAGS="$BASECFLAGS -m486 -DSCO5" |
| 1142 | ;; |
| 1143 | # is there any other compiler on Darwin besides gcc? |
| 1144 | Darwin*) |
Jeffrey Yasskin | 1b4e45b | 2008-03-17 14:40:53 +0000 | [diff] [blame] | 1145 | # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd |
| 1146 | # used to be here, but non-Apple gcc doesn't accept them. |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 1147 | if test "${CC}" = gcc |
| 1148 | then |
| 1149 | AC_MSG_CHECKING(which compiler should be used) |
| 1150 | case "${UNIVERSALSDK}" in |
| 1151 | */MacOSX10.4u.sdk) |
| 1152 | # Build using 10.4 SDK, force usage of gcc when the |
| 1153 | # compiler is gcc, otherwise the user will get very |
| 1154 | # confusing error messages when building on OSX 10.6 |
| 1155 | CC=gcc-4.0 |
| 1156 | CPP=cpp-4.0 |
| 1157 | ;; |
| 1158 | esac |
| 1159 | AC_MSG_RESULT($CC) |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 1160 | fi |
| 1161 | |
Benjamin Peterson | 4347c44 | 2008-07-17 15:59:24 +0000 | [diff] [blame] | 1162 | # Calculate the right deployment target for this build. |
| 1163 | # |
Ned Deily | c40b903 | 2014-06-25 13:48:46 -0700 | [diff] [blame] | 1164 | cur_target_major=`sw_vers -productVersion | \ |
| 1165 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` |
| 1166 | cur_target_minor=`sw_vers -productVersion | \ |
| 1167 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` |
| 1168 | cur_target="${cur_target_major}.${cur_target_minor}" |
| 1169 | if test ${cur_target_major} -eq 10 && \ |
| 1170 | test ${cur_target_minor} -ge 3 |
| 1171 | then |
Benjamin Peterson | 4347c44 | 2008-07-17 15:59:24 +0000 | [diff] [blame] | 1172 | cur_target=10.3 |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 1173 | if test ${enable_universalsdk}; then |
| 1174 | if test "${UNIVERSAL_ARCHS}" = "all"; then |
| 1175 | # Ensure that the default platform for a |
| 1176 | # 4-way universal build is OSX 10.5, |
| 1177 | # that's the first OS release where |
| 1178 | # 4-way builds make sense. |
| 1179 | cur_target='10.5' |
Ronald Oussoren | 23d9253 | 2009-09-07 06:12:00 +0000 | [diff] [blame] | 1180 | |
| 1181 | elif test "${UNIVERSAL_ARCHS}" = "3-way"; then |
| 1182 | cur_target='10.5' |
| 1183 | |
| 1184 | elif test "${UNIVERSAL_ARCHS}" = "intel"; then |
| 1185 | cur_target='10.5' |
| 1186 | |
| 1187 | elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then |
| 1188 | cur_target='10.5' |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 1189 | fi |
| 1190 | else |
Ronald Oussoren | bc0e83c | 2010-02-11 13:26:54 +0000 | [diff] [blame] | 1191 | if test `/usr/bin/arch` = "i386"; then |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 1192 | # On Intel macs default to a deployment |
| 1193 | # target of 10.4, that's the first OSX |
| 1194 | # release with Intel support. |
| 1195 | cur_target="10.4" |
| 1196 | fi |
| 1197 | fi |
Benjamin Peterson | 4347c44 | 2008-07-17 15:59:24 +0000 | [diff] [blame] | 1198 | fi |
| 1199 | CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}} |
| 1200 | |
| 1201 | # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the |
| 1202 | # environment with a value that is the same as what we'll use |
| 1203 | # in the Makefile to ensure that we'll get the same compiler |
| 1204 | # environment during configure and build time. |
| 1205 | MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET" |
| 1206 | export MACOSX_DEPLOYMENT_TARGET |
| 1207 | EXPORT_MACOSX_DEPLOYMENT_TARGET='' |
| 1208 | |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 1209 | if test "${enable_universalsdk}"; then |
| 1210 | UNIVERSAL_ARCH_FLAGS="" |
| 1211 | if test "$UNIVERSAL_ARCHS" = "32-bit" ; then |
| 1212 | UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386" |
| 1213 | ARCH_RUN_32BIT="" |
Ronald Oussoren | 7591285 | 2010-04-08 08:13:31 +0000 | [diff] [blame] | 1214 | LIPO_32BIT_FLAGS="" |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 1215 | |
| 1216 | elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then |
| 1217 | UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64" |
| 1218 | LIPO_32BIT_FLAGS="" |
| 1219 | ARCH_RUN_32BIT="true" |
| 1220 | |
| 1221 | elif test "$UNIVERSAL_ARCHS" = "all" ; then |
| 1222 | UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64" |
| 1223 | LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386" |
Ronald Oussoren | 92397ce | 2010-01-17 19:32:00 +0000 | [diff] [blame] | 1224 | ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc" |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 1225 | |
| 1226 | elif test "$UNIVERSAL_ARCHS" = "intel" ; then |
| 1227 | UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64" |
| 1228 | LIPO_32BIT_FLAGS="-extract i386" |
Ronald Oussoren | 92397ce | 2010-01-17 19:32:00 +0000 | [diff] [blame] | 1229 | ARCH_RUN_32BIT="/usr/bin/arch -i386" |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 1230 | |
| 1231 | elif test "$UNIVERSAL_ARCHS" = "3-way" ; then |
| 1232 | UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64" |
| 1233 | LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386" |
Ronald Oussoren | 9922f17 | 2010-02-11 13:19:34 +0000 | [diff] [blame] | 1234 | ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc" |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 1235 | |
| 1236 | else |
| 1237 | AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way]) |
| 1238 | |
| 1239 | fi |
| 1240 | |
| 1241 | |
Ronald Oussoren | 974eb5e | 2010-04-18 17:59:37 +0000 | [diff] [blame] | 1242 | CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}" |
| 1243 | if test "${UNIVERSALSDK}" != "/" |
| 1244 | then |
| 1245 | CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}" |
| 1246 | LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}" |
| 1247 | CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}" |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 1248 | fi |
| 1249 | |
| 1250 | fi |
| 1251 | |
| 1252 | |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1253 | ;; |
Neal Norwitz | dedeeaa | 2006-03-31 06:54:45 +0000 | [diff] [blame] | 1254 | OSF*) |
| 1255 | BASECFLAGS="$BASECFLAGS -mieee" |
| 1256 | ;; |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1257 | esac |
| 1258 | ;; |
| 1259 | |
| 1260 | *) |
| 1261 | case $ac_sys_system in |
| 1262 | OpenUNIX*|UnixWare*) |
| 1263 | BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca " |
| 1264 | ;; |
Neal Norwitz | b44f165 | 2003-05-26 14:11:55 +0000 | [diff] [blame] | 1265 | OSF*) |
| 1266 | BASECFLAGS="$BASECFLAGS -ieee -std" |
| 1267 | ;; |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1268 | SCO_SV*) |
| 1269 | BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5" |
| 1270 | ;; |
| 1271 | esac |
| 1272 | ;; |
| 1273 | esac |
| 1274 | |
Zachary Ware | 6ed42ea | 2015-12-21 11:43:03 -0600 | [diff] [blame] | 1275 | # ICC needs -fp-model strict or floats behave badly |
| 1276 | case "$CC" in |
| 1277 | *icc*) |
| 1278 | BASECFLAGS="$BASECFLAGS -fp-model strict" |
| 1279 | ;; |
| 1280 | esac |
| 1281 | |
Fred Drake | e1ceaa0 | 2001-12-04 20:55:47 +0000 | [diff] [blame] | 1282 | if test "$Py_DEBUG" = 'true'; then |
| 1283 | : |
| 1284 | else |
| 1285 | OPT="-DNDEBUG $OPT" |
| 1286 | fi |
| 1287 | |
Guido van Rossum | 6f2260e | 1996-09-09 16:21:03 +0000 | [diff] [blame] | 1288 | if test "$ac_arch_flags" |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 1289 | then |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1290 | BASECFLAGS="$BASECFLAGS $ac_arch_flags" |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 1291 | fi |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1292 | |
Neal Norwitz | 020c46a | 2006-01-07 21:39:28 +0000 | [diff] [blame] | 1293 | # disable check for icc since it seems to pass, but generates a warning |
| 1294 | if test "$CC" = icc |
| 1295 | then |
| 1296 | ac_cv_opt_olimit_ok=no |
| 1297 | fi |
| 1298 | |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 1299 | AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0) |
| 1300 | AC_CACHE_VAL(ac_cv_opt_olimit_ok, |
| 1301 | [ac_save_cc="$CC" |
| 1302 | CC="$CC -OPT:Olimit=0" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1303 | AC_COMPILE_IFELSE( |
Mark Dickinson | 5e13e29 | 2010-05-11 08:55:06 +0000 | [diff] [blame] | 1304 | [AC_LANG_PROGRAM([[]], [[]])], |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1305 | [ac_cv_opt_olimit_ok=yes], |
| 1306 | [ac_cv_opt_olimit_ok=no] |
Gregory P. Smith | ec3b8bd | 2009-11-01 21:02:52 +0000 | [diff] [blame] | 1307 | ) |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 1308 | CC="$ac_save_cc"]) |
| 1309 | AC_MSG_RESULT($ac_cv_opt_olimit_ok) |
Guido van Rossum | 2efa34b | 1997-10-23 17:43:11 +0000 | [diff] [blame] | 1310 | if test $ac_cv_opt_olimit_ok = yes; then |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 1311 | case $ac_sys_system in |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1312 | # XXX is this branch needed? On MacOSX 10.2.2 the result of the |
| 1313 | # olimit_ok test is "no". Is it "yes" in some other Darwin-esque |
| 1314 | # environment? |
| 1315 | Darwin*) |
| 1316 | ;; |
Trent Nelson | 34562e1 | 2012-10-17 18:01:12 -0400 | [diff] [blame] | 1317 | # XXX thankfully this useless troublemaker of a flag has been |
| 1318 | # eradicated in the 3.x line. For now, make sure it isn't picked |
| 1319 | # up by any of our other platforms that use CC. |
| 1320 | AIX*|SunOS*|HP-UX*|IRIX*) |
| 1321 | ;; |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 1322 | *) |
| 1323 | BASECFLAGS="$BASECFLAGS -OPT:Olimit=0" |
| 1324 | ;; |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 1325 | esac |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 1326 | else |
| 1327 | AC_MSG_CHECKING(whether $CC accepts -Olimit 1500) |
| 1328 | AC_CACHE_VAL(ac_cv_olimit_ok, |
| 1329 | [ac_save_cc="$CC" |
| 1330 | CC="$CC -Olimit 1500" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1331 | AC_COMPILE_IFELSE( |
Mark Dickinson | 5e13e29 | 2010-05-11 08:55:06 +0000 | [diff] [blame] | 1332 | [AC_LANG_PROGRAM([[]], [[]])], |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1333 | [ac_cv_olimit_ok=yes], |
| 1334 | [ac_cv_olimit_ok=no] |
Gregory P. Smith | ec3b8bd | 2009-11-01 21:02:52 +0000 | [diff] [blame] | 1335 | ) |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 1336 | CC="$ac_save_cc"]) |
| 1337 | AC_MSG_RESULT($ac_cv_olimit_ok) |
| 1338 | if test $ac_cv_olimit_ok = yes; then |
Stefan Krah | 6747326 | 2012-11-29 00:17:05 +0100 | [diff] [blame] | 1339 | case $ac_sys_system in |
| 1340 | # Issue #16534: On HP-UX ac_cv_olimit_ok=yes is a false positive. |
| 1341 | HP-UX*) |
| 1342 | ;; |
| 1343 | *) |
| 1344 | BASECFLAGS="$BASECFLAGS -Olimit 1500" |
| 1345 | ;; |
| 1346 | esac |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 1347 | fi |
Guido van Rossum | 201afe5 | 1997-05-14 21:14:44 +0000 | [diff] [blame] | 1348 | fi |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 1349 | |
Martin v. Löwis | aac1316 | 2006-10-19 10:58:46 +0000 | [diff] [blame] | 1350 | # Check whether GCC supports PyArg_ParseTuple format |
| 1351 | if test "$GCC" = "yes" |
| 1352 | then |
| 1353 | AC_MSG_CHECKING(whether gcc supports ParseTuple __format__) |
| 1354 | save_CFLAGS=$CFLAGS |
Benjamin Peterson | c875966 | 2013-05-11 13:00:05 -0500 | [diff] [blame] | 1355 | CFLAGS="$CFLAGS -Werror -Wformat" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1356 | AC_COMPILE_IFELSE([ |
| 1357 | AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]]) |
| 1358 | ],[ |
| 1359 | AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, |
| 1360 | [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))]) |
| 1361 | AC_MSG_RESULT(yes) |
| 1362 | ],[ |
| 1363 | AC_MSG_RESULT(no) |
| 1364 | ]) |
Martin v. Löwis | c1d7597 | 2006-10-19 16:01:37 +0000 | [diff] [blame] | 1365 | CFLAGS=$save_CFLAGS |
Martin v. Löwis | aac1316 | 2006-10-19 10:58:46 +0000 | [diff] [blame] | 1366 | fi |
| 1367 | |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1368 | |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 1369 | # Enable optimization flags |
| 1370 | AC_SUBST(DEF_MAKE_ALL_RULE) |
| 1371 | AC_SUBST(DEF_MAKE_RULE) |
| 1372 | Py_OPT='false' |
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) | b999915 | 2016-11-20 21:19:36 +0000 | [diff] [blame] | 1373 | AC_MSG_CHECKING(for --enable-optimizations) |
| 1374 | 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] | 1375 | [ |
| 1376 | if test "$withval" != no |
| 1377 | then |
| 1378 | Py_OPT='true' |
| 1379 | AC_MSG_RESULT(yes); |
| 1380 | else |
| 1381 | Py_OPT='false' |
| 1382 | AC_MSG_RESULT(no); |
| 1383 | fi], |
| 1384 | [AC_MSG_RESULT(no)]) |
| 1385 | if test "$Py_OPT" = 'true' ; then |
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) | 9cbfa79 | 2016-09-08 22:44:44 +0000 | [diff] [blame] | 1386 | # Intentionally not forcing Py_LTO='true' here. Too many toolchains do not |
| 1387 | # compile working code using it and both test_distutils and test_gdb are |
| 1388 | # broken when you do managed to get a toolchain that works with it. People |
| 1389 | # who want LTO need to use --with-lto themselves. |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 1390 | Py_LTO='true' |
| 1391 | DEF_MAKE_ALL_RULE="profile-opt" |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1392 | REQUIRE_PGO="yes" |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 1393 | DEF_MAKE_RULE="build_all" |
| 1394 | else |
| 1395 | DEF_MAKE_ALL_RULE="build_all" |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1396 | REQUIRE_PGO="no" |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 1397 | DEF_MAKE_RULE="all" |
| 1398 | fi |
| 1399 | |
| 1400 | |
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) | c543a0f | 2016-06-02 23:44:40 +0000 | [diff] [blame] | 1401 | # Enable LTO flags |
| 1402 | AC_SUBST(LTOFLAGS) |
| 1403 | AC_MSG_CHECKING(for --with-lto) |
| 1404 | AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable Link Time Optimization in PGO builds. Disabled by default.]), |
| 1405 | [ |
| 1406 | if test "$withval" != no |
| 1407 | then |
| 1408 | Py_LTO='true' |
| 1409 | AC_MSG_RESULT(yes); |
| 1410 | else |
| 1411 | Py_LTO='false' |
| 1412 | AC_MSG_RESULT(no); |
| 1413 | fi], |
| 1414 | [AC_MSG_RESULT(no)]) |
| 1415 | if test "$Py_LTO" = 'true' ; then |
| 1416 | case $CC in |
| 1417 | *clang*) |
| 1418 | # Any changes made here should be reflected in the GCC+Darwin case below |
| 1419 | LTOFLAGS="-flto" |
| 1420 | ;; |
| 1421 | *gcc*) |
| 1422 | case $ac_sys_system in |
| 1423 | Darwin*) |
| 1424 | LTOFLAGS="-flto" |
| 1425 | ;; |
| 1426 | *) |
| 1427 | LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none" |
| 1428 | ;; |
| 1429 | esac |
| 1430 | ;; |
| 1431 | esac |
| 1432 | fi |
| 1433 | |
| 1434 | |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1435 | # Enable PGO flags. |
| 1436 | AC_SUBST(PGO_PROF_GEN_FLAG) |
| 1437 | AC_SUBST(PGO_PROF_USE_FLAG) |
| 1438 | AC_SUBST(LLVM_PROF_MERGER) |
| 1439 | AC_SUBST(LLVM_PROF_FILE) |
| 1440 | AC_SUBST(LLVM_PROF_ERR) |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1441 | # Make this work on systems where llvm tools are not installed with their |
| 1442 | # normal names in the default $PATH (ie: Ubuntu). They exist under the |
| 1443 | # non-suffixed name in their versioned llvm directory. |
| 1444 | llvm_bin_dir='' |
| 1445 | llvm_path="${PATH}" |
| 1446 | if test "${CC}" = "clang" |
| 1447 | then |
| 1448 | clang_bin=`which clang` |
| 1449 | # Some systems install clang elsewhere as a symlink to the real path |
| 1450 | # which is where the related llvm tools are located. |
| 1451 | if test -L "${clang_bin}" |
| 1452 | then |
| 1453 | clang_dir=`dirname "${clang_bin}"` |
| 1454 | clang_bin=`readlink "${clang_bin}"` |
| 1455 | llvm_bin_dir="${clang_dir}/"`dirname "${clang_bin}"` |
| 1456 | llvm_path="${llvm_path}${PATH_SEPARATOR}${llvm_bin_dir}" |
| 1457 | fi |
| 1458 | fi |
| 1459 | AC_SUBST(LLVM_PROFDATA) |
| 1460 | AC_PATH_TARGET_TOOL(LLVM_PROFDATA, llvm-profdata, '', ${llvm_path}) |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1461 | AC_SUBST(LLVM_PROF_FOUND) |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1462 | if test -n "${LLVM_PROFDATA}" -a -x "${LLVM_PROFDATA}" |
| 1463 | then |
| 1464 | LLVM_PROF_FOUND="found" |
| 1465 | else |
| 1466 | LLVM_PROF_FOUND="not-found" |
| 1467 | fi |
| 1468 | if test "$ac_sys_system" = "Darwin" -a "${LLVM_PROF_FOUND}" = "not-found" |
| 1469 | then |
| 1470 | found_llvm_profdata=`/usr/bin/xcrun -find llvm-profdata 2>/dev/null` |
| 1471 | if test -n "${found_llvm_profdata}" |
| 1472 | then |
| 1473 | # llvm-profdata isn't directly in $PATH in some cases. |
| 1474 | # https://apple.stackexchange.com/questions/197053/ |
| 1475 | LLVM_PROFDATA='/usr/bin/xcrun llvm-profdata' |
| 1476 | LLVM_PROF_FOUND=found |
| 1477 | AC_MSG_NOTICE([llvm-profdata found via xcrun: ${LLVM_PROFDATA}]) |
| 1478 | fi |
| 1479 | fi |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1480 | LLVM_PROF_ERR=no |
| 1481 | case $CC in |
| 1482 | *clang*) |
| 1483 | # Any changes made here should be reflected in the GCC+Darwin case below |
| 1484 | PGO_PROF_GEN_FLAG="-fprofile-instr-generate" |
| 1485 | PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd" |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1486 | LLVM_PROF_MERGER="${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr" |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1487 | LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\"" |
| 1488 | if test $LLVM_PROF_FOUND = not-found |
| 1489 | then |
| 1490 | LLVM_PROF_ERR=yes |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1491 | if test "${REQUIRE_PGO}" = "yes" |
| 1492 | then |
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) | b999915 | 2016-11-20 21:19:36 +0000 | [diff] [blame] | 1493 | 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] | 1494 | fi |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1495 | fi |
| 1496 | ;; |
| 1497 | *gcc*) |
| 1498 | case $ac_sys_system in |
| 1499 | Darwin*) |
| 1500 | PGO_PROF_GEN_FLAG="-fprofile-instr-generate" |
| 1501 | PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd" |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1502 | LLVM_PROF_MERGER="${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr" |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1503 | LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\"" |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1504 | if test "${LLVM_PROF_FOUND}" = "not-found" |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1505 | then |
| 1506 | LLVM_PROF_ERR=yes |
Gregory P. Smith | 794b291 | 2016-09-08 00:07:40 -0700 | [diff] [blame] | 1507 | if test "${REQUIRE_PGO}" = "yes" |
| 1508 | then |
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) | b999915 | 2016-11-20 21:19:36 +0000 | [diff] [blame] | 1509 | 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] | 1510 | fi |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1511 | fi |
| 1512 | ;; |
| 1513 | *) |
| 1514 | PGO_PROF_GEN_FLAG="-fprofile-generate" |
| 1515 | PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction" |
| 1516 | LLVM_PROF_MERGER="true" |
| 1517 | LLVM_PROF_FILE="" |
| 1518 | ;; |
| 1519 | esac |
| 1520 | ;; |
Zachary Ware | 6ed42ea | 2015-12-21 11:43:03 -0600 | [diff] [blame] | 1521 | *icc*) |
| 1522 | PGO_PROF_GEN_FLAG="-prof-gen" |
| 1523 | PGO_PROF_USE_FLAG="-prof-use" |
| 1524 | LLVM_PROF_MERGER="true" |
| 1525 | LLVM_PROF_FILE="" |
| 1526 | ;; |
Brett Cannon | 4ff151a | 2015-09-18 15:09:42 -0700 | [diff] [blame] | 1527 | esac |
| 1528 | |
| 1529 | |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 1530 | # On some compilers, pthreads are available without further options |
| 1531 | # (e.g. MacOS X). On some of these systems, the compiler will not |
| 1532 | # complain if unaccepted options are passed (e.g. gcc on Mac OS X). |
| 1533 | # So we have to see first whether pthreads are available without |
| 1534 | # options before we can check whether -Kpthread improves anything. |
| 1535 | AC_MSG_CHECKING(whether pthreads are available without options) |
| 1536 | AC_CACHE_VAL(ac_cv_pthread_is_default, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1537 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 1538 | #include <stdio.h> |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 1539 | #include <pthread.h> |
| 1540 | |
| 1541 | void* routine(void* p){return NULL;} |
| 1542 | |
| 1543 | int main(){ |
| 1544 | pthread_t p; |
| 1545 | if(pthread_create(&p,NULL,routine,NULL)!=0) |
| 1546 | return 1; |
Jack Jansen | 4f8d054 | 2002-03-08 13:43:01 +0000 | [diff] [blame] | 1547 | (void)pthread_detach(p); |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 1548 | return 0; |
| 1549 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1550 | ]])],[ |
Skip Montanaro | d8d39a0 | 2003-07-10 20:44:10 +0000 | [diff] [blame] | 1551 | ac_cv_pthread_is_default=yes |
| 1552 | ac_cv_kthread=no |
| 1553 | ac_cv_pthread=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1554 | ],[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] | 1555 | ]) |
| 1556 | AC_MSG_RESULT($ac_cv_pthread_is_default) |
| 1557 | |
| 1558 | |
| 1559 | if test $ac_cv_pthread_is_default = yes |
| 1560 | then |
| 1561 | ac_cv_kpthread=no |
| 1562 | else |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 1563 | # -Kpthread, if available, provides the right #defines |
| 1564 | # and linker options to make pthread_create available |
Martin v. Löwis | 260aecc | 2001-10-07 08:14:41 +0000 | [diff] [blame] | 1565 | # Some compilers won't report that they do not support -Kpthread, |
| 1566 | # so we need to run a program to see whether it really made the |
| 1567 | # function available. |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 1568 | AC_MSG_CHECKING(whether $CC accepts -Kpthread) |
| 1569 | AC_CACHE_VAL(ac_cv_kpthread, |
| 1570 | [ac_save_cc="$CC" |
| 1571 | CC="$CC -Kpthread" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1572 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 1573 | #include <stdio.h> |
Martin v. Löwis | 260aecc | 2001-10-07 08:14:41 +0000 | [diff] [blame] | 1574 | #include <pthread.h> |
| 1575 | |
| 1576 | void* routine(void* p){return NULL;} |
| 1577 | |
| 1578 | int main(){ |
| 1579 | pthread_t p; |
| 1580 | if(pthread_create(&p,NULL,routine,NULL)!=0) |
| 1581 | return 1; |
Jack Jansen | 4f8d054 | 2002-03-08 13:43:01 +0000 | [diff] [blame] | 1582 | (void)pthread_detach(p); |
Martin v. Löwis | 260aecc | 2001-10-07 08:14:41 +0000 | [diff] [blame] | 1583 | return 0; |
| 1584 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1585 | ]])],[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] | 1586 | CC="$ac_save_cc"]) |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 1587 | AC_MSG_RESULT($ac_cv_kpthread) |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 1588 | fi |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 1589 | |
Skip Montanaro | d8d39a0 | 2003-07-10 20:44:10 +0000 | [diff] [blame] | 1590 | 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] | 1591 | then |
| 1592 | # -Kthread, if available, provides the right #defines |
| 1593 | # and linker options to make pthread_create available |
| 1594 | # Some compilers won't report that they do not support -Kthread, |
| 1595 | # so we need to run a program to see whether it really made the |
| 1596 | # function available. |
| 1597 | AC_MSG_CHECKING(whether $CC accepts -Kthread) |
| 1598 | AC_CACHE_VAL(ac_cv_kthread, |
| 1599 | [ac_save_cc="$CC" |
| 1600 | CC="$CC -Kthread" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1601 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 1602 | #include <stdio.h> |
Martin v. Löwis | 5f433f0 | 2003-05-05 05:05:30 +0000 | [diff] [blame] | 1603 | #include <pthread.h> |
| 1604 | |
| 1605 | void* routine(void* p){return NULL;} |
| 1606 | |
| 1607 | int main(){ |
| 1608 | pthread_t p; |
| 1609 | if(pthread_create(&p,NULL,routine,NULL)!=0) |
| 1610 | return 1; |
| 1611 | (void)pthread_detach(p); |
| 1612 | return 0; |
| 1613 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1614 | ]])],[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] | 1615 | CC="$ac_save_cc"]) |
| 1616 | AC_MSG_RESULT($ac_cv_kthread) |
| 1617 | fi |
| 1618 | |
Skip Montanaro | d8d39a0 | 2003-07-10 20:44:10 +0000 | [diff] [blame] | 1619 | 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] | 1620 | then |
| 1621 | # -pthread, if available, provides the right #defines |
| 1622 | # and linker options to make pthread_create available |
| 1623 | # Some compilers won't report that they do not support -pthread, |
| 1624 | # so we need to run a program to see whether it really made the |
| 1625 | # function available. |
| 1626 | AC_MSG_CHECKING(whether $CC accepts -pthread) |
doko@python.org | fa3f9a3 | 2013-01-25 15:32:31 +0100 | [diff] [blame] | 1627 | AC_CACHE_VAL(ac_cv_pthread, |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 1628 | [ac_save_cc="$CC" |
| 1629 | CC="$CC -pthread" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1630 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 1631 | #include <stdio.h> |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 1632 | #include <pthread.h> |
| 1633 | |
| 1634 | void* routine(void* p){return NULL;} |
| 1635 | |
| 1636 | int main(){ |
| 1637 | pthread_t p; |
| 1638 | if(pthread_create(&p,NULL,routine,NULL)!=0) |
| 1639 | return 1; |
| 1640 | (void)pthread_detach(p); |
| 1641 | return 0; |
| 1642 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1643 | ]])],[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] | 1644 | CC="$ac_save_cc"]) |
| 1645 | AC_MSG_RESULT($ac_cv_pthread) |
| 1646 | fi |
| 1647 | |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1648 | # If we have set a CC compiler flag for thread support then |
| 1649 | # check if it works for CXX, too. |
| 1650 | ac_cv_cxx_thread=no |
| 1651 | if test ! -z "$CXX" |
| 1652 | then |
| 1653 | AC_MSG_CHECKING(whether $CXX also accepts flags for thread support) |
| 1654 | ac_save_cxx="$CXX" |
| 1655 | |
| 1656 | if test "$ac_cv_kpthread" = "yes" |
| 1657 | then |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 1658 | CXX="$CXX -Kpthread" |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1659 | ac_cv_cxx_thread=yes |
| 1660 | elif test "$ac_cv_kthread" = "yes" |
| 1661 | then |
| 1662 | CXX="$CXX -Kthread" |
| 1663 | ac_cv_cxx_thread=yes |
| 1664 | elif test "$ac_cv_pthread" = "yes" |
| 1665 | then |
| 1666 | CXX="$CXX -pthread" |
| 1667 | ac_cv_cxx_thread=yes |
| 1668 | fi |
| 1669 | |
| 1670 | if test $ac_cv_cxx_thread = yes |
| 1671 | then |
| 1672 | echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext |
| 1673 | $CXX -c conftest.$ac_ext 2>&5 |
| 1674 | if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \ |
| 1675 | && test -s conftest$ac_exeext && ./conftest$ac_exeext |
| 1676 | then |
| 1677 | ac_cv_cxx_thread=yes |
| 1678 | else |
| 1679 | ac_cv_cxx_thread=no |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1680 | fi |
| 1681 | rm -fr conftest* |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1682 | fi |
Brett Cannon | c601e0f | 2004-11-07 01:24:12 +0000 | [diff] [blame] | 1683 | AC_MSG_RESULT($ac_cv_cxx_thread) |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1684 | fi |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 1685 | CXX="$ac_save_cxx" |
Martin v. Löwis | ab1e585 | 2003-06-28 07:46:38 +0000 | [diff] [blame] | 1686 | |
Fred Drake | ce81d59 | 2000-07-09 14:39:29 +0000 | [diff] [blame] | 1687 | dnl # check for ANSI or K&R ("traditional") preprocessor |
| 1688 | dnl AC_MSG_CHECKING(for C preprocessor type) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1689 | dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Fred Drake | ce81d59 | 2000-07-09 14:39:29 +0000 | [diff] [blame] | 1690 | dnl #define spam(name, doc) {#name, &name, #name "() -- " doc} |
| 1691 | dnl int foo; |
| 1692 | dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something"); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1693 | dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional]) |
Fred Drake | ce81d59 | 2000-07-09 14:39:29 +0000 | [diff] [blame] | 1694 | dnl AC_MSG_RESULT($cpp_type) |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 1695 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1696 | # checks for header files |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1697 | AC_HEADER_STDC |
doko@ubuntu.com | f27ec3e | 2014-04-17 20:11:19 +0200 | [diff] [blame] | 1698 | AC_CHECK_HEADERS(asm/types.h conio.h direct.h dlfcn.h errno.h \ |
Martin v. Löwis | 0e8bd7e | 2006-06-10 12:23:46 +0000 | [diff] [blame] | 1699 | fcntl.h grp.h \ |
doko@ubuntu.com | f27ec3e | 2014-04-17 20:11:19 +0200 | [diff] [blame] | 1700 | 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] | 1701 | 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] | 1702 | unistd.h utime.h \ |
Christian Heimes | 0e9ab5f | 2008-03-21 23:49:44 +0000 | [diff] [blame] | 1703 | sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ |
| 1704 | sys/lock.h sys/mkdev.h sys/modem.h \ |
Martin v. Löwis | 0e8bd7e | 2006-06-10 12:23:46 +0000 | [diff] [blame] | 1705 | sys/param.h sys/poll.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] | 1706 | sys/termio.h sys/time.h \ |
Martin v. Löwis | 0e8bd7e | 2006-06-10 12:23:46 +0000 | [diff] [blame] | 1707 | 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] | 1708 | sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ |
Christian Heimes | 3aa138f | 2013-06-18 13:25:24 +0200 | [diff] [blame] | 1709 | bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1710 | AC_HEADER_DIRENT |
Martin v. Löwis | dbe3f76 | 2002-10-10 14:27:30 +0000 | [diff] [blame] | 1711 | AC_HEADER_MAJOR |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1712 | |
Martin v. Löwis | 11017b1 | 2006-01-14 18:12:57 +0000 | [diff] [blame] | 1713 | # On Linux, netlink.h requires asm/types.h |
| 1714 | AC_CHECK_HEADERS(linux/netlink.h,,,[ |
| 1715 | #ifdef HAVE_ASM_TYPES_H |
| 1716 | #include <asm/types.h> |
| 1717 | #endif |
| 1718 | #ifdef HAVE_SYS_SOCKET_H |
| 1719 | #include <sys/socket.h> |
| 1720 | #endif |
| 1721 | ]) |
| 1722 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1723 | # checks for typedefs |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1724 | was_it_defined=no |
| 1725 | AC_MSG_CHECKING(for clock_t in time.h) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 1726 | AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [ |
| 1727 | AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.]) |
| 1728 | ]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1729 | AC_MSG_RESULT($was_it_defined) |
| 1730 | |
Neal Norwitz | 1169011 | 2002-07-30 01:08:28 +0000 | [diff] [blame] | 1731 | # Check whether using makedev requires defining _OSF_SOURCE |
| 1732 | AC_MSG_CHECKING(for makedev) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1733 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Jesus Cea | 616de77 | 2010-04-28 10:32:30 +0000 | [diff] [blame] | 1734 | #if defined(MAJOR_IN_MKDEV) |
| 1735 | #include <sys/mkdev.h> |
| 1736 | #elif defined(MAJOR_IN_SYSMACROS) |
| 1737 | #include <sys/sysmacros.h> |
| 1738 | #else |
| 1739 | #include <sys/types.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1740 | #endif ]], [[ makedev(0, 0) ]])], |
| 1741 | [ac_cv_has_makedev=yes], |
| 1742 | [ac_cv_has_makedev=no]) |
Neal Norwitz | 1169011 | 2002-07-30 01:08:28 +0000 | [diff] [blame] | 1743 | if test "$ac_cv_has_makedev" = "no"; then |
| 1744 | # 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] | 1745 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Neal Norwitz | 6eb37f0 | 2003-02-23 23:28:15 +0000 | [diff] [blame] | 1746 | #define _OSF_SOURCE 1 |
| 1747 | #include <sys/types.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1748 | ]], [[ makedev(0, 0) ]])], |
| 1749 | [ac_cv_has_makedev=yes], |
| 1750 | [ac_cv_has_makedev=no]) |
Neal Norwitz | 1169011 | 2002-07-30 01:08:28 +0000 | [diff] [blame] | 1751 | if test "$ac_cv_has_makedev" = "yes"; then |
| 1752 | AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.]) |
| 1753 | fi |
| 1754 | fi |
| 1755 | AC_MSG_RESULT($ac_cv_has_makedev) |
| 1756 | if test "$ac_cv_has_makedev" = "yes"; then |
| 1757 | AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.]) |
| 1758 | fi |
| 1759 | |
Martin v. Löwis | 399a689 | 2002-10-04 10:22:02 +0000 | [diff] [blame] | 1760 | # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in |
| 1761 | # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are |
| 1762 | # defined, but the compiler does not support pragma redefine_extname, |
| 1763 | # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit |
| 1764 | # structures (such as rlimit64) without declaring them. As a |
| 1765 | # work-around, disable LFS on such configurations |
| 1766 | |
| 1767 | use_lfs=yes |
| 1768 | AC_MSG_CHECKING(Solaris LFS bug) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1769 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | 399a689 | 2002-10-04 10:22:02 +0000 | [diff] [blame] | 1770 | #define _LARGEFILE_SOURCE 1 |
| 1771 | #define _FILE_OFFSET_BITS 64 |
| 1772 | #include <sys/resource.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1773 | ]], [[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] | 1774 | AC_MSG_RESULT($sol_lfs_bug) |
| 1775 | if test "$sol_lfs_bug" = "yes"; then |
| 1776 | use_lfs=no |
| 1777 | fi |
| 1778 | |
| 1779 | if test "$use_lfs" = "yes"; then |
Guido van Rossum | 810cc51 | 2001-09-09 23:51:39 +0000 | [diff] [blame] | 1780 | # Two defines needed to enable largefile support on various platforms |
| 1781 | # These may affect some typedefs |
Georg Brandl | 94800df | 2011-02-25 11:09:02 +0000 | [diff] [blame] | 1782 | case $ac_sys_system/$ac_sys_release in |
| 1783 | AIX*) |
| 1784 | AC_DEFINE(_LARGE_FILES, 1, |
| 1785 | [This must be defined on AIX systems to enable large file support.]) |
| 1786 | ;; |
| 1787 | esac |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 1788 | AC_DEFINE(_LARGEFILE_SOURCE, 1, |
| 1789 | [This must be defined on some systems to enable large file support.]) |
| 1790 | AC_DEFINE(_FILE_OFFSET_BITS, 64, |
| 1791 | [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] | 1792 | fi |
Guido van Rossum | 810cc51 | 2001-09-09 23:51:39 +0000 | [diff] [blame] | 1793 | |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 1794 | # Add some code to confdefs.h so that the test for off_t works on SCO |
| 1795 | cat >> confdefs.h <<\EOF |
| 1796 | #if defined(SCO_DS) |
| 1797 | #undef _OFF_T |
| 1798 | #endif |
| 1799 | EOF |
| 1800 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 1801 | # Type availability checks |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1802 | AC_TYPE_MODE_T |
| 1803 | AC_TYPE_OFF_T |
| 1804 | AC_TYPE_PID_T |
Matthias Klose | cbf54b1 | 2010-05-08 11:04:18 +0000 | [diff] [blame] | 1805 | 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] | 1806 | AC_TYPE_SIZE_T |
| 1807 | AC_TYPE_UID_T |
Mark Dickinson | 17c50cd | 2012-12-02 13:13:56 +0000 | [diff] [blame] | 1808 | |
| 1809 | # There are two separate checks for each of the exact-width integer types we |
| 1810 | # need. First we check whether the type is available using the usual |
| 1811 | # AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h> |
| 1812 | # and <stdint.h> where available). We then also use the special type checks of |
| 1813 | # the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available |
| 1814 | # directly, #define's uint32_t to be a suitable type. |
| 1815 | |
| 1816 | AC_CHECK_TYPE(uint32_t, |
| 1817 | 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] | 1818 | AC_TYPE_UINT32_T |
Mark Dickinson | 17c50cd | 2012-12-02 13:13:56 +0000 | [diff] [blame] | 1819 | |
| 1820 | AC_CHECK_TYPE(uint64_t, |
| 1821 | 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] | 1822 | AC_TYPE_UINT64_T |
Mark Dickinson | 17c50cd | 2012-12-02 13:13:56 +0000 | [diff] [blame] | 1823 | |
| 1824 | AC_CHECK_TYPE(int32_t, |
| 1825 | 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] | 1826 | AC_TYPE_INT32_T |
Mark Dickinson | 17c50cd | 2012-12-02 13:13:56 +0000 | [diff] [blame] | 1827 | |
| 1828 | AC_CHECK_TYPE(int64_t, |
| 1829 | 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] | 1830 | AC_TYPE_INT64_T |
Mark Dickinson | 17c50cd | 2012-12-02 13:13:56 +0000 | [diff] [blame] | 1831 | |
Christian Heimes | 951cc0f | 2008-01-31 23:08:23 +0000 | [diff] [blame] | 1832 | AC_CHECK_TYPE(ssize_t, |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 1833 | 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] | 1834 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 1835 | # Sizes of various common basic types |
Skip Montanaro | b9820a3 | 2004-01-17 00:16:12 +0000 | [diff] [blame] | 1836 | # 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] | 1837 | AC_CHECK_SIZEOF(int, 4) |
| 1838 | AC_CHECK_SIZEOF(long, 4) |
| 1839 | AC_CHECK_SIZEOF(void *, 4) |
Guido van Rossum | 3065c94 | 2001-09-17 04:03:14 +0000 | [diff] [blame] | 1840 | AC_CHECK_SIZEOF(short, 2) |
| 1841 | AC_CHECK_SIZEOF(float, 4) |
| 1842 | AC_CHECK_SIZEOF(double, 8) |
| 1843 | AC_CHECK_SIZEOF(fpos_t, 4) |
Martin v. Löwis | 18e1655 | 2006-02-15 17:27:45 +0000 | [diff] [blame] | 1844 | AC_CHECK_SIZEOF(size_t, 4) |
Christian Heimes | 951cc0f | 2008-01-31 23:08:23 +0000 | [diff] [blame] | 1845 | AC_CHECK_SIZEOF(pid_t, 4) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 1846 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1847 | AC_MSG_CHECKING(for long long support) |
| 1848 | have_long_long=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1849 | 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] | 1850 | AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.]) |
| 1851 | have_long_long=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1852 | ],[]) |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1853 | AC_MSG_RESULT($have_long_long) |
Guido van Rossum | 8bc1dfd | 1999-04-10 16:01:48 +0000 | [diff] [blame] | 1854 | if test "$have_long_long" = yes ; then |
Guido van Rossum | 3065c94 | 2001-09-17 04:03:14 +0000 | [diff] [blame] | 1855 | AC_CHECK_SIZEOF(long long, 8) |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1856 | fi |
| 1857 | |
Travis E. Oliphant | 711c9e9 | 2008-06-06 22:33:21 +0000 | [diff] [blame] | 1858 | AC_MSG_CHECKING(for long double support) |
| 1859 | have_long_double=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1860 | 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] | 1861 | AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.]) |
| 1862 | have_long_double=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1863 | ],[]) |
Travis E. Oliphant | 711c9e9 | 2008-06-06 22:33:21 +0000 | [diff] [blame] | 1864 | AC_MSG_RESULT($have_long_double) |
Mark Dickinson | dc1688a | 2008-06-27 22:20:14 +0000 | [diff] [blame] | 1865 | if test "$have_long_double" = yes ; then |
Travis E. Oliphant | 711c9e9 | 2008-06-06 22:33:21 +0000 | [diff] [blame] | 1866 | AC_CHECK_SIZEOF(long double, 12) |
| 1867 | fi |
| 1868 | |
Martin v. Löwis | aef4c6b | 2007-01-21 09:33:07 +0000 | [diff] [blame] | 1869 | AC_MSG_CHECKING(for _Bool support) |
| 1870 | have_c99_bool=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1871 | 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] | 1872 | AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.]) |
| 1873 | have_c99_bool=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1874 | ],[]) |
Martin v. Löwis | aef4c6b | 2007-01-21 09:33:07 +0000 | [diff] [blame] | 1875 | AC_MSG_RESULT($have_c99_bool) |
| 1876 | if test "$have_c99_bool" = yes ; then |
| 1877 | AC_CHECK_SIZEOF(_Bool, 1) |
| 1878 | fi |
| 1879 | |
Martin v. Löwis | ebe2670 | 2006-10-02 14:55:51 +0000 | [diff] [blame] | 1880 | AC_CHECK_TYPES(uintptr_t, |
| 1881 | [AC_CHECK_SIZEOF(uintptr_t, 4)], |
Martin v. Löwis | 40e9aed | 2006-10-02 15:20:37 +0000 | [diff] [blame] | 1882 | [], [#ifdef HAVE_STDINT_H |
| 1883 | #include <stdint.h> |
Antoine Pitrou | 7be5a65 | 2010-10-10 08:14:41 +0000 | [diff] [blame] | 1884 | #endif |
| 1885 | #ifdef HAVE_INTTYPES_H |
| 1886 | #include <inttypes.h> |
Martin v. Löwis | 40e9aed | 2006-10-02 15:20:37 +0000 | [diff] [blame] | 1887 | #endif]) |
Martin v. Löwis | ebe2670 | 2006-10-02 14:55:51 +0000 | [diff] [blame] | 1888 | |
Alexandre Vassalotti | 856782e | 2009-07-17 04:59:05 +0000 | [diff] [blame] | 1889 | AC_CHECK_SIZEOF(off_t, [], [ |
| 1890 | #ifdef HAVE_SYS_TYPES_H |
| 1891 | #include <sys/types.h> |
| 1892 | #endif |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1893 | ]) |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1894 | |
| 1895 | AC_MSG_CHECKING(whether to enable large file support) |
Mark Dickinson | 0ef0b91 | 2009-12-31 21:11:48 +0000 | [diff] [blame] | 1896 | if test "$have_long_long" = yes |
| 1897 | then |
| 1898 | 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] | 1899 | "$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] | 1900 | AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1, |
| 1901 | [Defined to enable large file support when an off_t is bigger than a long |
| 1902 | and long long is available and at least as big as an off_t. You may need |
| 1903 | to add some flags for configuration and compilation to enable this mode. |
| 1904 | (For Solaris and Linux, the necessary defines are already defined.)]) |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1905 | AC_MSG_RESULT(yes) |
| 1906 | else |
| 1907 | AC_MSG_RESULT(no) |
| 1908 | fi |
Mark Dickinson | 0ef0b91 | 2009-12-31 21:11:48 +0000 | [diff] [blame] | 1909 | else |
| 1910 | AC_MSG_RESULT(no) |
| 1911 | fi |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1912 | |
Alexandre Vassalotti | 856782e | 2009-07-17 04:59:05 +0000 | [diff] [blame] | 1913 | AC_CHECK_SIZEOF(time_t, [], [ |
| 1914 | #ifdef HAVE_SYS_TYPES_H |
| 1915 | #include <sys/types.h> |
| 1916 | #endif |
| 1917 | #ifdef HAVE_TIME_H |
| 1918 | #include <time.h> |
| 1919 | #endif |
Fred Drake | a3f6e91 | 2000-06-29 20:44:47 +0000 | [diff] [blame] | 1920 | ]) |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1921 | |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1922 | # if have pthread_t then define SIZEOF_PTHREAD_T |
Martin v. Löwis | 123cbd2 | 2001-07-19 14:21:10 +0000 | [diff] [blame] | 1923 | ac_save_cc="$CC" |
| 1924 | if test "$ac_cv_kpthread" = "yes" |
| 1925 | then CC="$CC -Kpthread" |
Martin v. Löwis | 5f433f0 | 2003-05-05 05:05:30 +0000 | [diff] [blame] | 1926 | elif test "$ac_cv_kthread" = "yes" |
| 1927 | then CC="$CC -Kthread" |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 1928 | elif test "$ac_cv_pthread" = "yes" |
| 1929 | then CC="$CC -pthread" |
Martin v. Löwis | 123cbd2 | 2001-07-19 14:21:10 +0000 | [diff] [blame] | 1930 | fi |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1931 | AC_MSG_CHECKING(for pthread_t) |
| 1932 | have_pthread_t=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 1933 | AC_COMPILE_IFELSE([ |
| 1934 | AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]]) |
| 1935 | ],[have_pthread_t=yes],[]) |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1936 | AC_MSG_RESULT($have_pthread_t) |
| 1937 | if test "$have_pthread_t" = yes ; then |
Alexandre Vassalotti | 856782e | 2009-07-17 04:59:05 +0000 | [diff] [blame] | 1938 | AC_CHECK_SIZEOF(pthread_t, [], [ |
| 1939 | #ifdef HAVE_PTHREAD_H |
| 1940 | #include <pthread.h> |
| 1941 | #endif |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1942 | ]) |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1943 | fi |
Martin v. Löwis | 123cbd2 | 2001-07-19 14:21:10 +0000 | [diff] [blame] | 1944 | CC="$ac_save_cc" |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 1945 | |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 1946 | AC_MSG_CHECKING(for --enable-toolbox-glue) |
| 1947 | AC_ARG_ENABLE(toolbox-glue, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 1948 | 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] | 1949 | |
| 1950 | if test -z "$enable_toolbox_glue" |
| 1951 | then |
| 1952 | case $ac_sys_system/$ac_sys_release in |
| 1953 | Darwin/*) |
| 1954 | enable_toolbox_glue="yes";; |
| 1955 | *) |
| 1956 | enable_toolbox_glue="no";; |
| 1957 | esac |
| 1958 | fi |
| 1959 | case "$enable_toolbox_glue" in |
| 1960 | yes) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 1961 | extra_machdep_objs="Python/mactoolboxglue.o" |
Raymond Hettinger | ec6eb36 | 2004-11-05 07:02:59 +0000 | [diff] [blame] | 1962 | extra_undefs="-u _PyMac_Error" |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 1963 | AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1, |
| 1964 | [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] | 1965 | ;; |
| 1966 | *) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 1967 | extra_machdep_objs="" |
Jack Jansen | 591cbed | 2001-08-15 13:55:15 +0000 | [diff] [blame] | 1968 | extra_undefs="" |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 1969 | ;; |
| 1970 | esac |
| 1971 | AC_MSG_RESULT($enable_toolbox_glue) |
| 1972 | |
Ronald Oussoren | 0d236eb | 2008-06-06 21:31:33 +0000 | [diff] [blame] | 1973 | |
Bob Ippolito | 7026a0a | 2005-03-28 23:23:47 +0000 | [diff] [blame] | 1974 | AC_SUBST(OTHER_LIBTOOL_OPT) |
| 1975 | case $ac_sys_system/$ac_sys_release in |
Anthony Baxter | 8220174 | 2006-04-09 15:07:40 +0000 | [diff] [blame] | 1976 | Darwin/@<:@01567@:>@\..*) |
Bob Ippolito | 7026a0a | 2005-03-28 23:23:47 +0000 | [diff] [blame] | 1977 | OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000" |
| 1978 | ;; |
| 1979 | Darwin/*) |
| 1980 | OTHER_LIBTOOL_OPT="" |
| 1981 | ;; |
| 1982 | esac |
| 1983 | |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 1984 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 1985 | AC_SUBST(LIBTOOL_CRUFT) |
| 1986 | case $ac_sys_system/$ac_sys_release in |
Anthony Baxter | 8220174 | 2006-04-09 15:07:40 +0000 | [diff] [blame] | 1987 | Darwin/@<:@01567@:>@\..*) |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 1988 | LIBTOOL_CRUFT="-framework System -lcc_dynamic" |
| 1989 | if test "${enable_universalsdk}"; then |
| 1990 | : |
| 1991 | else |
Ronald Oussoren | bc0e83c | 2010-02-11 13:26:54 +0000 | [diff] [blame] | 1992 | LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`" |
Ronald Oussoren | 988117f | 2006-04-29 11:31:35 +0000 | [diff] [blame] | 1993 | fi |
Jack Jansen | b36687a | 2004-07-16 08:43:47 +0000 | [diff] [blame] | 1994 | LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Jack Jansen | a3891ea | 2001-09-07 14:25:12 +0000 | [diff] [blame] | 1995 | LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 1996 | Darwin/*) |
Ronald Oussoren | a55af9a | 2010-01-17 16:25:57 +0000 | [diff] [blame] | 1997 | gcc_version=`gcc -dumpversion` |
Bob Ippolito | 7026a0a | 2005-03-28 23:23:47 +0000 | [diff] [blame] | 1998 | if test ${gcc_version} '<' 4.0 |
| 1999 | then |
| 2000 | LIBTOOL_CRUFT="-lcc_dynamic" |
| 2001 | else |
| 2002 | LIBTOOL_CRUFT="" |
| 2003 | fi |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2004 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 2005 | #include <unistd.h> |
| 2006 | int main(int argc, char*argv[]) |
| 2007 | { |
| 2008 | if (sizeof(long) == 4) { |
| 2009 | return 0; |
| 2010 | } else { |
| 2011 | return 1; |
| 2012 | } |
Ronald Oussoren | 84ddd72 | 2009-09-08 07:17:10 +0000 | [diff] [blame] | 2013 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2014 | ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes]) |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 2015 | |
| 2016 | if test "${ac_osx_32bit}" = "yes"; then |
Ronald Oussoren | bc0e83c | 2010-02-11 13:26:54 +0000 | [diff] [blame] | 2017 | case `/usr/bin/arch` in |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 2018 | i386) |
| 2019 | MACOSX_DEFAULT_ARCH="i386" |
| 2020 | ;; |
| 2021 | ppc) |
| 2022 | MACOSX_DEFAULT_ARCH="ppc" |
| 2023 | ;; |
| 2024 | *) |
| 2025 | AC_MSG_ERROR([Unexpected output of 'arch' on OSX]) |
| 2026 | ;; |
| 2027 | esac |
| 2028 | else |
Ronald Oussoren | bc0e83c | 2010-02-11 13:26:54 +0000 | [diff] [blame] | 2029 | case `/usr/bin/arch` in |
Ronald Oussoren | 2596758 | 2009-09-06 10:00:26 +0000 | [diff] [blame] | 2030 | i386) |
| 2031 | MACOSX_DEFAULT_ARCH="x86_64" |
| 2032 | ;; |
| 2033 | ppc) |
| 2034 | MACOSX_DEFAULT_ARCH="ppc64" |
| 2035 | ;; |
| 2036 | *) |
| 2037 | AC_MSG_ERROR([Unexpected output of 'arch' on OSX]) |
| 2038 | ;; |
| 2039 | esac |
| 2040 | |
| 2041 | #ARCH_RUN_32BIT="true" |
| 2042 | fi |
| 2043 | |
| 2044 | LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}" |
Jack Jansen | b36687a | 2004-07-16 08:43:47 +0000 | [diff] [blame] | 2045 | LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2046 | LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2047 | esac |
| 2048 | |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2049 | AC_MSG_CHECKING(for --enable-framework) |
| 2050 | if test "$enable_framework" |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2051 | then |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 2052 | BASECFLAGS="$BASECFLAGS -fno-common -dynamic" |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2053 | # -F. is needed to allow linking to the framework while |
| 2054 | # in the build location. |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2055 | AC_DEFINE(WITH_NEXT_FRAMEWORK, 1, |
| 2056 | [Define if you want to produce an OpenStep/Rhapsody framework |
| 2057 | (shared library plus accessory files).]) |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2058 | AC_MSG_RESULT(yes) |
Ronald Oussoren | 450d561 | 2009-06-08 21:12:41 +0000 | [diff] [blame] | 2059 | if test $enable_shared = "yes" |
| 2060 | then |
Ronald Oussoren | 9ebd242 | 2009-09-29 13:00:44 +0000 | [diff] [blame] | 2061 | 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] | 2062 | fi |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2063 | else |
| 2064 | AC_MSG_RESULT(no) |
| 2065 | fi |
| 2066 | |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2067 | AC_MSG_CHECKING(for dyld) |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 2068 | case $ac_sys_system/$ac_sys_release in |
| 2069 | Darwin/*) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2070 | AC_DEFINE(WITH_DYLD, 1, |
| 2071 | [Define if you want to use the new-style (Openstep, Rhapsody, MacOS) |
| 2072 | dynamic linker (dyld) instead of the old-style (NextStep) dynamic |
| 2073 | linker (rld). Dyld is necessary to support frameworks.]) |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 2074 | AC_MSG_RESULT(always on for Darwin) |
| 2075 | ;; |
| 2076 | *) |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2077 | AC_MSG_RESULT(no) |
| 2078 | ;; |
Jack Jansen | 9a66b6d | 2001-08-08 13:56:14 +0000 | [diff] [blame] | 2079 | esac |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2080 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2081 | # Set info about shared libraries. |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2082 | AC_SUBST(SO) |
| 2083 | AC_SUBST(LDSHARED) |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2084 | AC_SUBST(LDCXXSHARED) |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2085 | AC_SUBST(BLDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2086 | AC_SUBST(CCSHARED) |
| 2087 | AC_SUBST(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2088 | # SO is the extension of shared libraries `(including the dot!) |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 2089 | # -- usually .so, .sl on HP-UX, .dll on Cygwin |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2090 | AC_MSG_CHECKING(SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2091 | if test -z "$SO" |
| 2092 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2093 | case $ac_sys_system in |
Neal Norwitz | 58e2888 | 2006-05-19 07:00:58 +0000 | [diff] [blame] | 2094 | hp*|HP*) |
| 2095 | case `uname -m` in |
| 2096 | ia64) SO=.so;; |
| 2097 | *) SO=.sl;; |
| 2098 | esac |
| 2099 | ;; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 2100 | CYGWIN*) SO=.dll;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 2101 | *) SO=.so;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2102 | esac |
Martin v. Löwis | 368de8f | 2003-06-14 14:46:38 +0000 | [diff] [blame] | 2103 | else |
| 2104 | # this might also be a termcap variable, see #610332 |
| 2105 | echo |
| 2106 | echo '=====================================================================' |
| 2107 | echo '+ +' |
| 2108 | echo '+ WARNING: You have set SO in your environment. +' |
| 2109 | echo '+ Do you really mean to change the extension for shared libraries? +' |
| 2110 | echo '+ Continuing in 10 seconds to let you to ponder. +' |
| 2111 | echo '+ +' |
| 2112 | echo '=====================================================================' |
| 2113 | sleep 10 |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2114 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2115 | AC_MSG_RESULT($SO) |
Ronald Oussoren | 79f9049 | 2009-01-02 10:44:46 +0000 | [diff] [blame] | 2116 | |
Neal Norwitz | 58e2888 | 2006-05-19 07:00:58 +0000 | [diff] [blame] | 2117 | 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] | 2118 | # LDSHARED is the ld *command* used to create shared library |
Skip Montanaro | ce59c04 | 2004-01-17 14:19:44 +0000 | [diff] [blame] | 2119 | # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2120 | # (Shared libraries in this instance are shared modules to be loaded into |
| 2121 | # Python, as opposed to building Python itself as a shared library.) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2122 | AC_MSG_CHECKING(LDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2123 | if test -z "$LDSHARED" |
| 2124 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2125 | case $ac_sys_system/$ac_sys_release in |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2126 | AIX*) |
Martin Panter | f75a2eb | 2016-11-20 09:31:41 +0000 | [diff] [blame] | 2127 | BLDSHARED="Modules/ld_so_aix \$(CC) -bI:Modules/python.exp" |
Guido van Rossum | ce608b0 | 2001-09-28 15:59:38 +0000 | [diff] [blame] | 2128 | LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp" |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2129 | ;; |
| 2130 | BeOS*) |
| 2131 | BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY" |
Guido van Rossum | ce608b0 | 2001-09-28 15:59:38 +0000 | [diff] [blame] | 2132 | LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY" |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2133 | ;; |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 2134 | IRIX/5*) LDSHARED="ld -shared";; |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 2135 | IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";; |
Greg Ward | 57c9a66 | 2000-05-26 12:22:54 +0000 | [diff] [blame] | 2136 | SunOS/5*) |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2137 | if test "$GCC" = "yes" ; then |
| 2138 | LDSHARED='$(CC) -shared' |
| 2139 | LDCXXSHARED='$(CXX) -shared' |
| 2140 | else |
| 2141 | LDSHARED='$(CC) -G' |
| 2142 | LDCXXSHARED='$(CXX) -G' |
Greg Ward | 57c9a66 | 2000-05-26 12:22:54 +0000 | [diff] [blame] | 2143 | fi ;; |
Thomas Heller | dc96a77 | 2008-04-04 10:07:55 +0000 | [diff] [blame] | 2144 | hp*|HP*) |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2145 | if test "$GCC" = "yes" ; then |
| 2146 | LDSHARED='$(CC) -shared' |
| 2147 | LDCXXSHARED='$(CXX) -shared' |
| 2148 | else |
| 2149 | LDSHARED='ld -b' |
Thomas Heller | dc96a77 | 2008-04-04 10:07:55 +0000 | [diff] [blame] | 2150 | fi ;; |
Guido van Rossum | 71001e4 | 1995-01-26 00:44:03 +0000 | [diff] [blame] | 2151 | OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; |
Jack Jansen | 418c3b1 | 2001-11-14 10:59:57 +0000 | [diff] [blame] | 2152 | Darwin/1.3*) |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2153 | LDSHARED='$(CC) -bundle' |
| 2154 | LDCXXSHARED='$(CXX) -bundle' |
Jack Jansen | a3891ea | 2001-09-07 14:25:12 +0000 | [diff] [blame] | 2155 | if test "$enable_framework" ; then |
| 2156 | # Link against the framework. All externals should be defined. |
Jack Jansen | da49e19 | 2005-01-07 13:08:22 +0000 | [diff] [blame] | 2157 | BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
| 2158 | LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2159 | LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Jack Jansen | a3891ea | 2001-09-07 14:25:12 +0000 | [diff] [blame] | 2160 | else |
| 2161 | # No framework. Ignore undefined symbols, assuming they come from Python |
Jack Jansen | 418c3b1 | 2001-11-14 10:59:57 +0000 | [diff] [blame] | 2162 | LDSHARED="$LDSHARED -undefined suppress" |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2163 | LDCXXSHARED="$LDCXXSHARED -undefined suppress" |
Jack Jansen | a3891ea | 2001-09-07 14:25:12 +0000 | [diff] [blame] | 2164 | fi ;; |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2165 | Darwin/1.4*|Darwin/5.*|Darwin/6.*) |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2166 | LDSHARED='$(CC) -bundle' |
| 2167 | LDCXXSHARED='$(CXX) -bundle' |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2168 | if test "$enable_framework" ; then |
| 2169 | # Link against the framework. All externals should be defined. |
Jack Jansen | da49e19 | 2005-01-07 13:08:22 +0000 | [diff] [blame] | 2170 | BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
| 2171 | LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2172 | LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2173 | else |
Michael W. Hudson | 0c46c0c | 2002-03-07 09:58:56 +0000 | [diff] [blame] | 2174 | # No framework, use the Python app as bundle-loader |
| 2175 | BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' |
Jack Jansen | c28fc37 | 2003-02-25 13:14:43 +0000 | [diff] [blame] | 2176 | LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2177 | LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2178 | fi ;; |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2179 | Darwin/*) |
| 2180 | # Use -undefined dynamic_lookup whenever possible (10.3 and later). |
| 2181 | # This allows an extension to be used in any Python |
Ronald Oussoren | 38f1b98 | 2007-09-02 09:46:07 +0000 | [diff] [blame] | 2182 | |
Ned Deily | c40b903 | 2014-06-25 13:48:46 -0700 | [diff] [blame] | 2183 | dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ |
| 2184 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` |
| 2185 | dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \ |
| 2186 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` |
| 2187 | if test ${dep_target_major} -eq 10 && \ |
| 2188 | test ${dep_target_minor} -le 2 |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2189 | then |
Ned Deily | c40b903 | 2014-06-25 13:48:46 -0700 | [diff] [blame] | 2190 | # building for OS X 10.0 through 10.2 |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2191 | LDSHARED='$(CC) -bundle' |
| 2192 | LDCXXSHARED='$(CXX) -bundle' |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +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 | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2198 | else |
| 2199 | # No framework, use the Python app as bundle-loader |
| 2200 | BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' |
| 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)' |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2203 | fi |
Ned Deily | c40b903 | 2014-06-25 13:48:46 -0700 | [diff] [blame] | 2204 | else |
| 2205 | # building for OS X 10.3 and later |
| 2206 | if test "${enable_universalsdk}"; then |
| 2207 | LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" |
| 2208 | fi |
| 2209 | LDSHARED='$(CC) -bundle -undefined dynamic_lookup' |
| 2210 | LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' |
| 2211 | BLDSHARED="$LDSHARED" |
Jack Jansen | 6b08a40 | 2004-06-03 12:41:45 +0000 | [diff] [blame] | 2212 | fi |
| 2213 | ;; |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2214 | Linux*|GNU*|QNX*) |
| 2215 | LDSHARED='$(CC) -shared' |
| 2216 | LDCXXSHARED='$(CXX) -shared';; |
| 2217 | BSD/OS*/4*) |
| 2218 | LDSHARED="gcc -shared" |
| 2219 | LDCXXSHARED="g++ -shared";; |
Martin v. Löwis | 222c515 | 2006-06-03 07:37:13 +0000 | [diff] [blame] | 2220 | FreeBSD*) |
Jeremy Hylton | 4bcc7c5 | 2000-08-31 17:45:35 +0000 | [diff] [blame] | 2221 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 2222 | then |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2223 | LDSHARED='$(CC) -shared' |
| 2224 | LDCXXSHARED='$(CXX) -shared' |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 2225 | else |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2226 | LDSHARED="ld -Bshareable" |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 2227 | fi;; |
Martin v. Löwis | 222c515 | 2006-06-03 07:37:13 +0000 | [diff] [blame] | 2228 | OpenBSD*) |
| 2229 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
| 2230 | then |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2231 | LDSHARED='$(CC) -shared $(CCSHARED)' |
| 2232 | LDCXXSHARED='$(CXX) -shared $(CCSHARED)' |
Martin v. Löwis | 222c515 | 2006-06-03 07:37:13 +0000 | [diff] [blame] | 2233 | else |
| 2234 | case `uname -r` in |
| 2235 | [[01]].* | 2.[[0-7]] | 2.[[0-7]].*) |
| 2236 | LDSHARED="ld -Bshareable ${LDFLAGS}" |
| 2237 | ;; |
| 2238 | *) |
Stefan Krah | 3a3e203 | 2010-11-28 15:30:05 +0000 | [diff] [blame] | 2239 | LDSHARED='$(CC) -shared $(CCSHARED)' |
| 2240 | LDCXXSHARED='$(CXX) -shared $(CCSHARED)' |
Martin v. Löwis | 222c515 | 2006-06-03 07:37:13 +0000 | [diff] [blame] | 2241 | ;; |
| 2242 | esac |
| 2243 | fi;; |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2244 | NetBSD*|DragonFly*) |
Antoine Pitrou | cb40277 | 2011-01-02 20:51:34 +0000 | [diff] [blame] | 2245 | LDSHARED='$(CC) -shared' |
| 2246 | LDCXXSHARED='$(CXX) -shared';; |
Martin v. Löwis | 25ae43b | 2001-10-07 08:39:18 +0000 | [diff] [blame] | 2247 | OpenUNIX*|UnixWare*) |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2248 | if test "$GCC" = "yes" ; then |
| 2249 | LDSHARED='$(CC) -shared' |
| 2250 | LDCXXSHARED='$(CXX) -shared' |
| 2251 | else |
| 2252 | LDSHARED='$(CC) -G' |
| 2253 | LDCXXSHARED='$(CXX) -G' |
Martin v. Löwis | bec1958 | 2001-03-21 15:57:54 +0000 | [diff] [blame] | 2254 | fi;; |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2255 | SCO_SV*) |
| 2256 | LDSHARED='$(CC) -Wl,-G,-Bexport' |
| 2257 | LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';; |
| 2258 | CYGWIN*) |
| 2259 | LDSHARED="gcc -shared -Wl,--enable-auto-image-base" |
| 2260 | LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";; |
| 2261 | atheos*) |
| 2262 | LDSHARED="gcc -shared" |
| 2263 | LDCXXSHARED="g++ -shared";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2264 | *) LDSHARED="ld";; |
| 2265 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2266 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2267 | AC_MSG_RESULT($LDSHARED) |
Tarek Ziadé | 0000295 | 2010-04-03 08:37:59 +0000 | [diff] [blame] | 2268 | LDCXXSHARED=${LDCXXSHARED-$LDSHARED} |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2269 | BLDSHARED=${BLDSHARED-$LDSHARED} |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2270 | # 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] | 2271 | # library (module) -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2272 | AC_MSG_CHECKING(CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2273 | if test -z "$CCSHARED" |
| 2274 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 2275 | case $ac_sys_system/$ac_sys_release in |
Neil Schemenauer | 6625216 | 2001-02-19 04:47:42 +0000 | [diff] [blame] | 2276 | SunOS*) if test "$GCC" = yes; |
Martin v. Löwis | eb62357 | 2007-03-12 10:50:39 +0000 | [diff] [blame] | 2277 | then CCSHARED="-fPIC"; |
| 2278 | elif test `uname -p` = sparc; |
| 2279 | then CCSHARED="-xcode=pic32"; |
| 2280 | else CCSHARED="-Kpic"; |
| 2281 | fi;; |
Guido van Rossum | af07a44 | 1995-02-13 19:45:27 +0000 | [diff] [blame] | 2282 | hp*|HP*) if test "$GCC" = yes; |
Martin v. Löwis | 703ad70 | 2001-09-05 08:36:52 +0000 | [diff] [blame] | 2283 | then CCSHARED="-fPIC"; |
Guido van Rossum | af07a44 | 1995-02-13 19:45:27 +0000 | [diff] [blame] | 2284 | else CCSHARED="+z"; |
| 2285 | fi;; |
Martin v. Löwis | a6e9758 | 2002-01-01 18:41:33 +0000 | [diff] [blame] | 2286 | Linux*|GNU*) CCSHARED="-fPIC";; |
Guido van Rossum | f5957ea | 1999-10-05 21:59:33 +0000 | [diff] [blame] | 2287 | BSD/OS*/4*) CCSHARED="-fpic";; |
Martin v. Löwis | 86d6626 | 2006-02-17 08:40:11 +0000 | [diff] [blame] | 2288 | FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; |
Martin v. Löwis | 25ae43b | 2001-10-07 08:39:18 +0000 | [diff] [blame] | 2289 | OpenUNIX*|UnixWare*) |
Martin v. Löwis | bec1958 | 2001-03-21 15:57:54 +0000 | [diff] [blame] | 2290 | if test "$GCC" = "yes" |
| 2291 | then CCSHARED="-fPIC" |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2292 | else CCSHARED="-KPIC" |
Martin v. Löwis | bec1958 | 2001-03-21 15:57:54 +0000 | [diff] [blame] | 2293 | fi;; |
Martin v. Löwis | 21ee409 | 2002-09-30 16:19:48 +0000 | [diff] [blame] | 2294 | SCO_SV*) |
| 2295 | if test "$GCC" = "yes" |
| 2296 | then CCSHARED="-fPIC" |
| 2297 | else CCSHARED="-Kpic -belf" |
| 2298 | fi;; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 2299 | IRIX*/6*) case $CC in |
| 2300 | *gcc*) CCSHARED="-shared";; |
Guido van Rossum | ee21f41 | 1998-04-20 18:51:54 +0000 | [diff] [blame] | 2301 | *) CCSHARED="";; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 2302 | esac;; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2303 | atheos*) CCSHARED="-fPIC";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2304 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2305 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2306 | AC_MSG_RESULT($CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2307 | # LINKFORSHARED are the flags passed to the $(CC) command that links |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 2308 | # the python executable -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2309 | AC_MSG_CHECKING(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2310 | if test -z "$LINKFORSHARED" |
| 2311 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 2312 | case $ac_sys_system/$ac_sys_release in |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 2313 | AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';; |
Guido van Rossum | 5dab3d8 | 1996-12-06 21:18:18 +0000 | [diff] [blame] | 2314 | hp*|HP*) |
Martin v. Löwis | 1142de3 | 2002-03-29 16:28:31 +0000 | [diff] [blame] | 2315 | LINKFORSHARED="-Wl,-E -Wl,+s";; |
| 2316 | # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; |
Guido van Rossum | f5957ea | 1999-10-05 21:59:33 +0000 | [diff] [blame] | 2317 | BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Martin v. Löwis | a6e9758 | 2002-01-01 18:41:33 +0000 | [diff] [blame] | 2318 | Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 2319 | # -u libsys_s pulls in all symbols in libsys |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2320 | Darwin/*) |
Raymond Hettinger | ec6eb36 | 2004-11-05 07:02:59 +0000 | [diff] [blame] | 2321 | # -u _PyMac_Error is needed to pull in the mac toolbox glue, |
| 2322 | # which is |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2323 | # not used by the core itself but which needs to be in the core so |
| 2324 | # that dynamically loaded extension modules have access to it. |
Jack Jansen | 97e3f00 | 2003-02-23 22:59:01 +0000 | [diff] [blame] | 2325 | # -prebind is no longer used, because it actually seems to give a |
| 2326 | # slowdown in stead of a speedup, maybe due to the large number of |
| 2327 | # dynamic loads Python does. |
Raymond Hettinger | ec6eb36 | 2004-11-05 07:02:59 +0000 | [diff] [blame] | 2328 | |
| 2329 | LINKFORSHARED="$extra_undefs" |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2330 | if test "$enable_framework" |
| 2331 | then |
Jack Jansen | da49e19 | 2005-01-07 13:08:22 +0000 | [diff] [blame] | 2332 | LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 2333 | fi |
Raymond Hettinger | ec6eb36 | 2004-11-05 07:02:59 +0000 | [diff] [blame] | 2334 | LINKFORSHARED="$LINKFORSHARED";; |
Martin v. Löwis | 25ae43b | 2001-10-07 08:39:18 +0000 | [diff] [blame] | 2335 | OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";; |
Martin v. Löwis | 21ee409 | 2002-09-30 16:19:48 +0000 | [diff] [blame] | 2336 | SCO_SV*) LINKFORSHARED="-Wl,-Bexport";; |
Fred Drake | 02706f5 | 2000-09-25 15:08:46 +0000 | [diff] [blame] | 2337 | ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";; |
Martin v. Löwis | 86d6626 | 2006-02-17 08:40:11 +0000 | [diff] [blame] | 2338 | FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) |
Guido van Rossum | df69365 | 1999-01-07 21:50:41 +0000 | [diff] [blame] | 2339 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
| 2340 | then |
| 2341 | LINKFORSHARED="-Wl,--export-dynamic" |
| 2342 | fi;; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 2343 | SunOS/5*) case $CC in |
| 2344 | *gcc*) |
Martin v. Löwis | a454857 | 2002-04-18 14:51:36 +0000 | [diff] [blame] | 2345 | if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null |
Guido van Rossum | 8f4ceb1 | 1997-12-18 23:42:19 +0000 | [diff] [blame] | 2346 | then |
| 2347 | LINKFORSHARED="-Xlinker --export-dynamic" |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 2348 | fi;; |
| 2349 | esac;; |
Jason Tishler | 3076559 | 2003-09-04 11:04:06 +0000 | [diff] [blame] | 2350 | CYGWIN*) |
| 2351 | if test $enable_shared = "no" |
| 2352 | then |
| 2353 | LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)' |
| 2354 | fi;; |
Martin v. Löwis | 8c255e4 | 2008-05-23 15:06:50 +0000 | [diff] [blame] | 2355 | QNX*) |
| 2356 | # -Wl,-E causes the symbols to be added to the dynamic |
| 2357 | # symbol table so that they can be found when a module |
| 2358 | # is loaded. -N 2048K causes the stack size to be set |
| 2359 | # to 2048 kilobytes so that the stack doesn't overflow |
| 2360 | # when running test_compile.py. |
| 2361 | LINKFORSHARED='-Wl,-E -N 2048K';; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2362 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2363 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2364 | AC_MSG_RESULT($LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 2365 | |
Ronald Oussoren | 0d236eb | 2008-06-06 21:31:33 +0000 | [diff] [blame] | 2366 | |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 2367 | AC_SUBST(CFLAGSFORSHARED) |
| 2368 | AC_MSG_CHECKING(CFLAGSFORSHARED) |
| 2369 | if test ! "$LIBRARY" = "$LDLIBRARY" |
| 2370 | then |
Neil Schemenauer | d9cf41c | 2001-01-27 21:39:17 +0000 | [diff] [blame] | 2371 | case $ac_sys_system in |
| 2372 | CYGWIN*) |
| 2373 | # Cygwin needs CCSHARED when building extension DLLs |
| 2374 | # but not when building the interpreter DLL. |
| 2375 | CFLAGSFORSHARED='';; |
| 2376 | *) |
| 2377 | CFLAGSFORSHARED='$(CCSHARED)' |
| 2378 | esac |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 2379 | fi |
| 2380 | AC_MSG_RESULT($CFLAGSFORSHARED) |
| 2381 | |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2382 | # SHLIBS are libraries (except -lc and -lm) to link to the python shared |
| 2383 | # library (with --enable-shared). |
| 2384 | # 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] | 2385 | # symbols, this must be set to $(LIBS) (expanded by make). We do this even |
| 2386 | # if it is not required, since it creates a dependency of the shared library |
| 2387 | # to LIBS. This, in turn, means that applications linking the shared libpython |
| 2388 | # don't need to link LIBS explicitly. The default should be only changed |
| 2389 | # on systems where this approach causes problems. |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2390 | AC_SUBST(SHLIBS) |
| 2391 | AC_MSG_CHECKING(SHLIBS) |
| 2392 | case "$ac_sys_system" in |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2393 | *) |
Martin v. Löwis | d6359c5 | 2002-08-04 12:38:50 +0000 | [diff] [blame] | 2394 | SHLIBS='$(LIBS)';; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2395 | esac |
| 2396 | AC_MSG_RESULT($SHLIBS) |
| 2397 | |
| 2398 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 2399 | # checks for libraries |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 2400 | AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV |
| 2401 | 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] | 2402 | |
Skip Montanaro | 4d756af | 2008-12-01 01:55:22 +0000 | [diff] [blame] | 2403 | # only check for sem_init if thread support is requested |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 2404 | if test "$with_threads" = "yes" -o -z "$with_threads"; then |
| 2405 | AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris |
| 2406 | # posix4 on Solaris 2.6 |
| 2407 | # pthread (first!) on Linux |
| 2408 | fi |
| 2409 | |
Martin v. Löwis | 19d1734 | 2003-06-14 21:03:05 +0000 | [diff] [blame] | 2410 | # check if we need libintl for locale functions |
| 2411 | AC_CHECK_LIB(intl, textdomain, |
| 2412 | AC_DEFINE(WITH_LIBINTL, 1, |
| 2413 | [Define to 1 if libintl is needed for locale functions.])) |
Guido van Rossum | 0eefa3f | 1999-11-16 15:57:37 +0000 | [diff] [blame] | 2414 | |
| 2415 | # checks for system dependent C++ extensions support |
| 2416 | case "$ac_sys_system" in |
| 2417 | AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2418 | AC_LINK_IFELSE([ |
Georg Brandl | 94800df | 2011-02-25 11:09:02 +0000 | [diff] [blame] | 2419 | AC_LANG_PROGRAM([[#include <load.h>]], |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2420 | [[loadAndInit("", 0, "")]]) |
| 2421 | ],[ |
| 2422 | AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1, |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2423 | [Define for AIX if your compiler is a genuine IBM xlC/xlC_r |
| 2424 | and you want support for AIX C++ shared extension modules.]) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2425 | AC_MSG_RESULT(yes) |
| 2426 | ],[ |
| 2427 | AC_MSG_RESULT(no) |
| 2428 | ]);; |
Guido van Rossum | 0eefa3f | 1999-11-16 15:57:37 +0000 | [diff] [blame] | 2429 | *) ;; |
| 2430 | esac |
| 2431 | |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 2432 | # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 2433 | # BeOS' sockets are stashed in libnet. |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 2434 | AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 2435 | AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets |
Skip Montanaro | b9949db | 2004-01-17 04:04:13 +0000 | [diff] [blame] | 2436 | |
Jeremy Hylton | cb25d5e | 2000-07-27 21:23:28 +0000 | [diff] [blame] | 2437 | case "$ac_sys_system" in |
| 2438 | BeOS*) |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 2439 | AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS |
| 2440 | ;; |
| 2441 | esac |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 2442 | |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 2443 | AC_MSG_CHECKING(for --with-libs) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2444 | AC_ARG_WITH(libs, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2445 | AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2446 | [ |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 2447 | AC_MSG_RESULT($withval) |
| 2448 | LIBS="$withval $LIBS" |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2449 | ], |
| 2450 | [AC_MSG_RESULT(no)]) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 2451 | |
Benjamin Peterson | 64e8f6e | 2014-12-15 00:00:23 -0500 | [diff] [blame] | 2452 | PKG_PROG_PKG_CONFIG |
Benjamin Peterson | e9e07bf | 2010-03-09 21:46:54 +0000 | [diff] [blame] | 2453 | |
Benjamin Peterson | 2c19674 | 2009-12-31 03:17:18 +0000 | [diff] [blame] | 2454 | # Check for use of the system expat library |
| 2455 | AC_MSG_CHECKING(for --with-system-expat) |
| 2456 | AC_ARG_WITH(system_expat, |
Benjamin Peterson | f2d1b2a | 2010-10-31 16:53:53 +0000 | [diff] [blame] | 2457 | AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]), |
| 2458 | [], |
| 2459 | [with_system_expat="no"]) |
Benjamin Peterson | 2c19674 | 2009-12-31 03:17:18 +0000 | [diff] [blame] | 2460 | |
| 2461 | AC_MSG_RESULT($with_system_expat) |
| 2462 | |
Martin v. Löwis | 9176fc1 | 2006-04-11 11:12:43 +0000 | [diff] [blame] | 2463 | # Check for use of the system libffi library |
| 2464 | AC_MSG_CHECKING(for --with-system-ffi) |
| 2465 | AC_ARG_WITH(system_ffi, |
Benjamin Peterson | f2d1b2a | 2010-10-31 16:53:53 +0000 | [diff] [blame] | 2466 | AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]), |
| 2467 | [], |
| 2468 | [with_system_ffi="no"]) |
Martin v. Löwis | 9176fc1 | 2006-04-11 11:12:43 +0000 | [diff] [blame] | 2469 | |
Benjamin Peterson | e9e07bf | 2010-03-09 21:46:54 +0000 | [diff] [blame] | 2470 | if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then |
Benjamin Peterson | 1c335e6 | 2010-01-01 15:16:29 +0000 | [diff] [blame] | 2471 | LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`" |
| 2472 | else |
| 2473 | LIBFFI_INCLUDEDIR="" |
| 2474 | fi |
| 2475 | AC_SUBST(LIBFFI_INCLUDEDIR) |
| 2476 | |
Martin v. Löwis | 9176fc1 | 2006-04-11 11:12:43 +0000 | [diff] [blame] | 2477 | AC_MSG_RESULT($with_system_ffi) |
| 2478 | |
Ned Deily | a2a9f57 | 2013-10-25 00:30:10 -0700 | [diff] [blame] | 2479 | # Check for --with-tcltk-includes=path and --with-tcltk-libs=path |
| 2480 | AC_SUBST(TCLTK_INCLUDES) |
| 2481 | AC_SUBST(TCLTK_LIBS) |
| 2482 | AC_MSG_CHECKING(for --with-tcltk-includes) |
| 2483 | AC_ARG_WITH(tcltk-includes, |
| 2484 | AS_HELP_STRING([--with-tcltk-includes='-I...'], [override search for Tcl and Tk include files]), |
| 2485 | [], |
| 2486 | [with_tcltk_includes="default"]) |
| 2487 | AC_MSG_RESULT($with_tcltk_includes) |
| 2488 | AC_MSG_CHECKING(for --with-tcltk-libs) |
| 2489 | AC_ARG_WITH(tcltk-libs, |
| 2490 | AS_HELP_STRING([--with-tcltk-libs='-L...'], [override search for Tcl and Tk libs]), |
| 2491 | [], |
| 2492 | [with_tcltk_libs="default"]) |
| 2493 | AC_MSG_RESULT($with_tcltk_libs) |
| 2494 | if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault |
| 2495 | then |
| 2496 | if test "x$with_tcltk_includes" != "x$with_tcltk_libs" |
| 2497 | then |
| 2498 | AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither]) |
| 2499 | fi |
| 2500 | TCLTK_INCLUDES="" |
| 2501 | TCLTK_LIBS="" |
| 2502 | else |
| 2503 | TCLTK_INCLUDES="$with_tcltk_includes" |
| 2504 | TCLTK_LIBS="$with_tcltk_libs" |
| 2505 | fi |
| 2506 | |
Matthias Klose | 10cbe48 | 2009-04-29 17:18:19 +0000 | [diff] [blame] | 2507 | # Check for --with-dbmliborder |
| 2508 | AC_MSG_CHECKING(for --with-dbmliborder) |
| 2509 | AC_ARG_WITH(dbmliborder, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2510 | 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] | 2511 | [ |
| 2512 | if test x$with_dbmliborder = xyes |
| 2513 | then |
| 2514 | AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...]) |
| 2515 | else |
| 2516 | for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do |
| 2517 | if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb |
| 2518 | then |
| 2519 | AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...]) |
| 2520 | fi |
| 2521 | done |
Matthias Klose | 61dbdb9 | 2009-04-29 20:09:50 +0000 | [diff] [blame] | 2522 | fi]) |
| 2523 | AC_MSG_RESULT($with_dbmliborder) |
Matthias Klose | 10cbe48 | 2009-04-29 17:18:19 +0000 | [diff] [blame] | 2524 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 2525 | # Determine if signalmodule should be used. |
| 2526 | AC_SUBST(USE_SIGNAL_MODULE) |
| 2527 | AC_SUBST(SIGNAL_OBJS) |
| 2528 | AC_MSG_CHECKING(for --with-signal-module) |
| 2529 | AC_ARG_WITH(signal-module, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2530 | AS_HELP_STRING([--with-signal-module], [disable/enable signal module])) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 2531 | |
| 2532 | if test -z "$with_signal_module" |
| 2533 | then with_signal_module="yes" |
| 2534 | fi |
| 2535 | AC_MSG_RESULT($with_signal_module) |
| 2536 | |
| 2537 | if test "${with_signal_module}" = "yes"; then |
| 2538 | USE_SIGNAL_MODULE="" |
| 2539 | SIGNAL_OBJS="" |
| 2540 | else |
| 2541 | USE_SIGNAL_MODULE="#" |
| 2542 | SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o" |
| 2543 | fi |
| 2544 | |
Guido van Rossum | 3d15bd8 | 2001-01-10 18:53:48 +0000 | [diff] [blame] | 2545 | # This is used to generate Setup.config |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 2546 | AC_SUBST(USE_THREAD_MODULE) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2547 | USE_THREAD_MODULE="" |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 2548 | |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2549 | AC_MSG_CHECKING(for --with-dec-threads) |
| 2550 | AC_SUBST(LDLAST) |
| 2551 | AC_ARG_WITH(dec-threads, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2552 | 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] | 2553 | [ |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2554 | AC_MSG_RESULT($withval) |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2555 | LDLAST=-threads |
Guido van Rossum | f78abae | 1997-01-21 22:02:36 +0000 | [diff] [blame] | 2556 | if test "${with_thread+set}" != set; then |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2557 | with_thread="$withval"; |
| 2558 | fi], |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2559 | [AC_MSG_RESULT(no)]) |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2560 | |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 2561 | # Templates for things AC_DEFINEd more than once. |
| 2562 | # For a single AC_DEFINE, no template is needed. |
| 2563 | AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package]) |
| 2564 | AH_TEMPLATE(_REENTRANT, |
| 2565 | [Define to force use of thread-safe errno, h_errno, and other functions]) |
| 2566 | AH_TEMPLATE(WITH_THREAD, |
| 2567 | [Define if you want to compile in rudimentary thread support]) |
| 2568 | |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2569 | AC_MSG_CHECKING(for --with-threads) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2570 | dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2571 | AC_ARG_WITH(threads, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2572 | AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support])) |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 2573 | |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2574 | # --with-thread is deprecated, but check for it anyway |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2575 | dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output |
Barry Warsaw | a0f3c5c | 2000-06-30 16:39:35 +0000 | [diff] [blame] | 2576 | AC_ARG_WITH(thread, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2577 | 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] | 2578 | [with_threads=$with_thread]) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2579 | |
| 2580 | if test -z "$with_threads" |
| 2581 | then with_threads="yes" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 2582 | fi |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2583 | AC_MSG_RESULT($with_threads) |
Guido van Rossum | 6400c26 | 1997-05-22 20:34:27 +0000 | [diff] [blame] | 2584 | |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2585 | AC_SUBST(THREADOBJ) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2586 | if test "$with_threads" = "no" |
| 2587 | then |
| 2588 | USE_THREAD_MODULE="#" |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2589 | elif test "$ac_cv_pthread_is_default" = yes |
| 2590 | then |
| 2591 | AC_DEFINE(WITH_THREAD) |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2592 | # Defining _REENTRANT on system with POSIX threads should not hurt. |
| 2593 | AC_DEFINE(_REENTRANT) |
| 2594 | posix_threads=yes |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2595 | THREADOBJ="Python/thread.o" |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2596 | elif test "$ac_cv_kpthread" = "yes" |
| 2597 | then |
| 2598 | CC="$CC -Kpthread" |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 2599 | if test "$ac_cv_cxx_thread" = "yes"; then |
| 2600 | CXX="$CXX -Kpthread" |
| 2601 | fi |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2602 | AC_DEFINE(WITH_THREAD) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2603 | posix_threads=yes |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2604 | THREADOBJ="Python/thread.o" |
Martin v. Löwis | 5f433f0 | 2003-05-05 05:05:30 +0000 | [diff] [blame] | 2605 | elif test "$ac_cv_kthread" = "yes" |
| 2606 | then |
| 2607 | CC="$CC -Kthread" |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 2608 | if test "$ac_cv_cxx_thread" = "yes"; then |
| 2609 | CXX="$CXX -Kthread" |
| 2610 | fi |
Martin v. Löwis | 5f433f0 | 2003-05-05 05:05:30 +0000 | [diff] [blame] | 2611 | AC_DEFINE(WITH_THREAD) |
| 2612 | posix_threads=yes |
| 2613 | THREADOBJ="Python/thread.o" |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 2614 | elif test "$ac_cv_pthread" = "yes" |
| 2615 | then |
| 2616 | CC="$CC -pthread" |
Martin v. Löwis | 519adae | 2003-09-20 10:47:47 +0000 | [diff] [blame] | 2617 | if test "$ac_cv_cxx_thread" = "yes"; then |
| 2618 | CXX="$CXX -pthread" |
| 2619 | fi |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 2620 | AC_DEFINE(WITH_THREAD) |
| 2621 | posix_threads=yes |
| 2622 | THREADOBJ="Python/thread.o" |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2623 | else |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2624 | if test ! -z "$with_threads" -a -d "$with_threads" |
| 2625 | then LDFLAGS="$LDFLAGS -L$with_threads" |
| 2626 | fi |
| 2627 | if test ! -z "$withval" -a -d "$withval" |
| 2628 | then LDFLAGS="$LDFLAGS -L$withval" |
| 2629 | fi |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2630 | |
| 2631 | # According to the POSIX spec, a pthreads implementation must |
Matthias Klose | a2542be | 2004-08-16 11:35:51 +0000 | [diff] [blame] | 2632 | # define _POSIX_THREADS in unistd.h. Some apparently don't |
| 2633 | # (e.g. gnu pth with pthread emulation) |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2634 | AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h) |
| 2635 | AC_EGREP_CPP(yes, |
Neal Norwitz | 6eb37f0 | 2003-02-23 23:28:15 +0000 | [diff] [blame] | 2636 | [ |
| 2637 | #include <unistd.h> |
| 2638 | #ifdef _POSIX_THREADS |
| 2639 | yes |
| 2640 | #endif |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2641 | ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no) |
| 2642 | AC_MSG_RESULT($unistd_defines_pthreads) |
| 2643 | |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2644 | AC_DEFINE(_REENTRANT) |
Martin v. Löwis | a6e9758 | 2002-01-01 18:41:33 +0000 | [diff] [blame] | 2645 | AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD) |
| 2646 | AC_DEFINE(C_THREADS) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2647 | AC_DEFINE(HURD_C_THREADS, 1, |
| 2648 | [Define if you are using Mach cthreads directly under /include]) |
Martin v. Löwis | a6e9758 | 2002-01-01 18:41:33 +0000 | [diff] [blame] | 2649 | LIBS="$LIBS -lthreads" |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2650 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2651 | AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) |
| 2652 | AC_DEFINE(C_THREADS) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2653 | AC_DEFINE(MACH_C_THREADS, 1, |
| 2654 | [Define if you are using Mach cthreads under mach /]) |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2655 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2656 | AC_MSG_CHECKING(for --with-pth) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2657 | AC_ARG_WITH([pth], |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2658 | AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2659 | [AC_MSG_RESULT($withval) |
| 2660 | AC_DEFINE([WITH_THREAD]) |
| 2661 | AC_DEFINE([HAVE_PTH], 1, |
| 2662 | [Define if you have GNU PTH threads.]) |
| 2663 | LIBS="-lpth $LIBS" |
| 2664 | THREADOBJ="Python/thread.o"], |
| 2665 | [AC_MSG_RESULT(no) |
Martin v. Löwis | 8158b5a | 2001-10-08 13:17:28 +0000 | [diff] [blame] | 2666 | |
| 2667 | # Just looking for pthread_create in libpthread is not enough: |
| 2668 | # on HP/UX, pthread.h renames pthread_create to a different symbol name. |
| 2669 | # So we really have to include pthread.h, and then link. |
| 2670 | _libs=$LIBS |
| 2671 | LIBS="$LIBS -lpthread" |
| 2672 | AC_MSG_CHECKING([for pthread_create in -lpthread]) |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 2673 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 2674 | #include <stdio.h> |
| 2675 | #include <pthread.h> |
Martin v. Löwis | 8158b5a | 2001-10-08 13:17:28 +0000 | [diff] [blame] | 2676 | |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2677 | void * start_routine (void *arg) { exit (0); }]], [[ |
| 2678 | pthread_create (NULL, NULL, start_routine, NULL)]])],[ |
Martin v. Löwis | 8158b5a | 2001-10-08 13:17:28 +0000 | [diff] [blame] | 2679 | AC_MSG_RESULT(yes) |
| 2680 | AC_DEFINE(WITH_THREAD) |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2681 | posix_threads=yes |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2682 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 8158b5a | 2001-10-08 13:17:28 +0000 | [diff] [blame] | 2683 | LIBS=$_libs |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2684 | AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2685 | posix_threads=yes |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2686 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 2687 | AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD) |
| 2688 | AC_DEFINE(ATHEOS_THREADS, 1, |
| 2689 | [Define this if you have AtheOS threads.]) |
| 2690 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2691 | AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2692 | AC_DEFINE(BEOS_THREADS, 1, |
| 2693 | [Define this if you have BeOS threads.]) |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2694 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2695 | AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2696 | posix_threads=yes |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2697 | LIBS="$LIBS -lpthreads" |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2698 | THREADOBJ="Python/thread.o"], [ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2699 | AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2700 | posix_threads=yes |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2701 | LIBS="$LIBS -lc_r" |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2702 | THREADOBJ="Python/thread.o"], [ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2703 | AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2704 | posix_threads=yes |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2705 | LIBS="$LIBS -lpthread" |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2706 | THREADOBJ="Python/thread.o"], [ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2707 | AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2708 | posix_threads=yes |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2709 | LIBS="$LIBS -lcma" |
Martin v. Löwis | 2d7e264 | 2002-04-05 16:50:53 +0000 | [diff] [blame] | 2710 | THREADOBJ="Python/thread.o"],[ |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 2711 | USE_THREAD_MODULE="#"]) |
Skip Montanaro | f8712e5 | 2004-01-17 03:04:46 +0000 | [diff] [blame] | 2712 | ])])])])])])])])])]) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2713 | |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 2714 | AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) |
| 2715 | LIBS="$LIBS -lmpc" |
| 2716 | THREADOBJ="Python/thread.o" |
| 2717 | USE_THREAD_MODULE=""]) |
| 2718 | |
| 2719 | if test "$posix_threads" != "yes"; then |
| 2720 | AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) |
| 2721 | LIBS="$LIBS -lthread" |
| 2722 | THREADOBJ="Python/thread.o" |
| 2723 | USE_THREAD_MODULE=""]) |
| 2724 | fi |
| 2725 | |
| 2726 | if test "$USE_THREAD_MODULE" != "#" |
| 2727 | then |
| 2728 | # If the above checks didn't disable threads, (at least) OSF1 |
| 2729 | # needs this '-threads' argument during linking. |
| 2730 | case $ac_sys_system in |
| 2731 | OSF1) LDLAST=-threads;; |
| 2732 | esac |
| 2733 | fi |
| 2734 | fi |
| 2735 | |
| 2736 | if test "$posix_threads" = "yes"; then |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2737 | if test "$unistd_defines_pthreads" = "no"; then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2738 | AC_DEFINE(_POSIX_THREADS, 1, |
| 2739 | [Define if you have POSIX threads, |
| 2740 | and your system does not define that.]) |
Martin v. Löwis | 69c0ff3 | 2001-10-15 14:34:42 +0000 | [diff] [blame] | 2741 | fi |
| 2742 | |
Martin v. Löwis | dfc33fd | 2003-01-21 10:14:41 +0000 | [diff] [blame] | 2743 | # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. |
| 2744 | case $ac_sys_system/$ac_sys_release in |
Charles-François Natali | 4929eb9 | 2011-07-21 19:41:04 +0200 | [diff] [blame] | 2745 | SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 2746 | [Defined for Solaris 2.6 bug in pthread header.]) |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 2747 | ;; |
Martin v. Löwis | dfc33fd | 2003-01-21 10:14:41 +0000 | [diff] [blame] | 2748 | SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 2749 | [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] | 2750 | ;; |
Charles-François Natali | 4929eb9 | 2011-07-21 19:41:04 +0200 | [diff] [blame] | 2751 | AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 2752 | [Define if the Posix semaphores do not work on your system]) |
Christian Heimes | cba36bb | 2008-01-30 22:54:18 +0000 | [diff] [blame] | 2753 | ;; |
Martin v. Löwis | dfc33fd | 2003-01-21 10:14:41 +0000 | [diff] [blame] | 2754 | esac |
| 2755 | |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2756 | AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported) |
| 2757 | AC_CACHE_VAL(ac_cv_pthread_system_supported, |
Stefan Krah | ae66ca6 | 2012-11-22 22:36:57 +0100 | [diff] [blame] | 2758 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
| 2759 | #include <stdio.h> |
| 2760 | #include <pthread.h> |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2761 | void *foo(void *parm) { |
| 2762 | return NULL; |
| 2763 | } |
| 2764 | main() { |
| 2765 | pthread_attr_t attr; |
Martin v. Löwis | a82d347 | 2002-02-24 16:05:05 +0000 | [diff] [blame] | 2766 | pthread_t id; |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2767 | if (pthread_attr_init(&attr)) exit(-1); |
| 2768 | if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1); |
Martin v. Löwis | a82d347 | 2002-02-24 16:05:05 +0000 | [diff] [blame] | 2769 | if (pthread_create(&id, &attr, foo, NULL)) exit(-1); |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2770 | exit(0); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2771 | }]])], |
| 2772 | [ac_cv_pthread_system_supported=yes], |
| 2773 | [ac_cv_pthread_system_supported=no], |
| 2774 | [ac_cv_pthread_system_supported=no]) |
Guido van Rossum | d0b69ec | 2001-09-10 14:10:54 +0000 | [diff] [blame] | 2775 | ]) |
| 2776 | AC_MSG_RESULT($ac_cv_pthread_system_supported) |
| 2777 | if test "$ac_cv_pthread_system_supported" = "yes"; then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 2778 | 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] | 2779 | fi |
Jason Tishler | fac083d | 2003-07-22 15:20:49 +0000 | [diff] [blame] | 2780 | AC_CHECK_FUNCS(pthread_sigmask, |
| 2781 | [case $ac_sys_system in |
| 2782 | CYGWIN*) |
| 2783 | AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1, |
| 2784 | [Define if pthread_sigmask() does not work on your system.]) |
| 2785 | ;; |
| 2786 | esac]) |
Christian Heimes | 0d604cf | 2013-08-21 13:26:05 +0200 | [diff] [blame] | 2787 | AC_CHECK_FUNCS(pthread_atfork) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 2788 | fi |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 2789 | |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 2790 | |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2791 | # Check for enable-ipv6 |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 2792 | AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) |
Martin v. Löwis | a5f8bb5 | 2001-09-05 08:22:34 +0000 | [diff] [blame] | 2793 | AC_MSG_CHECKING([if --enable-ipv6 is specified]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2794 | AC_ARG_ENABLE(ipv6, |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 2795 | [ --enable-ipv6 Enable ipv6 (with ipv4) support |
| 2796 | --disable-ipv6 Disable ipv6 support], |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2797 | [ case "$enableval" in |
| 2798 | no) |
| 2799 | AC_MSG_RESULT(no) |
| 2800 | ipv6=no |
| 2801 | ;; |
| 2802 | *) AC_MSG_RESULT(yes) |
| 2803 | AC_DEFINE(ENABLE_IPV6) |
| 2804 | ipv6=yes |
| 2805 | ;; |
| 2806 | esac ], |
| 2807 | |
Martin v. Löwis | a5f8bb5 | 2001-09-05 08:22:34 +0000 | [diff] [blame] | 2808 | [ |
| 2809 | dnl the check does not work on cross compilation case... |
Charles-François Natali | be2b907 | 2013-01-08 19:47:00 +0100 | [diff] [blame] | 2810 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* AF_INET6 available check */ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2811 | #include <sys/types.h> |
Charles-François Natali | be2b907 | 2013-01-08 19:47:00 +0100 | [diff] [blame] | 2812 | #include <sys/socket.h>]], |
| 2813 | [[int domain = AF_INET6;]])],[ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2814 | AC_MSG_RESULT(yes) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2815 | ipv6=yes |
| 2816 | ],[ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2817 | AC_MSG_RESULT(no) |
| 2818 | ipv6=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2819 | ]) |
Martin v. Löwis | a5f8bb5 | 2001-09-05 08:22:34 +0000 | [diff] [blame] | 2820 | |
| 2821 | if test "$ipv6" = "yes"; then |
| 2822 | AC_MSG_CHECKING(if RFC2553 API is available) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2823 | AC_COMPILE_IFELSE([ |
| 2824 | AC_LANG_PROGRAM([[#include <sys/types.h> |
| 2825 | #include <netinet/in.h>]], |
| 2826 | [[struct sockaddr_in6 x; |
| 2827 | x.sin6_scope_id;]]) |
| 2828 | ],[ |
| 2829 | AC_MSG_RESULT(yes) |
| 2830 | ipv6=yes |
| 2831 | ],[ |
| 2832 | AC_MSG_RESULT(no, IPv6 disabled) |
| 2833 | ipv6=no |
| 2834 | ]) |
Martin v. Löwis | a5f8bb5 | 2001-09-05 08:22:34 +0000 | [diff] [blame] | 2835 | fi |
| 2836 | |
| 2837 | if test "$ipv6" = "yes"; then |
| 2838 | AC_DEFINE(ENABLE_IPV6) |
| 2839 | fi |
| 2840 | ]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2841 | |
| 2842 | ipv6type=unknown |
| 2843 | ipv6lib=none |
| 2844 | ipv6trylibc=no |
| 2845 | |
| 2846 | if test "$ipv6" = "yes"; then |
| 2847 | AC_MSG_CHECKING([ipv6 stack type]) |
Guido van Rossum | b855216 | 2001-09-05 14:58:11 +0000 | [diff] [blame] | 2848 | for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta; |
| 2849 | do |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2850 | case $i in |
| 2851 | inria) |
| 2852 | dnl http://www.kame.net/ |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2853 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2854 | #include <netinet/in.h> |
| 2855 | #ifdef IPV6_INRIA_VERSION |
| 2856 | yes |
| 2857 | #endif], |
Martin v. Löwis | 44ddbde | 2001-12-02 10:15:37 +0000 | [diff] [blame] | 2858 | [ipv6type=$i]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2859 | ;; |
| 2860 | kame) |
| 2861 | dnl http://www.kame.net/ |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2862 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2863 | #include <netinet/in.h> |
| 2864 | #ifdef __KAME__ |
| 2865 | yes |
| 2866 | #endif], |
| 2867 | [ipv6type=$i; |
| 2868 | ipv6lib=inet6 |
| 2869 | ipv6libdir=/usr/local/v6/lib |
Martin v. Löwis | 44ddbde | 2001-12-02 10:15:37 +0000 | [diff] [blame] | 2870 | ipv6trylibc=yes]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2871 | ;; |
| 2872 | linux-glibc) |
| 2873 | dnl http://www.v6.linux.or.jp/ |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2874 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2875 | #include <features.h> |
| 2876 | #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)) |
| 2877 | yes |
| 2878 | #endif], |
| 2879 | [ipv6type=$i; |
Martin v. Löwis | 44ddbde | 2001-12-02 10:15:37 +0000 | [diff] [blame] | 2880 | ipv6trylibc=yes]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2881 | ;; |
| 2882 | linux-inet6) |
| 2883 | dnl http://www.v6.linux.or.jp/ |
| 2884 | if test -d /usr/inet6; then |
| 2885 | ipv6type=$i |
| 2886 | ipv6lib=inet6 |
| 2887 | ipv6libdir=/usr/inet6/lib |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 2888 | BASECFLAGS="-I/usr/inet6/include $BASECFLAGS" |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2889 | fi |
| 2890 | ;; |
| 2891 | solaris) |
| 2892 | if test -f /etc/netconfig; then |
Antoine Pitrou | 31e8595 | 2011-01-03 18:57:14 +0000 | [diff] [blame] | 2893 | if $GREP -q tcp6 /etc/netconfig; then |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2894 | ipv6type=$i |
| 2895 | ipv6trylibc=yes |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2896 | fi |
| 2897 | fi |
| 2898 | ;; |
| 2899 | toshiba) |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2900 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2901 | #include <sys/param.h> |
| 2902 | #ifdef _TOSHIBA_INET6 |
| 2903 | yes |
| 2904 | #endif], |
| 2905 | [ipv6type=$i; |
| 2906 | ipv6lib=inet6; |
Martin v. Löwis | 44ddbde | 2001-12-02 10:15:37 +0000 | [diff] [blame] | 2907 | ipv6libdir=/usr/local/v6/lib]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2908 | ;; |
| 2909 | v6d) |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2910 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2911 | #include </usr/local/v6/include/sys/v6config.h> |
| 2912 | #ifdef __V6D__ |
| 2913 | yes |
| 2914 | #endif], |
| 2915 | [ipv6type=$i; |
| 2916 | ipv6lib=v6; |
| 2917 | ipv6libdir=/usr/local/v6/lib; |
Skip Montanaro | decc6a4 | 2003-01-01 20:07:49 +0000 | [diff] [blame] | 2918 | BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2919 | ;; |
| 2920 | zeta) |
Martin v. Löwis | a5f73f9 | 2001-10-15 08:06:29 +0000 | [diff] [blame] | 2921 | AC_EGREP_CPP(yes, [ |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2922 | #include <sys/param.h> |
| 2923 | #ifdef _ZETA_MINAMI_INET6 |
| 2924 | yes |
| 2925 | #endif], |
| 2926 | [ipv6type=$i; |
| 2927 | ipv6lib=inet6; |
Martin v. Löwis | 44ddbde | 2001-12-02 10:15:37 +0000 | [diff] [blame] | 2928 | ipv6libdir=/usr/local/v6/lib]) |
Martin v. Löwis | a2ac602 | 2001-08-09 11:40:14 +0000 | [diff] [blame] | 2929 | ;; |
| 2930 | esac |
| 2931 | if test "$ipv6type" != "unknown"; then |
| 2932 | break |
| 2933 | fi |
| 2934 | done |
| 2935 | AC_MSG_RESULT($ipv6type) |
| 2936 | fi |
| 2937 | |
| 2938 | if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then |
| 2939 | if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then |
| 2940 | LIBS="-L$ipv6libdir -l$ipv6lib $LIBS" |
| 2941 | echo "using lib$ipv6lib" |
| 2942 | else |
| 2943 | if test $ipv6trylibc = "yes"; then |
| 2944 | echo "using libc" |
| 2945 | else |
| 2946 | echo 'Fatal: no $ipv6lib library found. cannot continue.' |
| 2947 | echo "You need to fetch lib$ipv6lib.a from appropriate" |
| 2948 | echo 'ipv6 kit and compile beforehand.' |
| 2949 | exit 1 |
| 2950 | fi |
| 2951 | fi |
| 2952 | fi |
| 2953 | |
Ronald Oussoren | 0d236eb | 2008-06-06 21:31:33 +0000 | [diff] [blame] | 2954 | AC_MSG_CHECKING(for OSX 10.5 SDK or later) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2955 | AC_COMPILE_IFELSE([ |
Mark Dickinson | 0712b56 | 2010-05-08 19:13:21 +0000 | [diff] [blame] | 2956 | AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]]) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2957 | ],[ |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 2958 | 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] | 2959 | AC_MSG_RESULT(yes) |
| 2960 | ],[ |
Ronald Oussoren | 0d236eb | 2008-06-06 21:31:33 +0000 | [diff] [blame] | 2961 | AC_MSG_RESULT(no) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 2962 | ]) |
Ronald Oussoren | 0d236eb | 2008-06-06 21:31:33 +0000 | [diff] [blame] | 2963 | |
Martin v. Löwis | a3fb4f7 | 2002-06-09 13:33:54 +0000 | [diff] [blame] | 2964 | # Check for --with-doc-strings |
| 2965 | AC_MSG_CHECKING(for --with-doc-strings) |
| 2966 | AC_ARG_WITH(doc-strings, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2967 | 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] | 2968 | |
| 2969 | if test -z "$with_doc_strings" |
| 2970 | then with_doc_strings="yes" |
| 2971 | fi |
| 2972 | if test "$with_doc_strings" != "no" |
| 2973 | then |
| 2974 | AC_DEFINE(WITH_DOC_STRINGS, 1, |
| 2975 | [Define if you want documentation strings in extension modules]) |
| 2976 | fi |
| 2977 | AC_MSG_RESULT($with_doc_strings) |
| 2978 | |
Neil Schemenauer | a35c688 | 2001-02-27 04:45:05 +0000 | [diff] [blame] | 2979 | # Check for Python-specific malloc support |
Martin v. Löwis | f30d60e | 2004-06-08 08:17:44 +0000 | [diff] [blame] | 2980 | AC_MSG_CHECKING(for --with-tsc) |
| 2981 | AC_ARG_WITH(tsc, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2982 | 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] | 2983 | if test "$withval" != no |
| 2984 | then |
| 2985 | AC_DEFINE(WITH_TSC, 1, |
| 2986 | [Define to profile with the Pentium timestamp counter]) |
| 2987 | AC_MSG_RESULT(yes) |
| 2988 | else AC_MSG_RESULT(no) |
| 2989 | fi], |
| 2990 | [AC_MSG_RESULT(no)]) |
| 2991 | |
| 2992 | # Check for Python-specific malloc support |
Neil Schemenauer | a35c688 | 2001-02-27 04:45:05 +0000 | [diff] [blame] | 2993 | AC_MSG_CHECKING(for --with-pymalloc) |
| 2994 | AC_ARG_WITH(pymalloc, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 2995 | AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs])) |
Neil Schemenauer | 16c2297 | 2002-03-22 15:34:49 +0000 | [diff] [blame] | 2996 | |
| 2997 | if test -z "$with_pymalloc" |
| 2998 | then with_pymalloc="yes" |
| 2999 | fi |
| 3000 | if test "$with_pymalloc" != "no" |
| 3001 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3002 | AC_DEFINE(WITH_PYMALLOC, 1, |
| 3003 | [Define if you want to compile in Python-specific mallocs]) |
Neil Schemenauer | 16c2297 | 2002-03-22 15:34:49 +0000 | [diff] [blame] | 3004 | fi |
| 3005 | AC_MSG_RESULT($with_pymalloc) |
Neil Schemenauer | a35c688 | 2001-02-27 04:45:05 +0000 | [diff] [blame] | 3006 | |
Benjamin Peterson | 91c12eb | 2009-12-03 02:52:39 +0000 | [diff] [blame] | 3007 | # Check for Valgrind support |
| 3008 | AC_MSG_CHECKING([for --with-valgrind]) |
| 3009 | AC_ARG_WITH([valgrind], |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3010 | AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),, |
Benjamin Peterson | 91c12eb | 2009-12-03 02:52:39 +0000 | [diff] [blame] | 3011 | with_valgrind=no) |
| 3012 | AC_MSG_RESULT([$with_valgrind]) |
| 3013 | if test "$with_valgrind" != no; then |
| 3014 | AC_CHECK_HEADER([valgrind/valgrind.h], |
| 3015 | [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])], |
| 3016 | [AC_MSG_ERROR([Valgrind support requested but headers not available])] |
| 3017 | ) |
| 3018 | fi |
| 3019 | |
Barry Warsaw | ef82cd7 | 2000-06-30 16:21:01 +0000 | [diff] [blame] | 3020 | # Check for --with-wctype-functions |
| 3021 | AC_MSG_CHECKING(for --with-wctype-functions) |
| 3022 | AC_ARG_WITH(wctype-functions, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3023 | AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3024 | [ |
Barry Warsaw | ef82cd7 | 2000-06-30 16:21:01 +0000 | [diff] [blame] | 3025 | if test "$withval" != no |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3026 | then |
| 3027 | AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1, |
| 3028 | [Define if you want wctype.h functions to be used instead of the |
| 3029 | one supplied by Python itself. (see Include/unicodectype.h).]) |
| 3030 | AC_MSG_RESULT(yes) |
Barry Warsaw | ef82cd7 | 2000-06-30 16:21:01 +0000 | [diff] [blame] | 3031 | else AC_MSG_RESULT(no) |
| 3032 | fi], |
| 3033 | [AC_MSG_RESULT(no)]) |
| 3034 | |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 3035 | # -I${DLINCLDIR} is added to the compile rule for importdl.o |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3036 | AC_SUBST(DLINCLDIR) |
Guido van Rossum | 98935bf | 2001-09-05 19:13:16 +0000 | [diff] [blame] | 3037 | DLINCLDIR=. |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3038 | |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 3039 | # the dlopen() function means we might want to use dynload_shlib.o. some |
| 3040 | # 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] | 3041 | AC_CHECK_FUNCS(dlopen) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 3042 | |
| 3043 | # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic |
| 3044 | # loading of modules. |
| 3045 | AC_SUBST(DYNLOADFILE) |
| 3046 | AC_MSG_CHECKING(DYNLOADFILE) |
| 3047 | if test -z "$DYNLOADFILE" |
| 3048 | then |
| 3049 | case $ac_sys_system/$ac_sys_release in |
Martin v. Löwis | c19c5a6 | 2003-11-18 20:00:44 +0000 | [diff] [blame] | 3050 | AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c |
| 3051 | if test "$ac_cv_func_dlopen" = yes |
| 3052 | then DYNLOADFILE="dynload_shlib.o" |
| 3053 | else DYNLOADFILE="dynload_aix.o" |
| 3054 | fi |
| 3055 | ;; |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 3056 | BeOS*) DYNLOADFILE="dynload_beos.o";; |
| 3057 | hp*|HP*) DYNLOADFILE="dynload_hpux.o";; |
Anthony Baxter | 8220174 | 2006-04-09 15:07:40 +0000 | [diff] [blame] | 3058 | # Use dynload_next.c only on 10.2 and below, which don't have native dlopen() |
| 3059 | Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";; |
Martin v. Löwis | f90ae20 | 2002-06-11 06:22:31 +0000 | [diff] [blame] | 3060 | atheos*) DYNLOADFILE="dynload_atheos.o";; |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 3061 | *) |
| 3062 | # use dynload_shlib.c and dlopen() if we have it; otherwise stub |
| 3063 | # out any dynamic loading |
| 3064 | if test "$ac_cv_func_dlopen" = yes |
| 3065 | then DYNLOADFILE="dynload_shlib.o" |
| 3066 | else DYNLOADFILE="dynload_stub.o" |
| 3067 | fi |
| 3068 | ;; |
| 3069 | esac |
| 3070 | fi |
| 3071 | AC_MSG_RESULT($DYNLOADFILE) |
| 3072 | if test "$DYNLOADFILE" != "dynload_stub.o" |
| 3073 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3074 | AC_DEFINE(HAVE_DYNAMIC_LOADING, 1, |
| 3075 | [Defined when any dynamic module loading is enabled.]) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 3076 | fi |
| 3077 | |
Jack Jansen | c49e5b7 | 2001-06-19 15:00:23 +0000 | [diff] [blame] | 3078 | # MACHDEP_OBJS can be set to platform-specific object files needed by Python |
| 3079 | |
| 3080 | AC_SUBST(MACHDEP_OBJS) |
| 3081 | AC_MSG_CHECKING(MACHDEP_OBJS) |
| 3082 | if test -z "$MACHDEP_OBJS" |
| 3083 | then |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 3084 | MACHDEP_OBJS=$extra_machdep_objs |
| 3085 | else |
| 3086 | MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs" |
Jack Jansen | c49e5b7 | 2001-06-19 15:00:23 +0000 | [diff] [blame] | 3087 | fi |
Jack Jansen | b6e9cad | 2001-08-15 01:26:28 +0000 | [diff] [blame] | 3088 | AC_MSG_RESULT(MACHDEP_OBJS) |
Jack Jansen | c49e5b7 | 2001-06-19 15:00:23 +0000 | [diff] [blame] | 3089 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3090 | # checks for library functions |
Martin v. Löwis | aef18b1 | 2008-03-24 13:31:16 +0000 | [diff] [blame] | 3091 | AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \ |
| 3092 | clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \ |
Martin v. Löwis | 438b534 | 2002-12-27 10:16:42 +0000 | [diff] [blame] | 3093 | gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ |
Benjamin Peterson | 27c269a | 2014-12-26 11:09:00 -0600 | [diff] [blame] | 3094 | getentropy \ |
Martin v. Löwis | 50ea456 | 2009-11-27 13:56:01 +0000 | [diff] [blame] | 3095 | getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ |
Benjamin Peterson | d16e01c | 2014-02-04 10:20:26 -0500 | [diff] [blame] | 3096 | initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime mmap \ |
Martin v. Löwis | a5f0907 | 2002-10-11 05:37:59 +0000 | [diff] [blame] | 3097 | mremap nice pathconf pause plock poll pthread_init \ |
Guido van Rossum | 162e38c | 2003-02-19 15:25:10 +0000 | [diff] [blame] | 3098 | putenv readlink realpath \ |
Jesse Noller | 355b126 | 2009-04-02 00:03:28 +0000 | [diff] [blame] | 3099 | select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \ |
| 3100 | setgid \ |
Martin v. Löwis | 4daacb1 | 2003-03-28 18:37:01 +0000 | [diff] [blame] | 3101 | setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \ |
Martin v. Löwis | 50ea456 | 2009-11-27 13:56:01 +0000 | [diff] [blame] | 3102 | setlocale setregid setreuid setresuid setresgid \ |
| 3103 | setsid setpgid setpgrp setuid setvbuf snprintf \ |
Skip Montanaro | 7e11a01 | 2004-02-07 12:55:46 +0000 | [diff] [blame] | 3104 | sigaction siginterrupt sigrelse strftime \ |
Michael W. Hudson | 34f20ea | 2002-05-27 15:08:24 +0000 | [diff] [blame] | 3105 | sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ |
Neal Norwitz | 05a4559 | 2006-03-20 06:30:08 +0000 | [diff] [blame] | 3106 | truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty) |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 3107 | |
Martin v. Löwis | c8ad7cc | 2002-11-11 13:23:45 +0000 | [diff] [blame] | 3108 | # For some functions, having a definition is not sufficient, since |
| 3109 | # we want to take their address. |
| 3110 | AC_MSG_CHECKING(for chroot) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3111 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])], |
| 3112 | [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.) |
| 3113 | AC_MSG_RESULT(yes)], |
| 3114 | [AC_MSG_RESULT(no) |
| 3115 | ]) |
Martin v. Löwis | c8ad7cc | 2002-11-11 13:23:45 +0000 | [diff] [blame] | 3116 | AC_MSG_CHECKING(for link) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3117 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])], |
| 3118 | [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.) |
| 3119 | AC_MSG_RESULT(yes)], |
| 3120 | [AC_MSG_RESULT(no) |
| 3121 | ]) |
Martin v. Löwis | c8ad7cc | 2002-11-11 13:23:45 +0000 | [diff] [blame] | 3122 | AC_MSG_CHECKING(for symlink) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3123 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])], |
| 3124 | [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.) |
| 3125 | AC_MSG_RESULT(yes)], |
| 3126 | [AC_MSG_RESULT(no) |
| 3127 | ]) |
Martin v. Löwis | a64988c | 2003-09-20 15:30:20 +0000 | [diff] [blame] | 3128 | AC_MSG_CHECKING(for fchdir) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3129 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])], |
| 3130 | [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.) |
| 3131 | AC_MSG_RESULT(yes)], |
| 3132 | [AC_MSG_RESULT(no) |
| 3133 | ]) |
Martin v. Löwis | a64988c | 2003-09-20 15:30:20 +0000 | [diff] [blame] | 3134 | AC_MSG_CHECKING(for fsync) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3135 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])], |
| 3136 | [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.) |
| 3137 | AC_MSG_RESULT(yes)], |
| 3138 | [AC_MSG_RESULT(no) |
| 3139 | ]) |
Martin v. Löwis | a64988c | 2003-09-20 15:30:20 +0000 | [diff] [blame] | 3140 | AC_MSG_CHECKING(for fdatasync) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3141 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])], |
| 3142 | [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.) |
| 3143 | AC_MSG_RESULT(yes)], |
| 3144 | [AC_MSG_RESULT(no) |
| 3145 | ]) |
Christian Heimes | 0e9ab5f | 2008-03-21 23:49:44 +0000 | [diff] [blame] | 3146 | AC_MSG_CHECKING(for epoll) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3147 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])], |
| 3148 | [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.) |
| 3149 | AC_MSG_RESULT(yes)], |
| 3150 | [AC_MSG_RESULT(no) |
| 3151 | ]) |
Christian Heimes | 0e9ab5f | 2008-03-21 23:49:44 +0000 | [diff] [blame] | 3152 | AC_MSG_CHECKING(for kqueue) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3153 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Christian Heimes | 0e9ab5f | 2008-03-21 23:49:44 +0000 | [diff] [blame] | 3154 | #include <sys/types.h> |
| 3155 | #include <sys/event.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3156 | ]], [[int x=kqueue()]])], |
| 3157 | [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.) |
| 3158 | AC_MSG_RESULT(yes)], |
| 3159 | [AC_MSG_RESULT(no) |
| 3160 | ]) |
Martin v. Löwis | d584368 | 2002-11-21 20:41:28 +0000 | [diff] [blame] | 3161 | # On some systems (eg. FreeBSD 5), we would find a definition of the |
| 3162 | # functions ctermid_r, setgroups in the library, but no prototype |
| 3163 | # (e.g. because we use _XOPEN_SOURCE). See whether we can take their |
| 3164 | # address to avoid compiler warnings and potential miscompilations |
| 3165 | # because of the missing prototypes. |
| 3166 | |
| 3167 | AC_MSG_CHECKING(for ctermid_r) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3168 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | d584368 | 2002-11-21 20:41:28 +0000 | [diff] [blame] | 3169 | #include <stdio.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3170 | ]], [[void* p = ctermid_r]])], |
| 3171 | [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.) |
| 3172 | AC_MSG_RESULT(yes)], |
| 3173 | [AC_MSG_RESULT(no) |
| 3174 | ]) |
Martin v. Löwis | d584368 | 2002-11-21 20:41:28 +0000 | [diff] [blame] | 3175 | |
Antoine Pitrou | b170f17 | 2010-09-10 18:47:36 +0000 | [diff] [blame] | 3176 | AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl], |
| 3177 | [AC_COMPILE_IFELSE( |
| 3178 | [AC_LANG_PROGRAM( |
| 3179 | [#include <sys/file.h>], |
| 3180 | [void* p = flock] |
| 3181 | )], |
| 3182 | [ac_cv_flock_decl=yes], |
| 3183 | [ac_cv_flock_decl=no] |
| 3184 | ) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3185 | ]) |
Antoine Pitrou | b170f17 | 2010-09-10 18:47:36 +0000 | [diff] [blame] | 3186 | if test "x${ac_cv_flock_decl}" = xyes; then |
| 3187 | AC_CHECK_FUNCS(flock,, |
| 3188 | AC_CHECK_LIB(bsd,flock, |
| 3189 | [AC_DEFINE(HAVE_FLOCK) |
| 3190 | AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.) |
| 3191 | ]) |
| 3192 | ) |
Antoine Pitrou | 8572981 | 2010-09-07 14:55:24 +0000 | [diff] [blame] | 3193 | fi |
Martin v. Löwis | f26d63b | 2003-03-30 17:23:49 +0000 | [diff] [blame] | 3194 | |
| 3195 | AC_MSG_CHECKING(for getpagesize) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3196 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | f26d63b | 2003-03-30 17:23:49 +0000 | [diff] [blame] | 3197 | #include <unistd.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3198 | ]], [[void* p = getpagesize]])], |
| 3199 | [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.) |
| 3200 | AC_MSG_RESULT(yes)], |
| 3201 | [AC_MSG_RESULT(no) |
| 3202 | ]) |
Martin v. Löwis | f26d63b | 2003-03-30 17:23:49 +0000 | [diff] [blame] | 3203 | |
Charles-François Natali | 93a1175 | 2011-11-27 13:01:35 +0100 | [diff] [blame] | 3204 | AC_MSG_CHECKING(for broken unsetenv) |
| 3205 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 3206 | #include <stdlib.h> |
| 3207 | ]], [[int res = unsetenv("DUMMY")]])], |
| 3208 | [AC_MSG_RESULT(no)], |
| 3209 | [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.) |
| 3210 | AC_MSG_RESULT(yes) |
| 3211 | ]) |
| 3212 | |
Martin v. Löwis | 4ee6eef | 2003-05-26 05:37:51 +0000 | [diff] [blame] | 3213 | dnl check for true |
| 3214 | AC_CHECK_PROGS(TRUE, true, /bin/true) |
| 3215 | |
Martin v. Löwis | 95c419b | 2003-05-03 12:10:48 +0000 | [diff] [blame] | 3216 | dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv |
| 3217 | 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] | 3218 | AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE], |
Martin v. Löwis | 95c419b | 2003-05-03 12:10:48 +0000 | [diff] [blame] | 3219 | AC_CHECK_LIB(resolv, inet_aton) |
| 3220 | ) |
| 3221 | |
Martin v. Löwis | a51d5c8 | 2007-12-04 08:37:59 +0000 | [diff] [blame] | 3222 | # On Tru64, chflags seems to be present, but calling it will |
| 3223 | # exit Python |
Gregory P. Smith | bb21389 | 2009-11-02 01:37:37 +0000 | [diff] [blame] | 3224 | AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl |
Ned Deily | 43e1054 | 2011-06-27 23:41:53 -0700 | [diff] [blame] | 3225 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Martin v. Löwis | a51d5c8 | 2007-12-04 08:37:59 +0000 | [diff] [blame] | 3226 | #include <sys/stat.h> |
| 3227 | #include <unistd.h> |
| 3228 | int main(int argc, char*argv[]) |
| 3229 | { |
| 3230 | if(chflags(argv[0], 0) != 0) |
| 3231 | return 1; |
| 3232 | return 0; |
| 3233 | } |
Ned Deily | 43e1054 | 2011-06-27 23:41:53 -0700 | [diff] [blame] | 3234 | ]])], |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3235 | [ac_cv_have_chflags=yes], |
| 3236 | [ac_cv_have_chflags=no], |
| 3237 | [ac_cv_have_chflags=cross]) |
Gregory P. Smith | bb21389 | 2009-11-02 01:37:37 +0000 | [diff] [blame] | 3238 | ]) |
| 3239 | if test "$ac_cv_have_chflags" = cross ; then |
| 3240 | AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"]) |
| 3241 | fi |
| 3242 | if test "$ac_cv_have_chflags" = yes ; then |
Ned Deily | 43e1054 | 2011-06-27 23:41:53 -0700 | [diff] [blame] | 3243 | 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] | 3244 | fi |
Martin v. Löwis | a51d5c8 | 2007-12-04 08:37:59 +0000 | [diff] [blame] | 3245 | |
Gregory P. Smith | bb21389 | 2009-11-02 01:37:37 +0000 | [diff] [blame] | 3246 | AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [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(lchflags(argv[0], 0) != 0) |
| 3253 | return 1; |
| 3254 | return 0; |
| 3255 | } |
Ned Deily | 43e1054 | 2011-06-27 23:41:53 -0700 | [diff] [blame] | 3256 | ]])],[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] | 3257 | ]) |
| 3258 | if test "$ac_cv_have_lchflags" = cross ; then |
| 3259 | AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"]) |
| 3260 | fi |
| 3261 | if test "$ac_cv_have_lchflags" = yes ; then |
Ned Deily | 43e1054 | 2011-06-27 23:41:53 -0700 | [diff] [blame] | 3262 | 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] | 3263 | fi |
Martin v. Löwis | a51d5c8 | 2007-12-04 08:37:59 +0000 | [diff] [blame] | 3264 | |
Neal Norwitz | 6e73aaa | 2006-06-12 03:33:09 +0000 | [diff] [blame] | 3265 | dnl Check if system zlib has *Copy() functions |
Ronald Oussoren | f875264 | 2006-07-06 10:13:35 +0000 | [diff] [blame] | 3266 | dnl |
| 3267 | dnl On MacOSX the linker will search for dylibs on the entire linker path |
| 3268 | dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first |
| 3269 | dnl to revert to a more traditional unix behaviour and make it possible to |
| 3270 | dnl override the system libz with a local static library of libz. Temporarily |
| 3271 | dnl add that flag to our CFLAGS as well to ensure that we check the version |
| 3272 | dnl of libz that will be used by setup.py. |
| 3273 | dnl The -L/usr/local/lib is needed as wel to get the same compilation |
| 3274 | dnl environment as setup.py (and leaving it out can cause configure to use the |
| 3275 | dnl wrong version of the library) |
| 3276 | case $ac_sys_system/$ac_sys_release in |
| 3277 | Darwin/*) |
| 3278 | _CUR_CFLAGS="${CFLAGS}" |
| 3279 | _CUR_LDFLAGS="${LDFLAGS}" |
| 3280 | CFLAGS="${CFLAGS} -Wl,-search_paths_first" |
| 3281 | LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib" |
| 3282 | ;; |
| 3283 | esac |
| 3284 | |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 3285 | 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] | 3286 | |
Ronald Oussoren | f875264 | 2006-07-06 10:13:35 +0000 | [diff] [blame] | 3287 | case $ac_sys_system/$ac_sys_release in |
| 3288 | Darwin/*) |
| 3289 | CFLAGS="${_CUR_CFLAGS}" |
| 3290 | LDFLAGS="${_CUR_LDFLAGS}" |
| 3291 | ;; |
| 3292 | esac |
| 3293 | |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3294 | AC_MSG_CHECKING(for hstrerror) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3295 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3296 | #include <netdb.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3297 | ]], [[void* p = hstrerror; hstrerror(0)]])], |
| 3298 | [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.) |
| 3299 | AC_MSG_RESULT(yes)], |
| 3300 | [AC_MSG_RESULT(no) |
| 3301 | ]) |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3302 | |
| 3303 | AC_MSG_CHECKING(for inet_aton) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3304 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | 86d6626 | 2006-02-17 08:40:11 +0000 | [diff] [blame] | 3305 | #include <sys/types.h> |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3306 | #include <sys/socket.h> |
| 3307 | #include <netinet/in.h> |
| 3308 | #include <arpa/inet.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3309 | ]], [[void* p = inet_aton;inet_aton(0,0)]])], |
| 3310 | [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.) |
| 3311 | AC_MSG_RESULT(yes)], |
| 3312 | [AC_MSG_RESULT(no) |
| 3313 | ]) |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3314 | |
| 3315 | AC_MSG_CHECKING(for inet_pton) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3316 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | f2e488d | 2003-05-05 22:00:11 +0000 | [diff] [blame] | 3317 | #include <sys/types.h> |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3318 | #include <sys/socket.h> |
| 3319 | #include <netinet/in.h> |
| 3320 | #include <arpa/inet.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3321 | ]], [[void* p = inet_pton]])], |
| 3322 | [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.) |
| 3323 | AC_MSG_RESULT(yes)], |
| 3324 | [AC_MSG_RESULT(no) |
| 3325 | ]) |
Martin v. Löwis | e941617 | 2003-05-03 10:12:45 +0000 | [diff] [blame] | 3326 | |
Martin v. Löwis | d6640d4 | 2003-07-06 09:29:52 +0000 | [diff] [blame] | 3327 | # 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] | 3328 | AC_MSG_CHECKING(for setgroups) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3329 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | f2e488d | 2003-05-05 22:00:11 +0000 | [diff] [blame] | 3330 | #include <unistd.h> |
Martin v. Löwis | d6640d4 | 2003-07-06 09:29:52 +0000 | [diff] [blame] | 3331 | #ifdef HAVE_GRP_H |
| 3332 | #include <grp.h> |
| 3333 | #endif |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3334 | ]], [[void* p = setgroups]])], |
| 3335 | [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.) |
| 3336 | AC_MSG_RESULT(yes)], |
| 3337 | [AC_MSG_RESULT(no) |
| 3338 | ]) |
Martin v. Löwis | d584368 | 2002-11-21 20:41:28 +0000 | [diff] [blame] | 3339 | |
Fred Drake | 8cef4cf | 2000-06-28 16:40:38 +0000 | [diff] [blame] | 3340 | # check for openpty and forkpty |
| 3341 | |
Martin v. Löwis | fd9a72a | 2006-01-08 10:07:33 +0000 | [diff] [blame] | 3342 | AC_CHECK_FUNCS(openpty,, |
| 3343 | AC_CHECK_LIB(util,openpty, |
| 3344 | [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"], |
| 3345 | AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"]) |
| 3346 | ) |
| 3347 | ) |
| 3348 | AC_CHECK_FUNCS(forkpty,, |
| 3349 | AC_CHECK_LIB(util,forkpty, |
| 3350 | [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"], |
| 3351 | AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"]) |
| 3352 | ) |
| 3353 | ) |
Fred Drake | 8cef4cf | 2000-06-28 16:40:38 +0000 | [diff] [blame] | 3354 | |
Brett Cannon | aa5778d | 2008-03-18 04:09:00 +0000 | [diff] [blame] | 3355 | # Stuff for expat. |
| 3356 | AC_CHECK_FUNCS(memmove) |
| 3357 | |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 3358 | # check for long file support functions |
| 3359 | AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs) |
| 3360 | |
Brett Cannon | aa5778d | 2008-03-18 04:09:00 +0000 | [diff] [blame] | 3361 | AC_REPLACE_FUNCS(dup2 getcwd strdup) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3362 | AC_CHECK_FUNCS(getpgrp, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3363 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])], |
| 3364 | [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])], |
| 3365 | []) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3366 | ) |
Jack Jansen | 150753c | 2003-03-29 22:07:47 +0000 | [diff] [blame] | 3367 | AC_CHECK_FUNCS(setpgrp, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3368 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])], |
| 3369 | [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])], |
| 3370 | []) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3371 | ) |
| 3372 | AC_CHECK_FUNCS(gettimeofday, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3373 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]], |
| 3374 | [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])], |
| 3375 | [], |
| 3376 | [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1, |
| 3377 | [Define if gettimeofday() does not have second (timezone) argument |
| 3378 | This is the case on Motorola V4 (R40V4.2)]) |
| 3379 | ]) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3380 | ) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3381 | |
Martin v. Löwis | dbe3f76 | 2002-10-10 14:27:30 +0000 | [diff] [blame] | 3382 | AC_MSG_CHECKING(for major, minor, and makedev) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3383 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Neal Norwitz | 6eb37f0 | 2003-02-23 23:28:15 +0000 | [diff] [blame] | 3384 | #if defined(MAJOR_IN_MKDEV) |
| 3385 | #include <sys/mkdev.h> |
| 3386 | #elif defined(MAJOR_IN_SYSMACROS) |
| 3387 | #include <sys/sysmacros.h> |
| 3388 | #else |
| 3389 | #include <sys/types.h> |
| 3390 | #endif |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3391 | ]], [[ |
Martin v. Löwis | dbe3f76 | 2002-10-10 14:27:30 +0000 | [diff] [blame] | 3392 | makedev(major(0),minor(0)); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3393 | ]])],[ |
Martin v. Löwis | dbe3f76 | 2002-10-10 14:27:30 +0000 | [diff] [blame] | 3394 | AC_DEFINE(HAVE_DEVICE_MACROS, 1, |
| 3395 | [Define to 1 if you have the device macros.]) |
| 3396 | AC_MSG_RESULT(yes) |
| 3397 | ],[ |
| 3398 | AC_MSG_RESULT(no) |
| 3399 | ]) |
Martin v. Löwis | 861a65b | 2001-10-24 14:36:00 +0000 | [diff] [blame] | 3400 | |
| 3401 | # On OSF/1 V5.1, getaddrinfo is available, but a define |
| 3402 | # for [no]getaddrinfo in netdb.h. |
| 3403 | AC_MSG_CHECKING(for getaddrinfo) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3404 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | c010b6d | 2001-11-09 17:50:52 +0000 | [diff] [blame] | 3405 | #include <sys/types.h> |
Martin v. Löwis | 861a65b | 2001-10-24 14:36:00 +0000 | [diff] [blame] | 3406 | #include <sys/socket.h> |
| 3407 | #include <netdb.h> |
Martin v. Löwis | c010b6d | 2001-11-09 17:50:52 +0000 | [diff] [blame] | 3408 | #include <stdio.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3409 | ]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], |
| 3410 | [have_getaddrinfo=yes], |
| 3411 | [have_getaddrinfo=no]) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3412 | AC_MSG_RESULT($have_getaddrinfo) |
| 3413 | if test $have_getaddrinfo = yes |
| 3414 | then |
| 3415 | AC_MSG_CHECKING(getaddrinfo bug) |
| 3416 | AC_CACHE_VAL(ac_cv_buggy_getaddrinfo, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3417 | AC_RUN_IFELSE([AC_LANG_SOURCE([[[ |
Stefan Krah | 0afe4e4 | 2012-11-22 23:56:51 +0100 | [diff] [blame] | 3418 | #include <stdio.h> |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3419 | #include <sys/types.h> |
| 3420 | #include <netdb.h> |
| 3421 | #include <string.h> |
| 3422 | #include <sys/socket.h> |
| 3423 | #include <netinet/in.h> |
| 3424 | |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3425 | int main() |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3426 | { |
| 3427 | int passive, gaierr, inet4 = 0, inet6 = 0; |
| 3428 | struct addrinfo hints, *ai, *aitop; |
| 3429 | char straddr[INET6_ADDRSTRLEN], strport[16]; |
| 3430 | |
| 3431 | for (passive = 0; passive <= 1; passive++) { |
| 3432 | memset(&hints, 0, sizeof(hints)); |
| 3433 | hints.ai_family = AF_UNSPEC; |
| 3434 | hints.ai_flags = passive ? AI_PASSIVE : 0; |
| 3435 | hints.ai_socktype = SOCK_STREAM; |
Hye-Shik Chang | 54f9439 | 2004-04-14 07:55:31 +0000 | [diff] [blame] | 3436 | hints.ai_protocol = IPPROTO_TCP; |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3437 | if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) { |
| 3438 | (void)gai_strerror(gaierr); |
| 3439 | goto bad; |
| 3440 | } |
| 3441 | for (ai = aitop; ai; ai = ai->ai_next) { |
| 3442 | if (ai->ai_addr == NULL || |
| 3443 | ai->ai_addrlen == 0 || |
| 3444 | getnameinfo(ai->ai_addr, ai->ai_addrlen, |
| 3445 | straddr, sizeof(straddr), strport, sizeof(strport), |
| 3446 | NI_NUMERICHOST|NI_NUMERICSERV) != 0) { |
| 3447 | goto bad; |
| 3448 | } |
| 3449 | switch (ai->ai_family) { |
| 3450 | case AF_INET: |
| 3451 | if (strcmp(strport, "54321") != 0) { |
| 3452 | goto bad; |
| 3453 | } |
| 3454 | if (passive) { |
| 3455 | if (strcmp(straddr, "0.0.0.0") != 0) { |
| 3456 | goto bad; |
| 3457 | } |
| 3458 | } else { |
| 3459 | if (strcmp(straddr, "127.0.0.1") != 0) { |
| 3460 | goto bad; |
| 3461 | } |
| 3462 | } |
| 3463 | inet4++; |
| 3464 | break; |
| 3465 | case AF_INET6: |
| 3466 | if (strcmp(strport, "54321") != 0) { |
| 3467 | goto bad; |
| 3468 | } |
| 3469 | if (passive) { |
| 3470 | if (strcmp(straddr, "::") != 0) { |
| 3471 | goto bad; |
| 3472 | } |
| 3473 | } else { |
| 3474 | if (strcmp(straddr, "::1") != 0) { |
| 3475 | goto bad; |
| 3476 | } |
| 3477 | } |
| 3478 | inet6++; |
| 3479 | break; |
| 3480 | case AF_UNSPEC: |
| 3481 | goto bad; |
| 3482 | break; |
| 3483 | default: |
| 3484 | /* another family support? */ |
| 3485 | break; |
| 3486 | } |
| 3487 | } |
Benjamin Peterson | d34677c | 2016-09-06 15:54:24 -0700 | [diff] [blame] | 3488 | freeaddrinfo(aitop); |
| 3489 | aitop = NULL; |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3490 | } |
| 3491 | |
| 3492 | if (!(inet4 == 0 || inet4 == 2)) |
| 3493 | goto bad; |
| 3494 | if (!(inet6 == 0 || inet6 == 2)) |
| 3495 | goto bad; |
| 3496 | |
| 3497 | if (aitop) |
| 3498 | freeaddrinfo(aitop); |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3499 | return 0; |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3500 | |
| 3501 | bad: |
| 3502 | if (aitop) |
| 3503 | freeaddrinfo(aitop); |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3504 | return 1; |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3505 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3506 | ]]])], |
| 3507 | [ac_cv_buggy_getaddrinfo=no], |
| 3508 | [ac_cv_buggy_getaddrinfo=yes], |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 3509 | [ |
| 3510 | if test "${enable_ipv6+set}" = set; then |
| 3511 | ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6" |
| 3512 | else |
| 3513 | ac_cv_buggy_getaddrinfo=yes |
| 3514 | fi])) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3515 | fi |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3516 | |
Benjamin Peterson | 75fed81 | 2010-11-01 01:47:19 +0000 | [diff] [blame] | 3517 | AC_MSG_RESULT($ac_cv_buggy_getaddrinfo) |
| 3518 | |
Mark Dickinson | 0ef0b91 | 2009-12-31 21:11:48 +0000 | [diff] [blame] | 3519 | if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 3520 | then |
| 3521 | if test $ipv6 = yes |
| 3522 | then |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3523 | echo 'Fatal: You must get working getaddrinfo() function.' |
| 3524 | echo ' or you can specify "--disable-ipv6"'. |
| 3525 | exit 1 |
| 3526 | fi |
Martin v. Löwis | 861a65b | 2001-10-24 14:36:00 +0000 | [diff] [blame] | 3527 | else |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3528 | 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] | 3529 | fi |
Benjamin Peterson | 75fed81 | 2010-11-01 01:47:19 +0000 | [diff] [blame] | 3530 | |
Thomas Wouters | b0db85a | 2001-08-08 10:39:03 +0000 | [diff] [blame] | 3531 | AC_CHECK_FUNCS(getnameinfo) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3532 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3533 | # checks for structures |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3534 | AC_HEADER_TIME |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3535 | AC_STRUCT_TM |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3536 | AC_STRUCT_TIMEZONE |
Martin v. Löwis | 60a5d72 | 2002-10-16 20:28:25 +0000 | [diff] [blame] | 3537 | AC_CHECK_MEMBERS([struct stat.st_rdev]) |
| 3538 | AC_CHECK_MEMBERS([struct stat.st_blksize]) |
Hye-Shik Chang | 5f937a7 | 2005-06-02 13:09:30 +0000 | [diff] [blame] | 3539 | AC_CHECK_MEMBERS([struct stat.st_flags]) |
Martin v. Löwis | ebd9d5b | 2005-08-09 15:00:59 +0000 | [diff] [blame] | 3540 | AC_CHECK_MEMBERS([struct stat.st_gen]) |
| 3541 | AC_CHECK_MEMBERS([struct stat.st_birthtime]) |
Martin Panter | a45120d | 2016-03-18 02:36:41 +0000 | [diff] [blame] | 3542 | AC_CHECK_MEMBERS([struct stat.st_blocks]) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3543 | |
| 3544 | AC_MSG_CHECKING(for time.h that defines altzone) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3545 | AC_CACHE_VAL(ac_cv_header_time_altzone,[ |
| 3546 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])], |
| 3547 | [ac_cv_header_time_altzone=yes], |
| 3548 | [ac_cv_header_time_altzone=no]) |
| 3549 | ]) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3550 | AC_MSG_RESULT($ac_cv_header_time_altzone) |
| 3551 | if test $ac_cv_header_time_altzone = yes; then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3552 | 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] | 3553 | fi |
| 3554 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3555 | was_it_defined=no |
| 3556 | 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] | 3557 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3558 | #include <sys/types.h> |
| 3559 | #include <sys/select.h> |
| 3560 | #include <sys/time.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3561 | ]], [[;]])],[ |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3562 | AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1, |
| 3563 | [Define if you can safely include both <sys/select.h> and <sys/time.h> |
| 3564 | (which you can't on SCO ODT 3.0).]) |
| 3565 | was_it_defined=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3566 | ],[]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3567 | AC_MSG_RESULT($was_it_defined) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3568 | |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3569 | AC_MSG_CHECKING(for addrinfo) |
| 3570 | AC_CACHE_VAL(ac_cv_struct_addrinfo, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3571 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])], |
| 3572 | [ac_cv_struct_addrinfo=yes], |
| 3573 | [ac_cv_struct_addrinfo=no])) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3574 | AC_MSG_RESULT($ac_cv_struct_addrinfo) |
| 3575 | if test $ac_cv_struct_addrinfo = yes; then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3576 | AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)]) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3577 | fi |
| 3578 | |
| 3579 | AC_MSG_CHECKING(for sockaddr_storage) |
| 3580 | AC_CACHE_VAL(ac_cv_struct_sockaddr_storage, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3581 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3582 | # include <sys/types.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3583 | # include <sys/socket.h>]], [[struct sockaddr_storage s]])], |
| 3584 | [ac_cv_struct_sockaddr_storage=yes], |
| 3585 | [ac_cv_struct_sockaddr_storage=no])) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3586 | AC_MSG_RESULT($ac_cv_struct_sockaddr_storage) |
| 3587 | if test $ac_cv_struct_sockaddr_storage = yes; then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3588 | 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] | 3589 | fi |
| 3590 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3591 | # checks for compiler characteristics |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3592 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3593 | AC_C_CHAR_UNSIGNED |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3594 | AC_C_CONST |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3595 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3596 | works=no |
| 3597 | AC_MSG_CHECKING(for working volatile) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3598 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])], |
| 3599 | [works=yes], |
| 3600 | [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] | 3601 | ) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3602 | AC_MSG_RESULT($works) |
Guido van Rossum | dabb11b | 1994-10-11 15:04:27 +0000 | [diff] [blame] | 3603 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3604 | works=no |
| 3605 | AC_MSG_CHECKING(for working signed char) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3606 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])], |
| 3607 | [works=yes], |
| 3608 | [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] | 3609 | ) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3610 | AC_MSG_RESULT($works) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3611 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3612 | have_prototypes=no |
| 3613 | AC_MSG_CHECKING(for prototypes) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3614 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])], |
| 3615 | [AC_DEFINE(HAVE_PROTOTYPES, 1, |
| 3616 | [Define if your compiler supports function prototype]) |
| 3617 | have_prototypes=yes], |
| 3618 | [] |
| 3619 | ) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3620 | AC_MSG_RESULT($have_prototypes) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3621 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3622 | works=no |
| 3623 | AC_MSG_CHECKING(for variable length prototypes and stdarg.h) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3624 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3625 | #include <stdarg.h> |
Guido van Rossum | 3f13e48 | 1996-08-30 20:58:11 +0000 | [diff] [blame] | 3626 | int foo(int x, ...) { |
| 3627 | va_list va; |
| 3628 | va_start(va, x); |
| 3629 | va_arg(va, int); |
| 3630 | va_arg(va, char *); |
| 3631 | va_arg(va, double); |
| 3632 | return 0; |
| 3633 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3634 | ]], [[return foo(10, "", 3.14);]])],[ |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3635 | AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1, |
| 3636 | [Define if your compiler supports variable length function prototypes |
| 3637 | (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>]) |
| 3638 | works=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3639 | ],[]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3640 | AC_MSG_RESULT($works) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3641 | |
Dave Cole | 331708b | 2004-08-09 04:51:41 +0000 | [diff] [blame] | 3642 | # check for socketpair |
| 3643 | AC_MSG_CHECKING(for socketpair) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3644 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Dave Cole | 331708b | 2004-08-09 04:51:41 +0000 | [diff] [blame] | 3645 | #include <sys/types.h> |
| 3646 | #include <sys/socket.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3647 | ]], [[void *x=socketpair]])], |
| 3648 | [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.]) |
| 3649 | AC_MSG_RESULT(yes)], |
| 3650 | [AC_MSG_RESULT(no)] |
Dave Cole | 331708b | 2004-08-09 04:51:41 +0000 | [diff] [blame] | 3651 | ) |
| 3652 | |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3653 | # check if sockaddr has sa_len member |
| 3654 | AC_MSG_CHECKING(if sockaddr has sa_len member) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3655 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
| 3656 | #include <sys/socket.h>]], [[struct sockaddr x; |
| 3657 | x.sa_len = 0;]])], |
| 3658 | [AC_MSG_RESULT(yes) |
| 3659 | AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])], |
| 3660 | [AC_MSG_RESULT(no)] |
| 3661 | ) |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 3662 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3663 | va_list_is_array=no |
| 3664 | AC_MSG_CHECKING(whether va_list is an array) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3665 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3666 | #ifdef HAVE_STDARG_PROTOTYPES |
| 3667 | #include <stdarg.h> |
| 3668 | #else |
| 3669 | #include <varargs.h> |
| 3670 | #endif |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3671 | ]], [[va_list list1, list2; list1 = list2;]])],[],[ |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3672 | AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind]) |
| 3673 | va_list_is_array=yes |
| 3674 | ]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 3675 | AC_MSG_RESULT($va_list_is_array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3676 | |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3677 | # 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] | 3678 | AH_TEMPLATE(HAVE_GETHOSTBYNAME_R, |
| 3679 | [Define this if you have some version of gethostbyname_r()]) |
| 3680 | |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3681 | AC_CHECK_FUNC(gethostbyname_r, [ |
| 3682 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
| 3683 | AC_MSG_CHECKING([gethostbyname_r with 6 args]) |
| 3684 | OLD_CFLAGS=$CFLAGS |
| 3685 | CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3686 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3687 | # include <netdb.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3688 | ]], [[ |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3689 | char *name; |
| 3690 | struct hostent *he, *res; |
| 3691 | char buffer[2048]; |
| 3692 | int buflen = 2048; |
| 3693 | int h_errnop; |
| 3694 | |
| 3695 | (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3696 | ]])],[ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 3697 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3698 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1, |
| 3699 | [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] | 3700 | AC_MSG_RESULT(yes) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3701 | ],[ |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3702 | AC_MSG_RESULT(no) |
| 3703 | AC_MSG_CHECKING([gethostbyname_r with 5 args]) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3704 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3705 | # include <netdb.h> |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3706 | ]], [[ |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3707 | char *name; |
| 3708 | struct hostent *he; |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3709 | char buffer[2048]; |
| 3710 | int buflen = 2048; |
| 3711 | int h_errnop; |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3712 | |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3713 | (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop) |
| 3714 | ]])], |
| 3715 | [ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 3716 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3717 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1, |
| 3718 | [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] | 3719 | AC_MSG_RESULT(yes) |
| 3720 | ], [ |
| 3721 | AC_MSG_RESULT(no) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3722 | AC_MSG_CHECKING([gethostbyname_r with 3 args]) |
| 3723 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 3724 | # include <netdb.h> |
| 3725 | ]], [[ |
| 3726 | char *name; |
| 3727 | struct hostent *he; |
| 3728 | struct hostent_data data; |
| 3729 | |
| 3730 | (void) gethostbyname_r(name, he, &data); |
| 3731 | ]])], |
| 3732 | [ |
| 3733 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
| 3734 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1, |
| 3735 | [Define this if you have the 3-arg version of gethostbyname_r().]) |
| 3736 | AC_MSG_RESULT(yes) |
| 3737 | ], [ |
| 3738 | AC_MSG_RESULT(no) |
| 3739 | ]) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3740 | ]) |
| 3741 | ]) |
| 3742 | CFLAGS=$OLD_CFLAGS |
| 3743 | ], [ |
Thomas Wouters | 3a58420 | 2000-08-05 23:28:51 +0000 | [diff] [blame] | 3744 | AC_CHECK_FUNCS(gethostbyname) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3745 | ]) |
| 3746 | AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG) |
| 3747 | AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG) |
| 3748 | AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG) |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 3749 | AC_SUBST(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 3750 | AC_SUBST(HAVE_GETHOSTBYNAME) |
| 3751 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3752 | # checks for system services |
| 3753 | # (none yet) |
| 3754 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 3755 | # Linux requires this for correct f.p. operations |
Jeremy Hylton | be28f5b | 2000-07-27 21:03:04 +0000 | [diff] [blame] | 3756 | AC_CHECK_FUNC(__fpu_control, |
| 3757 | [], |
| 3758 | [AC_CHECK_LIB(ieee, __fpu_control) |
| 3759 | ]) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 3760 | |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3761 | # Check for --with-fpectl |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3762 | AC_MSG_CHECKING(for --with-fpectl) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 3763 | AC_ARG_WITH(fpectl, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3764 | AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3765 | [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3766 | if test "$withval" != no |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 3767 | then |
| 3768 | AC_DEFINE(WANT_SIGFPE_HANDLER, 1, |
| 3769 | [Define if you want SIGFPE handled (see Include/pyfpe.h).]) |
| 3770 | AC_MSG_RESULT(yes) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3771 | else AC_MSG_RESULT(no) |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 3772 | fi], |
| 3773 | [AC_MSG_RESULT(no)]) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3774 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3775 | # check for --with-libm=... |
| 3776 | AC_SUBST(LIBM) |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 3777 | case $ac_sys_system in |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 3778 | Darwin) ;; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 3779 | BeOS) ;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 3780 | *) LIBM=-lm |
| 3781 | esac |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3782 | AC_MSG_CHECKING(for --with-libm=STRING) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3783 | AC_ARG_WITH(libm, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3784 | AS_HELP_STRING([--with-libm=STRING], [math library]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3785 | [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3786 | if test "$withval" = no |
| 3787 | then LIBM= |
| 3788 | AC_MSG_RESULT(force LIBM empty) |
| 3789 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3790 | then LIBM=$withval |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3791 | AC_MSG_RESULT(set LIBM="$withval") |
| 3792 | else AC_MSG_ERROR([proper usage is --with-libm=STRING]) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3793 | fi], |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3794 | [AC_MSG_RESULT(default LIBM="$LIBM")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3795 | |
| 3796 | # check for --with-libc=... |
| 3797 | AC_SUBST(LIBC) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3798 | AC_MSG_CHECKING(for --with-libc=STRING) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3799 | AC_ARG_WITH(libc, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 3800 | AS_HELP_STRING([--with-libc=STRING], [C library]), |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3801 | [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3802 | if test "$withval" = no |
| 3803 | then LIBC= |
| 3804 | AC_MSG_RESULT(force LIBC empty) |
| 3805 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3806 | then LIBC=$withval |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3807 | AC_MSG_RESULT(set LIBC="$withval") |
| 3808 | else AC_MSG_ERROR([proper usage is --with-libc=STRING]) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 3809 | fi], |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 3810 | [AC_MSG_RESULT(default LIBC="$LIBC")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 3811 | |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3812 | # ************************************************** |
| 3813 | # * Check for various properties of floating point * |
| 3814 | # ************************************************** |
Mark Dickinson | 265d738 | 2008-04-21 22:32:24 +0000 | [diff] [blame] | 3815 | |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3816 | AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64) |
| 3817 | AC_CACHE_VAL(ac_cv_little_endian_double, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3818 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3819 | #include <string.h> |
| 3820 | int main() { |
| 3821 | double x = 9006104071832581.0; |
| 3822 | if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0) |
| 3823 | return 0; |
| 3824 | else |
| 3825 | return 1; |
| 3826 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3827 | ]])], |
| 3828 | [ac_cv_little_endian_double=yes], |
| 3829 | [ac_cv_little_endian_double=no], |
| 3830 | [ac_cv_little_endian_double=no])]) |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3831 | AC_MSG_RESULT($ac_cv_little_endian_double) |
| 3832 | if test "$ac_cv_little_endian_double" = yes |
| 3833 | then |
| 3834 | AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1, |
| 3835 | [Define if C doubles are 64-bit IEEE 754 binary format, stored |
| 3836 | with the least significant byte first]) |
| 3837 | fi |
| 3838 | |
| 3839 | AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64) |
| 3840 | AC_CACHE_VAL(ac_cv_big_endian_double, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3841 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3842 | #include <string.h> |
| 3843 | int main() { |
| 3844 | double x = 9006104071832581.0; |
| 3845 | if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0) |
| 3846 | return 0; |
| 3847 | else |
| 3848 | return 1; |
| 3849 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3850 | ]])], |
| 3851 | [ac_cv_big_endian_double=yes], |
| 3852 | [ac_cv_big_endian_double=no], |
| 3853 | [ac_cv_big_endian_double=no])]) |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3854 | AC_MSG_RESULT($ac_cv_big_endian_double) |
| 3855 | if test "$ac_cv_big_endian_double" = yes |
| 3856 | then |
| 3857 | AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1, |
| 3858 | [Define if C doubles are 64-bit IEEE 754 binary format, stored |
| 3859 | with the most significant byte first]) |
| 3860 | fi |
| 3861 | |
| 3862 | # Some ARM platforms use a mixed-endian representation for doubles. |
| 3863 | # While Python doesn't currently have full support for these platforms |
| 3864 | # (see e.g., issue 1762561), we can at least make sure that float <-> string |
| 3865 | # conversions work. |
| 3866 | AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64) |
| 3867 | AC_CACHE_VAL(ac_cv_mixed_endian_double, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3868 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3869 | #include <string.h> |
| 3870 | int main() { |
| 3871 | double x = 9006104071832581.0; |
| 3872 | if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0) |
| 3873 | return 0; |
| 3874 | else |
| 3875 | return 1; |
| 3876 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3877 | ]])], |
| 3878 | [ac_cv_mixed_endian_double=yes], |
| 3879 | [ac_cv_mixed_endian_double=no], |
| 3880 | [ac_cv_mixed_endian_double=no])]) |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3881 | AC_MSG_RESULT($ac_cv_mixed_endian_double) |
| 3882 | if test "$ac_cv_mixed_endian_double" = yes |
| 3883 | then |
| 3884 | AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1, |
| 3885 | [Define if C doubles are 64-bit IEEE 754 binary format, stored |
| 3886 | in ARM mixed-endian order (byte order 45670123)]) |
| 3887 | fi |
| 3888 | |
| 3889 | # The short float repr introduced in Python 3.1 requires the |
| 3890 | # correctly-rounded string <-> double conversion functions from |
| 3891 | # Python/dtoa.c, which in turn require that the FPU uses 53-bit |
| 3892 | # 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] | 3893 | # 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] | 3894 | # using inline assembler to get and set the x87 FPU control word. |
Mark Dickinson | a548dee | 2009-11-15 13:12:43 +0000 | [diff] [blame] | 3895 | |
| 3896 | # This inline assembler syntax may also work for suncc and icc, |
| 3897 | # so we try it on all platforms. |
| 3898 | |
| 3899 | 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] | 3900 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ |
Mark Dickinson | a548dee | 2009-11-15 13:12:43 +0000 | [diff] [blame] | 3901 | unsigned short cw; |
| 3902 | __asm__ __volatile__ ("fnstcw %0" : "=m" (cw)); |
| 3903 | __asm__ __volatile__ ("fldcw %0" : : "m" (cw)); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3904 | ]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no]) |
Mark Dickinson | a548dee | 2009-11-15 13:12:43 +0000 | [diff] [blame] | 3905 | AC_MSG_RESULT($have_gcc_asm_for_x87) |
| 3906 | if test "$have_gcc_asm_for_x87" = yes |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3907 | then |
Mark Dickinson | a548dee | 2009-11-15 13:12:43 +0000 | [diff] [blame] | 3908 | AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1, |
| 3909 | [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] | 3910 | fi |
Mark Dickinson | 7a3d864 | 2008-04-22 00:54:27 +0000 | [diff] [blame] | 3911 | |
Mark Dickinson | 04b2723 | 2009-01-04 12:29:36 +0000 | [diff] [blame] | 3912 | # Detect whether system arithmetic is subject to x87-style double |
| 3913 | # rounding issues. The result of this test has little meaning on non |
| 3914 | # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding |
| 3915 | # mode is round-to-nearest and double rounding issues are present, and |
| 3916 | # 0 otherwise. See http://bugs.python.org/issue2937 for more info. |
| 3917 | AC_MSG_CHECKING(for x87-style double rounding) |
Mark Dickinson | 99abd14 | 2009-10-24 13:44:16 +0000 | [diff] [blame] | 3918 | # $BASECFLAGS may affect the result |
| 3919 | ac_save_cc="$CC" |
| 3920 | CC="$CC $BASECFLAGS" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3921 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | 04b2723 | 2009-01-04 12:29:36 +0000 | [diff] [blame] | 3922 | #include <stdlib.h> |
| 3923 | #include <math.h> |
| 3924 | int main() { |
| 3925 | volatile double x, y, z; |
| 3926 | /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */ |
| 3927 | x = 0.99999999999999989; /* 1-2**-53 */ |
| 3928 | y = 1./x; |
| 3929 | if (y != 1.) |
| 3930 | exit(0); |
| 3931 | /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */ |
| 3932 | x = 1e16; |
| 3933 | y = 2.99999; |
| 3934 | z = x + y; |
| 3935 | if (z != 1e16+4.) |
| 3936 | exit(0); |
| 3937 | /* both tests show evidence of double rounding */ |
| 3938 | exit(1); |
| 3939 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3940 | ]])], |
| 3941 | [ac_cv_x87_double_rounding=no], |
| 3942 | [ac_cv_x87_double_rounding=yes], |
| 3943 | [ac_cv_x87_double_rounding=no]) |
Mark Dickinson | 99abd14 | 2009-10-24 13:44:16 +0000 | [diff] [blame] | 3944 | CC="$ac_save_cc" |
Mark Dickinson | 04b2723 | 2009-01-04 12:29:36 +0000 | [diff] [blame] | 3945 | AC_MSG_RESULT($ac_cv_x87_double_rounding) |
| 3946 | if test "$ac_cv_x87_double_rounding" = yes |
| 3947 | then |
| 3948 | AC_DEFINE(X87_DOUBLE_ROUNDING, 1, |
| 3949 | [Define if arithmetic is subject to x87-style double rounding issue]) |
| 3950 | fi |
| 3951 | |
Mark Dickinson | 1d6e2e1 | 2009-10-24 13:28:38 +0000 | [diff] [blame] | 3952 | # ************************************ |
| 3953 | # * Check for mathematical functions * |
| 3954 | # ************************************ |
| 3955 | |
| 3956 | LIBS_SAVE=$LIBS |
| 3957 | LIBS="$LIBS $LIBM" |
| 3958 | |
Mark Dickinson | c63392c | 2009-11-28 13:13:13 +0000 | [diff] [blame] | 3959 | # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of |
| 3960 | # -0. on some architectures. |
| 3961 | AC_MSG_CHECKING(whether tanh preserves the sign of zero) |
| 3962 | AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3963 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | c63392c | 2009-11-28 13:13:13 +0000 | [diff] [blame] | 3964 | #include <math.h> |
| 3965 | #include <stdlib.h> |
| 3966 | int main() { |
| 3967 | /* return 0 if either negative zeros don't exist |
| 3968 | on this platform or if negative zeros exist |
| 3969 | and tanh(-0.) == -0. */ |
| 3970 | if (atan2(0., -1.) == atan2(-0., -1.) || |
| 3971 | atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0); |
| 3972 | else exit(1); |
| 3973 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3974 | ]])], |
| 3975 | [ac_cv_tanh_preserves_zero_sign=yes], |
| 3976 | [ac_cv_tanh_preserves_zero_sign=no], |
| 3977 | [ac_cv_tanh_preserves_zero_sign=no])]) |
Mark Dickinson | c63392c | 2009-11-28 13:13:13 +0000 | [diff] [blame] | 3978 | AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign) |
| 3979 | if test "$ac_cv_tanh_preserves_zero_sign" = yes |
| 3980 | then |
| 3981 | AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1, |
| 3982 | [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros]) |
| 3983 | fi |
| 3984 | |
| 3985 | AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma]) |
| 3986 | AC_CHECK_FUNCS([hypot lgamma log1p round tgamma]) |
| 3987 | AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]]) |
| 3988 | |
| 3989 | LIBS=$LIBS_SAVE |
| 3990 | |
Mark Dickinson | c4920e8 | 2009-11-20 19:30:22 +0000 | [diff] [blame] | 3991 | # For multiprocessing module, check that sem_open |
| 3992 | # actually works. For FreeBSD versions <= 7.2, |
| 3993 | # the kernel module that provides POSIX semaphores |
| 3994 | # isn't loaded by default, so an attempt to call |
| 3995 | # sem_open results in a 'Signal 12' error. |
| 3996 | AC_MSG_CHECKING(whether POSIX semaphores are enabled) |
| 3997 | AC_CACHE_VAL(ac_cv_posix_semaphores_enabled, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 3998 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Mark Dickinson | c4920e8 | 2009-11-20 19:30:22 +0000 | [diff] [blame] | 3999 | #include <unistd.h> |
| 4000 | #include <fcntl.h> |
| 4001 | #include <stdio.h> |
| 4002 | #include <semaphore.h> |
| 4003 | #include <sys/stat.h> |
| 4004 | |
| 4005 | int main(void) { |
| 4006 | sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0); |
| 4007 | if (a == SEM_FAILED) { |
| 4008 | perror("sem_open"); |
| 4009 | return 1; |
| 4010 | } |
| 4011 | sem_close(a); |
Mark Dickinson | 59dc89e | 2009-12-13 21:06:06 +0000 | [diff] [blame] | 4012 | sem_unlink("/autoconf"); |
Mark Dickinson | c4920e8 | 2009-11-20 19:30:22 +0000 | [diff] [blame] | 4013 | return 0; |
| 4014 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4015 | ]])], |
| 4016 | [ac_cv_posix_semaphores_enabled=yes], |
| 4017 | [ac_cv_posix_semaphores_enabled=no], |
| 4018 | [ac_cv_posix_semaphores_enabled=yes]) |
Mark Dickinson | c4920e8 | 2009-11-20 19:30:22 +0000 | [diff] [blame] | 4019 | ) |
| 4020 | AC_MSG_RESULT($ac_cv_posix_semaphores_enabled) |
| 4021 | if test $ac_cv_posix_semaphores_enabled = no |
| 4022 | then |
Mark Dickinson | 5afa6d4 | 2009-11-28 10:44:20 +0000 | [diff] [blame] | 4023 | AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1, |
| 4024 | [Define if POSIX semaphores aren't enabled on your system]) |
Mark Dickinson | c4920e8 | 2009-11-20 19:30:22 +0000 | [diff] [blame] | 4025 | fi |
| 4026 | |
Jesse Noller | 355b126 | 2009-04-02 00:03:28 +0000 | [diff] [blame] | 4027 | # Multiprocessing check for broken sem_getvalue |
| 4028 | AC_MSG_CHECKING(for broken sem_getvalue) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 4029 | AC_CACHE_VAL(ac_cv_broken_sem_getvalue, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4030 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Jesse Noller | 355b126 | 2009-04-02 00:03:28 +0000 | [diff] [blame] | 4031 | #include <unistd.h> |
| 4032 | #include <fcntl.h> |
| 4033 | #include <stdio.h> |
| 4034 | #include <semaphore.h> |
| 4035 | #include <sys/stat.h> |
| 4036 | |
| 4037 | int main(void){ |
Mark Dickinson | 59dc89e | 2009-12-13 21:06:06 +0000 | [diff] [blame] | 4038 | 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] | 4039 | int count; |
| 4040 | int res; |
| 4041 | if(a==SEM_FAILED){ |
| 4042 | perror("sem_open"); |
| 4043 | return 1; |
| 4044 | |
| 4045 | } |
| 4046 | res = sem_getvalue(a, &count); |
| 4047 | sem_close(a); |
Mark Dickinson | 59dc89e | 2009-12-13 21:06:06 +0000 | [diff] [blame] | 4048 | sem_unlink("/autocftw"); |
Jesse Noller | 355b126 | 2009-04-02 00:03:28 +0000 | [diff] [blame] | 4049 | return res==-1 ? 1 : 0; |
| 4050 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4051 | ]])], |
| 4052 | [ac_cv_broken_sem_getvalue=no], |
| 4053 | [ac_cv_broken_sem_getvalue=yes], |
| 4054 | [ac_cv_broken_sem_getvalue=yes]) |
Jesse Noller | 355b126 | 2009-04-02 00:03:28 +0000 | [diff] [blame] | 4055 | ) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 4056 | AC_MSG_RESULT($ac_cv_broken_sem_getvalue) |
| 4057 | if test $ac_cv_broken_sem_getvalue = yes |
| 4058 | then |
| 4059 | AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1, |
| 4060 | [define to 1 if your sem_getvalue is broken.]) |
| 4061 | fi |
Mark Dickinson | 04b2723 | 2009-01-04 12:29:36 +0000 | [diff] [blame] | 4062 | |
Mark Dickinson | efc82f7 | 2009-03-20 15:51:55 +0000 | [diff] [blame] | 4063 | # determine what size digit to use for Python's longs |
| 4064 | AC_MSG_CHECKING([digit size for Python's longs]) |
| 4065 | AC_ARG_ENABLE(big-digits, |
Matthias Klose | 22520ea | 2010-05-08 10:14:46 +0000 | [diff] [blame] | 4066 | 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] | 4067 | [case $enable_big_digits in |
| 4068 | yes) |
| 4069 | enable_big_digits=30 ;; |
| 4070 | no) |
| 4071 | enable_big_digits=15 ;; |
| 4072 | [15|30]) |
| 4073 | ;; |
| 4074 | *) |
| 4075 | AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;; |
| 4076 | esac |
| 4077 | AC_MSG_RESULT($enable_big_digits) |
| 4078 | AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits]) |
| 4079 | ], |
| 4080 | [AC_MSG_RESULT(no value specified)]) |
| 4081 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 4082 | # check for wchar.h |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4083 | AC_CHECK_HEADER(wchar.h, [ |
| 4084 | AC_DEFINE(HAVE_WCHAR_H, 1, |
| 4085 | [Define if the compiler provides a wchar.h header file.]) |
| 4086 | wchar_h="yes" |
| 4087 | ], |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 4088 | wchar_h="no" |
| 4089 | ) |
| 4090 | |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4091 | # determine wchar_t size |
| 4092 | if test "$wchar_h" = yes |
| 4093 | then |
Guido van Rossum | 67b2659 | 2001-10-20 14:21:45 +0000 | [diff] [blame] | 4094 | AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>]) |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4095 | fi |
| 4096 | |
Martin v. Löwis | fa3bdea | 2003-09-04 18:50:54 +0000 | [diff] [blame] | 4097 | AC_MSG_CHECKING(for UCS-4 tcl) |
| 4098 | have_ucs4_tcl=no |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4099 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
Martin v. Löwis | fa3bdea | 2003-09-04 18:50:54 +0000 | [diff] [blame] | 4100 | #include <tcl.h> |
| 4101 | #if TCL_UTF_MAX != 6 |
| 4102 | # error "NOT UCS4_TCL" |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4103 | #endif]], [[]])],[ |
Martin v. Löwis | fa3bdea | 2003-09-04 18:50:54 +0000 | [diff] [blame] | 4104 | AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6]) |
| 4105 | have_ucs4_tcl=yes |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4106 | ],[]) |
Martin v. Löwis | fa3bdea | 2003-09-04 18:50:54 +0000 | [diff] [blame] | 4107 | AC_MSG_RESULT($have_ucs4_tcl) |
| 4108 | |
Marc-André Lemburg | d7160f8 | 2003-09-22 11:14:40 +0000 | [diff] [blame] | 4109 | # check whether wchar_t is signed or not |
| 4110 | if test "$wchar_h" = yes |
| 4111 | then |
| 4112 | # check whether wchar_t is signed or not |
| 4113 | AC_MSG_CHECKING(whether wchar_t is signed) |
| 4114 | AC_CACHE_VAL(ac_cv_wchar_t_signed, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4115 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Marc-André Lemburg | d7160f8 | 2003-09-22 11:14:40 +0000 | [diff] [blame] | 4116 | #include <wchar.h> |
| 4117 | int main() |
| 4118 | { |
Martin v. Löwis | 44fe0e4 | 2006-04-11 07:15:30 +0000 | [diff] [blame] | 4119 | /* Success: exit code 0 */ |
| 4120 | exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1); |
Marc-André Lemburg | d7160f8 | 2003-09-22 11:14:40 +0000 | [diff] [blame] | 4121 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4122 | ]])], |
| 4123 | [ac_cv_wchar_t_signed=yes], |
| 4124 | [ac_cv_wchar_t_signed=no], |
| 4125 | [ac_cv_wchar_t_signed=yes])]) |
Marc-André Lemburg | d7160f8 | 2003-09-22 11:14:40 +0000 | [diff] [blame] | 4126 | AC_MSG_RESULT($ac_cv_wchar_t_signed) |
| 4127 | fi |
| 4128 | |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4129 | AC_MSG_CHECKING(what type to use for unicode) |
Martin v. Löwis | 3e2c632 | 2002-10-29 10:07:43 +0000 | [diff] [blame] | 4130 | dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4131 | AC_ARG_ENABLE(unicode, |
Benjamin Peterson | 66556b0 | 2010-05-25 02:23:32 +0000 | [diff] [blame] | 4132 | 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] | 4133 | [], |
| 4134 | [enable_unicode=yes]) |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4135 | |
| 4136 | if test $enable_unicode = yes |
| 4137 | then |
Martin v. Löwis | fd91779 | 2001-06-27 20:22:04 +0000 | [diff] [blame] | 4138 | # Without any arguments, Py_UNICODE defaults to two-byte mode |
Martin v. Löwis | fa3bdea | 2003-09-04 18:50:54 +0000 | [diff] [blame] | 4139 | case "$have_ucs4_tcl" in |
| 4140 | yes) enable_unicode="ucs4" |
| 4141 | ;; |
| 4142 | *) enable_unicode="ucs2" |
| 4143 | ;; |
| 4144 | esac |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4145 | fi |
| 4146 | |
Martin v. Löwis | 0036cba | 2002-04-12 09:58:45 +0000 | [diff] [blame] | 4147 | AH_TEMPLATE(Py_UNICODE_SIZE, |
| 4148 | [Define as the size of the unicode type.]) |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4149 | case "$enable_unicode" in |
| 4150 | ucs2) unicode_size="2" |
| 4151 | AC_DEFINE(Py_UNICODE_SIZE,2) |
| 4152 | ;; |
| 4153 | ucs4) unicode_size="4" |
| 4154 | AC_DEFINE(Py_UNICODE_SIZE,4) |
| 4155 | ;; |
Martin v. Löwis | ed11a5d | 2012-05-20 10:42:17 +0200 | [diff] [blame] | 4156 | no) ;; # To allow --disable-unicode |
Ezio Melotti | 5820efb | 2010-02-27 00:05:42 +0000 | [diff] [blame] | 4157 | *) 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] | 4158 | esac |
| 4159 | |
Martin v. Löwis | 1143799 | 2002-04-12 09:54:03 +0000 | [diff] [blame] | 4160 | AH_TEMPLATE(PY_UNICODE_TYPE, |
| 4161 | [Define as the integral type used for Unicode representation.]) |
Martin v. Löwis | 0036cba | 2002-04-12 09:58:45 +0000 | [diff] [blame] | 4162 | |
Martin v. Löwis | 339d0f7 | 2001-08-17 18:39:25 +0000 | [diff] [blame] | 4163 | AC_SUBST(UNICODE_OBJS) |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4164 | if test "$enable_unicode" = "no" |
| 4165 | then |
Martin v. Löwis | 339d0f7 | 2001-08-17 18:39:25 +0000 | [diff] [blame] | 4166 | UNICODE_OBJS="" |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4167 | AC_MSG_RESULT(not used) |
| 4168 | else |
Martin v. Löwis | 339d0f7 | 2001-08-17 18:39:25 +0000 | [diff] [blame] | 4169 | UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o" |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4170 | AC_DEFINE(Py_USING_UNICODE, 1, |
| 4171 | [Define if you want to have a Unicode type.]) |
Marc-André Lemburg | d7160f8 | 2003-09-22 11:14:40 +0000 | [diff] [blame] | 4172 | |
| 4173 | # wchar_t is only usable if it maps to an unsigned type |
| 4174 | if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \ |
Matthias Klose | 7dbeed7 | 2004-12-24 08:22:17 +0000 | [diff] [blame] | 4175 | -a "$ac_cv_wchar_t_signed" = "no" |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4176 | then |
| 4177 | PY_UNICODE_TYPE="wchar_t" |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4178 | AC_DEFINE(HAVE_USABLE_WCHAR_T, 1, |
| 4179 | [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] | 4180 | 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] | 4181 | Include/unicodeobject.h).]) |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 4182 | AC_DEFINE(PY_UNICODE_TYPE,wchar_t) |
| 4183 | elif test "$ac_cv_sizeof_short" = "$unicode_size" |
| 4184 | then |
| 4185 | PY_UNICODE_TYPE="unsigned short" |
| 4186 | AC_DEFINE(PY_UNICODE_TYPE,unsigned short) |
| 4187 | elif test "$ac_cv_sizeof_long" = "$unicode_size" |
| 4188 | then |
| 4189 | PY_UNICODE_TYPE="unsigned long" |
| 4190 | AC_DEFINE(PY_UNICODE_TYPE,unsigned long) |
| 4191 | else |
| 4192 | PY_UNICODE_TYPE="no type found" |
| 4193 | fi |
| 4194 | AC_MSG_RESULT($PY_UNICODE_TYPE) |
| 4195 | fi |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 4196 | |
| 4197 | # check for endianness |
| 4198 | AC_C_BIGENDIAN |
| 4199 | |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 4200 | # Check whether right shifting a negative integer extends the sign bit |
| 4201 | # or fills with zeros (like the Cray J90, according to Tim Peters). |
| 4202 | AC_MSG_CHECKING(whether right shift extends the sign bit) |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 4203 | AC_CACHE_VAL(ac_cv_rshift_extends_sign, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4204 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 4205 | int main() |
| 4206 | { |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 4207 | exit(((-1)>>3 == -1) ? 0 : 1); |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 4208 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4209 | ]])], |
| 4210 | [ac_cv_rshift_extends_sign=yes], |
| 4211 | [ac_cv_rshift_extends_sign=no], |
| 4212 | [ac_cv_rshift_extends_sign=yes])]) |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 4213 | AC_MSG_RESULT($ac_cv_rshift_extends_sign) |
| 4214 | if test "$ac_cv_rshift_extends_sign" = no |
| 4215 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4216 | AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1, |
| 4217 | [Define if i>>j for signed int i does not extend the sign bit |
| 4218 | when i < 0]) |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 4219 | fi |
| 4220 | |
Guido van Rossum | cadfaec | 2001-01-05 14:45:49 +0000 | [diff] [blame] | 4221 | # check for getc_unlocked and related locking functions |
| 4222 | AC_MSG_CHECKING(for getc_unlocked() and friends) |
| 4223 | AC_CACHE_VAL(ac_cv_have_getc_unlocked, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4224 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[ |
Guido van Rossum | cadfaec | 2001-01-05 14:45:49 +0000 | [diff] [blame] | 4225 | FILE *f = fopen("/dev/null", "r"); |
| 4226 | flockfile(f); |
| 4227 | getc_unlocked(f); |
| 4228 | funlockfile(f); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4229 | ]])],[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] | 4230 | AC_MSG_RESULT($ac_cv_have_getc_unlocked) |
| 4231 | if test "$ac_cv_have_getc_unlocked" = yes |
| 4232 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4233 | AC_DEFINE(HAVE_GETC_UNLOCKED, 1, |
| 4234 | [Define this if you have flockfile(), getc_unlocked(), and funlockfile()]) |
Guido van Rossum | cadfaec | 2001-01-05 14:45:49 +0000 | [diff] [blame] | 4235 | fi |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 4236 | |
Neal Norwitz | fe8e3d9 | 2006-01-07 21:07:20 +0000 | [diff] [blame] | 4237 | # check where readline lives |
Martin v. Löwis | 82bca63 | 2006-02-10 20:49:30 +0000 | [diff] [blame] | 4238 | # save the value of LIBS so we don't actually link Python with readline |
| 4239 | LIBS_no_readline=$LIBS |
Gregory P. Smith | 980b99b | 2008-09-07 05:15:18 +0000 | [diff] [blame] | 4240 | |
| 4241 | # On some systems we need to link readline to a termcap compatible |
| 4242 | # library. NOTE: Keep the precedence of listed libraries synchronised |
| 4243 | # with setup.py. |
| 4244 | py_cv_lib_readline=no |
| 4245 | AC_MSG_CHECKING([how to link readline libs]) |
| 4246 | for py_libtermcap in "" ncursesw ncurses curses termcap; do |
| 4247 | if test -z "$py_libtermcap"; then |
| 4248 | READLINE_LIBS="-lreadline" |
| 4249 | else |
| 4250 | READLINE_LIBS="-lreadline -l$py_libtermcap" |
| 4251 | fi |
| 4252 | LIBS="$READLINE_LIBS $LIBS_no_readline" |
| 4253 | AC_LINK_IFELSE( |
| 4254 | [AC_LANG_CALL([],[readline])], |
| 4255 | [py_cv_lib_readline=yes]) |
| 4256 | if test $py_cv_lib_readline = yes; then |
| 4257 | break |
| 4258 | fi |
| 4259 | done |
| 4260 | # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts |
| 4261 | #AC_SUBST([READLINE_LIBS]) |
Gregory P. Smith | 29ec750 | 2008-09-07 19:18:16 +0000 | [diff] [blame] | 4262 | if test $py_cv_lib_readline = no; then |
Gregory P. Smith | 980b99b | 2008-09-07 05:15:18 +0000 | [diff] [blame] | 4263 | AC_MSG_RESULT([none]) |
| 4264 | else |
| 4265 | AC_MSG_RESULT([$READLINE_LIBS]) |
| 4266 | AC_DEFINE(HAVE_LIBREADLINE, 1, |
| 4267 | [Define if you have the readline library (-lreadline).]) |
Neal Norwitz | fe8e3d9 | 2006-01-07 21:07:20 +0000 | [diff] [blame] | 4268 | fi |
| 4269 | |
Michael W. Hudson | 30ea2f2 | 2004-07-07 17:44:12 +0000 | [diff] [blame] | 4270 | # check for readline 2.1 |
| 4271 | AC_CHECK_LIB(readline, rl_callback_handler_install, |
| 4272 | AC_DEFINE(HAVE_RL_CALLBACK, 1, |
Gregory P. Smith | ff7b2d5 | 2008-09-03 05:57:48 +0000 | [diff] [blame] | 4273 | [Define if you have readline 2.1]), ,$READLINE_LIBS) |
Michael W. Hudson | 30ea2f2 | 2004-07-07 17:44:12 +0000 | [diff] [blame] | 4274 | |
Guido van Rossum | faf5e4d | 2002-12-30 16:25:41 +0000 | [diff] [blame] | 4275 | # check for readline 2.2 |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4276 | AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])], |
| 4277 | [have_readline=yes], |
| 4278 | [have_readline=no] |
| 4279 | ) |
Guido van Rossum | faf5e4d | 2002-12-30 16:25:41 +0000 | [diff] [blame] | 4280 | if test $have_readline = yes |
| 4281 | then |
| 4282 | AC_EGREP_HEADER([extern int rl_completion_append_character;], |
| 4283 | [readline/readline.h], |
| 4284 | AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1, |
| 4285 | [Define if you have readline 2.2]), ) |
Antoine Pitrou | d9ff74e | 2009-10-26 19:16:46 +0000 | [diff] [blame] | 4286 | AC_EGREP_HEADER([extern int rl_completion_suppress_append;], |
| 4287 | [readline/readline.h], |
| 4288 | AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1, |
| 4289 | [Define if you have rl_completion_suppress_append]), ) |
Guido van Rossum | faf5e4d | 2002-12-30 16:25:41 +0000 | [diff] [blame] | 4290 | fi |
| 4291 | |
Martin v. Löwis | 0daad59 | 2001-09-30 21:09:59 +0000 | [diff] [blame] | 4292 | # check for readline 4.0 |
| 4293 | AC_CHECK_LIB(readline, rl_pre_input_hook, |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4294 | AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1, |
Gregory P. Smith | ff7b2d5 | 2008-09-03 05:57:48 +0000 | [diff] [blame] | 4295 | [Define if you have readline 4.0]), ,$READLINE_LIBS) |
Martin v. Löwis | 0daad59 | 2001-09-30 21:09:59 +0000 | [diff] [blame] | 4296 | |
Martin v. Löwis | 58bd49f | 2007-09-04 13:13:14 +0000 | [diff] [blame] | 4297 | # also in 4.0 |
| 4298 | AC_CHECK_LIB(readline, rl_completion_display_matches_hook, |
| 4299 | AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1, |
Gregory P. Smith | ff7b2d5 | 2008-09-03 05:57:48 +0000 | [diff] [blame] | 4300 | [Define if you have readline 4.0]), ,$READLINE_LIBS) |
Martin v. Löwis | 58bd49f | 2007-09-04 13:13:14 +0000 | [diff] [blame] | 4301 | |
Martin Panter | a70c323 | 2016-04-03 02:54:58 +0000 | [diff] [blame] | 4302 | # also in 4.0, but not in editline |
| 4303 | AC_CHECK_LIB(readline, rl_resize_terminal, |
| 4304 | AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1, |
| 4305 | [Define if you have readline 4.0]), ,$READLINE_LIBS) |
| 4306 | |
Guido van Rossum | 353ae58 | 2001-07-10 16:45:32 +0000 | [diff] [blame] | 4307 | # check for readline 4.2 |
| 4308 | AC_CHECK_LIB(readline, rl_completion_matches, |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4309 | AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, |
Gregory P. Smith | ff7b2d5 | 2008-09-03 05:57:48 +0000 | [diff] [blame] | 4310 | [Define if you have readline 4.2]), ,$READLINE_LIBS) |
Guido van Rossum | 353ae58 | 2001-07-10 16:45:32 +0000 | [diff] [blame] | 4311 | |
Michael W. Hudson | 30ea2f2 | 2004-07-07 17:44:12 +0000 | [diff] [blame] | 4312 | # also in readline 4.2 |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4313 | AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])], |
| 4314 | [have_readline=yes], |
| 4315 | [have_readline=no] |
| 4316 | ) |
Michael W. Hudson | 30ea2f2 | 2004-07-07 17:44:12 +0000 | [diff] [blame] | 4317 | if test $have_readline = yes |
| 4318 | then |
| 4319 | AC_EGREP_HEADER([extern int rl_catch_signals;], |
| 4320 | [readline/readline.h], |
| 4321 | AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1, |
| 4322 | [Define if you can turn off readline's signal handling.]), ) |
| 4323 | fi |
| 4324 | |
Martin v. Löwis | 82bca63 | 2006-02-10 20:49:30 +0000 | [diff] [blame] | 4325 | # End of readline checks: restore LIBS |
| 4326 | LIBS=$LIBS_no_readline |
| 4327 | |
Thomas Wouters | e38b2f1 | 2001-07-11 22:35:31 +0000 | [diff] [blame] | 4328 | AC_MSG_CHECKING(for broken nice()) |
| 4329 | AC_CACHE_VAL(ac_cv_broken_nice, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4330 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Thomas Wouters | e38b2f1 | 2001-07-11 22:35:31 +0000 | [diff] [blame] | 4331 | int main() |
| 4332 | { |
| 4333 | int val1 = nice(1); |
| 4334 | if (val1 != -1 && val1 == nice(2)) |
| 4335 | exit(0); |
| 4336 | exit(1); |
| 4337 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4338 | ]])], |
| 4339 | [ac_cv_broken_nice=yes], |
| 4340 | [ac_cv_broken_nice=no], |
| 4341 | [ac_cv_broken_nice=no])]) |
Thomas Wouters | e38b2f1 | 2001-07-11 22:35:31 +0000 | [diff] [blame] | 4342 | AC_MSG_RESULT($ac_cv_broken_nice) |
| 4343 | if test "$ac_cv_broken_nice" = yes |
| 4344 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4345 | AC_DEFINE(HAVE_BROKEN_NICE, 1, |
| 4346 | [Define if nice() returns success/failure instead of the new priority.]) |
Thomas Wouters | e38b2f1 | 2001-07-11 22:35:31 +0000 | [diff] [blame] | 4347 | fi |
| 4348 | |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4349 | AC_MSG_CHECKING(for broken poll()) |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 4350 | AC_CACHE_VAL(ac_cv_broken_poll, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4351 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4352 | #include <poll.h> |
| 4353 | |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4354 | int main() |
| 4355 | { |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4356 | struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 }; |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4357 | int poll_test; |
| 4358 | |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4359 | close (42); |
| 4360 | |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4361 | poll_test = poll(&poll_struct, 1, 0); |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4362 | if (poll_test < 0) |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4363 | return 0; |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4364 | else if (poll_test == 0 && poll_struct.revents != POLLNVAL) |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4365 | return 0; |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4366 | else |
Alexandre Vassalotti | 66da263 | 2009-07-17 06:17:33 +0000 | [diff] [blame] | 4367 | return 1; |
| 4368 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4369 | ]])], |
| 4370 | [ac_cv_broken_poll=yes], |
| 4371 | [ac_cv_broken_poll=no], |
| 4372 | [ac_cv_broken_poll=no])) |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4373 | AC_MSG_RESULT($ac_cv_broken_poll) |
| 4374 | if test "$ac_cv_broken_poll" = yes |
| 4375 | then |
| 4376 | AC_DEFINE(HAVE_BROKEN_POLL, 1, |
| 4377 | [Define if poll() sets errno on invalid file descriptors.]) |
| 4378 | fi |
| 4379 | |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4380 | # Before we can test tzset, we need to check if struct tm has a tm_zone |
| 4381 | # (which is not required by ISO C or UNIX spec) and/or if we support |
| 4382 | # tzname[] |
| 4383 | AC_STRUCT_TIMEZONE |
Nicholas Bastin | e62c5c8 | 2004-03-21 23:45:42 +0000 | [diff] [blame] | 4384 | |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4385 | # check tzset(3) exists and works like we expect it to |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4386 | AC_MSG_CHECKING(for working tzset()) |
| 4387 | AC_CACHE_VAL(ac_cv_working_tzset, [ |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4388 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4389 | #include <stdlib.h> |
| 4390 | #include <time.h> |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4391 | #include <string.h> |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4392 | |
| 4393 | #if HAVE_TZNAME |
| 4394 | extern char *tzname[]; |
| 4395 | #endif |
| 4396 | |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4397 | int main() |
| 4398 | { |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4399 | /* Note that we need to ensure that not only does tzset(3) |
| 4400 | do 'something' with localtime, but it works as documented |
| 4401 | in the library reference and as expected by the test suite. |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4402 | This includes making sure that tzname is set properly if |
| 4403 | tm->tm_zone does not exist since it is the alternative way |
| 4404 | of getting timezone info. |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4405 | |
| 4406 | Red Hat 6.2 doesn't understand the southern hemisphere |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4407 | after New Year's Day. |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4408 | */ |
| 4409 | |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4410 | time_t groundhogday = 1044144000; /* GMT-based */ |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4411 | time_t midyear = groundhogday + (365 * 24 * 3600 / 2); |
| 4412 | |
Neal Norwitz | 7f2588c | 2003-04-11 15:35:53 +0000 | [diff] [blame] | 4413 | putenv("TZ=UTC+0"); |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4414 | tzset(); |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4415 | if (localtime(&groundhogday)->tm_hour != 0) |
| 4416 | exit(1); |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4417 | #if HAVE_TZNAME |
| 4418 | /* For UTC, tzname[1] is sometimes "", sometimes " " */ |
| 4419 | if (strcmp(tzname[0], "UTC") || |
| 4420 | (tzname[1][0] != 0 && tzname[1][0] != ' ')) |
| 4421 | exit(1); |
| 4422 | #endif |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4423 | |
Neal Norwitz | 7f2588c | 2003-04-11 15:35:53 +0000 | [diff] [blame] | 4424 | putenv("TZ=EST+5EDT,M4.1.0,M10.5.0"); |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4425 | tzset(); |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4426 | if (localtime(&groundhogday)->tm_hour != 19) |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4427 | exit(1); |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4428 | #if HAVE_TZNAME |
| 4429 | if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT")) |
| 4430 | exit(1); |
| 4431 | #endif |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4432 | |
| 4433 | putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0"); |
| 4434 | tzset(); |
| 4435 | if (localtime(&groundhogday)->tm_hour != 11) |
| 4436 | exit(1); |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4437 | #if HAVE_TZNAME |
| 4438 | if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT")) |
| 4439 | exit(1); |
| 4440 | #endif |
| 4441 | |
| 4442 | #if HAVE_STRUCT_TM_TM_ZONE |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4443 | if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT")) |
| 4444 | exit(1); |
| 4445 | if (strcmp(localtime(&midyear)->tm_zone, "AEST")) |
| 4446 | exit(1); |
Brett Cannon | 4380242 | 2005-02-10 20:48:03 +0000 | [diff] [blame] | 4447 | #endif |
Brett Cannon | 1836781 | 2003-09-19 00:59:16 +0000 | [diff] [blame] | 4448 | |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4449 | exit(0); |
| 4450 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4451 | ]])], |
| 4452 | [ac_cv_working_tzset=yes], |
| 4453 | [ac_cv_working_tzset=no], |
| 4454 | [ac_cv_working_tzset=no])]) |
Guido van Rossum | d11b62e | 2003-03-14 21:51:36 +0000 | [diff] [blame] | 4455 | AC_MSG_RESULT($ac_cv_working_tzset) |
| 4456 | if test "$ac_cv_working_tzset" = yes |
| 4457 | then |
| 4458 | AC_DEFINE(HAVE_WORKING_TZSET, 1, |
| 4459 | [Define if tzset() actually switches the local timezone in a meaningful way.]) |
| 4460 | fi |
| 4461 | |
Martin v. Löwis | 94717ed | 2002-09-09 14:24:16 +0000 | [diff] [blame] | 4462 | # Look for subsecond timestamps in struct stat |
| 4463 | AC_MSG_CHECKING(for tv_nsec in struct stat) |
| 4464 | AC_CACHE_VAL(ac_cv_stat_tv_nsec, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4465 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[ |
Martin v. Löwis | 94717ed | 2002-09-09 14:24:16 +0000 | [diff] [blame] | 4466 | struct stat st; |
| 4467 | st.st_mtim.tv_nsec = 1; |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4468 | ]])], |
| 4469 | [ac_cv_stat_tv_nsec=yes], |
| 4470 | [ac_cv_stat_tv_nsec=no])) |
Martin v. Löwis | 94717ed | 2002-09-09 14:24:16 +0000 | [diff] [blame] | 4471 | AC_MSG_RESULT($ac_cv_stat_tv_nsec) |
| 4472 | if test "$ac_cv_stat_tv_nsec" = yes |
| 4473 | then |
| 4474 | AC_DEFINE(HAVE_STAT_TV_NSEC, 1, |
| 4475 | [Define if you have struct stat.st_mtim.tv_nsec]) |
| 4476 | fi |
| 4477 | |
Martin v. Löwis | ebd9d5b | 2005-08-09 15:00:59 +0000 | [diff] [blame] | 4478 | # Look for BSD style subsecond timestamps in struct stat |
| 4479 | AC_MSG_CHECKING(for tv_nsec2 in struct stat) |
| 4480 | AC_CACHE_VAL(ac_cv_stat_tv_nsec2, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4481 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[ |
Martin v. Löwis | ebd9d5b | 2005-08-09 15:00:59 +0000 | [diff] [blame] | 4482 | struct stat st; |
| 4483 | st.st_mtimespec.tv_nsec = 1; |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4484 | ]])], |
| 4485 | [ac_cv_stat_tv_nsec2=yes], |
| 4486 | [ac_cv_stat_tv_nsec2=no])) |
Martin v. Löwis | ebd9d5b | 2005-08-09 15:00:59 +0000 | [diff] [blame] | 4487 | AC_MSG_RESULT($ac_cv_stat_tv_nsec2) |
| 4488 | if test "$ac_cv_stat_tv_nsec2" = yes |
| 4489 | then |
| 4490 | AC_DEFINE(HAVE_STAT_TV_NSEC2, 1, |
| 4491 | [Define if you have struct stat.st_mtimensec]) |
| 4492 | fi |
| 4493 | |
doko@ubuntu.com | f27ec3e | 2014-04-17 20:11:19 +0200 | [diff] [blame] | 4494 | # first curses configure check |
| 4495 | ac_save_cppflags="$CPPFLAGS" |
| 4496 | CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" |
| 4497 | |
| 4498 | AC_CHECK_HEADERS(curses.h ncurses.h) |
| 4499 | |
| 4500 | # On Solaris, term.h requires curses.h |
| 4501 | AC_CHECK_HEADERS(term.h,,,[ |
| 4502 | #ifdef HAVE_CURSES_H |
| 4503 | #include <curses.h> |
| 4504 | #endif |
| 4505 | ]) |
| 4506 | |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4507 | # On HP/UX 11.0, mvwdelch is a block with a return statement |
| 4508 | AC_MSG_CHECKING(whether mvwdelch is an expression) |
| 4509 | AC_CACHE_VAL(ac_cv_mvwdelch_is_expression, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4510 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4511 | int rtn; |
| 4512 | rtn = mvwdelch(0,0,0); |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4513 | ]])], |
| 4514 | [ac_cv_mvwdelch_is_expression=yes], |
| 4515 | [ac_cv_mvwdelch_is_expression=no])) |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4516 | AC_MSG_RESULT($ac_cv_mvwdelch_is_expression) |
| 4517 | |
| 4518 | if test "$ac_cv_mvwdelch_is_expression" = yes |
| 4519 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4520 | AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1, |
| 4521 | [Define if mvwdelch in curses.h is an expression.]) |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4522 | fi |
| 4523 | |
| 4524 | AC_MSG_CHECKING(whether WINDOW has _flags) |
| 4525 | AC_CACHE_VAL(ac_cv_window_has_flags, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4526 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4527 | WINDOW *w; |
| 4528 | w->_flags = 0; |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4529 | ]])], |
| 4530 | [ac_cv_window_has_flags=yes], |
| 4531 | [ac_cv_window_has_flags=no])) |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4532 | AC_MSG_RESULT($ac_cv_window_has_flags) |
| 4533 | |
| 4534 | |
| 4535 | if test "$ac_cv_window_has_flags" = yes |
| 4536 | then |
Martin v. Löwis | c45929e | 2002-04-06 10:10:49 +0000 | [diff] [blame] | 4537 | AC_DEFINE(WINDOW_HAS_FLAGS, 1, |
| 4538 | [Define if WINDOW in curses.h offers a field _flags.]) |
Martin v. Löwis | eb9b103 | 2001-10-24 17:10:49 +0000 | [diff] [blame] | 4539 | fi |
| 4540 | |
Walter Dörwald | 4994d95 | 2006-06-19 08:07:50 +0000 | [diff] [blame] | 4541 | AC_MSG_CHECKING(for is_term_resized) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4542 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])], |
| 4543 | [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.) |
| 4544 | AC_MSG_RESULT(yes)], |
| 4545 | [AC_MSG_RESULT(no)] |
Walter Dörwald | 4994d95 | 2006-06-19 08:07:50 +0000 | [diff] [blame] | 4546 | ) |
| 4547 | |
Walter Dörwald | 05fdbf1 | 2006-06-19 08:14:09 +0000 | [diff] [blame] | 4548 | AC_MSG_CHECKING(for resize_term) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4549 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])], |
| 4550 | [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.) |
| 4551 | AC_MSG_RESULT(yes)], |
| 4552 | [AC_MSG_RESULT(no)] |
Walter Dörwald | 4994d95 | 2006-06-19 08:07:50 +0000 | [diff] [blame] | 4553 | ) |
| 4554 | |
Walter Dörwald | 05fdbf1 | 2006-06-19 08:14:09 +0000 | [diff] [blame] | 4555 | AC_MSG_CHECKING(for resizeterm) |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4556 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])], |
| 4557 | [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.) |
| 4558 | AC_MSG_RESULT(yes)], |
| 4559 | [AC_MSG_RESULT(no)] |
Walter Dörwald | 4994d95 | 2006-06-19 08:07:50 +0000 | [diff] [blame] | 4560 | ) |
doko@ubuntu.com | f27ec3e | 2014-04-17 20:11:19 +0200 | [diff] [blame] | 4561 | # last curses configure check |
| 4562 | CPPFLAGS=$ac_save_cppflags |
Walter Dörwald | 4994d95 | 2006-06-19 08:07:50 +0000 | [diff] [blame] | 4563 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 4564 | AC_MSG_NOTICE([checking for device files]) |
Martin v. Löwis | fefbc20 | 2006-10-17 18:59:23 +0000 | [diff] [blame] | 4565 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 4566 | dnl NOTE: Inform user how to proceed with files when cross compiling. |
| 4567 | if test "x$cross_compiling" = xyes; then |
| 4568 | if test "${ac_cv_file__dev_ptmx+set}" != set; then |
| 4569 | AC_MSG_CHECKING([for /dev/ptmx]) |
| 4570 | AC_MSG_RESULT([not set]) |
| 4571 | AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling]) |
| 4572 | fi |
| 4573 | if test "${ac_cv_file__dev_ptc+set}" != set; then |
| 4574 | AC_MSG_CHECKING([for /dev/ptc]) |
| 4575 | AC_MSG_RESULT([not set]) |
| 4576 | AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling]) |
| 4577 | fi |
Martin v. Löwis | fefbc20 | 2006-10-17 18:59:23 +0000 | [diff] [blame] | 4578 | fi |
| 4579 | |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 4580 | AC_CHECK_FILE(/dev/ptmx, [], []) |
| 4581 | if test "x$ac_cv_file__dev_ptmx" = xyes; then |
| 4582 | AC_DEFINE(HAVE_DEV_PTMX, 1, |
| 4583 | [Define to 1 if you have the /dev/ptmx device file.]) |
| 4584 | fi |
| 4585 | AC_CHECK_FILE(/dev/ptc, [], []) |
| 4586 | if test "x$ac_cv_file__dev_ptc" = xyes; then |
Martin v. Löwis | fefbc20 | 2006-10-17 18:59:23 +0000 | [diff] [blame] | 4587 | AC_DEFINE(HAVE_DEV_PTC, 1, |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 4588 | [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] | 4589 | fi |
Neal Norwitz | 865400f | 2003-03-21 01:42:58 +0000 | [diff] [blame] | 4590 | |
Mark Dickinson | 82864d1 | 2009-11-15 16:18:58 +0000 | [diff] [blame] | 4591 | if test "$have_long_long" = yes |
| 4592 | then |
| 4593 | AC_MSG_CHECKING(for %lld and %llu printf() format support) |
| 4594 | AC_CACHE_VAL(ac_cv_have_long_long_format, |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4595 | AC_RUN_IFELSE([AC_LANG_SOURCE([[[ |
Mark Dickinson | 82864d1 | 2009-11-15 16:18:58 +0000 | [diff] [blame] | 4596 | #include <stdio.h> |
| 4597 | #include <stddef.h> |
| 4598 | #include <string.h> |
| 4599 | |
| 4600 | #ifdef HAVE_SYS_TYPES_H |
| 4601 | #include <sys/types.h> |
| 4602 | #endif |
| 4603 | |
| 4604 | int main() |
| 4605 | { |
| 4606 | char buffer[256]; |
| 4607 | |
| 4608 | if (sprintf(buffer, "%lld", (long long)123) < 0) |
| 4609 | return 1; |
| 4610 | if (strcmp(buffer, "123")) |
| 4611 | return 1; |
| 4612 | |
| 4613 | if (sprintf(buffer, "%lld", (long long)-123) < 0) |
| 4614 | return 1; |
| 4615 | if (strcmp(buffer, "-123")) |
| 4616 | return 1; |
| 4617 | |
| 4618 | if (sprintf(buffer, "%llu", (unsigned long long)123) < 0) |
| 4619 | return 1; |
| 4620 | if (strcmp(buffer, "123")) |
| 4621 | return 1; |
| 4622 | |
| 4623 | return 0; |
| 4624 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4625 | ]]])], |
| 4626 | [ac_cv_have_long_long_format=yes], |
| 4627 | [ac_cv_have_long_long_format=no], |
doko@python.org | d65e2ba | 2013-01-31 23:52:03 +0100 | [diff] [blame] | 4628 | [ac_cv_have_long_long_format="cross -- assuming no" |
| 4629 | if test x$GCC = xyes; then |
| 4630 | save_CFLAGS=$CFLAGS |
| 4631 | CFLAGS="$CFLAGS -Werror -Wformat" |
| 4632 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4633 | #include <stdio.h> |
| 4634 | #include <stddef.h> |
| 4635 | ]], [[ |
| 4636 | char *buffer; |
| 4637 | sprintf(buffer, "%lld", (long long)123); |
| 4638 | sprintf(buffer, "%lld", (long long)-123); |
| 4639 | sprintf(buffer, "%llu", (unsigned long long)123); |
| 4640 | ]])], |
| 4641 | ac_cv_have_long_long_format=yes |
| 4642 | ) |
| 4643 | CFLAGS=$save_CFLAGS |
| 4644 | fi]) |
Mark Dickinson | 82864d1 | 2009-11-15 16:18:58 +0000 | [diff] [blame] | 4645 | ) |
| 4646 | AC_MSG_RESULT($ac_cv_have_long_long_format) |
| 4647 | fi |
| 4648 | |
Mark Dickinson | 5ce8474 | 2009-12-31 20:48:04 +0000 | [diff] [blame] | 4649 | if test "$ac_cv_have_long_long_format" = yes |
Mark Dickinson | 82864d1 | 2009-11-15 16:18:58 +0000 | [diff] [blame] | 4650 | then |
| 4651 | AC_DEFINE(PY_FORMAT_LONG_LONG, "ll", |
| 4652 | [Define to printf format modifier for long long type]) |
| 4653 | fi |
| 4654 | |
Ronald Oussoren | 315cd0c | 2009-11-19 16:25:21 +0000 | [diff] [blame] | 4655 | if test $ac_sys_system = Darwin |
| 4656 | then |
| 4657 | LIBS="$LIBS -framework CoreFoundation" |
| 4658 | fi |
| 4659 | |
Mark Dickinson | 82864d1 | 2009-11-15 16:18:58 +0000 | [diff] [blame] | 4660 | |
Gregory P. Smith | d8cb2d9 | 2009-11-02 02:02:38 +0000 | [diff] [blame] | 4661 | 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] | 4662 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Alexandre Vassalotti | e7cf118 | 2009-07-17 06:33:51 +0000 | [diff] [blame] | 4663 | #include <stdio.h> |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4664 | #include <stddef.h> |
| 4665 | #include <string.h> |
| 4666 | |
Christian Heimes | db3d6cb | 2007-12-16 21:39:43 +0000 | [diff] [blame] | 4667 | #ifdef HAVE_SYS_TYPES_H |
| 4668 | #include <sys/types.h> |
| 4669 | #endif |
Neal Norwitz | 4a8fbdb | 2006-09-22 08:16:26 +0000 | [diff] [blame] | 4670 | |
| 4671 | #ifdef HAVE_SSIZE_T |
| 4672 | typedef ssize_t Py_ssize_t; |
| 4673 | #elif SIZEOF_VOID_P == SIZEOF_LONG |
| 4674 | typedef long Py_ssize_t; |
| 4675 | #else |
| 4676 | typedef int Py_ssize_t; |
| 4677 | #endif |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4678 | |
Christian Heimes | db3d6cb | 2007-12-16 21:39:43 +0000 | [diff] [blame] | 4679 | int main() |
| 4680 | { |
| 4681 | char buffer[256]; |
| 4682 | |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4683 | if(sprintf(buffer, "%zd", (size_t)123) < 0) |
| 4684 | return 1; |
| 4685 | |
Neal Norwitz | 4a8fbdb | 2006-09-22 08:16:26 +0000 | [diff] [blame] | 4686 | if (strcmp(buffer, "123")) |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4687 | return 1; |
Neal Norwitz | 4a8fbdb | 2006-09-22 08:16:26 +0000 | [diff] [blame] | 4688 | |
| 4689 | if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0) |
| 4690 | return 1; |
| 4691 | |
| 4692 | if (strcmp(buffer, "-123")) |
| 4693 | return 1; |
| 4694 | |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4695 | return 0; |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 4696 | } |
Matthias Klose | c511b47 | 2010-05-08 11:01:39 +0000 | [diff] [blame] | 4697 | ]])], |
| 4698 | [ac_cv_have_size_t_format=yes], |
| 4699 | [ac_cv_have_size_t_format=no], |
| 4700 | [ac_cv_have_size_t_format="cross -- assuming yes" |
| 4701 | ])]) |
Gregory P. Smith | d8cb2d9 | 2009-11-02 02:02:38 +0000 | [diff] [blame] | 4702 | if test "$ac_cv_have_size_t_format" != no ; then |
Alexandre Vassalotti | 0090089 | 2009-07-17 05:26:39 +0000 | [diff] [blame] | 4703 | AC_DEFINE(PY_FORMAT_SIZE_T, "z", |
| 4704 | [Define to printf format modifier for Py_ssize_t]) |
| 4705 | fi |
Brett Cannon | 09d1236 | 2006-05-11 05:11:33 +0000 | [diff] [blame] | 4706 | |
Martin v. Löwis | 01c0401 | 2002-11-11 14:58:44 +0000 | [diff] [blame] | 4707 | AC_CHECK_TYPE(socklen_t,, |
| 4708 | AC_DEFINE(socklen_t,int, |
Matthias Klose | 5183ebd | 2010-04-24 16:38:36 +0000 | [diff] [blame] | 4709 | [Define to `int' if <sys/socket.h> does not define.]),[ |
Martin v. Löwis | 01c0401 | 2002-11-11 14:58:44 +0000 | [diff] [blame] | 4710 | #ifdef HAVE_SYS_TYPES_H |
| 4711 | #include <sys/types.h> |
| 4712 | #endif |
Guido van Rossum | 95713eb | 2000-05-18 20:53:31 +0000 | [diff] [blame] | 4713 | #ifdef HAVE_SYS_SOCKET_H |
| 4714 | #include <sys/socket.h> |
| 4715 | #endif |
Martin v. Löwis | 01c0401 | 2002-11-11 14:58:44 +0000 | [diff] [blame] | 4716 | ]) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 4717 | |
R. David Murray | 1d9d16e | 2010-10-16 00:43:13 +0000 | [diff] [blame] | 4718 | case $ac_sys_system in |
| 4719 | AIX*) |
| 4720 | AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;; |
| 4721 | esac |
| 4722 | |
| 4723 | |
Martin v. Löwis | 06f15bb | 2001-12-02 13:02:32 +0000 | [diff] [blame] | 4724 | AC_SUBST(THREADHEADERS) |
| 4725 | |
| 4726 | for h in `(cd $srcdir;echo Python/thread_*.h)` |
| 4727 | do |
| 4728 | THREADHEADERS="$THREADHEADERS \$(srcdir)/$h" |
| 4729 | done |
| 4730 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 4731 | AC_SUBST(SRCDIRS) |
Neal Norwitz | d24499d | 2005-12-18 21:36:39 +0000 | [diff] [blame] | 4732 | SRCDIRS="Parser Grammar Objects Python Modules Mac" |
Andrew M. Kuchling | 8abedde | 2001-01-26 22:55:24 +0000 | [diff] [blame] | 4733 | AC_MSG_CHECKING(for build directories) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 4734 | for dir in $SRCDIRS; do |
| 4735 | if test ! -d $dir; then |
| 4736 | mkdir $dir |
Fred Drake | 884d3ba | 2000-11-02 17:52:56 +0000 | [diff] [blame] | 4737 | fi |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 4738 | done |
Benjamin Peterson | 2c992a0 | 2015-05-28 12:45:31 -0500 | [diff] [blame] | 4739 | |
| 4740 | # BEGIN_COMPUTED_GOTO |
| 4741 | # Check for --with-computed-gotos |
| 4742 | AC_MSG_CHECKING(for --with-computed-gotos) |
| 4743 | AC_ARG_WITH(computed-gotos, |
| 4744 | AS_HELP_STRING([--with(out)-computed-gotos], |
| 4745 | [Use computed gotos in evaluation loop (enabled by default on supported compilers)]), |
| 4746 | [ |
| 4747 | if test "$withval" = yes |
| 4748 | then |
| 4749 | AC_DEFINE(USE_COMPUTED_GOTOS, 1, |
| 4750 | [Define if you want to use computed gotos in ceval.c.]) |
| 4751 | AC_MSG_RESULT(yes) |
| 4752 | fi |
| 4753 | if test "$withval" = no |
| 4754 | then |
| 4755 | AC_DEFINE(USE_COMPUTED_GOTOS, 0, |
| 4756 | [Define if you want to use computed gotos in ceval.c.]) |
| 4757 | AC_MSG_RESULT(no) |
| 4758 | fi |
| 4759 | ], |
| 4760 | [AC_MSG_RESULT(no value specified)]) |
| 4761 | |
| 4762 | AC_MSG_CHECKING(whether $CC supports computed gotos) |
| 4763 | AC_CACHE_VAL(ac_cv_computed_gotos, |
| 4764 | AC_RUN_IFELSE([AC_LANG_SOURCE([[[ |
| 4765 | int main(int argc, char **argv) |
| 4766 | { |
| 4767 | static void *targets[1] = { &&LABEL1 }; |
| 4768 | goto LABEL2; |
| 4769 | LABEL1: |
| 4770 | return 0; |
| 4771 | LABEL2: |
| 4772 | goto *targets[0]; |
| 4773 | return 1; |
| 4774 | } |
| 4775 | ]]])], |
| 4776 | [ac_cv_computed_gotos=yes], |
| 4777 | [ac_cv_computed_gotos=no], |
| 4778 | [if test "${with_computed_gotos+set}" = set; then |
| 4779 | ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos" |
| 4780 | else |
| 4781 | ac_cv_computed_gotos=no |
| 4782 | fi])) |
| 4783 | AC_MSG_RESULT($ac_cv_computed_gotos) |
| 4784 | case "$ac_cv_computed_gotos" in yes*) |
| 4785 | AC_DEFINE(HAVE_COMPUTED_GOTOS, 1, |
| 4786 | [Define if the C compiler supports computed gotos.]) |
| 4787 | esac |
| 4788 | # END_COMPUTED_GOTO |
| 4789 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 4790 | AC_MSG_RESULT(done) |
Fred Drake | 036144d | 2000-10-26 17:09:35 +0000 | [diff] [blame] | 4791 | |
Ned Deily | 3f1d0b3 | 2014-11-20 02:11:03 -0800 | [diff] [blame] | 4792 | # ensurepip option |
| 4793 | AC_MSG_CHECKING(for ensurepip) |
| 4794 | AC_ARG_WITH(ensurepip, |
| 4795 | [AS_HELP_STRING([--with(out)-ensurepip=@<:@=OPTION@:>@], |
| 4796 | ["install" or "upgrade" using bundled pip, default is "no"])], |
| 4797 | [], |
| 4798 | [with_ensurepip=no]) |
| 4799 | AS_CASE($with_ensurepip, |
| 4800 | [yes|upgrade],[ENSUREPIP=upgrade], |
| 4801 | [install],[ENSUREPIP=install], |
| 4802 | [no],[ENSUREPIP=no], |
| 4803 | [AC_MSG_ERROR([--with-ensurepip=upgrade|install|no])]) |
| 4804 | AC_MSG_RESULT($ENSUREPIP) |
| 4805 | AC_SUBST(ENSUREPIP) |
| 4806 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 4807 | # generate output files |
Antoine Pitrou | f2caeed | 2009-05-24 20:23:57 +0000 | [diff] [blame] | 4808 | AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc) |
Antoine Pitrou | aabdceb | 2010-09-10 20:03:17 +0000 | [diff] [blame] | 4809 | 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] | 4810 | AC_OUTPUT |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 4811 | |
Martin v. Löwis | f7afe95 | 2006-04-14 15:16:15 +0000 | [diff] [blame] | 4812 | echo "creating Modules/Setup" |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 4813 | if test ! -f Modules/Setup |
| 4814 | then |
| 4815 | cp $srcdir/Modules/Setup.dist Modules/Setup |
| 4816 | fi |
| 4817 | |
Martin v. Löwis | f7afe95 | 2006-04-14 15:16:15 +0000 | [diff] [blame] | 4818 | echo "creating Modules/Setup.local" |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 4819 | if test ! -f Modules/Setup.local |
| 4820 | then |
| 4821 | echo "# Edit this file for local setup changes" >Modules/Setup.local |
| 4822 | fi |
| 4823 | |
| 4824 | echo "creating Makefile" |
| 4825 | $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ |
| 4826 | -s Modules Modules/Setup.config \ |
Neil Schemenauer | f8b71c5 | 2001-04-21 17:41:16 +0000 | [diff] [blame] | 4827 | Modules/Setup.local Modules/Setup |
Skip Montanaro | 7221d93 | 2007-08-22 19:02:16 +0000 | [diff] [blame] | 4828 | |
| 4829 | case $ac_sys_system in |
| 4830 | BeOS) |
| 4831 | AC_MSG_WARN([ |
| 4832 | |
| 4833 | Support for BeOS is deprecated as of Python 2.6. |
| 4834 | See PEP 11 for the gory details. |
| 4835 | ]) |
| 4836 | ;; |
| 4837 | *) ;; |
| 4838 | esac |
| 4839 | |
Neil Schemenauer | 6625216 | 2001-02-19 04:47:42 +0000 | [diff] [blame] | 4840 | mv config.c Modules |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 4841 | |
| 4842 | if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then |
| 4843 | echo "" >&AS_MESSAGE_FD |
| 4844 | echo "" >&AS_MESSAGE_FD |
| 4845 | 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] | 4846 | echo "please run ./configure --enable-optimizations" >&AS_MESSAGE_FD |
Gregory P. Smith | 6d8fdfc | 2016-09-07 23:28:23 -0700 | [diff] [blame] | 4847 | echo "" >&AS_MESSAGE_FD |
| 4848 | echo "" >&AS_MESSAGE_FD |
| 4849 | fi |