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