Debian Codegraph @

cpython27/configure.ac

raw
1 dnl ***********************************************
2 dnl * Please run autoreconf to test your changes! *
3 dnl ***********************************************
4
5 # Set VERSION so we only need to edit in one place (i.e., here)
6 m4_define(PYTHON_VERSION, 2.7)
7
8 AC_PREREQ(2.65)
9
10 AC_REVISION($Revision$)
11 AC_INIT(python, PYTHON_VERSION, https://bugs.python.org/)
12 AC_CONFIG_SRCDIR([Include/object.h])
13 AC_CONFIG_HEADER(pyconfig.h)
14
15 AC_CANONICAL_HOST
16 AC_SUBST(build)
17 AC_SUBST(host)
18
19 # pybuilddir.txt will be created by --generate-posix-vars in the Makefile
20 rm -f pybuilddir.txt
21
22 AC_CHECK_PROGS(PYTHON_FOR_REGEN, python$PACKAGE_VERSION python3 python, python3)
23 AC_SUBST(PYTHON_FOR_REGEN)
24
25 if test "$cross_compiling" = yes; then
26 AC_MSG_CHECKING([for python interpreter for cross build])
27 if test -z "$PYTHON_FOR_BUILD"; then
28 for interp in python$PACKAGE_VERSION python2 python; do
29 which $interp >/dev/null 2>&1 || continue
30 if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >= (2,7) and sys.version_info@<:@0@:>@ < 3))'; then
31 break
32 fi
33 interp=
34 done
35 if test x$interp = x; then
36 AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
37 fi
38 AC_MSG_RESULT($interp)
39 PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
40 fi
41 elif test "$cross_compiling" = maybe; then
42 AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
43 else
44 PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
45 fi
46 AC_SUBST(PYTHON_FOR_BUILD)
47
48 dnl Ensure that if prefix is specified, it does not end in a slash. If
49 dnl it does, we get path names containing '//' which is both ugly and
50 dnl can cause trouble.
51
52 dnl Last slash shouldn't be stripped if prefix=/
53 if test "$prefix" != "/"; then
54 prefix=`echo "$prefix" | sed -e 's/\/$//g'`
55 fi
56
57 dnl This is for stuff that absolutely must end up in pyconfig.h.
58 dnl Please use pyport.h instead, if possible.
59 AH_TOP([
60 #ifndef Py_PYCONFIG_H
61 #define Py_PYCONFIG_H
62 ])
63 AH_BOTTOM([
64 /* Define the macros needed if on a UnixWare 7.x system. */
65 #if defined(__USLC__) && defined(__SCO_VERSION__)
66 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
67 #endif
68
69 #endif /*Py_PYCONFIG_H*/
70 ])
71
72 # We don't use PACKAGE_ variables, and they cause conflicts
73 # with other autoconf-based packages that include Python.h
74 grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
75 rm confdefs.h
76 mv confdefs.h.new confdefs.h
77
78 AC_SUBST(VERSION)
79 VERSION=PYTHON_VERSION
80
81 AC_SUBST(SOVERSION)
82 SOVERSION=1.0
83
84 # The later defininition of _XOPEN_SOURCE disables certain features
85 # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
86 AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
87
88 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
89 # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
90 # them.
91 AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
92
93 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
94 # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
95 # them.
96 AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
97
98 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
99 # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
100 AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
101
102 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
103 # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
104 # them.
105 AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
106
107
108 define_xopen_source=yes
109
110 # Arguments passed to configure.
111 AC_SUBST(CONFIG_ARGS)
112 CONFIG_ARGS="$ac_configure_args"
113
114 AC_MSG_CHECKING([for --enable-universalsdk])
115 AC_ARG_ENABLE(universalsdk,
116 AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build fat binary against Mac OS X SDK]),
117 [
118 case $enableval in
119 yes)
120 # Locate the best usable SDK, see Mac/README for more
121 # information
122 enableval="`/usr/bin/xcodebuild -version -sdk macosx Path 2>/dev/null`"
123 if ! ( echo $enableval | grep -E '\.sdk' 1>/dev/null )
124 then
125 enableval=/Developer/SDKs/MacOSX10.4u.sdk
126 if test ! -d "${enableval}"
127 then
128 enableval=/
129 fi
130 fi
131 ;;
132 esac
133 case $enableval in
134 no)
135 UNIVERSALSDK=
136 enable_universalsdk=
137 ;;
138 *)
139 UNIVERSALSDK=$enableval
140 if test ! -d "${UNIVERSALSDK}"
141 then
142 AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
143 fi
144 ;;
145 esac
146
147 ],[
148 UNIVERSALSDK=
149 enable_universalsdk=
150 ])
151 if test -n "${UNIVERSALSDK}"
152 then
153 AC_MSG_RESULT(${UNIVERSALSDK})
154 else
155 AC_MSG_RESULT(no)
156 fi
157 AC_SUBST(UNIVERSALSDK)
158
159 AC_SUBST(ARCH_RUN_32BIT)
160 ARCH_RUN_32BIT=""
161
162 # For backward compatibility reasons we prefer to select '32-bit' if available,
163 # otherwise use 'intel'
164 UNIVERSAL_ARCHS="32-bit"
165 if test "`uname -s`" = "Darwin"
166 then
167 if test -n "${UNIVERSALSDK}"
168 then
169 if test -z "`/usr/bin/file -L "${UNIVERSALSDK}/usr/lib/libSystem.dylib" | grep ppc`"
170 then
171 UNIVERSAL_ARCHS="intel"
172 fi
173 fi
174 fi
175
176 AC_SUBST(LIPO_32BIT_FLAGS)
177 AC_MSG_CHECKING(for --with-universal-archs)
178 AC_ARG_WITH(universal-archs,
179 AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel", "intel-32", "intel-64", or "all")]),
180 [
181 UNIVERSAL_ARCHS="$withval"
182 ],
183 [])
184 if test -n "${UNIVERSALSDK}"
185 then
186 AC_MSG_RESULT(${UNIVERSAL_ARCHS})
187 else
188 AC_MSG_RESULT(no)
189 fi
190
191 AC_ARG_WITH(framework-name,
192 AS_HELP_STRING([--with-framework-name=FRAMEWORK],
193 [specify an alternate name of the framework built with --enable-framework]),
194 [
195 if test "${enable_framework}"; then
196 :
197 else
198 AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
199 fi
200 PYTHONFRAMEWORK=${withval}
201 PYTHONFRAMEWORKDIR=${withval}.framework
202 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
203 ],[
204 PYTHONFRAMEWORK=Python
205 PYTHONFRAMEWORKDIR=Python.framework
206 PYTHONFRAMEWORKIDENTIFIER=org.python.python
207 ])
208 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
209 AC_ARG_ENABLE(framework,
210 AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@], [Build (MacOSX|Darwin) framework]),
211 [
212 case $enableval in
213 yes)
214 enableval=/Library/Frameworks
215 esac
216 case $enableval in
217 no)
218 PYTHONFRAMEWORK=
219 PYTHONFRAMEWORKDIR=no-framework
220 PYTHONFRAMEWORKPREFIX=
221 PYTHONFRAMEWORKINSTALLDIR=
222 FRAMEWORKINSTALLFIRST=
223 FRAMEWORKINSTALLLAST=
224 FRAMEWORKALTINSTALLFIRST=
225 FRAMEWORKALTINSTALLLAST=
226 if test "x${prefix}" = "xNONE"; then
227 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
228 else
229 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
230 fi
231 enable_framework=
232 ;;
233 *)
234 PYTHONFRAMEWORKPREFIX="${enableval}"
235 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
236 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
237 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
238 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
239 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
240 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
241
242 if test "x${prefix}" = "xNONE" ; then
243 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
244
245 else
246 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
247 fi
248
249 case "${enableval}" in
250 /System*)
251 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
252 if test "${prefix}" = "NONE" ; then
253 # See below
254 FRAMEWORKUNIXTOOLSPREFIX="/usr"
255 fi
256 ;;
257
258 /Library*)
259 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
260 ;;
261
262 */Library/Frameworks)
263 MDIR="`dirname "${enableval}"`"
264 MDIR="`dirname "${MDIR}"`"
265 FRAMEWORKINSTALLAPPSPREFIX="${MDIR}/Applications"
266
267 if test "${prefix}" = "NONE"; then
268 # User hasn't specified the
269 # --prefix option, but wants to install
270 # the framework in a non-default location,
271 # ensure that the compatibility links get
272 # installed relative to that prefix as well
273 # instead of in /usr/local.
274 FRAMEWORKUNIXTOOLSPREFIX="${MDIR}"
275 fi
276 ;;
277
278 *)
279 FRAMEWORKINSTALLAPPSPREFIX="/Applications"
280 ;;
281 esac
282
283 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
284
285 # Add files for Mac specific code to the list of output
286 # files:
287 AC_CONFIG_FILES(Mac/Makefile)
288 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
289 AC_CONFIG_FILES(Mac/IDLE/Makefile)
290 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
291 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
292 esac
293 ],[
294 PYTHONFRAMEWORK=
295 PYTHONFRAMEWORKDIR=no-framework
296 PYTHONFRAMEWORKPREFIX=
297 PYTHONFRAMEWORKINSTALLDIR=
298 FRAMEWORKINSTALLFIRST=
299 FRAMEWORKINSTALLLAST=
300 FRAMEWORKALTINSTALLFIRST=
301 FRAMEWORKALTINSTALLLAST=
302 if test "x${prefix}" = "xNONE" ; then
303 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
304 else
305 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
306 fi
307 enable_framework=
308
309 ])
310 AC_SUBST(PYTHONFRAMEWORK)
311 AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
312 AC_SUBST(PYTHONFRAMEWORKDIR)
313 AC_SUBST(PYTHONFRAMEWORKPREFIX)
314 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
315 AC_SUBST(FRAMEWORKINSTALLFIRST)
316 AC_SUBST(FRAMEWORKINSTALLLAST)
317 AC_SUBST(FRAMEWORKALTINSTALLFIRST)
318 AC_SUBST(FRAMEWORKALTINSTALLLAST)
319 AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
320 AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
321
322 ##AC_ARG_WITH(dyld,
323 ## AS_HELP_STRING([--with-dyld],
324 ## [Use (OpenStep|Rhapsody) dynamic linker]))
325 ##
326 # Set name for machine-dependent library files
327 AC_SUBST(MACHDEP)
328 AC_MSG_CHECKING(MACHDEP)
329 if test -z "$MACHDEP"
330 then
331 # avoid using uname for cross builds
332 if test "$cross_compiling" = yes; then
333 # ac_sys_system and ac_sys_release are only used for setting
334 # `define_xopen_source' in the case statement below. For the
335 # current supported cross builds, this macro is not adjusted.
336 case "$host" in
337 *-*-linux*)
338 ac_sys_system=Linux
339 ;;
340 *-*-cygwin*)
341 ac_sys_system=Cygwin
342 ;;
343 *)
344 # for now, limit cross builds to known configurations
345 MACHDEP="unknown"
346 AC_MSG_ERROR([cross build not supported for $host])
347 esac
348 ac_sys_release=
349 else
350 ac_sys_system=`uname -s`
351 if test "$ac_sys_system" = "AIX" \
352 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
353 ac_sys_release=`uname -v`
354 else
355 ac_sys_release=`uname -r`
356 fi
357 fi
358 ac_md_system=`echo $ac_sys_system |
359 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
360 ac_md_release=`echo $ac_sys_release |
361 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
362 MACHDEP="$ac_md_system$ac_md_release"
363
364 case $MACHDEP in
365 linux*) MACHDEP="linux2";;
366 cygwin*) MACHDEP="cygwin";;
367 darwin*) MACHDEP="darwin";;
368 atheos*) MACHDEP="atheos";;
369 irix646) MACHDEP="irix6";;
370 '') MACHDEP="unknown";;
371 esac
372 fi
373
374 AC_SUBST(_PYTHON_HOST_PLATFORM)
375 if test "$cross_compiling" = yes; then
376 case "$host" in
377 *-*-linux*)
378 case "$host_cpu" in
379 arm*)
380 _host_cpu=arm
381 ;;
382 *)
383 _host_cpu=$host_cpu
384 esac
385 ;;
386 *-*-cygwin*)
387 _host_cpu=
388 ;;
389 *)
390 # for now, limit cross builds to known configurations
391 MACHDEP="unknown"
392 AC_MSG_ERROR([cross build not supported for $host])
393 esac
394 _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
395 fi
396
397 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
398 # disable features if it is defined, without any means to access these
399 # features as extensions. For these systems, we skip the definition of
400 # _XOPEN_SOURCE. Before adding a system to the list to gain access to
401 # some feature, make sure there is no alternative way to access this
402 # feature. Also, when using wildcards, make sure you have verified the
403 # need for not defining _XOPEN_SOURCE on all systems matching the
404 # wildcard, and that the wildcard does not include future systems
405 # (which may remove their limitations).
406 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
407 case $ac_sys_system/$ac_sys_release in
408 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
409 # even though select is a POSIX function. Reported by J. Ribbens.
410 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
411 # In addition, Stefan Krah confirms that issue #1244610 exists through
412 # OpenBSD 4.6, but is fixed in 4.7.
413 OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@)
414 define_xopen_source=no
415 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
416 # also defined. This can be overridden by defining _BSD_SOURCE
417 # As this has a different meaning on Linux, only define it on OpenBSD
418 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
419 ;;
420 OpenBSD/*)
421 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
422 # also defined. This can be overridden by defining _BSD_SOURCE
423 # As this has a different meaning on Linux, only define it on OpenBSD
424 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
425 ;;
426 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
427 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
428 # Marc Recht
429 NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
430 define_xopen_source=no;;
431 # From the perspective of Solaris, _XOPEN_SOURCE is not so much a
432 # request to enable features supported by the standard as a request
433 # to disable features not supported by the standard. The best way
434 # for Python to use Solaris is simply to leave _XOPEN_SOURCE out
435 # entirely and define __EXTENSIONS__ instead.
436 SunOS/*)
437 define_xopen_source=no;;
438 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
439 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
440 # Reconfirmed for 7.1.4 by Martin v. Loewis.
441 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
442 define_xopen_source=no;;
443 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
444 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
445 SCO_SV/3.2)
446 define_xopen_source=no;;
447 # On FreeBSD 4, the math functions C89 does not cover are never defined
448 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
449 FreeBSD/4.*)
450 define_xopen_source=no;;
451 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
452 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
453 # identifies itself as Darwin/7.*
454 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
455 # disables platform specific features beyond repair.
456 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
457 # has no effect, don't bother defining them
458 Darwin/@<:@6789@:>@.*)
459 define_xopen_source=no;;
460 Darwin/1@<:@0-9@:>@.*)
461 define_xopen_source=no;;
462 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
463 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
464 # or has another value. By not (re)defining it, the defaults come in place.
465 AIX/4)
466 define_xopen_source=no;;
467 AIX/5)
468 if test `uname -r` -eq 1; then
469 define_xopen_source=no
470 fi
471 ;;
472 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
473 # defining NI_NUMERICHOST.
474 QNX/6.3.2)
475 define_xopen_source=no
476 ;;
477
478 esac
479
480 if test $define_xopen_source = yes
481 then
482 AC_DEFINE(_XOPEN_SOURCE, 600,
483 Define to the level of X/Open that your system supports)
484
485 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
486 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
487 # several APIs are not declared. Since this is also needed in some
488 # cases for HP-UX, we define it globally.
489 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
490 Define to activate Unix95-and-earlier features)
491
492 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
493
494 fi
495
496 #
497 # SGI compilers allow the specification of the both the ABI and the
498 # ISA on the command line. Depending on the values of these switches,
499 # different and often incompatible code will be generated.
500 #
501 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
502 # thus supply support for various ABI/ISA combinations. The MACHDEP
503 # variable is also adjusted.
504 #
505 AC_SUBST(SGI_ABI)
506 if test ! -z "$SGI_ABI"
507 then
508 CC="cc $SGI_ABI"
509 LDFLAGS="$SGI_ABI $LDFLAGS"
510 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
511 fi
512 AC_MSG_RESULT($MACHDEP)
513
514 AC_SUBST(PLATDIR)
515 PLATDIR=plat-$MACHDEP
516
517 # And add extra plat-mac for darwin
518 AC_SUBST(EXTRAPLATDIR)
519 AC_SUBST(EXTRAMACHDEPPATH)
520 AC_MSG_CHECKING(EXTRAPLATDIR)
521 if test -z "$EXTRAPLATDIR"
522 then
523 case $MACHDEP in
524 darwin)
525 EXTRAPLATDIR="\$(PLATMACDIRS)"
526 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
527 ;;
528 *)
529 EXTRAPLATDIR=""
530 EXTRAMACHDEPPATH=""
531 ;;
532 esac
533 fi
534 AC_MSG_RESULT($EXTRAPLATDIR)
535
536 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
537 # it may influence the way we can build extensions, so distutils
538 # needs to check it
539 AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
540 AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
541 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
542 EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
543
544 # checks for alternative programs
545
546 # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
547 # for debug/optimization stuff. BASECFLAGS is for flags that are required
548 # just to get things to compile and link. Users are free to override OPT
549 # when running configure or make. The build should not break if they do.
550 # BASECFLAGS should generally not be messed with, however.
551
552 # XXX shouldn't some/most/all of this code be merged with the stuff later
553 # on that fiddles with OPT and BASECFLAGS?
554 AC_MSG_CHECKING(for --without-gcc)
555 AC_ARG_WITH(gcc,
556 AS_HELP_STRING([--without-gcc], [never use gcc]),
557 [
558 case $withval in
559 no) CC=${CC:-cc}
560 without_gcc=yes;;
561 yes) CC=gcc
562 without_gcc=no;;
563 *) CC=$withval
564 without_gcc=$withval;;
565 esac], [
566 case $ac_sys_system in
567 AIX*) CC=${CC:-xlc_r}
568 without_gcc=;;
569 BeOS*)
570 case $BE_HOST_CPU in
571 ppc)
572 CC=mwcc
573 without_gcc=yes
574 BASECFLAGS="$BASECFLAGS -export pragma"
575 OPT="$OPT -O"
576 LDFLAGS="$LDFLAGS -nodup"
577 ;;
578 x86)
579 CC=gcc
580 without_gcc=no
581 OPT="$OPT -O"
582 ;;
583 *)
584 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
585 ;;
586 esac
587 AR="\$(srcdir)/Modules/ar_beos"
588 RANLIB=:
589 ;;
590 *) without_gcc=no;;
591 esac])
592 AC_MSG_RESULT($without_gcc)
593
594 AC_MSG_CHECKING(for --with-icc)
595 AC_ARG_WITH(icc,
596 AS_HELP_STRING([--with-icc], [build with icc]),
597 [
598 case $withval in
599 no) CC=${CC:-cc}
600 with_icc=no;;
601 yes) CC=icc
602 CXX=icpc
603 with_icc=yes;;
604 *) CC=$withval
605 with_icc=$withval;;
606 esac], [
607 with_icc=no])
608 AC_MSG_RESULT($with_icc)
609
610 # If the user switches compilers, we can't believe the cache
611 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
612 then
613 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
614 (it is also a good idea to do 'make clean' before compiling)])
615 fi
616
617 if test "$MACHDEP" = "irix6" && test "$CC" != "gcc"; then
618 # Normally, MIPSpro CC treats #error directives as warnings, which means
619 # a successful exit code is returned (0). This is a problem because IRIX
620 # has a bunch of system headers with this guard at the top:
621 #
622 # #ifndef __c99
623 # #error This header file is to be used only for c99 mode compilations
624 # #else
625 #
626 # When autoconf tests for such a header, like stdint.h, this happens:
627 #
628 # configure:4619: cc -c conftest.c >&5
629 # cc-1035 cc: WARNING File = /usr/include/stdint.h, Line = 5
630 # #error directive: This header file is to be used only for c99 mode
631 # compilations
632 #
633 # #error This header file is to be used only for c99 mode compilations
634 # ^
635 #
636 # configure:4619: $? = 0
637 # configure:4619: result: yes
638 #
639 # Therefore, we use `-diag_error 1035` to have the compiler treat the
640 # warning as an error, which causes cc to return a non-zero result,
641 # which autoconf can interpret correctly.
642 CFLAGS="$CFLAGS -diag_error 1035"
643 # Whilst we're here, we might as well make sure CXX defaults to something
644 # sensible if we're not using gcc.
645 if test -z "$CXX"; then
646 CXX="CC"
647 fi
648 fi
649
650 # If the user set CFLAGS, use this instead of the automatically
651 # determined setting
652 preset_cflags="$CFLAGS"
653 AC_PROG_CC
654 if test ! -z "$preset_cflags"
655 then
656 CFLAGS=$preset_cflags
657 fi
658
659 AC_SUBST(CXX)
660 AC_SUBST(MAINCC)
661 AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
662 AC_ARG_WITH(cxx_main,
663 AS_HELP_STRING([--with-cxx-main=<compiler>],
664 [compile main() and link python executable with C++ compiler]),
665 [
666
667 case $withval in
668 no) with_cxx_main=no
669 MAINCC='$(CC)';;
670 yes) with_cxx_main=yes
671 MAINCC='$(CXX)';;
672 *) with_cxx_main=yes
673 MAINCC=$withval
674 if test -z "$CXX"
675 then
676 CXX=$withval
677 fi;;
678 esac], [
679 with_cxx_main=no
680 MAINCC='$(CC)'
681 ])
682 AC_MSG_RESULT($with_cxx_main)
683
684 preset_cxx="$CXX"
685 if test -z "$CXX"
686 then
687 case "$CC" in
688 gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
689 cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
690 esac
691 if test "$CXX" = "notfound"
692 then
693 CXX=""
694 fi
695 fi
696 if test -z "$CXX"
697 then
698 AC_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
699 if test "$CXX" = "notfound"
700 then
701 CXX=""
702 fi
703 fi
704 if test "$preset_cxx" != "$CXX"
705 then
706 AC_MSG_WARN([
707
708 By default, distutils will build C++ extension modules with "$CXX".
709 If this is not intended, then set CXX on the configure command line.
710 ])
711 fi
712
713 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
714 AC_SUBST(MULTIARCH)
715
716
717 # checks for UNIX variants that set C preprocessor variables
718 AC_USE_SYSTEM_EXTENSIONS
719
720 # Check for unsupported systems
721 case $ac_sys_system/$ac_sys_release in
722 atheos*|Linux*/1*)
723 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
724 echo See README for details.
725 exit 1;;
726 esac
727
728 AC_EXEEXT
729 AC_MSG_CHECKING(for --with-suffix)
730 AC_ARG_WITH(suffix,
731 AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]),
732 [
733 case $withval in
734 no) EXEEXT=;;
735 yes) EXEEXT=.exe;;
736 *) EXEEXT=$withval;;
737 esac])
738 AC_MSG_RESULT($EXEEXT)
739
740 # Test whether we're running on a non-case-sensitive system, in which
741 # case we give a warning if no ext is given
742 AC_SUBST(BUILDEXEEXT)
743 AC_MSG_CHECKING(for case-insensitive build directory)
744 if test ! -d CaseSensitiveTestDir; then
745 mkdir CaseSensitiveTestDir
746 fi
747
748 if test -d casesensitivetestdir
749 then
750 AC_MSG_RESULT(yes)
751 BUILDEXEEXT=.exe
752 else
753 AC_MSG_RESULT(no)
754 BUILDEXEEXT=$EXEEXT
755 fi
756 rmdir CaseSensitiveTestDir
757
758 case $MACHDEP in
759 bsdos*)
760 case $CC in
761 gcc) CC="$CC -D_HAVE_BSDI";;
762 esac;;
763 esac
764
765 case $ac_sys_system in
766 hp*|HP*)
767 case $CC in
768 cc|*/cc) CC="$CC -Ae";;
769 esac;;
770 SunOS*)
771 # Some functions have a prototype only with that define, e.g. confstr
772 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
773 ;;
774 esac
775
776
777 AC_SUBST(LIBRARY)
778 AC_MSG_CHECKING(LIBRARY)
779 if test -z "$LIBRARY"
780 then
781 LIBRARY='libpython$(VERSION).a'
782 fi
783 AC_MSG_RESULT($LIBRARY)
784
785 # LDLIBRARY is the name of the library to link against (as opposed to the
786 # name of the library into which to insert object files). BLDLIBRARY is also
787 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
788 # is blank as the main program is not linked directly against LDLIBRARY.
789 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
790 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
791 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
792 # DLLLIBRARY is the shared (i.e., DLL) library.
793 #
794 # RUNSHARED is used to run shared python without installed libraries
795 #
796 # INSTSONAME is the name of the shared library that will be use to install
797 # on the system - some systems like version suffix, others don't
798 AC_SUBST(LDLIBRARY)
799 AC_SUBST(DLLLIBRARY)
800 AC_SUBST(BLDLIBRARY)
801 AC_SUBST(LDLIBRARYDIR)
802 AC_SUBST(INSTSONAME)
803 AC_SUBST(RUNSHARED)
804 LDLIBRARY="$LIBRARY"
805 BLDLIBRARY='$(LDLIBRARY)'
806 INSTSONAME='$(LDLIBRARY)'
807 DLLLIBRARY=''
808 LDLIBRARYDIR=''
809 RUNSHARED=''
810
811 # LINKCC is the command that links the python executable -- default is $(CC).
812 # If CXX is set, and if it is needed to link a main function that was
813 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
814 # python might then depend on the C++ runtime
815 # This is altered for AIX in order to build the export list before
816 # linking.
817 AC_SUBST(LINKCC)
818 AC_MSG_CHECKING(LINKCC)
819 if test -z "$LINKCC"
820 then
821 LINKCC='$(PURIFY) $(MAINCC)'
822 case $ac_sys_system in
823 AIX*)
824 exp_extra="\"\""
825 if test $ac_sys_release -ge 5 -o \
826 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
827 exp_extra="."
828 fi
829 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
830 QNX*)
831 # qcc must be used because the other compilers do not
832 # support -N.
833 LINKCC=qcc;;
834 esac
835 fi
836 AC_MSG_RESULT($LINKCC)
837
838 # GNULD is set to "yes" if the GNU linker is used. If this goes wrong
839 # make sure we default having it set to "no": this is used by
840 # distutils.unixccompiler to know if it should add --enable-new-dtags
841 # to linker command lines, and failing to detect GNU ld simply results
842 # in the same bahaviour as before.
843 AC_SUBST(GNULD)
844 AC_MSG_CHECKING(for GNU ld)
845 ac_prog=ld
846 if test "$GCC" = yes; then
847 ac_prog=`$CC -print-prog-name=ld`
848 fi
849 case `"$ac_prog" -V 2>&1 < /dev/null` in
850 *GNU*)
851 GNULD=yes;;
852 *)
853 GNULD=no;;
854 esac
855 AC_MSG_RESULT($GNULD)
856
857 AC_MSG_CHECKING(for --enable-shared)
858 AC_ARG_ENABLE(shared,
859 AS_HELP_STRING([--enable-shared], [disable/enable building shared python library]))
860
861 if test -z "$enable_shared"
862 then
863 case $ac_sys_system in
864 CYGWIN* | atheos*)
865 enable_shared="yes";;
866 *)
867 enable_shared="no";;
868 esac
869 fi
870 AC_MSG_RESULT($enable_shared)
871
872 AC_MSG_CHECKING(for --enable-profiling)
873 AC_ARG_ENABLE(profiling,
874 AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]))
875 if test "x$enable_profiling" = xyes; then
876 ac_save_cc="$CC"
877 CC="$CC -pg"
878 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
879 [],
880 [enable_profiling=no])
881 CC="$ac_save_cc"
882 else
883 enable_profiling=no
884 fi
885 AC_MSG_RESULT($enable_profiling)
886
887 if test "x$enable_profiling" = xyes; then
888 BASECFLAGS="-pg $BASECFLAGS"
889 LDFLAGS="-pg $LDFLAGS"
890 fi
891
892 AC_MSG_CHECKING(LDLIBRARY)
893
894 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
895 # library that we build, but we do not want to link against it (we
896 # will find it with a -framework option). For this reason there is an
897 # extra variable BLDLIBRARY against which Python and the extension
898 # modules are linked, BLDLIBRARY. This is normally the same as
899 # LDLIBRARY, but empty for MacOSX framework builds.
900 if test "$enable_framework"
901 then
902 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
903 RUNSHARED=DYLD_FRAMEWORK_PATH=`pwd`${DYLD_FRAMEWORK_PATH:+:${DYLD_FRAMEWORK_PATH}}
904 BLDLIBRARY=''
905 else
906 BLDLIBRARY='$(LDLIBRARY)'
907 fi
908
909 # Other platforms follow
910 if test $enable_shared = "yes"; then
911 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
912 case $ac_sys_system in
913 BeOS*)
914 LDLIBRARY='libpython$(VERSION).so'
915 ;;
916 CYGWIN*)
917 LDLIBRARY='libpython$(VERSION).dll.a'
918 DLLLIBRARY='libpython$(VERSION).dll'
919 ;;
920 SunOS*)
921 LDLIBRARY='libpython$(VERSION).so'
922 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
923 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
924 INSTSONAME="$LDLIBRARY".$SOVERSION
925 ;;
926 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
927 LDLIBRARY='libpython$(VERSION).so'
928 BLDLIBRARY='-L. -lpython$(VERSION)'
929 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
930 case $ac_sys_system in
931 FreeBSD*)
932 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
933 ;;
934 esac
935 INSTSONAME="$LDLIBRARY".$SOVERSION
936 ;;
937 hp*|HP*)
938 case `uname -m` in
939 ia64)
940 LDLIBRARY='libpython$(VERSION).so'
941 ;;
942 *)
943 LDLIBRARY='libpython$(VERSION).sl'
944 ;;
945 esac
946 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
947 RUNSHARED=SHLIB_PATH=`pwd`${SHLIB_PATH:+:${SHLIB_PATH}}
948 ;;
949 OSF*)
950 LDLIBRARY='libpython$(VERSION).so'
951 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
952 RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
953 ;;
954 atheos*)
955 LDLIBRARY='libpython$(VERSION).so'
956 BLDLIBRARY='-L. -lpython$(VERSION)'
957 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
958 ;;
959 Darwin*)
960 LDLIBRARY='libpython$(VERSION).dylib'
961 BLDLIBRARY='-L. -lpython$(VERSION)'
962 RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
963 ;;
964 AIX*)
965 LDLIBRARY='libpython$(VERSION).so'
966 RUNSHARED=LIBPATH=`pwd`${LIBPATH:+:${LIBPATH}}
967 ;;
968
969 esac
970 else # shared is disabled
971 case $ac_sys_system in
972 CYGWIN*)
973 BLDLIBRARY='$(LIBRARY)'
974 LDLIBRARY='libpython$(VERSION).dll.a'
975 ;;
976 esac
977 fi
978
979 if test "$cross_compiling" = yes; then
980 RUNSHARED=
981 fi
982
983 AC_MSG_RESULT($LDLIBRARY)
984
985 AC_PROG_RANLIB
986 AC_SUBST(AR)
987 AC_CHECK_TOOLS(AR, ar aal, ar)
988
989 # tweak ARFLAGS only if the user didn't set it on the command line
990 AC_SUBST(ARFLAGS)
991 if test -z "$ARFLAGS"
992 then
993 ARFLAGS="rc"
994 fi
995
996 AC_SUBST(GITVERSION)
997 AC_SUBST(GITTAG)
998 AC_SUBST(GITBRANCH)
999
1000 if test -e $srcdir/.git
1001 then
1002 AC_CHECK_PROG(HAS_GIT, git, found, not-found)
1003 else
1004 HAS_GIT=no-repository
1005 fi
1006 if test $HAS_GIT = found
1007 then
1008 GITVERSION="git --git-dir \$(srcdir)/.git rev-parse --short HEAD"
1009 GITTAG="git --git-dir \$(srcdir)/.git describe --all --always --dirty"
1010 GITBRANCH="git --git-dir \$(srcdir)/.git name-rev --name-only HEAD"
1011 else
1012 GITVERSION=""
1013 GITTAG=""
1014 GITBRANCH=""
1015 fi
1016
1017 case $MACHDEP in
1018 bsdos*|hp*|HP*)
1019 # install -d does not work on BSDI or HP-UX
1020 if test -z "$INSTALL"
1021 then
1022 INSTALL="${srcdir}/install-sh -c"
1023 fi
1024 esac
1025 AC_PROG_INSTALL
1026 AC_PROG_MKDIR_P
1027
1028 # Not every filesystem supports hard links
1029 AC_SUBST(LN)
1030 if test -z "$LN" ; then
1031 case $ac_sys_system in
1032 BeOS*) LN="ln -s";;
1033 CYGWIN*) LN="ln -s";;
1034 atheos*) LN="ln -s";;
1035 *) LN=ln;;
1036 esac
1037 fi
1038
1039 # Check for --with-pydebug
1040 AC_MSG_CHECKING(for --with-pydebug)
1041 AC_ARG_WITH(pydebug,
1042 AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]),
1043 [
1044 if test "$withval" != no
1045 then
1046 AC_DEFINE(Py_DEBUG, 1,
1047 [Define if you want to build an interpreter with many run-time checks.])
1048 AC_MSG_RESULT(yes);
1049 Py_DEBUG='true'
1050 else AC_MSG_RESULT(no); Py_DEBUG='false'
1051 fi],
1052 [AC_MSG_RESULT(no)])
1053
1054 # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
1055 # merged with this chunk of code?
1056
1057 # Optimizer/debugger flags
1058 # ------------------------
1059 # (The following bit of code is complicated enough - please keep things
1060 # indented properly. Just pretend you're editing Python code. ;-)
1061
1062 # There are two parallel sets of case statements below, one that checks to
1063 # see if OPT was set and one that does BASECFLAGS setting based upon
1064 # compiler and platform. BASECFLAGS tweaks need to be made even if the
1065 # user set OPT.
1066
1067 # tweak OPT based on compiler and platform, only if the user didn't set
1068 # it on the command line
1069 AC_SUBST(OPT)
1070 if test "${OPT-unset}" = "unset"
1071 then
1072 case $GCC in
1073 yes)
1074 if test "$CC" != 'g++' ; then
1075 STRICT_PROTO="-Wstrict-prototypes"
1076 fi
1077 # For gcc 4.x we need to use -fwrapv so lets check if its supported
1078 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
1079 WRAP="-fwrapv"
1080 fi
1081
1082 # Clang also needs -fwrapv
1083 case $CC in
1084 *clang*) WRAP="-fwrapv"
1085 ;;
1086 esac
1087
1088 case $ac_cv_prog_cc_g in
1089 yes)
1090 if test "$Py_DEBUG" = 'true' ; then
1091 # Optimization messes up debuggers, so turn it off for
1092 # debug builds.
1093 OPT="-g -O0 -Wall $STRICT_PROTO"
1094 else
1095 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
1096 fi
1097 ;;
1098 *)
1099 OPT="-O3 -Wall $STRICT_PROTO"
1100 ;;
1101 esac
1102 case $ac_sys_system in
1103 SCO_SV*) OPT="$OPT -m486 -DSCO5"
1104 ;;
1105 esac
1106 ;;
1107
1108 *)
1109 OPT="-O"
1110 ;;
1111 esac
1112 fi
1113
1114 AC_SUBST(BASECFLAGS)
1115
1116 # The -arch flags for universal builds on OSX
1117 UNIVERSAL_ARCH_FLAGS=
1118 AC_SUBST(UNIVERSAL_ARCH_FLAGS)
1119
1120 # tweak BASECFLAGS based on compiler and platform
1121 case $GCC in
1122 yes)
1123 # Python violates C99 rules, by casting between incompatible
1124 # pointer types. GCC may generate bad code as a result of that,
1125 # so use -fno-strict-aliasing if supported.
1126 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
1127 ac_save_cc="$CC"
1128 CC="$CC -fno-strict-aliasing"
1129 AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
1130 AC_COMPILE_IFELSE(
1131 [AC_LANG_PROGRAM([[]], [[]])],
1132 [ac_cv_no_strict_aliasing_ok=yes],
1133 [ac_cv_no_strict_aliasing_ok=no]))
1134 CC="$ac_save_cc"
1135 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
1136 if test $ac_cv_no_strict_aliasing_ok = yes
1137 then
1138 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
1139 fi
1140
1141 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
1142 # support. Without this, treatment of subnormals doesn't follow
1143 # the standard.
1144 case $host in
1145 alpha*)
1146 BASECFLAGS="$BASECFLAGS -mieee"
1147 ;;
1148 esac
1149
1150 case $ac_sys_system in
1151 SCO_SV*)
1152 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
1153 ;;
1154 # is there any other compiler on Darwin besides gcc?
1155 Darwin*)
1156 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
1157 # used to be here, but non-Apple gcc doesn't accept them.
1158 if test "${CC}" = gcc
1159 then
1160 AC_MSG_CHECKING(which compiler should be used)
1161 case "${UNIVERSALSDK}" in
1162 */MacOSX10.4u.sdk)
1163 # Build using 10.4 SDK, force usage of gcc when the
1164 # compiler is gcc, otherwise the user will get very
1165 # confusing error messages when building on OSX 10.6
1166 CC=gcc-4.0
1167 CPP=cpp-4.0
1168 ;;
1169 esac
1170 AC_MSG_RESULT($CC)
1171 fi
1172
1173 if test "${enable_universalsdk}"
1174 then
1175 case "$UNIVERSAL_ARCHS" in
1176 32-bit)
1177 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
1178 LIPO_32BIT_FLAGS=""
1179 ARCH_RUN_32BIT=""
1180 ;;
1181 64-bit)
1182 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
1183 LIPO_32BIT_FLAGS=""
1184 ARCH_RUN_32BIT=""
1185 ;;
1186 all)
1187 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
1188 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
1189 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
1190 ;;
1191 intel)
1192 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
1193 LIPO_32BIT_FLAGS="-extract i386"
1194 ARCH_RUN_32BIT="/usr/bin/arch -i386"
1195 ;;
1196 intel-32)
1197 UNIVERSAL_ARCH_FLAGS="-arch i386"
1198 LIPO_32BIT_FLAGS=""
1199 ARCH_RUN_32BIT=""
1200 ;;
1201 intel-64)
1202 UNIVERSAL_ARCH_FLAGS="-arch x86_64"
1203 LIPO_32BIT_FLAGS=""
1204 ARCH_RUN_32BIT=""
1205 ;;
1206 3-way)
1207 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
1208 LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
1209 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
1210 ;;
1211 *)
1212 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
1213 ;;
1214 esac
1215
1216 if test "${UNIVERSALSDK}" != "/"
1217 then
1218 CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
1219 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1220 CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
1221 else
1222 CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
1223 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} ${LDFLAGS}"
1224 fi
1225 fi
1226
1227 # Calculate an appropriate deployment target for this build:
1228 # The deployment target value is used explicitly to enable certain
1229 # features are enabled (such as builtin libedit support for readline)
1230 # through the use of Apple's Availability Macros and is used as a
1231 # component of the string returned by distutils.get_platform().
1232 #
1233 # Use the value from:
1234 # 1. the MACOSX_DEPLOYMENT_TARGET environment variable if specified
1235 # 2. the operating system version of the build machine if >= 10.6
1236 # 3. If running on OS X 10.3 through 10.5, use the legacy tests
1237 # below to pick either 10.3, 10.4, or 10.5 as the target.
1238 # 4. If we are running on OS X 10.2 or earlier, good luck!
1239
1240 AC_MSG_CHECKING(which MACOSX_DEPLOYMENT_TARGET to use)
1241 cur_target_major=`sw_vers -productVersion | \
1242 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
1243 cur_target_minor=`sw_vers -productVersion | \
1244 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
1245 cur_target="${cur_target_major}.${cur_target_minor}"
1246 if test ${cur_target_major} -eq 10 && \
1247 test ${cur_target_minor} -ge 3 && \
1248 test ${cur_target_minor} -le 5
1249 then
1250 # OS X 10.3 through 10.5
1251 cur_target=10.3
1252 if test ${enable_universalsdk}
1253 then
1254 case "$UNIVERSAL_ARCHS" in
1255 all|3-way|intel|64-bit)
1256 # These configurations were first supported in 10.5
1257 cur_target='10.5'
1258 ;;
1259 esac
1260 else
1261 if test `/usr/bin/arch` = "i386"
1262 then
1263 # 10.4 was the first release to support Intel archs
1264 cur_target="10.4"
1265 fi
1266 fi
1267 fi
1268 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1269
1270 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1271 # environment with a value that is the same as what we'll use
1272 # in the Makefile to ensure that we'll get the same compiler
1273 # environment during configure and build time.
1274 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1275 export MACOSX_DEPLOYMENT_TARGET
1276 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1277 AC_MSG_RESULT($MACOSX_DEPLOYMENT_TARGET)
1278
1279 # end of Darwin* tests
1280 ;;
1281 OSF*)
1282 BASECFLAGS="$BASECFLAGS -mieee"
1283 ;;
1284 esac
1285 ;;
1286
1287 *)
1288 case $ac_sys_system in
1289 OpenUNIX*|UnixWare*)
1290 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1291 ;;
1292 OSF*)
1293 BASECFLAGS="$BASECFLAGS -ieee -std"
1294 ;;
1295 SCO_SV*)
1296 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1297 ;;
1298 esac
1299 ;;
1300 esac
1301
1302 # ICC needs -fp-model strict or floats behave badly
1303 case "$CC" in
1304 *icc*)
1305 BASECFLAGS="$BASECFLAGS -fp-model strict"
1306 ;;
1307 esac
1308
1309 if test "$Py_DEBUG" = 'true'; then
1310 :
1311 else
1312 OPT="-DNDEBUG $OPT"
1313 fi
1314
1315 if test "$ac_arch_flags"
1316 then
1317 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
1318 fi
1319
1320 # disable check for icc since it seems to pass, but generates a warning
1321 if test "$CC" = icc
1322 then
1323 ac_cv_opt_olimit_ok=no
1324 fi
1325
1326 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1327 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1328 [ac_save_cc="$CC"
1329 CC="$CC -OPT:Olimit=0"
1330 AC_COMPILE_IFELSE(
1331 [AC_LANG_PROGRAM([[]], [[]])],
1332 [ac_cv_opt_olimit_ok=yes],
1333 [ac_cv_opt_olimit_ok=no]
1334 )
1335 CC="$ac_save_cc"])
1336 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
1337 if test $ac_cv_opt_olimit_ok = yes; then
1338 case $ac_sys_system in
1339 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1340 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1341 # environment?
1342 Darwin*)
1343 ;;
1344 # XXX thankfully this useless troublemaker of a flag has been
1345 # eradicated in the 3.x line. For now, make sure it isn't picked
1346 # up by any of our other platforms that use CC.
1347 AIX*|SunOS*|HP-UX*|IRIX*)
1348 ;;
1349 *)
1350 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1351 ;;
1352 esac
1353 else
1354 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1355 AC_CACHE_VAL(ac_cv_olimit_ok,
1356 [ac_save_cc="$CC"
1357 CC="$CC -Olimit 1500"
1358 AC_COMPILE_IFELSE(
1359 [AC_LANG_PROGRAM([[]], [[]])],
1360 [ac_cv_olimit_ok=yes],
1361 [ac_cv_olimit_ok=no]
1362 )
1363 CC="$ac_save_cc"])
1364 AC_MSG_RESULT($ac_cv_olimit_ok)
1365 if test $ac_cv_olimit_ok = yes; then
1366 case $ac_sys_system in
1367 # Issue #16534: On HP-UX ac_cv_olimit_ok=yes is a false positive.
1368 HP-UX*)
1369 ;;
1370 *)
1371 BASECFLAGS="$BASECFLAGS -Olimit 1500"
1372 ;;
1373 esac
1374 fi
1375 fi
1376
1377 # Check whether GCC supports PyArg_ParseTuple format
1378 if test "$GCC" = "yes"
1379 then
1380 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1381 save_CFLAGS=$CFLAGS
1382 CFLAGS="$CFLAGS -Werror -Wformat"
1383 AC_COMPILE_IFELSE([
1384 AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
1385 ],[
1386 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1,
1387 [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1388 AC_MSG_RESULT(yes)
1389 ],[
1390 AC_MSG_RESULT(no)
1391 ])
1392 CFLAGS=$save_CFLAGS
1393 fi
1394
1395
1396 # Enable optimization flags
1397 AC_SUBST(DEF_MAKE_ALL_RULE)
1398 AC_SUBST(DEF_MAKE_RULE)
1399 Py_OPT='false'
1400 AC_MSG_CHECKING(for --enable-optimizations)
1401 AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--enable-optimizations], [Enable expensive optimizations (PGO, maybe LTO, etc). Disabled by default.]),
1402 [
1403 if test "$enableval" != no
1404 then
1405 Py_OPT='true'
1406 AC_MSG_RESULT(yes);
1407 else
1408 Py_OPT='false'
1409 AC_MSG_RESULT(no);
1410 fi],
1411 [AC_MSG_RESULT(no)])
1412 if test "$Py_OPT" = 'true' ; then
1413 # Intentionally not forcing Py_LTO='true' here. Too many toolchains do not
1414 # compile working code using it and both test_distutils and test_gdb are
1415 # broken when you do managed to get a toolchain that works with it. People
1416 # who want LTO need to use --with-lto themselves.
1417 DEF_MAKE_ALL_RULE="profile-opt"
1418 REQUIRE_PGO="yes"
1419 DEF_MAKE_RULE="build_all"
1420 else
1421 DEF_MAKE_ALL_RULE="build_all"
1422 REQUIRE_PGO="no"
1423 DEF_MAKE_RULE="all"
1424 fi
1425
1426
1427 # Enable LTO flags
1428 AC_SUBST(LTOFLAGS)
1429 AC_MSG_CHECKING(for --with-lto)
1430 AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable Link Time Optimization in PGO builds. Disabled by default.]),
1431 [
1432 if test "$withval" != no
1433 then
1434 Py_LTO='true'
1435 AC_MSG_RESULT(yes);
1436 else
1437 Py_LTO='false'
1438 AC_MSG_RESULT(no);
1439 fi],
1440 [AC_MSG_RESULT(no)])
1441 if test "$Py_LTO" = 'true' ; then
1442 case $CC in
1443 *clang*)
1444 # Any changes made here should be reflected in the GCC+Darwin case below
1445 LTOFLAGS="-flto"
1446 ;;
1447 *gcc*)
1448 case $ac_sys_system in
1449 Darwin*)
1450 LTOFLAGS="-flto"
1451 ;;
1452 *)
1453 LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
1454 ;;
1455 esac
1456 ;;
1457 esac
1458
1459 if test "$ac_cv_prog_cc_g" = "yes"
1460 then
1461 # bpo-30345: Add -g to LDFLAGS when compiling with LTO
1462 # to get debug symbols.
1463 LTOFLAGS="$LTOFLAGS -g"
1464 fi
1465 fi
1466
1467
1468 # Enable PGO flags.
1469 AC_SUBST(PGO_PROF_GEN_FLAG)
1470 AC_SUBST(PGO_PROF_USE_FLAG)
1471 AC_SUBST(LLVM_PROF_MERGER)
1472 AC_SUBST(LLVM_PROF_FILE)
1473 AC_SUBST(LLVM_PROF_ERR)
1474 # Make this work on systems where llvm tools are not installed with their
1475 # normal names in the default $PATH (ie: Ubuntu). They exist under the
1476 # non-suffixed name in their versioned llvm directory.
1477 llvm_bin_dir=''
1478 llvm_path="${PATH}"
1479 if test "${CC}" = "clang"
1480 then
1481 clang_bin=`which clang`
1482 # Some systems install clang elsewhere as a symlink to the real path
1483 # which is where the related llvm tools are located.
1484 if test -L "${clang_bin}"
1485 then
1486 clang_dir=`dirname "${clang_bin}"`
1487 clang_bin=`readlink "${clang_bin}"`
1488 llvm_bin_dir="${clang_dir}/"`dirname "${clang_bin}"`
1489 llvm_path="${llvm_path}${PATH_SEPARATOR}${llvm_bin_dir}"
1490 fi
1491 fi
1492 AC_SUBST(LLVM_PROFDATA)
1493 AC_PATH_TARGET_TOOL(LLVM_PROFDATA, llvm-profdata, '', ${llvm_path})
1494 AC_SUBST(LLVM_PROF_FOUND)
1495 if test -n "${LLVM_PROFDATA}" -a -x "${LLVM_PROFDATA}"
1496 then
1497 LLVM_PROF_FOUND="found"
1498 else
1499 LLVM_PROF_FOUND="not-found"
1500 fi
1501 if test "$ac_sys_system" = "Darwin" -a "${LLVM_PROF_FOUND}" = "not-found"
1502 then
1503 found_llvm_profdata=`/usr/bin/xcrun -find llvm-profdata 2>/dev/null`
1504 if test -n "${found_llvm_profdata}"
1505 then
1506 # llvm-profdata isn't directly in $PATH in some cases.
1507 # https://apple.stackexchange.com/questions/197053/
1508 LLVM_PROFDATA='/usr/bin/xcrun llvm-profdata'
1509 LLVM_PROF_FOUND=found
1510 AC_MSG_NOTICE([llvm-profdata found via xcrun: ${LLVM_PROFDATA}])
1511 fi
1512 fi
1513 LLVM_PROF_ERR=no
1514 case $CC in
1515 *clang*)
1516 # Any changes made here should be reflected in the GCC+Darwin case below
1517 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
1518 PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
1519 LLVM_PROF_MERGER="${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr"
1520 LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
1521 if test $LLVM_PROF_FOUND = not-found
1522 then
1523 LLVM_PROF_ERR=yes
1524 if test "${REQUIRE_PGO}" = "yes"
1525 then
1526 AC_MSG_ERROR([llvm-profdata is required for a --enable-optimizations build but could not be found.])
1527 fi
1528 fi
1529 ;;
1530 *gcc*)
1531 case $ac_sys_system in
1532 Darwin*)
1533 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
1534 PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"
1535 LLVM_PROF_MERGER="${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr"
1536 LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"code-%p.profclangr\""
1537 if test "${LLVM_PROF_FOUND}" = "not-found"
1538 then
1539 LLVM_PROF_ERR=yes
1540 if test "${REQUIRE_PGO}" = "yes"
1541 then
1542 AC_MSG_ERROR([llvm-profdata is required for a --enable-optimizations build but could not be found.])
1543 fi
1544 fi
1545 ;;
1546 *)
1547 PGO_PROF_GEN_FLAG="-fprofile-generate"
1548 PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
1549 LLVM_PROF_MERGER="true"
1550 LLVM_PROF_FILE=""
1551 ;;
1552 esac
1553 ;;
1554 *icc*)
1555 PGO_PROF_GEN_FLAG="-prof-gen"
1556 PGO_PROF_USE_FLAG="-prof-use"
1557 LLVM_PROF_MERGER="true"
1558 LLVM_PROF_FILE=""
1559 ;;
1560 esac
1561
1562
1563 # On some compilers, pthreads are available without further options
1564 # (e.g. MacOS X). On some of these systems, the compiler will not
1565 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1566 # So we have to see first whether pthreads are available without
1567 # options before we can check whether -Kpthread improves anything.
1568 AC_MSG_CHECKING(whether pthreads are available without options)
1569 AC_CACHE_VAL(ac_cv_pthread_is_default,
1570 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
1571 #include <stdio.h>
1572 #include <pthread.h>
1573
1574 void* routine(void* p){return NULL;}
1575
1576 int main(){
1577 pthread_t p;
1578 if(pthread_create(&p,NULL,routine,NULL)!=0)
1579 return 1;
1580 (void)pthread_detach(p);
1581 return 0;
1582 }
1583 ]])],[
1584 ac_cv_pthread_is_default=yes
1585 ac_cv_kthread=no
1586 ac_cv_pthread=no
1587 ],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no])
1588 ])
1589 AC_MSG_RESULT($ac_cv_pthread_is_default)
1590
1591
1592 if test $ac_cv_pthread_is_default = yes
1593 then
1594 ac_cv_kpthread=no
1595 else
1596 # -Kpthread, if available, provides the right #defines
1597 # and linker options to make pthread_create available
1598 # Some compilers won't report that they do not support -Kpthread,
1599 # so we need to run a program to see whether it really made the
1600 # function available.
1601 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1602 AC_CACHE_VAL(ac_cv_kpthread,
1603 [ac_save_cc="$CC"
1604 CC="$CC -Kpthread"
1605 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1606 #include <stdio.h>
1607 #include <pthread.h>
1608
1609 void* routine(void* p){return NULL;}
1610
1611 int main(){
1612 pthread_t p;
1613 if(pthread_create(&p,NULL,routine,NULL)!=0)
1614 return 1;
1615 (void)pthread_detach(p);
1616 return 0;
1617 }
1618 ]])],[ac_cv_kpthread=yes],[ac_cv_kpthread=no],[ac_cv_kpthread=no])
1619 CC="$ac_save_cc"])
1620 AC_MSG_RESULT($ac_cv_kpthread)
1621 fi
1622
1623 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
1624 then
1625 # -Kthread, if available, provides the right #defines
1626 # and linker options to make pthread_create available
1627 # Some compilers won't report that they do not support -Kthread,
1628 # so we need to run a program to see whether it really made the
1629 # function available.
1630 AC_MSG_CHECKING(whether $CC accepts -Kthread)
1631 AC_CACHE_VAL(ac_cv_kthread,
1632 [ac_save_cc="$CC"
1633 CC="$CC -Kthread"
1634 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1635 #include <stdio.h>
1636 #include <pthread.h>
1637
1638 void* routine(void* p){return NULL;}
1639
1640 int main(){
1641 pthread_t p;
1642 if(pthread_create(&p,NULL,routine,NULL)!=0)
1643 return 1;
1644 (void)pthread_detach(p);
1645 return 0;
1646 }
1647 ]])],[ac_cv_kthread=yes],[ac_cv_kthread=no],[ac_cv_kthread=no])
1648 CC="$ac_save_cc"])
1649 AC_MSG_RESULT($ac_cv_kthread)
1650 fi
1651
1652 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
1653 then
1654 # -pthread, if available, provides the right #defines
1655 # and linker options to make pthread_create available
1656 # Some compilers won't report that they do not support -pthread,
1657 # so we need to run a program to see whether it really made the
1658 # function available.
1659 AC_MSG_CHECKING(whether $CC accepts -pthread)
1660 AC_CACHE_VAL(ac_cv_pthread,
1661 [ac_save_cc="$CC"
1662 CC="$CC -pthread"
1663 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1664 #include <stdio.h>
1665 #include <pthread.h>
1666
1667 void* routine(void* p){return NULL;}
1668
1669 int main(){
1670 pthread_t p;
1671 if(pthread_create(&p,NULL,routine,NULL)!=0)
1672 return 1;
1673 (void)pthread_detach(p);
1674 return 0;
1675 }
1676 ]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
1677 CC="$ac_save_cc"])
1678 AC_MSG_RESULT($ac_cv_pthread)
1679 fi
1680
1681 # If we have set a CC compiler flag for thread support then
1682 # check if it works for CXX, too.
1683 ac_cv_cxx_thread=no
1684 if test ! -z "$CXX"
1685 then
1686 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1687 ac_save_cxx="$CXX"
1688
1689 if test "$ac_cv_kpthread" = "yes"
1690 then
1691 CXX="$CXX -Kpthread"
1692 ac_cv_cxx_thread=yes
1693 elif test "$ac_cv_kthread" = "yes"
1694 then
1695 CXX="$CXX -Kthread"
1696 ac_cv_cxx_thread=yes
1697 elif test "$ac_cv_pthread" = "yes"
1698 then
1699 CXX="$CXX -pthread"
1700 ac_cv_cxx_thread=yes
1701 fi
1702
1703 if test $ac_cv_cxx_thread = yes
1704 then
1705 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1706 $CXX -c conftest.$ac_ext 2>&5
1707 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1708 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1709 then
1710 ac_cv_cxx_thread=yes
1711 else
1712 ac_cv_cxx_thread=no
1713 fi
1714 rm -fr conftest*
1715 fi
1716 AC_MSG_RESULT($ac_cv_cxx_thread)
1717 fi
1718 CXX="$ac_save_cxx"
1719
1720 dnl # check for ANSI or K&R ("traditional") preprocessor
1721 dnl AC_MSG_CHECKING(for C preprocessor type)
1722 dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1723 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1724 dnl int foo;
1725 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1726 dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional])
1727 dnl AC_MSG_RESULT($cpp_type)
1728
1729 # checks for header files
1730 AC_HEADER_STDC
1731 AC_CHECK_HEADERS(asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \
1732 fcntl.h grp.h \
1733 ieeefp.h io.h langinfo.h libintl.h poll.h process.h pthread.h \
1734 shadow.h signal.h stdint.h stropts.h termios.h thread.h \
1735 unistd.h utime.h \
1736 sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1737 sys/lock.h sys/mkdev.h sys/modem.h \
1738 sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
1739 sys/termio.h sys/time.h \
1740 sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
1741 sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1742 bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h)
1743 AC_HEADER_DIRENT
1744 AC_HEADER_MAJOR
1745
1746 # On Linux, netlink.h requires asm/types.h
1747 AC_CHECK_HEADERS(linux/netlink.h,,,[
1748 #ifdef HAVE_ASM_TYPES_H
1749 #include <asm/types.h>
1750 #endif
1751 #ifdef HAVE_SYS_SOCKET_H
1752 #include <sys/socket.h>
1753 #endif
1754 ])
1755
1756 # checks for typedefs
1757 was_it_defined=no
1758 AC_MSG_CHECKING(for clock_t in time.h)
1759 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1760 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1761 ])
1762 AC_MSG_RESULT($was_it_defined)
1763
1764 # Check whether using makedev requires defining _OSF_SOURCE
1765 AC_MSG_CHECKING(for makedev)
1766 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1767 #if defined(MAJOR_IN_MKDEV)
1768 #include <sys/mkdev.h>
1769 #elif defined(MAJOR_IN_SYSMACROS)
1770 #include <sys/sysmacros.h>
1771 #else
1772 #include <sys/types.h>
1773 #endif ]], [[ makedev(0, 0) ]])],
1774 [ac_cv_has_makedev=yes],
1775 [ac_cv_has_makedev=no])
1776 if test "$ac_cv_has_makedev" = "no"; then
1777 # we didn't link, try if _OSF_SOURCE will allow us to link
1778 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1779 #define _OSF_SOURCE 1
1780 #include <sys/types.h>
1781 ]], [[ makedev(0, 0) ]])],
1782 [ac_cv_has_makedev=yes],
1783 [ac_cv_has_makedev=no])
1784 if test "$ac_cv_has_makedev" = "yes"; then
1785 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1786 fi
1787 fi
1788 AC_MSG_RESULT($ac_cv_has_makedev)
1789 if test "$ac_cv_has_makedev" = "yes"; then
1790 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1791 fi
1792
1793 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1794 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1795 # defined, but the compiler does not support pragma redefine_extname,
1796 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1797 # structures (such as rlimit64) without declaring them. As a
1798 # work-around, disable LFS on such configurations
1799
1800 use_lfs=yes
1801 AC_MSG_CHECKING(Solaris LFS bug)
1802 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1803 #define _LARGEFILE_SOURCE 1
1804 #define _FILE_OFFSET_BITS 64
1805 #include <sys/resource.h>
1806 ]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes])
1807 AC_MSG_RESULT($sol_lfs_bug)
1808 if test "$sol_lfs_bug" = "yes"; then
1809 use_lfs=no
1810 fi
1811
1812 if test "$use_lfs" = "yes"; then
1813 # Two defines needed to enable largefile support on various platforms
1814 # These may affect some typedefs
1815 case $ac_sys_system/$ac_sys_release in
1816 AIX*)
1817 AC_DEFINE(_LARGE_FILES, 1,
1818 [This must be defined on AIX systems to enable large file support.])
1819 ;;
1820 esac
1821 AC_DEFINE(_LARGEFILE_SOURCE, 1,
1822 [This must be defined on some systems to enable large file support.])
1823 AC_DEFINE(_FILE_OFFSET_BITS, 64,
1824 [This must be set to 64 on some systems to enable large file support.])
1825 fi
1826
1827 # Add some code to confdefs.h so that the test for off_t works on SCO
1828 cat >> confdefs.h <<\EOF
1829 #if defined(SCO_DS)
1830 #undef _OFF_T
1831 #endif
1832 EOF
1833
1834 # Type availability checks
1835 AC_TYPE_MODE_T
1836 AC_TYPE_OFF_T
1837 AC_TYPE_PID_T
1838 AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
1839 AC_TYPE_SIZE_T
1840 AC_TYPE_UID_T
1841
1842 # There are two separate checks for each of the exact-width integer types we
1843 # need. First we check whether the type is available using the usual
1844 # AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h>
1845 # and <stdint.h> where available). We then also use the special type checks of
1846 # the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available
1847 # directly, #define's uint32_t to be a suitable type.
1848
1849 AC_CHECK_TYPE(uint32_t,
1850 AC_DEFINE(HAVE_UINT32_T, 1, [Define if your compiler provides uint32_t.]),,)
1851 AC_TYPE_UINT32_T
1852
1853 AC_CHECK_TYPE(uint64_t,
1854 AC_DEFINE(HAVE_UINT64_T, 1, [Define if your compiler provides uint64_t.]),,)
1855 AC_TYPE_UINT64_T
1856
1857 AC_CHECK_TYPE(int32_t,
1858 AC_DEFINE(HAVE_INT32_T, 1, [Define if your compiler provides int32_t.]),,)
1859 AC_TYPE_INT32_T
1860
1861 AC_CHECK_TYPE(int64_t,
1862 AC_DEFINE(HAVE_INT64_T, 1, [Define if your compiler provides int64_t.]),,)
1863 AC_TYPE_INT64_T
1864
1865 AC_CHECK_TYPE(ssize_t,
1866 AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
1867
1868 # Sizes of various common basic types
1869 # ANSI C requires sizeof(char) == 1, so no need to check it
1870 AC_CHECK_SIZEOF(int, 4)
1871 AC_CHECK_SIZEOF(long, 4)
1872 AC_CHECK_SIZEOF(void *, 4)
1873 AC_CHECK_SIZEOF(short, 2)
1874 AC_CHECK_SIZEOF(float, 4)
1875 AC_CHECK_SIZEOF(double, 8)
1876 AC_CHECK_SIZEOF(fpos_t, 4)
1877 AC_CHECK_SIZEOF(size_t, 4)
1878 AC_CHECK_SIZEOF(pid_t, 4)
1879
1880 AC_MSG_CHECKING(for long long support)
1881 have_long_long=no
1882 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
1883 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1884 have_long_long=yes
1885 ],[])
1886 AC_MSG_RESULT($have_long_long)
1887 if test "$have_long_long" = yes ; then
1888 AC_CHECK_SIZEOF(long long, 8)
1889 fi
1890
1891 AC_MSG_CHECKING(for long double support)
1892 have_long_double=no
1893 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
1894 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1895 have_long_double=yes
1896 ],[])
1897 AC_MSG_RESULT($have_long_double)
1898 if test "$have_long_double" = yes ; then
1899 AC_CHECK_SIZEOF(long double, 12)
1900 fi
1901
1902 AC_MSG_CHECKING(for _Bool support)
1903 have_c99_bool=no
1904 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Bool x; x = (_Bool)0;]])],[
1905 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1906 have_c99_bool=yes
1907 ],[])
1908 AC_MSG_RESULT($have_c99_bool)
1909 if test "$have_c99_bool" = yes ; then
1910 AC_CHECK_SIZEOF(_Bool, 1)
1911 fi
1912
1913 AC_CHECK_TYPES(uintptr_t,
1914 [AC_CHECK_SIZEOF(uintptr_t, 4)],
1915 [], [#ifdef HAVE_STDINT_H
1916 #include <stdint.h>
1917 #endif
1918 #ifdef HAVE_INTTYPES_H
1919 #include <inttypes.h>
1920 #endif])
1921
1922 AC_CHECK_SIZEOF(off_t, [], [
1923 #ifdef HAVE_SYS_TYPES_H
1924 #include <sys/types.h>
1925 #endif
1926 ])
1927
1928 AC_MSG_CHECKING(whether to enable large file support)
1929 if test "$have_long_long" = yes
1930 then
1931 if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1932 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1933 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1934 [Defined to enable large file support when an off_t is bigger than a long
1935 and long long is available and at least as big as an off_t. You may need
1936 to add some flags for configuration and compilation to enable this mode.
1937 (For Solaris and Linux, the necessary defines are already defined.)])
1938 AC_MSG_RESULT(yes)
1939 else
1940 AC_MSG_RESULT(no)
1941 fi
1942 else
1943 AC_MSG_RESULT(no)
1944 fi
1945
1946 AC_CHECK_SIZEOF(time_t, [], [
1947 #ifdef HAVE_SYS_TYPES_H
1948 #include <sys/types.h>
1949 #endif
1950 #ifdef HAVE_TIME_H
1951 #include <time.h>
1952 #endif
1953 ])
1954
1955 # if have pthread_t then define SIZEOF_PTHREAD_T
1956 ac_save_cc="$CC"
1957 if test "$ac_cv_kpthread" = "yes"
1958 then CC="$CC -Kpthread"
1959 elif test "$ac_cv_kthread" = "yes"
1960 then CC="$CC -Kthread"
1961 elif test "$ac_cv_pthread" = "yes"
1962 then CC="$CC -pthread"
1963 fi
1964 AC_MSG_CHECKING(for pthread_t)
1965 have_pthread_t=no
1966 AC_COMPILE_IFELSE([
1967 AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
1968 ],[have_pthread_t=yes],[])
1969 AC_MSG_RESULT($have_pthread_t)
1970 if test "$have_pthread_t" = yes ; then
1971 AC_CHECK_SIZEOF(pthread_t, [], [
1972 #ifdef HAVE_PTHREAD_H
1973 #include <pthread.h>
1974 #endif
1975 ])
1976 fi
1977 CC="$ac_save_cc"
1978
1979 AC_MSG_CHECKING(for --enable-toolbox-glue)
1980 AC_ARG_ENABLE(toolbox-glue,
1981 AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions]))
1982
1983 if test -z "$enable_toolbox_glue"
1984 then
1985 case $ac_sys_system/$ac_sys_release in
1986 Darwin/*)
1987 enable_toolbox_glue="yes";;
1988 *)
1989 enable_toolbox_glue="no";;
1990 esac
1991 fi
1992 case "$enable_toolbox_glue" in
1993 yes)
1994 extra_machdep_objs="Python/mactoolboxglue.o"
1995 extra_undefs="-u _PyMac_Error"
1996 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1997 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
1998 ;;
1999 *)
2000 extra_machdep_objs=""
2001 extra_undefs=""
2002 ;;
2003 esac
2004 AC_MSG_RESULT($enable_toolbox_glue)
2005
2006
2007 AC_SUBST(OTHER_LIBTOOL_OPT)
2008 case $ac_sys_system/$ac_sys_release in
2009 Darwin/@<:@01567@:>@\..*)
2010 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
2011 ;;
2012 Darwin/*)
2013 OTHER_LIBTOOL_OPT=""
2014 ;;
2015 esac
2016
2017
2018 AC_SUBST(LIBTOOL_CRUFT)
2019 case $ac_sys_system/$ac_sys_release in
2020 Darwin/@<:@01567@:>@\..*)
2021 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
2022 if test "${enable_universalsdk}"; then
2023 :
2024 else
2025 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
2026 fi
2027 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2028 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
2029 Darwin/*)
2030 gcc_version=`gcc -dumpversion`
2031 if test ${gcc_version} '<' 4.0
2032 then
2033 LIBTOOL_CRUFT="-lcc_dynamic"
2034 else
2035 LIBTOOL_CRUFT=""
2036 fi
2037 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2038 #include <unistd.h>
2039 int main(int argc, char*argv[])
2040 {
2041 if (sizeof(long) == 4) {
2042 return 0;
2043 } else {
2044 return 1;
2045 }
2046 }
2047 ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
2048
2049 if test "${ac_osx_32bit}" = "yes"; then
2050 case `/usr/bin/arch` in
2051 i386)
2052 MACOSX_DEFAULT_ARCH="i386"
2053 ;;
2054 ppc)
2055 MACOSX_DEFAULT_ARCH="ppc"
2056 ;;
2057 *)
2058 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
2059 ;;
2060 esac
2061 else
2062 case `/usr/bin/arch` in
2063 i386)
2064 MACOSX_DEFAULT_ARCH="x86_64"
2065 ;;
2066 ppc)
2067 MACOSX_DEFAULT_ARCH="ppc64"
2068 ;;
2069 *)
2070 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
2071 ;;
2072 esac
2073
2074 fi
2075
2076 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
2077 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2078 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
2079 esac
2080
2081 AC_MSG_CHECKING(for --enable-framework)
2082 if test "$enable_framework"
2083 then
2084 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
2085 # -F. is needed to allow linking to the framework while
2086 # in the build location.
2087 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
2088 [Define if you want to produce an OpenStep/Rhapsody framework
2089 (shared library plus accessory files).])
2090 AC_MSG_RESULT(yes)
2091 if test $enable_shared = "yes"
2092 then
2093 AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.])
2094 fi
2095 else
2096 AC_MSG_RESULT(no)
2097 fi
2098
2099 AC_MSG_CHECKING(for dyld)
2100 case $ac_sys_system/$ac_sys_release in
2101 Darwin/*)
2102 AC_DEFINE(WITH_DYLD, 1,
2103 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
2104 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
2105 linker (rld). Dyld is necessary to support frameworks.])
2106 AC_MSG_RESULT(always on for Darwin)
2107 ;;
2108 *)
2109 AC_MSG_RESULT(no)
2110 ;;
2111 esac
2112
2113 # Set info about shared libraries.
2114 AC_SUBST(SO)
2115 AC_SUBST(LDSHARED)
2116 AC_SUBST(LDCXXSHARED)
2117 AC_SUBST(BLDSHARED)
2118 AC_SUBST(CCSHARED)
2119 AC_SUBST(LINKFORSHARED)
2120 # SO is the extension of shared libraries `(including the dot!)
2121 # -- usually .so, .sl on HP-UX, .dll on Cygwin
2122 AC_MSG_CHECKING(SO)
2123 if test -z "$SO"
2124 then
2125 case $ac_sys_system in
2126 hp*|HP*)
2127 case `uname -m` in
2128 ia64) SO=.so;;
2129 *) SO=.sl;;
2130 esac
2131 ;;
2132 CYGWIN*) SO=.dll;;
2133 *) SO=.so;;
2134 esac
2135 else
2136 # this might also be a termcap variable, see #610332
2137 echo
2138 echo '====================================================================='
2139 echo '+ +'
2140 echo '+ WARNING: You have set SO in your environment. +'
2141 echo '+ Do you really mean to change the extension for shared libraries? +'
2142 echo '+ Continuing in 10 seconds to let you to ponder. +'
2143 echo '+ +'
2144 echo '====================================================================='
2145 sleep 10
2146 fi
2147 AC_MSG_RESULT($SO)
2148
2149 AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
2150 # LDSHARED is the ld *command* used to create shared library
2151 # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
2152 # (Shared libraries in this instance are shared modules to be loaded into
2153 # Python, as opposed to building Python itself as a shared library.)
2154 AC_MSG_CHECKING(LDSHARED)
2155 if test -z "$LDSHARED"
2156 then
2157 case $ac_sys_system/$ac_sys_release in
2158 AIX*)
2159 BLDSHARED="Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
2160 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
2161 ;;
2162 BeOS*)
2163 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
2164 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
2165 ;;
2166 IRIX/5*) LDSHARED="ld -shared";;
2167 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
2168 SunOS/5*)
2169 if test "$GCC" = "yes" ; then
2170 LDSHARED='$(CC) -shared'
2171 LDCXXSHARED='$(CXX) -shared'
2172 else
2173 LDSHARED='$(CC) -G'
2174 LDCXXSHARED='$(CXX) -G'
2175 fi ;;
2176 hp*|HP*)
2177 if test "$GCC" = "yes" ; then
2178 LDSHARED='$(CC) -shared'
2179 LDCXXSHARED='$(CXX) -shared'
2180 else
2181 LDSHARED='ld -b'
2182 fi ;;
2183 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
2184 Darwin/1.3*)
2185 LDSHARED='$(CC) -bundle'
2186 LDCXXSHARED='$(CXX) -bundle'
2187 if test "$enable_framework" ; then
2188 # Link against the framework. All externals should be defined.
2189 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2190 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2191 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2192 else
2193 # No framework. Ignore undefined symbols, assuming they come from Python
2194 LDSHARED="$LDSHARED -undefined suppress"
2195 LDCXXSHARED="$LDCXXSHARED -undefined suppress"
2196 fi ;;
2197 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
2198 LDSHARED='$(CC) -bundle'
2199 LDCXXSHARED='$(CXX) -bundle'
2200 if test "$enable_framework" ; then
2201 # Link against the framework. All externals should be defined.
2202 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2203 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2204 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2205 else
2206 # No framework, use the Python app as bundle-loader
2207 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
2208 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
2209 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
2210 fi ;;
2211 Darwin/*)
2212 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
2213 # This allows an extension to be used in any Python
2214
2215 dep_target_major=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
2216 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
2217 dep_target_minor=`echo ${MACOSX_DEPLOYMENT_TARGET} | \
2218 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
2219 if test ${dep_target_major} -eq 10 && \
2220 test ${dep_target_minor} -le 2
2221 then
2222 # building for OS X 10.0 through 10.2
2223 LDSHARED='$(CC) -bundle'
2224 LDCXXSHARED='$(CXX) -bundle'
2225 if test "$enable_framework" ; then
2226 # Link against the framework. All externals should be defined.
2227 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2228 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2229 LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2230 else
2231 # No framework, use the Python app as bundle-loader
2232 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
2233 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
2234 LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
2235 fi
2236 else
2237 # building for OS X 10.3 and later
2238 LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
2239 LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
2240 BLDSHARED="$LDSHARED"
2241 fi
2242 ;;
2243 Linux*|GNU*|QNX*)
2244 LDSHARED='$(CC) -shared'
2245 LDCXXSHARED='$(CXX) -shared';;
2246 BSD/OS*/4*)
2247 LDSHARED="gcc -shared"
2248 LDCXXSHARED="g++ -shared";;
2249 FreeBSD*)
2250 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
2251 then
2252 LDSHARED='$(CC) -shared'
2253 LDCXXSHARED='$(CXX) -shared'
2254 else
2255 LDSHARED="ld -Bshareable"
2256 fi;;
2257 OpenBSD*)
2258 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
2259 then
2260 LDSHARED='$(CC) -shared $(CCSHARED)'
2261 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
2262 else
2263 case `uname -r` in
2264 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
2265 LDSHARED="ld -Bshareable ${LDFLAGS}"
2266 ;;
2267 *)
2268 LDSHARED='$(CC) -shared $(CCSHARED)'
2269 LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
2270 ;;
2271 esac
2272 fi;;
2273 NetBSD*|DragonFly*)
2274 LDSHARED='$(CC) -shared'
2275 LDCXXSHARED='$(CXX) -shared';;
2276 OpenUNIX*|UnixWare*)
2277 if test "$GCC" = "yes" ; then
2278 LDSHARED='$(CC) -shared'
2279 LDCXXSHARED='$(CXX) -shared'
2280 else
2281 LDSHARED='$(CC) -G'
2282 LDCXXSHARED='$(CXX) -G'
2283 fi;;
2284 SCO_SV*)
2285 LDSHARED='$(CC) -Wl,-G,-Bexport'
2286 LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
2287 CYGWIN*)
2288 LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
2289 LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
2290 atheos*)
2291 LDSHARED="gcc -shared"
2292 LDCXXSHARED="g++ -shared";;
2293 *) LDSHARED="ld";;
2294 esac
2295 fi
2296 AC_MSG_RESULT($LDSHARED)
2297 LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
2298 BLDSHARED=${BLDSHARED-$LDSHARED}
2299 # CCSHARED are the C *flags* used to create objects to go into a shared
2300 # library (module) -- this is only needed for a few systems
2301 AC_MSG_CHECKING(CCSHARED)
2302 if test -z "$CCSHARED"
2303 then
2304 case $ac_sys_system/$ac_sys_release in
2305 SunOS*) if test "$GCC" = yes;
2306 then CCSHARED="-fPIC";
2307 elif test `uname -p` = sparc;
2308 then CCSHARED="-xcode=pic32";
2309 else CCSHARED="-Kpic";
2310 fi;;
2311 hp*|HP*) if test "$GCC" = yes;
2312 then CCSHARED="-fPIC";
2313 else CCSHARED="+z";
2314 fi;;
2315 Linux*|GNU*) CCSHARED="-fPIC";;
2316 BSD/OS*/4*) CCSHARED="-fpic";;
2317 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
2318 OpenUNIX*|UnixWare*)
2319 if test "$GCC" = "yes"
2320 then CCSHARED="-fPIC"
2321 else CCSHARED="-KPIC"
2322 fi;;
2323 SCO_SV*)
2324 if test "$GCC" = "yes"
2325 then CCSHARED="-fPIC"
2326 else CCSHARED="-Kpic -belf"
2327 fi;;
2328 IRIX*/6*) case $CC in
2329 *gcc*) CCSHARED="-shared";;
2330 *) CCSHARED="";;
2331 esac;;
2332 atheos*) CCSHARED="-fPIC";;
2333 esac
2334 fi
2335 AC_MSG_RESULT($CCSHARED)
2336 # LINKFORSHARED are the flags passed to the $(CC) command that links
2337 # the python executable -- this is only needed for a few systems
2338 AC_MSG_CHECKING(LINKFORSHARED)
2339 if test -z "$LINKFORSHARED"
2340 then
2341 case $ac_sys_system/$ac_sys_release in
2342 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
2343 hp*|HP*)
2344 LINKFORSHARED="-Wl,-E -Wl,+s";;
2345 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
2346 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
2347 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
2348 # -u libsys_s pulls in all symbols in libsys
2349 Darwin/*)
2350 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
2351 # which is
2352 # not used by the core itself but which needs to be in the core so
2353 # that dynamically loaded extension modules have access to it.
2354 # -prebind is no longer used, because it actually seems to give a
2355 # slowdown in stead of a speedup, maybe due to the large number of
2356 # dynamic loads Python does.
2357
2358 LINKFORSHARED="$extra_undefs"
2359 if test "$enable_framework"
2360 then
2361 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2362 fi
2363 LINKFORSHARED="$LINKFORSHARED";;
2364 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
2365 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
2366 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
2367 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
2368 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
2369 then
2370 LINKFORSHARED="-Wl,--export-dynamic"
2371 fi;;
2372 SunOS/5*) case $CC in
2373 *gcc*)
2374 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
2375 then
2376 LINKFORSHARED="-Xlinker --export-dynamic"
2377 fi;;
2378 esac;;
2379 CYGWIN*)
2380 if test $enable_shared = "no"
2381 then
2382 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
2383 fi;;
2384 QNX*)
2385 # -Wl,-E causes the symbols to be added to the dynamic
2386 # symbol table so that they can be found when a module
2387 # is loaded. -N 2048K causes the stack size to be set
2388 # to 2048 kilobytes so that the stack doesn't overflow
2389 # when running test_compile.py.
2390 LINKFORSHARED='-Wl,-E -N 2048K';;
2391 esac
2392 fi
2393 AC_MSG_RESULT($LINKFORSHARED)
2394
2395
2396 AC_SUBST(CFLAGSFORSHARED)
2397 AC_MSG_CHECKING(CFLAGSFORSHARED)
2398 if test ! "$LIBRARY" = "$LDLIBRARY"
2399 then
2400 case $ac_sys_system in
2401 CYGWIN*)
2402 # Cygwin needs CCSHARED when building extension DLLs
2403 # but not when building the interpreter DLL.
2404 CFLAGSFORSHARED='';;
2405 *)
2406 CFLAGSFORSHARED='$(CCSHARED)'
2407 esac
2408 fi
2409 AC_MSG_RESULT($CFLAGSFORSHARED)
2410
2411 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
2412 # library (with --enable-shared).
2413 # For platforms on which shared libraries are not allowed to have unresolved
2414 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
2415 # if it is not required, since it creates a dependency of the shared library
2416 # to LIBS. This, in turn, means that applications linking the shared libpython
2417 # don't need to link LIBS explicitly. The default should be only changed
2418 # on systems where this approach causes problems.
2419 AC_SUBST(SHLIBS)
2420 AC_MSG_CHECKING(SHLIBS)
2421 case "$ac_sys_system" in
2422 *)
2423 SHLIBS='$(LIBS)';;
2424 esac
2425 AC_MSG_RESULT($SHLIBS)
2426
2427
2428 # checks for libraries
2429 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
2430 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
2431
2432 # only check for sem_init if thread support is requested
2433 if test "$with_threads" = "yes" -o -z "$with_threads"; then
2434 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
2435 # posix4 on Solaris 2.6
2436 # pthread (first!) on Linux
2437 fi
2438
2439 # check if we need libintl for locale functions
2440 AC_CHECK_LIB(intl, textdomain,
2441 AC_DEFINE(WITH_LIBINTL, 1,
2442 [Define to 1 if libintl is needed for locale functions.]))
2443 AC_SEARCH_LIBS(bind_textdomain_codeset, intl,
2444 AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET, 1,
2445 [Define to 1 if bind_textdomain_codeset is available.]))
2446
2447 # checks for system dependent C++ extensions support
2448 case "$ac_sys_system" in
2449 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
2450 AC_LINK_IFELSE([
2451 AC_LANG_PROGRAM([[#include <load.h>]],
2452 [[loadAndInit("", 0, "")]])
2453 ],[
2454 AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
2455 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
2456 and you want support for AIX C++ shared extension modules.])
2457 AC_MSG_RESULT(yes)
2458 ],[
2459 AC_MSG_RESULT(no)
2460 ]);;
2461 *) ;;
2462 esac
2463
2464 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
2465 # BeOS' sockets are stashed in libnet.
2466 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
2467 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
2468
2469 case "$ac_sys_system" in
2470 BeOS*)
2471 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
2472 ;;
2473 esac
2474
2475 AC_MSG_CHECKING(for --with-libs)
2476 AC_ARG_WITH(libs,
2477 AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
2478 [
2479 AC_MSG_RESULT($withval)
2480 LIBS="$withval $LIBS"
2481 ],
2482 [AC_MSG_RESULT(no)])
2483
2484 PKG_PROG_PKG_CONFIG
2485
2486 # Check for use of the system expat library
2487 AC_MSG_CHECKING(for --with-system-expat)
2488 AC_ARG_WITH(system_expat,
2489 AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
2490 [],
2491 [with_system_expat="no"])
2492
2493 AC_MSG_RESULT($with_system_expat)
2494
2495 # Check for use of the system libffi library
2496 AC_MSG_CHECKING(for --with-system-ffi)
2497 AC_ARG_WITH(system_ffi,
2498 AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),
2499 [],
2500 [with_system_ffi="no"])
2501
2502 if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
2503 LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
2504 else
2505 LIBFFI_INCLUDEDIR=""
2506 fi
2507 AC_SUBST(LIBFFI_INCLUDEDIR)
2508
2509 AC_MSG_RESULT($with_system_ffi)
2510
2511 # Check for --with-tcltk-includes=path and --with-tcltk-libs=path
2512 AC_SUBST(TCLTK_INCLUDES)
2513 AC_SUBST(TCLTK_LIBS)
2514 AC_MSG_CHECKING(for --with-tcltk-includes)
2515 AC_ARG_WITH(tcltk-includes,
2516 AS_HELP_STRING([--with-tcltk-includes='-I...'], [override search for Tcl and Tk include files]),
2517 [],
2518 [with_tcltk_includes="default"])
2519 AC_MSG_RESULT($with_tcltk_includes)
2520 AC_MSG_CHECKING(for --with-tcltk-libs)
2521 AC_ARG_WITH(tcltk-libs,
2522 AS_HELP_STRING([--with-tcltk-libs='-L...'], [override search for Tcl and Tk libs]),
2523 [],
2524 [with_tcltk_libs="default"])
2525 AC_MSG_RESULT($with_tcltk_libs)
2526 if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault
2527 then
2528 if test "x$with_tcltk_includes" != "x$with_tcltk_libs"
2529 then
2530 AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither])
2531 fi
2532 TCLTK_INCLUDES=""
2533 TCLTK_LIBS=""
2534 else
2535 TCLTK_INCLUDES="$with_tcltk_includes"
2536 TCLTK_LIBS="$with_tcltk_libs"
2537 fi
2538
2539 # Check for --with-dbmliborder
2540 AC_MSG_CHECKING(for --with-dbmliborder)
2541 AC_ARG_WITH(dbmliborder,
2542 AS_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'.]),
2543 [
2544 if test x$with_dbmliborder = xyes
2545 then
2546 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2547 else
2548 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
2549 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
2550 then
2551 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
2552 fi
2553 done
2554 fi])
2555 AC_MSG_RESULT($with_dbmliborder)
2556
2557 # Determine if signalmodule should be used.
2558 AC_SUBST(USE_SIGNAL_MODULE)
2559 AC_SUBST(SIGNAL_OBJS)
2560 AC_MSG_CHECKING(for --with-signal-module)
2561 AC_ARG_WITH(signal-module,
2562 AS_HELP_STRING([--with-signal-module], [disable/enable signal module]))
2563
2564 if test -z "$with_signal_module"
2565 then with_signal_module="yes"
2566 fi
2567 AC_MSG_RESULT($with_signal_module)
2568
2569 if test "${with_signal_module}" = "yes"; then
2570 USE_SIGNAL_MODULE=""
2571 SIGNAL_OBJS=""
2572 else
2573 USE_SIGNAL_MODULE="#"
2574 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2575 fi
2576
2577 # This is used to generate Setup.config
2578 AC_SUBST(USE_THREAD_MODULE)
2579 USE_THREAD_MODULE=""
2580
2581 AC_MSG_CHECKING(for --with-dec-threads)
2582 AC_SUBST(LDLAST)
2583 AC_ARG_WITH(dec-threads,
2584 AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]),
2585 [
2586 AC_MSG_RESULT($withval)
2587 LDLAST=-threads
2588 if test "${with_thread+set}" != set; then
2589 with_thread="$withval";
2590 fi],
2591 [AC_MSG_RESULT(no)])
2592
2593 # Templates for things AC_DEFINEd more than once.
2594 # For a single AC_DEFINE, no template is needed.
2595 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2596 AH_TEMPLATE(_REENTRANT,
2597 [Define to force use of thread-safe errno, h_errno, and other functions])
2598 AH_TEMPLATE(WITH_THREAD,
2599 [Define if you want to compile in rudimentary thread support])
2600
2601 AC_MSG_CHECKING(for --with-threads)
2602 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2603 AC_ARG_WITH(threads,
2604 AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support]))
2605
2606 # --with-thread is deprecated, but check for it anyway
2607 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2608 AC_ARG_WITH(thread,
2609 AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]),
2610 [with_threads=$with_thread])
2611
2612 if test -z "$with_threads"
2613 then with_threads="yes"
2614 fi
2615 AC_MSG_RESULT($with_threads)
2616
2617 AC_SUBST(THREADOBJ)
2618 if test "$with_threads" = "no"
2619 then
2620 USE_THREAD_MODULE="#"
2621 elif test "$ac_cv_pthread_is_default" = yes
2622 then
2623 AC_DEFINE(WITH_THREAD)
2624 # Defining _REENTRANT on system with POSIX threads should not hurt.
2625 AC_DEFINE(_REENTRANT)
2626 posix_threads=yes
2627 THREADOBJ="Python/thread.o"
2628 if test "$ac_sys_system" = "SunOS"; then
2629 CFLAGS="$CFLAGS -D_REENTRANT"
2630 fi
2631 elif test "$ac_cv_kpthread" = "yes"
2632 then
2633 CC="$CC -Kpthread"
2634 if test "$ac_cv_cxx_thread" = "yes"; then
2635 CXX="$CXX -Kpthread"
2636 fi
2637 AC_DEFINE(WITH_THREAD)
2638 posix_threads=yes
2639 THREADOBJ="Python/thread.o"
2640 elif test "$ac_cv_kthread" = "yes"
2641 then
2642 CC="$CC -Kthread"
2643 if test "$ac_cv_cxx_thread" = "yes"; then
2644 CXX="$CXX -Kthread"
2645 fi
2646 AC_DEFINE(WITH_THREAD)
2647 posix_threads=yes
2648 THREADOBJ="Python/thread.o"
2649 elif test "$ac_cv_pthread" = "yes"
2650 then
2651 CC="$CC -pthread"
2652 if test "$ac_cv_cxx_thread" = "yes"; then
2653 CXX="$CXX -pthread"
2654 fi
2655 AC_DEFINE(WITH_THREAD)
2656 posix_threads=yes
2657 THREADOBJ="Python/thread.o"
2658 else
2659 if test ! -z "$with_threads" -a -d "$with_threads"
2660 then LDFLAGS="$LDFLAGS -L$with_threads"
2661 fi
2662 if test ! -z "$withval" -a -d "$withval"
2663 then LDFLAGS="$LDFLAGS -L$withval"
2664 fi
2665
2666 # According to the POSIX spec, a pthreads implementation must
2667 # define _POSIX_THREADS in unistd.h. Some apparently don't
2668 # (e.g. gnu pth with pthread emulation)
2669 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2670 AC_EGREP_CPP(yes,
2671 [
2672 #include <unistd.h>
2673 #ifdef _POSIX_THREADS
2674 yes
2675 #endif
2676 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2677 AC_MSG_RESULT($unistd_defines_pthreads)
2678
2679 AC_DEFINE(_REENTRANT)
2680 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2681 AC_DEFINE(C_THREADS)
2682 AC_DEFINE(HURD_C_THREADS, 1,
2683 [Define if you are using Mach cthreads directly under /include])
2684 LIBS="$LIBS -lthreads"
2685 THREADOBJ="Python/thread.o"],[
2686 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2687 AC_DEFINE(C_THREADS)
2688 AC_DEFINE(MACH_C_THREADS, 1,
2689 [Define if you are using Mach cthreads under mach /])
2690 THREADOBJ="Python/thread.o"],[
2691 AC_MSG_CHECKING(for --with-pth)
2692 AC_ARG_WITH([pth],
2693 AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]),
2694 [AC_MSG_RESULT($withval)
2695 AC_DEFINE([WITH_THREAD])
2696 AC_DEFINE([HAVE_PTH], 1,
2697 [Define if you have GNU PTH threads.])
2698 LIBS="-lpth $LIBS"
2699 THREADOBJ="Python/thread.o"],
2700 [AC_MSG_RESULT(no)
2701
2702 # Just looking for pthread_create in libpthread is not enough:
2703 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2704 # So we really have to include pthread.h, and then link.
2705 _libs=$LIBS
2706 LIBS="$LIBS -lpthread"
2707 AC_MSG_CHECKING([for pthread_create in -lpthread])
2708 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2709 #include <stdio.h>
2710 #include <pthread.h>
2711
2712 void * start_routine (void *arg) { exit (0); }]], [[
2713 pthread_create (NULL, NULL, start_routine, NULL)]])],[
2714 AC_MSG_RESULT(yes)
2715 AC_DEFINE(WITH_THREAD)
2716 posix_threads=yes
2717 THREADOBJ="Python/thread.o"],[
2718 LIBS=$_libs
2719 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
2720 posix_threads=yes
2721 THREADOBJ="Python/thread.o"],[
2722 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2723 AC_DEFINE(ATHEOS_THREADS, 1,
2724 [Define this if you have AtheOS threads.])
2725 THREADOBJ="Python/thread.o"],[
2726 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
2727 AC_DEFINE(BEOS_THREADS, 1,
2728 [Define this if you have BeOS threads.])
2729 THREADOBJ="Python/thread.o"],[
2730 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
2731 posix_threads=yes
2732 LIBS="$LIBS -lpthreads"
2733 THREADOBJ="Python/thread.o"], [
2734 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
2735 posix_threads=yes
2736 LIBS="$LIBS -lc_r"
2737 THREADOBJ="Python/thread.o"], [
2738 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
2739 posix_threads=yes
2740 LIBS="$LIBS -lpthread"
2741 THREADOBJ="Python/thread.o"], [
2742 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
2743 posix_threads=yes
2744 LIBS="$LIBS -lcma"
2745 THREADOBJ="Python/thread.o"],[
2746 USE_THREAD_MODULE="#"])
2747 ])])])])])])])])])])
2748
2749 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2750 LIBS="$LIBS -lmpc"
2751 THREADOBJ="Python/thread.o"
2752 USE_THREAD_MODULE=""])
2753
2754 if test "$posix_threads" != "yes"; then
2755 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2756 LIBS="$LIBS -lthread"
2757 THREADOBJ="Python/thread.o"
2758 USE_THREAD_MODULE=""])
2759 fi
2760
2761 if test "$USE_THREAD_MODULE" != "#"
2762 then
2763 # If the above checks didn't disable threads, (at least) OSF1
2764 # needs this '-threads' argument during linking.
2765 case $ac_sys_system in
2766 OSF1) LDLAST=-threads;;
2767 esac
2768 fi
2769 fi
2770
2771 if test "$posix_threads" = "yes"; then
2772 if test "$unistd_defines_pthreads" = "no"; then
2773 AC_DEFINE(_POSIX_THREADS, 1,
2774 [Define if you have POSIX threads,
2775 and your system does not define that.])
2776 fi
2777
2778 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2779 case $ac_sys_system/$ac_sys_release in
2780 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
2781 [Defined for Solaris 2.6 bug in pthread header.])
2782 ;;
2783 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2784 [Define if the Posix semaphores do not work on your system])
2785 ;;
2786 AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2787 [Define if the Posix semaphores do not work on your system])
2788 ;;
2789 esac
2790
2791 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2792 AC_CACHE_VAL(ac_cv_pthread_system_supported,
2793 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
2794 #include <stdio.h>
2795 #include <pthread.h>
2796 void *foo(void *parm) {
2797 return NULL;
2798 }
2799 main() {
2800 pthread_attr_t attr;
2801 pthread_t id;
2802 if (pthread_attr_init(&attr)) exit(-1);
2803 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
2804 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
2805 exit(0);
2806 }]])],
2807 [ac_cv_pthread_system_supported=yes],
2808 [ac_cv_pthread_system_supported=no],
2809 [ac_cv_pthread_system_supported=no])
2810 ])
2811 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2812 if test "$ac_cv_pthread_system_supported" = "yes"; then
2813 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
2814 fi
2815 AC_CHECK_FUNCS(pthread_sigmask,
2816 [case $ac_sys_system in
2817 CYGWIN*)
2818 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2819 [Define if pthread_sigmask() does not work on your system.])
2820 ;;
2821 esac])
2822 AC_CHECK_FUNCS(pthread_atfork)
2823 fi
2824
2825
2826 # Check for enable-ipv6
2827 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
2828 AC_MSG_CHECKING([if --enable-ipv6 is specified])
2829 AC_ARG_ENABLE(ipv6,
2830 [ --enable-ipv6 Enable ipv6 (with ipv4) support
2831 --disable-ipv6 Disable ipv6 support],
2832 [ case "$enableval" in
2833 no)
2834 AC_MSG_RESULT(no)
2835 ipv6=no
2836 ;;
2837 *) AC_MSG_RESULT(yes)
2838 AC_DEFINE(ENABLE_IPV6)
2839 ipv6=yes
2840 ;;
2841 esac ],
2842
2843 [
2844 dnl the check does not work on cross compilation case...
2845 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* AF_INET6 available check */
2846 #include <sys/types.h>
2847 #include <sys/socket.h>]],
2848 [[int domain = AF_INET6;]])],[
2849 AC_MSG_RESULT(yes)
2850 ipv6=yes
2851 ],[
2852 AC_MSG_RESULT(no)
2853 ipv6=no
2854 ])
2855
2856 if test "$ipv6" = "yes"; then
2857 AC_MSG_CHECKING(if RFC2553 API is available)
2858 AC_COMPILE_IFELSE([
2859 AC_LANG_PROGRAM([[#include <sys/types.h>
2860 #include <netinet/in.h>]],
2861 [[struct sockaddr_in6 x;
2862 x.sin6_scope_id;]])
2863 ],[
2864 AC_MSG_RESULT(yes)
2865 ipv6=yes
2866 ],[
2867 AC_MSG_RESULT(no, IPv6 disabled)
2868 ipv6=no
2869 ])
2870 fi
2871
2872 if test "$ipv6" = "yes"; then
2873 AC_DEFINE(ENABLE_IPV6)
2874 fi
2875 ])
2876
2877 ipv6type=unknown
2878 ipv6lib=none
2879 ipv6trylibc=no
2880
2881 if test "$ipv6" = "yes"; then
2882 AC_MSG_CHECKING([ipv6 stack type])
2883 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2884 do
2885 case $i in
2886 inria)
2887 dnl http://www.kame.net/
2888 AC_EGREP_CPP(yes, [
2889 #include <netinet/in.h>
2890 #ifdef IPV6_INRIA_VERSION
2891 yes
2892 #endif],
2893 [ipv6type=$i])
2894 ;;
2895 kame)
2896 dnl http://www.kame.net/
2897 AC_EGREP_CPP(yes, [
2898 #include <netinet/in.h>
2899 #ifdef __KAME__
2900 yes
2901 #endif],
2902 [ipv6type=$i;
2903 ipv6lib=inet6
2904 ipv6libdir=/usr/local/v6/lib
2905 ipv6trylibc=yes])
2906 ;;
2907 linux-glibc)
2908 dnl http://www.v6.linux.or.jp/
2909 AC_EGREP_CPP(yes, [
2910 #include <features.h>
2911 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2912 yes
2913 #endif],
2914 [ipv6type=$i;
2915 ipv6trylibc=yes])
2916 ;;
2917 linux-inet6)
2918 dnl http://www.v6.linux.or.jp/
2919 if test -d /usr/inet6; then
2920 ipv6type=$i
2921 ipv6lib=inet6
2922 ipv6libdir=/usr/inet6/lib
2923 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
2924 fi
2925 ;;
2926 solaris)
2927 if test -f /etc/netconfig; then
2928 if $GREP -q tcp6 /etc/netconfig; then
2929 ipv6type=$i
2930 ipv6trylibc=yes
2931 fi
2932 fi
2933 ;;
2934 toshiba)
2935 AC_EGREP_CPP(yes, [
2936 #include <sys/param.h>
2937 #ifdef _TOSHIBA_INET6
2938 yes
2939 #endif],
2940 [ipv6type=$i;
2941 ipv6lib=inet6;
2942 ipv6libdir=/usr/local/v6/lib])
2943 ;;
2944 v6d)
2945 AC_EGREP_CPP(yes, [
2946 #include </usr/local/v6/include/sys/v6config.h>
2947 #ifdef __V6D__
2948 yes
2949 #endif],
2950 [ipv6type=$i;
2951 ipv6lib=v6;
2952 ipv6libdir=/usr/local/v6/lib;
2953 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
2954 ;;
2955 zeta)
2956 AC_EGREP_CPP(yes, [
2957 #include <sys/param.h>
2958 #ifdef _ZETA_MINAMI_INET6
2959 yes
2960 #endif],
2961 [ipv6type=$i;
2962 ipv6lib=inet6;
2963 ipv6libdir=/usr/local/v6/lib])
2964 ;;
2965 esac
2966 if test "$ipv6type" != "unknown"; then
2967 break
2968 fi
2969 done
2970 AC_MSG_RESULT($ipv6type)
2971 fi
2972
2973 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2974 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2975 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2976 echo "using lib$ipv6lib"
2977 else
2978 if test $ipv6trylibc = "yes"; then
2979 echo "using libc"
2980 else
2981 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2982 echo "You need to fetch lib$ipv6lib.a from appropriate"
2983 echo 'ipv6 kit and compile beforehand.'
2984 exit 1
2985 fi
2986 fi
2987 fi
2988
2989 AC_MSG_CHECKING(for OSX 10.5 SDK or later)
2990 AC_COMPILE_IFELSE([
2991 AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
2992 ],[
2993 AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.])
2994 AC_MSG_RESULT(yes)
2995 ],[
2996 AC_MSG_RESULT(no)
2997 ])
2998
2999 # Check for --with-doc-strings
3000 AC_MSG_CHECKING(for --with-doc-strings)
3001 AC_ARG_WITH(doc-strings,
3002 AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings]))
3003
3004 if test -z "$with_doc_strings"
3005 then with_doc_strings="yes"
3006 fi
3007 if test "$with_doc_strings" != "no"
3008 then
3009 AC_DEFINE(WITH_DOC_STRINGS, 1,
3010 [Define if you want documentation strings in extension modules])
3011 fi
3012 AC_MSG_RESULT($with_doc_strings)
3013
3014 # Check for Python-specific malloc support
3015 AC_MSG_CHECKING(for --with-tsc)
3016 AC_ARG_WITH(tsc,
3017 AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[
3018 if test "$withval" != no
3019 then
3020 AC_DEFINE(WITH_TSC, 1,
3021 [Define to profile with the Pentium timestamp counter])
3022 AC_MSG_RESULT(yes)
3023 else AC_MSG_RESULT(no)
3024 fi],
3025 [AC_MSG_RESULT(no)])
3026
3027 # Check for Python-specific malloc support
3028 AC_MSG_CHECKING(for --with-pymalloc)
3029 AC_ARG_WITH(pymalloc,
3030 AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs]))
3031
3032 if test -z "$with_pymalloc"
3033 then with_pymalloc="yes"
3034 fi
3035 if test "$with_pymalloc" != "no"
3036 then
3037 AC_DEFINE(WITH_PYMALLOC, 1,
3038 [Define if you want to compile in Python-specific mallocs])
3039 fi
3040 AC_MSG_RESULT($with_pymalloc)
3041
3042 # Check for Valgrind support
3043 AC_MSG_CHECKING([for --with-valgrind])
3044 AC_ARG_WITH([valgrind],
3045 AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
3046 with_valgrind=no)
3047 AC_MSG_RESULT([$with_valgrind])
3048 if test "$with_valgrind" != no; then
3049 AC_CHECK_HEADER([valgrind/valgrind.h],
3050 [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
3051 [AC_MSG_ERROR([Valgrind support requested but headers not available])]
3052 )
3053 fi
3054
3055 # Check for --with-wctype-functions
3056 AC_MSG_CHECKING(for --with-wctype-functions)
3057 AC_ARG_WITH(wctype-functions,
3058 AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]),
3059 [
3060 if test "$withval" != no
3061 then
3062 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
3063 [Define if you want wctype.h functions to be used instead of the
3064 one supplied by Python itself. (see Include/unicodectype.h).])
3065 AC_MSG_RESULT(yes)
3066 else AC_MSG_RESULT(no)
3067 fi],
3068 [AC_MSG_RESULT(no)])
3069
3070 # -I${DLINCLDIR} is added to the compile rule for importdl.o
3071 AC_SUBST(DLINCLDIR)
3072 DLINCLDIR=.
3073
3074 # the dlopen() function means we might want to use dynload_shlib.o. some
3075 # platforms, such as AIX, have dlopen(), but don't want to use it.
3076 AC_CHECK_FUNCS(dlopen)
3077
3078 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
3079 # loading of modules.
3080 AC_SUBST(DYNLOADFILE)
3081 AC_MSG_CHECKING(DYNLOADFILE)
3082 if test -z "$DYNLOADFILE"
3083 then
3084 case $ac_sys_system/$ac_sys_release in
3085 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
3086 if test "$ac_cv_func_dlopen" = yes
3087 then DYNLOADFILE="dynload_shlib.o"
3088 else DYNLOADFILE="dynload_aix.o"
3089 fi
3090 ;;
3091 BeOS*) DYNLOADFILE="dynload_beos.o";;
3092 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
3093 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
3094 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
3095 atheos*) DYNLOADFILE="dynload_atheos.o";;
3096 *)
3097 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
3098 # out any dynamic loading
3099 if test "$ac_cv_func_dlopen" = yes
3100 then DYNLOADFILE="dynload_shlib.o"
3101 else DYNLOADFILE="dynload_stub.o"
3102 fi
3103 ;;
3104 esac
3105 fi
3106 AC_MSG_RESULT($DYNLOADFILE)
3107 if test "$DYNLOADFILE" != "dynload_stub.o"
3108 then
3109 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
3110 [Defined when any dynamic module loading is enabled.])
3111 fi
3112
3113 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
3114
3115 AC_SUBST(MACHDEP_OBJS)
3116 AC_MSG_CHECKING(MACHDEP_OBJS)
3117 if test -z "$MACHDEP_OBJS"
3118 then
3119 MACHDEP_OBJS=$extra_machdep_objs
3120 else
3121 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
3122 fi
3123 AC_MSG_RESULT(MACHDEP_OBJS)
3124
3125 # checks for library functions
3126 AC_CHECK_FUNCS(alarm setitimer getitimer chown \
3127 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
3128 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
3129 getentropy \
3130 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
3131 initgroups kill killpg lchown lstat mkfifo mknod mktime mmap \
3132 mremap nice pathconf pause plock poll pthread_init \
3133 putenv readlink realpath \
3134 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
3135 setgid \
3136 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
3137 setlocale setregid setreuid setresuid setresgid \
3138 setsid setpgid setpgrp setuid setvbuf snprintf \
3139 sigaction siginterrupt sigrelse strftime \
3140 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
3141 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
3142
3143 # Force lchmod off for Linux. Linux disallows changing the mode of symbolic
3144 # links. Some libc implementations have a stub lchmod implementation that always
3145 # returns an error.
3146 if test "$MACHDEP" != linux; then
3147 AC_CHECK_FUNCS(lchmod)
3148 fi
3149
3150 # For some functions, having a definition is not sufficient, since
3151 # we want to take their address.
3152 AC_MSG_CHECKING(for chroot)
3153 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])],
3154 [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
3155 AC_MSG_RESULT(yes)],
3156 [AC_MSG_RESULT(no)
3157 ])
3158 AC_MSG_CHECKING(for link)
3159 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])],
3160 [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
3161 AC_MSG_RESULT(yes)],
3162 [AC_MSG_RESULT(no)
3163 ])
3164 AC_MSG_CHECKING(for symlink)
3165 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])],
3166 [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
3167 AC_MSG_RESULT(yes)],
3168 [AC_MSG_RESULT(no)
3169 ])
3170 AC_MSG_CHECKING(for fchdir)
3171 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])],
3172 [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
3173 AC_MSG_RESULT(yes)],
3174 [AC_MSG_RESULT(no)
3175 ])
3176 AC_MSG_CHECKING(for fsync)
3177 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])],
3178 [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
3179 AC_MSG_RESULT(yes)],
3180 [AC_MSG_RESULT(no)
3181 ])
3182 AC_MSG_CHECKING(for fdatasync)
3183 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])],
3184 [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
3185 AC_MSG_RESULT(yes)],
3186 [AC_MSG_RESULT(no)
3187 ])
3188 AC_MSG_CHECKING(for epoll)
3189 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])],
3190 [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
3191 AC_MSG_RESULT(yes)],
3192 [AC_MSG_RESULT(no)
3193 ])
3194 AC_MSG_CHECKING(for kqueue)
3195 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3196 #include <sys/types.h>
3197 #include <sys/event.h>
3198 ]], [[int x=kqueue()]])],
3199 [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
3200 AC_MSG_RESULT(yes)],
3201 [AC_MSG_RESULT(no)
3202 ])
3203 # On some systems (eg. FreeBSD 5), we would find a definition of the
3204 # functions ctermid_r, setgroups in the library, but no prototype
3205 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
3206 # address to avoid compiler warnings and potential miscompilations
3207 # because of the missing prototypes.
3208
3209 AC_MSG_CHECKING(for ctermid_r)
3210 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3211 #include <stdio.h>
3212 ]], [[void* p = ctermid_r]])],
3213 [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
3214 AC_MSG_RESULT(yes)],
3215 [AC_MSG_RESULT(no)
3216 ])
3217
3218 AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl],
3219 [AC_COMPILE_IFELSE(
3220 [AC_LANG_PROGRAM(
3221 [#include <sys/file.h>],
3222 [void* p = flock]
3223 )],
3224 [ac_cv_flock_decl=yes],
3225 [ac_cv_flock_decl=no]
3226 )
3227 ])
3228 if test "x${ac_cv_flock_decl}" = xyes; then
3229 AC_CHECK_FUNCS(flock,,
3230 AC_CHECK_LIB(bsd,flock,
3231 [AC_DEFINE(HAVE_FLOCK)
3232 AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
3233 ])
3234 )
3235 fi
3236
3237 AC_MSG_CHECKING(for getpagesize)
3238 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3239 #include <unistd.h>
3240 ]], [[void* p = getpagesize]])],
3241 [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
3242 AC_MSG_RESULT(yes)],
3243 [AC_MSG_RESULT(no)
3244 ])
3245
3246 AC_MSG_CHECKING(for broken unsetenv)
3247 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3248 #include <stdlib.h>
3249 ]], [[int res = unsetenv("DUMMY")]])],
3250 [AC_MSG_RESULT(no)],
3251 [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.)
3252 AC_MSG_RESULT(yes)
3253 ])
3254
3255 dnl check for true
3256 AC_CHECK_PROGS(TRUE, true, /bin/true)
3257
3258 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
3259 dnl On others, they are in the C library, so we to take no action
3260 AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
3261 AC_CHECK_LIB(resolv, inet_aton)
3262 )
3263
3264 # On Tru64, chflags seems to be present, but calling it will
3265 # exit Python
3266 AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
3267 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3268 #include <sys/stat.h>
3269 #include <unistd.h>
3270 int main(int argc, char*argv[])
3271 {
3272 if(chflags(argv[0], 0) != 0)
3273 return 1;
3274 return 0;
3275 }
3276 ]])],
3277 [ac_cv_have_chflags=yes],
3278 [ac_cv_have_chflags=no],
3279 [ac_cv_have_chflags=cross])
3280 ])
3281 if test "$ac_cv_have_chflags" = cross ; then
3282 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
3283 fi
3284 if test "$ac_cv_have_chflags" = yes ; then
3285 AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the 'chflags' function.])
3286 fi
3287
3288 AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
3289 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3290 #include <sys/stat.h>
3291 #include <unistd.h>
3292 int main(int argc, char*argv[])
3293 {
3294 if(lchflags(argv[0], 0) != 0)
3295 return 1;
3296 return 0;
3297 }
3298 ]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross])
3299 ])
3300 if test "$ac_cv_have_lchflags" = cross ; then
3301 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
3302 fi
3303 if test "$ac_cv_have_lchflags" = yes ; then
3304 AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.])
3305 fi
3306
3307 dnl Check if system zlib has *Copy() functions
3308 dnl
3309 dnl On MacOSX the linker will search for dylibs on the entire linker path
3310 dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
3311 dnl to revert to a more traditional unix behaviour and make it possible to
3312 dnl override the system libz with a local static library of libz. Temporarily
3313 dnl add that flag to our CFLAGS as well to ensure that we check the version
3314 dnl of libz that will be used by setup.py.
3315 dnl The -L/usr/local/lib is needed as wel to get the same compilation
3316 dnl environment as setup.py (and leaving it out can cause configure to use the
3317 dnl wrong version of the library)
3318 case $ac_sys_system/$ac_sys_release in
3319 Darwin/*)
3320 _CUR_CFLAGS="${CFLAGS}"
3321 _CUR_LDFLAGS="${LDFLAGS}"
3322 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
3323 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
3324 ;;
3325 esac
3326
3327 AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
3328
3329 case $ac_sys_system/$ac_sys_release in
3330 Darwin/*)
3331 CFLAGS="${_CUR_CFLAGS}"
3332 LDFLAGS="${_CUR_LDFLAGS}"
3333 ;;
3334 esac
3335
3336 AC_MSG_CHECKING(for hstrerror)
3337 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3338 #include <netdb.h>
3339 ]], [[void* p = hstrerror; hstrerror(0)]])],
3340 [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
3341 AC_MSG_RESULT(yes)],
3342 [AC_MSG_RESULT(no)
3343 ])
3344
3345 AC_MSG_CHECKING(for inet_aton)
3346 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3347 #include <sys/types.h>
3348 #include <sys/socket.h>
3349 #include <netinet/in.h>
3350 #include <arpa/inet.h>
3351 ]], [[void* p = inet_aton;inet_aton(0,0)]])],
3352 [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
3353 AC_MSG_RESULT(yes)],
3354 [AC_MSG_RESULT(no)
3355 ])
3356
3357 AC_MSG_CHECKING(for inet_pton)
3358 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3359 #include <sys/types.h>
3360 #include <sys/socket.h>
3361 #include <netinet/in.h>
3362 #include <arpa/inet.h>
3363 ]], [[void* p = inet_pton]])],
3364 [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
3365 AC_MSG_RESULT(yes)],
3366 [AC_MSG_RESULT(no)
3367 ])
3368
3369 # On some systems, setgroups is in unistd.h, on others, in grp.h
3370 AC_MSG_CHECKING(for setgroups)
3371 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3372 #include <unistd.h>
3373 #ifdef HAVE_GRP_H
3374 #include <grp.h>
3375 #endif
3376 ]], [[void* p = setgroups]])],
3377 [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
3378 AC_MSG_RESULT(yes)],
3379 [AC_MSG_RESULT(no)
3380 ])
3381
3382 # check for openpty and forkpty
3383
3384 AC_CHECK_FUNCS(openpty,,
3385 AC_CHECK_LIB(util,openpty,
3386 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
3387 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
3388 )
3389 )
3390 AC_CHECK_FUNCS(forkpty,,
3391 AC_CHECK_LIB(util,forkpty,
3392 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
3393 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
3394 )
3395 )
3396
3397 # Stuff for expat.
3398 AC_CHECK_FUNCS(memmove)
3399
3400 # check for long file support functions
3401 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
3402
3403 AC_REPLACE_FUNCS(dup2 getcwd strdup)
3404 AC_CHECK_FUNCS(getpgrp,
3405 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
3406 [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
3407 [])
3408 )
3409 AC_CHECK_FUNCS(setpgrp,
3410 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])],
3411 [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])],
3412 [])
3413 )
3414 AC_CHECK_FUNCS(gettimeofday,
3415 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]],
3416 [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])],
3417 [],
3418 [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
3419 [Define if gettimeofday() does not have second (timezone) argument
3420 This is the case on Motorola V4 (R40V4.2)])
3421 ])
3422 )
3423
3424 AC_MSG_CHECKING(for major, minor, and makedev)
3425 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3426 #if defined(MAJOR_IN_MKDEV)
3427 #include <sys/mkdev.h>
3428 #elif defined(MAJOR_IN_SYSMACROS)
3429 #include <sys/sysmacros.h>
3430 #else
3431 #include <sys/types.h>
3432 #endif
3433 ]], [[
3434 makedev(major(0),minor(0));
3435 ]])],[
3436 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
3437 [Define to 1 if you have the device macros.])
3438 AC_MSG_RESULT(yes)
3439 ],[
3440 AC_MSG_RESULT(no)
3441 ])
3442
3443 # On OSF/1 V5.1, getaddrinfo is available, but a define
3444 # for [no]getaddrinfo in netdb.h.
3445 AC_MSG_CHECKING(for getaddrinfo)
3446 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3447 #include <sys/types.h>
3448 #include <sys/socket.h>
3449 #include <netdb.h>
3450 #include <stdio.h>
3451 ]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],
3452 [have_getaddrinfo=yes],
3453 [have_getaddrinfo=no])
3454 AC_MSG_RESULT($have_getaddrinfo)
3455 if test $have_getaddrinfo = yes
3456 then
3457 AC_MSG_CHECKING(getaddrinfo bug)
3458 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
3459 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
3460 #include <stdio.h>
3461 #include <sys/types.h>
3462 #include <netdb.h>
3463 #include <string.h>
3464 #include <sys/socket.h>
3465 #include <netinet/in.h>
3466
3467 int main()
3468 {
3469 int passive, gaierr, inet4 = 0, inet6 = 0;
3470 struct addrinfo hints, *ai, *aitop;
3471 char straddr[INET6_ADDRSTRLEN], strport[16];
3472
3473 for (passive = 0; passive <= 1; passive++) {
3474 memset(&hints, 0, sizeof(hints));
3475 hints.ai_family = AF_UNSPEC;
3476 hints.ai_flags = passive ? AI_PASSIVE : 0;
3477 hints.ai_socktype = SOCK_STREAM;
3478 hints.ai_protocol = IPPROTO_TCP;
3479 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
3480 (void)gai_strerror(gaierr);
3481 goto bad;
3482 }
3483 for (ai = aitop; ai; ai = ai->ai_next) {
3484 if (ai->ai_addr == NULL ||
3485 ai->ai_addrlen == 0 ||
3486 getnameinfo(ai->ai_addr, ai->ai_addrlen,
3487 straddr, sizeof(straddr), strport, sizeof(strport),
3488 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
3489 goto bad;
3490 }
3491 switch (ai->ai_family) {
3492 case AF_INET:
3493 if (strcmp(strport, "54321") != 0) {
3494 goto bad;
3495 }
3496 if (passive) {
3497 if (strcmp(straddr, "0.0.0.0") != 0) {
3498 goto bad;
3499 }
3500 } else {
3501 if (strcmp(straddr, "127.0.0.1") != 0) {
3502 goto bad;
3503 }
3504 }
3505 inet4++;
3506 break;
3507 case AF_INET6:
3508 if (strcmp(strport, "54321") != 0) {
3509 goto bad;
3510 }
3511 if (passive) {
3512 if (strcmp(straddr, "::") != 0) {
3513 goto bad;
3514 }
3515 } else {
3516 if (strcmp(straddr, "::1") != 0) {
3517 goto bad;
3518 }
3519 }
3520 inet6++;
3521 break;
3522 case AF_UNSPEC:
3523 goto bad;
3524 break;
3525 default:
3526 /* another family support? */
3527 break;
3528 }
3529 }
3530 freeaddrinfo(aitop);
3531 aitop = NULL;
3532 }
3533
3534 if (!(inet4 == 0 || inet4 == 2))
3535 goto bad;
3536 if (!(inet6 == 0 || inet6 == 2))
3537 goto bad;
3538
3539 if (aitop)
3540 freeaddrinfo(aitop);
3541 return 0;
3542
3543 bad:
3544 if (aitop)
3545 freeaddrinfo(aitop);
3546 return 1;
3547 }
3548 ]]])],
3549 [ac_cv_buggy_getaddrinfo=no],
3550 [ac_cv_buggy_getaddrinfo=yes],
3551 [
3552 if test "${enable_ipv6+set}" = set; then
3553 ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6"
3554 else
3555 ac_cv_buggy_getaddrinfo=yes
3556 fi]))
3557 fi
3558
3559 AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
3560
3561 if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
3562 then
3563 if test $ipv6 = yes
3564 then
3565 echo 'Fatal: You must get working getaddrinfo() function.'
3566 echo ' or you can specify "--disable-ipv6"'.
3567 exit 1
3568 fi
3569 else
3570 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
3571 fi
3572
3573 AC_CHECK_FUNCS(getnameinfo)
3574
3575 # checks for structures
3576 AC_HEADER_TIME
3577 AC_STRUCT_TM
3578 AC_STRUCT_TIMEZONE
3579 AC_CHECK_MEMBERS([struct stat.st_rdev])
3580 AC_CHECK_MEMBERS([struct stat.st_blksize])
3581 AC_CHECK_MEMBERS([struct stat.st_flags])
3582 AC_CHECK_MEMBERS([struct stat.st_gen])
3583 AC_CHECK_MEMBERS([struct stat.st_birthtime])
3584 AC_CHECK_MEMBERS([struct stat.st_blocks])
3585
3586 AC_MSG_CHECKING(for time.h that defines altzone)
3587 AC_CACHE_VAL(ac_cv_header_time_altzone,[
3588 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])],
3589 [ac_cv_header_time_altzone=yes],
3590 [ac_cv_header_time_altzone=no])
3591 ])
3592 AC_MSG_RESULT($ac_cv_header_time_altzone)
3593 if test $ac_cv_header_time_altzone = yes; then
3594 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
3595 fi
3596
3597 was_it_defined=no
3598 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
3599 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3600 #include <sys/types.h>
3601 #include <sys/select.h>
3602 #include <sys/time.h>
3603 ]], [[;]])],[
3604 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
3605 [Define if you can safely include both <sys/select.h> and <sys/time.h>
3606 (which you can't on SCO ODT 3.0).])
3607 was_it_defined=yes
3608 ],[])
3609 AC_MSG_RESULT($was_it_defined)
3610
3611 AC_MSG_CHECKING(for addrinfo)
3612 AC_CACHE_VAL(ac_cv_struct_addrinfo,
3613 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
3614 [ac_cv_struct_addrinfo=yes],
3615 [ac_cv_struct_addrinfo=no]))
3616 AC_MSG_RESULT($ac_cv_struct_addrinfo)
3617 if test $ac_cv_struct_addrinfo = yes; then
3618 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
3619 fi
3620
3621 AC_MSG_CHECKING(for sockaddr_storage)
3622 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
3623 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3624 # include <sys/types.h>
3625 # include <sys/socket.h>]], [[struct sockaddr_storage s]])],
3626 [ac_cv_struct_sockaddr_storage=yes],
3627 [ac_cv_struct_sockaddr_storage=no]))
3628 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3629 if test $ac_cv_struct_sockaddr_storage = yes; then
3630 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
3631 fi
3632
3633 # checks for compiler characteristics
3634
3635 AC_C_CHAR_UNSIGNED
3636 AC_C_CONST
3637
3638 works=no
3639 AC_MSG_CHECKING(for working volatile)
3640 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])],
3641 [works=yes],
3642 [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])]
3643 )
3644 AC_MSG_RESULT($works)
3645
3646 works=no
3647 AC_MSG_CHECKING(for working signed char)
3648 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])],
3649 [works=yes],
3650 [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])]
3651 )
3652 AC_MSG_RESULT($works)
3653
3654 have_prototypes=no
3655 AC_MSG_CHECKING(for prototypes)
3656 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])],
3657 [AC_DEFINE(HAVE_PROTOTYPES, 1,
3658 [Define if your compiler supports function prototype])
3659 have_prototypes=yes],
3660 []
3661 )
3662 AC_MSG_RESULT($have_prototypes)
3663
3664 works=no
3665 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
3666 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3667 #include <stdarg.h>
3668 int foo(int x, ...) {
3669 va_list va;
3670 va_start(va, x);
3671 va_arg(va, int);
3672 va_arg(va, char *);
3673 va_arg(va, double);
3674 return 0;
3675 }
3676 ]], [[return foo(10, "", 3.14);]])],[
3677 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3678 [Define if your compiler supports variable length function prototypes
3679 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3680 works=yes
3681 ],[])
3682 AC_MSG_RESULT($works)
3683
3684 # check for socketpair
3685 AC_MSG_CHECKING(for socketpair)
3686 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3687 #include <sys/types.h>
3688 #include <sys/socket.h>
3689 ]], [[void *x=socketpair]])],
3690 [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.])
3691 AC_MSG_RESULT(yes)],
3692 [AC_MSG_RESULT(no)]
3693 )
3694
3695 # check if sockaddr has sa_len member
3696 AC_MSG_CHECKING(if sockaddr has sa_len member)
3697 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3698 #include <sys/socket.h>]], [[struct sockaddr x;
3699 x.sa_len = 0;]])],
3700 [AC_MSG_RESULT(yes)
3701 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])],
3702 [AC_MSG_RESULT(no)]
3703 )
3704
3705 va_list_is_array=no
3706 AC_MSG_CHECKING(whether va_list is an array)
3707 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3708 #ifdef HAVE_STDARG_PROTOTYPES
3709 #include <stdarg.h>
3710 #else
3711 #include <varargs.h>
3712 #endif
3713 ]], [[va_list list1, list2; list1 = list2;]])],[],[
3714 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3715 va_list_is_array=yes
3716 ])
3717 AC_MSG_RESULT($va_list_is_array)
3718
3719 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
3720 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3721 [Define this if you have some version of gethostbyname_r()])
3722
3723 AC_CHECK_FUNC(gethostbyname_r, [
3724 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3725 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3726 OLD_CFLAGS=$CFLAGS
3727 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
3728 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3729 # include <netdb.h>
3730 ]], [[
3731 char *name;
3732 struct hostent *he, *res;
3733 char buffer[2048];
3734 int buflen = 2048;
3735 int h_errnop;
3736
3737 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
3738 ]])],[
3739 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3740 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3741 [Define this if you have the 6-arg version of gethostbyname_r().])
3742 AC_MSG_RESULT(yes)
3743 ],[
3744 AC_MSG_RESULT(no)
3745 AC_MSG_CHECKING([gethostbyname_r with 5 args])
3746 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3747 # include <netdb.h>
3748 ]], [[
3749 char *name;
3750 struct hostent *he;
3751 char buffer[2048];
3752 int buflen = 2048;
3753 int h_errnop;
3754
3755 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3756 ]])],
3757 [
3758 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3759 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3760 [Define this if you have the 5-arg version of gethostbyname_r().])
3761 AC_MSG_RESULT(yes)
3762 ], [
3763 AC_MSG_RESULT(no)
3764 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3765 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3766 # include <netdb.h>
3767 ]], [[
3768 char *name;
3769 struct hostent *he;
3770 struct hostent_data data;
3771
3772 (void) gethostbyname_r(name, he, &data);
3773 ]])],
3774 [
3775 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3776 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3777 [Define this if you have the 3-arg version of gethostbyname_r().])
3778 AC_MSG_RESULT(yes)
3779 ], [
3780 AC_MSG_RESULT(no)
3781 ])
3782 ])
3783 ])
3784 CFLAGS=$OLD_CFLAGS
3785 ], [
3786 AC_CHECK_FUNCS(gethostbyname)
3787 ])
3788 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3789 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3790 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
3791 AC_SUBST(HAVE_GETHOSTBYNAME_R)
3792 AC_SUBST(HAVE_GETHOSTBYNAME)
3793
3794 # checks for system services
3795 # (none yet)
3796
3797 # Linux requires this for correct f.p. operations
3798 AC_CHECK_FUNC(__fpu_control,
3799 [],
3800 [AC_CHECK_LIB(ieee, __fpu_control)
3801 ])
3802
3803 # Check for --with-fpectl
3804 AC_MSG_CHECKING(for --with-fpectl)
3805 AC_ARG_WITH(fpectl,
3806 AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]),
3807 [
3808 if test "$withval" != no
3809 then
3810 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3811 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3812 AC_MSG_RESULT(yes)
3813 else AC_MSG_RESULT(no)
3814 fi],
3815 [AC_MSG_RESULT(no)])
3816
3817 # check for --with-libm=...
3818 AC_SUBST(LIBM)
3819 case $ac_sys_system in
3820 Darwin) ;;
3821 BeOS) ;;
3822 *) LIBM=-lm
3823 esac
3824 AC_MSG_CHECKING(for --with-libm=STRING)
3825 AC_ARG_WITH(libm,
3826 AS_HELP_STRING([--with-libm=STRING], [math library]),
3827 [
3828 if test "$withval" = no
3829 then LIBM=
3830 AC_MSG_RESULT(force LIBM empty)
3831 elif test "$withval" != yes
3832 then LIBM=$withval
3833 AC_MSG_RESULT(set LIBM="$withval")
3834 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
3835 fi],
3836 [AC_MSG_RESULT(default LIBM="$LIBM")])
3837
3838 # check for --with-libc=...
3839 AC_SUBST(LIBC)
3840 AC_MSG_CHECKING(for --with-libc=STRING)
3841 AC_ARG_WITH(libc,
3842 AS_HELP_STRING([--with-libc=STRING], [C library]),
3843 [
3844 if test "$withval" = no
3845 then LIBC=
3846 AC_MSG_RESULT(force LIBC empty)
3847 elif test "$withval" != yes
3848 then LIBC=$withval
3849 AC_MSG_RESULT(set LIBC="$withval")
3850 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
3851 fi],
3852 [AC_MSG_RESULT(default LIBC="$LIBC")])
3853
3854 # **************************************************
3855 # * Check for various properties of floating point *
3856 # **************************************************
3857
3858 AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3859 AC_CACHE_VAL(ac_cv_little_endian_double, [
3860 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3861 #include <string.h>
3862 int main() {
3863 double x = 9006104071832581.0;
3864 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3865 return 0;
3866 else
3867 return 1;
3868 }
3869 ]])],
3870 [ac_cv_little_endian_double=yes],
3871 [ac_cv_little_endian_double=no],
3872 [ac_cv_little_endian_double=no])])
3873 AC_MSG_RESULT($ac_cv_little_endian_double)
3874 if test "$ac_cv_little_endian_double" = yes
3875 then
3876 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3877 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3878 with the least significant byte first])
3879 fi
3880
3881 AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3882 AC_CACHE_VAL(ac_cv_big_endian_double, [
3883 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3884 #include <string.h>
3885 int main() {
3886 double x = 9006104071832581.0;
3887 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3888 return 0;
3889 else
3890 return 1;
3891 }
3892 ]])],
3893 [ac_cv_big_endian_double=yes],
3894 [ac_cv_big_endian_double=no],
3895 [ac_cv_big_endian_double=no])])
3896 AC_MSG_RESULT($ac_cv_big_endian_double)
3897 if test "$ac_cv_big_endian_double" = yes
3898 then
3899 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3900 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3901 with the most significant byte first])
3902 fi
3903
3904 # Some ARM platforms use a mixed-endian representation for doubles.
3905 # While Python doesn't currently have full support for these platforms
3906 # (see e.g., issue 1762561), we can at least make sure that float <-> string
3907 # conversions work.
3908 AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3909 AC_CACHE_VAL(ac_cv_mixed_endian_double, [
3910 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3911 #include <string.h>
3912 int main() {
3913 double x = 9006104071832581.0;
3914 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3915 return 0;
3916 else
3917 return 1;
3918 }
3919 ]])],
3920 [ac_cv_mixed_endian_double=yes],
3921 [ac_cv_mixed_endian_double=no],
3922 [ac_cv_mixed_endian_double=no])])
3923 AC_MSG_RESULT($ac_cv_mixed_endian_double)
3924 if test "$ac_cv_mixed_endian_double" = yes
3925 then
3926 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3927 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3928 in ARM mixed-endian order (byte order 45670123)])
3929 fi
3930
3931 # The short float repr introduced in Python 3.1 requires the
3932 # correctly-rounded string <-> double conversion functions from
3933 # Python/dtoa.c, which in turn require that the FPU uses 53-bit
3934 # rounding; this is a problem on x86, where the x87 FPU has a default
3935 # rounding precision of 64 bits. For gcc/x86, we can fix this by
3936 # using inline assembler to get and set the x87 FPU control word.
3937
3938 # This inline assembler syntax may also work for suncc and icc,
3939 # so we try it on all platforms.
3940
3941 AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
3942 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
3943 unsigned short cw;
3944 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3945 __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
3946 ]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no])
3947 AC_MSG_RESULT($have_gcc_asm_for_x87)
3948 if test "$have_gcc_asm_for_x87" = yes
3949 then
3950 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3951 [Define if we can use gcc inline assembler to get and set x87 control word])
3952 fi
3953
3954 # Detect whether system arithmetic is subject to x87-style double
3955 # rounding issues. The result of this test has little meaning on non
3956 # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3957 # mode is round-to-nearest and double rounding issues are present, and
3958 # 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3959 AC_MSG_CHECKING(for x87-style double rounding)
3960 # $BASECFLAGS may affect the result
3961 ac_save_cc="$CC"
3962 CC="$CC $BASECFLAGS"
3963 AC_RUN_IFELSE([AC_LANG_SOURCE([[
3964 #include <stdlib.h>
3965 #include <math.h>
3966 int main() {
3967 volatile double x, y, z;
3968 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3969 x = 0.99999999999999989; /* 1-2**-53 */
3970 y = 1./x;
3971 if (y != 1.)
3972 exit(0);
3973 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3974 x = 1e16;
3975 y = 2.99999;
3976 z = x + y;
3977 if (z != 1e16+4.)
3978 exit(0);
3979 /* both tests show evidence of double rounding */
3980 exit(1);
3981 }
3982 ]])],
3983 [ac_cv_x87_double_rounding=no],
3984 [ac_cv_x87_double_rounding=yes],
3985 [ac_cv_x87_double_rounding=no])
3986 CC="$ac_save_cc"
3987 AC_MSG_RESULT($ac_cv_x87_double_rounding)
3988 if test "$ac_cv_x87_double_rounding" = yes
3989 then
3990 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3991 [Define if arithmetic is subject to x87-style double rounding issue])
3992 fi
3993
3994 # ************************************
3995 # * Check for mathematical functions *
3996 # ************************************
3997
3998 LIBS_SAVE=$LIBS
3999 LIBS="$LIBS $LIBM"
4000
4001 # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
4002 # -0. on some architectures.
4003 AC_MSG_CHECKING(whether tanh preserves the sign of zero)
4004 AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
4005 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4006 #include <math.h>
4007 #include <stdlib.h>
4008 int main() {
4009 /* return 0 if either negative zeros don't exist
4010 on this platform or if negative zeros exist
4011 and tanh(-0.) == -0. */
4012 if (atan2(0., -1.) == atan2(-0., -1.) ||
4013 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
4014 else exit(1);
4015 }
4016 ]])],
4017 [ac_cv_tanh_preserves_zero_sign=yes],
4018 [ac_cv_tanh_preserves_zero_sign=no],
4019 [ac_cv_tanh_preserves_zero_sign=no])])
4020 AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
4021 if test "$ac_cv_tanh_preserves_zero_sign" = yes
4022 then
4023 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
4024 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
4025 fi
4026
4027 AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
4028 AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
4029 AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
4030
4031 LIBS=$LIBS_SAVE
4032
4033 # For multiprocessing module, check that sem_open
4034 # actually works. For FreeBSD versions <= 7.2,
4035 # the kernel module that provides POSIX semaphores
4036 # isn't loaded by default, so an attempt to call
4037 # sem_open results in a 'Signal 12' error.
4038 AC_MSG_CHECKING(whether POSIX semaphores are enabled)
4039 AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
4040 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4041 #include <unistd.h>
4042 #include <fcntl.h>
4043 #include <stdio.h>
4044 #include <semaphore.h>
4045 #include <sys/stat.h>
4046
4047 int main(void) {
4048 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
4049 if (a == SEM_FAILED) {
4050 perror("sem_open");
4051 return 1;
4052 }
4053 sem_close(a);
4054 sem_unlink("/autoconf");
4055 return 0;
4056 }
4057 ]])],
4058 [ac_cv_posix_semaphores_enabled=yes],
4059 [ac_cv_posix_semaphores_enabled=no],
4060 [ac_cv_posix_semaphores_enabled=yes])
4061 )
4062 AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
4063 if test $ac_cv_posix_semaphores_enabled = no
4064 then
4065 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
4066 [Define if POSIX semaphores aren't enabled on your system])
4067 fi
4068
4069 # Multiprocessing check for broken sem_getvalue
4070 AC_MSG_CHECKING(for broken sem_getvalue)
4071 AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
4072 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4073 #include <unistd.h>
4074 #include <fcntl.h>
4075 #include <stdio.h>
4076 #include <semaphore.h>
4077 #include <sys/stat.h>
4078
4079 int main(void){
4080 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
4081 int count;
4082 int res;
4083 if(a==SEM_FAILED){
4084 perror("sem_open");
4085 return 1;
4086
4087 }
4088 res = sem_getvalue(a, &count);
4089 sem_close(a);
4090 sem_unlink("/autocftw");
4091 return res==-1 ? 1 : 0;
4092 }
4093 ]])],
4094 [ac_cv_broken_sem_getvalue=no],
4095 [ac_cv_broken_sem_getvalue=yes],
4096 [ac_cv_broken_sem_getvalue=yes])
4097 )
4098 AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
4099 if test $ac_cv_broken_sem_getvalue = yes
4100 then
4101 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
4102 [define to 1 if your sem_getvalue is broken.])
4103 fi
4104
4105 # determine what size digit to use for Python's longs
4106 AC_MSG_CHECKING([digit size for Python's longs])
4107 AC_ARG_ENABLE(big-digits,
4108 AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
4109 [case $enable_big_digits in
4110 yes)
4111 enable_big_digits=30 ;;
4112 no)
4113 enable_big_digits=15 ;;
4114 [15|30])
4115 ;;
4116 *)
4117 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
4118 esac
4119 AC_MSG_RESULT($enable_big_digits)
4120 AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
4121 ],
4122 [AC_MSG_RESULT(no value specified)])
4123
4124 # check for wchar.h
4125 AC_CHECK_HEADER(wchar.h, [
4126 AC_DEFINE(HAVE_WCHAR_H, 1,
4127 [Define if the compiler provides a wchar.h header file.])
4128 wchar_h="yes"
4129 ],
4130 wchar_h="no"
4131 )
4132
4133 # determine wchar_t size
4134 if test "$wchar_h" = yes
4135 then
4136 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
4137 fi
4138
4139 AC_MSG_CHECKING(for UCS-4 tcl)
4140 have_ucs4_tcl=no
4141 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4142 #include <tcl.h>
4143 #if TCL_UTF_MAX != 6
4144 # error "NOT UCS4_TCL"
4145 #endif]], [[]])],[
4146 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
4147 have_ucs4_tcl=yes
4148 ],[])
4149 AC_MSG_RESULT($have_ucs4_tcl)
4150
4151 # check whether wchar_t is signed or not
4152 if test "$wchar_h" = yes
4153 then
4154 # check whether wchar_t is signed or not
4155 AC_MSG_CHECKING(whether wchar_t is signed)
4156 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
4157 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4158 #include <wchar.h>
4159 int main()
4160 {
4161 /* Success: exit code 0 */
4162 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
4163 }
4164 ]])],
4165 [ac_cv_wchar_t_signed=yes],
4166 [ac_cv_wchar_t_signed=no],
4167 [ac_cv_wchar_t_signed=yes])])
4168 AC_MSG_RESULT($ac_cv_wchar_t_signed)
4169 fi
4170
4171 AC_MSG_CHECKING(what type to use for unicode)
4172 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
4173 AC_ARG_ENABLE(unicode,
4174 AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is ucs2)]),
4175 [],
4176 [enable_unicode=yes])
4177
4178 if test $enable_unicode = yes
4179 then
4180 # Without any arguments, Py_UNICODE defaults to two-byte mode
4181 case "$have_ucs4_tcl" in
4182 yes) enable_unicode="ucs4"
4183 ;;
4184 *) enable_unicode="ucs2"
4185 ;;
4186 esac
4187 fi
4188
4189 AH_TEMPLATE(Py_UNICODE_SIZE,
4190 [Define as the size of the unicode type.])
4191 case "$enable_unicode" in
4192 ucs2) unicode_size="2"
4193 AC_DEFINE(Py_UNICODE_SIZE,2)
4194 ;;
4195 ucs4) unicode_size="4"
4196 AC_DEFINE(Py_UNICODE_SIZE,4)
4197 ;;
4198 no) ;; # To allow --disable-unicode
4199 *) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
4200 esac
4201
4202 AH_TEMPLATE(PY_UNICODE_TYPE,
4203 [Define as the integral type used for Unicode representation.])
4204
4205 AC_SUBST(UNICODE_OBJS)
4206 if test "$enable_unicode" = "no"
4207 then
4208 UNICODE_OBJS=""
4209 AC_MSG_RESULT(not used)
4210 else
4211 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
4212 AC_DEFINE(Py_USING_UNICODE, 1,
4213 [Define if you want to have a Unicode type.])
4214
4215 # wchar_t is only usable if it maps to an unsigned type
4216 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
4217 -a "$ac_cv_wchar_t_signed" = "no"
4218 then
4219 PY_UNICODE_TYPE="wchar_t"
4220 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
4221 [Define if you have a useable wchar_t type defined in wchar.h; useable
4222 means wchar_t must be an unsigned type with at least 16 bits. (see
4223 Include/unicodeobject.h).])
4224 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
4225 elif test "$ac_cv_sizeof_short" = "$unicode_size"
4226 then
4227 PY_UNICODE_TYPE="unsigned short"
4228 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
4229 elif test "$ac_cv_sizeof_long" = "$unicode_size"
4230 then
4231 PY_UNICODE_TYPE="unsigned long"
4232 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
4233 else
4234 PY_UNICODE_TYPE="no type found"
4235 fi
4236 AC_MSG_RESULT($PY_UNICODE_TYPE)
4237 fi
4238
4239 # check for endianness
4240 AC_C_BIGENDIAN
4241
4242 # Check whether right shifting a negative integer extends the sign bit
4243 # or fills with zeros (like the Cray J90, according to Tim Peters).
4244 AC_MSG_CHECKING(whether right shift extends the sign bit)
4245 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
4246 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4247 int main()
4248 {
4249 exit(((-1)>>3 == -1) ? 0 : 1);
4250 }
4251 ]])],
4252 [ac_cv_rshift_extends_sign=yes],
4253 [ac_cv_rshift_extends_sign=no],
4254 [ac_cv_rshift_extends_sign=yes])])
4255 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
4256 if test "$ac_cv_rshift_extends_sign" = no
4257 then
4258 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
4259 [Define if i>>j for signed int i does not extend the sign bit
4260 when i < 0])
4261 fi
4262
4263 # check for getc_unlocked and related locking functions
4264 AC_MSG_CHECKING(for getc_unlocked() and friends)
4265 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
4266 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
4267 FILE *f = fopen("/dev/null", "r");
4268 flockfile(f);
4269 getc_unlocked(f);
4270 funlockfile(f);
4271 ]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])])
4272 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
4273 if test "$ac_cv_have_getc_unlocked" = yes
4274 then
4275 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
4276 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
4277 fi
4278
4279 # check where readline lives
4280 # save the value of LIBS so we don't actually link Python with readline
4281 LIBS_no_readline=$LIBS
4282
4283 # On some systems we need to link readline to a termcap compatible
4284 # library. NOTE: Keep the precedence of listed libraries synchronised
4285 # with setup.py.
4286 py_cv_lib_readline=no
4287 AC_MSG_CHECKING([how to link readline libs])
4288 for py_libtermcap in "" ncursesw ncurses curses termcap; do
4289 if test -z "$py_libtermcap"; then
4290 READLINE_LIBS="-lreadline"
4291 else
4292 READLINE_LIBS="-lreadline -l$py_libtermcap"
4293 fi
4294 LIBS="$READLINE_LIBS $LIBS_no_readline"
4295 AC_LINK_IFELSE(
4296 [AC_LANG_CALL([],[readline])],
4297 [py_cv_lib_readline=yes])
4298 if test $py_cv_lib_readline = yes; then
4299 break
4300 fi
4301 done
4302 # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
4303 #AC_SUBST([READLINE_LIBS])
4304 if test $py_cv_lib_readline = no; then
4305 AC_MSG_RESULT([none])
4306 else
4307 AC_MSG_RESULT([$READLINE_LIBS])
4308 AC_DEFINE(HAVE_LIBREADLINE, 1,
4309 [Define if you have the readline library (-lreadline).])
4310 fi
4311
4312 # check for readline 2.1
4313 AC_CHECK_LIB(readline, rl_callback_handler_install,
4314 AC_DEFINE(HAVE_RL_CALLBACK, 1,
4315 [Define if you have readline 2.1]), ,$READLINE_LIBS)
4316
4317 # check for readline 2.2
4318 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
4319 [have_readline=yes],
4320 [have_readline=no]
4321 )
4322 if test $have_readline = yes
4323 then
4324 AC_EGREP_HEADER([extern int rl_completion_append_character;],
4325 [readline/readline.h],
4326 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
4327 [Define if you have readline 2.2]), )
4328 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
4329 [readline/readline.h],
4330 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
4331 [Define if you have rl_completion_suppress_append]), )
4332 fi
4333
4334 # check for readline 4.0
4335 AC_CHECK_LIB(readline, rl_pre_input_hook,
4336 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
4337 [Define if you have readline 4.0]), ,$READLINE_LIBS)
4338
4339 # also in 4.0
4340 AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
4341 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
4342 [Define if you have readline 4.0]), ,$READLINE_LIBS)
4343
4344 # also in 4.0, but not in editline
4345 AC_CHECK_LIB(readline, rl_resize_terminal,
4346 AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1,
4347 [Define if you have readline 4.0]), ,$READLINE_LIBS)
4348
4349 # check for readline 4.2
4350 AC_CHECK_LIB(readline, rl_completion_matches,
4351 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
4352 [Define if you have readline 4.2]), ,$READLINE_LIBS)
4353
4354 # also in readline 4.2
4355 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
4356 [have_readline=yes],
4357 [have_readline=no]
4358 )
4359 if test $have_readline = yes
4360 then
4361 AC_EGREP_HEADER([extern int rl_catch_signals;],
4362 [readline/readline.h],
4363 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
4364 [Define if you can turn off readline's signal handling.]), )
4365 fi
4366
4367 # End of readline checks: restore LIBS
4368 LIBS=$LIBS_no_readline
4369
4370 AC_MSG_CHECKING(for broken nice())
4371 AC_CACHE_VAL(ac_cv_broken_nice, [
4372 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4373 #include <stdlib.h>
4374 #include <unistd.h>
4375 int main()
4376 {
4377 int val1 = nice(1);
4378 if (val1 != -1 && val1 == nice(2))
4379 exit(0);
4380 exit(1);
4381 }
4382 ]])],
4383 [ac_cv_broken_nice=yes],
4384 [ac_cv_broken_nice=no],
4385 [ac_cv_broken_nice=no])])
4386 AC_MSG_RESULT($ac_cv_broken_nice)
4387 if test "$ac_cv_broken_nice" = yes
4388 then
4389 AC_DEFINE(HAVE_BROKEN_NICE, 1,
4390 [Define if nice() returns success/failure instead of the new priority.])
4391 fi
4392
4393 AC_MSG_CHECKING(for broken poll())
4394 AC_CACHE_VAL(ac_cv_broken_poll,
4395 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4396 #include <poll.h>
4397
4398 int main()
4399 {
4400 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
4401 int poll_test;
4402
4403 close (42);
4404
4405 poll_test = poll(&poll_struct, 1, 0);
4406 if (poll_test < 0)
4407 return 0;
4408 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
4409 return 0;
4410 else
4411 return 1;
4412 }
4413 ]])],
4414 [ac_cv_broken_poll=yes],
4415 [ac_cv_broken_poll=no],
4416 [ac_cv_broken_poll=no]))
4417 AC_MSG_RESULT($ac_cv_broken_poll)
4418 if test "$ac_cv_broken_poll" = yes
4419 then
4420 AC_DEFINE(HAVE_BROKEN_POLL, 1,
4421 [Define if poll() sets errno on invalid file descriptors.])
4422 fi
4423
4424 # check tzset(3) exists and works like we expect it to
4425 AC_MSG_CHECKING(for working tzset())
4426 AC_CACHE_VAL(ac_cv_working_tzset, [
4427 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4428 #include <stdlib.h>
4429 #include <time.h>
4430 #include <string.h>
4431
4432 #if HAVE_TZNAME
4433 extern char *tzname[];
4434 #endif
4435
4436 int main()
4437 {
4438 /* Note that we need to ensure that not only does tzset(3)
4439 do 'something' with localtime, but it works as documented
4440 in the library reference and as expected by the test suite.
4441 This includes making sure that tzname is set properly if
4442 tm->tm_zone does not exist since it is the alternative way
4443 of getting timezone info.
4444
4445 Red Hat 6.2 doesn't understand the southern hemisphere
4446 after New Year's Day.
4447 */
4448
4449 time_t groundhogday = 1044144000; /* GMT-based */
4450 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
4451
4452 putenv("TZ=UTC+0");
4453 tzset();
4454 if (localtime(&groundhogday)->tm_hour != 0)
4455 exit(1);
4456 #if HAVE_TZNAME
4457 /* For UTC, tzname[1] is sometimes "", sometimes " " */
4458 if (strcmp(tzname[0], "UTC") ||
4459 (tzname[1][0] != 0 && tzname[1][0] != ' '))
4460 exit(1);
4461 #endif
4462
4463 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
4464 tzset();
4465 if (localtime(&groundhogday)->tm_hour != 19)
4466 exit(1);
4467 #if HAVE_TZNAME
4468 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
4469 exit(1);
4470 #endif
4471
4472 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
4473 tzset();
4474 if (localtime(&groundhogday)->tm_hour != 11)
4475 exit(1);
4476 #if HAVE_TZNAME
4477 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
4478 exit(1);
4479 #endif
4480
4481 #if HAVE_STRUCT_TM_TM_ZONE
4482 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
4483 exit(1);
4484 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
4485 exit(1);
4486 #endif
4487
4488 exit(0);
4489 }
4490 ]])],
4491 [ac_cv_working_tzset=yes],
4492 [ac_cv_working_tzset=no],
4493 [ac_cv_working_tzset=no])])
4494 AC_MSG_RESULT($ac_cv_working_tzset)
4495 if test "$ac_cv_working_tzset" = yes
4496 then
4497 AC_DEFINE(HAVE_WORKING_TZSET, 1,
4498 [Define if tzset() actually switches the local timezone in a meaningful way.])
4499 fi
4500
4501 # Look for subsecond timestamps in struct stat
4502 AC_MSG_CHECKING(for tv_nsec in struct stat)
4503 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
4504 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
4505 struct stat st;
4506 st.st_mtim.tv_nsec = 1;
4507 ]])],
4508 [ac_cv_stat_tv_nsec=yes],
4509 [ac_cv_stat_tv_nsec=no]))
4510 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
4511 if test "$ac_cv_stat_tv_nsec" = yes
4512 then
4513 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
4514 [Define if you have struct stat.st_mtim.tv_nsec])
4515 fi
4516
4517 # Look for BSD style subsecond timestamps in struct stat
4518 AC_MSG_CHECKING(for tv_nsec2 in struct stat)
4519 AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
4520 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
4521 struct stat st;
4522 st.st_mtimespec.tv_nsec = 1;
4523 ]])],
4524 [ac_cv_stat_tv_nsec2=yes],
4525 [ac_cv_stat_tv_nsec2=no]))
4526 AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
4527 if test "$ac_cv_stat_tv_nsec2" = yes
4528 then
4529 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
4530 [Define if you have struct stat.st_mtimensec])
4531 fi
4532
4533 # first curses configure check
4534 ac_save_cppflags="$CPPFLAGS"
4535 CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
4536
4537 AC_CHECK_HEADERS(curses.h ncurses.h)
4538
4539 # On Solaris, term.h requires curses.h
4540 AC_CHECK_HEADERS(term.h,,,[
4541 #ifdef HAVE_CURSES_H
4542 #include <curses.h>
4543 #endif
4544 ])
4545
4546 # On HP/UX 11.0, mvwdelch is a block with a return statement
4547 AC_MSG_CHECKING(whether mvwdelch is an expression)
4548 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
4549 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4550 int rtn;
4551 rtn = mvwdelch(0,0,0);
4552 ]])],
4553 [ac_cv_mvwdelch_is_expression=yes],
4554 [ac_cv_mvwdelch_is_expression=no]))
4555 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
4556
4557 if test "$ac_cv_mvwdelch_is_expression" = yes
4558 then
4559 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
4560 [Define if mvwdelch in curses.h is an expression.])
4561 fi
4562
4563 # Issue #25720: ncurses has introduced the NCURSES_OPAQUE symbol making opaque
4564 # structs since version 5.7. If the macro is defined as zero before including
4565 # [n]curses.h, ncurses will expose fields of the structs regardless of the
4566 # configuration.
4567 AC_MSG_CHECKING(whether WINDOW has _flags)
4568 AC_CACHE_VAL(ac_cv_window_has_flags,
4569 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4570 #define NCURSES_OPAQUE 0
4571 #include <curses.h>
4572 ]], [[
4573 WINDOW *w;
4574 w->_flags = 0;
4575 ]])],
4576 [ac_cv_window_has_flags=yes],
4577 [ac_cv_window_has_flags=no]))
4578 AC_MSG_RESULT($ac_cv_window_has_flags)
4579
4580
4581 if test "$ac_cv_window_has_flags" = yes
4582 then
4583 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
4584 [Define if WINDOW in curses.h offers a field _flags.])
4585 fi
4586
4587 AC_MSG_CHECKING(for is_pad)
4588 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4589 #ifndef is_pad
4590 void *x=is_pad
4591 #endif
4592 ]])],
4593 [AC_DEFINE(HAVE_CURSES_IS_PAD, 1, Define if you have the 'is_pad' function or macro.)
4594 AC_MSG_RESULT(yes)],
4595 [AC_MSG_RESULT(no)]
4596 )
4597
4598 AC_MSG_CHECKING(for is_term_resized)
4599 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])],
4600 [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
4601 AC_MSG_RESULT(yes)],
4602 [AC_MSG_RESULT(no)]
4603 )
4604
4605 AC_MSG_CHECKING(for resize_term)
4606 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])],
4607 [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
4608 AC_MSG_RESULT(yes)],
4609 [AC_MSG_RESULT(no)]
4610 )
4611
4612 AC_MSG_CHECKING(for resizeterm)
4613 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])],
4614 [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
4615 AC_MSG_RESULT(yes)],
4616 [AC_MSG_RESULT(no)]
4617 )
4618
4619 AC_MSG_CHECKING(for immedok)
4620 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4621 #ifndef immedok
4622 void *x=immedok
4623 #endif
4624 ]])],
4625 [AC_DEFINE(HAVE_CURSES_IMMEDOK, 1, Define if you have the 'immedok' function.)
4626 AC_MSG_RESULT(yes)],
4627 [AC_MSG_RESULT(no)]
4628 )
4629
4630 AC_MSG_CHECKING(for syncok)
4631 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4632 #ifndef syncok
4633 void *x=syncok
4634 #endif
4635 ]])],
4636 [AC_DEFINE(HAVE_CURSES_SYNCOK, 1, Define if you have the 'syncok' function.)
4637 AC_MSG_RESULT(yes)],
4638 [AC_MSG_RESULT(no)]
4639 )
4640
4641 AC_MSG_CHECKING(for wchgat)
4642 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4643 #ifndef wchgat
4644 void *x=wchgat
4645 #endif
4646 ]])],
4647 [AC_DEFINE(HAVE_CURSES_WCHGAT, 1, Define if you have the 'wchgat' function.)
4648 AC_MSG_RESULT(yes)],
4649 [AC_MSG_RESULT(no)]
4650 )
4651
4652 AC_MSG_CHECKING(for filter)
4653 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4654 #ifndef filter
4655 void *x=filter
4656 #endif
4657 ]])],
4658 [AC_DEFINE(HAVE_CURSES_FILTER, 1, Define if you have the 'filter' function.)
4659 AC_MSG_RESULT(yes)],
4660 [AC_MSG_RESULT(no)]
4661 )
4662
4663 AC_MSG_CHECKING(for has_key)
4664 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4665 #ifndef has_key
4666 void *x=has_key
4667 #endif
4668 ]])],
4669 [AC_DEFINE(HAVE_CURSES_HAS_KEY, 1, Define if you have the 'has_key' function.)
4670 AC_MSG_RESULT(yes)],
4671 [AC_MSG_RESULT(no)]
4672 )
4673
4674 AC_MSG_CHECKING(for typeahead)
4675 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4676 #ifndef typeahead
4677 void *x=typeahead
4678 #endif
4679 ]])],
4680 [AC_DEFINE(HAVE_CURSES_TYPEAHEAD, 1, Define if you have the 'typeahead' function.)
4681 AC_MSG_RESULT(yes)],
4682 [AC_MSG_RESULT(no)]
4683 )
4684
4685 AC_MSG_CHECKING(for use_env)
4686 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
4687 #ifndef use_env
4688 void *x=use_env
4689 #endif
4690 ]])],
4691 [AC_DEFINE(HAVE_CURSES_USE_ENV, 1, Define if you have the 'use_env' function.)
4692 AC_MSG_RESULT(yes)],
4693 [AC_MSG_RESULT(no)]
4694 )
4695 # last curses configure check
4696 CPPFLAGS=$ac_save_cppflags
4697
4698 AC_MSG_NOTICE([checking for device files])
4699
4700 dnl NOTE: Inform user how to proceed with files when cross compiling.
4701 if test "x$cross_compiling" = xyes; then
4702 if test "${ac_cv_file__dev_ptmx+set}" != set; then
4703 AC_MSG_CHECKING([for /dev/ptmx])
4704 AC_MSG_RESULT([not set])
4705 AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
4706 fi
4707 if test "${ac_cv_file__dev_ptc+set}" != set; then
4708 AC_MSG_CHECKING([for /dev/ptc])
4709 AC_MSG_RESULT([not set])
4710 AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling])
4711 fi
4712 fi
4713
4714 AC_CHECK_FILE(/dev/ptmx, [], [])
4715 if test "x$ac_cv_file__dev_ptmx" = xyes; then
4716 AC_DEFINE(HAVE_DEV_PTMX, 1,
4717 [Define to 1 if you have the /dev/ptmx device file.])
4718 fi
4719 AC_CHECK_FILE(/dev/ptc, [], [])
4720 if test "x$ac_cv_file__dev_ptc" = xyes; then
4721 AC_DEFINE(HAVE_DEV_PTC, 1,
4722 [Define to 1 if you have the /dev/ptc device file.])
4723 fi
4724
4725 if test "$have_long_long" = yes
4726 then
4727 AC_MSG_CHECKING(for %lld and %llu printf() format support)
4728 AC_CACHE_VAL(ac_cv_have_long_long_format,
4729 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
4730 #include <stdio.h>
4731 #include <stddef.h>
4732 #include <string.h>
4733
4734 #ifdef HAVE_SYS_TYPES_H
4735 #include <sys/types.h>
4736 #endif
4737
4738 int main()
4739 {
4740 char buffer[256];
4741
4742 if (sprintf(buffer, "%lld", (long long)123) < 0)
4743 return 1;
4744 if (strcmp(buffer, "123"))
4745 return 1;
4746
4747 if (sprintf(buffer, "%lld", (long long)-123) < 0)
4748 return 1;
4749 if (strcmp(buffer, "-123"))
4750 return 1;
4751
4752 if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
4753 return 1;
4754 if (strcmp(buffer, "123"))
4755 return 1;
4756
4757 return 0;
4758 }
4759 ]]])],
4760 [ac_cv_have_long_long_format=yes],
4761 [ac_cv_have_long_long_format=no],
4762 [ac_cv_have_long_long_format="cross -- assuming no"
4763 if test x$GCC = xyes; then
4764 save_CFLAGS=$CFLAGS
4765 CFLAGS="$CFLAGS -Werror -Wformat"
4766 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4767 #include <stdio.h>
4768 #include <stddef.h>
4769 ]], [[
4770 char *buffer;
4771 sprintf(buffer, "%lld", (long long)123);
4772 sprintf(buffer, "%lld", (long long)-123);
4773 sprintf(buffer, "%llu", (unsigned long long)123);
4774 ]])],
4775 ac_cv_have_long_long_format=yes
4776 )
4777 CFLAGS=$save_CFLAGS
4778 fi])
4779 )
4780 AC_MSG_RESULT($ac_cv_have_long_long_format)
4781 fi
4782
4783 if test "$ac_cv_have_long_long_format" = yes
4784 then
4785 AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
4786 [Define to printf format modifier for long long type])
4787 fi
4788
4789 if test $ac_sys_system = Darwin
4790 then
4791 LIBS="$LIBS -framework CoreFoundation"
4792 fi
4793
4794
4795 AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
4796 AC_RUN_IFELSE([AC_LANG_SOURCE([[
4797 #include <stdio.h>
4798 #include <stddef.h>
4799 #include <string.h>
4800
4801 #ifdef HAVE_SYS_TYPES_H
4802 #include <sys/types.h>
4803 #endif
4804
4805 #ifdef HAVE_SSIZE_T
4806 typedef ssize_t Py_ssize_t;
4807 #elif SIZEOF_VOID_P == SIZEOF_LONG
4808 typedef long Py_ssize_t;
4809 #else
4810 typedef int Py_ssize_t;
4811 #endif
4812
4813 int main()
4814 {
4815 char buffer[256];
4816
4817 if(sprintf(buffer, "%zd", (size_t)123) < 0)
4818 return 1;
4819
4820 if (strcmp(buffer, "123"))
4821 return 1;
4822
4823 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
4824 return 1;
4825
4826 if (strcmp(buffer, "-123"))
4827 return 1;
4828
4829 return 0;
4830 }
4831 ]])],
4832 [ac_cv_have_size_t_format=yes],
4833 [ac_cv_have_size_t_format=no],
4834 [ac_cv_have_size_t_format="cross -- assuming yes"
4835 ])])
4836 if test "$ac_cv_have_size_t_format" != no ; then
4837 AC_DEFINE(PY_FORMAT_SIZE_T, "z",
4838 [Define to printf format modifier for Py_ssize_t])
4839 fi
4840
4841 AC_CHECK_TYPE(socklen_t,,
4842 AC_DEFINE(socklen_t,int,
4843 [Define to `int' if <sys/socket.h> does not define.]),[
4844 #ifdef HAVE_SYS_TYPES_H
4845 #include <sys/types.h>
4846 #endif
4847 #ifdef HAVE_SYS_SOCKET_H
4848 #include <sys/socket.h>
4849 #endif
4850 ])
4851
4852 case $ac_sys_system in
4853 AIX*)
4854 AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;;
4855 esac
4856
4857
4858 AC_SUBST(THREADHEADERS)
4859
4860 for h in `(cd $srcdir;echo Python/thread_*.h)`
4861 do
4862 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4863 done
4864
4865 AC_SUBST(SRCDIRS)
4866 SRCDIRS="Parser Objects Python Modules Modules/_io"
4867 AC_MSG_CHECKING(for build directories)
4868 for dir in $SRCDIRS; do
4869 if test ! -d $dir; then
4870 mkdir $dir
4871 fi
4872 done
4873
4874 # BEGIN_COMPUTED_GOTO
4875 # Check for --with-computed-gotos
4876 AC_MSG_CHECKING(for --with-computed-gotos)
4877 AC_ARG_WITH(computed-gotos,
4878 AS_HELP_STRING([--with(out)-computed-gotos],
4879 [Use computed gotos in evaluation loop (enabled by default on supported compilers)]),
4880 [
4881 if test "$withval" = yes
4882 then
4883 AC_DEFINE(USE_COMPUTED_GOTOS, 1,
4884 [Define if you want to use computed gotos in ceval.c.])
4885 AC_MSG_RESULT(yes)
4886 fi
4887 if test "$withval" = no
4888 then
4889 AC_DEFINE(USE_COMPUTED_GOTOS, 0,
4890 [Define if you want to use computed gotos in ceval.c.])
4891 AC_MSG_RESULT(no)
4892 fi
4893 ],
4894 [AC_MSG_RESULT(no value specified)])
4895
4896 AC_MSG_CHECKING(whether $CC supports computed gotos)
4897 AC_CACHE_VAL(ac_cv_computed_gotos,
4898 AC_RUN_IFELSE([AC_LANG_SOURCE([[[
4899 int main(int argc, char **argv)
4900 {
4901 static void *targets[1] = { &&LABEL1 };
4902 goto LABEL2;
4903 LABEL1:
4904 return 0;
4905 LABEL2:
4906 goto *targets[0];
4907 return 1;
4908 }
4909 ]]])],
4910 [ac_cv_computed_gotos=yes],
4911 [ac_cv_computed_gotos=no],
4912 [if test "${with_computed_gotos+set}" = set; then
4913 ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos"
4914 else
4915 ac_cv_computed_gotos=no
4916 fi]))
4917 AC_MSG_RESULT($ac_cv_computed_gotos)
4918 case "$ac_cv_computed_gotos" in yes*)
4919 AC_DEFINE(HAVE_COMPUTED_GOTOS, 1,
4920 [Define if the C compiler supports computed gotos.])
4921 esac
4922 # END_COMPUTED_GOTO
4923
4924 AC_MSG_RESULT(done)
4925
4926 # ensurepip option
4927 AC_MSG_CHECKING(for ensurepip)
4928 AC_ARG_WITH(ensurepip,
4929 [AS_HELP_STRING([--with(out)-ensurepip=@<:@=OPTION@:>@],
4930 ["install" or "upgrade" using bundled pip, default is "no"])],
4931 [],
4932 [with_ensurepip=no])
4933 AS_CASE($with_ensurepip,
4934 [yes|upgrade],[ENSUREPIP=upgrade],
4935 [install],[ENSUREPIP=install],
4936 [no],[ENSUREPIP=no],
4937 [AC_MSG_ERROR([--with-ensurepip=upgrade|install|no])])
4938 AC_MSG_RESULT($ENSUREPIP)
4939 AC_SUBST(ENSUREPIP)
4940
4941 # generate output files
4942 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
4943 AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
4944 AC_OUTPUT
4945
4946 echo "creating Modules/Setup"
4947 if test ! -f Modules/Setup
4948 then
4949 cp $srcdir/Modules/Setup.dist Modules/Setup
4950 fi
4951
4952 echo "creating Modules/Setup.local"
4953 if test ! -f Modules/Setup.local
4954 then
4955 echo "# Edit this file for local setup changes" >Modules/Setup.local
4956 fi
4957
4958 echo "creating Makefile"
4959 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4960 -s Modules Modules/Setup.config \
4961 Modules/Setup.local Modules/Setup
4962
4963 case $ac_sys_system in
4964 BeOS)
4965 AC_MSG_WARN([
4966
4967 Support for BeOS is deprecated as of Python 2.6.
4968 See PEP 11 for the gory details.
4969 ])
4970 ;;
4971 *) ;;
4972 esac
4973
4974 mv config.c Modules
4975
4976 if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then
4977 echo "" >&AS_MESSAGE_FD
4978 echo "" >&AS_MESSAGE_FD
4979 echo "If you want a release build with all optimizations active (LTO, PGO, etc),"
4980 echo "please run ./configure --enable-optimizations" >&AS_MESSAGE_FD
4981 echo "" >&AS_MESSAGE_FD
4982 echo "" >&AS_MESSAGE_FD
4983 fi