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