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