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