1 dnl Process this file with autoconf 2.0 or later to make a configure script.
3 # Set VERSION so we only need to edit in one place (i.e., here)
4 m4_define(PYTHON_VERSION, 2.5)
6 AC_REVISION($Revision$)
8 AC_INIT(python, PYTHON_VERSION, http://www.python.org/python-bugs)
9 AC_CONFIG_SRCDIR([Include/object.h])
10 AC_CONFIG_HEADER(pyconfig.h)
12 dnl This is for stuff that absolutely must end up in pyconfig.h.
13 dnl Please use pyport.h instead, if possible.
19 /* Define the macros needed if on a UnixWare 7.x system. */
20 #if defined(__USLC__) && defined(__SCO_VERSION__)
21 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
24 #endif /*Py_PYCONFIG_H*/
27 # We don't use PACKAGE_ variables, and they cause conflicts
28 # with other autoconf-based packages that include Python.h
29 grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
31 mv confdefs.h.new confdefs.h
34 VERSION=PYTHON_VERSION
39 # The later defininition of _XOPEN_SOURCE disables certain features
40 # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
41 AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
43 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
44 # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
46 AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
48 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
49 # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
51 AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
53 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
54 # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
55 AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
57 define_xopen_source=yes
59 # Arguments passed to configure.
61 CONFIG_ARGS="$ac_configure_args"
63 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
64 AC_ARG_ENABLE(framework,
65 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
69 enableval=/Library/Frameworks
74 PYTHONFRAMEWORKDIR=no-framework
75 PYTHONFRAMEWORKPREFIX=
76 PYTHONFRAMEWORKINSTALLDIR=
80 PYTHONFRAMEWORK=Python
81 PYTHONFRAMEWORKDIR=Python.framework
82 PYTHONFRAMEWORKPREFIX=$enableval
83 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
84 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
88 PYTHONFRAMEWORKDIR=no-framework
89 PYTHONFRAMEWORKPREFIX=
90 PYTHONFRAMEWORKINSTALLDIR=
93 AC_SUBST(PYTHONFRAMEWORK)
94 AC_SUBST(PYTHONFRAMEWORKDIR)
95 AC_SUBST(PYTHONFRAMEWORKPREFIX)
96 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
99 ## AC_HELP_STRING(--with-dyld,
100 ## Use (OpenStep|Rhapsody) dynamic linker))
102 # Set name for machine-dependent library files
104 AC_MSG_CHECKING(MACHDEP)
105 if test -z "$MACHDEP"
107 ac_sys_system=`uname -s`
108 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
109 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
110 ac_sys_release=`uname -v`
112 ac_sys_release=`uname -r`
114 ac_md_system=`echo $ac_sys_system |
115 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
116 ac_md_release=`echo $ac_sys_release |
117 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
118 MACHDEP="$ac_md_system$ac_md_release"
121 cygwin*) MACHDEP="cygwin";;
122 darwin*) MACHDEP="darwin";;
123 atheos*) MACHDEP="atheos";;
124 irix646) MACHDEP="irix6";;
125 '') MACHDEP="unknown";;
129 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
130 # disable features if it is defined, without any means to access these
131 # features as extensions. For these systems, we skip the definition of
132 # _XOPEN_SOURCE. Before adding a system to the list to gain access to
133 # some feature, make sure there is no alternative way to access this
134 # feature. Also, when using wildcards, make sure you have verified the
135 # need for not defining _XOPEN_SOURCE on all systems matching the
136 # wildcard, and that the wildcard does not include future systems
137 # (which may remove their limitations).
138 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
139 case $ac_sys_system/$ac_sys_release in
140 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
141 # even though select is a POSIX function. Reported by J. Ribbens.
142 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
143 OpenBSD/2.* | OpenBSD/3.@<:@012345678@:>@)
144 define_xopen_source=no;;
145 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
146 # of union __?sigval. Reported by Stuart Bishop.
148 define_xopen_source=no;;
149 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
150 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
151 # Reconfirmed for 7.1.4 by Martin v. Loewis.
152 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
153 define_xopen_source=no;;
154 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
155 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
157 define_xopen_source=no;;
158 # On FreeBSD 4.8 and MacOS X 10.2, a bug in ncurses.h means that
159 # it craps out if _XOPEN_EXTENDED_SOURCE is defined. Apparently,
160 # this is fixed in 10.3, which identifies itself as Darwin/7.*
161 # This should hopefully be fixed in FreeBSD 4.9
162 FreeBSD/4.8* | Darwin/6* )
163 define_xopen_source=no;;
164 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
165 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
166 # or has another value. By not (re)defining it, the defaults come in place.
168 define_xopen_source=no;;
170 if test `uname -r` -eq 1; then
171 define_xopen_source=no
174 # XXX(nnorwitz): the 2 cases below should be Darwin/[78].*,
175 # but autoconf seems to convert that to Darwin/78.* which is incorrect.
176 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
177 # has no effect, don't bother defining them.
179 define_xopen_source=no
181 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
182 # disables platform specific features beyond repair.
184 define_xopen_source=no
188 if test $define_xopen_source = yes
190 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
191 # defined precisely as g++ defines it
192 # Furthermore, on Solaris 10, XPG6 requires the use of a C99
194 case $ac_sys_system/$ac_sys_release in
195 SunOS/5.8|SunOS/5.9|SunOS/5.10)
196 AC_DEFINE(_XOPEN_SOURCE, 500,
197 Define to the level of X/Open that your system supports)
200 AC_DEFINE(_XOPEN_SOURCE, 600,
201 Define to the level of X/Open that your system supports)
205 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
206 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
207 # several APIs are not declared. Since this is also needed in some
208 # cases for HP-UX, we define it globally.
209 # except for Solaris 10, where it must not be defined,
210 # as it implies XPG4.2
211 case $ac_sys_system/$ac_sys_release in
215 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
216 Define to activate Unix95-and-earlier features)
220 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
225 # SGI compilers allow the specification of the both the ABI and the
226 # ISA on the command line. Depending on the values of these switches,
227 # different and often incompatable code will be generated.
229 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
230 # thus supply support for various ABI/ISA combinations. The MACHDEP
231 # variable is also adjusted.
234 if test ! -z "$SGI_ABI"
237 LDFLAGS="$SGI_ABI $LDFLAGS"
238 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
240 AC_MSG_RESULT($MACHDEP)
242 # And add extra plat-mac for darwin
243 AC_SUBST(EXTRAPLATDIR)
244 AC_SUBST(EXTRAMACHDEPPATH)
245 AC_MSG_CHECKING(EXTRAPLATDIR)
246 if test -z "$EXTRAPLATDIR"
250 EXTRAPLATDIR="\$(PLATMACDIRS)"
251 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
259 AC_MSG_RESULT($EXTRAPLATDIR)
261 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
262 # it may influence the way we can build extensions, so distutils
264 AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
265 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
267 # checks for alternative programs
269 # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
270 # for debug/optimization stuff. BASECFLAGS is for flags that are required
271 # just to get things to compile and link. Users are free to override OPT
272 # when running configure or make. The build should not break if they do.
273 # BASECFLAGS should generally not be messed with, however.
275 # XXX shouldn't some/most/all of this code be merged with the stuff later
276 # on that fiddles with OPT and BASECFLAGS?
277 AC_MSG_CHECKING(for --without-gcc)
279 AC_HELP_STRING(--without-gcc,never use gcc),
287 without_gcc=$withval;;
289 case $ac_sys_system in
297 BASECFLAGS="$BASECFLAGS -export pragma"
299 LDFLAGS="$LDFLAGS -nodup"
307 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
310 AR="\$(srcdir)/Modules/ar_beos"
318 AC_MSG_RESULT($without_gcc)
323 AC_MSG_CHECKING(for --with-cxx=<compiler>)
325 AC_HELP_STRING(--with-cxx=<compiler>, enable C++ support),
338 AC_MSG_RESULT($with_cxx)
340 if test "$with_cxx" = "yes"
342 AC_MSG_ERROR([must supply a compiler when using --with-cxx])
345 dnl The following fragment works similar to AC_PROG_CXX.
346 dnl It does not fail if CXX is not found, and it is not executed if
347 dnl --without-cxx was given.
348 dnl Finally, it does not test whether CXX is g++.
350 dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
351 ifdef([AC_PROG_CXX_WORKS],[],
352 [AC_DEFUN([AC_PROG_CXX_WORKS],
353 [AC_LANG_PUSH(C++)dnl
359 if test "$check_cxx" = "yes"
361 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
362 if test "$CXX" = "notfound"
370 # If the user switches compilers, we can't believe the cache
371 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
373 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
374 (it is also a good idea to do 'make clean' before compiling)])
379 # checks for UNIX variants that set C preprocessor variables
382 # Check for unsupported systems
383 case $ac_sys_system/$ac_sys_release in
385 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
386 echo See README for details.
391 AC_MSG_CHECKING(for --with-suffix)
393 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
400 AC_MSG_RESULT($EXEEXT)
402 # Test whether we're running on a non-case-sensitive system, in which
403 # case we give a warning if no ext is given
404 AC_SUBST(BUILDEXEEXT)
405 AC_MSG_CHECKING(for case-insensitive build directory)
406 if test ! -d CaseSensitiveTestDir; then
407 mkdir CaseSensitiveTestDir
410 if test -d casesensitivetestdir
418 rmdir CaseSensitiveTestDir
423 gcc) CC="$CC -D_HAVE_BSDI";;
427 case $ac_sys_system in
430 cc|*/cc) CC="$CC -Ae";;
434 cc) CC="$CC -Wl,-Bexport";;
437 # Some functions have a prototype only with that define, e.g. confstr
438 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
444 AC_MSG_CHECKING(LIBRARY)
445 if test -z "$LIBRARY"
447 LIBRARY='libpython$(VERSION).a'
449 AC_MSG_RESULT($LIBRARY)
451 # LDLIBRARY is the name of the library to link against (as opposed to the
452 # name of the library into which to insert object files). BLDLIBRARY is also
453 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
454 # is blank as the main program is not linked directly against LDLIBRARY.
455 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
456 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
457 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
458 # DLLLIBRARY is the shared (i.e., DLL) library.
460 # RUNSHARED is used to run shared python without installed libraries
462 # INSTSONAME is the name of the shared library that will be use to install
463 # on the system - some systems like version suffix, others don't
467 AC_SUBST(LDLIBRARYDIR)
471 BLDLIBRARY='$(LDLIBRARY)'
472 INSTSONAME='$(LDLIBRARY)'
477 # LINKCC is the command that links the python executable -- default is $(CC).
478 # If CXX is set, and if it is needed to link a main function that was
479 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
480 # python might then depend on the C++ runtime
481 # This is altered for AIX in order to build the export list before
484 AC_MSG_CHECKING(LINKCC)
487 if test -z "$CXX"; then
488 LINKCC="\$(PURIFY) \$(CC)"
490 echo 'extern "C" void foo();int main(){foo();}' > conftest_a.cc
491 $CXX -c conftest_a.cc # 2>&5
492 echo 'void foo(){}' > conftest_b.$ac_ext
493 $CC -c conftest_b.$ac_ext # 2>&5
494 if $CC -o conftest$ac_exeext conftest_a.$ac_objext conftest_b.$ac_objext 2>&5 \
495 && test -s conftest$ac_exeext && ./conftest$ac_exeext
497 LINKCC="\$(PURIFY) \$(CC)"
499 LINKCC="\$(PURIFY) \$(CXX)"
503 case $ac_sys_system in
506 if test $ac_sys_release -ge 5 -o \
507 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
510 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
512 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
515 AC_MSG_RESULT($LINKCC)
517 AC_MSG_CHECKING(for --enable-shared)
518 AC_ARG_ENABLE(shared,
519 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
521 if test -z "$enable_shared"
523 case $ac_sys_system in
525 enable_shared="yes";;
530 AC_MSG_RESULT($enable_shared)
532 AC_MSG_CHECKING(for --enable-profiling)
533 AC_ARG_ENABLE(profiling,
534 AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
537 AC_TRY_RUN([int main() { return 0; }],
538 ac_enable_profiling="yes",
539 ac_enable_profiling="no",
540 ac_enable_profiling="no")
542 AC_MSG_RESULT($ac_enable_profiling)
544 case "$ac_enable_profiling" in
546 BASECFLAGS="-pg $BASECFLAGS"
547 LDFLAGS="-pg $LDFLAGS"
551 AC_MSG_CHECKING(LDLIBRARY)
553 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
554 # library that we build, but we do not want to link against it (we
555 # will find it with a -framework option). For this reason there is an
556 # extra variable BLDLIBRARY against which Python and the extension
557 # modules are linked, BLDLIBRARY. This is normally the same as
558 # LDLIBRARY, but empty for MacOSX framework builds.
559 if test "$enable_framework"
561 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
562 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
565 BLDLIBRARY='$(LDLIBRARY)'
568 # Other platforms follow
569 if test $enable_shared = "yes"; then
570 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
571 case $ac_sys_system in
573 LDLIBRARY='libpython$(VERSION).so'
576 LDLIBRARY='libpython$(VERSION).dll.a'
577 DLLLIBRARY='libpython$(VERSION).dll'
580 LDLIBRARY='libpython$(VERSION).so'
581 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
582 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
583 INSTSONAME="$LDLIBRARY".$SOVERSION
585 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
586 LDLIBRARY='libpython$(VERSION).so'
587 BLDLIBRARY='-L. -lpython$(VERSION)'
588 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
589 case $ac_sys_system in
591 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
594 INSTSONAME="$LDLIBRARY".$SOVERSION
597 LDLIBRARY='libpython$(VERSION).sl'
598 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
599 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
602 LDLIBRARY='libpython$(VERSION).so'
603 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
604 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
607 LDLIBRARY='libpython$(VERSION).so'
608 BLDLIBRARY='-L. -lpython$(VERSION)'
609 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
612 else # shared is disabled
613 case $ac_sys_system in
615 BLDLIBRARY='$(LIBRARY)'
616 LDLIBRARY='libpython$(VERSION).dll.a'
621 AC_MSG_RESULT($LDLIBRARY)
625 AC_CHECK_PROGS(AR, ar aal, ar)
628 AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
629 if test $SVNVERSION = found
631 SVNVERSION="svnversion \$(srcdir)"
633 SVNVERSION="echo exported"
638 # install -d does not work on BSDI or HP-UX
639 if test -z "$INSTALL"
641 INSTALL="${srcdir}/install-sh -c"
646 # Not every filesystem supports hard links
648 if test -z "$LN" ; then
649 case $ac_sys_system in
651 CYGWIN*) LN="ln -s";;
652 atheos*) LN="ln -s";;
657 # Check for --with-pydebug
658 AC_MSG_CHECKING(for --with-pydebug)
660 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
662 if test "$withval" != no
664 AC_DEFINE(Py_DEBUG, 1,
665 [Define if you want to build an interpreter with many run-time checks.])
668 else AC_MSG_RESULT(no); Py_DEBUG='false'
672 # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
673 # merged with this chunk of code?
675 # Optimizer/debugger flags
676 # ------------------------
677 # (The following bit of code is complicated enough - please keep things
678 # indented properly. Just pretend you're editing Python code. ;-)
680 # There are two parallel sets of case statements below, one that checks to
681 # see if OPT was set and one that does BASECFLAGS setting based upon
682 # compiler and platform. BASECFLAGS tweaks need to be made even if the
685 # tweak OPT based on compiler and platform, only if the user didn't set
686 # it on the command line
692 case $ac_cv_prog_cc_g in
694 if test "$Py_DEBUG" = 'true' ; then
695 # Optimization messes up debuggers, so turn it off for
697 OPT="-g -Wall -Wstrict-prototypes"
699 OPT="-g -O3 -Wall -Wstrict-prototypes"
703 OPT="-O3 -Wall -Wstrict-prototypes"
706 case $ac_sys_system in
707 SCO_SV*) OPT="$OPT -m486 -DSCO5"
717 # The current (beta) Monterey compiler dies with optimizations
718 # XXX what is Monterey? Does it still die w/ -O? Can we get rid of this?
719 case $ac_sys_system in
728 # tweak BASECFLAGS based on compiler and platform
731 # Python violates C99 rules, by casting between incompatible
732 # pointer types. GCC may generate bad code as a result of that,
733 # so use -fno-strict-aliasing if supported.
734 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
736 CC="$CC -fno-strict-aliasing"
737 AC_TRY_RUN([int main() { return 0; }],
738 ac_cv_no_strict_aliasing_ok=yes,
739 ac_cv_no_strict_aliasing_ok=no,
740 ac_cv_no_strict_aliasing_ok=no)
742 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
743 if test $ac_cv_no_strict_aliasing_ok = yes
745 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
747 case $ac_sys_system in
749 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
751 # is there any other compiler on Darwin besides gcc?
753 BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
756 BASECFLAGS="$BASECFLAGS -mieee"
762 case $ac_sys_system in
764 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
767 BASECFLAGS="$BASECFLAGS -ieee -std"
770 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
776 if test "$Py_DEBUG" = 'true'; then
782 if test "$ac_arch_flags"
784 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
787 # disable check for icc since it seems to pass, but generates a warning
790 ac_cv_opt_olimit_ok=no
793 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
794 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
796 CC="$CC -OPT:Olimit=0"
797 AC_TRY_RUN([int main() { return 0; }],
798 ac_cv_opt_olimit_ok=yes,
799 ac_cv_opt_olimit_ok=no,
800 ac_cv_opt_olimit_ok=no)
802 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
803 if test $ac_cv_opt_olimit_ok = yes; then
804 case $ac_sys_system in
805 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
806 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
811 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
815 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
816 AC_CACHE_VAL(ac_cv_olimit_ok,
818 CC="$CC -Olimit 1500"
819 AC_TRY_RUN([int main() { return 0; }],
824 AC_MSG_RESULT($ac_cv_olimit_ok)
825 if test $ac_cv_olimit_ok = yes; then
826 BASECFLAGS="$BASECFLAGS -Olimit 1500"
830 # On some compilers, pthreads are available without further options
831 # (e.g. MacOS X). On some of these systems, the compiler will not
832 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
833 # So we have to see first whether pthreads are available without
834 # options before we can check whether -Kpthread improves anything.
835 AC_MSG_CHECKING(whether pthreads are available without options)
836 AC_CACHE_VAL(ac_cv_pthread_is_default,
840 void* routine(void* p){return NULL;}
844 if(pthread_create(&p,NULL,routine,NULL)!=0)
846 (void)pthread_detach(p);
851 ac_cv_pthread_is_default=yes
855 ac_cv_pthread_is_default=no,
856 ac_cv_pthread_is_default=no)
858 AC_MSG_RESULT($ac_cv_pthread_is_default)
861 if test $ac_cv_pthread_is_default = yes
865 # -Kpthread, if available, provides the right #defines
866 # and linker options to make pthread_create available
867 # Some compilers won't report that they do not support -Kpthread,
868 # so we need to run a program to see whether it really made the
869 # function available.
870 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
871 AC_CACHE_VAL(ac_cv_kpthread,
877 void* routine(void* p){return NULL;}
881 if(pthread_create(&p,NULL,routine,NULL)!=0)
883 (void)pthread_detach(p);
891 AC_MSG_RESULT($ac_cv_kpthread)
894 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
896 # -Kthread, if available, provides the right #defines
897 # and linker options to make pthread_create available
898 # Some compilers won't report that they do not support -Kthread,
899 # so we need to run a program to see whether it really made the
900 # function available.
901 AC_MSG_CHECKING(whether $CC accepts -Kthread)
902 AC_CACHE_VAL(ac_cv_kthread,
908 void* routine(void* p){return NULL;}
912 if(pthread_create(&p,NULL,routine,NULL)!=0)
914 (void)pthread_detach(p);
922 AC_MSG_RESULT($ac_cv_kthread)
925 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
927 # -pthread, if available, provides the right #defines
928 # and linker options to make pthread_create available
929 # Some compilers won't report that they do not support -pthread,
930 # so we need to run a program to see whether it really made the
931 # function available.
932 AC_MSG_CHECKING(whether $CC accepts -pthread)
933 AC_CACHE_VAL(ac_cv_thread,
939 void* routine(void* p){return NULL;}
943 if(pthread_create(&p,NULL,routine,NULL)!=0)
945 (void)pthread_detach(p);
953 AC_MSG_RESULT($ac_cv_pthread)
956 # If we have set a CC compiler flag for thread support then
957 # check if it works for CXX, too.
961 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
964 if test "$ac_cv_kpthread" = "yes"
968 elif test "$ac_cv_kthread" = "yes"
972 elif test "$ac_cv_pthread" = "yes"
978 if test $ac_cv_cxx_thread = yes
980 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
981 $CXX -c conftest.$ac_ext 2>&5
982 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
983 && test -s conftest$ac_exeext && ./conftest$ac_exeext
991 AC_MSG_RESULT($ac_cv_cxx_thread)
995 dnl # check for ANSI or K&R ("traditional") preprocessor
996 dnl AC_MSG_CHECKING(for C preprocessor type)
998 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1000 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1001 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
1002 dnl AC_MSG_RESULT($cpp_type)
1004 # checks for header files
1006 AC_CHECK_HEADERS(asm/types.h curses.h dlfcn.h fcntl.h grp.h \
1007 shadow.h langinfo.h libintl.h ncurses.h poll.h pthread.h \
1008 stropts.h termios.h thread.h \
1010 sys/audioio.h sys/bsdtty.h sys/file.h sys/loadavg.h sys/lock.h sys/mkdev.h \
1012 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
1013 sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
1014 sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1015 bluetooth/bluetooth.h)
1019 # On Solaris, term.h requires curses.h
1020 AC_CHECK_HEADERS(term.h,,,[
1021 #ifdef HAVE_CURSES_H
1026 # On Linux, netlink.h requires asm/types.h
1027 AC_CHECK_HEADERS(linux/netlink.h,,,[
1028 #ifdef HAVE_ASM_TYPES_H
1029 #include <asm/types.h>
1031 #ifdef HAVE_SYS_SOCKET_H
1032 #include <sys/socket.h>
1036 # checks for typedefs
1038 AC_MSG_CHECKING(for clock_t in time.h)
1039 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1040 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1042 AC_MSG_RESULT($was_it_defined)
1044 # Check whether using makedev requires defining _OSF_SOURCE
1045 AC_MSG_CHECKING(for makedev)
1046 AC_TRY_LINK([#include <sys/types.h> ],
1048 ac_cv_has_makedev=yes,
1049 ac_cv_has_makedev=no)
1050 if test "$ac_cv_has_makedev" = "no"; then
1051 # we didn't link, try if _OSF_SOURCE will allow us to link
1053 #define _OSF_SOURCE 1
1054 #include <sys/types.h>
1057 ac_cv_has_makedev=yes,
1058 ac_cv_has_makedev=no)
1059 if test "$ac_cv_has_makedev" = "yes"; then
1060 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1063 AC_MSG_RESULT($ac_cv_has_makedev)
1064 if test "$ac_cv_has_makedev" = "yes"; then
1065 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1068 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1069 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1070 # defined, but the compiler does not support pragma redefine_extname,
1071 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1072 # structures (such as rlimit64) without declaring them. As a
1073 # work-around, disable LFS on such configurations
1076 AC_MSG_CHECKING(Solaris LFS bug)
1078 #define _LARGEFILE_SOURCE 1
1079 #define _FILE_OFFSET_BITS 64
1080 #include <sys/resource.h>
1081 ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1082 AC_MSG_RESULT($sol_lfs_bug)
1083 if test "$sol_lfs_bug" = "yes"; then
1087 if test "$use_lfs" = "yes"; then
1088 # Two defines needed to enable largefile support on various platforms
1089 # These may affect some typedefs
1090 AC_DEFINE(_LARGEFILE_SOURCE, 1,
1091 [This must be defined on some systems to enable large file support.])
1092 AC_DEFINE(_FILE_OFFSET_BITS, 64,
1093 [This must be set to 64 on some systems to enable large file support.])
1096 # Add some code to confdefs.h so that the test for off_t works on SCO
1097 cat >> confdefs.h <<\EOF
1103 # Type availability checks
1110 AC_CHECK_TYPE(ssize_t,
1111 AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
1113 # Sizes of various common basic types
1114 # ANSI C requires sizeof(char) == 1, so no need to check it
1115 AC_CHECK_SIZEOF(int, 4)
1116 AC_CHECK_SIZEOF(long, 4)
1117 AC_CHECK_SIZEOF(void *, 4)
1118 AC_CHECK_SIZEOF(short, 2)
1119 AC_CHECK_SIZEOF(float, 4)
1120 AC_CHECK_SIZEOF(double, 8)
1121 AC_CHECK_SIZEOF(fpos_t, 4)
1122 AC_CHECK_SIZEOF(size_t, 4)
1124 AC_MSG_CHECKING(for long long support)
1126 AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1127 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1130 AC_MSG_RESULT($have_long_long)
1131 if test "$have_long_long" = yes ; then
1132 AC_CHECK_SIZEOF(long long, 8)
1135 AC_MSG_CHECKING(for uintptr_t support)
1137 AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
1138 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
1141 AC_MSG_RESULT($have_uintptr_t)
1142 if test "$have_uintptr_t" = yes ; then
1143 AC_CHECK_SIZEOF(uintptr_t, 4)
1146 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
1147 AC_MSG_CHECKING(size of off_t)
1148 AC_CACHE_VAL(ac_cv_sizeof_off_t,
1149 [AC_TRY_RUN([#include <stdio.h>
1150 #include <sys/types.h>
1153 FILE *f=fopen("conftestval", "w");
1155 fprintf(f, "%d\n", sizeof(off_t));
1158 ac_cv_sizeof_off_t=`cat conftestval`,
1159 ac_cv_sizeof_off_t=0,
1160 ac_cv_sizeof_off_t=4)
1162 AC_MSG_RESULT($ac_cv_sizeof_off_t)
1163 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1164 [The number of bytes in an off_t.])
1166 AC_MSG_CHECKING(whether to enable large file support)
1167 if test "$have_long_long" = yes -a \
1168 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1169 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1170 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1171 [Defined to enable large file support when an off_t is bigger than a long
1172 and long long is available and at least as big as an off_t. You may need
1173 to add some flags for configuration and compilation to enable this mode.
1174 (For Solaris and Linux, the necessary defines are already defined.)])
1180 # AC_CHECK_SIZEOF() doesn't include <time.h>.
1181 AC_MSG_CHECKING(size of time_t)
1182 AC_CACHE_VAL(ac_cv_sizeof_time_t,
1183 [AC_TRY_RUN([#include <stdio.h>
1187 FILE *f=fopen("conftestval", "w");
1189 fprintf(f, "%d\n", sizeof(time_t));
1192 ac_cv_sizeof_time_t=`cat conftestval`,
1193 ac_cv_sizeof_time_t=0,
1194 ac_cv_sizeof_time_t=4)
1196 AC_MSG_RESULT($ac_cv_sizeof_time_t)
1197 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
1198 [The number of bytes in a time_t.])
1201 # if have pthread_t then define SIZEOF_PTHREAD_T
1203 if test "$ac_cv_kpthread" = "yes"
1204 then CC="$CC -Kpthread"
1205 elif test "$ac_cv_kthread" = "yes"
1206 then CC="$CC -Kthread"
1207 elif test "$ac_cv_pthread" = "yes"
1208 then CC="$CC -pthread"
1210 AC_MSG_CHECKING(for pthread_t)
1212 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
1213 AC_MSG_RESULT($have_pthread_t)
1214 if test "$have_pthread_t" = yes ; then
1215 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
1216 AC_MSG_CHECKING(size of pthread_t)
1217 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
1218 [AC_TRY_RUN([#include <stdio.h>
1219 #include <pthread.h>
1222 FILE *f=fopen("conftestval", "w");
1224 fprintf(f, "%d\n", sizeof(pthread_t));
1227 ac_cv_sizeof_pthread_t=`cat conftestval`,
1228 ac_cv_sizeof_pthread_t=0,
1229 ac_cv_sizeof_pthread_t=4)
1231 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
1232 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
1233 [The number of bytes in a pthread_t.])
1237 AC_MSG_CHECKING(for --enable-toolbox-glue)
1238 AC_ARG_ENABLE(toolbox-glue,
1239 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
1241 if test -z "$enable_toolbox_glue"
1243 case $ac_sys_system/$ac_sys_release in
1245 enable_toolbox_glue="yes";;
1247 enable_toolbox_glue="no";;
1250 case "$enable_toolbox_glue" in
1252 extra_machdep_objs="Python/mactoolboxglue.o"
1253 extra_undefs="-u _PyMac_Error"
1254 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1255 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
1258 extra_machdep_objs=""
1262 AC_MSG_RESULT($enable_toolbox_glue)
1264 AC_SUBST(OTHER_LIBTOOL_OPT)
1265 case $ac_sys_system/$ac_sys_release in
1266 Darwin/@<:@01234567@:>@.*)
1267 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1270 OTHER_LIBTOOL_OPT=""
1274 AC_SUBST(LIBTOOL_CRUFT)
1275 case $ac_sys_system/$ac_sys_release in
1276 Darwin/@<:@01234567@:>@.*)
1277 LIBTOOL_CRUFT="-framework System -lcc_dynamic -arch_only `arch`"
1278 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1279 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1281 gcc_version=`gcc -v 2>&1 | grep version | cut -d\ -f3`
1282 if test ${gcc_version} '<' 4.0
1284 LIBTOOL_CRUFT="-lcc_dynamic"
1288 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
1289 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1290 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1293 AC_MSG_CHECKING(for --enable-framework)
1294 if test "$enable_framework"
1296 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
1297 # -F. is needed to allow linking to the framework while
1298 # in the build location.
1299 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1300 [Define if you want to produce an OpenStep/Rhapsody framework
1301 (shared library plus accessory files).])
1307 AC_MSG_CHECKING(for dyld)
1308 case $ac_sys_system/$ac_sys_release in
1310 AC_DEFINE(WITH_DYLD, 1,
1311 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1312 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1313 linker (rld). Dyld is necessary to support frameworks.])
1314 AC_MSG_RESULT(always on for Darwin)
1321 # Set info about shared libraries.
1326 AC_SUBST(LINKFORSHARED)
1327 # SO is the extension of shared libraries `(including the dot!)
1328 # -- usually .so, .sl on HP-UX, .dll on Cygwin
1332 case $ac_sys_system in
1338 # this might also be a termcap variable, see #610332
1340 echo '====================================================================='
1342 echo '+ WARNING: You have set SO in your environment. +'
1343 echo '+ Do you really mean to change the extension for shared libraries? +'
1344 echo '+ Continuing in 10 seconds to let you to ponder. +'
1346 echo '====================================================================='
1350 # LDSHARED is the ld *command* used to create shared library
1351 # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
1352 # (Shared libraries in this instance are shared modules to be loaded into
1353 # Python, as opposed to building Python itself as a shared library.)
1354 AC_MSG_CHECKING(LDSHARED)
1355 if test -z "$LDSHARED"
1357 case $ac_sys_system/$ac_sys_release in
1359 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
1360 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
1363 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
1364 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
1366 IRIX/5*) LDSHARED="ld -shared";;
1367 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1369 if test "$GCC" = "yes"
1370 then LDSHARED='$(CC) -shared'
1371 else LDSHARED='$(CC) -G';
1373 hp*|HP*) LDSHARED="ld -b";;
1374 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1376 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1377 if test "$enable_framework" ; then
1378 # Link against the framework. All externals should be defined.
1379 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1380 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1382 # No framework. Ignore undefined symbols, assuming they come from Python
1383 LDSHARED="$LDSHARED -undefined suppress"
1385 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
1386 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1387 if test "$enable_framework" ; then
1388 # Link against the framework. All externals should be defined.
1389 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1390 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1392 # No framework, use the Python app as bundle-loader
1393 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1394 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1397 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1398 # This allows an extension to be used in any Python
1399 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
1400 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1401 if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
1403 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1404 BLDSHARED="$LDSHARED"
1406 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1407 if test "$enable_framework" ; then
1408 # Link against the framework. All externals should be defined.
1409 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1410 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1412 # No framework, use the Python app as bundle-loader
1413 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1414 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1418 Linux*|GNU*) LDSHARED='$(CC) -shared';;
1419 BSD/OS*/4*) LDSHARED="gcc -shared";;
1421 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1423 LDSHARED="$CC -shared ${LDFLAGS}"
1425 LDSHARED="ld -Bshareable ${LDFLAGS}"
1427 NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
1428 OpenUNIX*|UnixWare*)
1429 if test "$GCC" = "yes"
1430 then LDSHARED='$(CC) -shared'
1431 else LDSHARED='$(CC) -G'
1433 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1434 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
1435 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1436 atheos*) LDSHARED="gcc -shared";;
1440 AC_MSG_RESULT($LDSHARED)
1441 BLDSHARED=${BLDSHARED-$LDSHARED}
1442 # CCSHARED are the C *flags* used to create objects to go into a shared
1443 # library (module) -- this is only needed for a few systems
1444 AC_MSG_CHECKING(CCSHARED)
1445 if test -z "$CCSHARED"
1447 case $ac_sys_system/$ac_sys_release in
1448 SunOS*) if test "$GCC" = yes;
1449 then CCSHARED="-fPIC";
1450 else CCSHARED="-xcode=pic32";
1452 hp*|HP*) if test "$GCC" = yes;
1453 then CCSHARED="-fPIC";
1456 Linux*|GNU*) CCSHARED="-fPIC";;
1457 BSD/OS*/4*) CCSHARED="-fpic";;
1458 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
1459 OpenUNIX*|UnixWare*)
1460 if test "$GCC" = "yes"
1461 then CCSHARED="-fPIC"
1462 else CCSHARED="-KPIC"
1465 if test "$GCC" = "yes"
1466 then CCSHARED="-fPIC"
1467 else CCSHARED="-Kpic -belf"
1469 Monterey*) CCSHARED="-G";;
1470 IRIX*/6*) case $CC in
1471 *gcc*) CCSHARED="-shared";;
1474 atheos*) CCSHARED="-fPIC";;
1477 AC_MSG_RESULT($CCSHARED)
1478 # LINKFORSHARED are the flags passed to the $(CC) command that links
1479 # the python executable -- this is only needed for a few systems
1480 AC_MSG_CHECKING(LINKFORSHARED)
1481 if test -z "$LINKFORSHARED"
1483 case $ac_sys_system/$ac_sys_release in
1484 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1486 LINKFORSHARED="-Wl,-E -Wl,+s";;
1487 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1488 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1489 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1490 # -u libsys_s pulls in all symbols in libsys
1492 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1494 # not used by the core itself but which needs to be in the core so
1495 # that dynamically loaded extension modules have access to it.
1496 # -prebind is no longer used, because it actually seems to give a
1497 # slowdown in stead of a speedup, maybe due to the large number of
1498 # dynamic loads Python does.
1500 LINKFORSHARED="$extra_undefs"
1501 if test "$enable_framework"
1503 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1505 LINKFORSHARED="$LINKFORSHARED";;
1506 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1507 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1508 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1509 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
1510 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1512 LINKFORSHARED="-Wl,--export-dynamic"
1514 SunOS/5*) case $CC in
1516 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
1518 LINKFORSHARED="-Xlinker --export-dynamic"
1522 if test $enable_shared = "no"
1524 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1528 AC_MSG_RESULT($LINKFORSHARED)
1530 AC_SUBST(CFLAGSFORSHARED)
1531 AC_MSG_CHECKING(CFLAGSFORSHARED)
1532 if test ! "$LIBRARY" = "$LDLIBRARY"
1534 case $ac_sys_system in
1536 # Cygwin needs CCSHARED when building extension DLLs
1537 # but not when building the interpreter DLL.
1538 CFLAGSFORSHARED='';;
1540 CFLAGSFORSHARED='$(CCSHARED)'
1543 AC_MSG_RESULT($CFLAGSFORSHARED)
1545 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
1546 # library (with --enable-shared).
1547 # For platforms on which shared libraries are not allowed to have unresolved
1548 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
1549 # if it is not required, since it creates a dependency of the shared library
1550 # to LIBS. This, in turn, means that applications linking the shared libpython
1551 # don't need to link LIBS explicitly. The default should be only changed
1552 # on systems where this approach causes problems.
1554 AC_MSG_CHECKING(SHLIBS)
1555 case "$ac_sys_system" in
1559 AC_MSG_RESULT($SHLIBS)
1562 # checks for libraries
1563 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1564 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
1566 # only check for sem_ini if thread support is requested
1567 if test "$with_threads" = "yes" -o -z "$with_threads"; then
1568 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
1569 # posix4 on Solaris 2.6
1570 # pthread (first!) on Linux
1573 # check if we need libintl for locale functions
1574 AC_CHECK_LIB(intl, textdomain,
1575 AC_DEFINE(WITH_LIBINTL, 1,
1576 [Define to 1 if libintl is needed for locale functions.]))
1578 # checks for system dependent C++ extensions support
1579 case "$ac_sys_system" in
1580 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1581 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1582 [loadAndInit("", 0, "")],
1583 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1584 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1585 and you want support for AIX C++ shared extension modules.])
1586 AC_MSG_RESULT(yes)],
1587 [AC_MSG_RESULT(no)]);;
1591 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1592 # BeOS' sockets are stashed in libnet.
1593 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
1594 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
1596 case "$ac_sys_system" in
1598 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1602 AC_MSG_CHECKING(for --with-libs)
1604 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1606 AC_MSG_RESULT($withval)
1607 LIBS="$withval $LIBS"
1609 [AC_MSG_RESULT(no)])
1611 # Determine if signalmodule should be used.
1612 AC_SUBST(USE_SIGNAL_MODULE)
1613 AC_SUBST(SIGNAL_OBJS)
1614 AC_MSG_CHECKING(for --with-signal-module)
1615 AC_ARG_WITH(signal-module,
1616 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
1618 if test -z "$with_signal_module"
1619 then with_signal_module="yes"
1621 AC_MSG_RESULT($with_signal_module)
1623 if test "${with_signal_module}" = "yes"; then
1624 USE_SIGNAL_MODULE=""
1627 USE_SIGNAL_MODULE="#"
1628 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1631 # This is used to generate Setup.config
1632 AC_SUBST(USE_THREAD_MODULE)
1633 USE_THREAD_MODULE=""
1635 AC_MSG_CHECKING(for --with-dec-threads)
1637 AC_ARG_WITH(dec-threads,
1638 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
1640 AC_MSG_RESULT($withval)
1642 if test "${with_thread+set}" != set; then
1643 with_thread="$withval";
1645 [AC_MSG_RESULT(no)])
1647 # Templates for things AC_DEFINEd more than once.
1648 # For a single AC_DEFINE, no template is needed.
1649 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
1650 AH_TEMPLATE(_REENTRANT,
1651 [Define to force use of thread-safe errno, h_errno, and other functions])
1652 AH_TEMPLATE(WITH_THREAD,
1653 [Define if you want to compile in rudimentary thread support])
1655 AC_MSG_CHECKING(for --with-threads)
1656 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1657 AC_ARG_WITH(threads,
1658 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
1660 # --with-thread is deprecated, but check for it anyway
1661 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1663 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
1664 [with_threads=$with_thread])
1666 if test -z "$with_threads"
1667 then with_threads="yes"
1669 AC_MSG_RESULT($with_threads)
1672 if test "$with_threads" = "no"
1674 USE_THREAD_MODULE="#"
1675 elif test "$ac_cv_pthread_is_default" = yes
1677 AC_DEFINE(WITH_THREAD)
1678 # Defining _REENTRANT on system with POSIX threads should not hurt.
1679 AC_DEFINE(_REENTRANT)
1681 THREADOBJ="Python/thread.o"
1682 elif test "$ac_cv_kpthread" = "yes"
1685 if test "$ac_cv_cxx_thread" = "yes"; then
1686 CXX="$CXX -Kpthread"
1688 AC_DEFINE(WITH_THREAD)
1690 THREADOBJ="Python/thread.o"
1691 elif test "$ac_cv_kthread" = "yes"
1694 if test "$ac_cv_cxx_thread" = "yes"; then
1697 AC_DEFINE(WITH_THREAD)
1699 THREADOBJ="Python/thread.o"
1700 elif test "$ac_cv_pthread" = "yes"
1703 if test "$ac_cv_cxx_thread" = "yes"; then
1706 AC_DEFINE(WITH_THREAD)
1708 THREADOBJ="Python/thread.o"
1710 if test ! -z "$with_threads" -a -d "$with_threads"
1711 then LDFLAGS="$LDFLAGS -L$with_threads"
1713 if test ! -z "$withval" -a -d "$withval"
1714 then LDFLAGS="$LDFLAGS -L$withval"
1717 # According to the POSIX spec, a pthreads implementation must
1718 # define _POSIX_THREADS in unistd.h. Some apparently don't
1719 # (e.g. gnu pth with pthread emulation)
1720 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1724 #ifdef _POSIX_THREADS
1727 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1728 AC_MSG_RESULT($unistd_defines_pthreads)
1730 AC_DEFINE(_REENTRANT)
1731 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1732 AC_DEFINE(C_THREADS)
1733 AC_DEFINE(HURD_C_THREADS, 1,
1734 [Define if you are using Mach cthreads directly under /include])
1735 LIBS="$LIBS -lthreads"
1736 THREADOBJ="Python/thread.o"],[
1737 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1738 AC_DEFINE(C_THREADS)
1739 AC_DEFINE(MACH_C_THREADS, 1,
1740 [Define if you are using Mach cthreads under mach /])
1741 THREADOBJ="Python/thread.o"],[
1742 AC_MSG_CHECKING(for --with-pth)
1744 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
1745 [AC_MSG_RESULT($withval)
1746 AC_DEFINE([WITH_THREAD])
1747 AC_DEFINE([HAVE_PTH], 1,
1748 [Define if you have GNU PTH threads.])
1750 THREADOBJ="Python/thread.o"],
1753 # Just looking for pthread_create in libpthread is not enough:
1754 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1755 # So we really have to include pthread.h, and then link.
1757 LIBS="$LIBS -lpthread"
1758 AC_MSG_CHECKING([for pthread_create in -lpthread])
1759 AC_TRY_LINK([#include <pthread.h>
1761 void * start_routine (void *arg) { exit (0); }], [
1762 pthread_create (NULL, NULL, start_routine, NULL)], [
1764 AC_DEFINE(WITH_THREAD)
1766 THREADOBJ="Python/thread.o"],[
1768 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1770 THREADOBJ="Python/thread.o"],[
1771 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
1772 AC_DEFINE(ATHEOS_THREADS, 1,
1773 [Define this if you have AtheOS threads.])
1774 THREADOBJ="Python/thread.o"],[
1775 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1776 AC_DEFINE(BEOS_THREADS, 1,
1777 [Define this if you have BeOS threads.])
1778 THREADOBJ="Python/thread.o"],[
1779 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1781 LIBS="$LIBS -lpthreads"
1782 THREADOBJ="Python/thread.o"], [
1783 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1786 THREADOBJ="Python/thread.o"], [
1787 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1789 LIBS="$LIBS -lpthread"
1790 THREADOBJ="Python/thread.o"], [
1791 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1794 THREADOBJ="Python/thread.o"],[
1795 USE_THREAD_MODULE="#"])
1796 ])])])])])])])])])])
1798 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1800 THREADOBJ="Python/thread.o"
1801 USE_THREAD_MODULE=""])
1803 if test "$posix_threads" != "yes"; then
1804 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1805 LIBS="$LIBS -lthread"
1806 THREADOBJ="Python/thread.o"
1807 USE_THREAD_MODULE=""])
1810 if test "$USE_THREAD_MODULE" != "#"
1812 # If the above checks didn't disable threads, (at least) OSF1
1813 # needs this '-threads' argument during linking.
1814 case $ac_sys_system in
1815 OSF1) LDLAST=-threads;;
1820 if test "$posix_threads" = "yes"; then
1821 if test "$unistd_defines_pthreads" = "no"; then
1822 AC_DEFINE(_POSIX_THREADS, 1,
1823 [Define if you have POSIX threads,
1824 and your system does not define that.])
1827 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
1828 case $ac_sys_system/$ac_sys_release in
1829 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
1830 Defined for Solaris 2.6 bug in pthread header.)
1832 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
1833 Define if the Posix semaphores do not work on your system)
1837 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1838 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1839 [AC_TRY_RUN([#include <pthread.h>
1840 void *foo(void *parm) {
1844 pthread_attr_t attr;
1846 if (pthread_attr_init(&attr)) exit(-1);
1847 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
1848 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
1851 ac_cv_pthread_system_supported=yes,
1852 ac_cv_pthread_system_supported=no,
1853 ac_cv_pthread_system_supported=no)
1855 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1856 if test "$ac_cv_pthread_system_supported" = "yes"; then
1857 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
1859 AC_CHECK_FUNCS(pthread_sigmask,
1860 [case $ac_sys_system in
1862 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
1863 [Define if pthread_sigmask() does not work on your system.])
1869 # Check for enable-ipv6
1870 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
1871 AC_MSG_CHECKING([if --enable-ipv6 is specified])
1873 [ --enable-ipv6 Enable ipv6 (with ipv4) support
1874 --disable-ipv6 Disable ipv6 support],
1875 [ case "$enableval" in
1880 *) AC_MSG_RESULT(yes)
1881 AC_DEFINE(ENABLE_IPV6)
1887 dnl the check does not work on cross compilation case...
1888 AC_TRY_RUN([ /* AF_INET6 available check */
1889 #include <sys/types.h>
1890 #include <sys/socket.h>
1893 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1907 if test "$ipv6" = "yes"; then
1908 AC_MSG_CHECKING(if RFC2553 API is available)
1909 AC_TRY_COMPILE([#include <sys/types.h>
1910 #include <netinet/in.h>],
1911 [struct sockaddr_in6 x;
1915 AC_MSG_RESULT(no, IPv6 disabled)
1919 if test "$ipv6" = "yes"; then
1920 AC_DEFINE(ENABLE_IPV6)
1928 if test "$ipv6" = "yes"; then
1929 AC_MSG_CHECKING([ipv6 stack type])
1930 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1934 dnl http://www.kame.net/
1936 #include <netinet/in.h>
1937 #ifdef IPV6_INRIA_VERSION
1943 dnl http://www.kame.net/
1945 #include <netinet/in.h>
1951 ipv6libdir=/usr/local/v6/lib
1955 dnl http://www.v6.linux.or.jp/
1957 #include <features.h>
1958 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1965 dnl http://www.v6.linux.or.jp/
1966 if test -d /usr/inet6; then
1969 ipv6libdir=/usr/inet6/lib
1970 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
1974 if test -f /etc/netconfig; then
1975 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1983 #include <sys/param.h>
1984 #ifdef _TOSHIBA_INET6
1989 ipv6libdir=/usr/local/v6/lib])
1993 #include </usr/local/v6/include/sys/v6config.h>
1999 ipv6libdir=/usr/local/v6/lib;
2000 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
2004 #include <sys/param.h>
2005 #ifdef _ZETA_MINAMI_INET6
2010 ipv6libdir=/usr/local/v6/lib])
2013 if test "$ipv6type" != "unknown"; then
2017 AC_MSG_RESULT($ipv6type)
2020 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2021 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2022 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2023 echo "using lib$ipv6lib"
2025 if test $ipv6trylibc = "yes"; then
2028 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2029 echo "You need to fetch lib$ipv6lib.a from appropriate"
2030 echo 'ipv6 kit and compile beforehand.'
2036 # Check for --with-doc-strings
2037 AC_MSG_CHECKING(for --with-doc-strings)
2038 AC_ARG_WITH(doc-strings,
2039 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
2041 if test -z "$with_doc_strings"
2042 then with_doc_strings="yes"
2044 if test "$with_doc_strings" != "no"
2046 AC_DEFINE(WITH_DOC_STRINGS, 1,
2047 [Define if you want documentation strings in extension modules])
2049 AC_MSG_RESULT($with_doc_strings)
2051 # Check for Python-specific malloc support
2052 AC_MSG_CHECKING(for --with-tsc)
2054 [ --with(out)-tsc enable/disable timestamp counter profile], [
2055 if test "$withval" != no
2057 AC_DEFINE(WITH_TSC, 1,
2058 [Define to profile with the Pentium timestamp counter])
2060 else AC_MSG_RESULT(no)
2062 [AC_MSG_RESULT(no)])
2064 # Check for Python-specific malloc support
2065 AC_MSG_CHECKING(for --with-pymalloc)
2066 AC_ARG_WITH(pymalloc,
2067 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
2069 if test -z "$with_pymalloc"
2070 then with_pymalloc="yes"
2072 if test "$with_pymalloc" != "no"
2074 AC_DEFINE(WITH_PYMALLOC, 1,
2075 [Define if you want to compile in Python-specific mallocs])
2077 AC_MSG_RESULT($with_pymalloc)
2079 # Check for --with-wctype-functions
2080 AC_MSG_CHECKING(for --with-wctype-functions)
2081 AC_ARG_WITH(wctype-functions,
2082 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
2084 if test "$withval" != no
2086 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2087 [Define if you want wctype.h functions to be used instead of the
2088 one supplied by Python itself. (see Include/unicodectype.h).])
2090 else AC_MSG_RESULT(no)
2092 [AC_MSG_RESULT(no)])
2094 # -I${DLINCLDIR} is added to the compile rule for importdl.o
2098 # the dlopen() function means we might want to use dynload_shlib.o. some
2099 # platforms, such as AIX, have dlopen(), but don't want to use it.
2100 AC_CHECK_FUNCS(dlopen)
2102 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2103 # loading of modules.
2104 AC_SUBST(DYNLOADFILE)
2105 AC_MSG_CHECKING(DYNLOADFILE)
2106 if test -z "$DYNLOADFILE"
2108 case $ac_sys_system/$ac_sys_release in
2109 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2110 if test "$ac_cv_func_dlopen" = yes
2111 then DYNLOADFILE="dynload_shlib.o"
2112 else DYNLOADFILE="dynload_aix.o"
2115 BeOS*) DYNLOADFILE="dynload_beos.o";;
2116 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
2117 Darwin/*) DYNLOADFILE="dynload_next.o";;
2118 atheos*) DYNLOADFILE="dynload_atheos.o";;
2120 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2121 # out any dynamic loading
2122 if test "$ac_cv_func_dlopen" = yes
2123 then DYNLOADFILE="dynload_shlib.o"
2124 else DYNLOADFILE="dynload_stub.o"
2129 AC_MSG_RESULT($DYNLOADFILE)
2130 if test "$DYNLOADFILE" != "dynload_stub.o"
2132 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2133 [Defined when any dynamic module loading is enabled.])
2136 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
2138 AC_SUBST(MACHDEP_OBJS)
2139 AC_MSG_CHECKING(MACHDEP_OBJS)
2140 if test -z "$MACHDEP_OBJS"
2142 MACHDEP_OBJS=$extra_machdep_objs
2144 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
2146 AC_MSG_RESULT(MACHDEP_OBJS)
2148 # checks for library functions
2149 AC_CHECK_FUNCS(alarm bind_textdomain_codeset chown clock confstr ctermid \
2150 execv fork fpathconf ftime ftruncate \
2151 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2152 getpriority getpwent getspnam getspent getsid getwd \
2153 kill killpg lchown lstat mkfifo mknod mktime \
2154 mremap nice pathconf pause plock poll pthread_init \
2155 putenv readlink realpath \
2156 select setegid seteuid setgid \
2157 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
2158 sigaction siginterrupt sigrelse strftime \
2159 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
2160 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
2162 # For some functions, having a definition is not sufficient, since
2163 # we want to take their address.
2164 AC_MSG_CHECKING(for chroot)
2165 AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2166 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2170 AC_MSG_CHECKING(for link)
2171 AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2172 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2176 AC_MSG_CHECKING(for symlink)
2177 AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2178 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2182 AC_MSG_CHECKING(for fchdir)
2183 AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2184 AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2188 AC_MSG_CHECKING(for fsync)
2189 AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
2190 AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2194 AC_MSG_CHECKING(for fdatasync)
2195 AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2196 AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2201 # On some systems (eg. FreeBSD 5), we would find a definition of the
2202 # functions ctermid_r, setgroups in the library, but no prototype
2203 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2204 # address to avoid compiler warnings and potential miscompilations
2205 # because of the missing prototypes.
2207 AC_MSG_CHECKING(for ctermid_r)
2209 #include "confdefs.h"
2211 ], void* p = ctermid_r,
2212 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2217 AC_MSG_CHECKING(for flock)
2219 #include "confdefs.h"
2220 #include <sys/file.h>
2222 AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2227 AC_MSG_CHECKING(for getpagesize)
2229 #include "confdefs.h"
2231 ], void* p = getpagesize,
2232 AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2238 AC_CHECK_PROGS(TRUE, true, /bin/true)
2240 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2241 dnl On others, they are in the C library, so we to take no action
2242 AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
2243 AC_CHECK_LIB(resolv, inet_aton)
2246 AC_MSG_CHECKING(for hstrerror)
2248 #include "confdefs.h"
2250 ], void* p = hstrerror; hstrerror(0),
2251 AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2256 AC_MSG_CHECKING(for inet_aton)
2258 #include "confdefs.h"
2259 #include <sys/types.h>
2260 #include <sys/socket.h>
2261 #include <netinet/in.h>
2262 #include <arpa/inet.h>
2263 ], void* p = inet_aton;inet_aton(0,0),
2264 AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2269 AC_MSG_CHECKING(for inet_pton)
2271 #include "confdefs.h"
2272 #include <sys/types.h>
2273 #include <sys/socket.h>
2274 #include <netinet/in.h>
2275 #include <arpa/inet.h>
2276 ], void* p = inet_pton,
2277 AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2282 # On some systems, setgroups is in unistd.h, on others, in grp.h
2283 AC_MSG_CHECKING(for setgroups)
2285 #include "confdefs.h"
2291 void* p = setgroups,
2292 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2297 # check for openpty and forkpty
2299 AC_CHECK_FUNCS(openpty,,
2300 AC_CHECK_LIB(util,openpty,
2301 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2302 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2305 AC_CHECK_FUNCS(forkpty,,
2306 AC_CHECK_LIB(util,forkpty,
2307 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2308 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2312 # check for long file support functions
2313 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2315 AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
2316 AC_CHECK_FUNCS(getpgrp,
2317 AC_TRY_COMPILE([#include <unistd.h>],
2319 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2320 [Define if getpgrp() must be called as getpgrp(0).])
2323 AC_CHECK_FUNCS(setpgrp,
2324 AC_TRY_COMPILE([#include <unistd.h>],
2326 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2327 [Define if setpgrp() must be called as setpgrp(0, 0).])
2330 AC_CHECK_FUNCS(gettimeofday,
2331 AC_TRY_COMPILE([#include <sys/time.h>],
2332 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2333 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2334 [Define if gettimeofday() does not have second (timezone) argument
2335 This is the case on Motorola V4 (R40V4.2)])
2339 AC_MSG_CHECKING(for major, minor, and makedev)
2341 #if defined(MAJOR_IN_MKDEV)
2342 #include <sys/mkdev.h>
2343 #elif defined(MAJOR_IN_SYSMACROS)
2344 #include <sys/sysmacros.h>
2346 #include <sys/types.h>
2349 makedev(major(0),minor(0));
2351 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2352 [Define to 1 if you have the device macros.])
2358 # On OSF/1 V5.1, getaddrinfo is available, but a define
2359 # for [no]getaddrinfo in netdb.h.
2360 AC_MSG_CHECKING(for getaddrinfo)
2362 #include <sys/types.h>
2363 #include <sys/socket.h>
2367 getaddrinfo(NULL, NULL, NULL, NULL);
2370 AC_MSG_CHECKING(getaddrinfo bug)
2372 #include <sys/types.h>
2375 #include <sys/socket.h>
2376 #include <netinet/in.h>
2380 int passive, gaierr, inet4 = 0, inet6 = 0;
2381 struct addrinfo hints, *ai, *aitop;
2382 char straddr[INET6_ADDRSTRLEN], strport[16];
2384 for (passive = 0; passive <= 1; passive++) {
2385 memset(&hints, 0, sizeof(hints));
2386 hints.ai_family = AF_UNSPEC;
2387 hints.ai_flags = passive ? AI_PASSIVE : 0;
2388 hints.ai_socktype = SOCK_STREAM;
2389 hints.ai_protocol = IPPROTO_TCP;
2390 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2391 (void)gai_strerror(gaierr);
2394 for (ai = aitop; ai; ai = ai->ai_next) {
2395 if (ai->ai_addr == NULL ||
2396 ai->ai_addrlen == 0 ||
2397 getnameinfo(ai->ai_addr, ai->ai_addrlen,
2398 straddr, sizeof(straddr), strport, sizeof(strport),
2399 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2402 switch (ai->ai_family) {
2404 if (strcmp(strport, "54321") != 0) {
2408 if (strcmp(straddr, "0.0.0.0") != 0) {
2412 if (strcmp(straddr, "127.0.0.1") != 0) {
2419 if (strcmp(strport, "54321") != 0) {
2423 if (strcmp(straddr, "::") != 0) {
2427 if (strcmp(straddr, "::1") != 0) {
2437 /* another family support? */
2443 if (!(inet4 == 0 || inet4 == 2))
2445 if (!(inet6 == 0 || inet6 == 2))
2449 freeaddrinfo(aitop);
2454 freeaddrinfo(aitop);
2459 buggygetaddrinfo=no,
2460 AC_MSG_RESULT(buggy)
2461 buggygetaddrinfo=yes,
2462 AC_MSG_RESULT(buggy)
2463 buggygetaddrinfo=yes)], [
2465 buggygetaddrinfo=yes
2468 if test "$buggygetaddrinfo" = "yes"; then
2469 if test "$ipv6" = "yes"; then
2470 echo 'Fatal: You must get working getaddrinfo() function.'
2471 echo ' or you can specify "--disable-ipv6"'.
2475 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
2477 AC_CHECK_FUNCS(getnameinfo)
2479 # checks for structures
2483 AC_CHECK_MEMBERS([struct stat.st_rdev])
2484 AC_CHECK_MEMBERS([struct stat.st_blksize])
2485 AC_CHECK_MEMBERS([struct stat.st_flags])
2486 AC_CHECK_MEMBERS([struct stat.st_gen])
2487 AC_CHECK_MEMBERS([struct stat.st_birthtime])
2490 AC_MSG_CHECKING(for time.h that defines altzone)
2491 AC_CACHE_VAL(ac_cv_header_time_altzone,
2492 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2493 ac_cv_header_time_altzone=yes,
2494 ac_cv_header_time_altzone=no)])
2495 AC_MSG_RESULT($ac_cv_header_time_altzone)
2496 if test $ac_cv_header_time_altzone = yes; then
2497 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
2501 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
2503 #include <sys/types.h>
2504 #include <sys/select.h>
2505 #include <sys/time.h>
2507 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
2508 [Define if you can safely include both <sys/select.h> and <sys/time.h>
2509 (which you can't on SCO ODT 3.0).])
2512 AC_MSG_RESULT($was_it_defined)
2514 AC_MSG_CHECKING(for addrinfo)
2515 AC_CACHE_VAL(ac_cv_struct_addrinfo,
2517 # include <netdb.h>],
2518 [struct addrinfo a],
2519 ac_cv_struct_addrinfo=yes,
2520 ac_cv_struct_addrinfo=no))
2521 AC_MSG_RESULT($ac_cv_struct_addrinfo)
2522 if test $ac_cv_struct_addrinfo = yes; then
2523 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
2526 AC_MSG_CHECKING(for sockaddr_storage)
2527 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
2529 # include <sys/types.h>
2530 # include <sys/socket.h>],
2531 [struct sockaddr_storage s],
2532 ac_cv_struct_sockaddr_storage=yes,
2533 ac_cv_struct_sockaddr_storage=no))
2534 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
2535 if test $ac_cv_struct_sockaddr_storage = yes; then
2536 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
2539 # checks for compiler characteristics
2545 AC_MSG_CHECKING(for working volatile)
2546 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
2547 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
2549 AC_MSG_RESULT($works)
2552 AC_MSG_CHECKING(for working signed char)
2553 AC_TRY_COMPILE([], [signed char c;], works=yes,
2554 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
2556 AC_MSG_RESULT($works)
2559 AC_MSG_CHECKING(for prototypes)
2560 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
2561 AC_DEFINE(HAVE_PROTOTYPES, 1,
2562 [Define if your compiler supports function prototype])
2565 AC_MSG_RESULT($have_prototypes)
2568 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
2571 int foo(int x, ...) {
2579 ], [return foo(10, "", 3.14);], [
2580 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
2581 [Define if your compiler supports variable length function prototypes
2582 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
2585 AC_MSG_RESULT($works)
2587 # check for socketpair
2588 AC_MSG_CHECKING(for socketpair)
2590 #include <sys/types.h>
2591 #include <sys/socket.h>
2592 ], void *x=socketpair,
2593 AC_DEFINE(HAVE_SOCKETPAIR, 1, Define if you have the 'socketpair' function.)
2598 # check if sockaddr has sa_len member
2599 AC_MSG_CHECKING(if sockaddr has sa_len member)
2600 AC_TRY_COMPILE([#include <sys/types.h>
2601 #include <sys/socket.h>],
2605 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
2609 AC_MSG_CHECKING(whether va_list is an array)
2611 #ifdef HAVE_STDARG_PROTOTYPES
2614 #include <varargs.h>
2616 ], [va_list list1, list2; list1 = list2;], , [
2617 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
2618 va_list_is_array=yes
2620 AC_MSG_RESULT($va_list_is_array)
2622 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
2623 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
2624 [Define this if you have some version of gethostbyname_r()])
2626 AC_CHECK_FUNC(gethostbyname_r, [
2627 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2628 AC_MSG_CHECKING([gethostbyname_r with 6 args])
2630 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
2635 struct hostent *he, *res;
2640 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
2642 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2643 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
2644 [Define this if you have the 6-arg version of gethostbyname_r().])
2648 AC_MSG_CHECKING([gethostbyname_r with 5 args])
2658 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
2660 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2661 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
2662 [Define this if you have the 5-arg version of gethostbyname_r().])
2666 AC_MSG_CHECKING([gethostbyname_r with 3 args])
2672 struct hostent_data data;
2674 (void) gethostbyname_r(name, he, &data);
2676 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2677 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
2678 [Define this if you have the 3-arg version of gethostbyname_r().])
2687 AC_CHECK_FUNCS(gethostbyname)
2689 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
2690 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
2691 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
2692 AC_SUBST(HAVE_GETHOSTBYNAME_R)
2693 AC_SUBST(HAVE_GETHOSTBYNAME)
2695 # checks for system services
2698 # Linux requires this for correct f.p. operations
2699 AC_CHECK_FUNC(__fpu_control,
2701 [AC_CHECK_LIB(ieee, __fpu_control)
2704 # Check for --with-fpectl
2705 AC_MSG_CHECKING(for --with-fpectl)
2707 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
2709 if test "$withval" != no
2711 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
2712 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
2714 else AC_MSG_RESULT(no)
2716 [AC_MSG_RESULT(no)])
2718 # check for --with-libm=...
2720 case $ac_sys_system in
2725 AC_MSG_CHECKING(for --with-libm=STRING)
2727 AC_HELP_STRING(--with-libm=STRING, math library),
2729 if test "$withval" = no
2731 AC_MSG_RESULT(force LIBM empty)
2732 elif test "$withval" != yes
2734 AC_MSG_RESULT(set LIBM="$withval")
2735 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
2737 [AC_MSG_RESULT(default LIBM="$LIBM")])
2739 # check for --with-libc=...
2741 AC_MSG_CHECKING(for --with-libc=STRING)
2743 AC_HELP_STRING(--with-libc=STRING, C library),
2745 if test "$withval" = no
2747 AC_MSG_RESULT(force LIBC empty)
2748 elif test "$withval" != yes
2750 AC_MSG_RESULT(set LIBC="$withval")
2751 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
2753 [AC_MSG_RESULT(default LIBC="$LIBC")])
2755 # check for hypot() in math library
2758 AC_REPLACE_FUNCS(hypot)
2762 AC_CHECK_HEADER(wchar.h, [
2763 AC_DEFINE(HAVE_WCHAR_H, 1,
2764 [Define if the compiler provides a wchar.h header file.])
2770 # determine wchar_t size
2771 if test "$wchar_h" = yes
2773 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
2776 AC_MSG_CHECKING(for UCS-4 tcl)
2780 #if TCL_UTF_MAX != 6
2781 # error "NOT UCS4_TCL"
2783 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
2786 AC_MSG_RESULT($have_ucs4_tcl)
2788 # check whether wchar_t is signed or not
2789 if test "$wchar_h" = yes
2791 # check whether wchar_t is signed or not
2792 AC_MSG_CHECKING(whether wchar_t is signed)
2793 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
2798 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 1 : 0);
2801 ac_cv_wchar_t_signed=yes,
2802 ac_cv_wchar_t_signed=no,
2803 ac_cv_wchar_t_signed=yes)])
2804 AC_MSG_RESULT($ac_cv_wchar_t_signed)
2807 AC_MSG_CHECKING(what type to use for unicode)
2808 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2809 AC_ARG_ENABLE(unicode,
2810 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
2812 [enable_unicode=yes])
2814 if test $enable_unicode = yes
2816 # Without any arguments, Py_UNICODE defaults to two-byte mode
2817 case "$have_ucs4_tcl" in
2818 yes) enable_unicode="ucs4"
2820 *) enable_unicode="ucs2"
2825 AH_TEMPLATE(Py_UNICODE_SIZE,
2826 [Define as the size of the unicode type.])
2827 case "$enable_unicode" in
2828 ucs2) unicode_size="2"
2829 AC_DEFINE(Py_UNICODE_SIZE,2)
2831 ucs4) unicode_size="4"
2832 AC_DEFINE(Py_UNICODE_SIZE,4)
2836 AH_TEMPLATE(PY_UNICODE_TYPE,
2837 [Define as the integral type used for Unicode representation.])
2839 AC_SUBST(UNICODE_OBJS)
2840 if test "$enable_unicode" = "no"
2843 AC_MSG_RESULT(not used)
2845 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
2846 AC_DEFINE(Py_USING_UNICODE, 1,
2847 [Define if you want to have a Unicode type.])
2849 # wchar_t is only usable if it maps to an unsigned type
2850 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
2851 -a "$ac_cv_wchar_t_signed" = "no"
2853 PY_UNICODE_TYPE="wchar_t"
2854 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
2855 [Define if you have a useable wchar_t type defined in wchar.h; useable
2856 means wchar_t must be an unsigned type with at least 16 bits. (see
2857 Include/unicodeobject.h).])
2858 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
2859 elif test "$ac_cv_sizeof_short" = "$unicode_size"
2861 PY_UNICODE_TYPE="unsigned short"
2862 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
2863 elif test "$ac_cv_sizeof_long" = "$unicode_size"
2865 PY_UNICODE_TYPE="unsigned long"
2866 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
2868 PY_UNICODE_TYPE="no type found"
2870 AC_MSG_RESULT($PY_UNICODE_TYPE)
2873 # check for endianness
2876 # Check whether right shifting a negative integer extends the sign bit
2877 # or fills with zeros (like the Cray J90, according to Tim Peters).
2878 AC_MSG_CHECKING(whether right shift extends the sign bit)
2879 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
2883 exit(((-1)>>3 == -1) ? 0 : 1);
2886 ac_cv_rshift_extends_sign=yes,
2887 ac_cv_rshift_extends_sign=no,
2888 ac_cv_rshift_extends_sign=yes)])
2889 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
2890 if test "$ac_cv_rshift_extends_sign" = no
2892 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
2893 [Define if i>>j for signed int i does not extend the sign bit
2897 # check for getc_unlocked and related locking functions
2898 AC_MSG_CHECKING(for getc_unlocked() and friends)
2899 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
2900 AC_TRY_LINK([#include <stdio.h>],[
2901 FILE *f = fopen("/dev/null", "r");
2905 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
2906 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
2907 if test "$ac_cv_have_getc_unlocked" = yes
2909 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
2910 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
2913 # check where readline lives
2914 # save the value of LIBS so we don't actually link Python with readline
2915 LIBS_no_readline=$LIBS
2916 AC_CHECK_LIB(readline, readline)
2917 if test "$ac_cv_have_readline_readline" = no
2919 AC_CHECK_LIB(termcap, readline)
2922 # check for readline 2.1
2923 AC_CHECK_LIB(readline, rl_callback_handler_install,
2924 AC_DEFINE(HAVE_RL_CALLBACK, 1,
2925 [Define if you have readline 2.1]), , )
2927 # check for readline 2.2
2928 AC_TRY_CPP([#include <readline/readline.h>],
2929 have_readline=yes, have_readline=no)
2930 if test $have_readline = yes
2932 AC_EGREP_HEADER([extern int rl_completion_append_character;],
2933 [readline/readline.h],
2934 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
2935 [Define if you have readline 2.2]), )
2938 # check for readline 4.0
2939 AC_CHECK_LIB(readline, rl_pre_input_hook,
2940 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
2941 [Define if you have readline 4.0]), , )
2943 # check for readline 4.2
2944 AC_CHECK_LIB(readline, rl_completion_matches,
2945 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
2946 [Define if you have readline 4.2]), , )
2948 # also in readline 4.2
2949 AC_TRY_CPP([#include <readline/readline.h>],
2950 have_readline=yes, have_readline=no)
2951 if test $have_readline = yes
2953 AC_EGREP_HEADER([extern int rl_catch_signals;],
2954 [readline/readline.h],
2955 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
2956 [Define if you can turn off readline's signal handling.]), )
2959 # End of readline checks: restore LIBS
2960 LIBS=$LIBS_no_readline
2962 AC_MSG_CHECKING(for broken nice())
2963 AC_CACHE_VAL(ac_cv_broken_nice, [
2968 if (val1 != -1 && val1 == nice(2))
2973 ac_cv_broken_nice=yes,
2974 ac_cv_broken_nice=no,
2975 ac_cv_broken_nice=no)])
2976 AC_MSG_RESULT($ac_cv_broken_nice)
2977 if test "$ac_cv_broken_nice" = yes
2979 AC_DEFINE(HAVE_BROKEN_NICE, 1,
2980 [Define if nice() returns success/failure instead of the new priority.])
2983 AC_MSG_CHECKING(for broken poll())
2989 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
2993 int poll_test = poll (&poll_struct, 1, 0);
2999 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
3009 ac_cv_broken_poll=yes,
3010 ac_cv_broken_poll=no,
3011 ac_cv_broken_poll=no)
3012 AC_MSG_RESULT($ac_cv_broken_poll)
3013 if test "$ac_cv_broken_poll" = yes
3015 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3016 [Define if poll() sets errno on invalid file descriptors.])
3019 # Before we can test tzset, we need to check if struct tm has a tm_zone
3020 # (which is not required by ISO C or UNIX spec) and/or if we support
3024 # check tzset(3) exists and works like we expect it to
3025 AC_MSG_CHECKING(for working tzset())
3026 AC_CACHE_VAL(ac_cv_working_tzset, [
3033 extern char *tzname[];
3038 /* Note that we need to ensure that not only does tzset(3)
3039 do 'something' with localtime, but it works as documented
3040 in the library reference and as expected by the test suite.
3041 This includes making sure that tzname is set properly if
3042 tm->tm_zone does not exist since it is the alternative way
3043 of getting timezone info.
3045 Red Hat 6.2 doesn't understand the southern hemisphere
3046 after New Year's Day.
3049 time_t groundhogday = 1044144000; /* GMT-based */
3050 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3054 if (localtime(&groundhogday)->tm_hour != 0)
3057 /* For UTC, tzname[1] is sometimes "", sometimes " " */
3058 if (strcmp(tzname[0], "UTC") ||
3059 (tzname[1][0] != 0 && tzname[1][0] != ' '))
3063 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
3065 if (localtime(&groundhogday)->tm_hour != 19)
3068 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
3072 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
3074 if (localtime(&groundhogday)->tm_hour != 11)
3077 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
3081 #if HAVE_STRUCT_TM_TM_ZONE
3082 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
3084 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
3091 ac_cv_working_tzset=yes,
3092 ac_cv_working_tzset=no,
3093 ac_cv_working_tzset=no)])
3094 AC_MSG_RESULT($ac_cv_working_tzset)
3095 if test "$ac_cv_working_tzset" = yes
3097 AC_DEFINE(HAVE_WORKING_TZSET, 1,
3098 [Define if tzset() actually switches the local timezone in a meaningful way.])
3101 # Look for subsecond timestamps in struct stat
3102 AC_MSG_CHECKING(for tv_nsec in struct stat)
3103 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
3104 AC_TRY_COMPILE([#include <sys/stat.h>], [
3106 st.st_mtim.tv_nsec = 1;
3108 ac_cv_stat_tv_nsec=yes,
3109 ac_cv_stat_tv_nsec=no,
3110 ac_cv_stat_tv_nsec=no))
3111 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
3112 if test "$ac_cv_stat_tv_nsec" = yes
3114 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
3115 [Define if you have struct stat.st_mtim.tv_nsec])
3118 # Look for BSD style subsecond timestamps in struct stat
3119 AC_MSG_CHECKING(for tv_nsec2 in struct stat)
3120 AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
3121 AC_TRY_COMPILE([#include <sys/stat.h>], [
3123 st.st_mtimespec.tv_nsec = 1;
3125 ac_cv_stat_tv_nsec2=yes,
3126 ac_cv_stat_tv_nsec2=no,
3127 ac_cv_stat_tv_nsec2=no))
3128 AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
3129 if test "$ac_cv_stat_tv_nsec2" = yes
3131 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
3132 [Define if you have struct stat.st_mtimensec])
3135 # On HP/UX 11.0, mvwdelch is a block with a return statement
3136 AC_MSG_CHECKING(whether mvwdelch is an expression)
3137 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
3138 AC_TRY_COMPILE([#include <curses.h>], [
3140 rtn = mvwdelch(0,0,0);
3141 ], ac_cv_mvwdelch_is_expression=yes,
3142 ac_cv_mvwdelch_is_expression=no,
3143 ac_cv_mvwdelch_is_expression=yes))
3144 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
3146 if test "$ac_cv_mvwdelch_is_expression" = yes
3148 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
3149 [Define if mvwdelch in curses.h is an expression.])
3152 AC_MSG_CHECKING(whether WINDOW has _flags)
3153 AC_CACHE_VAL(ac_cv_window_has_flags,
3154 AC_TRY_COMPILE([#include <curses.h>], [
3157 ], ac_cv_window_has_flags=yes,
3158 ac_cv_window_has_flags=no,
3159 ac_cv_window_has_flags=no))
3160 AC_MSG_RESULT($ac_cv_window_has_flags)
3163 if test "$ac_cv_window_has_flags" = yes
3165 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
3166 [Define if WINDOW in curses.h offers a field _flags.])
3169 AC_MSG_CHECKING(for /dev/ptmx)
3171 if test -e /dev/ptmx
3174 AC_DEFINE(HAVE_DEV_PTMX, 1,
3175 [Define if we have /dev/ptmx.])
3180 AC_MSG_CHECKING(for /dev/ptc)
3185 AC_DEFINE(HAVE_DEV_PTC, 1,
3186 [Define if we have /dev/ptc.])
3191 AC_CHECK_TYPE(socklen_t,,
3192 AC_DEFINE(socklen_t,int,
3193 Define to `int' if <sys/socket.h> does not define.),[
3194 #ifdef HAVE_SYS_TYPES_H
3195 #include <sys/types.h>
3197 #ifdef HAVE_SYS_SOCKET_H
3198 #include <sys/socket.h>
3202 AC_SUBST(THREADHEADERS)
3204 for h in `(cd $srcdir;echo Python/thread_*.h)`
3206 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
3210 SRCDIRS="Parser Grammar Objects Python Modules Mac"
3211 AC_MSG_CHECKING(for build directories)
3212 for dir in $SRCDIRS; do
3213 if test ! -d $dir; then
3219 # generate output files
3220 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
3223 echo "creating Setup"
3224 if test ! -f Modules/Setup
3226 cp $srcdir/Modules/Setup.dist Modules/Setup
3229 echo "creating Setup.local"
3230 if test ! -f Modules/Setup.local
3232 echo "# Edit this file for local setup changes" >Modules/Setup.local
3235 echo "creating Makefile"
3236 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
3237 -s Modules Modules/Setup.config \
3238 Modules/Setup.local Modules/Setup