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