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