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