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.@<:@0123456@:>@)
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 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
175 # disables platform specific features beyond repair.
177 define_xopen_source=no
182 if test $define_xopen_source = yes
184 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
185 # defined precisely as g++ defines it
186 case $ac_sys_system/$ac_sys_release in
188 AC_DEFINE(_XOPEN_SOURCE, 500,
189 Define to the level of X/Open that your system supports)
192 AC_DEFINE(_XOPEN_SOURCE, 600,
193 Define to the level of X/Open that your system supports)
197 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
198 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
199 # several APIs are not declared. Since this is also needed in some
200 # cases for HP-UX, we define it globally.
202 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Define to activate Unix95-and-earlier features)
204 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
209 # SGI compilers allow the specification of the both the ABI and the
210 # ISA on the command line. Depending on the values of these switches,
211 # different and often incompatable code will be generated.
213 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
214 # thus supply support for various ABI/ISA combinations. The MACHDEP
215 # variable is also adjusted.
218 if test ! -z "$SGI_ABI"
221 LDFLAGS="$SGI_ABI $LDFLAGS"
222 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
224 AC_MSG_RESULT($MACHDEP)
226 # And add extra plat-mac for darwin
227 AC_SUBST(EXTRAPLATDIR)
228 AC_SUBST(EXTRAMACHDEPPATH)
229 AC_MSG_CHECKING(EXTRAPLATDIR)
230 if test -z "$EXTRAPLATDIR"
234 EXTRAPLATDIR="\$(PLATMACDIRS)"
235 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
243 AC_MSG_RESULT($EXTRAPLATDIR)
245 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
246 # it may influence the way we can build extensions, so distutils
248 AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
249 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
251 # checks for alternative programs
253 # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
254 # for debug/optimization stuff. BASECFLAGS is for flags that are required
255 # just to get things to compile and link. Users are free to override OPT
256 # when running configure or make. The build should not break if they do.
257 # BASECFLAGS should generally not be messed with, however.
259 # XXX shouldn't some/most/all of this code be merged with the stuff later
260 # on that fiddles with OPT and BASECFLAGS?
261 AC_MSG_CHECKING(for --without-gcc)
263 AC_HELP_STRING(--without-gcc,never use gcc),
271 without_gcc=$withval;;
273 case $ac_sys_system in
281 BASECFLAGS="$BASECFLAGS -export pragma"
283 LDFLAGS="$LDFLAGS -nodup"
291 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
294 AR="\$(srcdir)/Modules/ar_beos"
302 AC_MSG_RESULT($without_gcc)
307 AC_MSG_CHECKING(for --with-cxx=<compiler>)
309 AC_HELP_STRING(--with-cxx=<compiler>, enable C++ support),
322 AC_MSG_RESULT($with_cxx)
324 if test "$with_cxx" = "yes"
326 AC_MSG_ERROR([must supply a compiler when using --with-cxx])
329 dnl The following fragment works similar to AC_PROG_CXX.
330 dnl It does not fail if CXX is not found, and it is not executed if
331 dnl --without-cxx was given.
332 dnl Finally, it does not test whether CXX is g++.
334 dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
335 ifdef([AC_PROG_CXX_WORKS],[],
336 [AC_DEFUN([AC_PROG_CXX_WORKS],
337 [AC_LANG_PUSH(C++)dnl
343 if test "$check_cxx" = "yes"
345 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
346 if test "$CXX" = "notfound"
354 # If the user switches compilers, we can't believe the cache
355 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
357 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
358 (it is also a good idea to do 'make clean' before compiling)])
363 # checks for UNIX variants that set C preprocessor variables
366 # Check for unsupported systems
367 case $ac_sys_system/$ac_sys_release in
369 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
370 echo See README for details.
375 AC_MSG_CHECKING(for --with-suffix)
377 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
384 AC_MSG_RESULT($EXEEXT)
386 # Test whether we're running on a non-case-sensitive system, in which
387 # case we give a warning if no ext is given
388 AC_SUBST(BUILDEXEEXT)
389 AC_MSG_CHECKING(for case-insensitive build directory)
390 if test ! -d CaseSensitiveTestDir; then
391 mkdir CaseSensitiveTestDir
394 if test -d casesensitivetestdir
402 rmdir CaseSensitiveTestDir
407 gcc) CC="$CC -D_HAVE_BSDI";;
411 case $ac_sys_system in
414 cc|*/cc) CC="$CC -Ae";;
418 cc) CC="$CC -Wl,-Bexport";;
421 # Some functions have a prototype only with that define, e.g. confstr
422 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
428 AC_MSG_CHECKING(LIBRARY)
429 if test -z "$LIBRARY"
431 LIBRARY='libpython$(VERSION).a'
433 AC_MSG_RESULT($LIBRARY)
435 # LDLIBRARY is the name of the library to link against (as opposed to the
436 # name of the library into which to insert object files). BLDLIBRARY is also
437 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
438 # is blank as the main program is not linked directly against LDLIBRARY.
439 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
440 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
441 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
442 # DLLLIBRARY is the shared (i.e., DLL) library.
444 # RUNSHARED is used to run shared python without installed libraries
446 # INSTSONAME is the name of the shared library that will be use to install
447 # on the system - some systems like version suffix, others don't
451 AC_SUBST(LDLIBRARYDIR)
455 BLDLIBRARY='$(LDLIBRARY)'
456 INSTSONAME='$(LDLIBRARY)'
461 # LINKCC is the command that links the python executable -- default is $(CC).
462 # If CXX is set, and if it is needed to link a main function that was
463 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
464 # python might then depend on the C++ runtime
465 # This is altered for AIX in order to build the export list before
468 AC_MSG_CHECKING(LINKCC)
471 if test -z "$CXX"; then
472 LINKCC="\$(PURIFY) \$(CC)"
474 echo 'extern "C" void foo();int main(){foo();}' > conftest_a.cc
475 $CXX -c conftest_a.cc # 2>&5
476 echo 'void foo(){}' > conftest_b.$ac_ext
477 $CC -c conftest_b.$ac_ext # 2>&5
478 if $CC -o conftest$ac_exeext conftest_a.$ac_objext conftest_b.$ac_objext 2>&5 \
479 && test -s conftest$ac_exeext && ./conftest$ac_exeext
481 LINKCC="\$(PURIFY) \$(CC)"
483 LINKCC="\$(PURIFY) \$(CXX)"
487 case $ac_sys_system in
490 if test $ac_sys_release -ge 5 -o \
491 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
494 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
496 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
499 AC_MSG_RESULT($LINKCC)
501 AC_MSG_CHECKING(for --enable-shared)
502 AC_ARG_ENABLE(shared,
503 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
505 if test -z "$enable_shared"
507 case $ac_sys_system in
509 enable_shared="yes";;
514 AC_MSG_RESULT($enable_shared)
516 AC_MSG_CHECKING(for --enable-profiling)
517 AC_ARG_ENABLE(profiling,
518 AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
521 AC_TRY_RUN([int main() { return 0; }],
522 ac_enable_profiling="yes",
523 ac_enable_profiling="no",
524 ac_enable_profiling="no")
526 AC_MSG_RESULT($ac_enable_profiling)
528 case "$ac_enable_profiling" in
530 BASECFLAGS="-pg $BASECFLAGS"
531 LDFLAGS="-pg $LDFLAGS"
535 AC_MSG_CHECKING(LDLIBRARY)
537 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
538 # library that we build, but we do not want to link against it (we
539 # will find it with a -framework option). For this reason there is an
540 # extra variable BLDLIBRARY against which Python and the extension
541 # modules are linked, BLDLIBRARY. This is normally the same as
542 # LDLIBRARY, but empty for MacOSX framework builds.
543 if test "$enable_framework"
545 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
546 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
549 BLDLIBRARY='$(LDLIBRARY)'
552 # Other platforms follow
553 if test $enable_shared = "yes"; then
554 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
555 case $ac_sys_system in
557 LDLIBRARY='libpython$(VERSION).so'
560 LDLIBRARY='libpython$(VERSION).dll.a'
561 DLLLIBRARY='libpython$(VERSION).dll'
564 LDLIBRARY='libpython$(VERSION).so'
565 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
566 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
567 INSTSONAME="$LDLIBRARY".$SOVERSION
569 Linux*|GNU*|NetBSD*|FreeBSD*)
570 LDLIBRARY='libpython$(VERSION).so'
571 BLDLIBRARY='-L. -lpython$(VERSION)'
572 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
573 case $ac_sys_system in
575 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
578 INSTSONAME="$LDLIBRARY".$SOVERSION
581 LDLIBRARY='libpython$(VERSION).sl'
582 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
583 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
586 LDLIBRARY='libpython$(VERSION).so'
587 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
588 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
591 LDLIBRARY='libpython$(VERSION).so'
592 BLDLIBRARY='-L. -lpython$(VERSION)'
593 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
596 else # shared is disabled
597 case $ac_sys_system in
599 BLDLIBRARY='$(LIBRARY)'
600 LDLIBRARY='libpython$(VERSION).dll.a'
605 AC_MSG_RESULT($LDLIBRARY)
609 AC_CHECK_PROGS(AR, ar aal, ar)
613 # install -d does not work on BSDI or HP-UX
614 if test -z "$INSTALL"
616 INSTALL="${srcdir}/install-sh -c"
621 # Not every filesystem supports hard links
623 if test -z "$LN" ; then
624 case $ac_sys_system in
626 CYGWIN*) LN="ln -s";;
627 atheos*) LN="ln -s";;
632 # Check for --with-pydebug
633 AC_MSG_CHECKING(for --with-pydebug)
635 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
637 if test "$withval" != no
639 AC_DEFINE(Py_DEBUG, 1,
640 [Define if you want to build an interpreter with many run-time checks.])
643 else AC_MSG_RESULT(no); Py_DEBUG='false'
647 # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
648 # merged with this chunk of code?
650 # Optimizer/debugger flags
651 # ------------------------
652 # (The following bit of code is complicated enough - please keep things
653 # indented properly. Just pretend you're editing Python code. ;-)
655 # There are two parallel sets of case statements below, one that checks to
656 # see if OPT was set and one that does BASECFLAGS setting based upon
657 # compiler and platform. BASECFLAGS tweaks need to be made even if the
660 # tweak OPT based on compiler and platform, only if the user didn't set
661 # it on the command line
667 case $ac_cv_prog_cc_g in
669 if test "$Py_DEBUG" = 'true' ; then
670 # Optimization messes up debuggers, so turn it off for
672 OPT="-g -Wall -Wstrict-prototypes"
674 OPT="-g -O3 -Wall -Wstrict-prototypes"
678 OPT="-O3 -Wall -Wstrict-prototypes"
681 case $ac_sys_system in
682 SCO_SV*) OPT="$OPT -m486 -DSCO5"
692 # The current (beta) Monterey compiler dies with optimizations
693 # XXX what is Monterey? Does it still die w/ -O? Can we get rid of this?
694 case $ac_sys_system in
703 # tweak BASECFLAGS based on compiler and platform
706 # Python violates C99 rules, by casting between incompatible
707 # pointer types. GCC may generate bad code as a result of that,
708 # so use -fno-strict-aliasing if supported.
709 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
711 CC="$CC -fno-strict-aliasing"
712 AC_TRY_RUN([int main() { return 0; }],
713 ac_cv_no_strict_aliasing_ok=yes,
714 ac_cv_no_strict_aliasing_ok=no,
715 ac_cv_no_strict_aliasing_ok=no)
717 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
718 if test $ac_cv_no_strict_aliasing_ok = yes
720 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
722 case $ac_sys_system in
724 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
726 # is there any other compiler on Darwin besides gcc?
728 BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
734 case $ac_sys_system in
736 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
739 BASECFLAGS="$BASECFLAGS -ieee -std"
742 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
748 if test "$Py_DEBUG" = 'true'; then
754 if test "$ac_arch_flags"
756 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
759 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
760 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
762 CC="$CC -OPT:Olimit=0"
763 AC_TRY_RUN([int main() { return 0; }],
764 ac_cv_opt_olimit_ok=yes,
765 ac_cv_opt_olimit_ok=no,
766 ac_cv_opt_olimit_ok=no)
768 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
769 if test $ac_cv_opt_olimit_ok = yes; then
770 case $ac_sys_system in
771 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
772 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
777 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
781 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
782 AC_CACHE_VAL(ac_cv_olimit_ok,
784 CC="$CC -Olimit 1500"
785 AC_TRY_RUN([int main() { return 0; }],
790 AC_MSG_RESULT($ac_cv_olimit_ok)
791 if test $ac_cv_olimit_ok = yes; then
792 BASECFLAGS="$BASECFLAGS -Olimit 1500"
796 # On some compilers, pthreads are available without further options
797 # (e.g. MacOS X). On some of these systems, the compiler will not
798 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
799 # So we have to see first whether pthreads are available without
800 # options before we can check whether -Kpthread improves anything.
801 AC_MSG_CHECKING(whether pthreads are available without options)
802 AC_CACHE_VAL(ac_cv_pthread_is_default,
806 void* routine(void* p){return NULL;}
810 if(pthread_create(&p,NULL,routine,NULL)!=0)
812 (void)pthread_detach(p);
817 ac_cv_pthread_is_default=yes
821 ac_cv_pthread_is_default=no,
822 ac_cv_pthread_is_default=no)
824 AC_MSG_RESULT($ac_cv_pthread_is_default)
827 if test $ac_cv_pthread_is_default = yes
831 # -Kpthread, if available, provides the right #defines
832 # and linker options to make pthread_create available
833 # Some compilers won't report that they do not support -Kpthread,
834 # so we need to run a program to see whether it really made the
835 # function available.
836 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
837 AC_CACHE_VAL(ac_cv_kpthread,
843 void* routine(void* p){return NULL;}
847 if(pthread_create(&p,NULL,routine,NULL)!=0)
849 (void)pthread_detach(p);
857 AC_MSG_RESULT($ac_cv_kpthread)
860 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
862 # -Kthread, if available, provides the right #defines
863 # and linker options to make pthread_create available
864 # Some compilers won't report that they do not support -Kthread,
865 # so we need to run a program to see whether it really made the
866 # function available.
867 AC_MSG_CHECKING(whether $CC accepts -Kthread)
868 AC_CACHE_VAL(ac_cv_kthread,
874 void* routine(void* p){return NULL;}
878 if(pthread_create(&p,NULL,routine,NULL)!=0)
880 (void)pthread_detach(p);
888 AC_MSG_RESULT($ac_cv_kthread)
891 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
893 # -pthread, if available, provides the right #defines
894 # and linker options to make pthread_create available
895 # Some compilers won't report that they do not support -pthread,
896 # so we need to run a program to see whether it really made the
897 # function available.
898 AC_MSG_CHECKING(whether $CC accepts -pthread)
899 AC_CACHE_VAL(ac_cv_thread,
905 void* routine(void* p){return NULL;}
909 if(pthread_create(&p,NULL,routine,NULL)!=0)
911 (void)pthread_detach(p);
919 AC_MSG_RESULT($ac_cv_pthread)
922 # If we have set a CC compiler flag for thread support then
923 # check if it works for CXX, too.
927 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
930 if test "$ac_cv_kpthread" = "yes"
934 elif test "$ac_cv_kthread" = "yes"
938 elif test "$ac_cv_pthread" = "yes"
944 if test $ac_cv_cxx_thread = yes
946 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
947 $CXX -c conftest.$ac_ext 2>&5
948 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
949 && test -s conftest$ac_exeext && ./conftest$ac_exeext
957 AC_MSG_RESULT($ac_cv_cxx_thread)
961 dnl # check for ANSI or K&R ("traditional") preprocessor
962 dnl AC_MSG_CHECKING(for C preprocessor type)
964 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
966 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
967 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
968 dnl AC_MSG_RESULT($cpp_type)
970 # checks for header files
972 AC_CHECK_HEADERS(curses.h dlfcn.h fcntl.h grp.h shadow.h langinfo.h \
973 libintl.h ncurses.h poll.h pthread.h \
974 stropts.h termios.h thread.h \
976 sys/audioio.h sys/bsdtty.h sys/file.h sys/loadavg.h sys/lock.h sys/mkdev.h \
978 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
979 sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
980 sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
981 bluetooth/bluetooth.h)
985 # On Solaris, term.h requires curses.h
986 AC_CHECK_HEADERS(term.h,,,[
992 # checks for typedefs
994 AC_MSG_CHECKING(for clock_t in time.h)
995 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
996 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
998 AC_MSG_RESULT($was_it_defined)
1000 # Check whether using makedev requires defining _OSF_SOURCE
1001 AC_MSG_CHECKING(for makedev)
1002 AC_TRY_LINK([#include <sys/types.h> ],
1004 ac_cv_has_makedev=yes,
1005 ac_cv_has_makedev=no)
1006 if test "$ac_cv_has_makedev" = "no"; then
1007 # we didn't link, try if _OSF_SOURCE will allow us to link
1009 #define _OSF_SOURCE 1
1010 #include <sys/types.h>
1013 ac_cv_has_makedev=yes,
1014 ac_cv_has_makedev=no)
1015 if test "$ac_cv_has_makedev" = "yes"; then
1016 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1019 AC_MSG_RESULT($ac_cv_has_makedev)
1020 if test "$ac_cv_has_makedev" = "yes"; then
1021 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1024 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1025 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1026 # defined, but the compiler does not support pragma redefine_extname,
1027 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1028 # structures (such as rlimit64) without declaring them. As a
1029 # work-around, disable LFS on such configurations
1032 AC_MSG_CHECKING(Solaris LFS bug)
1034 #define _LARGEFILE_SOURCE 1
1035 #define _FILE_OFFSET_BITS 64
1036 #include <sys/resource.h>
1037 ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1038 AC_MSG_RESULT($sol_lfs_bug)
1039 if test "$sol_lfs_bug" = "yes"; then
1043 if test "$use_lfs" = "yes"; then
1044 # Two defines needed to enable largefile support on various platforms
1045 # These may affect some typedefs
1046 AC_DEFINE(_LARGEFILE_SOURCE, 1,
1047 [This must be defined on some systems to enable large file support.])
1048 AC_DEFINE(_FILE_OFFSET_BITS, 64,
1049 [This must be set to 64 on some systems to enable large file support.])
1052 # Add some code to confdefs.h so that the test for off_t works on SCO
1053 cat >> confdefs.h <<\EOF
1059 # Type availability checks
1067 # Sizes of various common basic types
1068 # ANSI C requires sizeof(char) == 1, so no need to check it
1069 AC_CHECK_SIZEOF(int, 4)
1070 AC_CHECK_SIZEOF(long, 4)
1071 AC_CHECK_SIZEOF(void *, 4)
1072 AC_CHECK_SIZEOF(short, 2)
1073 AC_CHECK_SIZEOF(float, 4)
1074 AC_CHECK_SIZEOF(double, 8)
1075 AC_CHECK_SIZEOF(fpos_t, 4)
1077 AC_MSG_CHECKING(for long long support)
1079 AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1080 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1083 AC_MSG_RESULT($have_long_long)
1084 if test "$have_long_long" = yes ; then
1085 AC_CHECK_SIZEOF(long long, 8)
1088 AC_MSG_CHECKING(for uintptr_t support)
1090 AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
1091 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
1094 AC_MSG_RESULT($have_uintptr_t)
1095 if test "$have_uintptr_t" = yes ; then
1096 AC_CHECK_SIZEOF(uintptr_t, 4)
1099 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
1100 AC_MSG_CHECKING(size of off_t)
1101 AC_CACHE_VAL(ac_cv_sizeof_off_t,
1102 [AC_TRY_RUN([#include <stdio.h>
1103 #include <sys/types.h>
1106 FILE *f=fopen("conftestval", "w");
1108 fprintf(f, "%d\n", sizeof(off_t));
1111 ac_cv_sizeof_off_t=`cat conftestval`,
1112 ac_cv_sizeof_off_t=0,
1113 ac_cv_sizeof_off_t=4)
1115 AC_MSG_RESULT($ac_cv_sizeof_off_t)
1116 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1117 [The number of bytes in an off_t.])
1119 AC_MSG_CHECKING(whether to enable large file support)
1120 if test "$have_long_long" = yes -a \
1121 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1122 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1123 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1124 [Defined to enable large file support when an off_t is bigger than a long
1125 and long long is available and at least as big as an off_t. You may need
1126 to add some flags for configuration and compilation to enable this mode.
1127 (For Solaris and Linux, the necessary defines are already defined.)])
1133 # AC_CHECK_SIZEOF() doesn't include <time.h>.
1134 AC_MSG_CHECKING(size of time_t)
1135 AC_CACHE_VAL(ac_cv_sizeof_time_t,
1136 [AC_TRY_RUN([#include <stdio.h>
1140 FILE *f=fopen("conftestval", "w");
1142 fprintf(f, "%d\n", sizeof(time_t));
1145 ac_cv_sizeof_time_t=`cat conftestval`,
1146 ac_cv_sizeof_time_t=0,
1147 ac_cv_sizeof_time_t=4)
1149 AC_MSG_RESULT($ac_cv_sizeof_time_t)
1150 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
1151 [The number of bytes in a time_t.])
1154 # if have pthread_t then define SIZEOF_PTHREAD_T
1156 if test "$ac_cv_kpthread" = "yes"
1157 then CC="$CC -Kpthread"
1158 elif test "$ac_cv_kthread" = "yes"
1159 then CC="$CC -Kthread"
1160 elif test "$ac_cv_pthread" = "yes"
1161 then CC="$CC -pthread"
1163 AC_MSG_CHECKING(for pthread_t)
1165 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
1166 AC_MSG_RESULT($have_pthread_t)
1167 if test "$have_pthread_t" = yes ; then
1168 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
1169 AC_MSG_CHECKING(size of pthread_t)
1170 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
1171 [AC_TRY_RUN([#include <stdio.h>
1172 #include <pthread.h>
1175 FILE *f=fopen("conftestval", "w");
1177 fprintf(f, "%d\n", sizeof(pthread_t));
1180 ac_cv_sizeof_pthread_t=`cat conftestval`,
1181 ac_cv_sizeof_pthread_t=0,
1182 ac_cv_sizeof_pthread_t=4)
1184 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
1185 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
1186 [The number of bytes in a pthread_t.])
1190 AC_MSG_CHECKING(for --enable-toolbox-glue)
1191 AC_ARG_ENABLE(toolbox-glue,
1192 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
1194 if test -z "$enable_toolbox_glue"
1196 case $ac_sys_system/$ac_sys_release in
1198 enable_toolbox_glue="yes";;
1200 enable_toolbox_glue="no";;
1203 case "$enable_toolbox_glue" in
1205 extra_machdep_objs="Python/mactoolboxglue.o"
1206 extra_undefs="-u _PyMac_Error"
1207 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1208 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
1211 extra_machdep_objs=""
1215 AC_MSG_RESULT($enable_toolbox_glue)
1217 AC_SUBST(OTHER_LIBTOOL_OPT)
1218 case $ac_sys_system/$ac_sys_release in
1219 Darwin/@<:@01234567@:>@.*)
1220 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1223 OTHER_LIBTOOL_OPT=""
1227 AC_SUBST(LIBTOOL_CRUFT)
1228 case $ac_sys_system/$ac_sys_release in
1229 Darwin/@<:@01234567@:>@.*)
1230 LIBTOOL_CRUFT="-framework System -lcc_dynamic -arch_only ppc"
1231 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1232 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1234 gcc_version=`gcc -v 2>&1 | grep version | cut -d\ -f3`
1235 if test ${gcc_version} '<' 4.0
1237 LIBTOOL_CRUFT="-lcc_dynamic"
1241 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -lSystem -lSystemStubs -arch_only ppc'
1242 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1243 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1246 AC_MSG_CHECKING(for --enable-framework)
1247 if test "$enable_framework"
1249 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
1250 # -F. is needed to allow linking to the framework while
1251 # in the build location.
1252 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1253 [Define if you want to produce an OpenStep/Rhapsody framework
1254 (shared library plus accessory files).])
1260 AC_MSG_CHECKING(for dyld)
1261 case $ac_sys_system/$ac_sys_release in
1263 AC_DEFINE(WITH_DYLD, 1,
1264 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1265 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1266 linker (rld). Dyld is necessary to support frameworks.])
1267 AC_MSG_RESULT(always on for Darwin)
1274 # Set info about shared libraries.
1279 AC_SUBST(LINKFORSHARED)
1280 # SO is the extension of shared libraries `(including the dot!)
1281 # -- usually .so, .sl on HP-UX, .dll on Cygwin
1285 case $ac_sys_system in
1291 # this might also be a termcap variable, see #610332
1293 echo '====================================================================='
1295 echo '+ WARNING: You have set SO in your environment. +'
1296 echo '+ Do you really mean to change the extension for shared libraries? +'
1297 echo '+ Continuing in 10 seconds to let you to ponder. +'
1299 echo '====================================================================='
1303 # LDSHARED is the ld *command* used to create shared library
1304 # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
1305 # (Shared libraries in this instance are shared modules to be loaded into
1306 # Python, as opposed to building Python itself as a shared library.)
1307 AC_MSG_CHECKING(LDSHARED)
1308 if test -z "$LDSHARED"
1310 case $ac_sys_system/$ac_sys_release in
1312 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
1313 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
1316 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
1317 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
1319 IRIX/5*) LDSHARED="ld -shared";;
1320 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1322 if test "$GCC" = "yes"
1323 then LDSHARED='$(CC) -shared'
1324 else LDSHARED='$(CC) -G';
1326 hp*|HP*) LDSHARED="ld -b";;
1327 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1329 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1330 if test "$enable_framework" ; then
1331 # Link against the framework. All externals should be defined.
1332 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1333 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1335 # No framework. Ignore undefined symbols, assuming they come from Python
1336 LDSHARED="$LDSHARED -undefined suppress"
1338 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
1339 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1340 if test "$enable_framework" ; then
1341 # Link against the framework. All externals should be defined.
1342 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1343 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1345 # No framework, use the Python app as bundle-loader
1346 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1347 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1350 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1351 # This allows an extension to be used in any Python
1352 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
1353 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1354 if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
1356 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1357 BLDSHARED="$LDSHARED"
1359 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1360 if test "$enable_framework" ; then
1361 # Link against the framework. All externals should be defined.
1362 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1363 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1365 # No framework, use the Python app as bundle-loader
1366 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1367 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1371 Linux*|GNU*) LDSHARED='$(CC) -shared';;
1372 BSD/OS*/4*) LDSHARED="gcc -shared";;
1374 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1376 LDSHARED="$CC -shared ${LDFLAGS}"
1378 LDSHARED="ld -Bshareable ${LDFLAGS}"
1380 NetBSD*) LDSHARED="cc -shared ${LDFLAGS}";;
1381 OpenUNIX*|UnixWare*)
1382 if test "$GCC" = "yes"
1383 then LDSHARED='$(CC) -shared'
1384 else LDSHARED='$(CC) -G'
1386 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1387 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
1388 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1389 atheos*) LDSHARED="gcc -shared";;
1393 AC_MSG_RESULT($LDSHARED)
1394 BLDSHARED=${BLDSHARED-$LDSHARED}
1395 # CCSHARED are the C *flags* used to create objects to go into a shared
1396 # library (module) -- this is only needed for a few systems
1397 AC_MSG_CHECKING(CCSHARED)
1398 if test -z "$CCSHARED"
1400 case $ac_sys_system/$ac_sys_release in
1401 SunOS*) if test "$GCC" = yes;
1402 then CCSHARED="-fPIC";
1404 hp*|HP*) if test "$GCC" = yes;
1405 then CCSHARED="-fPIC";
1408 Linux*|GNU*) CCSHARED="-fPIC";;
1409 BSD/OS*/4*) CCSHARED="-fpic";;
1410 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
1411 OpenUNIX*|UnixWare*)
1412 if test "$GCC" = "yes"
1413 then CCSHARED="-fPIC"
1414 else CCSHARED="-KPIC"
1417 if test "$GCC" = "yes"
1418 then CCSHARED="-fPIC"
1419 else CCSHARED="-Kpic -belf"
1421 Monterey*) CCSHARED="-G";;
1422 IRIX*/6*) case $CC in
1423 *gcc*) CCSHARED="-shared";;
1426 atheos*) CCSHARED="-fPIC";;
1429 AC_MSG_RESULT($CCSHARED)
1430 # LINKFORSHARED are the flags passed to the $(CC) command that links
1431 # the python executable -- this is only needed for a few systems
1432 AC_MSG_CHECKING(LINKFORSHARED)
1433 if test -z "$LINKFORSHARED"
1435 case $ac_sys_system/$ac_sys_release in
1436 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1438 LINKFORSHARED="-Wl,-E -Wl,+s";;
1439 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1440 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1441 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1442 # -u libsys_s pulls in all symbols in libsys
1444 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1446 # not used by the core itself but which needs to be in the core so
1447 # that dynamically loaded extension modules have access to it.
1448 # -prebind is no longer used, because it actually seems to give a
1449 # slowdown in stead of a speedup, maybe due to the large number of
1450 # dynamic loads Python does.
1452 LINKFORSHARED="$extra_undefs"
1453 if test "$enable_framework"
1455 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1457 LINKFORSHARED="$LINKFORSHARED";;
1458 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1459 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1460 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1461 FreeBSD*|NetBSD*|OpenBSD*)
1462 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1464 LINKFORSHARED="-Wl,--export-dynamic"
1466 SunOS/5*) case $CC in
1468 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
1470 LINKFORSHARED="-Xlinker --export-dynamic"
1474 if test $enable_shared = "no"
1476 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1480 AC_MSG_RESULT($LINKFORSHARED)
1482 AC_SUBST(CFLAGSFORSHARED)
1483 AC_MSG_CHECKING(CFLAGSFORSHARED)
1484 if test ! "$LIBRARY" = "$LDLIBRARY"
1486 case $ac_sys_system in
1488 # Cygwin needs CCSHARED when building extension DLLs
1489 # but not when building the interpreter DLL.
1490 CFLAGSFORSHARED='';;
1492 CFLAGSFORSHARED='$(CCSHARED)'
1495 AC_MSG_RESULT($CFLAGSFORSHARED)
1497 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
1498 # library (with --enable-shared).
1499 # For platforms on which shared libraries are not allowed to have unresolved
1500 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
1501 # if it is not required, since it creates a dependency of the shared library
1502 # to LIBS. This, in turn, means that applications linking the shared libpython
1503 # don't need to link LIBS explicitly. The default should be only changed
1504 # on systems where this approach causes problems.
1506 AC_MSG_CHECKING(SHLIBS)
1507 case "$ac_sys_system" in
1511 AC_MSG_RESULT($SHLIBS)
1514 # checks for libraries
1515 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1516 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
1518 # only check for sem_ini if thread support is requested
1519 if test "$with_threads" = "yes" -o -z "$with_threads"; then
1520 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
1521 # posix4 on Solaris 2.6
1522 # pthread (first!) on Linux
1525 # check if we need libintl for locale functions
1526 AC_CHECK_LIB(intl, textdomain,
1527 AC_DEFINE(WITH_LIBINTL, 1,
1528 [Define to 1 if libintl is needed for locale functions.]))
1530 # checks for system dependent C++ extensions support
1531 case "$ac_sys_system" in
1532 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1533 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1534 [loadAndInit("", 0, "")],
1535 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1536 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1537 and you want support for AIX C++ shared extension modules.])
1538 AC_MSG_RESULT(yes)],
1539 [AC_MSG_RESULT(no)]);;
1543 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1544 # BeOS' sockets are stashed in libnet.
1545 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
1546 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
1548 case "$ac_sys_system" in
1550 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1554 AC_MSG_CHECKING(for --with-libs)
1556 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1558 AC_MSG_RESULT($withval)
1559 LIBS="$withval $LIBS"
1561 [AC_MSG_RESULT(no)])
1563 # Determine if signalmodule should be used.
1564 AC_SUBST(USE_SIGNAL_MODULE)
1565 AC_SUBST(SIGNAL_OBJS)
1566 AC_MSG_CHECKING(for --with-signal-module)
1567 AC_ARG_WITH(signal-module,
1568 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
1570 if test -z "$with_signal_module"
1571 then with_signal_module="yes"
1573 AC_MSG_RESULT($with_signal_module)
1575 if test "${with_signal_module}" = "yes"; then
1576 USE_SIGNAL_MODULE=""
1579 USE_SIGNAL_MODULE="#"
1580 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1583 # This is used to generate Setup.config
1584 AC_SUBST(USE_THREAD_MODULE)
1585 USE_THREAD_MODULE=""
1587 AC_MSG_CHECKING(for --with-dec-threads)
1589 AC_ARG_WITH(dec-threads,
1590 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
1592 AC_MSG_RESULT($withval)
1594 if test "${with_thread+set}" != set; then
1595 with_thread="$withval";
1597 [AC_MSG_RESULT(no)])
1599 # Templates for things AC_DEFINEd more than once.
1600 # For a single AC_DEFINE, no template is needed.
1601 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
1602 AH_TEMPLATE(_REENTRANT,
1603 [Define to force use of thread-safe errno, h_errno, and other functions])
1604 AH_TEMPLATE(WITH_THREAD,
1605 [Define if you want to compile in rudimentary thread support])
1607 AC_MSG_CHECKING(for --with-threads)
1608 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1609 AC_ARG_WITH(threads,
1610 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
1612 # --with-thread is deprecated, but check for it anyway
1613 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1615 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
1616 [with_threads=$with_thread])
1618 if test -z "$with_threads"
1619 then with_threads="yes"
1621 AC_MSG_RESULT($with_threads)
1624 if test "$with_threads" = "no"
1626 USE_THREAD_MODULE="#"
1627 elif test "$ac_cv_pthread_is_default" = yes
1629 AC_DEFINE(WITH_THREAD)
1630 # Defining _REENTRANT on system with POSIX threads should not hurt.
1631 AC_DEFINE(_REENTRANT)
1633 THREADOBJ="Python/thread.o"
1634 elif test "$ac_cv_kpthread" = "yes"
1637 if test "$ac_cv_cxx_thread" = "yes"; then
1638 CXX="$CXX -Kpthread"
1640 AC_DEFINE(WITH_THREAD)
1642 THREADOBJ="Python/thread.o"
1643 elif test "$ac_cv_kthread" = "yes"
1646 if test "$ac_cv_cxx_thread" = "yes"; then
1649 AC_DEFINE(WITH_THREAD)
1651 THREADOBJ="Python/thread.o"
1652 elif test "$ac_cv_pthread" = "yes"
1655 if test "$ac_cv_cxx_thread" = "yes"; then
1658 AC_DEFINE(WITH_THREAD)
1660 THREADOBJ="Python/thread.o"
1662 if test ! -z "$with_threads" -a -d "$with_threads"
1663 then LDFLAGS="$LDFLAGS -L$with_threads"
1665 if test ! -z "$withval" -a -d "$withval"
1666 then LDFLAGS="$LDFLAGS -L$withval"
1669 # According to the POSIX spec, a pthreads implementation must
1670 # define _POSIX_THREADS in unistd.h. Some apparently don't
1671 # (e.g. gnu pth with pthread emulation)
1672 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1676 #ifdef _POSIX_THREADS
1679 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1680 AC_MSG_RESULT($unistd_defines_pthreads)
1682 AC_DEFINE(_REENTRANT)
1683 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1684 AC_DEFINE(C_THREADS)
1685 AC_DEFINE(HURD_C_THREADS, 1,
1686 [Define if you are using Mach cthreads directly under /include])
1687 LIBS="$LIBS -lthreads"
1688 THREADOBJ="Python/thread.o"],[
1689 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1690 AC_DEFINE(C_THREADS)
1691 AC_DEFINE(MACH_C_THREADS, 1,
1692 [Define if you are using Mach cthreads under mach /])
1693 THREADOBJ="Python/thread.o"],[
1694 AC_MSG_CHECKING(for --with-pth)
1696 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
1697 [AC_MSG_RESULT($withval)
1698 AC_DEFINE([WITH_THREAD])
1699 AC_DEFINE([HAVE_PTH], 1,
1700 [Define if you have GNU PTH threads.])
1702 THREADOBJ="Python/thread.o"],
1705 # Just looking for pthread_create in libpthread is not enough:
1706 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1707 # So we really have to include pthread.h, and then link.
1709 LIBS="$LIBS -lpthread"
1710 AC_MSG_CHECKING([for pthread_create in -lpthread])
1711 AC_TRY_LINK([#include <pthread.h>
1713 void * start_routine (void *arg) { exit (0); }], [
1714 pthread_create (NULL, NULL, start_routine, NULL)], [
1716 AC_DEFINE(WITH_THREAD)
1718 THREADOBJ="Python/thread.o"],[
1720 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1722 THREADOBJ="Python/thread.o"],[
1723 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
1724 AC_DEFINE(ATHEOS_THREADS, 1,
1725 [Define this if you have AtheOS threads.])
1726 THREADOBJ="Python/thread.o"],[
1727 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1728 AC_DEFINE(BEOS_THREADS, 1,
1729 [Define this if you have BeOS threads.])
1730 THREADOBJ="Python/thread.o"],[
1731 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1733 LIBS="$LIBS -lpthreads"
1734 THREADOBJ="Python/thread.o"], [
1735 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1738 THREADOBJ="Python/thread.o"], [
1739 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1741 LIBS="$LIBS -lpthread"
1742 THREADOBJ="Python/thread.o"], [
1743 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1746 THREADOBJ="Python/thread.o"],[
1747 USE_THREAD_MODULE="#"])
1748 ])])])])])])])])])])
1750 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1752 THREADOBJ="Python/thread.o"
1753 USE_THREAD_MODULE=""])
1755 if test "$posix_threads" != "yes"; then
1756 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1757 LIBS="$LIBS -lthread"
1758 THREADOBJ="Python/thread.o"
1759 USE_THREAD_MODULE=""])
1762 if test "$USE_THREAD_MODULE" != "#"
1764 # If the above checks didn't disable threads, (at least) OSF1
1765 # needs this '-threads' argument during linking.
1766 case $ac_sys_system in
1767 OSF1) LDLAST=-threads;;
1772 if test "$posix_threads" = "yes"; then
1773 if test "$unistd_defines_pthreads" = "no"; then
1774 AC_DEFINE(_POSIX_THREADS, 1,
1775 [Define if you have POSIX threads,
1776 and your system does not define that.])
1779 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
1780 case $ac_sys_system/$ac_sys_release in
1781 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
1782 Defined for Solaris 2.6 bug in pthread header.)
1784 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
1785 Define if the Posix semaphores do not work on your system)
1789 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1790 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1791 [AC_TRY_RUN([#include <pthread.h>
1792 void *foo(void *parm) {
1796 pthread_attr_t attr;
1798 if (pthread_attr_init(&attr)) exit(-1);
1799 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
1800 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
1803 ac_cv_pthread_system_supported=yes,
1804 ac_cv_pthread_system_supported=no,
1805 ac_cv_pthread_system_supported=no)
1807 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1808 if test "$ac_cv_pthread_system_supported" = "yes"; then
1809 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
1811 AC_CHECK_FUNCS(pthread_sigmask,
1812 [case $ac_sys_system in
1814 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
1815 [Define if pthread_sigmask() does not work on your system.])
1821 # Check for enable-ipv6
1822 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
1823 AC_MSG_CHECKING([if --enable-ipv6 is specified])
1825 [ --enable-ipv6 Enable ipv6 (with ipv4) support
1826 --disable-ipv6 Disable ipv6 support],
1827 [ case "$enableval" in
1832 *) AC_MSG_RESULT(yes)
1833 AC_DEFINE(ENABLE_IPV6)
1839 dnl the check does not work on cross compilation case...
1840 AC_TRY_RUN([ /* AF_INET6 available check */
1841 #include <sys/types.h>
1842 #include <sys/socket.h>
1845 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1859 if test "$ipv6" = "yes"; then
1860 AC_MSG_CHECKING(if RFC2553 API is available)
1861 AC_TRY_COMPILE([#include <sys/types.h>
1862 #include <netinet/in.h>],
1863 [struct sockaddr_in6 x;
1867 AC_MSG_RESULT(no, IPv6 disabled)
1871 if test "$ipv6" = "yes"; then
1872 AC_DEFINE(ENABLE_IPV6)
1880 if test "$ipv6" = "yes"; then
1881 AC_MSG_CHECKING([ipv6 stack type])
1882 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1886 dnl http://www.kame.net/
1888 #include <netinet/in.h>
1889 #ifdef IPV6_INRIA_VERSION
1895 dnl http://www.kame.net/
1897 #include <netinet/in.h>
1903 ipv6libdir=/usr/local/v6/lib
1907 dnl http://www.v6.linux.or.jp/
1909 #include <features.h>
1910 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1917 dnl http://www.v6.linux.or.jp/
1918 if test -d /usr/inet6; then
1921 ipv6libdir=/usr/inet6/lib
1922 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
1926 if test -f /etc/netconfig; then
1927 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1935 #include <sys/param.h>
1936 #ifdef _TOSHIBA_INET6
1941 ipv6libdir=/usr/local/v6/lib])
1945 #include </usr/local/v6/include/sys/v6config.h>
1951 ipv6libdir=/usr/local/v6/lib;
1952 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
1956 #include <sys/param.h>
1957 #ifdef _ZETA_MINAMI_INET6
1962 ipv6libdir=/usr/local/v6/lib])
1965 if test "$ipv6type" != "unknown"; then
1969 AC_MSG_RESULT($ipv6type)
1972 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1973 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1974 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1975 echo "using lib$ipv6lib"
1977 if test $ipv6trylibc = "yes"; then
1980 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1981 echo "You need to fetch lib$ipv6lib.a from appropriate"
1982 echo 'ipv6 kit and compile beforehand.'
1988 # Check for --with-doc-strings
1989 AC_MSG_CHECKING(for --with-doc-strings)
1990 AC_ARG_WITH(doc-strings,
1991 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
1993 if test -z "$with_doc_strings"
1994 then with_doc_strings="yes"
1996 if test "$with_doc_strings" != "no"
1998 AC_DEFINE(WITH_DOC_STRINGS, 1,
1999 [Define if you want documentation strings in extension modules])
2001 AC_MSG_RESULT($with_doc_strings)
2003 # Check for Python-specific malloc support
2004 AC_MSG_CHECKING(for --with-tsc)
2006 [ --with(out)-tsc enable/disable timestamp counter profile], [
2007 if test "$withval" != no
2009 AC_DEFINE(WITH_TSC, 1,
2010 [Define to profile with the Pentium timestamp counter])
2012 else AC_MSG_RESULT(no)
2014 [AC_MSG_RESULT(no)])
2016 # Check for Python-specific malloc support
2017 AC_MSG_CHECKING(for --with-pymalloc)
2018 AC_ARG_WITH(pymalloc,
2019 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
2021 if test -z "$with_pymalloc"
2022 then with_pymalloc="yes"
2024 if test "$with_pymalloc" != "no"
2026 AC_DEFINE(WITH_PYMALLOC, 1,
2027 [Define if you want to compile in Python-specific mallocs])
2029 AC_MSG_RESULT($with_pymalloc)
2031 # Check for --with-wctype-functions
2032 AC_MSG_CHECKING(for --with-wctype-functions)
2033 AC_ARG_WITH(wctype-functions,
2034 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
2036 if test "$withval" != no
2038 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2039 [Define if you want wctype.h functions to be used instead of the
2040 one supplied by Python itself. (see Include/unicodectype.h).])
2042 else AC_MSG_RESULT(no)
2044 [AC_MSG_RESULT(no)])
2046 # -I${DLINCLDIR} is added to the compile rule for importdl.o
2050 # the dlopen() function means we might want to use dynload_shlib.o. some
2051 # platforms, such as AIX, have dlopen(), but don't want to use it.
2052 AC_CHECK_FUNCS(dlopen)
2054 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2055 # loading of modules.
2056 AC_SUBST(DYNLOADFILE)
2057 AC_MSG_CHECKING(DYNLOADFILE)
2058 if test -z "$DYNLOADFILE"
2060 case $ac_sys_system/$ac_sys_release in
2061 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2062 if test "$ac_cv_func_dlopen" = yes
2063 then DYNLOADFILE="dynload_shlib.o"
2064 else DYNLOADFILE="dynload_aix.o"
2067 BeOS*) DYNLOADFILE="dynload_beos.o";;
2068 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
2069 Darwin/*) DYNLOADFILE="dynload_next.o";;
2070 atheos*) DYNLOADFILE="dynload_atheos.o";;
2072 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2073 # out any dynamic loading
2074 if test "$ac_cv_func_dlopen" = yes
2075 then DYNLOADFILE="dynload_shlib.o"
2076 else DYNLOADFILE="dynload_stub.o"
2081 AC_MSG_RESULT($DYNLOADFILE)
2082 if test "$DYNLOADFILE" != "dynload_stub.o"
2084 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2085 [Defined when any dynamic module loading is enabled.])
2088 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
2090 AC_SUBST(MACHDEP_OBJS)
2091 AC_MSG_CHECKING(MACHDEP_OBJS)
2092 if test -z "$MACHDEP_OBJS"
2094 MACHDEP_OBJS=$extra_machdep_objs
2096 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
2098 AC_MSG_RESULT(MACHDEP_OBJS)
2100 # checks for library functions
2101 AC_CHECK_FUNCS(alarm bind_textdomain_codeset chown clock confstr ctermid \
2102 execv fork fpathconf ftime ftruncate \
2103 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2104 getpriority getpwent getspnam getspent getsid getwd \
2105 kill killpg lchown lstat mkfifo mknod mktime \
2106 mremap nice pathconf pause plock poll pthread_init \
2107 putenv readlink realpath \
2108 select setegid seteuid setgid \
2109 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
2110 sigaction siginterrupt sigrelse strftime \
2111 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
2112 truncate uname unsetenv utimes waitpid wcscoll _getpty)
2114 # For some functions, having a definition is not sufficient, since
2115 # we want to take their address.
2116 AC_MSG_CHECKING(for chroot)
2117 AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2118 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2122 AC_MSG_CHECKING(for link)
2123 AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2124 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2128 AC_MSG_CHECKING(for symlink)
2129 AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2130 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2134 AC_MSG_CHECKING(for fchdir)
2135 AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2136 AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2140 AC_MSG_CHECKING(for fsync)
2141 AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
2142 AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2146 AC_MSG_CHECKING(for fdatasync)
2147 AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2148 AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2153 # On some systems (eg. FreeBSD 5), we would find a definition of the
2154 # functions ctermid_r, setgroups in the library, but no prototype
2155 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2156 # address to avoid compiler warnings and potential miscompilations
2157 # because of the missing prototypes.
2159 AC_MSG_CHECKING(for ctermid_r)
2161 #include "confdefs.h"
2163 ], void* p = ctermid_r,
2164 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2169 AC_MSG_CHECKING(for flock)
2171 #include "confdefs.h"
2172 #include <sys/file.h>
2174 AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2179 AC_MSG_CHECKING(for getpagesize)
2181 #include "confdefs.h"
2183 ], void* p = getpagesize,
2184 AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2190 AC_CHECK_PROGS(TRUE, true, /bin/true)
2192 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2193 dnl On others, they are in the C library, so we to take no action
2194 AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
2195 AC_CHECK_LIB(resolv, inet_aton)
2198 AC_MSG_CHECKING(for hstrerror)
2200 #include "confdefs.h"
2202 ], void* p = hstrerror; hstrerror(0),
2203 AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2208 AC_MSG_CHECKING(for inet_aton)
2210 #include "confdefs.h"
2211 #include <sys/socket.h>
2212 #include <netinet/in.h>
2213 #include <arpa/inet.h>
2214 ], void* p = inet_aton;inet_aton(0,0),
2215 AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2220 AC_MSG_CHECKING(for inet_pton)
2222 #include "confdefs.h"
2223 #include <sys/types.h>
2224 #include <sys/socket.h>
2225 #include <netinet/in.h>
2226 #include <arpa/inet.h>
2227 ], void* p = inet_pton,
2228 AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2233 # On some systems, setgroups is in unistd.h, on others, in grp.h
2234 AC_MSG_CHECKING(for setgroups)
2236 #include "confdefs.h"
2242 void* p = setgroups,
2243 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2248 # check for openpty and forkpty
2250 AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"]))
2251 AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"]))
2253 # check for long file support functions
2254 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2256 AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
2257 AC_CHECK_FUNCS(getpgrp,
2258 AC_TRY_COMPILE([#include <unistd.h>],
2260 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2261 [Define if getpgrp() must be called as getpgrp(0).])
2264 AC_CHECK_FUNCS(setpgrp,
2265 AC_TRY_COMPILE([#include <unistd.h>],
2267 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2268 [Define if setpgrp() must be called as setpgrp(0, 0).])
2271 AC_CHECK_FUNCS(gettimeofday,
2272 AC_TRY_COMPILE([#include <sys/time.h>],
2273 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2274 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2275 [Define if gettimeofday() does not have second (timezone) argument
2276 This is the case on Motorola V4 (R40V4.2)])
2280 AC_MSG_CHECKING(for major, minor, and makedev)
2282 #if defined(MAJOR_IN_MKDEV)
2283 #include <sys/mkdev.h>
2284 #elif defined(MAJOR_IN_SYSMACROS)
2285 #include <sys/sysmacros.h>
2287 #include <sys/types.h>
2290 makedev(major(0),minor(0));
2292 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2293 [Define to 1 if you have the device macros.])
2299 # On OSF/1 V5.1, getaddrinfo is available, but a define
2300 # for [no]getaddrinfo in netdb.h.
2301 AC_MSG_CHECKING(for getaddrinfo)
2303 #include <sys/types.h>
2304 #include <sys/socket.h>
2308 getaddrinfo(NULL, NULL, NULL, NULL);
2311 AC_MSG_CHECKING(getaddrinfo bug)
2313 #include <sys/types.h>
2316 #include <sys/socket.h>
2317 #include <netinet/in.h>
2321 int passive, gaierr, inet4 = 0, inet6 = 0;
2322 struct addrinfo hints, *ai, *aitop;
2323 char straddr[INET6_ADDRSTRLEN], strport[16];
2325 for (passive = 0; passive <= 1; passive++) {
2326 memset(&hints, 0, sizeof(hints));
2327 hints.ai_family = AF_UNSPEC;
2328 hints.ai_flags = passive ? AI_PASSIVE : 0;
2329 hints.ai_socktype = SOCK_STREAM;
2330 hints.ai_protocol = IPPROTO_TCP;
2331 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2332 (void)gai_strerror(gaierr);
2335 for (ai = aitop; ai; ai = ai->ai_next) {
2336 if (ai->ai_addr == NULL ||
2337 ai->ai_addrlen == 0 ||
2338 getnameinfo(ai->ai_addr, ai->ai_addrlen,
2339 straddr, sizeof(straddr), strport, sizeof(strport),
2340 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2343 switch (ai->ai_family) {
2345 if (strcmp(strport, "54321") != 0) {
2349 if (strcmp(straddr, "0.0.0.0") != 0) {
2353 if (strcmp(straddr, "127.0.0.1") != 0) {
2360 if (strcmp(strport, "54321") != 0) {
2364 if (strcmp(straddr, "::") != 0) {
2368 if (strcmp(straddr, "::1") != 0) {
2378 /* another family support? */
2384 if (!(inet4 == 0 || inet4 == 2))
2386 if (!(inet6 == 0 || inet6 == 2))
2390 freeaddrinfo(aitop);
2395 freeaddrinfo(aitop);
2400 buggygetaddrinfo=no,
2401 AC_MSG_RESULT(buggy)
2402 buggygetaddrinfo=yes,
2403 AC_MSG_RESULT(buggy)
2404 buggygetaddrinfo=yes)], [
2406 buggygetaddrinfo=yes
2409 if test "$buggygetaddrinfo" = "yes"; then
2410 if test "$ipv6" = "yes"; then
2411 echo 'Fatal: You must get working getaddrinfo() function.'
2412 echo ' or you can specify "--disable-ipv6"'.
2416 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
2418 AC_CHECK_FUNCS(getnameinfo)
2420 # checks for structures
2424 AC_CHECK_MEMBERS([struct stat.st_rdev])
2425 AC_CHECK_MEMBERS([struct stat.st_blksize])
2426 AC_CHECK_MEMBERS([struct stat.st_flags])
2427 AC_CHECK_MEMBERS([struct stat.st_gen])
2428 AC_CHECK_MEMBERS([struct stat.st_birthtime])
2431 AC_MSG_CHECKING(for time.h that defines altzone)
2432 AC_CACHE_VAL(ac_cv_header_time_altzone,
2433 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2434 ac_cv_header_time_altzone=yes,
2435 ac_cv_header_time_altzone=no)])
2436 AC_MSG_RESULT($ac_cv_header_time_altzone)
2437 if test $ac_cv_header_time_altzone = yes; then
2438 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
2442 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
2444 #include <sys/types.h>
2445 #include <sys/select.h>
2446 #include <sys/time.h>
2448 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
2449 [Define if you can safely include both <sys/select.h> and <sys/time.h>
2450 (which you can't on SCO ODT 3.0).])
2453 AC_MSG_RESULT($was_it_defined)
2455 AC_MSG_CHECKING(for addrinfo)
2456 AC_CACHE_VAL(ac_cv_struct_addrinfo,
2458 # include <netdb.h>],
2459 [struct addrinfo a],
2460 ac_cv_struct_addrinfo=yes,
2461 ac_cv_struct_addrinfo=no))
2462 AC_MSG_RESULT($ac_cv_struct_addrinfo)
2463 if test $ac_cv_struct_addrinfo = yes; then
2464 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
2467 AC_MSG_CHECKING(for sockaddr_storage)
2468 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
2470 # include <sys/types.h>
2471 # include <sys/socket.h>],
2472 [struct sockaddr_storage s],
2473 ac_cv_struct_sockaddr_storage=yes,
2474 ac_cv_struct_sockaddr_storage=no))
2475 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
2476 if test $ac_cv_struct_sockaddr_storage = yes; then
2477 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
2480 # checks for compiler characteristics
2486 AC_MSG_CHECKING(for working volatile)
2487 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
2488 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
2490 AC_MSG_RESULT($works)
2493 AC_MSG_CHECKING(for working signed char)
2494 AC_TRY_COMPILE([], [signed char c;], works=yes,
2495 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
2497 AC_MSG_RESULT($works)
2500 AC_MSG_CHECKING(for prototypes)
2501 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
2502 AC_DEFINE(HAVE_PROTOTYPES, 1,
2503 [Define if your compiler supports function prototype])
2506 AC_MSG_RESULT($have_prototypes)
2509 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
2512 int foo(int x, ...) {
2520 ], [return foo(10, "", 3.14);], [
2521 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
2522 [Define if your compiler supports variable length function prototypes
2523 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
2526 AC_MSG_RESULT($works)
2528 # check for socketpair
2529 AC_MSG_CHECKING(for socketpair)
2531 #include <sys/types.h>
2532 #include <sys/socket.h>
2533 ], void *x=socketpair,
2534 AC_DEFINE(HAVE_SOCKETPAIR, 1, Define if you have the 'socketpair' function.)
2539 # check if sockaddr has sa_len member
2540 AC_MSG_CHECKING(if sockaddr has sa_len member)
2541 AC_TRY_COMPILE([#include <sys/types.h>
2542 #include <sys/socket.h>],
2546 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
2550 AC_MSG_CHECKING(whether va_list is an array)
2552 #ifdef HAVE_STDARG_PROTOTYPES
2555 #include <varargs.h>
2557 ], [va_list list1, list2; list1 = list2;], , [
2558 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
2559 va_list_is_array=yes
2561 AC_MSG_RESULT($va_list_is_array)
2563 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
2564 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
2565 [Define this if you have some version of gethostbyname_r()])
2567 AC_CHECK_FUNC(gethostbyname_r, [
2568 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2569 AC_MSG_CHECKING([gethostbyname_r with 6 args])
2571 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
2576 struct hostent *he, *res;
2581 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
2583 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2584 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
2585 [Define this if you have the 6-arg version of gethostbyname_r().])
2589 AC_MSG_CHECKING([gethostbyname_r with 5 args])
2599 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
2601 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2602 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
2603 [Define this if you have the 5-arg version of gethostbyname_r().])
2607 AC_MSG_CHECKING([gethostbyname_r with 3 args])
2613 struct hostent_data data;
2615 (void) gethostbyname_r(name, he, &data);
2617 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2618 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
2619 [Define this if you have the 3-arg version of gethostbyname_r().])
2628 AC_CHECK_FUNCS(gethostbyname)
2630 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
2631 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
2632 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
2633 AC_SUBST(HAVE_GETHOSTBYNAME_R)
2634 AC_SUBST(HAVE_GETHOSTBYNAME)
2636 # checks for system services
2639 # Linux requires this for correct f.p. operations
2640 AC_CHECK_FUNC(__fpu_control,
2642 [AC_CHECK_LIB(ieee, __fpu_control)
2645 # Check for --with-fpectl
2646 AC_MSG_CHECKING(for --with-fpectl)
2648 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
2650 if test "$withval" != no
2652 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
2653 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
2655 else AC_MSG_RESULT(no)
2657 [AC_MSG_RESULT(no)])
2659 # check for --with-libm=...
2661 case $ac_sys_system in
2666 AC_MSG_CHECKING(for --with-libm=STRING)
2668 AC_HELP_STRING(--with-libm=STRING, math library),
2670 if test "$withval" = no
2672 AC_MSG_RESULT(force LIBM empty)
2673 elif test "$withval" != yes
2675 AC_MSG_RESULT(set LIBM="$withval")
2676 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
2678 [AC_MSG_RESULT(default LIBM="$LIBM")])
2680 # check for --with-libc=...
2682 AC_MSG_CHECKING(for --with-libc=STRING)
2684 AC_HELP_STRING(--with-libc=STRING, C library),
2686 if test "$withval" = no
2688 AC_MSG_RESULT(force LIBC empty)
2689 elif test "$withval" != yes
2691 AC_MSG_RESULT(set LIBC="$withval")
2692 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
2694 [AC_MSG_RESULT(default LIBC="$LIBC")])
2696 # check for hypot() in math library
2699 AC_REPLACE_FUNCS(hypot)
2703 AC_CHECK_HEADER(wchar.h, [
2704 AC_DEFINE(HAVE_WCHAR_H, 1,
2705 [Define if the compiler provides a wchar.h header file.])
2711 # determine wchar_t size
2712 if test "$wchar_h" = yes
2714 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
2717 AC_MSG_CHECKING(for UCS-4 tcl)
2721 #if TCL_UTF_MAX != 6
2722 # error "NOT UCS4_TCL"
2724 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
2727 AC_MSG_RESULT($have_ucs4_tcl)
2729 # check whether wchar_t is signed or not
2730 if test "$wchar_h" = yes
2732 # check whether wchar_t is signed or not
2733 AC_MSG_CHECKING(whether wchar_t is signed)
2734 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
2739 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 1 : 0);
2742 ac_cv_wchar_t_signed=yes,
2743 ac_cv_wchar_t_signed=no,
2744 ac_cv_wchar_t_signed=yes)])
2745 AC_MSG_RESULT($ac_cv_wchar_t_signed)
2748 AC_MSG_CHECKING(what type to use for unicode)
2749 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2750 AC_ARG_ENABLE(unicode,
2751 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
2753 [enable_unicode=yes])
2755 if test $enable_unicode = yes
2757 # Without any arguments, Py_UNICODE defaults to two-byte mode
2758 case "$have_ucs4_tcl" in
2759 yes) enable_unicode="ucs4"
2761 *) enable_unicode="ucs2"
2766 AH_TEMPLATE(Py_UNICODE_SIZE,
2767 [Define as the size of the unicode type.])
2768 case "$enable_unicode" in
2769 ucs2) unicode_size="2"
2770 AC_DEFINE(Py_UNICODE_SIZE,2)
2772 ucs4) unicode_size="4"
2773 AC_DEFINE(Py_UNICODE_SIZE,4)
2777 AH_TEMPLATE(PY_UNICODE_TYPE,
2778 [Define as the integral type used for Unicode representation.])
2780 AC_SUBST(UNICODE_OBJS)
2781 if test "$enable_unicode" = "no"
2784 AC_MSG_RESULT(not used)
2786 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
2787 AC_DEFINE(Py_USING_UNICODE, 1,
2788 [Define if you want to have a Unicode type.])
2790 # wchar_t is only usable if it maps to an unsigned type
2791 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
2792 -a "$ac_cv_wchar_t_signed" = "no"
2794 PY_UNICODE_TYPE="wchar_t"
2795 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
2796 [Define if you have a useable wchar_t type defined in wchar.h; useable
2797 means wchar_t must be an unsigned type with at least 16 bits. (see
2798 Include/unicodeobject.h).])
2799 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
2800 elif test "$ac_cv_sizeof_short" = "$unicode_size"
2802 PY_UNICODE_TYPE="unsigned short"
2803 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
2804 elif test "$ac_cv_sizeof_long" = "$unicode_size"
2806 PY_UNICODE_TYPE="unsigned long"
2807 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
2809 PY_UNICODE_TYPE="no type found"
2811 AC_MSG_RESULT($PY_UNICODE_TYPE)
2814 # check for endianness
2817 # Check whether right shifting a negative integer extends the sign bit
2818 # or fills with zeros (like the Cray J90, according to Tim Peters).
2819 AC_MSG_CHECKING(whether right shift extends the sign bit)
2820 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
2824 exit(((-1)>>3 == -1) ? 0 : 1);
2827 ac_cv_rshift_extends_sign=yes,
2828 ac_cv_rshift_extends_sign=no,
2829 ac_cv_rshift_extends_sign=yes)])
2830 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
2831 if test "$ac_cv_rshift_extends_sign" = no
2833 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
2834 [Define if i>>j for signed int i does not extend the sign bit
2838 # check for getc_unlocked and related locking functions
2839 AC_MSG_CHECKING(for getc_unlocked() and friends)
2840 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
2841 AC_TRY_LINK([#include <stdio.h>],[
2842 FILE *f = fopen("/dev/null", "r");
2846 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
2847 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
2848 if test "$ac_cv_have_getc_unlocked" = yes
2850 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
2851 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
2854 # check for readline 2.1
2855 AC_CHECK_LIB(readline, rl_callback_handler_install,
2856 AC_DEFINE(HAVE_RL_CALLBACK, 1,
2857 [Define if you have readline 2.1]), , -ltermcap)
2859 # check for readline 2.2
2860 AC_TRY_CPP([#include <readline/readline.h>],
2861 have_readline=yes, have_readline=no)
2862 if test $have_readline = yes
2864 AC_EGREP_HEADER([extern int rl_completion_append_character;],
2865 [readline/readline.h],
2866 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
2867 [Define if you have readline 2.2]), )
2870 # check for readline 4.0
2871 AC_CHECK_LIB(readline, rl_pre_input_hook,
2872 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
2873 [Define if you have readline 4.0]), , -ltermcap)
2875 # check for readline 4.2
2876 AC_CHECK_LIB(readline, rl_completion_matches,
2877 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
2878 [Define if you have readline 4.2]), , -ltermcap)
2880 # also in readline 4.2
2881 AC_TRY_CPP([#include <readline/readline.h>],
2882 have_readline=yes, have_readline=no)
2883 if test $have_readline = yes
2885 AC_EGREP_HEADER([extern int rl_catch_signals;],
2886 [readline/readline.h],
2887 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
2888 [Define if you can turn off readline's signal handling.]), )
2891 AC_MSG_CHECKING(for broken nice())
2892 AC_CACHE_VAL(ac_cv_broken_nice, [
2897 if (val1 != -1 && val1 == nice(2))
2902 ac_cv_broken_nice=yes,
2903 ac_cv_broken_nice=no,
2904 ac_cv_broken_nice=no)])
2905 AC_MSG_RESULT($ac_cv_broken_nice)
2906 if test "$ac_cv_broken_nice" = yes
2908 AC_DEFINE(HAVE_BROKEN_NICE, 1,
2909 [Define if nice() returns success/failure instead of the new priority.])
2912 AC_MSG_CHECKING(for broken poll())
2918 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
2922 int poll_test = poll (&poll_struct, 1, 0);
2928 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
2938 ac_cv_broken_poll=yes,
2939 ac_cv_broken_poll=no,
2940 ac_cv_broken_poll=no)
2941 AC_MSG_RESULT($ac_cv_broken_poll)
2942 if test "$ac_cv_broken_poll" = yes
2944 AC_DEFINE(HAVE_BROKEN_POLL, 1,
2945 [Define if poll() sets errno on invalid file descriptors.])
2948 # Before we can test tzset, we need to check if struct tm has a tm_zone
2949 # (which is not required by ISO C or UNIX spec) and/or if we support
2953 # check tzset(3) exists and works like we expect it to
2954 AC_MSG_CHECKING(for working tzset())
2955 AC_CACHE_VAL(ac_cv_working_tzset, [
2962 extern char *tzname[];
2967 /* Note that we need to ensure that not only does tzset(3)
2968 do 'something' with localtime, but it works as documented
2969 in the library reference and as expected by the test suite.
2970 This includes making sure that tzname is set properly if
2971 tm->tm_zone does not exist since it is the alternative way
2972 of getting timezone info.
2974 Red Hat 6.2 doesn't understand the southern hemisphere
2975 after New Year's Day.
2978 time_t groundhogday = 1044144000; /* GMT-based */
2979 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
2983 if (localtime(&groundhogday)->tm_hour != 0)
2986 /* For UTC, tzname[1] is sometimes "", sometimes " " */
2987 if (strcmp(tzname[0], "UTC") ||
2988 (tzname[1][0] != 0 && tzname[1][0] != ' '))
2992 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
2994 if (localtime(&groundhogday)->tm_hour != 19)
2997 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
3001 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
3003 if (localtime(&groundhogday)->tm_hour != 11)
3006 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
3010 #if HAVE_STRUCT_TM_TM_ZONE
3011 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
3013 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
3020 ac_cv_working_tzset=yes,
3021 ac_cv_working_tzset=no,
3022 ac_cv_working_tzset=no)])
3023 AC_MSG_RESULT($ac_cv_working_tzset)
3024 if test "$ac_cv_working_tzset" = yes
3026 AC_DEFINE(HAVE_WORKING_TZSET, 1,
3027 [Define if tzset() actually switches the local timezone in a meaningful way.])
3030 # Look for subsecond timestamps in struct stat
3031 AC_MSG_CHECKING(for tv_nsec in struct stat)
3032 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
3033 AC_TRY_COMPILE([#include <sys/stat.h>], [
3035 st.st_mtim.tv_nsec = 1;
3037 ac_cv_stat_tv_nsec=yes,
3038 ac_cv_stat_tv_nsec=no,
3039 ac_cv_stat_tv_nsec=no))
3040 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
3041 if test "$ac_cv_stat_tv_nsec" = yes
3043 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
3044 [Define if you have struct stat.st_mtim.tv_nsec])
3047 # Look for BSD style subsecond timestamps in struct stat
3048 AC_MSG_CHECKING(for tv_nsec2 in struct stat)
3049 AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
3050 AC_TRY_COMPILE([#include <sys/stat.h>], [
3052 st.st_mtimespec.tv_nsec = 1;
3054 ac_cv_stat_tv_nsec2=yes,
3055 ac_cv_stat_tv_nsec2=no,
3056 ac_cv_stat_tv_nsec2=no))
3057 AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
3058 if test "$ac_cv_stat_tv_nsec2" = yes
3060 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
3061 [Define if you have struct stat.st_mtimensec])
3064 # On HP/UX 11.0, mvwdelch is a block with a return statement
3065 AC_MSG_CHECKING(whether mvwdelch is an expression)
3066 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
3067 AC_TRY_COMPILE([#include <curses.h>], [
3069 rtn = mvwdelch(0,0,0);
3070 ], ac_cv_mvwdelch_is_expression=yes,
3071 ac_cv_mvwdelch_is_expression=no,
3072 ac_cv_mvwdelch_is_expression=yes))
3073 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
3075 if test "$ac_cv_mvwdelch_is_expression" = yes
3077 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
3078 [Define if mvwdelch in curses.h is an expression.])
3081 AC_MSG_CHECKING(whether WINDOW has _flags)
3082 AC_CACHE_VAL(ac_cv_window_has_flags,
3083 AC_TRY_COMPILE([#include <curses.h>], [
3086 ], ac_cv_window_has_flags=yes,
3087 ac_cv_window_has_flags=no,
3088 ac_cv_window_has_flags=no))
3089 AC_MSG_RESULT($ac_cv_window_has_flags)
3092 if test "$ac_cv_window_has_flags" = yes
3094 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
3095 [Define if WINDOW in curses.h offers a field _flags.])
3098 AC_MSG_CHECKING(for /dev/ptmx)
3100 if test -e /dev/ptmx
3103 AC_DEFINE(HAVE_DEV_PTMX, 1,
3104 [Define if we have /dev/ptmx.])
3109 AC_MSG_CHECKING(for /dev/ptc)
3114 AC_DEFINE(HAVE_DEV_PTC, 1,
3115 [Define if we have /dev/ptc.])
3120 AC_CHECK_TYPE(socklen_t,,
3121 AC_DEFINE(socklen_t,int,
3122 Define to `int' if <sys/socket.h> does not define.),[
3123 #ifdef HAVE_SYS_TYPES_H
3124 #include <sys/types.h>
3126 #ifdef HAVE_SYS_SOCKET_H
3127 #include <sys/socket.h>
3131 AC_SUBST(THREADHEADERS)
3133 for h in `(cd $srcdir;echo Python/thread_*.h)`
3135 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
3139 SRCDIRS="Parser Grammar Objects Python Modules Mac Mac/Python"
3140 AC_MSG_CHECKING(for build directories)
3141 for dir in $SRCDIRS; do
3142 if test ! -d $dir; then
3148 # generate output files
3149 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
3152 echo "creating Setup"
3153 if test ! -f Modules/Setup
3155 cp $srcdir/Modules/Setup.dist Modules/Setup
3158 echo "creating Setup.local"
3159 if test ! -f Modules/Setup.local
3161 echo "# Edit this file for local setup changes" >Modules/Setup.local
3164 echo "creating Makefile"
3165 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
3166 -s Modules Modules/Setup.config \
3167 Modules/Setup.local Modules/Setup