1dnl *********************************************** 2dnl * Please run autoreconf to test your changes! * 3dnl *********************************************** 4 5# Set VERSION so we only need to edit in one place (i.e., here) 6m4_define(PYTHON_VERSION, 2.7) 7 8AC_PREREQ(2.65) 9 10AC_REVISION($Revision$) 11AC_INIT(python, PYTHON_VERSION, https://bugs.python.org/) 12AC_CONFIG_SRCDIR([Include/object.h]) 13AC_CONFIG_HEADER(pyconfig.h) 14 15AC_CANONICAL_HOST 16AC_SUBST(build) 17AC_SUBST(host) 18 19# pybuilddir.txt will be created by --generate-posix-vars in the Makefile 20rm -f pybuilddir.txt 21 22AC_CHECK_PROGS(PYTHON_FOR_REGEN, python$PACKAGE_VERSION python3 python, python3) 23AC_SUBST(PYTHON_FOR_REGEN) 24 25if 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 41elif test "$cross_compiling" = maybe; then 42 AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) 43else 44 PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' 45fi 46AC_SUBST(PYTHON_FOR_BUILD) 47 48dnl Ensure that if prefix is specified, it does not end in a slash. If 49dnl it does, we get path names containing '//' which is both ugly and 50dnl can cause trouble. 51 52dnl Last slash shouldn't be stripped if prefix=/ 53if test "$prefix" != "/"; then 54 prefix=`echo "$prefix" | sed -e 's/\/$//g'` 55fi 56 57dnl This is for stuff that absolutely must end up in pyconfig.h. 58dnl Please use pyport.h instead, if possible. 59AH_TOP([ 60#ifndef Py_PYCONFIG_H 61#define Py_PYCONFIG_H 62]) 63AH_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 74grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new 75rm confdefs.h 76mv confdefs.h.new confdefs.h 77 78AC_SUBST(VERSION) 79VERSION=PYTHON_VERSION 80 81AC_SUBST(SOVERSION) 82SOVERSION=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). 86AC_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. 91AC_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. 96AC_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. 100AC_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. 105AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features]) 106 107 108define_xopen_source=yes 109 110# Arguments passed to configure. 111AC_SUBST(CONFIG_ARGS) 112CONFIG_ARGS="$ac_configure_args" 113 114AC_MSG_CHECKING([for --enable-universalsdk]) 115AC_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.txt 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]) 151if test -n "${UNIVERSALSDK}" 152then 153 AC_MSG_RESULT(${UNIVERSALSDK}) 154else 155 AC_MSG_RESULT(no) 156fi 157AC_SUBST(UNIVERSALSDK) 158 159AC_SUBST(ARCH_RUN_32BIT) 160ARCH_RUN_32BIT="" 161 162# For backward compatibility reasons we prefer to select '32-bit' if available, 163# otherwise use 'intel' 164UNIVERSAL_ARCHS="32-bit" 165if test "`uname -s`" = "Darwin" 166then 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 174fi 175 176AC_SUBST(LIPO_32BIT_FLAGS) 177AC_MSG_CHECKING(for --with-universal-archs) 178AC_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[]) 184if test -n "${UNIVERSALSDK}" 185then 186 AC_MSG_RESULT(${UNIVERSAL_ARCHS}) 187else 188 AC_MSG_RESULT(no) 189fi 190 191AC_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]) 208dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output 209AC_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]) 310AC_SUBST(PYTHONFRAMEWORK) 311AC_SUBST(PYTHONFRAMEWORKIDENTIFIER) 312AC_SUBST(PYTHONFRAMEWORKDIR) 313AC_SUBST(PYTHONFRAMEWORKPREFIX) 314AC_SUBST(PYTHONFRAMEWORKINSTALLDIR) 315AC_SUBST(FRAMEWORKINSTALLFIRST) 316AC_SUBST(FRAMEWORKINSTALLLAST) 317AC_SUBST(FRAMEWORKALTINSTALLFIRST) 318AC_SUBST(FRAMEWORKALTINSTALLLAST) 319AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX) 320AC_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 327AC_SUBST(MACHDEP) 328AC_MSG_CHECKING(MACHDEP) 329if test -z "$MACHDEP" 330then 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 372fi 373 374AC_SUBST(_PYTHON_HOST_PLATFORM) 375if 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}" 395fi 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). 406dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output 407case $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 478esac 479 480if test $define_xopen_source = yes 481then 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 494fi 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# 505AC_SUBST(SGI_ABI) 506if test ! -z "$SGI_ABI" 507then 508 CC="cc $SGI_ABI" 509 LDFLAGS="$SGI_ABI $LDFLAGS" 510 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'` 511fi 512AC_MSG_RESULT($MACHDEP) 513 514AC_SUBST(PLATDIR) 515PLATDIR=plat-$MACHDEP 516 517# And add extra plat-mac for darwin 518AC_SUBST(EXTRAPLATDIR) 519AC_SUBST(EXTRAMACHDEPPATH) 520AC_MSG_CHECKING(EXTRAPLATDIR) 521if test -z "$EXTRAPLATDIR" 522then 523 case $MACHDEP in 524 darwin) 525 EXTRAPLATDIR="\$(PLATMACDIRS)" 526 EXTRAMACHDEPPATH="\$(PLATMACPATH)" 527 ;; 528 *) 529 EXTRAPLATDIR="" 530 EXTRAMACHDEPPATH="" 531 ;; 532 esac 533fi 534AC_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 539AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET) 540AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET) 541CONFIGURE_MACOSX_DEPLOYMENT_TARGET= 542EXPORT_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? 554AC_MSG_CHECKING(for --without-gcc) 555AC_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]) 592AC_MSG_RESULT($without_gcc) 593 594AC_MSG_CHECKING(for --with-icc) 595AC_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]) 608AC_MSG_RESULT($with_icc) 609 610# If the user switches compilers, we can't believe the cache 611if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" 612then 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)]) 615fi 616 617if 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 648fi 649 650# If the user set CFLAGS, use this instead of the automatically 651# determined setting 652preset_cflags="$CFLAGS" 653AC_PROG_CC 654if test ! -z "$preset_cflags" 655then 656 CFLAGS=$preset_cflags 657fi 658 659AC_SUBST(CXX) 660AC_SUBST(MAINCC) 661AC_MSG_CHECKING(for --with-cxx-main=<compiler>) 662AC_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]) 682AC_MSG_RESULT($with_cxx_main) 683 684preset_cxx="$CXX" 685if test -z "$CXX" 686then 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 695fi 696if test -z "$CXX" 697then 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 703fi 704if test "$preset_cxx" != "$CXX" 705then 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 ]) 711fi 712 713MULTIARCH=$($CC --print-multiarch 2>/dev/null) 714AC_SUBST(MULTIARCH) 715 716 717# checks for UNIX variants that set C preprocessor variables 718AC_USE_SYSTEM_EXTENSIONS 719 720# Check for unsupported systems 721case $ac_sys_system/$ac_sys_release in 722atheos*|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;; 726esac 727 728AC_EXEEXT 729AC_MSG_CHECKING(for --with-suffix) 730AC_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]) 738AC_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 742AC_SUBST(BUILDEXEEXT) 743AC_MSG_CHECKING(for case-insensitive build directory) 744if test ! -d CaseSensitiveTestDir; then 745mkdir CaseSensitiveTestDir 746fi 747 748if test -d casesensitivetestdir 749then 750 AC_MSG_RESULT(yes) 751 BUILDEXEEXT=.exe 752else 753 AC_MSG_RESULT(no) 754 BUILDEXEEXT=$EXEEXT 755fi 756rmdir CaseSensitiveTestDir 757 758case $MACHDEP in 759bsdos*) 760 case $CC in 761 gcc) CC="$CC -D_HAVE_BSDI";; 762 esac;; 763esac 764 765case $ac_sys_system in 766hp*|HP*) 767 case $CC in 768 cc|*/cc) CC="$CC -Ae";; 769 esac;; 770SunOS*) 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 ;; 774esac 775 776 777AC_SUBST(LIBRARY) 778AC_MSG_CHECKING(LIBRARY) 779if test -z "$LIBRARY" 780then 781 LIBRARY='libpython$(VERSION).a' 782fi 783AC_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 798AC_SUBST(LDLIBRARY) 799AC_SUBST(DLLLIBRARY) 800AC_SUBST(BLDLIBRARY) 801AC_SUBST(LDLIBRARYDIR) 802AC_SUBST(INSTSONAME) 803AC_SUBST(RUNSHARED) 804LDLIBRARY="$LIBRARY" 805BLDLIBRARY='$(LDLIBRARY)' 806INSTSONAME='$(LDLIBRARY)' 807DLLLIBRARY='' 808LDLIBRARYDIR='' 809RUNSHARED='' 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. 817AC_SUBST(LINKCC) 818AC_MSG_CHECKING(LINKCC) 819if test -z "$LINKCC" 820then 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 835fi 836AC_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. 843AC_SUBST(GNULD) 844AC_MSG_CHECKING(for GNU ld) 845ac_prog=ld 846if test "$GCC" = yes; then 847 ac_prog=`$CC -print-prog-name=ld` 848fi 849case `"$ac_prog" -V 2>&1 < /dev/null` in 850 *GNU*) 851 GNULD=yes;; 852 *) 853 GNULD=no;; 854esac 855AC_MSG_RESULT($GNULD) 856 857AC_MSG_CHECKING(for --enable-shared) 858AC_ARG_ENABLE(shared, 859 AS_HELP_STRING([--enable-shared], [disable/enable building shared python library])) 860 861if test -z "$enable_shared" 862then 863 case $ac_sys_system in 864 CYGWIN* | atheos*) 865 enable_shared="yes";; 866 *) 867 enable_shared="no";; 868 esac 869fi 870AC_MSG_RESULT($enable_shared) 871 872AC_MSG_CHECKING(for --enable-profiling) 873AC_ARG_ENABLE(profiling, 874 AS_HELP_STRING([--enable-profiling], [enable C-level code profiling])) 875if 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" 882else 883 enable_profiling=no 884fi 885AC_MSG_RESULT($enable_profiling) 886 887if test "x$enable_profiling" = xyes; then 888 BASECFLAGS="-pg $BASECFLAGS" 889 LDFLAGS="-pg $LDFLAGS" 890fi 891 892AC_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. 900if test "$enable_framework" 901then 902 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' 903 RUNSHARED=DYLD_FRAMEWORK_PATH=`pwd`${DYLD_FRAMEWORK_PATH:+:${DYLD_FRAMEWORK_PATH}} 904 BLDLIBRARY='' 905else 906 BLDLIBRARY='$(LDLIBRARY)' 907fi 908 909# Other platforms follow 910if 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 970else # shared is disabled 971 case $ac_sys_system in 972 CYGWIN*) 973 BLDLIBRARY='$(LIBRARY)' 974 LDLIBRARY='libpython$(VERSION).dll.a' 975 ;; 976 esac 977fi 978 979if test "$cross_compiling" = yes; then 980 RUNSHARED= 981fi 982 983AC_MSG_RESULT($LDLIBRARY) 984 985AC_PROG_RANLIB 986AC_SUBST(AR) 987AC_CHECK_TOOLS(AR, ar aal, ar) 988 989# tweak ARFLAGS only if the user didn't set it on the command line 990AC_SUBST(ARFLAGS) 991if test -z "$ARFLAGS" 992then 993 ARFLAGS="rc" 994fi 995 996AC_SUBST(GITVERSION) 997AC_SUBST(GITTAG) 998AC_SUBST(GITBRANCH) 999 1000if test -e $srcdir/.git 1001then 1002AC_CHECK_PROG(HAS_GIT, git, found, not-found) 1003else 1004HAS_GIT=no-repository 1005fi 1006if test $HAS_GIT = found 1007then 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" 1011else 1012 GITVERSION="" 1013 GITTAG="" 1014 GITBRANCH="" 1015fi 1016 1017case $MACHDEP in 1018bsdos*|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 1024esac 1025AC_PROG_INSTALL 1026AC_PROG_MKDIR_P 1027 1028# Not every filesystem supports hard links 1029AC_SUBST(LN) 1030if 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 1037fi 1038 1039# Check for --with-pydebug 1040AC_MSG_CHECKING(for --with-pydebug) 1041AC_ARG_WITH(pydebug, 1042 AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]), 1043[ 1044if test "$withval" != no 1045then 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' 1050else AC_MSG_RESULT(no); Py_DEBUG='false' 1051fi], 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 1069AC_SUBST(OPT) 1070if test "${OPT-unset}" = "unset" 1071then 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 1112fi 1113 1114AC_SUBST(BASECFLAGS) 1115 1116# The -arch flags for universal builds on OSX 1117UNIVERSAL_ARCH_FLAGS= 1118AC_SUBST(UNIVERSAL_ARCH_FLAGS) 1119 1120# tweak BASECFLAGS based on compiler and platform 1121case $GCC in 1122yes) 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 ;; 1300esac 1301 1302# ICC needs -fp-model strict or floats behave badly 1303case "$CC" in 1304*icc*) 1305 BASECFLAGS="$BASECFLAGS -fp-model strict" 1306 ;; 1307esac 1308 1309if test "$Py_DEBUG" = 'true'; then 1310 : 1311else 1312 OPT="-DNDEBUG $OPT" 1313fi 1314 1315if test "$ac_arch_flags" 1316then 1317 BASECFLAGS="$BASECFLAGS $ac_arch_flags" 1318fi 1319 1320# disable check for icc since it seems to pass, but generates a warning 1321if test "$CC" = icc 1322then 1323 ac_cv_opt_olimit_ok=no 1324fi 1325 1326AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0) 1327AC_CACHE_VAL(ac_cv_opt_olimit_ok, 1328[ac_save_cc="$CC" 1329CC="$CC -OPT:Olimit=0" 1330AC_COMPILE_IFELSE( 1331 [AC_LANG_PROGRAM([[]], [[]])], 1332 [ac_cv_opt_olimit_ok=yes], 1333 [ac_cv_opt_olimit_ok=no] 1334 ) 1335CC="$ac_save_cc"]) 1336AC_MSG_RESULT($ac_cv_opt_olimit_ok) 1337if 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 1353else 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 1375fi 1376 1377# Check whether GCC supports PyArg_ParseTuple format 1378if test "$GCC" = "yes" 1379then 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 1393fi 1394 1395 1396# Enable optimization flags 1397AC_SUBST(DEF_MAKE_ALL_RULE) 1398AC_SUBST(DEF_MAKE_RULE) 1399Py_OPT='false' 1400AC_MSG_CHECKING(for --enable-optimizations) 1401AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--enable-optimizations], [Enable expensive optimizations (PGO, maybe LTO, etc). Disabled by default.]), 1402[ 1403if test "$enableval" != no 1404then 1405 Py_OPT='true' 1406 AC_MSG_RESULT(yes); 1407else 1408 Py_OPT='false' 1409 AC_MSG_RESULT(no); 1410fi], 1411[AC_MSG_RESULT(no)]) 1412if 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" 1420else 1421 DEF_MAKE_ALL_RULE="build_all" 1422 REQUIRE_PGO="no" 1423 DEF_MAKE_RULE="all" 1424fi 1425 1426 1427# Enable LTO flags 1428AC_SUBST(LTOFLAGS) 1429AC_MSG_CHECKING(for --with-lto) 1430AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable Link Time Optimization in PGO builds. Disabled by default.]), 1431[ 1432if test "$withval" != no 1433then 1434 Py_LTO='true' 1435 AC_MSG_RESULT(yes); 1436else 1437 Py_LTO='false' 1438 AC_MSG_RESULT(no); 1439fi], 1440[AC_MSG_RESULT(no)]) 1441if 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 1465fi 1466 1467 1468# Enable PGO flags. 1469AC_SUBST(PGO_PROF_GEN_FLAG) 1470AC_SUBST(PGO_PROF_USE_FLAG) 1471AC_SUBST(LLVM_PROF_MERGER) 1472AC_SUBST(LLVM_PROF_FILE) 1473AC_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. 1477llvm_bin_dir='' 1478llvm_path="${PATH}" 1479if test "${CC}" = "clang" 1480then 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 1491fi 1492AC_SUBST(LLVM_PROFDATA) 1493AC_PATH_TARGET_TOOL(LLVM_PROFDATA, llvm-profdata, '', ${llvm_path}) 1494AC_SUBST(LLVM_PROF_FOUND) 1495if test -n "${LLVM_PROFDATA}" -a -x "${LLVM_PROFDATA}" 1496then 1497 LLVM_PROF_FOUND="found" 1498else 1499 LLVM_PROF_FOUND="not-found" 1500fi 1501if test "$ac_sys_system" = "Darwin" -a "${LLVM_PROF_FOUND}" = "not-found" 1502then 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 1512fi 1513LLVM_PROF_ERR=no 1514case $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 ;; 1560esac 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. 1568AC_MSG_CHECKING(whether pthreads are available without options) 1569AC_CACHE_VAL(ac_cv_pthread_is_default, 1570[AC_RUN_IFELSE([AC_LANG_SOURCE([[ 1571#include <stdio.h> 1572#include <pthread.h> 1573 1574void* routine(void* p){return NULL;} 1575 1576int 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]) 1589AC_MSG_RESULT($ac_cv_pthread_is_default) 1590 1591 1592if test $ac_cv_pthread_is_default = yes 1593then 1594 ac_cv_kpthread=no 1595else 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. 1601AC_MSG_CHECKING(whether $CC accepts -Kpthread) 1602AC_CACHE_VAL(ac_cv_kpthread, 1603[ac_save_cc="$CC" 1604CC="$CC -Kpthread" 1605AC_RUN_IFELSE([AC_LANG_SOURCE([[ 1606#include <stdio.h> 1607#include <pthread.h> 1608 1609void* routine(void* p){return NULL;} 1610 1611int 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]) 1619CC="$ac_save_cc"]) 1620AC_MSG_RESULT($ac_cv_kpthread) 1621fi 1622 1623if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no 1624then 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. 1630AC_MSG_CHECKING(whether $CC accepts -Kthread) 1631AC_CACHE_VAL(ac_cv_kthread, 1632[ac_save_cc="$CC" 1633CC="$CC -Kthread" 1634AC_RUN_IFELSE([AC_LANG_SOURCE([[ 1635#include <stdio.h> 1636#include <pthread.h> 1637 1638void* routine(void* p){return NULL;} 1639 1640int 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]) 1648CC="$ac_save_cc"]) 1649AC_MSG_RESULT($ac_cv_kthread) 1650fi 1651 1652if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no 1653then 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. 1659AC_MSG_CHECKING(whether $CC accepts -pthread) 1660AC_CACHE_VAL(ac_cv_pthread, 1661[ac_save_cc="$CC" 1662CC="$CC -pthread" 1663AC_RUN_IFELSE([AC_LANG_SOURCE([[ 1664#include <stdio.h> 1665#include <pthread.h> 1666 1667void* routine(void* p){return NULL;} 1668 1669int 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]) 1677CC="$ac_save_cc"]) 1678AC_MSG_RESULT($ac_cv_pthread) 1679fi 1680 1681# If we have set a CC compiler flag for thread support then 1682# check if it works for CXX, too. 1683ac_cv_cxx_thread=no 1684if test ! -z "$CXX" 1685then 1686AC_MSG_CHECKING(whether $CXX also accepts flags for thread support) 1687ac_save_cxx="$CXX" 1688 1689if test "$ac_cv_kpthread" = "yes" 1690then 1691 CXX="$CXX -Kpthread" 1692 ac_cv_cxx_thread=yes 1693elif test "$ac_cv_kthread" = "yes" 1694then 1695 CXX="$CXX -Kthread" 1696 ac_cv_cxx_thread=yes 1697elif test "$ac_cv_pthread" = "yes" 1698then 1699 CXX="$CXX -pthread" 1700 ac_cv_cxx_thread=yes 1701fi 1702 1703if test $ac_cv_cxx_thread = yes 1704then 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* 1715fi 1716AC_MSG_RESULT($ac_cv_cxx_thread) 1717fi 1718CXX="$ac_save_cxx" 1719 1720dnl # check for ANSI or K&R ("traditional") preprocessor 1721dnl AC_MSG_CHECKING(for C preprocessor type) 1722dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 1723dnl #define spam(name, doc) {#name, &name, #name "() -- " doc} 1724dnl int foo; 1725dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something"); 1726dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional]) 1727dnl AC_MSG_RESULT($cpp_type) 1728 1729# checks for header files 1730AC_HEADER_STDC 1731AC_CHECK_HEADERS(asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \ 1732fcntl.h grp.h \ 1733ieeefp.h io.h langinfo.h libintl.h poll.h process.h pthread.h \ 1734shadow.h signal.h stdint.h stropts.h termios.h thread.h \ 1735unistd.h utime.h \ 1736sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ 1737sys/lock.h sys/mkdev.h sys/modem.h \ 1738sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ 1739sys/termio.h sys/time.h \ 1740sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ 1741sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ 1742bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h) 1743AC_HEADER_DIRENT 1744AC_HEADER_MAJOR 1745 1746# On Linux, netlink.h requires asm/types.h 1747AC_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 1757was_it_defined=no 1758AC_MSG_CHECKING(for clock_t in time.h) 1759AC_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]) 1762AC_MSG_RESULT($was_it_defined) 1763 1764# Check whether using makedev requires defining _OSF_SOURCE 1765AC_MSG_CHECKING(for makedev) 1766AC_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]) 1776if 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 1787fi 1788AC_MSG_RESULT($ac_cv_has_makedev) 1789if test "$ac_cv_has_makedev" = "yes"; then 1790 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.]) 1791fi 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 1800use_lfs=yes 1801AC_MSG_CHECKING(Solaris LFS bug) 1802AC_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]) 1807AC_MSG_RESULT($sol_lfs_bug) 1808if test "$sol_lfs_bug" = "yes"; then 1809 use_lfs=no 1810fi 1811 1812if test "$use_lfs" = "yes"; then 1813# Two defines needed to enable largefile support on various platforms 1814# These may affect some typedefs 1815case $ac_sys_system/$ac_sys_release in 1816AIX*) 1817 AC_DEFINE(_LARGE_FILES, 1, 1818 [This must be defined on AIX systems to enable large file support.]) 1819 ;; 1820esac 1821AC_DEFINE(_LARGEFILE_SOURCE, 1, 1822[This must be defined on some systems to enable large file support.]) 1823AC_DEFINE(_FILE_OFFSET_BITS, 64, 1824[This must be set to 64 on some systems to enable large file support.]) 1825fi 1826 1827# Add some code to confdefs.h so that the test for off_t works on SCO 1828cat >> confdefs.h <<\EOF 1829#if defined(SCO_DS) 1830#undef _OFF_T 1831#endif 1832EOF 1833 1834# Type availability checks 1835AC_TYPE_MODE_T 1836AC_TYPE_OFF_T 1837AC_TYPE_PID_T 1838AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void]) 1839AC_TYPE_SIZE_T 1840AC_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 1849AC_CHECK_TYPE(uint32_t, 1850 AC_DEFINE(HAVE_UINT32_T, 1, [Define if your compiler provides uint32_t.]),,) 1851AC_TYPE_UINT32_T 1852 1853AC_CHECK_TYPE(uint64_t, 1854 AC_DEFINE(HAVE_UINT64_T, 1, [Define if your compiler provides uint64_t.]),,) 1855AC_TYPE_UINT64_T 1856 1857AC_CHECK_TYPE(int32_t, 1858 AC_DEFINE(HAVE_INT32_T, 1, [Define if your compiler provides int32_t.]),,) 1859AC_TYPE_INT32_T 1860 1861AC_CHECK_TYPE(int64_t, 1862 AC_DEFINE(HAVE_INT64_T, 1, [Define if your compiler provides int64_t.]),,) 1863AC_TYPE_INT64_T 1864 1865AC_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 1870AC_CHECK_SIZEOF(int, 4) 1871AC_CHECK_SIZEOF(long, 4) 1872AC_CHECK_SIZEOF(void *, 4) 1873AC_CHECK_SIZEOF(short, 2) 1874AC_CHECK_SIZEOF(float, 4) 1875AC_CHECK_SIZEOF(double, 8) 1876AC_CHECK_SIZEOF(fpos_t, 4) 1877AC_CHECK_SIZEOF(size_t, 4) 1878AC_CHECK_SIZEOF(pid_t, 4) 1879 1880AC_MSG_CHECKING(for long long support) 1881have_long_long=no 1882AC_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],[]) 1886AC_MSG_RESULT($have_long_long) 1887if test "$have_long_long" = yes ; then 1888AC_CHECK_SIZEOF(long long, 8) 1889fi 1890 1891AC_MSG_CHECKING(for long double support) 1892have_long_double=no 1893AC_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],[]) 1897AC_MSG_RESULT($have_long_double) 1898if test "$have_long_double" = yes ; then 1899AC_CHECK_SIZEOF(long double, 12) 1900fi 1901 1902AC_MSG_CHECKING(for _Bool support) 1903have_c99_bool=no 1904AC_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],[]) 1908AC_MSG_RESULT($have_c99_bool) 1909if test "$have_c99_bool" = yes ; then 1910AC_CHECK_SIZEOF(_Bool, 1) 1911fi 1912 1913AC_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 1922AC_CHECK_SIZEOF(off_t, [], [ 1923#ifdef HAVE_SYS_TYPES_H 1924#include <sys/types.h> 1925#endif 1926]) 1927 1928AC_MSG_CHECKING(whether to enable large file support) 1929if test "$have_long_long" = yes 1930then 1931if 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) 1939else 1940 AC_MSG_RESULT(no) 1941fi 1942else 1943 AC_MSG_RESULT(no) 1944fi 1945 1946AC_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 1956ac_save_cc="$CC" 1957if test "$ac_cv_kpthread" = "yes" 1958then CC="$CC -Kpthread" 1959elif test "$ac_cv_kthread" = "yes" 1960then CC="$CC -Kthread" 1961elif test "$ac_cv_pthread" = "yes" 1962then CC="$CC -pthread" 1963fi 1964AC_MSG_CHECKING(for pthread_t) 1965have_pthread_t=no 1966AC_COMPILE_IFELSE([ 1967 AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]]) 1968],[have_pthread_t=yes],[]) 1969AC_MSG_RESULT($have_pthread_t) 1970if test "$have_pthread_t" = yes ; then 1971 AC_CHECK_SIZEOF(pthread_t, [], [ 1972#ifdef HAVE_PTHREAD_H 1973#include <pthread.h> 1974#endif 1975 ]) 1976fi 1977CC="$ac_save_cc" 1978 1979AC_MSG_CHECKING(for --enable-toolbox-glue) 1980AC_ARG_ENABLE(toolbox-glue, 1981 AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions])) 1982 1983if test -z "$enable_toolbox_glue" 1984then 1985 case $ac_sys_system/$ac_sys_release in 1986 Darwin/*) 1987 enable_toolbox_glue="yes";; 1988 *) 1989 enable_toolbox_glue="no";; 1990 esac 1991fi 1992case "$enable_toolbox_glue" in 1993yes) 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 ;; 2003esac 2004AC_MSG_RESULT($enable_toolbox_glue) 2005 2006 2007AC_SUBST(OTHER_LIBTOOL_OPT) 2008case $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 ;; 2015esac 2016 2017 2018AC_SUBST(LIBTOOL_CRUFT) 2019case $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)';; 2079esac 2080 2081AC_MSG_CHECKING(for --enable-framework) 2082if test "$enable_framework" 2083then 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 2095else 2096 AC_MSG_RESULT(no) 2097fi 2098 2099AC_MSG_CHECKING(for dyld) 2100case $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 ;; 2111esac 2112 2113# Set info about shared libraries. 2114AC_SUBST(SO) 2115AC_SUBST(LDSHARED) 2116AC_SUBST(LDCXXSHARED) 2117AC_SUBST(BLDSHARED) 2118AC_SUBST(CCSHARED) 2119AC_SUBST(LINKFORSHARED) 2120# SO is the extension of shared libraries `(including the dot!) 2121# -- usually .so, .sl on HP-UX, .dll on Cygwin 2122AC_MSG_CHECKING(SO) 2123if test -z "$SO" 2124then 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 2135else 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 2146fi 2147AC_MSG_RESULT($SO) 2148 2149AC_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.) 2154AC_MSG_CHECKING(LDSHARED) 2155if test -z "$LDSHARED" 2156then 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 2295fi 2296AC_MSG_RESULT($LDSHARED) 2297LDCXXSHARED=${LDCXXSHARED-$LDSHARED} 2298BLDSHARED=${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 2301AC_MSG_CHECKING(CCSHARED) 2302if test -z "$CCSHARED" 2303then 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 2334fi 2335AC_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 2338AC_MSG_CHECKING(LINKFORSHARED) 2339if test -z "$LINKFORSHARED" 2340then 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 2392fi 2393AC_MSG_RESULT($LINKFORSHARED) 2394 2395 2396AC_SUBST(CFLAGSFORSHARED) 2397AC_MSG_CHECKING(CFLAGSFORSHARED) 2398if test ! "$LIBRARY" = "$LDLIBRARY" 2399then 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 2408fi 2409AC_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. 2419AC_SUBST(SHLIBS) 2420AC_MSG_CHECKING(SHLIBS) 2421case "$ac_sys_system" in 2422 *) 2423 SHLIBS='$(LIBS)';; 2424esac 2425AC_MSG_RESULT($SHLIBS) 2426 2427 2428# checks for libraries 2429AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV 2430AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX 2431 2432# only check for sem_init if thread support is requested 2433if 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 2437fi 2438 2439# check if we need libintl for locale functions 2440AC_CHECK_LIB(intl, textdomain, 2441 AC_DEFINE(WITH_LIBINTL, 1, 2442 [Define to 1 if libintl is needed for locale functions.])) 2443 2444# checks for system dependent C++ extensions support 2445case "$ac_sys_system" in 2446 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support) 2447 AC_LINK_IFELSE([ 2448 AC_LANG_PROGRAM([[#include <load.h>]], 2449 [[loadAndInit("", 0, "")]]) 2450 ],[ 2451 AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1, 2452 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r 2453 and you want support for AIX C++ shared extension modules.]) 2454 AC_MSG_RESULT(yes) 2455 ],[ 2456 AC_MSG_RESULT(no) 2457 ]);; 2458 *) ;; 2459esac 2460 2461# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. 2462# BeOS' sockets are stashed in libnet. 2463AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 2464AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets 2465 2466case "$ac_sys_system" in 2467BeOS*) 2468AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS 2469;; 2470esac 2471 2472AC_MSG_CHECKING(for --with-libs) 2473AC_ARG_WITH(libs, 2474 AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]), 2475[ 2476AC_MSG_RESULT($withval) 2477LIBS="$withval $LIBS" 2478], 2479[AC_MSG_RESULT(no)]) 2480 2481PKG_PROG_PKG_CONFIG 2482 2483# Check for use of the system expat library 2484AC_MSG_CHECKING(for --with-system-expat) 2485AC_ARG_WITH(system_expat, 2486 AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]), 2487 [], 2488 [with_system_expat="no"]) 2489 2490AC_MSG_RESULT($with_system_expat) 2491 2492# Check for use of the system libffi library 2493AC_MSG_CHECKING(for --with-system-ffi) 2494AC_ARG_WITH(system_ffi, 2495 AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]), 2496 [], 2497 [with_system_ffi="no"]) 2498 2499if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then 2500 LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`" 2501else 2502 LIBFFI_INCLUDEDIR="" 2503fi 2504AC_SUBST(LIBFFI_INCLUDEDIR) 2505 2506AC_MSG_RESULT($with_system_ffi) 2507 2508# Check for --with-tcltk-includes=path and --with-tcltk-libs=path 2509AC_SUBST(TCLTK_INCLUDES) 2510AC_SUBST(TCLTK_LIBS) 2511AC_MSG_CHECKING(for --with-tcltk-includes) 2512AC_ARG_WITH(tcltk-includes, 2513 AS_HELP_STRING([--with-tcltk-includes='-I...'], [override search for Tcl and Tk include files]), 2514 [], 2515 [with_tcltk_includes="default"]) 2516AC_MSG_RESULT($with_tcltk_includes) 2517AC_MSG_CHECKING(for --with-tcltk-libs) 2518AC_ARG_WITH(tcltk-libs, 2519 AS_HELP_STRING([--with-tcltk-libs='-L...'], [override search for Tcl and Tk libs]), 2520 [], 2521 [with_tcltk_libs="default"]) 2522AC_MSG_RESULT($with_tcltk_libs) 2523if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault 2524then 2525 if test "x$with_tcltk_includes" != "x$with_tcltk_libs" 2526 then 2527 AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither]) 2528 fi 2529 TCLTK_INCLUDES="" 2530 TCLTK_LIBS="" 2531else 2532 TCLTK_INCLUDES="$with_tcltk_includes" 2533 TCLTK_LIBS="$with_tcltk_libs" 2534fi 2535 2536# Check for --with-dbmliborder 2537AC_MSG_CHECKING(for --with-dbmliborder) 2538AC_ARG_WITH(dbmliborder, 2539 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'.]), 2540[ 2541if test x$with_dbmliborder = xyes 2542then 2543AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...]) 2544else 2545 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do 2546 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb 2547 then 2548 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...]) 2549 fi 2550 done 2551fi]) 2552AC_MSG_RESULT($with_dbmliborder) 2553 2554# Determine if signalmodule should be used. 2555AC_SUBST(USE_SIGNAL_MODULE) 2556AC_SUBST(SIGNAL_OBJS) 2557AC_MSG_CHECKING(for --with-signal-module) 2558AC_ARG_WITH(signal-module, 2559 AS_HELP_STRING([--with-signal-module], [disable/enable signal module])) 2560 2561if test -z "$with_signal_module" 2562then with_signal_module="yes" 2563fi 2564AC_MSG_RESULT($with_signal_module) 2565 2566if test "${with_signal_module}" = "yes"; then 2567 USE_SIGNAL_MODULE="" 2568 SIGNAL_OBJS="" 2569else 2570 USE_SIGNAL_MODULE="#" 2571 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o" 2572fi 2573 2574# This is used to generate Setup.config 2575AC_SUBST(USE_THREAD_MODULE) 2576USE_THREAD_MODULE="" 2577 2578AC_MSG_CHECKING(for --with-dec-threads) 2579AC_SUBST(LDLAST) 2580AC_ARG_WITH(dec-threads, 2581 AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]), 2582[ 2583AC_MSG_RESULT($withval) 2584LDLAST=-threads 2585if test "${with_thread+set}" != set; then 2586 with_thread="$withval"; 2587fi], 2588[AC_MSG_RESULT(no)]) 2589 2590# Templates for things AC_DEFINEd more than once. 2591# For a single AC_DEFINE, no template is needed. 2592AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package]) 2593AH_TEMPLATE(_REENTRANT, 2594 [Define to force use of thread-safe errno, h_errno, and other functions]) 2595AH_TEMPLATE(WITH_THREAD, 2596 [Define if you want to compile in rudimentary thread support]) 2597 2598AC_MSG_CHECKING(for --with-threads) 2599dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output 2600AC_ARG_WITH(threads, 2601 AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support])) 2602 2603# --with-thread is deprecated, but check for it anyway 2604dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output 2605AC_ARG_WITH(thread, 2606 AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]), 2607 [with_threads=$with_thread]) 2608 2609if test -z "$with_threads" 2610then with_threads="yes" 2611fi 2612AC_MSG_RESULT($with_threads) 2613 2614AC_SUBST(THREADOBJ) 2615if test "$with_threads" = "no" 2616then 2617 USE_THREAD_MODULE="#" 2618elif test "$ac_cv_pthread_is_default" = yes 2619then 2620 AC_DEFINE(WITH_THREAD) 2621 # Defining _REENTRANT on system with POSIX threads should not hurt. 2622 AC_DEFINE(_REENTRANT) 2623 posix_threads=yes 2624 THREADOBJ="Python/thread.o" 2625elif test "$ac_cv_kpthread" = "yes" 2626then 2627 CC="$CC -Kpthread" 2628 if test "$ac_cv_cxx_thread" = "yes"; then 2629 CXX="$CXX -Kpthread" 2630 fi 2631 AC_DEFINE(WITH_THREAD) 2632 posix_threads=yes 2633 THREADOBJ="Python/thread.o" 2634elif test "$ac_cv_kthread" = "yes" 2635then 2636 CC="$CC -Kthread" 2637 if test "$ac_cv_cxx_thread" = "yes"; then 2638 CXX="$CXX -Kthread" 2639 fi 2640 AC_DEFINE(WITH_THREAD) 2641 posix_threads=yes 2642 THREADOBJ="Python/thread.o" 2643elif test "$ac_cv_pthread" = "yes" 2644then 2645 CC="$CC -pthread" 2646 if test "$ac_cv_cxx_thread" = "yes"; then 2647 CXX="$CXX -pthread" 2648 fi 2649 AC_DEFINE(WITH_THREAD) 2650 posix_threads=yes 2651 THREADOBJ="Python/thread.o" 2652else 2653 if test ! -z "$with_threads" -a -d "$with_threads" 2654 then LDFLAGS="$LDFLAGS -L$with_threads" 2655 fi 2656 if test ! -z "$withval" -a -d "$withval" 2657 then LDFLAGS="$LDFLAGS -L$withval" 2658 fi 2659 2660 # According to the POSIX spec, a pthreads implementation must 2661 # define _POSIX_THREADS in unistd.h. Some apparently don't 2662 # (e.g. gnu pth with pthread emulation) 2663 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h) 2664 AC_EGREP_CPP(yes, 2665 [ 2666#include <unistd.h> 2667#ifdef _POSIX_THREADS 2668yes 2669#endif 2670 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no) 2671 AC_MSG_RESULT($unistd_defines_pthreads) 2672 2673 AC_DEFINE(_REENTRANT) 2674 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD) 2675 AC_DEFINE(C_THREADS) 2676 AC_DEFINE(HURD_C_THREADS, 1, 2677 [Define if you are using Mach cthreads directly under /include]) 2678 LIBS="$LIBS -lthreads" 2679 THREADOBJ="Python/thread.o"],[ 2680 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) 2681 AC_DEFINE(C_THREADS) 2682 AC_DEFINE(MACH_C_THREADS, 1, 2683 [Define if you are using Mach cthreads under mach /]) 2684 THREADOBJ="Python/thread.o"],[ 2685 AC_MSG_CHECKING(for --with-pth) 2686 AC_ARG_WITH([pth], 2687 AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]), 2688 [AC_MSG_RESULT($withval) 2689 AC_DEFINE([WITH_THREAD]) 2690 AC_DEFINE([HAVE_PTH], 1, 2691 [Define if you have GNU PTH threads.]) 2692 LIBS="-lpth $LIBS" 2693 THREADOBJ="Python/thread.o"], 2694 [AC_MSG_RESULT(no) 2695 2696 # Just looking for pthread_create in libpthread is not enough: 2697 # on HP/UX, pthread.h renames pthread_create to a different symbol name. 2698 # So we really have to include pthread.h, and then link. 2699 _libs=$LIBS 2700 LIBS="$LIBS -lpthread" 2701 AC_MSG_CHECKING([for pthread_create in -lpthread]) 2702 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 2703#include <stdio.h> 2704#include <pthread.h> 2705 2706void * start_routine (void *arg) { exit (0); }]], [[ 2707pthread_create (NULL, NULL, start_routine, NULL)]])],[ 2708 AC_MSG_RESULT(yes) 2709 AC_DEFINE(WITH_THREAD) 2710 posix_threads=yes 2711 THREADOBJ="Python/thread.o"],[ 2712 LIBS=$_libs 2713 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) 2714 posix_threads=yes 2715 THREADOBJ="Python/thread.o"],[ 2716 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD) 2717 AC_DEFINE(ATHEOS_THREADS, 1, 2718 [Define this if you have AtheOS threads.]) 2719 THREADOBJ="Python/thread.o"],[ 2720 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) 2721 AC_DEFINE(BEOS_THREADS, 1, 2722 [Define this if you have BeOS threads.]) 2723 THREADOBJ="Python/thread.o"],[ 2724 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) 2725 posix_threads=yes 2726 LIBS="$LIBS -lpthreads" 2727 THREADOBJ="Python/thread.o"], [ 2728 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) 2729 posix_threads=yes 2730 LIBS="$LIBS -lc_r" 2731 THREADOBJ="Python/thread.o"], [ 2732 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) 2733 posix_threads=yes 2734 LIBS="$LIBS -lpthread" 2735 THREADOBJ="Python/thread.o"], [ 2736 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) 2737 posix_threads=yes 2738 LIBS="$LIBS -lcma" 2739 THREADOBJ="Python/thread.o"],[ 2740 USE_THREAD_MODULE="#"]) 2741 ])])])])])])])])])]) 2742 2743 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) 2744 LIBS="$LIBS -lmpc" 2745 THREADOBJ="Python/thread.o" 2746 USE_THREAD_MODULE=""]) 2747 2748 if test "$posix_threads" != "yes"; then 2749 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) 2750 LIBS="$LIBS -lthread" 2751 THREADOBJ="Python/thread.o" 2752 USE_THREAD_MODULE=""]) 2753 fi 2754 2755 if test "$USE_THREAD_MODULE" != "#" 2756 then 2757 # If the above checks didn't disable threads, (at least) OSF1 2758 # needs this '-threads' argument during linking. 2759 case $ac_sys_system in 2760 OSF1) LDLAST=-threads;; 2761 esac 2762 fi 2763fi 2764 2765if test "$posix_threads" = "yes"; then 2766 if test "$unistd_defines_pthreads" = "no"; then 2767 AC_DEFINE(_POSIX_THREADS, 1, 2768 [Define if you have POSIX threads, 2769 and your system does not define that.]) 2770 fi 2771 2772 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. 2773 case $ac_sys_system/$ac_sys_release in 2774 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, 2775 [Defined for Solaris 2.6 bug in pthread header.]) 2776 ;; 2777 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, 2778 [Define if the Posix semaphores do not work on your system]) 2779 ;; 2780 AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, 2781 [Define if the Posix semaphores do not work on your system]) 2782 ;; 2783 esac 2784 2785 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported) 2786 AC_CACHE_VAL(ac_cv_pthread_system_supported, 2787 [AC_RUN_IFELSE([AC_LANG_SOURCE([[ 2788 #include <stdio.h> 2789 #include <pthread.h> 2790 void *foo(void *parm) { 2791 return NULL; 2792 } 2793 main() { 2794 pthread_attr_t attr; 2795 pthread_t id; 2796 if (pthread_attr_init(&attr)) exit(-1); 2797 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1); 2798 if (pthread_create(&id, &attr, foo, NULL)) exit(-1); 2799 exit(0); 2800 }]])], 2801 [ac_cv_pthread_system_supported=yes], 2802 [ac_cv_pthread_system_supported=no], 2803 [ac_cv_pthread_system_supported=no]) 2804 ]) 2805 AC_MSG_RESULT($ac_cv_pthread_system_supported) 2806 if test "$ac_cv_pthread_system_supported" = "yes"; then 2807 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.]) 2808 fi 2809 AC_CHECK_FUNCS(pthread_sigmask, 2810 [case $ac_sys_system in 2811 CYGWIN*) 2812 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1, 2813 [Define if pthread_sigmask() does not work on your system.]) 2814 ;; 2815 esac]) 2816 AC_CHECK_FUNCS(pthread_atfork) 2817fi 2818 2819 2820# Check for enable-ipv6 2821AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) 2822AC_MSG_CHECKING([if --enable-ipv6 is specified]) 2823AC_ARG_ENABLE(ipv6, 2824[ --enable-ipv6 Enable ipv6 (with ipv4) support 2825 --disable-ipv6 Disable ipv6 support], 2826[ case "$enableval" in 2827 no) 2828 AC_MSG_RESULT(no) 2829 ipv6=no 2830 ;; 2831 *) AC_MSG_RESULT(yes) 2832 AC_DEFINE(ENABLE_IPV6) 2833 ipv6=yes 2834 ;; 2835 esac ], 2836 2837[ 2838dnl the check does not work on cross compilation case... 2839 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* AF_INET6 available check */ 2840#include <sys/types.h> 2841#include <sys/socket.h>]], 2842[[int domain = AF_INET6;]])],[ 2843 AC_MSG_RESULT(yes) 2844 ipv6=yes 2845],[ 2846 AC_MSG_RESULT(no) 2847 ipv6=no 2848]) 2849 2850if test "$ipv6" = "yes"; then 2851 AC_MSG_CHECKING(if RFC2553 API is available) 2852 AC_COMPILE_IFELSE([ 2853 AC_LANG_PROGRAM([[#include <sys/types.h> 2854#include <netinet/in.h>]], 2855 [[struct sockaddr_in6 x; 2856 x.sin6_scope_id;]]) 2857 ],[ 2858 AC_MSG_RESULT(yes) 2859 ipv6=yes 2860 ],[ 2861 AC_MSG_RESULT(no, IPv6 disabled) 2862 ipv6=no 2863 ]) 2864fi 2865 2866if test "$ipv6" = "yes"; then 2867 AC_DEFINE(ENABLE_IPV6) 2868fi 2869]) 2870 2871ipv6type=unknown 2872ipv6lib=none 2873ipv6trylibc=no 2874 2875if test "$ipv6" = "yes"; then 2876 AC_MSG_CHECKING([ipv6 stack type]) 2877 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta; 2878 do 2879 case $i in 2880 inria) 2881 dnl http://www.kame.net/ 2882 AC_EGREP_CPP(yes, [ 2883#include <netinet/in.h> 2884#ifdef IPV6_INRIA_VERSION 2885yes 2886#endif], 2887 [ipv6type=$i]) 2888 ;; 2889 kame) 2890 dnl http://www.kame.net/ 2891 AC_EGREP_CPP(yes, [ 2892#include <netinet/in.h> 2893#ifdef __KAME__ 2894yes 2895#endif], 2896 [ipv6type=$i; 2897 ipv6lib=inet6 2898 ipv6libdir=/usr/local/v6/lib 2899 ipv6trylibc=yes]) 2900 ;; 2901 linux-glibc) 2902 dnl http://www.v6.linux.or.jp/ 2903 AC_EGREP_CPP(yes, [ 2904#include <features.h> 2905#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)) 2906yes 2907#endif], 2908 [ipv6type=$i; 2909 ipv6trylibc=yes]) 2910 ;; 2911 linux-inet6) 2912 dnl http://www.v6.linux.or.jp/ 2913 if test -d /usr/inet6; then 2914 ipv6type=$i 2915 ipv6lib=inet6 2916 ipv6libdir=/usr/inet6/lib 2917 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS" 2918 fi 2919 ;; 2920 solaris) 2921 if test -f /etc/netconfig; then 2922 if $GREP -q tcp6 /etc/netconfig; then 2923 ipv6type=$i 2924 ipv6trylibc=yes 2925 fi 2926 fi 2927 ;; 2928 toshiba) 2929 AC_EGREP_CPP(yes, [ 2930#include <sys/param.h> 2931#ifdef _TOSHIBA_INET6 2932yes 2933#endif], 2934 [ipv6type=$i; 2935 ipv6lib=inet6; 2936 ipv6libdir=/usr/local/v6/lib]) 2937 ;; 2938 v6d) 2939 AC_EGREP_CPP(yes, [ 2940#include </usr/local/v6/include/sys/v6config.h> 2941#ifdef __V6D__ 2942yes 2943#endif], 2944 [ipv6type=$i; 2945 ipv6lib=v6; 2946 ipv6libdir=/usr/local/v6/lib; 2947 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"]) 2948 ;; 2949 zeta) 2950 AC_EGREP_CPP(yes, [ 2951#include <sys/param.h> 2952#ifdef _ZETA_MINAMI_INET6 2953yes 2954#endif], 2955 [ipv6type=$i; 2956 ipv6lib=inet6; 2957 ipv6libdir=/usr/local/v6/lib]) 2958 ;; 2959 esac 2960 if test "$ipv6type" != "unknown"; then 2961 break 2962 fi 2963 done 2964 AC_MSG_RESULT($ipv6type) 2965fi 2966 2967if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then 2968 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then 2969 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS" 2970 echo "using lib$ipv6lib" 2971 else 2972 if test $ipv6trylibc = "yes"; then 2973 echo "using libc" 2974 else 2975 echo 'Fatal: no $ipv6lib library found. cannot continue.' 2976 echo "You need to fetch lib$ipv6lib.a from appropriate" 2977 echo 'ipv6 kit and compile beforehand.' 2978 exit 1 2979 fi 2980 fi 2981fi 2982 2983AC_MSG_CHECKING(for OSX 10.5 SDK or later) 2984AC_COMPILE_IFELSE([ 2985 AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]]) 2986],[ 2987 AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.]) 2988 AC_MSG_RESULT(yes) 2989],[ 2990 AC_MSG_RESULT(no) 2991]) 2992 2993# Check for --with-doc-strings 2994AC_MSG_CHECKING(for --with-doc-strings) 2995AC_ARG_WITH(doc-strings, 2996 AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings])) 2997 2998if test -z "$with_doc_strings" 2999then with_doc_strings="yes" 3000fi 3001if test "$with_doc_strings" != "no" 3002then 3003 AC_DEFINE(WITH_DOC_STRINGS, 1, 3004 [Define if you want documentation strings in extension modules]) 3005fi 3006AC_MSG_RESULT($with_doc_strings) 3007 3008# Check for Python-specific malloc support 3009AC_MSG_CHECKING(for --with-tsc) 3010AC_ARG_WITH(tsc, 3011 AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[ 3012if test "$withval" != no 3013then 3014 AC_DEFINE(WITH_TSC, 1, 3015 [Define to profile with the Pentium timestamp counter]) 3016 AC_MSG_RESULT(yes) 3017else AC_MSG_RESULT(no) 3018fi], 3019[AC_MSG_RESULT(no)]) 3020 3021# Check for Python-specific malloc support 3022AC_MSG_CHECKING(for --with-pymalloc) 3023AC_ARG_WITH(pymalloc, 3024 AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs])) 3025 3026if test -z "$with_pymalloc" 3027then with_pymalloc="yes" 3028fi 3029if test "$with_pymalloc" != "no" 3030then 3031 AC_DEFINE(WITH_PYMALLOC, 1, 3032 [Define if you want to compile in Python-specific mallocs]) 3033fi 3034AC_MSG_RESULT($with_pymalloc) 3035 3036# Check for Valgrind support 3037AC_MSG_CHECKING([for --with-valgrind]) 3038AC_ARG_WITH([valgrind], 3039 AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),, 3040 with_valgrind=no) 3041AC_MSG_RESULT([$with_valgrind]) 3042if test "$with_valgrind" != no; then 3043 AC_CHECK_HEADER([valgrind/valgrind.h], 3044 [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])], 3045 [AC_MSG_ERROR([Valgrind support requested but headers not available])] 3046 ) 3047fi 3048 3049# Check for --with-wctype-functions 3050AC_MSG_CHECKING(for --with-wctype-functions) 3051AC_ARG_WITH(wctype-functions, 3052 AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]), 3053[ 3054if test "$withval" != no 3055then 3056 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1, 3057 [Define if you want wctype.h functions to be used instead of the 3058 one supplied by Python itself. (see Include/unicodectype.h).]) 3059 AC_MSG_RESULT(yes) 3060else AC_MSG_RESULT(no) 3061fi], 3062[AC_MSG_RESULT(no)]) 3063 3064# -I${DLINCLDIR} is added to the compile rule for importdl.o 3065AC_SUBST(DLINCLDIR) 3066DLINCLDIR=. 3067 3068# the dlopen() function means we might want to use dynload_shlib.o. some 3069# platforms, such as AIX, have dlopen(), but don't want to use it. 3070AC_CHECK_FUNCS(dlopen) 3071 3072# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic 3073# loading of modules. 3074AC_SUBST(DYNLOADFILE) 3075AC_MSG_CHECKING(DYNLOADFILE) 3076if test -z "$DYNLOADFILE" 3077then 3078 case $ac_sys_system/$ac_sys_release in 3079 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c 3080 if test "$ac_cv_func_dlopen" = yes 3081 then DYNLOADFILE="dynload_shlib.o" 3082 else DYNLOADFILE="dynload_aix.o" 3083 fi 3084 ;; 3085 BeOS*) DYNLOADFILE="dynload_beos.o";; 3086 hp*|HP*) DYNLOADFILE="dynload_hpux.o";; 3087 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen() 3088 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";; 3089 atheos*) DYNLOADFILE="dynload_atheos.o";; 3090 *) 3091 # use dynload_shlib.c and dlopen() if we have it; otherwise stub 3092 # out any dynamic loading 3093 if test "$ac_cv_func_dlopen" = yes 3094 then DYNLOADFILE="dynload_shlib.o" 3095 else DYNLOADFILE="dynload_stub.o" 3096 fi 3097 ;; 3098 esac 3099fi 3100AC_MSG_RESULT($DYNLOADFILE) 3101if test "$DYNLOADFILE" != "dynload_stub.o" 3102then 3103 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1, 3104 [Defined when any dynamic module loading is enabled.]) 3105fi 3106 3107# MACHDEP_OBJS can be set to platform-specific object files needed by Python 3108 3109AC_SUBST(MACHDEP_OBJS) 3110AC_MSG_CHECKING(MACHDEP_OBJS) 3111if test -z "$MACHDEP_OBJS" 3112then 3113 MACHDEP_OBJS=$extra_machdep_objs 3114else 3115 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs" 3116fi 3117AC_MSG_RESULT(MACHDEP_OBJS) 3118 3119# checks for library functions 3120AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \ 3121 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \ 3122 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ 3123 getentropy \ 3124 getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ 3125 initgroups kill killpg lchown lstat mkfifo mknod mktime mmap \ 3126 mremap nice pathconf pause plock poll pthread_init \ 3127 putenv readlink realpath \ 3128 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \ 3129 setgid \ 3130 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \ 3131 setlocale setregid setreuid setresuid setresgid \ 3132 setsid setpgid setpgrp setuid setvbuf snprintf \ 3133 sigaction siginterrupt sigrelse strftime \ 3134 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ 3135 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty) 3136 3137# Force lchmod off for Linux. Linux disallows changing the mode of symbolic 3138# links. Some libc implementations have a stub lchmod implementation that always 3139# returns an error. 3140if test "$MACHDEP" != linux; then 3141 AC_CHECK_FUNC(lchmod) 3142fi 3143 3144# For some functions, having a definition is not sufficient, since 3145# we want to take their address. 3146AC_MSG_CHECKING(for chroot) 3147AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])], 3148 [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.) 3149 AC_MSG_RESULT(yes)], 3150 [AC_MSG_RESULT(no) 3151]) 3152AC_MSG_CHECKING(for link) 3153AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])], 3154 [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.) 3155 AC_MSG_RESULT(yes)], 3156 [AC_MSG_RESULT(no) 3157]) 3158AC_MSG_CHECKING(for symlink) 3159AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])], 3160 [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.) 3161 AC_MSG_RESULT(yes)], 3162 [AC_MSG_RESULT(no) 3163]) 3164AC_MSG_CHECKING(for fchdir) 3165AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])], 3166 [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.) 3167 AC_MSG_RESULT(yes)], 3168 [AC_MSG_RESULT(no) 3169]) 3170AC_MSG_CHECKING(for fsync) 3171AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])], 3172 [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.) 3173 AC_MSG_RESULT(yes)], 3174 [AC_MSG_RESULT(no) 3175]) 3176AC_MSG_CHECKING(for fdatasync) 3177AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])], 3178 [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.) 3179 AC_MSG_RESULT(yes)], 3180 [AC_MSG_RESULT(no) 3181]) 3182AC_MSG_CHECKING(for epoll) 3183AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])], 3184 [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.) 3185 AC_MSG_RESULT(yes)], 3186 [AC_MSG_RESULT(no) 3187]) 3188AC_MSG_CHECKING(for kqueue) 3189AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3190#include <sys/types.h> 3191#include <sys/event.h> 3192 ]], [[int x=kqueue()]])], 3193 [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.) 3194 AC_MSG_RESULT(yes)], 3195 [AC_MSG_RESULT(no) 3196]) 3197# On some systems (eg. FreeBSD 5), we would find a definition of the 3198# functions ctermid_r, setgroups in the library, but no prototype 3199# (e.g. because we use _XOPEN_SOURCE). See whether we can take their 3200# address to avoid compiler warnings and potential miscompilations 3201# because of the missing prototypes. 3202 3203AC_MSG_CHECKING(for ctermid_r) 3204AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3205#include <stdio.h> 3206]], [[void* p = ctermid_r]])], 3207 [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.) 3208 AC_MSG_RESULT(yes)], 3209 [AC_MSG_RESULT(no) 3210]) 3211 3212AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl], 3213 [AC_COMPILE_IFELSE( 3214 [AC_LANG_PROGRAM( 3215 [#include <sys/file.h>], 3216 [void* p = flock] 3217 )], 3218 [ac_cv_flock_decl=yes], 3219 [ac_cv_flock_decl=no] 3220 ) 3221]) 3222if test "x${ac_cv_flock_decl}" = xyes; then 3223 AC_CHECK_FUNCS(flock,, 3224 AC_CHECK_LIB(bsd,flock, 3225 [AC_DEFINE(HAVE_FLOCK) 3226 AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.) 3227 ]) 3228 ) 3229fi 3230 3231AC_MSG_CHECKING(for getpagesize) 3232AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3233#include <unistd.h> 3234]], [[void* p = getpagesize]])], 3235 [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.) 3236 AC_MSG_RESULT(yes)], 3237 [AC_MSG_RESULT(no) 3238]) 3239 3240AC_MSG_CHECKING(for broken unsetenv) 3241AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3242#include <stdlib.h> 3243]], [[int res = unsetenv("DUMMY")]])], 3244 [AC_MSG_RESULT(no)], 3245 [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.) 3246 AC_MSG_RESULT(yes) 3247]) 3248 3249dnl check for true 3250AC_CHECK_PROGS(TRUE, true, /bin/true) 3251 3252dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv 3253dnl On others, they are in the C library, so we to take no action 3254AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE], 3255 AC_CHECK_LIB(resolv, inet_aton) 3256) 3257 3258# On Tru64, chflags seems to be present, but calling it will 3259# exit Python 3260AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl 3261AC_RUN_IFELSE([AC_LANG_SOURCE([[ 3262#include <sys/stat.h> 3263#include <unistd.h> 3264int main(int argc, char*argv[]) 3265{ 3266 if(chflags(argv[0], 0) != 0) 3267 return 1; 3268 return 0; 3269} 3270]])], 3271[ac_cv_have_chflags=yes], 3272[ac_cv_have_chflags=no], 3273[ac_cv_have_chflags=cross]) 3274]) 3275if test "$ac_cv_have_chflags" = cross ; then 3276 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"]) 3277fi 3278if test "$ac_cv_have_chflags" = yes ; then 3279 AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the 'chflags' function.]) 3280fi 3281 3282AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl 3283AC_RUN_IFELSE([AC_LANG_SOURCE([[ 3284#include <sys/stat.h> 3285#include <unistd.h> 3286int main(int argc, char*argv[]) 3287{ 3288 if(lchflags(argv[0], 0) != 0) 3289 return 1; 3290 return 0; 3291} 3292]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross]) 3293]) 3294if test "$ac_cv_have_lchflags" = cross ; then 3295 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"]) 3296fi 3297if test "$ac_cv_have_lchflags" = yes ; then 3298 AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.]) 3299fi 3300 3301dnl Check if system zlib has *Copy() functions 3302dnl 3303dnl On MacOSX the linker will search for dylibs on the entire linker path 3304dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first 3305dnl to revert to a more traditional unix behaviour and make it possible to 3306dnl override the system libz with a local static library of libz. Temporarily 3307dnl add that flag to our CFLAGS as well to ensure that we check the version 3308dnl of libz that will be used by setup.py. 3309dnl The -L/usr/local/lib is needed as wel to get the same compilation 3310dnl environment as setup.py (and leaving it out can cause configure to use the 3311dnl wrong version of the library) 3312case $ac_sys_system/$ac_sys_release in 3313Darwin/*) 3314 _CUR_CFLAGS="${CFLAGS}" 3315 _CUR_LDFLAGS="${LDFLAGS}" 3316 CFLAGS="${CFLAGS} -Wl,-search_paths_first" 3317 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib" 3318 ;; 3319esac 3320 3321AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy])) 3322 3323case $ac_sys_system/$ac_sys_release in 3324Darwin/*) 3325 CFLAGS="${_CUR_CFLAGS}" 3326 LDFLAGS="${_CUR_LDFLAGS}" 3327 ;; 3328esac 3329 3330AC_MSG_CHECKING(for hstrerror) 3331AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 3332#include <netdb.h> 3333]], [[void* p = hstrerror; hstrerror(0)]])], 3334 [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.) 3335 AC_MSG_RESULT(yes)], 3336 [AC_MSG_RESULT(no) 3337]) 3338 3339AC_MSG_CHECKING(for inet_aton) 3340AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 3341#include <sys/types.h> 3342#include <sys/socket.h> 3343#include <netinet/in.h> 3344#include <arpa/inet.h> 3345]], [[void* p = inet_aton;inet_aton(0,0)]])], 3346 [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.) 3347 AC_MSG_RESULT(yes)], 3348 [AC_MSG_RESULT(no) 3349]) 3350 3351AC_MSG_CHECKING(for inet_pton) 3352AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3353#include <sys/types.h> 3354#include <sys/socket.h> 3355#include <netinet/in.h> 3356#include <arpa/inet.h> 3357]], [[void* p = inet_pton]])], 3358 [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.) 3359 AC_MSG_RESULT(yes)], 3360 [AC_MSG_RESULT(no) 3361]) 3362 3363# On some systems, setgroups is in unistd.h, on others, in grp.h 3364AC_MSG_CHECKING(for setgroups) 3365AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3366#include <unistd.h> 3367#ifdef HAVE_GRP_H 3368#include <grp.h> 3369#endif 3370]], [[void* p = setgroups]])], 3371 [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.) 3372 AC_MSG_RESULT(yes)], 3373 [AC_MSG_RESULT(no) 3374]) 3375 3376# check for openpty and forkpty 3377 3378AC_CHECK_FUNCS(openpty,, 3379 AC_CHECK_LIB(util,openpty, 3380 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"], 3381 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"]) 3382 ) 3383) 3384AC_CHECK_FUNCS(forkpty,, 3385 AC_CHECK_LIB(util,forkpty, 3386 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"], 3387 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"]) 3388 ) 3389) 3390 3391# Stuff for expat. 3392AC_CHECK_FUNCS(memmove) 3393 3394# check for long file support functions 3395AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs) 3396 3397AC_REPLACE_FUNCS(dup2 getcwd strdup) 3398AC_CHECK_FUNCS(getpgrp, 3399 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])], 3400 [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])], 3401 []) 3402) 3403AC_CHECK_FUNCS(setpgrp, 3404 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])], 3405 [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])], 3406 []) 3407) 3408AC_CHECK_FUNCS(gettimeofday, 3409 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]], 3410 [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])], 3411 [], 3412 [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1, 3413 [Define if gettimeofday() does not have second (timezone) argument 3414 This is the case on Motorola V4 (R40V4.2)]) 3415 ]) 3416) 3417 3418AC_MSG_CHECKING(for major, minor, and makedev) 3419AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 3420#if defined(MAJOR_IN_MKDEV) 3421#include <sys/mkdev.h> 3422#elif defined(MAJOR_IN_SYSMACROS) 3423#include <sys/sysmacros.h> 3424#else 3425#include <sys/types.h> 3426#endif 3427]], [[ 3428 makedev(major(0),minor(0)); 3429]])],[ 3430 AC_DEFINE(HAVE_DEVICE_MACROS, 1, 3431 [Define to 1 if you have the device macros.]) 3432 AC_MSG_RESULT(yes) 3433],[ 3434 AC_MSG_RESULT(no) 3435]) 3436 3437# On OSF/1 V5.1, getaddrinfo is available, but a define 3438# for [no]getaddrinfo in netdb.h. 3439AC_MSG_CHECKING(for getaddrinfo) 3440AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 3441#include <sys/types.h> 3442#include <sys/socket.h> 3443#include <netdb.h> 3444#include <stdio.h> 3445]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], 3446[have_getaddrinfo=yes], 3447[have_getaddrinfo=no]) 3448AC_MSG_RESULT($have_getaddrinfo) 3449if test $have_getaddrinfo = yes 3450then 3451 AC_MSG_CHECKING(getaddrinfo bug) 3452 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo, 3453 AC_RUN_IFELSE([AC_LANG_SOURCE([[[ 3454#include <stdio.h> 3455#include <sys/types.h> 3456#include <netdb.h> 3457#include <string.h> 3458#include <sys/socket.h> 3459#include <netinet/in.h> 3460 3461int main() 3462{ 3463 int passive, gaierr, inet4 = 0, inet6 = 0; 3464 struct addrinfo hints, *ai, *aitop; 3465 char straddr[INET6_ADDRSTRLEN], strport[16]; 3466 3467 for (passive = 0; passive <= 1; passive++) { 3468 memset(&hints, 0, sizeof(hints)); 3469 hints.ai_family = AF_UNSPEC; 3470 hints.ai_flags = passive ? AI_PASSIVE : 0; 3471 hints.ai_socktype = SOCK_STREAM; 3472 hints.ai_protocol = IPPROTO_TCP; 3473 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) { 3474 (void)gai_strerror(gaierr); 3475 goto bad; 3476 } 3477 for (ai = aitop; ai; ai = ai->ai_next) { 3478 if (ai->ai_addr == NULL || 3479 ai->ai_addrlen == 0 || 3480 getnameinfo(ai->ai_addr, ai->ai_addrlen, 3481 straddr, sizeof(straddr), strport, sizeof(strport), 3482 NI_NUMERICHOST|NI_NUMERICSERV) != 0) { 3483 goto bad; 3484 } 3485 switch (ai->ai_family) { 3486 case AF_INET: 3487 if (strcmp(strport, "54321") != 0) { 3488 goto bad; 3489 } 3490 if (passive) { 3491 if (strcmp(straddr, "0.0.0.0") != 0) { 3492 goto bad; 3493 } 3494 } else { 3495 if (strcmp(straddr, "127.0.0.1") != 0) { 3496 goto bad; 3497 } 3498 } 3499 inet4++; 3500 break; 3501 case AF_INET6: 3502 if (strcmp(strport, "54321") != 0) { 3503 goto bad; 3504 } 3505 if (passive) { 3506 if (strcmp(straddr, "::") != 0) { 3507 goto bad; 3508 } 3509 } else { 3510 if (strcmp(straddr, "::1") != 0) { 3511 goto bad; 3512 } 3513 } 3514 inet6++; 3515 break; 3516 case AF_UNSPEC: 3517 goto bad; 3518 break; 3519 default: 3520 /* another family support? */ 3521 break; 3522 } 3523 } 3524 freeaddrinfo(aitop); 3525 aitop = NULL; 3526 } 3527 3528 if (!(inet4 == 0 || inet4 == 2)) 3529 goto bad; 3530 if (!(inet6 == 0 || inet6 == 2)) 3531 goto bad; 3532 3533 if (aitop) 3534 freeaddrinfo(aitop); 3535 return 0; 3536 3537 bad: 3538 if (aitop) 3539 freeaddrinfo(aitop); 3540 return 1; 3541} 3542]]])], 3543[ac_cv_buggy_getaddrinfo=no], 3544[ac_cv_buggy_getaddrinfo=yes], 3545[ 3546if test "${enable_ipv6+set}" = set; then 3547 ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6" 3548else 3549 ac_cv_buggy_getaddrinfo=yes 3550fi])) 3551fi 3552 3553AC_MSG_RESULT($ac_cv_buggy_getaddrinfo) 3554 3555if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes 3556then 3557 if test $ipv6 = yes 3558 then 3559 echo 'Fatal: You must get working getaddrinfo() function.' 3560 echo ' or you can specify "--disable-ipv6"'. 3561 exit 1 3562 fi 3563else 3564 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.]) 3565fi 3566 3567AC_CHECK_FUNCS(getnameinfo) 3568 3569# checks for structures 3570AC_HEADER_TIME 3571AC_STRUCT_TM 3572AC_STRUCT_TIMEZONE 3573AC_CHECK_MEMBERS([struct stat.st_rdev]) 3574AC_CHECK_MEMBERS([struct stat.st_blksize]) 3575AC_CHECK_MEMBERS([struct stat.st_flags]) 3576AC_CHECK_MEMBERS([struct stat.st_gen]) 3577AC_CHECK_MEMBERS([struct stat.st_birthtime]) 3578AC_CHECK_MEMBERS([struct stat.st_blocks]) 3579 3580AC_MSG_CHECKING(for time.h that defines altzone) 3581AC_CACHE_VAL(ac_cv_header_time_altzone,[ 3582 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])], 3583 [ac_cv_header_time_altzone=yes], 3584 [ac_cv_header_time_altzone=no]) 3585 ]) 3586AC_MSG_RESULT($ac_cv_header_time_altzone) 3587if test $ac_cv_header_time_altzone = yes; then 3588 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.]) 3589fi 3590 3591was_it_defined=no 3592AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included) 3593AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3594#include <sys/types.h> 3595#include <sys/select.h> 3596#include <sys/time.h> 3597]], [[;]])],[ 3598 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1, 3599 [Define if you can safely include both <sys/select.h> and <sys/time.h> 3600 (which you can't on SCO ODT 3.0).]) 3601 was_it_defined=yes 3602],[]) 3603AC_MSG_RESULT($was_it_defined) 3604 3605AC_MSG_CHECKING(for addrinfo) 3606AC_CACHE_VAL(ac_cv_struct_addrinfo, 3607AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])], 3608 [ac_cv_struct_addrinfo=yes], 3609 [ac_cv_struct_addrinfo=no])) 3610AC_MSG_RESULT($ac_cv_struct_addrinfo) 3611if test $ac_cv_struct_addrinfo = yes; then 3612 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)]) 3613fi 3614 3615AC_MSG_CHECKING(for sockaddr_storage) 3616AC_CACHE_VAL(ac_cv_struct_sockaddr_storage, 3617AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3618# include <sys/types.h> 3619# include <sys/socket.h>]], [[struct sockaddr_storage s]])], 3620 [ac_cv_struct_sockaddr_storage=yes], 3621 [ac_cv_struct_sockaddr_storage=no])) 3622AC_MSG_RESULT($ac_cv_struct_sockaddr_storage) 3623if test $ac_cv_struct_sockaddr_storage = yes; then 3624 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)]) 3625fi 3626 3627# checks for compiler characteristics 3628 3629AC_C_CHAR_UNSIGNED 3630AC_C_CONST 3631 3632works=no 3633AC_MSG_CHECKING(for working volatile) 3634AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])], 3635 [works=yes], 3636 [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])] 3637) 3638AC_MSG_RESULT($works) 3639 3640works=no 3641AC_MSG_CHECKING(for working signed char) 3642AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])], 3643 [works=yes], 3644 [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])] 3645) 3646AC_MSG_RESULT($works) 3647 3648have_prototypes=no 3649AC_MSG_CHECKING(for prototypes) 3650AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])], 3651 [AC_DEFINE(HAVE_PROTOTYPES, 1, 3652 [Define if your compiler supports function prototype]) 3653 have_prototypes=yes], 3654 [] 3655) 3656AC_MSG_RESULT($have_prototypes) 3657 3658works=no 3659AC_MSG_CHECKING(for variable length prototypes and stdarg.h) 3660AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3661#include <stdarg.h> 3662int foo(int x, ...) { 3663 va_list va; 3664 va_start(va, x); 3665 va_arg(va, int); 3666 va_arg(va, char *); 3667 va_arg(va, double); 3668 return 0; 3669} 3670]], [[return foo(10, "", 3.14);]])],[ 3671 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1, 3672 [Define if your compiler supports variable length function prototypes 3673 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>]) 3674 works=yes 3675],[]) 3676AC_MSG_RESULT($works) 3677 3678# check for socketpair 3679AC_MSG_CHECKING(for socketpair) 3680AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3681#include <sys/types.h> 3682#include <sys/socket.h> 3683]], [[void *x=socketpair]])], 3684 [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.]) 3685 AC_MSG_RESULT(yes)], 3686 [AC_MSG_RESULT(no)] 3687) 3688 3689# check if sockaddr has sa_len member 3690AC_MSG_CHECKING(if sockaddr has sa_len member) 3691AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 3692#include <sys/socket.h>]], [[struct sockaddr x; 3693x.sa_len = 0;]])], 3694 [AC_MSG_RESULT(yes) 3695 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])], 3696 [AC_MSG_RESULT(no)] 3697) 3698 3699va_list_is_array=no 3700AC_MSG_CHECKING(whether va_list is an array) 3701AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3702#ifdef HAVE_STDARG_PROTOTYPES 3703#include <stdarg.h> 3704#else 3705#include <varargs.h> 3706#endif 3707]], [[va_list list1, list2; list1 = list2;]])],[],[ 3708 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind]) 3709 va_list_is_array=yes 3710]) 3711AC_MSG_RESULT($va_list_is_array) 3712 3713# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-( 3714AH_TEMPLATE(HAVE_GETHOSTBYNAME_R, 3715 [Define this if you have some version of gethostbyname_r()]) 3716 3717AC_CHECK_FUNC(gethostbyname_r, [ 3718 AC_DEFINE(HAVE_GETHOSTBYNAME_R) 3719 AC_MSG_CHECKING([gethostbyname_r with 6 args]) 3720 OLD_CFLAGS=$CFLAGS 3721 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS" 3722 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3723# include <netdb.h> 3724 ]], [[ 3725 char *name; 3726 struct hostent *he, *res; 3727 char buffer[2048]; 3728 int buflen = 2048; 3729 int h_errnop; 3730 3731 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop) 3732 ]])],[ 3733 AC_DEFINE(HAVE_GETHOSTBYNAME_R) 3734 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1, 3735 [Define this if you have the 6-arg version of gethostbyname_r().]) 3736 AC_MSG_RESULT(yes) 3737 ],[ 3738 AC_MSG_RESULT(no) 3739 AC_MSG_CHECKING([gethostbyname_r with 5 args]) 3740 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3741# include <netdb.h> 3742 ]], [[ 3743 char *name; 3744 struct hostent *he; 3745 char buffer[2048]; 3746 int buflen = 2048; 3747 int h_errnop; 3748 3749 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop) 3750 ]])], 3751 [ 3752 AC_DEFINE(HAVE_GETHOSTBYNAME_R) 3753 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1, 3754 [Define this if you have the 5-arg version of gethostbyname_r().]) 3755 AC_MSG_RESULT(yes) 3756 ], [ 3757 AC_MSG_RESULT(no) 3758 AC_MSG_CHECKING([gethostbyname_r with 3 args]) 3759 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 3760# include <netdb.h> 3761 ]], [[ 3762 char *name; 3763 struct hostent *he; 3764 struct hostent_data data; 3765 3766 (void) gethostbyname_r(name, he, &data); 3767 ]])], 3768 [ 3769 AC_DEFINE(HAVE_GETHOSTBYNAME_R) 3770 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1, 3771 [Define this if you have the 3-arg version of gethostbyname_r().]) 3772 AC_MSG_RESULT(yes) 3773 ], [ 3774 AC_MSG_RESULT(no) 3775 ]) 3776 ]) 3777 ]) 3778 CFLAGS=$OLD_CFLAGS 3779], [ 3780 AC_CHECK_FUNCS(gethostbyname) 3781]) 3782AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG) 3783AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG) 3784AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG) 3785AC_SUBST(HAVE_GETHOSTBYNAME_R) 3786AC_SUBST(HAVE_GETHOSTBYNAME) 3787 3788# checks for system services 3789# (none yet) 3790 3791# Linux requires this for correct f.p. operations 3792AC_CHECK_FUNC(__fpu_control, 3793 [], 3794 [AC_CHECK_LIB(ieee, __fpu_control) 3795]) 3796 3797# Check for --with-fpectl 3798AC_MSG_CHECKING(for --with-fpectl) 3799AC_ARG_WITH(fpectl, 3800 AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]), 3801[ 3802if test "$withval" != no 3803then 3804 AC_DEFINE(WANT_SIGFPE_HANDLER, 1, 3805 [Define if you want SIGFPE handled (see Include/pyfpe.h).]) 3806 AC_MSG_RESULT(yes) 3807else AC_MSG_RESULT(no) 3808fi], 3809[AC_MSG_RESULT(no)]) 3810 3811# check for --with-libm=... 3812AC_SUBST(LIBM) 3813case $ac_sys_system in 3814Darwin) ;; 3815BeOS) ;; 3816*) LIBM=-lm 3817esac 3818AC_MSG_CHECKING(for --with-libm=STRING) 3819AC_ARG_WITH(libm, 3820 AS_HELP_STRING([--with-libm=STRING], [math library]), 3821[ 3822if test "$withval" = no 3823then LIBM= 3824 AC_MSG_RESULT(force LIBM empty) 3825elif test "$withval" != yes 3826then LIBM=$withval 3827 AC_MSG_RESULT(set LIBM="$withval") 3828else AC_MSG_ERROR([proper usage is --with-libm=STRING]) 3829fi], 3830[AC_MSG_RESULT(default LIBM="$LIBM")]) 3831 3832# check for --with-libc=... 3833AC_SUBST(LIBC) 3834AC_MSG_CHECKING(for --with-libc=STRING) 3835AC_ARG_WITH(libc, 3836 AS_HELP_STRING([--with-libc=STRING], [C library]), 3837[ 3838if test "$withval" = no 3839then LIBC= 3840 AC_MSG_RESULT(force LIBC empty) 3841elif test "$withval" != yes 3842then LIBC=$withval 3843 AC_MSG_RESULT(set LIBC="$withval") 3844else AC_MSG_ERROR([proper usage is --with-libc=STRING]) 3845fi], 3846[AC_MSG_RESULT(default LIBC="$LIBC")]) 3847 3848# ************************************************** 3849# * Check for various properties of floating point * 3850# ************************************************** 3851 3852AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64) 3853AC_CACHE_VAL(ac_cv_little_endian_double, [ 3854AC_RUN_IFELSE([AC_LANG_SOURCE([[ 3855#include <string.h> 3856int main() { 3857 double x = 9006104071832581.0; 3858 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0) 3859 return 0; 3860 else 3861 return 1; 3862} 3863]])], 3864[ac_cv_little_endian_double=yes], 3865[ac_cv_little_endian_double=no], 3866[ac_cv_little_endian_double=no])]) 3867AC_MSG_RESULT($ac_cv_little_endian_double) 3868if test "$ac_cv_little_endian_double" = yes 3869then 3870 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1, 3871 [Define if C doubles are 64-bit IEEE 754 binary format, stored 3872 with the least significant byte first]) 3873fi 3874 3875AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64) 3876AC_CACHE_VAL(ac_cv_big_endian_double, [ 3877AC_RUN_IFELSE([AC_LANG_SOURCE([[ 3878#include <string.h> 3879int main() { 3880 double x = 9006104071832581.0; 3881 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0) 3882 return 0; 3883 else 3884 return 1; 3885} 3886]])], 3887[ac_cv_big_endian_double=yes], 3888[ac_cv_big_endian_double=no], 3889[ac_cv_big_endian_double=no])]) 3890AC_MSG_RESULT($ac_cv_big_endian_double) 3891if test "$ac_cv_big_endian_double" = yes 3892then 3893 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1, 3894 [Define if C doubles are 64-bit IEEE 754 binary format, stored 3895 with the most significant byte first]) 3896fi 3897 3898# Some ARM platforms use a mixed-endian representation for doubles. 3899# While Python doesn't currently have full support for these platforms 3900# (see e.g., issue 1762561), we can at least make sure that float <-> string 3901# conversions work. 3902AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64) 3903AC_CACHE_VAL(ac_cv_mixed_endian_double, [ 3904AC_RUN_IFELSE([AC_LANG_SOURCE([[ 3905#include <string.h> 3906int main() { 3907 double x = 9006104071832581.0; 3908 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0) 3909 return 0; 3910 else 3911 return 1; 3912} 3913]])], 3914[ac_cv_mixed_endian_double=yes], 3915[ac_cv_mixed_endian_double=no], 3916[ac_cv_mixed_endian_double=no])]) 3917AC_MSG_RESULT($ac_cv_mixed_endian_double) 3918if test "$ac_cv_mixed_endian_double" = yes 3919then 3920 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1, 3921 [Define if C doubles are 64-bit IEEE 754 binary format, stored 3922 in ARM mixed-endian order (byte order 45670123)]) 3923fi 3924 3925# The short float repr introduced in Python 3.1 requires the 3926# correctly-rounded string <-> double conversion functions from 3927# Python/dtoa.c, which in turn require that the FPU uses 53-bit 3928# rounding; this is a problem on x86, where the x87 FPU has a default 3929# rounding precision of 64 bits. For gcc/x86, we can fix this by 3930# using inline assembler to get and set the x87 FPU control word. 3931 3932# This inline assembler syntax may also work for suncc and icc, 3933# so we try it on all platforms. 3934 3935AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word) 3936AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ 3937 unsigned short cw; 3938 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw)); 3939 __asm__ __volatile__ ("fldcw %0" : : "m" (cw)); 3940]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no]) 3941AC_MSG_RESULT($have_gcc_asm_for_x87) 3942if test "$have_gcc_asm_for_x87" = yes 3943then 3944 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1, 3945 [Define if we can use gcc inline assembler to get and set x87 control word]) 3946fi 3947 3948# Detect whether system arithmetic is subject to x87-style double 3949# rounding issues. The result of this test has little meaning on non 3950# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding 3951# mode is round-to-nearest and double rounding issues are present, and 3952# 0 otherwise. See http://bugs.python.org/issue2937 for more info. 3953AC_MSG_CHECKING(for x87-style double rounding) 3954# $BASECFLAGS may affect the result 3955ac_save_cc="$CC" 3956CC="$CC $BASECFLAGS" 3957AC_RUN_IFELSE([AC_LANG_SOURCE([[ 3958#include <stdlib.h> 3959#include <math.h> 3960int main() { 3961 volatile double x, y, z; 3962 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */ 3963 x = 0.99999999999999989; /* 1-2**-53 */ 3964 y = 1./x; 3965 if (y != 1.) 3966 exit(0); 3967 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */ 3968 x = 1e16; 3969 y = 2.99999; 3970 z = x + y; 3971 if (z != 1e16+4.) 3972 exit(0); 3973 /* both tests show evidence of double rounding */ 3974 exit(1); 3975} 3976]])], 3977[ac_cv_x87_double_rounding=no], 3978[ac_cv_x87_double_rounding=yes], 3979[ac_cv_x87_double_rounding=no]) 3980CC="$ac_save_cc" 3981AC_MSG_RESULT($ac_cv_x87_double_rounding) 3982if test "$ac_cv_x87_double_rounding" = yes 3983then 3984 AC_DEFINE(X87_DOUBLE_ROUNDING, 1, 3985 [Define if arithmetic is subject to x87-style double rounding issue]) 3986fi 3987 3988# ************************************ 3989# * Check for mathematical functions * 3990# ************************************ 3991 3992LIBS_SAVE=$LIBS 3993LIBS="$LIBS $LIBM" 3994 3995# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of 3996# -0. on some architectures. 3997AC_MSG_CHECKING(whether tanh preserves the sign of zero) 3998AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [ 3999AC_RUN_IFELSE([AC_LANG_SOURCE([[ 4000#include <math.h> 4001#include <stdlib.h> 4002int main() { 4003 /* return 0 if either negative zeros don't exist 4004 on this platform or if negative zeros exist 4005 and tanh(-0.) == -0. */ 4006 if (atan2(0., -1.) == atan2(-0., -1.) || 4007 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0); 4008 else exit(1); 4009} 4010]])], 4011[ac_cv_tanh_preserves_zero_sign=yes], 4012[ac_cv_tanh_preserves_zero_sign=no], 4013[ac_cv_tanh_preserves_zero_sign=no])]) 4014AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign) 4015if test "$ac_cv_tanh_preserves_zero_sign" = yes 4016then 4017 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1, 4018 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros]) 4019fi 4020 4021AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma]) 4022AC_CHECK_FUNCS([hypot lgamma log1p round tgamma]) 4023AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]]) 4024 4025LIBS=$LIBS_SAVE 4026 4027# For multiprocessing module, check that sem_open 4028# actually works. For FreeBSD versions <= 7.2, 4029# the kernel module that provides POSIX semaphores 4030# isn't loaded by default, so an attempt to call 4031# sem_open results in a 'Signal 12' error. 4032AC_MSG_CHECKING(whether POSIX semaphores are enabled) 4033AC_CACHE_VAL(ac_cv_posix_semaphores_enabled, 4034AC_RUN_IFELSE([AC_LANG_SOURCE([[ 4035#include <unistd.h> 4036#include <fcntl.h> 4037#include <stdio.h> 4038#include <semaphore.h> 4039#include <sys/stat.h> 4040 4041int main(void) { 4042 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0); 4043 if (a == SEM_FAILED) { 4044 perror("sem_open"); 4045 return 1; 4046 } 4047 sem_close(a); 4048 sem_unlink("/autoconf"); 4049 return 0; 4050} 4051]])], 4052[ac_cv_posix_semaphores_enabled=yes], 4053[ac_cv_posix_semaphores_enabled=no], 4054[ac_cv_posix_semaphores_enabled=yes]) 4055) 4056AC_MSG_RESULT($ac_cv_posix_semaphores_enabled) 4057if test $ac_cv_posix_semaphores_enabled = no 4058then 4059 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1, 4060 [Define if POSIX semaphores aren't enabled on your system]) 4061fi 4062 4063# Multiprocessing check for broken sem_getvalue 4064AC_MSG_CHECKING(for broken sem_getvalue) 4065AC_CACHE_VAL(ac_cv_broken_sem_getvalue, 4066AC_RUN_IFELSE([AC_LANG_SOURCE([[ 4067#include <unistd.h> 4068#include <fcntl.h> 4069#include <stdio.h> 4070#include <semaphore.h> 4071#include <sys/stat.h> 4072 4073int main(void){ 4074 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0); 4075 int count; 4076 int res; 4077 if(a==SEM_FAILED){ 4078 perror("sem_open"); 4079 return 1; 4080 4081 } 4082 res = sem_getvalue(a, &count); 4083 sem_close(a); 4084 sem_unlink("/autocftw"); 4085 return res==-1 ? 1 : 0; 4086} 4087]])], 4088[ac_cv_broken_sem_getvalue=no], 4089[ac_cv_broken_sem_getvalue=yes], 4090[ac_cv_broken_sem_getvalue=yes]) 4091) 4092AC_MSG_RESULT($ac_cv_broken_sem_getvalue) 4093if test $ac_cv_broken_sem_getvalue = yes 4094then 4095 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1, 4096 [define to 1 if your sem_getvalue is broken.]) 4097fi 4098 4099# determine what size digit to use for Python's longs 4100AC_MSG_CHECKING([digit size for Python's longs]) 4101AC_ARG_ENABLE(big-digits, 4102AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]), 4103[case $enable_big_digits in 4104yes) 4105 enable_big_digits=30 ;; 4106no) 4107 enable_big_digits=15 ;; 4108[15|30]) 4109 ;; 4110*) 4111 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;; 4112esac 4113AC_MSG_RESULT($enable_big_digits) 4114AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits]) 4115], 4116[AC_MSG_RESULT(no value specified)]) 4117 4118# check for wchar.h 4119AC_CHECK_HEADER(wchar.h, [ 4120 AC_DEFINE(HAVE_WCHAR_H, 1, 4121 [Define if the compiler provides a wchar.h header file.]) 4122 wchar_h="yes" 4123], 4124wchar_h="no" 4125) 4126 4127# determine wchar_t size 4128if test "$wchar_h" = yes 4129then 4130 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>]) 4131fi 4132 4133AC_MSG_CHECKING(for UCS-4 tcl) 4134have_ucs4_tcl=no 4135AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 4136#include <tcl.h> 4137#if TCL_UTF_MAX != 6 4138# error "NOT UCS4_TCL" 4139#endif]], [[]])],[ 4140 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6]) 4141 have_ucs4_tcl=yes 4142],[]) 4143AC_MSG_RESULT($have_ucs4_tcl) 4144 4145# check whether wchar_t is signed or not 4146if test "$wchar_h" = yes 4147then 4148 # check whether wchar_t is signed or not 4149 AC_MSG_CHECKING(whether wchar_t is signed) 4150 AC_CACHE_VAL(ac_cv_wchar_t_signed, [ 4151 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 4152 #include <wchar.h> 4153 int main() 4154 { 4155 /* Success: exit code 0 */ 4156 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1); 4157 } 4158 ]])], 4159 [ac_cv_wchar_t_signed=yes], 4160 [ac_cv_wchar_t_signed=no], 4161 [ac_cv_wchar_t_signed=yes])]) 4162 AC_MSG_RESULT($ac_cv_wchar_t_signed) 4163fi 4164 4165AC_MSG_CHECKING(what type to use for unicode) 4166dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output 4167AC_ARG_ENABLE(unicode, 4168 AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is ucs2)]), 4169 [], 4170 [enable_unicode=yes]) 4171 4172if test $enable_unicode = yes 4173then 4174 # Without any arguments, Py_UNICODE defaults to two-byte mode 4175 case "$have_ucs4_tcl" in 4176 yes) enable_unicode="ucs4" 4177 ;; 4178 *) enable_unicode="ucs2" 4179 ;; 4180 esac 4181fi 4182 4183AH_TEMPLATE(Py_UNICODE_SIZE, 4184 [Define as the size of the unicode type.]) 4185case "$enable_unicode" in 4186ucs2) unicode_size="2" 4187 AC_DEFINE(Py_UNICODE_SIZE,2) 4188 ;; 4189ucs4) unicode_size="4" 4190 AC_DEFINE(Py_UNICODE_SIZE,4) 4191 ;; 4192no) ;; # To allow --disable-unicode 4193*) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;; 4194esac 4195 4196AH_TEMPLATE(PY_UNICODE_TYPE, 4197 [Define as the integral type used for Unicode representation.]) 4198 4199AC_SUBST(UNICODE_OBJS) 4200if test "$enable_unicode" = "no" 4201then 4202 UNICODE_OBJS="" 4203 AC_MSG_RESULT(not used) 4204else 4205 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o" 4206 AC_DEFINE(Py_USING_UNICODE, 1, 4207 [Define if you want to have a Unicode type.]) 4208 4209 # wchar_t is only usable if it maps to an unsigned type 4210 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \ 4211 -a "$ac_cv_wchar_t_signed" = "no" 4212 then 4213 PY_UNICODE_TYPE="wchar_t" 4214 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1, 4215 [Define if you have a useable wchar_t type defined in wchar.h; useable 4216 means wchar_t must be an unsigned type with at least 16 bits. (see 4217 Include/unicodeobject.h).]) 4218 AC_DEFINE(PY_UNICODE_TYPE,wchar_t) 4219 elif test "$ac_cv_sizeof_short" = "$unicode_size" 4220 then 4221 PY_UNICODE_TYPE="unsigned short" 4222 AC_DEFINE(PY_UNICODE_TYPE,unsigned short) 4223 elif test "$ac_cv_sizeof_long" = "$unicode_size" 4224 then 4225 PY_UNICODE_TYPE="unsigned long" 4226 AC_DEFINE(PY_UNICODE_TYPE,unsigned long) 4227 else 4228 PY_UNICODE_TYPE="no type found" 4229 fi 4230 AC_MSG_RESULT($PY_UNICODE_TYPE) 4231fi 4232 4233# check for endianness 4234AC_C_BIGENDIAN 4235 4236# Check whether right shifting a negative integer extends the sign bit 4237# or fills with zeros (like the Cray J90, according to Tim Peters). 4238AC_MSG_CHECKING(whether right shift extends the sign bit) 4239AC_CACHE_VAL(ac_cv_rshift_extends_sign, [ 4240AC_RUN_IFELSE([AC_LANG_SOURCE([[ 4241int main() 4242{ 4243 exit(((-1)>>3 == -1) ? 0 : 1); 4244} 4245]])], 4246[ac_cv_rshift_extends_sign=yes], 4247[ac_cv_rshift_extends_sign=no], 4248[ac_cv_rshift_extends_sign=yes])]) 4249AC_MSG_RESULT($ac_cv_rshift_extends_sign) 4250if test "$ac_cv_rshift_extends_sign" = no 4251then 4252 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1, 4253 [Define if i>>j for signed int i does not extend the sign bit 4254 when i < 0]) 4255fi 4256 4257# check for getc_unlocked and related locking functions 4258AC_MSG_CHECKING(for getc_unlocked() and friends) 4259AC_CACHE_VAL(ac_cv_have_getc_unlocked, [ 4260AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[ 4261 FILE *f = fopen("/dev/null", "r"); 4262 flockfile(f); 4263 getc_unlocked(f); 4264 funlockfile(f); 4265]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])]) 4266AC_MSG_RESULT($ac_cv_have_getc_unlocked) 4267if test "$ac_cv_have_getc_unlocked" = yes 4268then 4269 AC_DEFINE(HAVE_GETC_UNLOCKED, 1, 4270 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()]) 4271fi 4272 4273# check where readline lives 4274# save the value of LIBS so we don't actually link Python with readline 4275LIBS_no_readline=$LIBS 4276 4277# On some systems we need to link readline to a termcap compatible 4278# library. NOTE: Keep the precedence of listed libraries synchronised 4279# with setup.py. 4280py_cv_lib_readline=no 4281AC_MSG_CHECKING([how to link readline libs]) 4282for py_libtermcap in "" ncursesw ncurses curses termcap; do 4283 if test -z "$py_libtermcap"; then 4284 READLINE_LIBS="-lreadline" 4285 else 4286 READLINE_LIBS="-lreadline -l$py_libtermcap" 4287 fi 4288 LIBS="$READLINE_LIBS $LIBS_no_readline" 4289 AC_LINK_IFELSE( 4290 [AC_LANG_CALL([],[readline])], 4291 [py_cv_lib_readline=yes]) 4292 if test $py_cv_lib_readline = yes; then 4293 break 4294 fi 4295done 4296# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts 4297#AC_SUBST([READLINE_LIBS]) 4298if test $py_cv_lib_readline = no; then 4299 AC_MSG_RESULT([none]) 4300else 4301 AC_MSG_RESULT([$READLINE_LIBS]) 4302 AC_DEFINE(HAVE_LIBREADLINE, 1, 4303 [Define if you have the readline library (-lreadline).]) 4304fi 4305 4306# check for readline 2.1 4307AC_CHECK_LIB(readline, rl_callback_handler_install, 4308 AC_DEFINE(HAVE_RL_CALLBACK, 1, 4309 [Define if you have readline 2.1]), ,$READLINE_LIBS) 4310 4311# check for readline 2.2 4312AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])], 4313 [have_readline=yes], 4314 [have_readline=no] 4315) 4316if test $have_readline = yes 4317then 4318 AC_EGREP_HEADER([extern int rl_completion_append_character;], 4319 [readline/readline.h], 4320 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1, 4321 [Define if you have readline 2.2]), ) 4322 AC_EGREP_HEADER([extern int rl_completion_suppress_append;], 4323 [readline/readline.h], 4324 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1, 4325 [Define if you have rl_completion_suppress_append]), ) 4326fi 4327 4328# check for readline 4.0 4329AC_CHECK_LIB(readline, rl_pre_input_hook, 4330 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1, 4331 [Define if you have readline 4.0]), ,$READLINE_LIBS) 4332 4333# also in 4.0 4334AC_CHECK_LIB(readline, rl_completion_display_matches_hook, 4335 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1, 4336 [Define if you have readline 4.0]), ,$READLINE_LIBS) 4337 4338# also in 4.0, but not in editline 4339AC_CHECK_LIB(readline, rl_resize_terminal, 4340 AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1, 4341 [Define if you have readline 4.0]), ,$READLINE_LIBS) 4342 4343# check for readline 4.2 4344AC_CHECK_LIB(readline, rl_completion_matches, 4345 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, 4346 [Define if you have readline 4.2]), ,$READLINE_LIBS) 4347 4348# also in readline 4.2 4349AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])], 4350 [have_readline=yes], 4351 [have_readline=no] 4352) 4353if test $have_readline = yes 4354then 4355 AC_EGREP_HEADER([extern int rl_catch_signals;], 4356 [readline/readline.h], 4357 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1, 4358 [Define if you can turn off readline's signal handling.]), ) 4359fi 4360 4361# End of readline checks: restore LIBS 4362LIBS=$LIBS_no_readline 4363 4364AC_MSG_CHECKING(for broken nice()) 4365AC_CACHE_VAL(ac_cv_broken_nice, [ 4366AC_RUN_IFELSE([AC_LANG_SOURCE([[ 4367int main() 4368{ 4369 int val1 = nice(1); 4370 if (val1 != -1 && val1 == nice(2)) 4371 exit(0); 4372 exit(1); 4373} 4374]])], 4375[ac_cv_broken_nice=yes], 4376[ac_cv_broken_nice=no], 4377[ac_cv_broken_nice=no])]) 4378AC_MSG_RESULT($ac_cv_broken_nice) 4379if test "$ac_cv_broken_nice" = yes 4380then 4381 AC_DEFINE(HAVE_BROKEN_NICE, 1, 4382 [Define if nice() returns success/failure instead of the new priority.]) 4383fi 4384 4385AC_MSG_CHECKING(for broken poll()) 4386AC_CACHE_VAL(ac_cv_broken_poll, 4387AC_RUN_IFELSE([AC_LANG_SOURCE([[ 4388#include <poll.h> 4389 4390int main() 4391{ 4392 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 }; 4393 int poll_test; 4394 4395 close (42); 4396 4397 poll_test = poll(&poll_struct, 1, 0); 4398 if (poll_test < 0) 4399 return 0; 4400 else if (poll_test == 0 && poll_struct.revents != POLLNVAL) 4401 return 0; 4402 else 4403 return 1; 4404} 4405]])], 4406[ac_cv_broken_poll=yes], 4407[ac_cv_broken_poll=no], 4408[ac_cv_broken_poll=no])) 4409AC_MSG_RESULT($ac_cv_broken_poll) 4410if test "$ac_cv_broken_poll" = yes 4411then 4412 AC_DEFINE(HAVE_BROKEN_POLL, 1, 4413 [Define if poll() sets errno on invalid file descriptors.]) 4414fi 4415 4416# Before we can test tzset, we need to check if struct tm has a tm_zone 4417# (which is not required by ISO C or UNIX spec) and/or if we support 4418# tzname[] 4419AC_STRUCT_TIMEZONE 4420 4421# check tzset(3) exists and works like we expect it to 4422AC_MSG_CHECKING(for working tzset()) 4423AC_CACHE_VAL(ac_cv_working_tzset, [ 4424AC_RUN_IFELSE([AC_LANG_SOURCE([[ 4425#include <stdlib.h> 4426#include <time.h> 4427#include <string.h> 4428 4429#if HAVE_TZNAME 4430extern char *tzname[]; 4431#endif 4432 4433int main() 4434{ 4435 /* Note that we need to ensure that not only does tzset(3) 4436 do 'something' with localtime, but it works as documented 4437 in the library reference and as expected by the test suite. 4438 This includes making sure that tzname is set properly if 4439 tm->tm_zone does not exist since it is the alternative way 4440 of getting timezone info. 4441 4442 Red Hat 6.2 doesn't understand the southern hemisphere 4443 after New Year's Day. 4444 */ 4445 4446 time_t groundhogday = 1044144000; /* GMT-based */ 4447 time_t midyear = groundhogday + (365 * 24 * 3600 / 2); 4448 4449 putenv("TZ=UTC+0"); 4450 tzset(); 4451 if (localtime(&groundhogday)->tm_hour != 0) 4452 exit(1); 4453#if HAVE_TZNAME 4454 /* For UTC, tzname[1] is sometimes "", sometimes " " */ 4455 if (strcmp(tzname[0], "UTC") || 4456 (tzname[1][0] != 0 && tzname[1][0] != ' ')) 4457 exit(1); 4458#endif 4459 4460 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0"); 4461 tzset(); 4462 if (localtime(&groundhogday)->tm_hour != 19) 4463 exit(1); 4464#if HAVE_TZNAME 4465 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT")) 4466 exit(1); 4467#endif 4468 4469 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0"); 4470 tzset(); 4471 if (localtime(&groundhogday)->tm_hour != 11) 4472 exit(1); 4473#if HAVE_TZNAME 4474 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT")) 4475 exit(1); 4476#endif 4477 4478#if HAVE_STRUCT_TM_TM_ZONE 4479 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT")) 4480 exit(1); 4481 if (strcmp(localtime(&midyear)->tm_zone, "AEST")) 4482 exit(1); 4483#endif 4484 4485 exit(0); 4486} 4487]])], 4488[ac_cv_working_tzset=yes], 4489[ac_cv_working_tzset=no], 4490[ac_cv_working_tzset=no])]) 4491AC_MSG_RESULT($ac_cv_working_tzset) 4492if test "$ac_cv_working_tzset" = yes 4493then 4494 AC_DEFINE(HAVE_WORKING_TZSET, 1, 4495 [Define if tzset() actually switches the local timezone in a meaningful way.]) 4496fi 4497 4498# Look for subsecond timestamps in struct stat 4499AC_MSG_CHECKING(for tv_nsec in struct stat) 4500AC_CACHE_VAL(ac_cv_stat_tv_nsec, 4501AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[ 4502struct stat st; 4503st.st_mtim.tv_nsec = 1; 4504]])], 4505[ac_cv_stat_tv_nsec=yes], 4506[ac_cv_stat_tv_nsec=no])) 4507AC_MSG_RESULT($ac_cv_stat_tv_nsec) 4508if test "$ac_cv_stat_tv_nsec" = yes 4509then 4510 AC_DEFINE(HAVE_STAT_TV_NSEC, 1, 4511 [Define if you have struct stat.st_mtim.tv_nsec]) 4512fi 4513 4514# Look for BSD style subsecond timestamps in struct stat 4515AC_MSG_CHECKING(for tv_nsec2 in struct stat) 4516AC_CACHE_VAL(ac_cv_stat_tv_nsec2, 4517AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[ 4518struct stat st; 4519st.st_mtimespec.tv_nsec = 1; 4520]])], 4521[ac_cv_stat_tv_nsec2=yes], 4522[ac_cv_stat_tv_nsec2=no])) 4523AC_MSG_RESULT($ac_cv_stat_tv_nsec2) 4524if test "$ac_cv_stat_tv_nsec2" = yes 4525then 4526 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1, 4527 [Define if you have struct stat.st_mtimensec]) 4528fi 4529 4530# first curses configure check 4531ac_save_cppflags="$CPPFLAGS" 4532CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" 4533 4534AC_CHECK_HEADERS(curses.h ncurses.h) 4535 4536# On Solaris, term.h requires curses.h 4537AC_CHECK_HEADERS(term.h,,,[ 4538#ifdef HAVE_CURSES_H 4539#include <curses.h> 4540#endif 4541]) 4542 4543# On HP/UX 11.0, mvwdelch is a block with a return statement 4544AC_MSG_CHECKING(whether mvwdelch is an expression) 4545AC_CACHE_VAL(ac_cv_mvwdelch_is_expression, 4546AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ 4547 int rtn; 4548 rtn = mvwdelch(0,0,0); 4549]])], 4550[ac_cv_mvwdelch_is_expression=yes], 4551[ac_cv_mvwdelch_is_expression=no])) 4552AC_MSG_RESULT($ac_cv_mvwdelch_is_expression) 4553 4554if test "$ac_cv_mvwdelch_is_expression" = yes 4555then 4556 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1, 4557 [Define if mvwdelch in curses.h is an expression.]) 4558fi 4559 4560# Issue #25720: ncurses has introduced the NCURSES_OPAQUE symbol making opaque 4561# structs since version 5.7. If the macro is defined as zero before including 4562# [n]curses.h, ncurses will expose fields of the structs regardless of the 4563# configuration. 4564AC_MSG_CHECKING(whether WINDOW has _flags) 4565AC_CACHE_VAL(ac_cv_window_has_flags, 4566AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 4567 #define NCURSES_OPAQUE 0 4568 #include <curses.h> 4569]], [[ 4570 WINDOW *w; 4571 w->_flags = 0; 4572]])], 4573[ac_cv_window_has_flags=yes], 4574[ac_cv_window_has_flags=no])) 4575AC_MSG_RESULT($ac_cv_window_has_flags) 4576 4577 4578if test "$ac_cv_window_has_flags" = yes 4579then 4580 AC_DEFINE(WINDOW_HAS_FLAGS, 1, 4581 [Define if WINDOW in curses.h offers a field _flags.]) 4582fi 4583 4584AC_MSG_CHECKING(for is_pad) 4585AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ 4586#ifndef is_pad 4587void *x=is_pad 4588#endif 4589]])], 4590 [AC_DEFINE(HAVE_CURSES_IS_PAD, 1, Define if you have the 'is_pad' function or macro.) 4591 AC_MSG_RESULT(yes)], 4592 [AC_MSG_RESULT(no)] 4593) 4594 4595AC_MSG_CHECKING(for is_term_resized) 4596AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])], 4597 [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.) 4598 AC_MSG_RESULT(yes)], 4599 [AC_MSG_RESULT(no)] 4600) 4601 4602AC_MSG_CHECKING(for resize_term) 4603AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])], 4604 [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.) 4605 AC_MSG_RESULT(yes)], 4606 [AC_MSG_RESULT(no)] 4607) 4608 4609AC_MSG_CHECKING(for resizeterm) 4610AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])], 4611 [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.) 4612 AC_MSG_RESULT(yes)], 4613 [AC_MSG_RESULT(no)] 4614) 4615 4616AC_MSG_CHECKING(for immedok) 4617AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ 4618#ifndef immedok 4619void *x=immedok 4620#endif 4621]])], 4622 [AC_DEFINE(HAVE_CURSES_IMMEDOK, 1, Define if you have the 'immedok' function.) 4623 AC_MSG_RESULT(yes)], 4624 [AC_MSG_RESULT(no)] 4625) 4626 4627AC_MSG_CHECKING(for syncok) 4628AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ 4629#ifndef syncok 4630void *x=syncok 4631#endif 4632]])], 4633 [AC_DEFINE(HAVE_CURSES_SYNCOK, 1, Define if you have the 'syncok' function.) 4634 AC_MSG_RESULT(yes)], 4635 [AC_MSG_RESULT(no)] 4636) 4637 4638AC_MSG_CHECKING(for wchgat) 4639AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ 4640#ifndef wchgat 4641void *x=wchgat 4642#endif 4643]])], 4644 [AC_DEFINE(HAVE_CURSES_WCHGAT, 1, Define if you have the 'wchgat' function.) 4645 AC_MSG_RESULT(yes)], 4646 [AC_MSG_RESULT(no)] 4647) 4648 4649AC_MSG_CHECKING(for filter) 4650AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ 4651#ifndef filter 4652void *x=filter 4653#endif 4654]])], 4655 [AC_DEFINE(HAVE_CURSES_FILTER, 1, Define if you have the 'filter' function.) 4656 AC_MSG_RESULT(yes)], 4657 [AC_MSG_RESULT(no)] 4658) 4659 4660AC_MSG_CHECKING(for has_key) 4661AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ 4662#ifndef has_key 4663void *x=has_key 4664#endif 4665]])], 4666 [AC_DEFINE(HAVE_CURSES_HAS_KEY, 1, Define if you have the 'has_key' function.) 4667 AC_MSG_RESULT(yes)], 4668 [AC_MSG_RESULT(no)] 4669) 4670 4671AC_MSG_CHECKING(for typeahead) 4672AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ 4673#ifndef typeahead 4674void *x=typeahead 4675#endif 4676]])], 4677 [AC_DEFINE(HAVE_CURSES_TYPEAHEAD, 1, Define if you have the 'typeahead' function.) 4678 AC_MSG_RESULT(yes)], 4679 [AC_MSG_RESULT(no)] 4680) 4681 4682AC_MSG_CHECKING(for use_env) 4683AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[ 4684#ifndef use_env 4685void *x=use_env 4686#endif 4687]])], 4688 [AC_DEFINE(HAVE_CURSES_USE_ENV, 1, Define if you have the 'use_env' function.) 4689 AC_MSG_RESULT(yes)], 4690 [AC_MSG_RESULT(no)] 4691) 4692# last curses configure check 4693CPPFLAGS=$ac_save_cppflags 4694 4695AC_MSG_NOTICE([checking for device files]) 4696 4697dnl NOTE: Inform user how to proceed with files when cross compiling. 4698if test "x$cross_compiling" = xyes; then 4699 if test "${ac_cv_file__dev_ptmx+set}" != set; then 4700 AC_MSG_CHECKING([for /dev/ptmx]) 4701 AC_MSG_RESULT([not set]) 4702 AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling]) 4703 fi 4704 if test "${ac_cv_file__dev_ptc+set}" != set; then 4705 AC_MSG_CHECKING([for /dev/ptc]) 4706 AC_MSG_RESULT([not set]) 4707 AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling]) 4708 fi 4709fi 4710 4711AC_CHECK_FILE(/dev/ptmx, [], []) 4712if test "x$ac_cv_file__dev_ptmx" = xyes; then 4713 AC_DEFINE(HAVE_DEV_PTMX, 1, 4714 [Define to 1 if you have the /dev/ptmx device file.]) 4715fi 4716AC_CHECK_FILE(/dev/ptc, [], []) 4717if test "x$ac_cv_file__dev_ptc" = xyes; then 4718 AC_DEFINE(HAVE_DEV_PTC, 1, 4719 [Define to 1 if you have the /dev/ptc device file.]) 4720fi 4721 4722if test "$have_long_long" = yes 4723then 4724 AC_MSG_CHECKING(for %lld and %llu printf() format support) 4725 AC_CACHE_VAL(ac_cv_have_long_long_format, 4726 AC_RUN_IFELSE([AC_LANG_SOURCE([[[ 4727 #include <stdio.h> 4728 #include <stddef.h> 4729 #include <string.h> 4730 4731 #ifdef HAVE_SYS_TYPES_H 4732 #include <sys/types.h> 4733 #endif 4734 4735 int main() 4736 { 4737 char buffer[256]; 4738 4739 if (sprintf(buffer, "%lld", (long long)123) < 0) 4740 return 1; 4741 if (strcmp(buffer, "123")) 4742 return 1; 4743 4744 if (sprintf(buffer, "%lld", (long long)-123) < 0) 4745 return 1; 4746 if (strcmp(buffer, "-123")) 4747 return 1; 4748 4749 if (sprintf(buffer, "%llu", (unsigned long long)123) < 0) 4750 return 1; 4751 if (strcmp(buffer, "123")) 4752 return 1; 4753 4754 return 0; 4755 } 4756 ]]])], 4757 [ac_cv_have_long_long_format=yes], 4758 [ac_cv_have_long_long_format=no], 4759 [ac_cv_have_long_long_format="cross -- assuming no" 4760 if test x$GCC = xyes; then 4761 save_CFLAGS=$CFLAGS 4762 CFLAGS="$CFLAGS -Werror -Wformat" 4763 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 4764 #include <stdio.h> 4765 #include <stddef.h> 4766 ]], [[ 4767 char *buffer; 4768 sprintf(buffer, "%lld", (long long)123); 4769 sprintf(buffer, "%lld", (long long)-123); 4770 sprintf(buffer, "%llu", (unsigned long long)123); 4771 ]])], 4772 ac_cv_have_long_long_format=yes 4773 ) 4774 CFLAGS=$save_CFLAGS 4775 fi]) 4776 ) 4777 AC_MSG_RESULT($ac_cv_have_long_long_format) 4778fi 4779 4780if test "$ac_cv_have_long_long_format" = yes 4781then 4782 AC_DEFINE(PY_FORMAT_LONG_LONG, "ll", 4783 [Define to printf format modifier for long long type]) 4784fi 4785 4786if test $ac_sys_system = Darwin 4787then 4788 LIBS="$LIBS -framework CoreFoundation" 4789fi 4790 4791 4792AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl 4793AC_RUN_IFELSE([AC_LANG_SOURCE([[ 4794#include <stdio.h> 4795#include <stddef.h> 4796#include <string.h> 4797 4798#ifdef HAVE_SYS_TYPES_H 4799#include <sys/types.h> 4800#endif 4801 4802#ifdef HAVE_SSIZE_T 4803typedef ssize_t Py_ssize_t; 4804#elif SIZEOF_VOID_P == SIZEOF_LONG 4805typedef long Py_ssize_t; 4806#else 4807typedef int Py_ssize_t; 4808#endif 4809 4810int main() 4811{ 4812 char buffer[256]; 4813 4814 if(sprintf(buffer, "%zd", (size_t)123) < 0) 4815 return 1; 4816 4817 if (strcmp(buffer, "123")) 4818 return 1; 4819 4820 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0) 4821 return 1; 4822 4823 if (strcmp(buffer, "-123")) 4824 return 1; 4825 4826 return 0; 4827} 4828]])], 4829[ac_cv_have_size_t_format=yes], 4830[ac_cv_have_size_t_format=no], 4831[ac_cv_have_size_t_format="cross -- assuming yes" 4832])]) 4833if test "$ac_cv_have_size_t_format" != no ; then 4834 AC_DEFINE(PY_FORMAT_SIZE_T, "z", 4835 [Define to printf format modifier for Py_ssize_t]) 4836fi 4837 4838AC_CHECK_TYPE(socklen_t,, 4839 AC_DEFINE(socklen_t,int, 4840 [Define to `int' if <sys/socket.h> does not define.]),[ 4841#ifdef HAVE_SYS_TYPES_H 4842#include <sys/types.h> 4843#endif 4844#ifdef HAVE_SYS_SOCKET_H 4845#include <sys/socket.h> 4846#endif 4847]) 4848 4849case $ac_sys_system in 4850AIX*) 4851 AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;; 4852esac 4853 4854 4855AC_SUBST(THREADHEADERS) 4856 4857for h in `(cd $srcdir;echo Python/thread_*.h)` 4858do 4859 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h" 4860done 4861 4862AC_SUBST(SRCDIRS) 4863SRCDIRS="Parser Objects Python Modules" 4864AC_MSG_CHECKING(for build directories) 4865for dir in $SRCDIRS; do 4866 if test ! -d $dir; then 4867 mkdir $dir 4868 fi 4869done 4870 4871# BEGIN_COMPUTED_GOTO 4872# Check for --with-computed-gotos 4873AC_MSG_CHECKING(for --with-computed-gotos) 4874AC_ARG_WITH(computed-gotos, 4875 AS_HELP_STRING([--with(out)-computed-gotos], 4876 [Use computed gotos in evaluation loop (enabled by default on supported compilers)]), 4877[ 4878if test "$withval" = yes 4879then 4880 AC_DEFINE(USE_COMPUTED_GOTOS, 1, 4881 [Define if you want to use computed gotos in ceval.c.]) 4882 AC_MSG_RESULT(yes) 4883fi 4884if test "$withval" = no 4885then 4886 AC_DEFINE(USE_COMPUTED_GOTOS, 0, 4887 [Define if you want to use computed gotos in ceval.c.]) 4888 AC_MSG_RESULT(no) 4889fi 4890], 4891[AC_MSG_RESULT(no value specified)]) 4892 4893AC_MSG_CHECKING(whether $CC supports computed gotos) 4894AC_CACHE_VAL(ac_cv_computed_gotos, 4895AC_RUN_IFELSE([AC_LANG_SOURCE([[[ 4896int main(int argc, char **argv) 4897{ 4898 static void *targets[1] = { &&LABEL1 }; 4899 goto LABEL2; 4900LABEL1: 4901 return 0; 4902LABEL2: 4903 goto *targets[0]; 4904 return 1; 4905} 4906]]])], 4907[ac_cv_computed_gotos=yes], 4908[ac_cv_computed_gotos=no], 4909[if test "${with_computed_gotos+set}" = set; then 4910 ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos" 4911 else 4912 ac_cv_computed_gotos=no 4913 fi])) 4914AC_MSG_RESULT($ac_cv_computed_gotos) 4915case "$ac_cv_computed_gotos" in yes*) 4916 AC_DEFINE(HAVE_COMPUTED_GOTOS, 1, 4917 [Define if the C compiler supports computed gotos.]) 4918esac 4919# END_COMPUTED_GOTO 4920 4921AC_MSG_RESULT(done) 4922 4923# ensurepip option 4924AC_MSG_CHECKING(for ensurepip) 4925AC_ARG_WITH(ensurepip, 4926 [AS_HELP_STRING([--with(out)-ensurepip=@<:@=OPTION@:>@], 4927 ["install" or "upgrade" using bundled pip, default is "no"])], 4928 [], 4929 [with_ensurepip=no]) 4930AS_CASE($with_ensurepip, 4931 [yes|upgrade],[ENSUREPIP=upgrade], 4932 [install],[ENSUREPIP=install], 4933 [no],[ENSUREPIP=no], 4934 [AC_MSG_ERROR([--with-ensurepip=upgrade|install|no])]) 4935AC_MSG_RESULT($ENSUREPIP) 4936AC_SUBST(ENSUREPIP) 4937 4938# generate output files 4939AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc) 4940AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix]) 4941AC_OUTPUT 4942 4943echo "creating Modules/Setup" 4944if test ! -f Modules/Setup 4945then 4946 cp $srcdir/Modules/Setup.dist Modules/Setup 4947fi 4948 4949echo "creating Modules/Setup.local" 4950if test ! -f Modules/Setup.local 4951then 4952 echo "# Edit this file for local setup changes" >Modules/Setup.local 4953fi 4954 4955echo "creating Makefile" 4956$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ 4957 -s Modules Modules/Setup.config \ 4958 Modules/Setup.local Modules/Setup 4959 4960case $ac_sys_system in 4961BeOS) 4962 AC_MSG_WARN([ 4963 4964 Support for BeOS is deprecated as of Python 2.6. 4965 See PEP 11 for the gory details. 4966 ]) 4967 ;; 4968*) ;; 4969esac 4970 4971mv config.c Modules 4972 4973if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then 4974 echo "" >&AS_MESSAGE_FD 4975 echo "" >&AS_MESSAGE_FD 4976 echo "If you want a release build with all optimizations active (LTO, PGO, etc)," 4977 echo "please run ./configure --enable-optimizations" >&AS_MESSAGE_FD 4978 echo "" >&AS_MESSAGE_FD 4979 echo "" >&AS_MESSAGE_FD 4980fi 4981