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 AC_ARG_ENABLE(universalsdk,
64 AC_HELP_STRING(--enable-universalsdk@<:@SDKDIR@:>@, Build agains Mac OS X 10.4u SDK (ppc/i386)),
68 enableval=/Developer/SDKs/MacOSX10.4u.sdk
77 UNIVERSALSDK=$enableval
84 AC_SUBST(UNIVERSALSDK)
86 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
87 AC_ARG_ENABLE(framework,
88 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
92 enableval=/Library/Frameworks
97 PYTHONFRAMEWORKDIR=no-framework
98 PYTHONFRAMEWORKPREFIX=
99 PYTHONFRAMEWORKINSTALLDIR=
103 PYTHONFRAMEWORK=Python
104 PYTHONFRAMEWORKDIR=Python.framework
105 PYTHONFRAMEWORKPREFIX=$enableval
106 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
107 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
111 PYTHONFRAMEWORKDIR=no-framework
112 PYTHONFRAMEWORKPREFIX=
113 PYTHONFRAMEWORKINSTALLDIR=
116 AC_SUBST(PYTHONFRAMEWORK)
117 AC_SUBST(PYTHONFRAMEWORKDIR)
118 AC_SUBST(PYTHONFRAMEWORKPREFIX)
119 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
122 ## AC_HELP_STRING(--with-dyld,
123 ## Use (OpenStep|Rhapsody) dynamic linker))
125 # Set name for machine-dependent library files
127 AC_MSG_CHECKING(MACHDEP)
128 if test -z "$MACHDEP"
130 ac_sys_system=`uname -s`
131 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
132 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
133 ac_sys_release=`uname -v`
135 ac_sys_release=`uname -r`
137 ac_md_system=`echo $ac_sys_system |
138 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
139 ac_md_release=`echo $ac_sys_release |
140 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
141 MACHDEP="$ac_md_system$ac_md_release"
144 cygwin*) MACHDEP="cygwin";;
145 darwin*) MACHDEP="darwin";;
146 atheos*) MACHDEP="atheos";;
147 irix646) MACHDEP="irix6";;
148 '') MACHDEP="unknown";;
152 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
153 # disable features if it is defined, without any means to access these
154 # features as extensions. For these systems, we skip the definition of
155 # _XOPEN_SOURCE. Before adding a system to the list to gain access to
156 # some feature, make sure there is no alternative way to access this
157 # feature. Also, when using wildcards, make sure you have verified the
158 # need for not defining _XOPEN_SOURCE on all systems matching the
159 # wildcard, and that the wildcard does not include future systems
160 # (which may remove their limitations).
161 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
162 case $ac_sys_system/$ac_sys_release in
163 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
164 # even though select is a POSIX function. Reported by J. Ribbens.
165 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
166 OpenBSD/2.* | OpenBSD/3.@<:@012345678@:>@)
167 define_xopen_source=no;;
168 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
169 # of union __?sigval. Reported by Stuart Bishop.
171 define_xopen_source=no;;
172 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
173 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
174 # Reconfirmed for 7.1.4 by Martin v. Loewis.
175 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
176 define_xopen_source=no;;
177 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
178 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
180 define_xopen_source=no;;
181 # On FreeBSD 4.8 and MacOS X 10.2, a bug in ncurses.h means that
182 # it craps out if _XOPEN_EXTENDED_SOURCE is defined. Apparently,
183 # this is fixed in 10.3, which identifies itself as Darwin/7.*
184 # This should hopefully be fixed in FreeBSD 4.9
185 FreeBSD/4.8* | Darwin/6* )
186 define_xopen_source=no;;
187 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
188 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
189 # or has another value. By not (re)defining it, the defaults come in place.
191 define_xopen_source=no;;
193 if test `uname -r` -eq 1; then
194 define_xopen_source=no
197 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
198 # disables platform specific features beyond repair.
199 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
200 # has no effect, don't bother defineing them
202 define_xopen_source=no
207 if test $define_xopen_source = yes
209 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
210 # defined precisely as g++ defines it
211 # Furthermore, on Solaris 10, XPG6 requires the use of a C99
213 case $ac_sys_system/$ac_sys_release in
214 SunOS/5.8|SunOS/5.9|SunOS/5.10)
215 AC_DEFINE(_XOPEN_SOURCE, 500,
216 Define to the level of X/Open that your system supports)
219 AC_DEFINE(_XOPEN_SOURCE, 600,
220 Define to the level of X/Open that your system supports)
224 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
225 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
226 # several APIs are not declared. Since this is also needed in some
227 # cases for HP-UX, we define it globally.
228 # except for Solaris 10, where it must not be defined,
229 # as it implies XPG4.2
230 case $ac_sys_system/$ac_sys_release in
234 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
235 Define to activate Unix95-and-earlier features)
239 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
244 # SGI compilers allow the specification of the both the ABI and the
245 # ISA on the command line. Depending on the values of these switches,
246 # different and often incompatable code will be generated.
248 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
249 # thus supply support for various ABI/ISA combinations. The MACHDEP
250 # variable is also adjusted.
253 if test ! -z "$SGI_ABI"
256 LDFLAGS="$SGI_ABI $LDFLAGS"
257 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
259 AC_MSG_RESULT($MACHDEP)
261 # And add extra plat-mac for darwin
262 AC_SUBST(EXTRAPLATDIR)
263 AC_SUBST(EXTRAMACHDEPPATH)
264 AC_MSG_CHECKING(EXTRAPLATDIR)
265 if test -z "$EXTRAPLATDIR"
269 EXTRAPLATDIR="\$(PLATMACDIRS)"
270 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
278 AC_MSG_RESULT($EXTRAPLATDIR)
280 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
281 # it may influence the way we can build extensions, so distutils
283 AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
284 AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
285 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
286 EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
288 # checks for alternative programs
290 # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
291 # for debug/optimization stuff. BASECFLAGS is for flags that are required
292 # just to get things to compile and link. Users are free to override OPT
293 # when running configure or make. The build should not break if they do.
294 # BASECFLAGS should generally not be messed with, however.
296 # XXX shouldn't some/most/all of this code be merged with the stuff later
297 # on that fiddles with OPT and BASECFLAGS?
298 AC_MSG_CHECKING(for --without-gcc)
300 AC_HELP_STRING(--without-gcc,never use gcc),
308 without_gcc=$withval;;
310 case $ac_sys_system in
318 BASECFLAGS="$BASECFLAGS -export pragma"
320 LDFLAGS="$LDFLAGS -nodup"
328 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
331 AR="\$(srcdir)/Modules/ar_beos"
339 AC_MSG_RESULT($without_gcc)
341 # If the user switches compilers, we can't believe the cache
342 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
344 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
345 (it is also a good idea to do 'make clean' before compiling)])
352 AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
353 AC_ARG_WITH(cxx_main,
354 AC_HELP_STRING([--with-cxx-main=<compiler>],
355 [compile main() and link python executable with C++ compiler]),
361 yes) with_cxx_main=yes
373 AC_MSG_RESULT($with_cxx_main)
379 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
380 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
382 if test "$CXX" = "notfound"
389 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
390 if test "$CXX" = "notfound"
395 if test "$preset_cxx" != "$CXX"
399 By default, distutils will build C++ extension modules with "$CXX".
400 If this is not intended, then set CXX on the configure command line.
405 # checks for UNIX variants that set C preprocessor variables
408 # Check for unsupported systems
409 case $ac_sys_system/$ac_sys_release in
411 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
412 echo See README for details.
417 AC_MSG_CHECKING(for --with-suffix)
419 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
426 AC_MSG_RESULT($EXEEXT)
428 # Test whether we're running on a non-case-sensitive system, in which
429 # case we give a warning if no ext is given
430 AC_SUBST(BUILDEXEEXT)
431 AC_MSG_CHECKING(for case-insensitive build directory)
432 if test ! -d CaseSensitiveTestDir; then
433 mkdir CaseSensitiveTestDir
436 if test -d casesensitivetestdir
444 rmdir CaseSensitiveTestDir
449 gcc) CC="$CC -D_HAVE_BSDI";;
453 case $ac_sys_system in
456 cc|*/cc) CC="$CC -Ae";;
460 cc) CC="$CC -Wl,-Bexport";;
463 # Some functions have a prototype only with that define, e.g. confstr
464 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
470 AC_MSG_CHECKING(LIBRARY)
471 if test -z "$LIBRARY"
473 LIBRARY='libpython$(VERSION).a'
475 AC_MSG_RESULT($LIBRARY)
477 # LDLIBRARY is the name of the library to link against (as opposed to the
478 # name of the library into which to insert object files). BLDLIBRARY is also
479 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
480 # is blank as the main program is not linked directly against LDLIBRARY.
481 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
482 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
483 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
484 # DLLLIBRARY is the shared (i.e., DLL) library.
486 # RUNSHARED is used to run shared python without installed libraries
488 # INSTSONAME is the name of the shared library that will be use to install
489 # on the system - some systems like version suffix, others don't
493 AC_SUBST(LDLIBRARYDIR)
497 BLDLIBRARY='$(LDLIBRARY)'
498 INSTSONAME='$(LDLIBRARY)'
503 # LINKCC is the command that links the python executable -- default is $(CC).
504 # If CXX is set, and if it is needed to link a main function that was
505 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
506 # python might then depend on the C++ runtime
507 # This is altered for AIX in order to build the export list before
510 AC_MSG_CHECKING(LINKCC)
513 LINKCC='$(PURIFY) $(MAINCC)'
514 case $ac_sys_system in
517 if test $ac_sys_release -ge 5 -o \
518 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
521 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
523 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
526 AC_MSG_RESULT($LINKCC)
528 AC_MSG_CHECKING(for --enable-shared)
529 AC_ARG_ENABLE(shared,
530 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
532 if test -z "$enable_shared"
534 case $ac_sys_system in
536 enable_shared="yes";;
541 AC_MSG_RESULT($enable_shared)
543 AC_MSG_CHECKING(for --enable-profiling)
544 AC_ARG_ENABLE(profiling,
545 AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
548 AC_TRY_RUN([int main() { return 0; }],
549 ac_enable_profiling="yes",
550 ac_enable_profiling="no",
551 ac_enable_profiling="no")
553 AC_MSG_RESULT($ac_enable_profiling)
555 case "$ac_enable_profiling" in
557 BASECFLAGS="-pg $BASECFLAGS"
558 LDFLAGS="-pg $LDFLAGS"
562 AC_MSG_CHECKING(LDLIBRARY)
564 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
565 # library that we build, but we do not want to link against it (we
566 # will find it with a -framework option). For this reason there is an
567 # extra variable BLDLIBRARY against which Python and the extension
568 # modules are linked, BLDLIBRARY. This is normally the same as
569 # LDLIBRARY, but empty for MacOSX framework builds.
570 if test "$enable_framework"
572 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
573 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
576 BLDLIBRARY='$(LDLIBRARY)'
579 # Other platforms follow
580 if test $enable_shared = "yes"; then
581 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
582 case $ac_sys_system in
584 LDLIBRARY='libpython$(VERSION).so'
587 LDLIBRARY='libpython$(VERSION).dll.a'
588 DLLLIBRARY='libpython$(VERSION).dll'
591 LDLIBRARY='libpython$(VERSION).so'
592 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
593 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
594 INSTSONAME="$LDLIBRARY".$SOVERSION
596 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
597 LDLIBRARY='libpython$(VERSION).so'
598 BLDLIBRARY='-L. -lpython$(VERSION)'
599 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
600 case $ac_sys_system in
602 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
605 INSTSONAME="$LDLIBRARY".$SOVERSION
608 LDLIBRARY='libpython$(VERSION).sl'
609 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
610 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
613 LDLIBRARY='libpython$(VERSION).so'
614 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
615 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
618 LDLIBRARY='libpython$(VERSION).so'
619 BLDLIBRARY='-L. -lpython$(VERSION)'
620 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
623 else # shared is disabled
624 case $ac_sys_system in
626 BLDLIBRARY='$(LIBRARY)'
627 LDLIBRARY='libpython$(VERSION).dll.a'
632 AC_MSG_RESULT($LDLIBRARY)
636 AC_CHECK_PROGS(AR, ar aal, ar)
639 AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
640 if test $SVNVERSION = found
642 SVNVERSION="svnversion \$(srcdir)"
644 SVNVERSION="echo exported"
649 # install -d does not work on BSDI or HP-UX
650 if test -z "$INSTALL"
652 INSTALL="${srcdir}/install-sh -c"
657 # Not every filesystem supports hard links
659 if test -z "$LN" ; then
660 case $ac_sys_system in
662 CYGWIN*) LN="ln -s";;
663 atheos*) LN="ln -s";;
668 # Check for --with-pydebug
669 AC_MSG_CHECKING(for --with-pydebug)
671 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
673 if test "$withval" != no
675 AC_DEFINE(Py_DEBUG, 1,
676 [Define if you want to build an interpreter with many run-time checks.])
679 else AC_MSG_RESULT(no); Py_DEBUG='false'
683 # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
684 # merged with this chunk of code?
686 # Optimizer/debugger flags
687 # ------------------------
688 # (The following bit of code is complicated enough - please keep things
689 # indented properly. Just pretend you're editing Python code. ;-)
691 # There are two parallel sets of case statements below, one that checks to
692 # see if OPT was set and one that does BASECFLAGS setting based upon
693 # compiler and platform. BASECFLAGS tweaks need to be made even if the
696 # tweak OPT based on compiler and platform, only if the user didn't set
697 # it on the command line
703 if test "$CC" != 'g++' ; then
704 STRICT_PROTO="-Wstrict-prototypes"
706 case $ac_cv_prog_cc_g in
708 if test "$Py_DEBUG" = 'true' ; then
709 # Optimization messes up debuggers, so turn it off for
711 OPT="-g -Wall $STRICT_PROTO"
713 OPT="-g -O3 -Wall $STRICT_PROTO"
717 OPT="-O3 -Wall $STRICT_PROTO"
720 case $ac_sys_system in
721 SCO_SV*) OPT="$OPT -m486 -DSCO5"
731 # The current (beta) Monterey compiler dies with optimizations
732 # XXX what is Monterey? Does it still die w/ -O? Can we get rid of this?
733 case $ac_sys_system in
742 # tweak BASECFLAGS based on compiler and platform
745 # Python violates C99 rules, by casting between incompatible
746 # pointer types. GCC may generate bad code as a result of that,
747 # so use -fno-strict-aliasing if supported.
748 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
750 CC="$CC -fno-strict-aliasing"
751 AC_TRY_RUN([int main() { return 0; }],
752 ac_cv_no_strict_aliasing_ok=yes,
753 ac_cv_no_strict_aliasing_ok=no,
754 ac_cv_no_strict_aliasing_ok=no)
756 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
757 if test $ac_cv_no_strict_aliasing_ok = yes
759 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
761 case $ac_sys_system in
763 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
765 # is there any other compiler on Darwin besides gcc?
767 BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
768 if test "${enable_universalsdk}"; then
769 BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
774 BASECFLAGS="$BASECFLAGS -mieee"
780 case $ac_sys_system in
782 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
785 BASECFLAGS="$BASECFLAGS -ieee -std"
788 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
794 if test "$Py_DEBUG" = 'true'; then
800 if test "$ac_arch_flags"
802 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
805 # disable check for icc since it seems to pass, but generates a warning
808 ac_cv_opt_olimit_ok=no
811 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
812 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
814 CC="$CC -OPT:Olimit=0"
815 AC_TRY_RUN([int main() { return 0; }],
816 ac_cv_opt_olimit_ok=yes,
817 ac_cv_opt_olimit_ok=no,
818 ac_cv_opt_olimit_ok=no)
820 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
821 if test $ac_cv_opt_olimit_ok = yes; then
822 case $ac_sys_system in
823 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
824 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
829 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
833 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
834 AC_CACHE_VAL(ac_cv_olimit_ok,
836 CC="$CC -Olimit 1500"
837 AC_TRY_RUN([int main() { return 0; }],
842 AC_MSG_RESULT($ac_cv_olimit_ok)
843 if test $ac_cv_olimit_ok = yes; then
844 BASECFLAGS="$BASECFLAGS -Olimit 1500"
848 # On some compilers, pthreads are available without further options
849 # (e.g. MacOS X). On some of these systems, the compiler will not
850 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
851 # So we have to see first whether pthreads are available without
852 # options before we can check whether -Kpthread improves anything.
853 AC_MSG_CHECKING(whether pthreads are available without options)
854 AC_CACHE_VAL(ac_cv_pthread_is_default,
858 void* routine(void* p){return NULL;}
862 if(pthread_create(&p,NULL,routine,NULL)!=0)
864 (void)pthread_detach(p);
869 ac_cv_pthread_is_default=yes
873 ac_cv_pthread_is_default=no,
874 ac_cv_pthread_is_default=no)
876 AC_MSG_RESULT($ac_cv_pthread_is_default)
879 if test $ac_cv_pthread_is_default = yes
883 # -Kpthread, if available, provides the right #defines
884 # and linker options to make pthread_create available
885 # Some compilers won't report that they do not support -Kpthread,
886 # so we need to run a program to see whether it really made the
887 # function available.
888 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
889 AC_CACHE_VAL(ac_cv_kpthread,
895 void* routine(void* p){return NULL;}
899 if(pthread_create(&p,NULL,routine,NULL)!=0)
901 (void)pthread_detach(p);
909 AC_MSG_RESULT($ac_cv_kpthread)
912 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
914 # -Kthread, if available, provides the right #defines
915 # and linker options to make pthread_create available
916 # Some compilers won't report that they do not support -Kthread,
917 # so we need to run a program to see whether it really made the
918 # function available.
919 AC_MSG_CHECKING(whether $CC accepts -Kthread)
920 AC_CACHE_VAL(ac_cv_kthread,
926 void* routine(void* p){return NULL;}
930 if(pthread_create(&p,NULL,routine,NULL)!=0)
932 (void)pthread_detach(p);
940 AC_MSG_RESULT($ac_cv_kthread)
943 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
945 # -pthread, if available, provides the right #defines
946 # and linker options to make pthread_create available
947 # Some compilers won't report that they do not support -pthread,
948 # so we need to run a program to see whether it really made the
949 # function available.
950 AC_MSG_CHECKING(whether $CC accepts -pthread)
951 AC_CACHE_VAL(ac_cv_thread,
957 void* routine(void* p){return NULL;}
961 if(pthread_create(&p,NULL,routine,NULL)!=0)
963 (void)pthread_detach(p);
971 AC_MSG_RESULT($ac_cv_pthread)
974 # If we have set a CC compiler flag for thread support then
975 # check if it works for CXX, too.
979 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
982 if test "$ac_cv_kpthread" = "yes"
986 elif test "$ac_cv_kthread" = "yes"
990 elif test "$ac_cv_pthread" = "yes"
996 if test $ac_cv_cxx_thread = yes
998 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
999 $CXX -c conftest.$ac_ext 2>&5
1000 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1001 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1003 ac_cv_cxx_thread=yes
1009 AC_MSG_RESULT($ac_cv_cxx_thread)
1013 dnl # check for ANSI or K&R ("traditional") preprocessor
1014 dnl AC_MSG_CHECKING(for C preprocessor type)
1015 dnl AC_TRY_COMPILE([
1016 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1018 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1019 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
1020 dnl AC_MSG_RESULT($cpp_type)
1022 # checks for header files
1024 AC_CHECK_HEADERS(asm/types.h curses.h dlfcn.h fcntl.h grp.h \
1025 shadow.h langinfo.h libintl.h ncurses.h poll.h pthread.h \
1026 stropts.h termios.h thread.h \
1028 sys/audioio.h sys/bsdtty.h sys/file.h sys/loadavg.h sys/lock.h sys/mkdev.h \
1030 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
1031 sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
1032 sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1033 bluetooth/bluetooth.h)
1037 # On Solaris, term.h requires curses.h
1038 AC_CHECK_HEADERS(term.h,,,[
1039 #ifdef HAVE_CURSES_H
1044 # On Linux, netlink.h requires asm/types.h
1045 AC_CHECK_HEADERS(linux/netlink.h,,,[
1046 #ifdef HAVE_ASM_TYPES_H
1047 #include <asm/types.h>
1049 #ifdef HAVE_SYS_SOCKET_H
1050 #include <sys/socket.h>
1054 # checks for typedefs
1056 AC_MSG_CHECKING(for clock_t in time.h)
1057 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1058 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1060 AC_MSG_RESULT($was_it_defined)
1062 # Check whether using makedev requires defining _OSF_SOURCE
1063 AC_MSG_CHECKING(for makedev)
1064 AC_TRY_LINK([#include <sys/types.h> ],
1066 ac_cv_has_makedev=yes,
1067 ac_cv_has_makedev=no)
1068 if test "$ac_cv_has_makedev" = "no"; then
1069 # we didn't link, try if _OSF_SOURCE will allow us to link
1071 #define _OSF_SOURCE 1
1072 #include <sys/types.h>
1075 ac_cv_has_makedev=yes,
1076 ac_cv_has_makedev=no)
1077 if test "$ac_cv_has_makedev" = "yes"; then
1078 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1081 AC_MSG_RESULT($ac_cv_has_makedev)
1082 if test "$ac_cv_has_makedev" = "yes"; then
1083 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1086 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1087 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1088 # defined, but the compiler does not support pragma redefine_extname,
1089 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1090 # structures (such as rlimit64) without declaring them. As a
1091 # work-around, disable LFS on such configurations
1094 AC_MSG_CHECKING(Solaris LFS bug)
1096 #define _LARGEFILE_SOURCE 1
1097 #define _FILE_OFFSET_BITS 64
1098 #include <sys/resource.h>
1099 ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1100 AC_MSG_RESULT($sol_lfs_bug)
1101 if test "$sol_lfs_bug" = "yes"; then
1105 if test "$use_lfs" = "yes"; then
1106 # Two defines needed to enable largefile support on various platforms
1107 # These may affect some typedefs
1108 AC_DEFINE(_LARGEFILE_SOURCE, 1,
1109 [This must be defined on some systems to enable large file support.])
1110 AC_DEFINE(_FILE_OFFSET_BITS, 64,
1111 [This must be set to 64 on some systems to enable large file support.])
1114 # Add some code to confdefs.h so that the test for off_t works on SCO
1115 cat >> confdefs.h <<\EOF
1121 # Type availability checks
1128 AC_CHECK_TYPE(ssize_t,
1129 AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
1131 # Sizes of various common basic types
1132 # ANSI C requires sizeof(char) == 1, so no need to check it
1133 AC_CHECK_SIZEOF(int, 4)
1134 AC_CHECK_SIZEOF(long, 4)
1135 AC_CHECK_SIZEOF(void *, 4)
1136 AC_CHECK_SIZEOF(short, 2)
1137 AC_CHECK_SIZEOF(float, 4)
1138 AC_CHECK_SIZEOF(double, 8)
1139 AC_CHECK_SIZEOF(fpos_t, 4)
1140 AC_CHECK_SIZEOF(size_t, 4)
1142 AC_MSG_CHECKING(for long long support)
1144 AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1145 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1148 AC_MSG_RESULT($have_long_long)
1149 if test "$have_long_long" = yes ; then
1150 AC_CHECK_SIZEOF(long long, 8)
1153 AC_MSG_CHECKING(for uintptr_t support)
1155 AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
1156 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
1159 AC_MSG_RESULT($have_uintptr_t)
1160 if test "$have_uintptr_t" = yes ; then
1161 AC_CHECK_SIZEOF(uintptr_t, 4)
1164 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
1165 AC_MSG_CHECKING(size of off_t)
1166 AC_CACHE_VAL(ac_cv_sizeof_off_t,
1167 [AC_TRY_RUN([#include <stdio.h>
1168 #include <sys/types.h>
1171 FILE *f=fopen("conftestval", "w");
1173 fprintf(f, "%d\n", sizeof(off_t));
1176 ac_cv_sizeof_off_t=`cat conftestval`,
1177 ac_cv_sizeof_off_t=0,
1178 ac_cv_sizeof_off_t=4)
1180 AC_MSG_RESULT($ac_cv_sizeof_off_t)
1181 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1182 [The number of bytes in an off_t.])
1184 AC_MSG_CHECKING(whether to enable large file support)
1185 if test "$have_long_long" = yes -a \
1186 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1187 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1188 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1189 [Defined to enable large file support when an off_t is bigger than a long
1190 and long long is available and at least as big as an off_t. You may need
1191 to add some flags for configuration and compilation to enable this mode.
1192 (For Solaris and Linux, the necessary defines are already defined.)])
1198 # AC_CHECK_SIZEOF() doesn't include <time.h>.
1199 AC_MSG_CHECKING(size of time_t)
1200 AC_CACHE_VAL(ac_cv_sizeof_time_t,
1201 [AC_TRY_RUN([#include <stdio.h>
1205 FILE *f=fopen("conftestval", "w");
1207 fprintf(f, "%d\n", sizeof(time_t));
1210 ac_cv_sizeof_time_t=`cat conftestval`,
1211 ac_cv_sizeof_time_t=0,
1212 ac_cv_sizeof_time_t=4)
1214 AC_MSG_RESULT($ac_cv_sizeof_time_t)
1215 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
1216 [The number of bytes in a time_t.])
1219 # if have pthread_t then define SIZEOF_PTHREAD_T
1221 if test "$ac_cv_kpthread" = "yes"
1222 then CC="$CC -Kpthread"
1223 elif test "$ac_cv_kthread" = "yes"
1224 then CC="$CC -Kthread"
1225 elif test "$ac_cv_pthread" = "yes"
1226 then CC="$CC -pthread"
1228 AC_MSG_CHECKING(for pthread_t)
1230 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
1231 AC_MSG_RESULT($have_pthread_t)
1232 if test "$have_pthread_t" = yes ; then
1233 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
1234 AC_MSG_CHECKING(size of pthread_t)
1235 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
1236 [AC_TRY_RUN([#include <stdio.h>
1237 #include <pthread.h>
1240 FILE *f=fopen("conftestval", "w");
1242 fprintf(f, "%d\n", sizeof(pthread_t));
1245 ac_cv_sizeof_pthread_t=`cat conftestval`,
1246 ac_cv_sizeof_pthread_t=0,
1247 ac_cv_sizeof_pthread_t=4)
1249 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
1250 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
1251 [The number of bytes in a pthread_t.])
1255 AC_MSG_CHECKING(for --enable-toolbox-glue)
1256 AC_ARG_ENABLE(toolbox-glue,
1257 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
1259 if test -z "$enable_toolbox_glue"
1261 case $ac_sys_system/$ac_sys_release in
1263 enable_toolbox_glue="yes";;
1265 enable_toolbox_glue="no";;
1268 case "$enable_toolbox_glue" in
1270 extra_machdep_objs="Python/mactoolboxglue.o"
1271 extra_undefs="-u _PyMac_Error"
1272 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1273 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
1276 extra_machdep_objs=""
1280 AC_MSG_RESULT($enable_toolbox_glue)
1282 AC_SUBST(OTHER_LIBTOOL_OPT)
1283 case $ac_sys_system/$ac_sys_release in
1284 Darwin/@<:@01567@:>@\..*)
1285 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1288 OTHER_LIBTOOL_OPT=""
1292 AC_SUBST(LIBTOOL_CRUFT)
1293 case $ac_sys_system/$ac_sys_release in
1294 Darwin/@<:@01567@:>@\..*)
1295 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1296 if test "${enable_universalsdk}"; then
1299 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
1301 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1302 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1304 gcc_version=`gcc -v 2>&1 | grep version | cut -d\ -f3`
1305 if test ${gcc_version} '<' 4.0
1307 LIBTOOL_CRUFT="-lcc_dynamic"
1311 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
1312 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1313 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1316 AC_MSG_CHECKING(for --enable-framework)
1317 if test "$enable_framework"
1319 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
1320 # -F. is needed to allow linking to the framework while
1321 # in the build location.
1322 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1323 [Define if you want to produce an OpenStep/Rhapsody framework
1324 (shared library plus accessory files).])
1330 AC_MSG_CHECKING(for dyld)
1331 case $ac_sys_system/$ac_sys_release in
1333 AC_DEFINE(WITH_DYLD, 1,
1334 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1335 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1336 linker (rld). Dyld is necessary to support frameworks.])
1337 AC_MSG_RESULT(always on for Darwin)
1344 # Set info about shared libraries.
1349 AC_SUBST(LINKFORSHARED)
1350 # SO is the extension of shared libraries `(including the dot!)
1351 # -- usually .so, .sl on HP-UX, .dll on Cygwin
1355 case $ac_sys_system in
1361 # this might also be a termcap variable, see #610332
1363 echo '====================================================================='
1365 echo '+ WARNING: You have set SO in your environment. +'
1366 echo '+ Do you really mean to change the extension for shared libraries? +'
1367 echo '+ Continuing in 10 seconds to let you to ponder. +'
1369 echo '====================================================================='
1373 # LDSHARED is the ld *command* used to create shared library
1374 # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
1375 # (Shared libraries in this instance are shared modules to be loaded into
1376 # Python, as opposed to building Python itself as a shared library.)
1377 AC_MSG_CHECKING(LDSHARED)
1378 if test -z "$LDSHARED"
1380 case $ac_sys_system/$ac_sys_release in
1382 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
1383 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
1386 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
1387 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
1389 IRIX/5*) LDSHARED="ld -shared";;
1390 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1392 if test "$GCC" = "yes"
1393 then LDSHARED='$(CC) -shared'
1394 else LDSHARED='$(CC) -G';
1396 hp*|HP*) LDSHARED="ld -b";;
1397 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1399 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1400 if test "$enable_framework" ; then
1401 # Link against the framework. All externals should be defined.
1402 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1403 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1405 # No framework. Ignore undefined symbols, assuming they come from Python
1406 LDSHARED="$LDSHARED -undefined suppress"
1408 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
1409 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1410 if test "$enable_framework" ; then
1411 # Link against the framework. All externals should be defined.
1412 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1413 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1415 # No framework, use the Python app as bundle-loader
1416 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1417 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1420 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1421 # This allows an extension to be used in any Python
1422 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
1423 if test ${cur_target} '>' 10.2; then
1426 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1427 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1428 if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
1430 if test "${enable_universalsdk}"; then
1431 LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1433 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1434 BLDSHARED="$LDSHARED"
1436 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1437 if test "$enable_framework" ; then
1438 # Link against the framework. All externals should be defined.
1439 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1440 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1442 # No framework, use the Python app as bundle-loader
1443 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1444 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1448 Linux*|GNU*) LDSHARED='$(CC) -shared';;
1449 BSD/OS*/4*) LDSHARED="gcc -shared";;
1451 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1453 LDSHARED="$CC -shared ${LDFLAGS}"
1455 LDSHARED="ld -Bshareable ${LDFLAGS}"
1457 NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
1458 OpenUNIX*|UnixWare*)
1459 if test "$GCC" = "yes"
1460 then LDSHARED='$(CC) -shared'
1461 else LDSHARED='$(CC) -G'
1463 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1464 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
1465 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1466 atheos*) LDSHARED="gcc -shared";;
1470 AC_MSG_RESULT($LDSHARED)
1471 BLDSHARED=${BLDSHARED-$LDSHARED}
1472 # CCSHARED are the C *flags* used to create objects to go into a shared
1473 # library (module) -- this is only needed for a few systems
1474 AC_MSG_CHECKING(CCSHARED)
1475 if test -z "$CCSHARED"
1477 case $ac_sys_system/$ac_sys_release in
1478 SunOS*) if test "$GCC" = yes;
1479 then CCSHARED="-fPIC";
1480 else CCSHARED="-xcode=pic32";
1482 hp*|HP*) if test "$GCC" = yes;
1483 then CCSHARED="-fPIC";
1486 Linux*|GNU*) CCSHARED="-fPIC";;
1487 BSD/OS*/4*) CCSHARED="-fpic";;
1488 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
1489 OpenUNIX*|UnixWare*)
1490 if test "$GCC" = "yes"
1491 then CCSHARED="-fPIC"
1492 else CCSHARED="-KPIC"
1495 if test "$GCC" = "yes"
1496 then CCSHARED="-fPIC"
1497 else CCSHARED="-Kpic -belf"
1499 Monterey*) CCSHARED="-G";;
1500 IRIX*/6*) case $CC in
1501 *gcc*) CCSHARED="-shared";;
1504 atheos*) CCSHARED="-fPIC";;
1507 AC_MSG_RESULT($CCSHARED)
1508 # LINKFORSHARED are the flags passed to the $(CC) command that links
1509 # the python executable -- this is only needed for a few systems
1510 AC_MSG_CHECKING(LINKFORSHARED)
1511 if test -z "$LINKFORSHARED"
1513 case $ac_sys_system/$ac_sys_release in
1514 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1516 LINKFORSHARED="-Wl,-E -Wl,+s";;
1517 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1518 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1519 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1520 # -u libsys_s pulls in all symbols in libsys
1522 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1524 # not used by the core itself but which needs to be in the core so
1525 # that dynamically loaded extension modules have access to it.
1526 # -prebind is no longer used, because it actually seems to give a
1527 # slowdown in stead of a speedup, maybe due to the large number of
1528 # dynamic loads Python does.
1530 LINKFORSHARED="$extra_undefs"
1531 if test "$enable_framework"
1533 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1535 LINKFORSHARED="$LINKFORSHARED";;
1536 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1537 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1538 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1539 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
1540 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1542 LINKFORSHARED="-Wl,--export-dynamic"
1544 SunOS/5*) case $CC in
1546 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
1548 LINKFORSHARED="-Xlinker --export-dynamic"
1552 if test $enable_shared = "no"
1554 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1558 AC_MSG_RESULT($LINKFORSHARED)
1560 AC_SUBST(CFLAGSFORSHARED)
1561 AC_MSG_CHECKING(CFLAGSFORSHARED)
1562 if test ! "$LIBRARY" = "$LDLIBRARY"
1564 case $ac_sys_system in
1566 # Cygwin needs CCSHARED when building extension DLLs
1567 # but not when building the interpreter DLL.
1568 CFLAGSFORSHARED='';;
1570 CFLAGSFORSHARED='$(CCSHARED)'
1573 AC_MSG_RESULT($CFLAGSFORSHARED)
1575 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
1576 # library (with --enable-shared).
1577 # For platforms on which shared libraries are not allowed to have unresolved
1578 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
1579 # if it is not required, since it creates a dependency of the shared library
1580 # to LIBS. This, in turn, means that applications linking the shared libpython
1581 # don't need to link LIBS explicitly. The default should be only changed
1582 # on systems where this approach causes problems.
1584 AC_MSG_CHECKING(SHLIBS)
1585 case "$ac_sys_system" in
1589 AC_MSG_RESULT($SHLIBS)
1592 # checks for libraries
1593 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1594 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
1596 # only check for sem_ini if thread support is requested
1597 if test "$with_threads" = "yes" -o -z "$with_threads"; then
1598 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
1599 # posix4 on Solaris 2.6
1600 # pthread (first!) on Linux
1603 # check if we need libintl for locale functions
1604 AC_CHECK_LIB(intl, textdomain,
1605 AC_DEFINE(WITH_LIBINTL, 1,
1606 [Define to 1 if libintl is needed for locale functions.]))
1608 # checks for system dependent C++ extensions support
1609 case "$ac_sys_system" in
1610 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1611 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1612 [loadAndInit("", 0, "")],
1613 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1614 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1615 and you want support for AIX C++ shared extension modules.])
1616 AC_MSG_RESULT(yes)],
1617 [AC_MSG_RESULT(no)]);;
1621 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1622 # BeOS' sockets are stashed in libnet.
1623 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
1624 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
1626 case "$ac_sys_system" in
1628 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1632 AC_MSG_CHECKING(for --with-libs)
1634 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1636 AC_MSG_RESULT($withval)
1637 LIBS="$withval $LIBS"
1639 [AC_MSG_RESULT(no)])
1641 # Check for use of the system libffi library
1642 AC_MSG_CHECKING(for --with-system-ffi)
1643 AC_ARG_WITH(system_ffi,
1644 AC_HELP_STRING(--with-system-ffi, build _ctypes module using an installed ffi library))
1646 if test -z "$with_system_ffi"
1647 then with_system_ffi="no"
1649 AC_MSG_RESULT($with_system_ffi)
1651 # Determine if signalmodule should be used.
1652 AC_SUBST(USE_SIGNAL_MODULE)
1653 AC_SUBST(SIGNAL_OBJS)
1654 AC_MSG_CHECKING(for --with-signal-module)
1655 AC_ARG_WITH(signal-module,
1656 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
1658 if test -z "$with_signal_module"
1659 then with_signal_module="yes"
1661 AC_MSG_RESULT($with_signal_module)
1663 if test "${with_signal_module}" = "yes"; then
1664 USE_SIGNAL_MODULE=""
1667 USE_SIGNAL_MODULE="#"
1668 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1671 # This is used to generate Setup.config
1672 AC_SUBST(USE_THREAD_MODULE)
1673 USE_THREAD_MODULE=""
1675 AC_MSG_CHECKING(for --with-dec-threads)
1677 AC_ARG_WITH(dec-threads,
1678 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
1680 AC_MSG_RESULT($withval)
1682 if test "${with_thread+set}" != set; then
1683 with_thread="$withval";
1685 [AC_MSG_RESULT(no)])
1687 # Templates for things AC_DEFINEd more than once.
1688 # For a single AC_DEFINE, no template is needed.
1689 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
1690 AH_TEMPLATE(_REENTRANT,
1691 [Define to force use of thread-safe errno, h_errno, and other functions])
1692 AH_TEMPLATE(WITH_THREAD,
1693 [Define if you want to compile in rudimentary thread support])
1695 AC_MSG_CHECKING(for --with-threads)
1696 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1697 AC_ARG_WITH(threads,
1698 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
1700 # --with-thread is deprecated, but check for it anyway
1701 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1703 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
1704 [with_threads=$with_thread])
1706 if test -z "$with_threads"
1707 then with_threads="yes"
1709 AC_MSG_RESULT($with_threads)
1712 if test "$with_threads" = "no"
1714 USE_THREAD_MODULE="#"
1715 elif test "$ac_cv_pthread_is_default" = yes
1717 AC_DEFINE(WITH_THREAD)
1718 # Defining _REENTRANT on system with POSIX threads should not hurt.
1719 AC_DEFINE(_REENTRANT)
1721 THREADOBJ="Python/thread.o"
1722 elif test "$ac_cv_kpthread" = "yes"
1725 if test "$ac_cv_cxx_thread" = "yes"; then
1726 CXX="$CXX -Kpthread"
1728 AC_DEFINE(WITH_THREAD)
1730 THREADOBJ="Python/thread.o"
1731 elif test "$ac_cv_kthread" = "yes"
1734 if test "$ac_cv_cxx_thread" = "yes"; then
1737 AC_DEFINE(WITH_THREAD)
1739 THREADOBJ="Python/thread.o"
1740 elif test "$ac_cv_pthread" = "yes"
1743 if test "$ac_cv_cxx_thread" = "yes"; then
1746 AC_DEFINE(WITH_THREAD)
1748 THREADOBJ="Python/thread.o"
1750 if test ! -z "$with_threads" -a -d "$with_threads"
1751 then LDFLAGS="$LDFLAGS -L$with_threads"
1753 if test ! -z "$withval" -a -d "$withval"
1754 then LDFLAGS="$LDFLAGS -L$withval"
1757 # According to the POSIX spec, a pthreads implementation must
1758 # define _POSIX_THREADS in unistd.h. Some apparently don't
1759 # (e.g. gnu pth with pthread emulation)
1760 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1764 #ifdef _POSIX_THREADS
1767 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1768 AC_MSG_RESULT($unistd_defines_pthreads)
1770 AC_DEFINE(_REENTRANT)
1771 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1772 AC_DEFINE(C_THREADS)
1773 AC_DEFINE(HURD_C_THREADS, 1,
1774 [Define if you are using Mach cthreads directly under /include])
1775 LIBS="$LIBS -lthreads"
1776 THREADOBJ="Python/thread.o"],[
1777 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1778 AC_DEFINE(C_THREADS)
1779 AC_DEFINE(MACH_C_THREADS, 1,
1780 [Define if you are using Mach cthreads under mach /])
1781 THREADOBJ="Python/thread.o"],[
1782 AC_MSG_CHECKING(for --with-pth)
1784 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
1785 [AC_MSG_RESULT($withval)
1786 AC_DEFINE([WITH_THREAD])
1787 AC_DEFINE([HAVE_PTH], 1,
1788 [Define if you have GNU PTH threads.])
1790 THREADOBJ="Python/thread.o"],
1793 # Just looking for pthread_create in libpthread is not enough:
1794 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1795 # So we really have to include pthread.h, and then link.
1797 LIBS="$LIBS -lpthread"
1798 AC_MSG_CHECKING([for pthread_create in -lpthread])
1799 AC_TRY_LINK([#include <pthread.h>
1801 void * start_routine (void *arg) { exit (0); }], [
1802 pthread_create (NULL, NULL, start_routine, NULL)], [
1804 AC_DEFINE(WITH_THREAD)
1806 THREADOBJ="Python/thread.o"],[
1808 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1810 THREADOBJ="Python/thread.o"],[
1811 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
1812 AC_DEFINE(ATHEOS_THREADS, 1,
1813 [Define this if you have AtheOS threads.])
1814 THREADOBJ="Python/thread.o"],[
1815 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1816 AC_DEFINE(BEOS_THREADS, 1,
1817 [Define this if you have BeOS threads.])
1818 THREADOBJ="Python/thread.o"],[
1819 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1821 LIBS="$LIBS -lpthreads"
1822 THREADOBJ="Python/thread.o"], [
1823 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1826 THREADOBJ="Python/thread.o"], [
1827 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1829 LIBS="$LIBS -lpthread"
1830 THREADOBJ="Python/thread.o"], [
1831 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1834 THREADOBJ="Python/thread.o"],[
1835 USE_THREAD_MODULE="#"])
1836 ])])])])])])])])])])
1838 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1840 THREADOBJ="Python/thread.o"
1841 USE_THREAD_MODULE=""])
1843 if test "$posix_threads" != "yes"; then
1844 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1845 LIBS="$LIBS -lthread"
1846 THREADOBJ="Python/thread.o"
1847 USE_THREAD_MODULE=""])
1850 if test "$USE_THREAD_MODULE" != "#"
1852 # If the above checks didn't disable threads, (at least) OSF1
1853 # needs this '-threads' argument during linking.
1854 case $ac_sys_system in
1855 OSF1) LDLAST=-threads;;
1860 if test "$posix_threads" = "yes"; then
1861 if test "$unistd_defines_pthreads" = "no"; then
1862 AC_DEFINE(_POSIX_THREADS, 1,
1863 [Define if you have POSIX threads,
1864 and your system does not define that.])
1867 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
1868 case $ac_sys_system/$ac_sys_release in
1869 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
1870 Defined for Solaris 2.6 bug in pthread header.)
1872 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
1873 Define if the Posix semaphores do not work on your system)
1877 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1878 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1879 [AC_TRY_RUN([#include <pthread.h>
1880 void *foo(void *parm) {
1884 pthread_attr_t attr;
1886 if (pthread_attr_init(&attr)) exit(-1);
1887 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
1888 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
1891 ac_cv_pthread_system_supported=yes,
1892 ac_cv_pthread_system_supported=no,
1893 ac_cv_pthread_system_supported=no)
1895 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1896 if test "$ac_cv_pthread_system_supported" = "yes"; then
1897 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
1899 AC_CHECK_FUNCS(pthread_sigmask,
1900 [case $ac_sys_system in
1902 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
1903 [Define if pthread_sigmask() does not work on your system.])
1909 # Check for enable-ipv6
1910 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
1911 AC_MSG_CHECKING([if --enable-ipv6 is specified])
1913 [ --enable-ipv6 Enable ipv6 (with ipv4) support
1914 --disable-ipv6 Disable ipv6 support],
1915 [ case "$enableval" in
1920 *) AC_MSG_RESULT(yes)
1921 AC_DEFINE(ENABLE_IPV6)
1927 dnl the check does not work on cross compilation case...
1928 AC_TRY_RUN([ /* AF_INET6 available check */
1929 #include <sys/types.h>
1930 #include <sys/socket.h>
1933 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1947 if test "$ipv6" = "yes"; then
1948 AC_MSG_CHECKING(if RFC2553 API is available)
1949 AC_TRY_COMPILE([#include <sys/types.h>
1950 #include <netinet/in.h>],
1951 [struct sockaddr_in6 x;
1955 AC_MSG_RESULT(no, IPv6 disabled)
1959 if test "$ipv6" = "yes"; then
1960 AC_DEFINE(ENABLE_IPV6)
1968 if test "$ipv6" = "yes"; then
1969 AC_MSG_CHECKING([ipv6 stack type])
1970 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1974 dnl http://www.kame.net/
1976 #include <netinet/in.h>
1977 #ifdef IPV6_INRIA_VERSION
1983 dnl http://www.kame.net/
1985 #include <netinet/in.h>
1991 ipv6libdir=/usr/local/v6/lib
1995 dnl http://www.v6.linux.or.jp/
1997 #include <features.h>
1998 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2005 dnl http://www.v6.linux.or.jp/
2006 if test -d /usr/inet6; then
2009 ipv6libdir=/usr/inet6/lib
2010 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
2014 if test -f /etc/netconfig; then
2015 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
2023 #include <sys/param.h>
2024 #ifdef _TOSHIBA_INET6
2029 ipv6libdir=/usr/local/v6/lib])
2033 #include </usr/local/v6/include/sys/v6config.h>
2039 ipv6libdir=/usr/local/v6/lib;
2040 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
2044 #include <sys/param.h>
2045 #ifdef _ZETA_MINAMI_INET6
2050 ipv6libdir=/usr/local/v6/lib])
2053 if test "$ipv6type" != "unknown"; then
2057 AC_MSG_RESULT($ipv6type)
2060 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2061 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2062 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2063 echo "using lib$ipv6lib"
2065 if test $ipv6trylibc = "yes"; then
2068 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2069 echo "You need to fetch lib$ipv6lib.a from appropriate"
2070 echo 'ipv6 kit and compile beforehand.'
2076 # Check for --with-doc-strings
2077 AC_MSG_CHECKING(for --with-doc-strings)
2078 AC_ARG_WITH(doc-strings,
2079 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
2081 if test -z "$with_doc_strings"
2082 then with_doc_strings="yes"
2084 if test "$with_doc_strings" != "no"
2086 AC_DEFINE(WITH_DOC_STRINGS, 1,
2087 [Define if you want documentation strings in extension modules])
2089 AC_MSG_RESULT($with_doc_strings)
2091 # Check for Python-specific malloc support
2092 AC_MSG_CHECKING(for --with-tsc)
2094 [ --with(out)-tsc enable/disable timestamp counter profile], [
2095 if test "$withval" != no
2097 AC_DEFINE(WITH_TSC, 1,
2098 [Define to profile with the Pentium timestamp counter])
2100 else AC_MSG_RESULT(no)
2102 [AC_MSG_RESULT(no)])
2104 # Check for Python-specific malloc support
2105 AC_MSG_CHECKING(for --with-pymalloc)
2106 AC_ARG_WITH(pymalloc,
2107 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
2109 if test -z "$with_pymalloc"
2110 then with_pymalloc="yes"
2112 if test "$with_pymalloc" != "no"
2114 AC_DEFINE(WITH_PYMALLOC, 1,
2115 [Define if you want to compile in Python-specific mallocs])
2117 AC_MSG_RESULT($with_pymalloc)
2119 # Check for --with-wctype-functions
2120 AC_MSG_CHECKING(for --with-wctype-functions)
2121 AC_ARG_WITH(wctype-functions,
2122 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
2124 if test "$withval" != no
2126 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2127 [Define if you want wctype.h functions to be used instead of the
2128 one supplied by Python itself. (see Include/unicodectype.h).])
2130 else AC_MSG_RESULT(no)
2132 [AC_MSG_RESULT(no)])
2134 # -I${DLINCLDIR} is added to the compile rule for importdl.o
2138 # the dlopen() function means we might want to use dynload_shlib.o. some
2139 # platforms, such as AIX, have dlopen(), but don't want to use it.
2140 AC_CHECK_FUNCS(dlopen)
2142 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2143 # loading of modules.
2144 AC_SUBST(DYNLOADFILE)
2145 AC_MSG_CHECKING(DYNLOADFILE)
2146 if test -z "$DYNLOADFILE"
2148 case $ac_sys_system/$ac_sys_release in
2149 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2150 if test "$ac_cv_func_dlopen" = yes
2151 then DYNLOADFILE="dynload_shlib.o"
2152 else DYNLOADFILE="dynload_aix.o"
2155 BeOS*) DYNLOADFILE="dynload_beos.o";;
2156 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
2157 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2158 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
2159 atheos*) DYNLOADFILE="dynload_atheos.o";;
2161 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2162 # out any dynamic loading
2163 if test "$ac_cv_func_dlopen" = yes
2164 then DYNLOADFILE="dynload_shlib.o"
2165 else DYNLOADFILE="dynload_stub.o"
2170 AC_MSG_RESULT($DYNLOADFILE)
2171 if test "$DYNLOADFILE" != "dynload_stub.o"
2173 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2174 [Defined when any dynamic module loading is enabled.])
2177 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
2179 AC_SUBST(MACHDEP_OBJS)
2180 AC_MSG_CHECKING(MACHDEP_OBJS)
2181 if test -z "$MACHDEP_OBJS"
2183 MACHDEP_OBJS=$extra_machdep_objs
2185 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
2187 AC_MSG_RESULT(MACHDEP_OBJS)
2189 # checks for library functions
2190 AC_CHECK_FUNCS(alarm bind_textdomain_codeset chown clock confstr ctermid \
2191 execv fork fpathconf ftime ftruncate \
2192 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2193 getpriority getpwent getspnam getspent getsid getwd \
2194 kill killpg lchown lstat mkfifo mknod mktime \
2195 mremap nice pathconf pause plock poll pthread_init \
2196 putenv readlink realpath \
2197 select setegid seteuid setgid \
2198 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
2199 sigaction siginterrupt sigrelse strftime \
2200 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
2201 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
2203 # For some functions, having a definition is not sufficient, since
2204 # we want to take their address.
2205 AC_MSG_CHECKING(for chroot)
2206 AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2207 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2211 AC_MSG_CHECKING(for link)
2212 AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2213 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2217 AC_MSG_CHECKING(for symlink)
2218 AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2219 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2223 AC_MSG_CHECKING(for fchdir)
2224 AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2225 AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2229 AC_MSG_CHECKING(for fsync)
2230 AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
2231 AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2235 AC_MSG_CHECKING(for fdatasync)
2236 AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2237 AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2242 # On some systems (eg. FreeBSD 5), we would find a definition of the
2243 # functions ctermid_r, setgroups in the library, but no prototype
2244 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2245 # address to avoid compiler warnings and potential miscompilations
2246 # because of the missing prototypes.
2248 AC_MSG_CHECKING(for ctermid_r)
2250 #include "confdefs.h"
2252 ], void* p = ctermid_r,
2253 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2258 AC_MSG_CHECKING(for flock)
2260 #include "confdefs.h"
2261 #include <sys/file.h>
2263 AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2268 AC_MSG_CHECKING(for getpagesize)
2270 #include "confdefs.h"
2272 ], void* p = getpagesize,
2273 AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2279 AC_CHECK_PROGS(TRUE, true, /bin/true)
2281 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2282 dnl On others, they are in the C library, so we to take no action
2283 AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
2284 AC_CHECK_LIB(resolv, inet_aton)
2287 AC_MSG_CHECKING(for hstrerror)
2289 #include "confdefs.h"
2291 ], void* p = hstrerror; hstrerror(0),
2292 AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2297 AC_MSG_CHECKING(for inet_aton)
2299 #include "confdefs.h"
2300 #include <sys/types.h>
2301 #include <sys/socket.h>
2302 #include <netinet/in.h>
2303 #include <arpa/inet.h>
2304 ], void* p = inet_aton;inet_aton(0,0),
2305 AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2310 AC_MSG_CHECKING(for inet_pton)
2312 #include "confdefs.h"
2313 #include <sys/types.h>
2314 #include <sys/socket.h>
2315 #include <netinet/in.h>
2316 #include <arpa/inet.h>
2317 ], void* p = inet_pton,
2318 AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2323 # On some systems, setgroups is in unistd.h, on others, in grp.h
2324 AC_MSG_CHECKING(for setgroups)
2326 #include "confdefs.h"
2332 void* p = setgroups,
2333 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2338 # check for openpty and forkpty
2340 AC_CHECK_FUNCS(openpty,,
2341 AC_CHECK_LIB(util,openpty,
2342 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2343 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2346 AC_CHECK_FUNCS(forkpty,,
2347 AC_CHECK_LIB(util,forkpty,
2348 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2349 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2353 # check for long file support functions
2354 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2356 AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
2357 AC_CHECK_FUNCS(getpgrp,
2358 AC_TRY_COMPILE([#include <unistd.h>],
2360 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2361 [Define if getpgrp() must be called as getpgrp(0).])
2364 AC_CHECK_FUNCS(setpgrp,
2365 AC_TRY_COMPILE([#include <unistd.h>],
2367 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2368 [Define if setpgrp() must be called as setpgrp(0, 0).])
2371 AC_CHECK_FUNCS(gettimeofday,
2372 AC_TRY_COMPILE([#include <sys/time.h>],
2373 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2374 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2375 [Define if gettimeofday() does not have second (timezone) argument
2376 This is the case on Motorola V4 (R40V4.2)])
2380 AC_MSG_CHECKING(for major, minor, and makedev)
2382 #if defined(MAJOR_IN_MKDEV)
2383 #include <sys/mkdev.h>
2384 #elif defined(MAJOR_IN_SYSMACROS)
2385 #include <sys/sysmacros.h>
2387 #include <sys/types.h>
2390 makedev(major(0),minor(0));
2392 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2393 [Define to 1 if you have the device macros.])
2399 # On OSF/1 V5.1, getaddrinfo is available, but a define
2400 # for [no]getaddrinfo in netdb.h.
2401 AC_MSG_CHECKING(for getaddrinfo)
2403 #include <sys/types.h>
2404 #include <sys/socket.h>
2408 getaddrinfo(NULL, NULL, NULL, NULL);
2411 AC_MSG_CHECKING(getaddrinfo bug)
2413 #include <sys/types.h>
2416 #include <sys/socket.h>
2417 #include <netinet/in.h>
2421 int passive, gaierr, inet4 = 0, inet6 = 0;
2422 struct addrinfo hints, *ai, *aitop;
2423 char straddr[INET6_ADDRSTRLEN], strport[16];
2425 for (passive = 0; passive <= 1; passive++) {
2426 memset(&hints, 0, sizeof(hints));
2427 hints.ai_family = AF_UNSPEC;
2428 hints.ai_flags = passive ? AI_PASSIVE : 0;
2429 hints.ai_socktype = SOCK_STREAM;
2430 hints.ai_protocol = IPPROTO_TCP;
2431 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2432 (void)gai_strerror(gaierr);
2435 for (ai = aitop; ai; ai = ai->ai_next) {
2436 if (ai->ai_addr == NULL ||
2437 ai->ai_addrlen == 0 ||
2438 getnameinfo(ai->ai_addr, ai->ai_addrlen,
2439 straddr, sizeof(straddr), strport, sizeof(strport),
2440 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2443 switch (ai->ai_family) {
2445 if (strcmp(strport, "54321") != 0) {
2449 if (strcmp(straddr, "0.0.0.0") != 0) {
2453 if (strcmp(straddr, "127.0.0.1") != 0) {
2460 if (strcmp(strport, "54321") != 0) {
2464 if (strcmp(straddr, "::") != 0) {
2468 if (strcmp(straddr, "::1") != 0) {
2478 /* another family support? */
2484 if (!(inet4 == 0 || inet4 == 2))
2486 if (!(inet6 == 0 || inet6 == 2))
2490 freeaddrinfo(aitop);
2495 freeaddrinfo(aitop);
2500 buggygetaddrinfo=no,
2501 AC_MSG_RESULT(buggy)
2502 buggygetaddrinfo=yes,
2503 AC_MSG_RESULT(buggy)
2504 buggygetaddrinfo=yes)], [
2506 buggygetaddrinfo=yes
2509 if test "$buggygetaddrinfo" = "yes"; then
2510 if test "$ipv6" = "yes"; then
2511 echo 'Fatal: You must get working getaddrinfo() function.'
2512 echo ' or you can specify "--disable-ipv6"'.
2516 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
2518 AC_CHECK_FUNCS(getnameinfo)
2520 # checks for structures
2524 AC_CHECK_MEMBERS([struct stat.st_rdev])
2525 AC_CHECK_MEMBERS([struct stat.st_blksize])
2526 AC_CHECK_MEMBERS([struct stat.st_flags])
2527 AC_CHECK_MEMBERS([struct stat.st_gen])
2528 AC_CHECK_MEMBERS([struct stat.st_birthtime])
2531 AC_MSG_CHECKING(for time.h that defines altzone)
2532 AC_CACHE_VAL(ac_cv_header_time_altzone,
2533 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2534 ac_cv_header_time_altzone=yes,
2535 ac_cv_header_time_altzone=no)])
2536 AC_MSG_RESULT($ac_cv_header_time_altzone)
2537 if test $ac_cv_header_time_altzone = yes; then
2538 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
2542 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
2544 #include <sys/types.h>
2545 #include <sys/select.h>
2546 #include <sys/time.h>
2548 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
2549 [Define if you can safely include both <sys/select.h> and <sys/time.h>
2550 (which you can't on SCO ODT 3.0).])
2553 AC_MSG_RESULT($was_it_defined)
2555 AC_MSG_CHECKING(for addrinfo)
2556 AC_CACHE_VAL(ac_cv_struct_addrinfo,
2558 # include <netdb.h>],
2559 [struct addrinfo a],
2560 ac_cv_struct_addrinfo=yes,
2561 ac_cv_struct_addrinfo=no))
2562 AC_MSG_RESULT($ac_cv_struct_addrinfo)
2563 if test $ac_cv_struct_addrinfo = yes; then
2564 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
2567 AC_MSG_CHECKING(for sockaddr_storage)
2568 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
2570 # include <sys/types.h>
2571 # include <sys/socket.h>],
2572 [struct sockaddr_storage s],
2573 ac_cv_struct_sockaddr_storage=yes,
2574 ac_cv_struct_sockaddr_storage=no))
2575 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
2576 if test $ac_cv_struct_sockaddr_storage = yes; then
2577 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
2580 # checks for compiler characteristics
2586 AC_MSG_CHECKING(for working volatile)
2587 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
2588 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
2590 AC_MSG_RESULT($works)
2593 AC_MSG_CHECKING(for working signed char)
2594 AC_TRY_COMPILE([], [signed char c;], works=yes,
2595 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
2597 AC_MSG_RESULT($works)
2600 AC_MSG_CHECKING(for prototypes)
2601 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
2602 AC_DEFINE(HAVE_PROTOTYPES, 1,
2603 [Define if your compiler supports function prototype])
2606 AC_MSG_RESULT($have_prototypes)
2609 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
2612 int foo(int x, ...) {
2620 ], [return foo(10, "", 3.14);], [
2621 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
2622 [Define if your compiler supports variable length function prototypes
2623 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
2626 AC_MSG_RESULT($works)
2628 # check for socketpair
2629 AC_MSG_CHECKING(for socketpair)
2631 #include <sys/types.h>
2632 #include <sys/socket.h>
2633 ], void *x=socketpair,
2634 AC_DEFINE(HAVE_SOCKETPAIR, 1, Define if you have the 'socketpair' function.)
2639 # check if sockaddr has sa_len member
2640 AC_MSG_CHECKING(if sockaddr has sa_len member)
2641 AC_TRY_COMPILE([#include <sys/types.h>
2642 #include <sys/socket.h>],
2646 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
2650 AC_MSG_CHECKING(whether va_list is an array)
2652 #ifdef HAVE_STDARG_PROTOTYPES
2655 #include <varargs.h>
2657 ], [va_list list1, list2; list1 = list2;], , [
2658 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
2659 va_list_is_array=yes
2661 AC_MSG_RESULT($va_list_is_array)
2663 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
2664 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
2665 [Define this if you have some version of gethostbyname_r()])
2667 AC_CHECK_FUNC(gethostbyname_r, [
2668 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2669 AC_MSG_CHECKING([gethostbyname_r with 6 args])
2671 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
2676 struct hostent *he, *res;
2681 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
2683 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2684 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
2685 [Define this if you have the 6-arg version of gethostbyname_r().])
2689 AC_MSG_CHECKING([gethostbyname_r with 5 args])
2699 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
2701 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2702 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
2703 [Define this if you have the 5-arg version of gethostbyname_r().])
2707 AC_MSG_CHECKING([gethostbyname_r with 3 args])
2713 struct hostent_data data;
2715 (void) gethostbyname_r(name, he, &data);
2717 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2718 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
2719 [Define this if you have the 3-arg version of gethostbyname_r().])
2728 AC_CHECK_FUNCS(gethostbyname)
2730 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
2731 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
2732 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
2733 AC_SUBST(HAVE_GETHOSTBYNAME_R)
2734 AC_SUBST(HAVE_GETHOSTBYNAME)
2736 # checks for system services
2739 # Linux requires this for correct f.p. operations
2740 AC_CHECK_FUNC(__fpu_control,
2742 [AC_CHECK_LIB(ieee, __fpu_control)
2745 # Check for --with-fpectl
2746 AC_MSG_CHECKING(for --with-fpectl)
2748 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
2750 if test "$withval" != no
2752 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
2753 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
2755 else AC_MSG_RESULT(no)
2757 [AC_MSG_RESULT(no)])
2759 # check for --with-libm=...
2761 case $ac_sys_system in
2766 AC_MSG_CHECKING(for --with-libm=STRING)
2768 AC_HELP_STRING(--with-libm=STRING, math library),
2770 if test "$withval" = no
2772 AC_MSG_RESULT(force LIBM empty)
2773 elif test "$withval" != yes
2775 AC_MSG_RESULT(set LIBM="$withval")
2776 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
2778 [AC_MSG_RESULT(default LIBM="$LIBM")])
2780 # check for --with-libc=...
2782 AC_MSG_CHECKING(for --with-libc=STRING)
2784 AC_HELP_STRING(--with-libc=STRING, C library),
2786 if test "$withval" = no
2788 AC_MSG_RESULT(force LIBC empty)
2789 elif test "$withval" != yes
2791 AC_MSG_RESULT(set LIBC="$withval")
2792 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
2794 [AC_MSG_RESULT(default LIBC="$LIBC")])
2796 # check for hypot() in math library
2799 AC_REPLACE_FUNCS(hypot)
2803 AC_CHECK_HEADER(wchar.h, [
2804 AC_DEFINE(HAVE_WCHAR_H, 1,
2805 [Define if the compiler provides a wchar.h header file.])
2811 # determine wchar_t size
2812 if test "$wchar_h" = yes
2814 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
2817 AC_MSG_CHECKING(for UCS-4 tcl)
2821 #if TCL_UTF_MAX != 6
2822 # error "NOT UCS4_TCL"
2824 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
2827 AC_MSG_RESULT($have_ucs4_tcl)
2829 # check whether wchar_t is signed or not
2830 if test "$wchar_h" = yes
2832 # check whether wchar_t is signed or not
2833 AC_MSG_CHECKING(whether wchar_t is signed)
2834 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
2839 /* Success: exit code 0 */
2840 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
2843 ac_cv_wchar_t_signed=yes,
2844 ac_cv_wchar_t_signed=no,
2845 ac_cv_wchar_t_signed=yes)])
2846 AC_MSG_RESULT($ac_cv_wchar_t_signed)
2849 AC_MSG_CHECKING(what type to use for unicode)
2850 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2851 AC_ARG_ENABLE(unicode,
2852 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
2854 [enable_unicode=yes])
2856 if test $enable_unicode = yes
2858 # Without any arguments, Py_UNICODE defaults to two-byte mode
2859 case "$have_ucs4_tcl" in
2860 yes) enable_unicode="ucs4"
2862 *) enable_unicode="ucs2"
2867 AH_TEMPLATE(Py_UNICODE_SIZE,
2868 [Define as the size of the unicode type.])
2869 case "$enable_unicode" in
2870 ucs2) unicode_size="2"
2871 AC_DEFINE(Py_UNICODE_SIZE,2)
2873 ucs4) unicode_size="4"
2874 AC_DEFINE(Py_UNICODE_SIZE,4)
2878 AH_TEMPLATE(PY_UNICODE_TYPE,
2879 [Define as the integral type used for Unicode representation.])
2881 AC_SUBST(UNICODE_OBJS)
2882 if test "$enable_unicode" = "no"
2885 AC_MSG_RESULT(not used)
2887 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
2888 AC_DEFINE(Py_USING_UNICODE, 1,
2889 [Define if you want to have a Unicode type.])
2891 # wchar_t is only usable if it maps to an unsigned type
2892 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
2893 -a "$ac_cv_wchar_t_signed" = "no"
2895 PY_UNICODE_TYPE="wchar_t"
2896 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
2897 [Define if you have a useable wchar_t type defined in wchar.h; useable
2898 means wchar_t must be an unsigned type with at least 16 bits. (see
2899 Include/unicodeobject.h).])
2900 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
2901 elif test "$ac_cv_sizeof_short" = "$unicode_size"
2903 PY_UNICODE_TYPE="unsigned short"
2904 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
2905 elif test "$ac_cv_sizeof_long" = "$unicode_size"
2907 PY_UNICODE_TYPE="unsigned long"
2908 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
2910 PY_UNICODE_TYPE="no type found"
2912 AC_MSG_RESULT($PY_UNICODE_TYPE)
2915 # check for endianness
2917 AH_VERBATIM([WORDS_BIGENDIAN],
2919 /* Define to 1 if your processor stores words with the most significant byte
2920 first (like Motorola and SPARC, unlike Intel and VAX).
2922 The block below does compile-time checking for endianness on platforms
2923 that use GCC and therefore allows compiling fat binaries on OSX by using
2924 '-arch ppc -arch i386' as the compile flags. The phrasing was choosen
2925 such that the configure-result is used on systems that don't use GCC.
2927 #ifdef __BIG_ENDIAN__
2928 #define WORDS_BIGENDIAN 1
2930 #ifndef __LITTLE_ENDIAN__
2931 #undef WORDS_BIGENDIAN
2935 # Check whether right shifting a negative integer extends the sign bit
2936 # or fills with zeros (like the Cray J90, according to Tim Peters).
2937 AC_MSG_CHECKING(whether right shift extends the sign bit)
2938 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
2942 exit(((-1)>>3 == -1) ? 0 : 1);
2945 ac_cv_rshift_extends_sign=yes,
2946 ac_cv_rshift_extends_sign=no,
2947 ac_cv_rshift_extends_sign=yes)])
2948 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
2949 if test "$ac_cv_rshift_extends_sign" = no
2951 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
2952 [Define if i>>j for signed int i does not extend the sign bit
2956 # check for getc_unlocked and related locking functions
2957 AC_MSG_CHECKING(for getc_unlocked() and friends)
2958 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
2959 AC_TRY_LINK([#include <stdio.h>],[
2960 FILE *f = fopen("/dev/null", "r");
2964 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
2965 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
2966 if test "$ac_cv_have_getc_unlocked" = yes
2968 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
2969 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
2972 # check where readline lives
2973 # save the value of LIBS so we don't actually link Python with readline
2974 LIBS_no_readline=$LIBS
2975 AC_CHECK_LIB(readline, readline)
2976 if test "$ac_cv_have_readline_readline" = no
2978 AC_CHECK_LIB(termcap, readline)
2981 # check for readline 2.1
2982 AC_CHECK_LIB(readline, rl_callback_handler_install,
2983 AC_DEFINE(HAVE_RL_CALLBACK, 1,
2984 [Define if you have readline 2.1]), , )
2986 # check for readline 2.2
2987 AC_TRY_CPP([#include <readline/readline.h>],
2988 have_readline=yes, have_readline=no)
2989 if test $have_readline = yes
2991 AC_EGREP_HEADER([extern int rl_completion_append_character;],
2992 [readline/readline.h],
2993 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
2994 [Define if you have readline 2.2]), )
2997 # check for readline 4.0
2998 AC_CHECK_LIB(readline, rl_pre_input_hook,
2999 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
3000 [Define if you have readline 4.0]), , )
3002 # check for readline 4.2
3003 AC_CHECK_LIB(readline, rl_completion_matches,
3004 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
3005 [Define if you have readline 4.2]), , )
3007 # also in readline 4.2
3008 AC_TRY_CPP([#include <readline/readline.h>],
3009 have_readline=yes, have_readline=no)
3010 if test $have_readline = yes
3012 AC_EGREP_HEADER([extern int rl_catch_signals;],
3013 [readline/readline.h],
3014 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3015 [Define if you can turn off readline's signal handling.]), )
3018 # End of readline checks: restore LIBS
3019 LIBS=$LIBS_no_readline
3021 AC_MSG_CHECKING(for broken nice())
3022 AC_CACHE_VAL(ac_cv_broken_nice, [
3027 if (val1 != -1 && val1 == nice(2))
3032 ac_cv_broken_nice=yes,
3033 ac_cv_broken_nice=no,
3034 ac_cv_broken_nice=no)])
3035 AC_MSG_RESULT($ac_cv_broken_nice)
3036 if test "$ac_cv_broken_nice" = yes
3038 AC_DEFINE(HAVE_BROKEN_NICE, 1,
3039 [Define if nice() returns success/failure instead of the new priority.])
3042 AC_MSG_CHECKING(for broken poll())
3048 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
3052 int poll_test = poll (&poll_struct, 1, 0);
3058 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
3068 ac_cv_broken_poll=yes,
3069 ac_cv_broken_poll=no,
3070 ac_cv_broken_poll=no)
3071 AC_MSG_RESULT($ac_cv_broken_poll)
3072 if test "$ac_cv_broken_poll" = yes
3074 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3075 [Define if poll() sets errno on invalid file descriptors.])
3078 # Before we can test tzset, we need to check if struct tm has a tm_zone
3079 # (which is not required by ISO C or UNIX spec) and/or if we support
3083 # check tzset(3) exists and works like we expect it to
3084 AC_MSG_CHECKING(for working tzset())
3085 AC_CACHE_VAL(ac_cv_working_tzset, [
3092 extern char *tzname[];
3097 /* Note that we need to ensure that not only does tzset(3)
3098 do 'something' with localtime, but it works as documented
3099 in the library reference and as expected by the test suite.
3100 This includes making sure that tzname is set properly if
3101 tm->tm_zone does not exist since it is the alternative way
3102 of getting timezone info.
3104 Red Hat 6.2 doesn't understand the southern hemisphere
3105 after New Year's Day.
3108 time_t groundhogday = 1044144000; /* GMT-based */
3109 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3113 if (localtime(&groundhogday)->tm_hour != 0)
3116 /* For UTC, tzname[1] is sometimes "", sometimes " " */
3117 if (strcmp(tzname[0], "UTC") ||
3118 (tzname[1][0] != 0 && tzname[1][0] != ' '))
3122 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
3124 if (localtime(&groundhogday)->tm_hour != 19)
3127 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
3131 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
3133 if (localtime(&groundhogday)->tm_hour != 11)
3136 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
3140 #if HAVE_STRUCT_TM_TM_ZONE
3141 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
3143 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
3150 ac_cv_working_tzset=yes,
3151 ac_cv_working_tzset=no,
3152 ac_cv_working_tzset=no)])
3153 AC_MSG_RESULT($ac_cv_working_tzset)
3154 if test "$ac_cv_working_tzset" = yes
3156 AC_DEFINE(HAVE_WORKING_TZSET, 1,
3157 [Define if tzset() actually switches the local timezone in a meaningful way.])
3160 # Look for subsecond timestamps in struct stat
3161 AC_MSG_CHECKING(for tv_nsec in struct stat)
3162 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
3163 AC_TRY_COMPILE([#include <sys/stat.h>], [
3165 st.st_mtim.tv_nsec = 1;
3167 ac_cv_stat_tv_nsec=yes,
3168 ac_cv_stat_tv_nsec=no,
3169 ac_cv_stat_tv_nsec=no))
3170 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
3171 if test "$ac_cv_stat_tv_nsec" = yes
3173 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
3174 [Define if you have struct stat.st_mtim.tv_nsec])
3177 # Look for BSD style subsecond timestamps in struct stat
3178 AC_MSG_CHECKING(for tv_nsec2 in struct stat)
3179 AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
3180 AC_TRY_COMPILE([#include <sys/stat.h>], [
3182 st.st_mtimespec.tv_nsec = 1;
3184 ac_cv_stat_tv_nsec2=yes,
3185 ac_cv_stat_tv_nsec2=no,
3186 ac_cv_stat_tv_nsec2=no))
3187 AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
3188 if test "$ac_cv_stat_tv_nsec2" = yes
3190 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
3191 [Define if you have struct stat.st_mtimensec])
3194 # On HP/UX 11.0, mvwdelch is a block with a return statement
3195 AC_MSG_CHECKING(whether mvwdelch is an expression)
3196 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
3197 AC_TRY_COMPILE([#include <curses.h>], [
3199 rtn = mvwdelch(0,0,0);
3200 ], ac_cv_mvwdelch_is_expression=yes,
3201 ac_cv_mvwdelch_is_expression=no,
3202 ac_cv_mvwdelch_is_expression=yes))
3203 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
3205 if test "$ac_cv_mvwdelch_is_expression" = yes
3207 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
3208 [Define if mvwdelch in curses.h is an expression.])
3211 AC_MSG_CHECKING(whether WINDOW has _flags)
3212 AC_CACHE_VAL(ac_cv_window_has_flags,
3213 AC_TRY_COMPILE([#include <curses.h>], [
3216 ], ac_cv_window_has_flags=yes,
3217 ac_cv_window_has_flags=no,
3218 ac_cv_window_has_flags=no))
3219 AC_MSG_RESULT($ac_cv_window_has_flags)
3222 if test "$ac_cv_window_has_flags" = yes
3224 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
3225 [Define if WINDOW in curses.h offers a field _flags.])
3228 AC_MSG_CHECKING(for /dev/ptmx)
3230 if test -e /dev/ptmx
3233 AC_DEFINE(HAVE_DEV_PTMX, 1,
3234 [Define if we have /dev/ptmx.])
3239 AC_MSG_CHECKING(for /dev/ptc)
3244 AC_DEFINE(HAVE_DEV_PTC, 1,
3245 [Define if we have /dev/ptc.])
3250 AC_MSG_CHECKING(for %zd printf() format support)
3251 AC_TRY_RUN([#include <stdio.h>
3259 if(sprintf(buffer, "%zd", (size_t)123) < 0)
3262 if (strncmp(buffer, "123", 3))
3268 AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
3271 AC_CHECK_TYPE(socklen_t,,
3272 AC_DEFINE(socklen_t,int,
3273 Define to `int' if <sys/socket.h> does not define.),[
3274 #ifdef HAVE_SYS_TYPES_H
3275 #include <sys/types.h>
3277 #ifdef HAVE_SYS_SOCKET_H
3278 #include <sys/socket.h>
3282 AC_SUBST(THREADHEADERS)
3284 for h in `(cd $srcdir;echo Python/thread_*.h)`
3286 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
3290 SRCDIRS="Parser Grammar Objects Python Modules Mac"
3291 AC_MSG_CHECKING(for build directories)
3292 for dir in $SRCDIRS; do
3293 if test ! -d $dir; then
3299 # generate output files
3300 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
3303 echo "creating Modules/Setup"
3304 if test ! -f Modules/Setup
3306 cp $srcdir/Modules/Setup.dist Modules/Setup
3309 echo "creating Modules/Setup.local"
3310 if test ! -f Modules/Setup.local
3312 echo "# Edit this file for local setup changes" >Modules/Setup.local
3315 echo "creating Makefile"
3316 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
3317 -s Modules Modules/Setup.config \
3318 Modules/Setup.local Modules/Setup