1 dnl ***********************************************
2 dnl * Please run autoreconf to test your changes! *
3 dnl ***********************************************
4 dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.61).
6 # Set VERSION so we only need to edit in one place (i.e., here)
7 m4_define(PYTHON_VERSION, 3.1)
9 AC_REVISION($Revision$)
11 AC_INIT(python, PYTHON_VERSION, http://www.python.org/python-bugs)
12 AC_CONFIG_SRCDIR([Include/object.h])
13 AC_CONFIG_HEADER(pyconfig.h)
15 dnl This is for stuff that absolutely must end up in pyconfig.h.
16 dnl Please use pyport.h instead, if possible.
22 /* Define the macros needed if on a UnixWare 7.x system. */
23 #if defined(__USLC__) && defined(__SCO_VERSION__)
24 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
27 #endif /*Py_PYCONFIG_H*/
30 # We don't use PACKAGE_ variables, and they cause conflicts
31 # with other autoconf-based packages that include Python.h
32 grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
34 mv confdefs.h.new confdefs.h
37 VERSION=PYTHON_VERSION
42 # The later defininition of _XOPEN_SOURCE disables certain features
43 # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
44 AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
46 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
47 # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
49 AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
51 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
52 # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
54 AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
56 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
57 # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
58 AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
60 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
61 # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
63 AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
66 define_xopen_source=yes
68 # Arguments passed to configure.
70 CONFIG_ARGS="$ac_configure_args"
72 AC_ARG_ENABLE(universalsdk,
73 AC_HELP_STRING(--enable-universalsdk@<:@=SDKDIR@:>@, Build against Mac OS X 10.4u SDK (ppc/i386)),
77 enableval=/Developer/SDKs/MacOSX10.4u.sdk
86 UNIVERSALSDK=$enableval
93 AC_SUBST(UNIVERSALSDK)
96 AC_SUBST(ARCH_RUN_32BIT)
98 UNIVERSAL_ARCHS="32-bit"
99 AC_MSG_CHECKING(for --with-universal-archs)
100 AC_ARG_WITH(universal-archs,
101 AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit" or "all")),
103 AC_MSG_RESULT($withval)
104 UNIVERSAL_ARCHS="$withval"
107 AC_MSG_RESULT(32-bit)
112 AC_ARG_WITH(framework-name,
113 AC_HELP_STRING(--with-framework-name=FRAMEWORK,
114 specify an alternate name of the framework built with --enable-framework),
116 PYTHONFRAMEWORK=${withval}
117 PYTHONFRAMEWORKDIR=${withval}.framework
118 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
120 PYTHONFRAMEWORK=Python
121 PYTHONFRAMEWORKDIR=Python.framework
122 PYTHONFRAMEWORKIDENTIFIER=org.python.python
124 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
125 AC_ARG_ENABLE(framework,
126 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
130 enableval=/Library/Frameworks
135 PYTHONFRAMEWORKDIR=no-framework
136 PYTHONFRAMEWORKPREFIX=
137 PYTHONFRAMEWORKINSTALLDIR=
138 FRAMEWORKINSTALLFIRST=
139 FRAMEWORKINSTALLLAST=
140 FRAMEWORKALTINSTALLFIRST=
141 FRAMEWORKALTINSTALLLAST=
142 if test "x${prefix}" = "xNONE"; then
143 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
145 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
150 PYTHONFRAMEWORKPREFIX=$enableval
151 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
152 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
153 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
154 if test "$UNIVERSAL_ARCHS" = "all"
156 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way"
158 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
161 if test "x${prefix}" = "xNONE" ; then
162 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
164 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
166 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
168 # Add files for Mac specific code to the list of output
170 AC_CONFIG_FILES(Mac/Makefile)
171 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
172 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
173 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
177 PYTHONFRAMEWORKDIR=no-framework
178 PYTHONFRAMEWORKPREFIX=
179 PYTHONFRAMEWORKINSTALLDIR=
180 FRAMEWORKINSTALLFIRST=
181 FRAMEWORKINSTALLLAST=
182 FRAMEWORKALTINSTALLFIRST=
183 FRAMEWORKALTINSTALLLAST=
184 if test "x${prefix}" = "xNONE" ; then
185 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
187 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
191 if test "$UNIVERSAL_ARCHS" = "all"
193 FRAMEWORKINSTALLLAST=update4wayuniversal
194 FRAMEWORKALTINSTALLLAST=update4wayuniversal
197 AC_SUBST(PYTHONFRAMEWORK)
198 AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
199 AC_SUBST(PYTHONFRAMEWORKDIR)
200 AC_SUBST(PYTHONFRAMEWORKPREFIX)
201 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
202 AC_SUBST(FRAMEWORKINSTALLFIRST)
203 AC_SUBST(FRAMEWORKINSTALLLAST)
204 AC_SUBST(FRAMEWORKALTINSTALLFIRST)
205 AC_SUBST(FRAMEWORKALTINSTALLLAST)
206 AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
209 ## AC_HELP_STRING(--with-dyld,
210 ## Use (OpenStep|Rhapsody) dynamic linker))
212 # Set name for machine-dependent library files
214 AC_MSG_CHECKING(MACHDEP)
215 if test -z "$MACHDEP"
217 ac_sys_system=`uname -s`
218 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
219 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
220 ac_sys_release=`uname -v`
222 ac_sys_release=`uname -r`
224 ac_md_system=`echo $ac_sys_system |
225 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
226 ac_md_release=`echo $ac_sys_release |
227 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
228 MACHDEP="$ac_md_system$ac_md_release"
231 cygwin*) MACHDEP="cygwin";;
232 darwin*) MACHDEP="darwin";;
233 atheos*) MACHDEP="atheos";;
234 irix646) MACHDEP="irix6";;
235 '') MACHDEP="unknown";;
239 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
240 # disable features if it is defined, without any means to access these
241 # features as extensions. For these systems, we skip the definition of
242 # _XOPEN_SOURCE. Before adding a system to the list to gain access to
243 # some feature, make sure there is no alternative way to access this
244 # feature. Also, when using wildcards, make sure you have verified the
245 # need for not defining _XOPEN_SOURCE on all systems matching the
246 # wildcard, and that the wildcard does not include future systems
247 # (which may remove their limitations).
248 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
249 case $ac_sys_system/$ac_sys_release in
250 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
251 # even though select is a POSIX function. Reported by J. Ribbens.
252 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
253 OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123@:>@)
254 define_xopen_source=no
255 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
256 # also defined. This can be overridden by defining _BSD_SOURCE
257 # As this has a different meaning on Linux, only define it on OpenBSD
258 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
260 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
261 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
263 NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
264 define_xopen_source=no;;
265 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
266 # of union __?sigval. Reported by Stuart Bishop.
268 define_xopen_source=no;;
269 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
270 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
271 # Reconfirmed for 7.1.4 by Martin v. Loewis.
272 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
273 define_xopen_source=no;;
274 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
275 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
277 define_xopen_source=no;;
278 # On FreeBSD 4, the math functions C89 does not cover are never defined
279 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
281 define_xopen_source=no;;
282 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
283 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
284 # identifies itself as Darwin/7.*
285 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
286 # disables platform specific features beyond repair.
287 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
288 # has no effect, don't bother defining them
289 Darwin/@<:@6789@:>@.*)
290 define_xopen_source=no;;
291 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
292 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
293 # or has another value. By not (re)defining it, the defaults come in place.
295 define_xopen_source=no;;
297 if test `uname -r` -eq 1; then
298 define_xopen_source=no
301 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
302 # defining NI_NUMERICHOST.
304 define_xopen_source=no
309 if test $define_xopen_source = yes
311 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
312 # defined precisely as g++ defines it
313 # Furthermore, on Solaris 10, XPG6 requires the use of a C99
315 case $ac_sys_system/$ac_sys_release in
316 SunOS/5.8|SunOS/5.9|SunOS/5.10)
317 AC_DEFINE(_XOPEN_SOURCE, 500,
318 Define to the level of X/Open that your system supports)
321 AC_DEFINE(_XOPEN_SOURCE, 600,
322 Define to the level of X/Open that your system supports)
326 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
327 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
328 # several APIs are not declared. Since this is also needed in some
329 # cases for HP-UX, we define it globally.
330 # except for Solaris 10, where it must not be defined,
331 # as it implies XPG4.2
332 case $ac_sys_system/$ac_sys_release in
336 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
337 Define to activate Unix95-and-earlier features)
341 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
346 # SGI compilers allow the specification of the both the ABI and the
347 # ISA on the command line. Depending on the values of these switches,
348 # different and often incompatable code will be generated.
350 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
351 # thus supply support for various ABI/ISA combinations. The MACHDEP
352 # variable is also adjusted.
355 if test ! -z "$SGI_ABI"
358 LDFLAGS="$SGI_ABI $LDFLAGS"
359 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
361 AC_MSG_RESULT($MACHDEP)
363 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
364 # it may influence the way we can build extensions, so distutils
366 AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
367 AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
368 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
369 EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
371 AC_MSG_CHECKING(machine type as reported by uname -m)
372 ac_sys_machine=`uname -m`
373 AC_MSG_RESULT($ac_sys_machine)
375 # checks for alternative programs
377 # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
378 # for debug/optimization stuff. BASECFLAGS is for flags that are required
379 # just to get things to compile and link. Users are free to override OPT
380 # when running configure or make. The build should not break if they do.
381 # BASECFLAGS should generally not be messed with, however.
383 # XXX shouldn't some/most/all of this code be merged with the stuff later
384 # on that fiddles with OPT and BASECFLAGS?
385 AC_MSG_CHECKING(for --without-gcc)
387 AC_HELP_STRING(--without-gcc,never use gcc),
395 without_gcc=$withval;;
397 case $ac_sys_system in
405 AC_MSG_RESULT($without_gcc)
407 # If the user switches compilers, we can't believe the cache
408 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
410 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
411 (it is also a good idea to do 'make clean' before compiling)])
418 AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
419 AC_ARG_WITH(cxx_main,
420 AC_HELP_STRING([--with-cxx-main=<compiler>],
421 [compile main() and link python executable with C++ compiler]),
427 yes) with_cxx_main=yes
439 AC_MSG_RESULT($with_cxx_main)
445 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
446 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
448 if test "$CXX" = "notfound"
455 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
456 if test "$CXX" = "notfound"
461 if test "$preset_cxx" != "$CXX"
465 By default, distutils will build C++ extension modules with "$CXX".
466 If this is not intended, then set CXX on the configure command line.
471 # checks for UNIX variants that set C preprocessor variables
474 # Check for unsupported systems
475 case $ac_sys_system/$ac_sys_release in
477 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
478 echo See README for details.
483 AC_MSG_CHECKING(for --with-suffix)
485 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
492 AC_MSG_RESULT($EXEEXT)
494 # Test whether we're running on a non-case-sensitive system, in which
495 # case we give a warning if no ext is given
496 AC_SUBST(BUILDEXEEXT)
497 AC_MSG_CHECKING(for case-insensitive build directory)
498 if test ! -d CaseSensitiveTestDir; then
499 mkdir CaseSensitiveTestDir
502 if test -d casesensitivetestdir
510 rmdir CaseSensitiveTestDir
515 gcc) CC="$CC -D_HAVE_BSDI";;
519 case $ac_sys_system in
522 cc|*/cc) CC="$CC -Ae";;
526 cc) CC="$CC -Wl,-Bexport";;
529 # Some functions have a prototype only with that define, e.g. confstr
530 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
536 AC_MSG_CHECKING(LIBRARY)
537 if test -z "$LIBRARY"
539 LIBRARY='libpython$(VERSION).a'
541 AC_MSG_RESULT($LIBRARY)
543 # LDLIBRARY is the name of the library to link against (as opposed to the
544 # name of the library into which to insert object files). BLDLIBRARY is also
545 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
546 # is blank as the main program is not linked directly against LDLIBRARY.
547 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
548 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
549 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
550 # DLLLIBRARY is the shared (i.e., DLL) library.
552 # RUNSHARED is used to run shared python without installed libraries
554 # INSTSONAME is the name of the shared library that will be use to install
555 # on the system - some systems like version suffix, others don't
559 AC_SUBST(LDLIBRARYDIR)
563 BLDLIBRARY='$(LDLIBRARY)'
564 INSTSONAME='$(LDLIBRARY)'
569 # LINKCC is the command that links the python executable -- default is $(CC).
570 # If CXX is set, and if it is needed to link a main function that was
571 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
572 # python might then depend on the C++ runtime
573 # This is altered for AIX in order to build the export list before
576 AC_MSG_CHECKING(LINKCC)
579 LINKCC='$(PURIFY) $(MAINCC)'
580 case $ac_sys_system in
583 if test $ac_sys_release -ge 5 -o \
584 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
587 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
589 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
591 # qcc must be used because the other compilers do not
596 AC_MSG_RESULT($LINKCC)
598 AC_MSG_CHECKING(for --enable-shared)
599 AC_ARG_ENABLE(shared,
600 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
602 if test -z "$enable_shared"
604 case $ac_sys_system in
606 enable_shared="yes";;
611 AC_MSG_RESULT($enable_shared)
613 AC_MSG_CHECKING(for --enable-profiling)
614 AC_ARG_ENABLE(profiling,
615 AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
618 AC_TRY_RUN([int main() { return 0; }],
619 ac_enable_profiling="yes",
620 ac_enable_profiling="no",
621 ac_enable_profiling="no")
623 AC_MSG_RESULT($ac_enable_profiling)
625 case "$ac_enable_profiling" in
627 BASECFLAGS="-pg $BASECFLAGS"
628 LDFLAGS="-pg $LDFLAGS"
632 AC_MSG_CHECKING(LDLIBRARY)
634 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
635 # library that we build, but we do not want to link against it (we
636 # will find it with a -framework option). For this reason there is an
637 # extra variable BLDLIBRARY against which Python and the extension
638 # modules are linked, BLDLIBRARY. This is normally the same as
639 # LDLIBRARY, but empty for MacOSX framework builds.
640 if test "$enable_framework"
642 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
643 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
646 BLDLIBRARY='$(LDLIBRARY)'
649 # Other platforms follow
650 if test $enable_shared = "yes"; then
651 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
652 case $ac_sys_system in
654 LDLIBRARY='libpython$(VERSION).dll.a'
655 DLLLIBRARY='libpython$(VERSION).dll'
658 LDLIBRARY='libpython$(VERSION).so'
659 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
660 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
661 INSTSONAME="$LDLIBRARY".$SOVERSION
663 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
664 LDLIBRARY='libpython$(VERSION).so'
665 BLDLIBRARY='-L. -lpython$(VERSION)'
666 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
667 case $ac_sys_system in
669 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
672 INSTSONAME="$LDLIBRARY".$SOVERSION
677 LDLIBRARY='libpython$(VERSION).so'
680 LDLIBRARY='libpython$(VERSION).sl'
683 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
684 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
687 LDLIBRARY='libpython$(VERSION).so'
688 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
689 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
692 LDLIBRARY='libpython$(VERSION).so'
693 BLDLIBRARY='-L. -lpython$(VERSION)'
694 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
697 LDLIBRARY='libpython$(VERSION).dylib'
698 BLDLIBRARY='-L. -lpython$(VERSION)'
699 RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
703 else # shared is disabled
704 case $ac_sys_system in
706 BLDLIBRARY='$(LIBRARY)'
707 LDLIBRARY='libpython$(VERSION).dll.a'
712 AC_MSG_RESULT($LDLIBRARY)
716 AC_CHECK_PROGS(AR, ar aal, ar)
719 AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
720 if test $SVNVERSION = found
722 SVNVERSION="svnversion \$(srcdir)"
724 SVNVERSION="echo exported"
729 # install -d does not work on BSDI or HP-UX
730 if test -z "$INSTALL"
732 INSTALL="${srcdir}/install-sh -c"
737 # Not every filesystem supports hard links
739 if test -z "$LN" ; then
740 case $ac_sys_system in
741 CYGWIN*) LN="ln -s";;
742 atheos*) LN="ln -s";;
747 # Check for --with-pydebug
748 AC_MSG_CHECKING(for --with-pydebug)
750 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
752 if test "$withval" != no
754 AC_DEFINE(Py_DEBUG, 1,
755 [Define if you want to build an interpreter with many run-time checks.])
758 else AC_MSG_RESULT(no); Py_DEBUG='false'
762 # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
763 # merged with this chunk of code?
765 # Optimizer/debugger flags
766 # ------------------------
767 # (The following bit of code is complicated enough - please keep things
768 # indented properly. Just pretend you're editing Python code. ;-)
770 # There are two parallel sets of case statements below, one that checks to
771 # see if OPT was set and one that does BASECFLAGS setting based upon
772 # compiler and platform. BASECFLAGS tweaks need to be made even if the
775 # tweak OPT based on compiler and platform, only if the user didn't set
776 # it on the command line
782 if test "$CC" != 'g++' ; then
783 STRICT_PROTO="-Wstrict-prototypes"
785 # For gcc 4.x we need to use -fwrapv so lets check if its supported
786 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
789 case $ac_cv_prog_cc_g in
791 if test "$Py_DEBUG" = 'true' ; then
792 # Optimization messes up debuggers, so turn it off for
794 OPT="-g -Wall $STRICT_PROTO"
796 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
800 OPT="-O3 -Wall $STRICT_PROTO"
803 case $ac_sys_system in
804 SCO_SV*) OPT="$OPT -m486 -DSCO5"
814 # The current (beta) Monterey compiler dies with optimizations
815 # XXX what is Monterey? Does it still die w/ -O? Can we get rid of this?
816 case $ac_sys_system in
826 # The -arch flags for universal builds on OSX
827 UNIVERSAL_ARCH_FLAGS=
828 AC_SUBST(UNIVERSAL_ARCH_FLAGS)
830 # tweak BASECFLAGS based on compiler and platform
833 # Python violates C99 rules, by casting between incompatible
834 # pointer types. GCC may generate bad code as a result of that,
835 # so use -fno-strict-aliasing if supported.
836 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
838 CC="$CC -fno-strict-aliasing"
839 AC_TRY_RUN([int main() { return 0; }],
840 ac_cv_no_strict_aliasing_ok=yes,
841 ac_cv_no_strict_aliasing_ok=no,
842 ac_cv_no_strict_aliasing_ok=no)
844 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
845 if test $ac_cv_no_strict_aliasing_ok = yes
847 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
850 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
851 # support. Without this, treatment of subnormals doesn't follow
853 case $ac_sys_machine in
855 BASECFLAGS="$BASECFLAGS -mieee"
859 case $ac_sys_system in
861 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
863 # is there any other compiler on Darwin besides gcc?
865 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
866 # used to be here, but non-Apple gcc doesn't accept them.
869 if test "${enable_universalsdk}"; then
870 UNIVERSAL_ARCH_FLAGS=""
871 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
872 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
875 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
876 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
878 elif test "$UNIVERSAL_ARCHS" = "all" ; then
879 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
880 ARCH_RUN_32BIT="arch -i386 -ppc"
883 AC_MSG_ERROR([proper usage is --with-universalarch=32-bit|64-bit|all])
888 BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
889 tgt=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
890 if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
891 CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
895 # Calculate the right deployment target for this build.
897 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
898 if test ${cur_target} '>' 10.2; then
901 if test "${UNIVERSAL_ARCHS}" = "all"; then
902 # Ensure that the default platform for a 4-way
903 # universal build is OSX 10.5, that's the first
904 # OS release where 4-way builds make sense.
907 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
909 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
910 # environment with a value that is the same as what we'll use
911 # in the Makefile to ensure that we'll get the same compiler
912 # environment during configure and build time.
913 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
914 export MACOSX_DEPLOYMENT_TARGET
915 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
919 BASECFLAGS="$BASECFLAGS -mieee"
925 case $ac_sys_system in
927 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
930 BASECFLAGS="$BASECFLAGS -ieee -std"
933 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
939 if test "$Py_DEBUG" = 'true'; then
945 if test "$ac_arch_flags"
947 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
950 # disable check for icc since it seems to pass, but generates a warning
953 ac_cv_opt_olimit_ok=no
956 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
957 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
959 CC="$CC -OPT:Olimit=0"
960 AC_TRY_RUN([int main() { return 0; }],
961 ac_cv_opt_olimit_ok=yes,
962 ac_cv_opt_olimit_ok=no,
963 ac_cv_opt_olimit_ok=no)
965 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
966 if test $ac_cv_opt_olimit_ok = yes; then
967 case $ac_sys_system in
968 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
969 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
974 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
978 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
979 AC_CACHE_VAL(ac_cv_olimit_ok,
981 CC="$CC -Olimit 1500"
982 AC_TRY_RUN([int main() { return 0; }],
987 AC_MSG_RESULT($ac_cv_olimit_ok)
988 if test $ac_cv_olimit_ok = yes; then
989 BASECFLAGS="$BASECFLAGS -Olimit 1500"
993 # Check whether GCC supports PyArg_ParseTuple format
994 if test "$GCC" = "yes"
996 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
998 CFLAGS="$CFLAGS -Werror"
1000 void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
1002 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1009 # On some compilers, pthreads are available without further options
1010 # (e.g. MacOS X). On some of these systems, the compiler will not
1011 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1012 # So we have to see first whether pthreads are available without
1013 # options before we can check whether -Kpthread improves anything.
1014 AC_MSG_CHECKING(whether pthreads are available without options)
1015 AC_CACHE_VAL(ac_cv_pthread_is_default,
1017 #include <pthread.h>
1019 void* routine(void* p){return NULL;}
1023 if(pthread_create(&p,NULL,routine,NULL)!=0)
1025 (void)pthread_detach(p);
1030 ac_cv_pthread_is_default=yes
1034 ac_cv_pthread_is_default=no,
1035 ac_cv_pthread_is_default=no)
1037 AC_MSG_RESULT($ac_cv_pthread_is_default)
1040 if test $ac_cv_pthread_is_default = yes
1044 # -Kpthread, if available, provides the right #defines
1045 # and linker options to make pthread_create available
1046 # Some compilers won't report that they do not support -Kpthread,
1047 # so we need to run a program to see whether it really made the
1048 # function available.
1049 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1050 AC_CACHE_VAL(ac_cv_kpthread,
1054 #include <pthread.h>
1056 void* routine(void* p){return NULL;}
1060 if(pthread_create(&p,NULL,routine,NULL)!=0)
1062 (void)pthread_detach(p);
1070 AC_MSG_RESULT($ac_cv_kpthread)
1073 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
1075 # -Kthread, if available, provides the right #defines
1076 # and linker options to make pthread_create available
1077 # Some compilers won't report that they do not support -Kthread,
1078 # so we need to run a program to see whether it really made the
1079 # function available.
1080 AC_MSG_CHECKING(whether $CC accepts -Kthread)
1081 AC_CACHE_VAL(ac_cv_kthread,
1085 #include <pthread.h>
1087 void* routine(void* p){return NULL;}
1091 if(pthread_create(&p,NULL,routine,NULL)!=0)
1093 (void)pthread_detach(p);
1101 AC_MSG_RESULT($ac_cv_kthread)
1104 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
1106 # -pthread, if available, provides the right #defines
1107 # and linker options to make pthread_create available
1108 # Some compilers won't report that they do not support -pthread,
1109 # so we need to run a program to see whether it really made the
1110 # function available.
1111 AC_MSG_CHECKING(whether $CC accepts -pthread)
1112 AC_CACHE_VAL(ac_cv_thread,
1116 #include <pthread.h>
1118 void* routine(void* p){return NULL;}
1122 if(pthread_create(&p,NULL,routine,NULL)!=0)
1124 (void)pthread_detach(p);
1132 AC_MSG_RESULT($ac_cv_pthread)
1135 # If we have set a CC compiler flag for thread support then
1136 # check if it works for CXX, too.
1140 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1143 if test "$ac_cv_kpthread" = "yes"
1145 CXX="$CXX -Kpthread"
1146 ac_cv_cxx_thread=yes
1147 elif test "$ac_cv_kthread" = "yes"
1150 ac_cv_cxx_thread=yes
1151 elif test "$ac_cv_pthread" = "yes"
1154 ac_cv_cxx_thread=yes
1157 if test $ac_cv_cxx_thread = yes
1159 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1160 $CXX -c conftest.$ac_ext 2>&5
1161 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1162 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1164 ac_cv_cxx_thread=yes
1170 AC_MSG_RESULT($ac_cv_cxx_thread)
1174 dnl # check for ANSI or K&R ("traditional") preprocessor
1175 dnl AC_MSG_CHECKING(for C preprocessor type)
1176 dnl AC_TRY_COMPILE([
1177 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1179 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1180 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
1181 dnl AC_MSG_RESULT($cpp_type)
1183 # checks for header files
1185 AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1187 ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
1188 shadow.h signal.h stdint.h stropts.h termios.h thread.h \
1190 sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1191 sys/lock.h sys/mkdev.h sys/modem.h \
1192 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
1193 sys/termio.h sys/time.h \
1194 sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
1195 sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1196 bluetooth/bluetooth.h linux/tipc.h)
1200 # On Solaris, term.h requires curses.h
1201 AC_CHECK_HEADERS(term.h,,,[
1202 #ifdef HAVE_CURSES_H
1207 # On Linux, netlink.h requires asm/types.h
1208 AC_CHECK_HEADERS(linux/netlink.h,,,[
1209 #ifdef HAVE_ASM_TYPES_H
1210 #include <asm/types.h>
1212 #ifdef HAVE_SYS_SOCKET_H
1213 #include <sys/socket.h>
1217 # checks for typedefs
1219 AC_MSG_CHECKING(for clock_t in time.h)
1220 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1221 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1223 AC_MSG_RESULT($was_it_defined)
1225 # Check whether using makedev requires defining _OSF_SOURCE
1226 AC_MSG_CHECKING(for makedev)
1227 AC_TRY_LINK([#include <sys/types.h> ],
1229 ac_cv_has_makedev=yes,
1230 ac_cv_has_makedev=no)
1231 if test "$ac_cv_has_makedev" = "no"; then
1232 # we didn't link, try if _OSF_SOURCE will allow us to link
1234 #define _OSF_SOURCE 1
1235 #include <sys/types.h>
1238 ac_cv_has_makedev=yes,
1239 ac_cv_has_makedev=no)
1240 if test "$ac_cv_has_makedev" = "yes"; then
1241 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1244 AC_MSG_RESULT($ac_cv_has_makedev)
1245 if test "$ac_cv_has_makedev" = "yes"; then
1246 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1249 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1250 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1251 # defined, but the compiler does not support pragma redefine_extname,
1252 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1253 # structures (such as rlimit64) without declaring them. As a
1254 # work-around, disable LFS on such configurations
1257 AC_MSG_CHECKING(Solaris LFS bug)
1259 #define _LARGEFILE_SOURCE 1
1260 #define _FILE_OFFSET_BITS 64
1261 #include <sys/resource.h>
1262 ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1263 AC_MSG_RESULT($sol_lfs_bug)
1264 if test "$sol_lfs_bug" = "yes"; then
1268 if test "$use_lfs" = "yes"; then
1269 # Two defines needed to enable largefile support on various platforms
1270 # These may affect some typedefs
1271 AC_DEFINE(_LARGEFILE_SOURCE, 1,
1272 [This must be defined on some systems to enable large file support.])
1273 AC_DEFINE(_FILE_OFFSET_BITS, 64,
1274 [This must be set to 64 on some systems to enable large file support.])
1277 # Add some code to confdefs.h so that the test for off_t works on SCO
1278 cat >> confdefs.h <<\EOF
1284 # Type availability checks
1291 AC_CHECK_TYPE(ssize_t,
1292 AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
1294 # Sizes of various common basic types
1295 # ANSI C requires sizeof(char) == 1, so no need to check it
1296 AC_CHECK_SIZEOF(int, 4)
1297 AC_CHECK_SIZEOF(long, 4)
1298 AC_CHECK_SIZEOF(void *, 4)
1299 AC_CHECK_SIZEOF(short, 2)
1300 AC_CHECK_SIZEOF(float, 4)
1301 AC_CHECK_SIZEOF(double, 8)
1302 AC_CHECK_SIZEOF(fpos_t, 4)
1303 AC_CHECK_SIZEOF(size_t, 4)
1304 AC_CHECK_SIZEOF(pid_t, 4)
1306 AC_MSG_CHECKING(for long long support)
1308 AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1309 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1312 AC_MSG_RESULT($have_long_long)
1313 if test "$have_long_long" = yes ; then
1314 AC_CHECK_SIZEOF(long long, 8)
1317 AC_MSG_CHECKING(for long double support)
1319 AC_TRY_COMPILE([], [long double x; x = (long double)0;], [
1320 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1321 have_long_double=yes
1323 AC_MSG_RESULT($have_long_double)
1324 if test "$have_long_double" = yes ; then
1325 AC_CHECK_SIZEOF(long double, 16)
1329 AC_MSG_CHECKING(for _Bool support)
1331 AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [
1332 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1335 AC_MSG_RESULT($have_c99_bool)
1336 if test "$have_c99_bool" = yes ; then
1337 AC_CHECK_SIZEOF(_Bool, 1)
1340 AC_CHECK_TYPES(uintptr_t,
1341 [AC_CHECK_SIZEOF(uintptr_t, 4)],
1342 [], [#ifdef HAVE_STDINT_H
1347 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
1348 AC_MSG_CHECKING(size of off_t)
1349 AC_CACHE_VAL(ac_cv_sizeof_off_t,
1350 [AC_TRY_RUN([#include <stdio.h>
1351 #include <sys/types.h>
1354 FILE *f=fopen("conftestval", "w");
1356 fprintf(f, "%d\n", sizeof(off_t));
1359 ac_cv_sizeof_off_t=`cat conftestval`,
1360 ac_cv_sizeof_off_t=0,
1361 ac_cv_sizeof_off_t=4)
1363 AC_MSG_RESULT($ac_cv_sizeof_off_t)
1364 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1365 [The number of bytes in an off_t.])
1367 AC_MSG_CHECKING(whether to enable large file support)
1368 if test "$have_long_long" = yes -a \
1369 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1370 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1371 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1372 [Defined to enable large file support when an off_t is bigger than a long
1373 and long long is available and at least as big as an off_t. You may need
1374 to add some flags for configuration and compilation to enable this mode.
1375 (For Solaris and Linux, the necessary defines are already defined.)])
1381 # AC_CHECK_SIZEOF() doesn't include <time.h>.
1382 AC_MSG_CHECKING(size of time_t)
1383 AC_CACHE_VAL(ac_cv_sizeof_time_t,
1384 [AC_TRY_RUN([#include <stdio.h>
1388 FILE *f=fopen("conftestval", "w");
1390 fprintf(f, "%d\n", sizeof(time_t));
1393 ac_cv_sizeof_time_t=`cat conftestval`,
1394 ac_cv_sizeof_time_t=0,
1395 ac_cv_sizeof_time_t=4)
1397 AC_MSG_RESULT($ac_cv_sizeof_time_t)
1398 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
1399 [The number of bytes in a time_t.])
1402 # if have pthread_t then define SIZEOF_PTHREAD_T
1404 if test "$ac_cv_kpthread" = "yes"
1405 then CC="$CC -Kpthread"
1406 elif test "$ac_cv_kthread" = "yes"
1407 then CC="$CC -Kthread"
1408 elif test "$ac_cv_pthread" = "yes"
1409 then CC="$CC -pthread"
1411 AC_MSG_CHECKING(for pthread_t)
1413 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
1414 AC_MSG_RESULT($have_pthread_t)
1415 if test "$have_pthread_t" = yes ; then
1416 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
1417 AC_MSG_CHECKING(size of pthread_t)
1418 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
1419 [AC_TRY_RUN([#include <stdio.h>
1420 #include <pthread.h>
1423 FILE *f=fopen("conftestval", "w");
1425 fprintf(f, "%d\n", sizeof(pthread_t));
1428 ac_cv_sizeof_pthread_t=`cat conftestval`,
1429 ac_cv_sizeof_pthread_t=0,
1430 ac_cv_sizeof_pthread_t=4)
1432 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
1433 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
1434 [The number of bytes in a pthread_t.])
1440 AC_SUBST(OTHER_LIBTOOL_OPT)
1441 case $ac_sys_system/$ac_sys_release in
1442 Darwin/@<:@01567@:>@\..*)
1443 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1446 OTHER_LIBTOOL_OPT=""
1450 AC_SUBST(LIBTOOL_CRUFT)
1451 case $ac_sys_system/$ac_sys_release in
1452 Darwin/@<:@01567@:>@\..*)
1453 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1454 if test "${enable_universalsdk}"; then
1457 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
1459 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1460 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1462 gcc_version=`gcc -v 2>&1 | grep version | cut -d\ -f3`
1463 if test ${gcc_version} '<' 4.0
1465 LIBTOOL_CRUFT="-lcc_dynamic"
1469 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
1470 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1471 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1474 AC_MSG_CHECKING(for --enable-framework)
1475 if test "$enable_framework"
1477 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
1478 # -F. is needed to allow linking to the framework while
1479 # in the build location.
1480 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1481 [Define if you want to produce an OpenStep/Rhapsody framework
1482 (shared library plus accessory files).])
1488 AC_MSG_CHECKING(for dyld)
1489 case $ac_sys_system/$ac_sys_release in
1491 AC_DEFINE(WITH_DYLD, 1,
1492 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1493 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1494 linker (rld). Dyld is necessary to support frameworks.])
1495 AC_MSG_RESULT(always on for Darwin)
1502 # Set info about shared libraries.
1507 AC_SUBST(LINKFORSHARED)
1508 # SO is the extension of shared libraries `(including the dot!)
1509 # -- usually .so, .sl on HP-UX, .dll on Cygwin
1513 case $ac_sys_system in
1524 # this might also be a termcap variable, see #610332
1526 echo '====================================================================='
1528 echo '+ WARNING: You have set SO in your environment. +'
1529 echo '+ Do you really mean to change the extension for shared libraries? +'
1530 echo '+ Continuing in 10 seconds to let you to ponder. +'
1532 echo '====================================================================='
1537 AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
1538 # LDSHARED is the ld *command* used to create shared library
1539 # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
1540 # (Shared libraries in this instance are shared modules to be loaded into
1541 # Python, as opposed to building Python itself as a shared library.)
1542 AC_MSG_CHECKING(LDSHARED)
1543 if test -z "$LDSHARED"
1545 case $ac_sys_system/$ac_sys_release in
1547 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
1548 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
1550 IRIX/5*) LDSHARED="ld -shared";;
1551 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1553 if test "$GCC" = "yes"
1554 then LDSHARED='$(CC) -shared'
1555 else LDSHARED='$(CC) -G';
1558 if test "$GCC" = "yes"
1559 then LDSHARED='$(CC) -shared'
1560 else LDSHARED='ld -b';
1562 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1564 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1565 if test "$enable_framework" ; then
1566 # Link against the framework. All externals should be defined.
1567 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1568 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1570 # No framework. Ignore undefined symbols, assuming they come from Python
1571 LDSHARED="$LDSHARED -undefined suppress"
1573 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
1574 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1575 if test "$enable_framework" ; then
1576 # Link against the framework. All externals should be defined.
1577 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1578 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1580 # No framework, use the Python app as bundle-loader
1581 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1582 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1585 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1586 # This allows an extension to be used in any Python
1588 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
1590 if test "${enable_universalsdk}"; then
1591 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1593 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1594 BLDSHARED="$LDSHARED"
1596 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1597 if test "$enable_framework" ; then
1598 # Link against the framework. All externals should be defined.
1599 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1600 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1602 # No framework, use the Python app as bundle-loader
1603 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1604 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1608 Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';;
1609 BSD/OS*/4*) LDSHARED="gcc -shared";;
1611 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1613 LDSHARED="$CC -shared ${LDFLAGS}"
1615 LDSHARED="ld -Bshareable ${LDFLAGS}"
1618 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1620 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1623 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
1624 LDSHARED="ld -Bshareable ${LDFLAGS}"
1627 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1631 NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
1632 OpenUNIX*|UnixWare*)
1633 if test "$GCC" = "yes"
1634 then LDSHARED='$(CC) -shared'
1635 else LDSHARED='$(CC) -G'
1637 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1638 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
1639 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1640 atheos*) LDSHARED="gcc -shared";;
1644 AC_MSG_RESULT($LDSHARED)
1645 BLDSHARED=${BLDSHARED-$LDSHARED}
1646 # CCSHARED are the C *flags* used to create objects to go into a shared
1647 # library (module) -- this is only needed for a few systems
1648 AC_MSG_CHECKING(CCSHARED)
1649 if test -z "$CCSHARED"
1651 case $ac_sys_system/$ac_sys_release in
1652 SunOS*) if test "$GCC" = yes;
1653 then CCSHARED="-fPIC";
1654 elif test `uname -p` = sparc;
1655 then CCSHARED="-xcode=pic32";
1656 else CCSHARED="-Kpic";
1658 hp*|HP*) if test "$GCC" = yes;
1659 then CCSHARED="-fPIC";
1662 Linux*|GNU*) CCSHARED="-fPIC";;
1663 BSD/OS*/4*) CCSHARED="-fpic";;
1664 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
1665 OpenUNIX*|UnixWare*)
1666 if test "$GCC" = "yes"
1667 then CCSHARED="-fPIC"
1668 else CCSHARED="-KPIC"
1671 if test "$GCC" = "yes"
1672 then CCSHARED="-fPIC"
1673 else CCSHARED="-Kpic -belf"
1675 Monterey*) CCSHARED="-G";;
1676 IRIX*/6*) case $CC in
1677 *gcc*) CCSHARED="-shared";;
1680 atheos*) CCSHARED="-fPIC";;
1683 AC_MSG_RESULT($CCSHARED)
1684 # LINKFORSHARED are the flags passed to the $(CC) command that links
1685 # the python executable -- this is only needed for a few systems
1686 AC_MSG_CHECKING(LINKFORSHARED)
1687 if test -z "$LINKFORSHARED"
1689 case $ac_sys_system/$ac_sys_release in
1690 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1692 LINKFORSHARED="-Wl,-E -Wl,+s";;
1693 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1694 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1695 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1696 # -u libsys_s pulls in all symbols in libsys
1698 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1700 # not used by the core itself but which needs to be in the core so
1701 # that dynamically loaded extension modules have access to it.
1702 # -prebind is no longer used, because it actually seems to give a
1703 # slowdown in stead of a speedup, maybe due to the large number of
1704 # dynamic loads Python does.
1706 LINKFORSHARED="$extra_undefs"
1707 if test "$enable_framework"
1709 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1711 LINKFORSHARED="$LINKFORSHARED";;
1712 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1713 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1714 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1715 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
1716 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1718 LINKFORSHARED="-Wl,--export-dynamic"
1720 SunOS/5*) case $CC in
1722 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
1724 LINKFORSHARED="-Xlinker --export-dynamic"
1728 if test $enable_shared = "no"
1730 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1733 # -Wl,-E causes the symbols to be added to the dynamic
1734 # symbol table so that they can be found when a module
1735 # is loaded. -N 2048K causes the stack size to be set
1736 # to 2048 kilobytes so that the stack doesn't overflow
1737 # when running test_compile.py.
1738 LINKFORSHARED='-Wl,-E -N 2048K';;
1741 AC_MSG_RESULT($LINKFORSHARED)
1744 AC_SUBST(CFLAGSFORSHARED)
1745 AC_MSG_CHECKING(CFLAGSFORSHARED)
1746 if test ! "$LIBRARY" = "$LDLIBRARY"
1748 case $ac_sys_system in
1750 # Cygwin needs CCSHARED when building extension DLLs
1751 # but not when building the interpreter DLL.
1752 CFLAGSFORSHARED='';;
1754 CFLAGSFORSHARED='$(CCSHARED)'
1757 AC_MSG_RESULT($CFLAGSFORSHARED)
1759 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
1760 # library (with --enable-shared).
1761 # For platforms on which shared libraries are not allowed to have unresolved
1762 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
1763 # if it is not required, since it creates a dependency of the shared library
1764 # to LIBS. This, in turn, means that applications linking the shared libpython
1765 # don't need to link LIBS explicitly. The default should be only changed
1766 # on systems where this approach causes problems.
1768 AC_MSG_CHECKING(SHLIBS)
1769 case "$ac_sys_system" in
1773 AC_MSG_RESULT($SHLIBS)
1776 # checks for libraries
1777 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1778 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
1780 # only check for sem_init if thread support is requested
1781 if test "$with_threads" = "yes" -o -z "$with_threads"; then
1782 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
1783 # posix4 on Solaris 2.6
1784 # pthread (first!) on Linux
1787 # check if we need libintl for locale functions
1788 AC_CHECK_LIB(intl, textdomain,
1789 AC_DEFINE(WITH_LIBINTL, 1,
1790 [Define to 1 if libintl is needed for locale functions.]))
1792 # checks for system dependent C++ extensions support
1793 case "$ac_sys_system" in
1794 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1795 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1796 [loadAndInit("", 0, "")],
1797 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1798 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1799 and you want support for AIX C++ shared extension modules.])
1800 AC_MSG_RESULT(yes)],
1801 [AC_MSG_RESULT(no)]);;
1805 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1806 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
1807 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
1809 AC_MSG_CHECKING(for --with-libs)
1811 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1813 AC_MSG_RESULT($withval)
1814 LIBS="$withval $LIBS"
1816 [AC_MSG_RESULT(no)])
1818 # Check for use of the system libffi library
1819 AC_MSG_CHECKING(for --with-system-ffi)
1820 AC_ARG_WITH(system_ffi,
1821 AC_HELP_STRING(--with-system-ffi, build _ctypes module using an installed ffi library))
1823 AC_MSG_RESULT($with_system_ffi)
1825 # Determine if signalmodule should be used.
1826 AC_SUBST(USE_SIGNAL_MODULE)
1827 AC_SUBST(SIGNAL_OBJS)
1828 AC_MSG_CHECKING(for --with-signal-module)
1829 AC_ARG_WITH(signal-module,
1830 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
1832 if test -z "$with_signal_module"
1833 then with_signal_module="yes"
1835 AC_MSG_RESULT($with_signal_module)
1837 if test "${with_signal_module}" = "yes"; then
1838 USE_SIGNAL_MODULE=""
1841 USE_SIGNAL_MODULE="#"
1842 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1845 # This is used to generate Setup.config
1846 AC_SUBST(USE_THREAD_MODULE)
1847 USE_THREAD_MODULE=""
1849 AC_MSG_CHECKING(for --with-dec-threads)
1851 AC_ARG_WITH(dec-threads,
1852 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
1854 AC_MSG_RESULT($withval)
1856 if test "${with_thread+set}" != set; then
1857 with_thread="$withval";
1859 [AC_MSG_RESULT(no)])
1861 # Templates for things AC_DEFINEd more than once.
1862 # For a single AC_DEFINE, no template is needed.
1863 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
1864 AH_TEMPLATE(_REENTRANT,
1865 [Define to force use of thread-safe errno, h_errno, and other functions])
1866 AH_TEMPLATE(WITH_THREAD,
1867 [Define if you want to compile in rudimentary thread support])
1869 AC_MSG_CHECKING(for --with-threads)
1870 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1871 AC_ARG_WITH(threads,
1872 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
1874 # --with-thread is deprecated, but check for it anyway
1875 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1877 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
1878 [with_threads=$with_thread])
1880 if test -z "$with_threads"
1881 then with_threads="yes"
1883 AC_MSG_RESULT($with_threads)
1886 if test "$with_threads" = "no"
1888 USE_THREAD_MODULE="#"
1889 elif test "$ac_cv_pthread_is_default" = yes
1891 AC_DEFINE(WITH_THREAD)
1892 # Defining _REENTRANT on system with POSIX threads should not hurt.
1893 AC_DEFINE(_REENTRANT)
1895 THREADOBJ="Python/thread.o"
1896 elif test "$ac_cv_kpthread" = "yes"
1899 if test "$ac_cv_cxx_thread" = "yes"; then
1900 CXX="$CXX -Kpthread"
1902 AC_DEFINE(WITH_THREAD)
1904 THREADOBJ="Python/thread.o"
1905 elif test "$ac_cv_kthread" = "yes"
1908 if test "$ac_cv_cxx_thread" = "yes"; then
1911 AC_DEFINE(WITH_THREAD)
1913 THREADOBJ="Python/thread.o"
1914 elif test "$ac_cv_pthread" = "yes"
1917 if test "$ac_cv_cxx_thread" = "yes"; then
1920 AC_DEFINE(WITH_THREAD)
1922 THREADOBJ="Python/thread.o"
1924 if test ! -z "$with_threads" -a -d "$with_threads"
1925 then LDFLAGS="$LDFLAGS -L$with_threads"
1927 if test ! -z "$withval" -a -d "$withval"
1928 then LDFLAGS="$LDFLAGS -L$withval"
1931 # According to the POSIX spec, a pthreads implementation must
1932 # define _POSIX_THREADS in unistd.h. Some apparently don't
1933 # (e.g. gnu pth with pthread emulation)
1934 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1938 #ifdef _POSIX_THREADS
1941 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1942 AC_MSG_RESULT($unistd_defines_pthreads)
1944 AC_DEFINE(_REENTRANT)
1945 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1946 AC_DEFINE(C_THREADS)
1947 AC_DEFINE(HURD_C_THREADS, 1,
1948 [Define if you are using Mach cthreads directly under /include])
1949 LIBS="$LIBS -lthreads"
1950 THREADOBJ="Python/thread.o"],[
1951 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1952 AC_DEFINE(C_THREADS)
1953 AC_DEFINE(MACH_C_THREADS, 1,
1954 [Define if you are using Mach cthreads under mach /])
1955 THREADOBJ="Python/thread.o"],[
1956 AC_MSG_CHECKING(for --with-pth)
1958 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
1959 [AC_MSG_RESULT($withval)
1960 AC_DEFINE([WITH_THREAD])
1961 AC_DEFINE([HAVE_PTH], 1,
1962 [Define if you have GNU PTH threads.])
1964 THREADOBJ="Python/thread.o"],
1967 # Just looking for pthread_create in libpthread is not enough:
1968 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1969 # So we really have to include pthread.h, and then link.
1971 LIBS="$LIBS -lpthread"
1972 AC_MSG_CHECKING([for pthread_create in -lpthread])
1973 AC_TRY_LINK([#include <pthread.h>
1975 void * start_routine (void *arg) { exit (0); }], [
1976 pthread_create (NULL, NULL, start_routine, NULL)], [
1978 AC_DEFINE(WITH_THREAD)
1980 THREADOBJ="Python/thread.o"],[
1982 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1984 THREADOBJ="Python/thread.o"],[
1985 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
1986 AC_DEFINE(ATHEOS_THREADS, 1,
1987 [Define this if you have AtheOS threads.])
1988 THREADOBJ="Python/thread.o"],[
1989 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1991 LIBS="$LIBS -lpthreads"
1992 THREADOBJ="Python/thread.o"], [
1993 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1996 THREADOBJ="Python/thread.o"], [
1997 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1999 LIBS="$LIBS -lpthread"
2000 THREADOBJ="Python/thread.o"], [
2001 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
2004 THREADOBJ="Python/thread.o"],[
2005 USE_THREAD_MODULE="#"])
2008 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2010 THREADOBJ="Python/thread.o"
2011 USE_THREAD_MODULE=""])
2013 if test "$posix_threads" != "yes"; then
2014 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2015 LIBS="$LIBS -lthread"
2016 THREADOBJ="Python/thread.o"
2017 USE_THREAD_MODULE=""])
2020 if test "$USE_THREAD_MODULE" != "#"
2022 # If the above checks didn't disable threads, (at least) OSF1
2023 # needs this '-threads' argument during linking.
2024 case $ac_sys_system in
2025 OSF1) LDLAST=-threads;;
2030 if test "$posix_threads" = "yes"; then
2031 if test "$unistd_defines_pthreads" = "no"; then
2032 AC_DEFINE(_POSIX_THREADS, 1,
2033 [Define if you have POSIX threads,
2034 and your system does not define that.])
2037 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2038 case $ac_sys_system/$ac_sys_release in
2039 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
2040 Defined for Solaris 2.6 bug in pthread header.)
2042 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2043 Define if the Posix semaphores do not work on your system)
2045 AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2046 Define if the Posix semaphores do not work on your system)
2050 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2051 AC_CACHE_VAL(ac_cv_pthread_system_supported,
2052 [AC_TRY_RUN([#include <pthread.h>
2053 void *foo(void *parm) {
2057 pthread_attr_t attr;
2059 if (pthread_attr_init(&attr)) exit(-1);
2060 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
2061 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
2064 ac_cv_pthread_system_supported=yes,
2065 ac_cv_pthread_system_supported=no,
2066 ac_cv_pthread_system_supported=no)
2068 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2069 if test "$ac_cv_pthread_system_supported" = "yes"; then
2070 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
2072 AC_CHECK_FUNCS(pthread_sigmask,
2073 [case $ac_sys_system in
2075 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2076 [Define if pthread_sigmask() does not work on your system.])
2082 # Check for enable-ipv6
2083 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
2084 AC_MSG_CHECKING([if --enable-ipv6 is specified])
2086 [ --enable-ipv6 Enable ipv6 (with ipv4) support
2087 --disable-ipv6 Disable ipv6 support],
2088 [ case "$enableval" in
2093 *) AC_MSG_RESULT(yes)
2094 AC_DEFINE(ENABLE_IPV6)
2100 dnl the check does not work on cross compilation case...
2101 AC_TRY_RUN([ /* AF_INET6 available check */
2102 #include <sys/types.h>
2103 #include <sys/socket.h>
2106 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
2120 if test "$ipv6" = "yes"; then
2121 AC_MSG_CHECKING(if RFC2553 API is available)
2122 AC_TRY_COMPILE([#include <sys/types.h>
2123 #include <netinet/in.h>],
2124 [struct sockaddr_in6 x;
2128 AC_MSG_RESULT(no, IPv6 disabled)
2132 if test "$ipv6" = "yes"; then
2133 AC_DEFINE(ENABLE_IPV6)
2141 if test "$ipv6" = "yes"; then
2142 AC_MSG_CHECKING([ipv6 stack type])
2143 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2147 dnl http://www.kame.net/
2149 #include <netinet/in.h>
2150 #ifdef IPV6_INRIA_VERSION
2156 dnl http://www.kame.net/
2158 #include <netinet/in.h>
2164 ipv6libdir=/usr/local/v6/lib
2168 dnl http://www.v6.linux.or.jp/
2170 #include <features.h>
2171 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2178 dnl http://www.v6.linux.or.jp/
2179 if test -d /usr/inet6; then
2182 ipv6libdir=/usr/inet6/lib
2183 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
2187 if test -f /etc/netconfig; then
2188 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
2196 #include <sys/param.h>
2197 #ifdef _TOSHIBA_INET6
2202 ipv6libdir=/usr/local/v6/lib])
2206 #include </usr/local/v6/include/sys/v6config.h>
2212 ipv6libdir=/usr/local/v6/lib;
2213 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
2217 #include <sys/param.h>
2218 #ifdef _ZETA_MINAMI_INET6
2223 ipv6libdir=/usr/local/v6/lib])
2226 if test "$ipv6type" != "unknown"; then
2230 AC_MSG_RESULT($ipv6type)
2233 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2234 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2235 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2236 echo "using lib$ipv6lib"
2238 if test $ipv6trylibc = "yes"; then
2241 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2242 echo "You need to fetch lib$ipv6lib.a from appropriate"
2243 echo 'ipv6 kit and compile beforehand.'
2249 AC_MSG_CHECKING(for OSX 10.5 SDK or later)
2250 AC_TRY_COMPILE([#include <Carbon/Carbon.h>], FSIORefNum fRef = 0,
2251 AC_DEFINE(HAVE_OSX105_SDK, 1, Define if compiling using MacOS X 10.5 SDK or later.)
2256 # Check for --with-doc-strings
2257 AC_MSG_CHECKING(for --with-doc-strings)
2258 AC_ARG_WITH(doc-strings,
2259 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
2261 if test -z "$with_doc_strings"
2262 then with_doc_strings="yes"
2264 if test "$with_doc_strings" != "no"
2266 AC_DEFINE(WITH_DOC_STRINGS, 1,
2267 [Define if you want documentation strings in extension modules])
2269 AC_MSG_RESULT($with_doc_strings)
2271 # Check for Python-specific malloc support
2272 AC_MSG_CHECKING(for --with-tsc)
2274 [ --with(out)-tsc enable/disable timestamp counter profile], [
2275 if test "$withval" != no
2277 AC_DEFINE(WITH_TSC, 1,
2278 [Define to profile with the Pentium timestamp counter])
2280 else AC_MSG_RESULT(no)
2282 [AC_MSG_RESULT(no)])
2284 # Check for Python-specific malloc support
2285 AC_MSG_CHECKING(for --with-pymalloc)
2286 AC_ARG_WITH(pymalloc,
2287 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
2289 if test -z "$with_pymalloc"
2290 then with_pymalloc="yes"
2292 if test "$with_pymalloc" != "no"
2294 AC_DEFINE(WITH_PYMALLOC, 1,
2295 [Define if you want to compile in Python-specific mallocs])
2297 AC_MSG_RESULT($with_pymalloc)
2299 # Check for --with-wctype-functions
2300 AC_MSG_CHECKING(for --with-wctype-functions)
2301 AC_ARG_WITH(wctype-functions,
2302 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
2304 if test "$withval" != no
2306 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2307 [Define if you want wctype.h functions to be used instead of the
2308 one supplied by Python itself. (see Include/unicodectype.h).])
2310 else AC_MSG_RESULT(no)
2312 [AC_MSG_RESULT(no)])
2314 # -I${DLINCLDIR} is added to the compile rule for importdl.o
2318 # the dlopen() function means we might want to use dynload_shlib.o. some
2319 # platforms, such as AIX, have dlopen(), but don't want to use it.
2320 AC_CHECK_FUNCS(dlopen)
2322 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2323 # loading of modules.
2324 AC_SUBST(DYNLOADFILE)
2325 AC_MSG_CHECKING(DYNLOADFILE)
2326 if test -z "$DYNLOADFILE"
2328 case $ac_sys_system/$ac_sys_release in
2329 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2330 if test "$ac_cv_func_dlopen" = yes
2331 then DYNLOADFILE="dynload_shlib.o"
2332 else DYNLOADFILE="dynload_aix.o"
2335 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
2336 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2337 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
2338 atheos*) DYNLOADFILE="dynload_atheos.o";;
2340 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2341 # out any dynamic loading
2342 if test "$ac_cv_func_dlopen" = yes
2343 then DYNLOADFILE="dynload_shlib.o"
2344 else DYNLOADFILE="dynload_stub.o"
2349 AC_MSG_RESULT($DYNLOADFILE)
2350 if test "$DYNLOADFILE" != "dynload_stub.o"
2352 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2353 [Defined when any dynamic module loading is enabled.])
2356 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
2358 AC_SUBST(MACHDEP_OBJS)
2359 AC_MSG_CHECKING(MACHDEP_OBJS)
2360 if test -z "$MACHDEP_OBJS"
2362 MACHDEP_OBJS=$extra_machdep_objs
2364 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
2366 AC_MSG_RESULT(MACHDEP_OBJS)
2368 # checks for library functions
2369 AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2370 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
2371 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2372 getpriority getpwent getspnam getspent getsid getwd \
2373 kill killpg lchmod lchown lstat mkfifo mknod mktime \
2374 mremap nice pathconf pause plock poll pthread_init \
2375 putenv readlink realpath \
2376 select setegid seteuid setgid \
2377 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
2378 sigaction siginterrupt sigrelse strftime strlcpy \
2379 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
2380 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll wcsxfrm _getpty)
2382 # For some functions, having a definition is not sufficient, since
2383 # we want to take their address.
2384 AC_MSG_CHECKING(for chroot)
2385 AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2386 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2390 AC_MSG_CHECKING(for link)
2391 AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2392 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2396 AC_MSG_CHECKING(for symlink)
2397 AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2398 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2402 AC_MSG_CHECKING(for fchdir)
2403 AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2404 AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2408 AC_MSG_CHECKING(for fsync)
2409 AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
2410 AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2414 AC_MSG_CHECKING(for fdatasync)
2415 AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2416 AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2420 AC_MSG_CHECKING(for epoll)
2421 AC_TRY_COMPILE([#include <sys/epoll.h>], void *x=epoll_create,
2422 AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2426 AC_MSG_CHECKING(for kqueue)
2428 #include <sys/types.h>
2429 #include <sys/event.h>
2431 AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2435 # On some systems (eg. FreeBSD 5), we would find a definition of the
2436 # functions ctermid_r, setgroups in the library, but no prototype
2437 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2438 # address to avoid compiler warnings and potential miscompilations
2439 # because of the missing prototypes.
2441 AC_MSG_CHECKING(for ctermid_r)
2443 #include "confdefs.h"
2445 ], void* p = ctermid_r,
2446 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2451 AC_MSG_CHECKING(for flock)
2453 #include "confdefs.h"
2454 #include <sys/file.h>
2456 AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2461 AC_MSG_CHECKING(for getpagesize)
2463 #include "confdefs.h"
2465 ], void* p = getpagesize,
2466 AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2472 AC_CHECK_PROGS(TRUE, true, /bin/true)
2474 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2475 dnl On others, they are in the C library, so we to take no action
2476 AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
2477 AC_CHECK_LIB(resolv, inet_aton)
2480 # On Tru64, chflags seems to be present, but calling it will
2482 AC_MSG_CHECKING(for chflags)
2484 #include <sys/stat.h>
2486 int main(int argc, char*argv[])
2488 if(chflags(argv[0], 0) != 0)
2492 ],AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
2497 AC_MSG_CHECKING(for lchflags)
2499 #include <sys/stat.h>
2501 int main(int argc, char*argv[])
2503 if(lchflags(argv[0], 0) != 0)
2507 ],AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
2512 dnl Check if system zlib has *Copy() functions
2514 dnl On MacOSX the linker will search for dylibs on the entire linker path
2515 dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
2516 dnl to revert to a more traditional unix behaviour and make it possible to
2517 dnl override the system libz with a local static library of libz. Temporarily
2518 dnl add that flag to our CFLAGS as well to ensure that we check the version
2519 dnl of libz that will be used by setup.py.
2520 dnl The -L/usr/local/lib is needed as wel to get the same compilation
2521 dnl environment as setup.py (and leaving it out can cause configure to use the
2522 dnl wrong version of the library)
2523 case $ac_sys_system/$ac_sys_release in
2525 _CUR_CFLAGS="${CFLAGS}"
2526 _CUR_LDFLAGS="${LDFLAGS}"
2527 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
2528 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
2532 AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, Define if the zlib library has inflateCopy))
2534 case $ac_sys_system/$ac_sys_release in
2536 CFLAGS="${_CUR_CFLAGS}"
2537 LDFLAGS="${_CUR_LDFLAGS}"
2541 AC_MSG_CHECKING(for hstrerror)
2543 #include "confdefs.h"
2545 ], void* p = hstrerror; hstrerror(0),
2546 AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2551 AC_MSG_CHECKING(for inet_aton)
2553 #include "confdefs.h"
2554 #include <sys/types.h>
2555 #include <sys/socket.h>
2556 #include <netinet/in.h>
2557 #include <arpa/inet.h>
2558 ], void* p = inet_aton;inet_aton(0,0),
2559 AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2564 AC_MSG_CHECKING(for inet_pton)
2566 #include "confdefs.h"
2567 #include <sys/types.h>
2568 #include <sys/socket.h>
2569 #include <netinet/in.h>
2570 #include <arpa/inet.h>
2571 ], void* p = inet_pton,
2572 AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2577 # On some systems, setgroups is in unistd.h, on others, in grp.h
2578 AC_MSG_CHECKING(for setgroups)
2580 #include "confdefs.h"
2586 void* p = setgroups,
2587 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2592 # check for openpty and forkpty
2594 AC_CHECK_FUNCS(openpty,,
2595 AC_CHECK_LIB(util,openpty,
2596 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2597 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2600 AC_CHECK_FUNCS(forkpty,,
2601 AC_CHECK_LIB(util,forkpty,
2602 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2603 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2608 AC_CHECK_FUNCS(memmove)
2610 # check for long file support functions
2611 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2613 AC_REPLACE_FUNCS(dup2 getcwd strdup)
2614 AC_CHECK_FUNCS(getpgrp,
2615 AC_TRY_COMPILE([#include <unistd.h>],
2617 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2618 [Define if getpgrp() must be called as getpgrp(0).])
2621 AC_CHECK_FUNCS(setpgrp,
2622 AC_TRY_COMPILE([#include <unistd.h>],
2624 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2625 [Define if setpgrp() must be called as setpgrp(0, 0).])
2628 AC_CHECK_FUNCS(gettimeofday,
2629 AC_TRY_COMPILE([#include <sys/time.h>],
2630 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2631 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2632 [Define if gettimeofday() does not have second (timezone) argument
2633 This is the case on Motorola V4 (R40V4.2)])
2637 AC_MSG_CHECKING(for major, minor, and makedev)
2639 #if defined(MAJOR_IN_MKDEV)
2640 #include <sys/mkdev.h>
2641 #elif defined(MAJOR_IN_SYSMACROS)
2642 #include <sys/sysmacros.h>
2644 #include <sys/types.h>
2647 makedev(major(0),minor(0));
2649 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2650 [Define to 1 if you have the device macros.])
2656 # On OSF/1 V5.1, getaddrinfo is available, but a define
2657 # for [no]getaddrinfo in netdb.h.
2658 AC_MSG_CHECKING(for getaddrinfo)
2660 #include <sys/types.h>
2661 #include <sys/socket.h>
2665 getaddrinfo(NULL, NULL, NULL, NULL);
2668 AC_MSG_CHECKING(getaddrinfo bug)
2670 #include <sys/types.h>
2673 #include <sys/socket.h>
2674 #include <netinet/in.h>
2678 int passive, gaierr, inet4 = 0, inet6 = 0;
2679 struct addrinfo hints, *ai, *aitop;
2680 char straddr[INET6_ADDRSTRLEN], strport[16];
2682 for (passive = 0; passive <= 1; passive++) {
2683 memset(&hints, 0, sizeof(hints));
2684 hints.ai_family = AF_UNSPEC;
2685 hints.ai_flags = passive ? AI_PASSIVE : 0;
2686 hints.ai_socktype = SOCK_STREAM;
2687 hints.ai_protocol = IPPROTO_TCP;
2688 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2689 (void)gai_strerror(gaierr);
2692 for (ai = aitop; ai; ai = ai->ai_next) {
2693 if (ai->ai_addr == NULL ||
2694 ai->ai_addrlen == 0 ||
2695 getnameinfo(ai->ai_addr, ai->ai_addrlen,
2696 straddr, sizeof(straddr), strport, sizeof(strport),
2697 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2700 switch (ai->ai_family) {
2702 if (strcmp(strport, "54321") != 0) {
2706 if (strcmp(straddr, "0.0.0.0") != 0) {
2710 if (strcmp(straddr, "127.0.0.1") != 0) {
2717 if (strcmp(strport, "54321") != 0) {
2721 if (strcmp(straddr, "::") != 0) {
2725 if (strcmp(straddr, "::1") != 0) {
2735 /* another family support? */
2741 if (!(inet4 == 0 || inet4 == 2))
2743 if (!(inet6 == 0 || inet6 == 2))
2747 freeaddrinfo(aitop);
2752 freeaddrinfo(aitop);
2757 buggygetaddrinfo=no,
2758 AC_MSG_RESULT(buggy)
2759 buggygetaddrinfo=yes,
2760 AC_MSG_RESULT(buggy)
2761 buggygetaddrinfo=yes)], [
2763 buggygetaddrinfo=yes
2766 if test "$buggygetaddrinfo" = "yes"; then
2767 if test "$ipv6" = "yes"; then
2768 echo 'Fatal: You must get working getaddrinfo() function.'
2769 echo ' or you can specify "--disable-ipv6"'.
2773 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
2775 AC_CHECK_FUNCS(getnameinfo)
2777 # checks for structures
2781 AC_CHECK_MEMBERS([struct stat.st_rdev])
2782 AC_CHECK_MEMBERS([struct stat.st_blksize])
2783 AC_CHECK_MEMBERS([struct stat.st_flags])
2784 AC_CHECK_MEMBERS([struct stat.st_gen])
2785 AC_CHECK_MEMBERS([struct stat.st_birthtime])
2788 AC_MSG_CHECKING(for time.h that defines altzone)
2789 AC_CACHE_VAL(ac_cv_header_time_altzone,
2790 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2791 ac_cv_header_time_altzone=yes,
2792 ac_cv_header_time_altzone=no)])
2793 AC_MSG_RESULT($ac_cv_header_time_altzone)
2794 if test $ac_cv_header_time_altzone = yes; then
2795 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
2799 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
2801 #include <sys/types.h>
2802 #include <sys/select.h>
2803 #include <sys/time.h>
2805 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
2806 [Define if you can safely include both <sys/select.h> and <sys/time.h>
2807 (which you can't on SCO ODT 3.0).])
2810 AC_MSG_RESULT($was_it_defined)
2812 AC_MSG_CHECKING(for addrinfo)
2813 AC_CACHE_VAL(ac_cv_struct_addrinfo,
2815 # include <netdb.h>],
2816 [struct addrinfo a],
2817 ac_cv_struct_addrinfo=yes,
2818 ac_cv_struct_addrinfo=no))
2819 AC_MSG_RESULT($ac_cv_struct_addrinfo)
2820 if test $ac_cv_struct_addrinfo = yes; then
2821 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
2824 AC_MSG_CHECKING(for sockaddr_storage)
2825 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
2827 # include <sys/types.h>
2828 # include <sys/socket.h>],
2829 [struct sockaddr_storage s],
2830 ac_cv_struct_sockaddr_storage=yes,
2831 ac_cv_struct_sockaddr_storage=no))
2832 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
2833 if test $ac_cv_struct_sockaddr_storage = yes; then
2834 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
2837 # checks for compiler characteristics
2843 AC_MSG_CHECKING(for working volatile)
2844 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
2845 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
2847 AC_MSG_RESULT($works)
2850 AC_MSG_CHECKING(for working signed char)
2851 AC_TRY_COMPILE([], [signed char c;], works=yes,
2852 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
2854 AC_MSG_RESULT($works)
2857 AC_MSG_CHECKING(for prototypes)
2858 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
2859 AC_DEFINE(HAVE_PROTOTYPES, 1,
2860 [Define if your compiler supports function prototype])
2863 AC_MSG_RESULT($have_prototypes)
2866 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
2869 int foo(int x, ...) {
2877 ], [return foo(10, "", 3.14);], [
2878 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
2879 [Define if your compiler supports variable length function prototypes
2880 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
2883 AC_MSG_RESULT($works)
2885 # check for socketpair
2886 AC_MSG_CHECKING(for socketpair)
2888 #include <sys/types.h>
2889 #include <sys/socket.h>
2890 ], void *x=socketpair,
2891 AC_DEFINE(HAVE_SOCKETPAIR, 1, Define if you have the 'socketpair' function.)
2896 # check if sockaddr has sa_len member
2897 AC_MSG_CHECKING(if sockaddr has sa_len member)
2898 AC_TRY_COMPILE([#include <sys/types.h>
2899 #include <sys/socket.h>],
2903 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
2907 AC_MSG_CHECKING(whether va_list is an array)
2909 #ifdef HAVE_STDARG_PROTOTYPES
2912 #include <varargs.h>
2914 ], [va_list list1, list2; list1 = list2;], , [
2915 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
2916 va_list_is_array=yes
2918 AC_MSG_RESULT($va_list_is_array)
2920 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
2921 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
2922 [Define this if you have some version of gethostbyname_r()])
2924 AC_CHECK_FUNC(gethostbyname_r, [
2925 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2926 AC_MSG_CHECKING([gethostbyname_r with 6 args])
2928 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
2933 struct hostent *he, *res;
2938 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
2940 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2941 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
2942 [Define this if you have the 6-arg version of gethostbyname_r().])
2946 AC_MSG_CHECKING([gethostbyname_r with 5 args])
2956 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
2958 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2959 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
2960 [Define this if you have the 5-arg version of gethostbyname_r().])
2964 AC_MSG_CHECKING([gethostbyname_r with 3 args])
2970 struct hostent_data data;
2972 (void) gethostbyname_r(name, he, &data);
2974 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2975 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
2976 [Define this if you have the 3-arg version of gethostbyname_r().])
2985 AC_CHECK_FUNCS(gethostbyname)
2987 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
2988 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
2989 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
2990 AC_SUBST(HAVE_GETHOSTBYNAME_R)
2991 AC_SUBST(HAVE_GETHOSTBYNAME)
2993 # checks for system services
2996 # Linux requires this for correct f.p. operations
2997 AC_CHECK_FUNC(__fpu_control,
2999 [AC_CHECK_LIB(ieee, __fpu_control)
3002 # Check for --with-fpectl
3003 AC_MSG_CHECKING(for --with-fpectl)
3005 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
3007 if test "$withval" != no
3009 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3010 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3012 else AC_MSG_RESULT(no)
3014 [AC_MSG_RESULT(no)])
3016 # check for --with-libm=...
3018 case $ac_sys_system in
3022 AC_MSG_CHECKING(for --with-libm=STRING)
3024 AC_HELP_STRING(--with-libm=STRING, math library),
3026 if test "$withval" = no
3028 AC_MSG_RESULT(force LIBM empty)
3029 elif test "$withval" != yes
3031 AC_MSG_RESULT(set LIBM="$withval")
3032 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
3034 [AC_MSG_RESULT(default LIBM="$LIBM")])
3036 # check for --with-libc=...
3038 AC_MSG_CHECKING(for --with-libc=STRING)
3040 AC_HELP_STRING(--with-libc=STRING, C library),
3042 if test "$withval" = no
3044 AC_MSG_RESULT(force LIBC empty)
3045 elif test "$withval" != yes
3047 AC_MSG_RESULT(set LIBC="$withval")
3048 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
3050 [AC_MSG_RESULT(default LIBC="$LIBC")])
3052 # ************************************
3053 # * Check for mathematical functions *
3054 # ************************************
3059 # Detect whether system arithmetic is subject to x87-style double
3060 # rounding issues. The result of this test has little meaning on non
3061 # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3062 # mode is round-to-nearest and double rounding issues are present, and
3063 # 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3064 AC_MSG_CHECKING(for x87-style double rounding)
3065 AC_CACHE_VAL(ac_cv_x87_double_rounding, [
3070 volatile double x, y, z;
3071 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3072 x = 0.99999999999999989; /* 1-2**-53 */
3076 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3082 /* both tests show evidence of double rounding */
3086 ac_cv_x87_double_rounding=no,
3087 ac_cv_x87_double_rounding=yes,
3088 ac_cv_x87_double_rounding=no)])
3089 AC_MSG_RESULT($ac_cv_x87_double_rounding)
3090 if test "$ac_cv_x87_double_rounding" = yes
3092 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3093 [Define if arithmetic is subject to x87-style double rounding issue])
3097 # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3098 # -0. on some architectures.
3099 AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3100 AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
3105 /* return 0 if either negative zeros don't exist
3106 on this platform or if negative zeros exist
3107 and tanh(-0.) == -0. */
3108 if (atan2(0., -1.) == atan2(-0., -1.) ||
3109 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3113 ac_cv_tanh_preserves_zero_sign=yes,
3114 ac_cv_tanh_preserves_zero_sign=no,
3115 ac_cv_tanh_preserves_zero_sign=no)])
3116 AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3117 if test "$ac_cv_tanh_preserves_zero_sign" = yes
3119 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3120 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3123 AC_CHECK_FUNCS([acosh asinh atanh copysign expm1 finite hypot log1p])
3124 AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3129 AC_CHECK_HEADER(wchar.h, [
3130 AC_DEFINE(HAVE_WCHAR_H, 1,
3131 [Define if the compiler provides a wchar.h header file.])
3137 # determine wchar_t size
3138 if test "$wchar_h" = yes
3140 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
3143 AC_MSG_CHECKING(for UCS-4 tcl)
3147 #if TCL_UTF_MAX != 6
3148 # error "NOT UCS4_TCL"
3150 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3153 AC_MSG_RESULT($have_ucs4_tcl)
3155 # check whether wchar_t is signed or not
3156 if test "$wchar_h" = yes
3158 # check whether wchar_t is signed or not
3159 AC_MSG_CHECKING(whether wchar_t is signed)
3160 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
3165 /* Success: exit code 0 */
3166 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
3169 ac_cv_wchar_t_signed=yes,
3170 ac_cv_wchar_t_signed=no,
3171 ac_cv_wchar_t_signed=yes)])
3172 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3175 AC_MSG_CHECKING(what type to use for str)
3176 AC_ARG_WITH(wide-unicode,
3177 AC_HELP_STRING(--with-wide-unicode, Use 4-byte Unicode characters (default is 2 bytes)),
3179 if test "$withval" != no
3180 then unicode_size="4"
3181 else unicode_size="2"
3185 case "$have_ucs4_tcl" in
3186 yes) unicode_size="4" ;;
3187 *) unicode_size="2" ;;
3191 AH_TEMPLATE(Py_UNICODE_SIZE,
3192 [Define as the size of the unicode type.])
3193 case "$unicode_size" in
3194 4) AC_DEFINE(Py_UNICODE_SIZE, 4) ;;
3195 *) AC_DEFINE(Py_UNICODE_SIZE, 2) ;;
3198 AH_TEMPLATE(PY_UNICODE_TYPE,
3199 [Define as the integral type used for Unicode representation.])
3201 # wchar_t is only usable if it maps to an unsigned type
3202 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
3203 -a "$ac_cv_wchar_t_signed" = "no"
3205 PY_UNICODE_TYPE="wchar_t"
3206 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3207 [Define if you have a useable wchar_t type defined in wchar.h; useable
3208 means wchar_t must be an unsigned type with at least 16 bits. (see
3209 Include/unicodeobject.h).])
3210 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3211 elif test "$ac_cv_sizeof_short" = "$unicode_size"
3213 PY_UNICODE_TYPE="unsigned short"
3214 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3215 elif test "$ac_cv_sizeof_long" = "$unicode_size"
3217 PY_UNICODE_TYPE="unsigned long"
3218 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3220 PY_UNICODE_TYPE="no type found"
3222 AC_MSG_RESULT($PY_UNICODE_TYPE)
3224 # check for endianness
3227 # Check whether right shifting a negative integer extends the sign bit
3228 # or fills with zeros (like the Cray J90, according to Tim Peters).
3229 AC_MSG_CHECKING(whether right shift extends the sign bit)
3230 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
3234 exit(((-1)>>3 == -1) ? 0 : 1);
3237 ac_cv_rshift_extends_sign=yes,
3238 ac_cv_rshift_extends_sign=no,
3239 ac_cv_rshift_extends_sign=yes)])
3240 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
3241 if test "$ac_cv_rshift_extends_sign" = no
3243 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
3244 [Define if i>>j for signed int i does not extend the sign bit
3248 # check for getc_unlocked and related locking functions
3249 AC_MSG_CHECKING(for getc_unlocked() and friends)
3250 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
3251 AC_TRY_LINK([#include <stdio.h>],[
3252 FILE *f = fopen("/dev/null", "r");
3256 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
3257 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
3258 if test "$ac_cv_have_getc_unlocked" = yes
3260 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
3261 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
3264 # check where readline lives
3265 # save the value of LIBS so we don't actually link Python with readline
3266 LIBS_no_readline=$LIBS
3268 # On some systems we need to link readline to a termcap compatible
3269 # library. NOTE: Keep the precedence of listed libraries synchronised
3271 py_cv_lib_readline=no
3272 AC_MSG_CHECKING([how to link readline libs])
3273 for py_libtermcap in "" ncursesw ncurses curses termcap; do
3274 if test -z "$py_libtermcap"; then
3275 READLINE_LIBS="-lreadline"
3277 READLINE_LIBS="-lreadline -l$py_libtermcap"
3279 LIBS="$READLINE_LIBS $LIBS_no_readline"
3281 [AC_LANG_CALL([],[readline])],
3282 [py_cv_lib_readline=yes])
3283 if test $py_cv_lib_readline = yes; then
3287 # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3288 #AC_SUBST([READLINE_LIBS])
3289 if test $py_cv_lib_readline = no; then
3290 AC_MSG_RESULT([none])
3292 AC_MSG_RESULT([$READLINE_LIBS])
3293 AC_DEFINE(HAVE_LIBREADLINE, 1,
3294 [Define if you have the readline library (-lreadline).])
3297 # check for readline 2.1
3298 AC_CHECK_LIB(readline, rl_callback_handler_install,
3299 AC_DEFINE(HAVE_RL_CALLBACK, 1,
3300 [Define if you have readline 2.1]), ,$READLINE_LIBS)
3302 # check for readline 2.2
3303 AC_TRY_CPP([#include <readline/readline.h>],
3304 have_readline=yes, have_readline=no)
3305 if test $have_readline = yes
3307 AC_EGREP_HEADER([extern int rl_completion_append_character;],
3308 [readline/readline.h],
3309 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
3310 [Define if you have readline 2.2]), )
3313 # check for readline 4.0
3314 AC_CHECK_LIB(readline, rl_pre_input_hook,
3315 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
3316 [Define if you have readline 4.0]), ,$READLINE_LIBS)
3319 AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
3320 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
3321 [Define if you have readline 4.0]), ,$READLINE_LIBS)
3323 # check for readline 4.2
3324 AC_CHECK_LIB(readline, rl_completion_matches,
3325 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
3326 [Define if you have readline 4.2]), ,$READLINE_LIBS)
3328 # also in readline 4.2
3329 AC_TRY_CPP([#include <readline/readline.h>],
3330 have_readline=yes, have_readline=no)
3331 if test $have_readline = yes
3333 AC_EGREP_HEADER([extern int rl_catch_signals;],
3334 [readline/readline.h],
3335 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3336 [Define if you can turn off readline's signal handling.]), )
3339 # End of readline checks: restore LIBS
3340 LIBS=$LIBS_no_readline
3342 AC_MSG_CHECKING(for broken nice())
3343 AC_CACHE_VAL(ac_cv_broken_nice, [
3348 if (val1 != -1 && val1 == nice(2))
3353 ac_cv_broken_nice=yes,
3354 ac_cv_broken_nice=no,
3355 ac_cv_broken_nice=no)])
3356 AC_MSG_RESULT($ac_cv_broken_nice)
3357 if test "$ac_cv_broken_nice" = yes
3359 AC_DEFINE(HAVE_BROKEN_NICE, 1,
3360 [Define if nice() returns success/failure instead of the new priority.])
3363 AC_MSG_CHECKING(for broken poll())
3369 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
3373 int poll_test = poll (&poll_struct, 1, 0);
3379 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
3389 ac_cv_broken_poll=yes,
3390 ac_cv_broken_poll=no,
3391 ac_cv_broken_poll=no)
3392 AC_MSG_RESULT($ac_cv_broken_poll)
3393 if test "$ac_cv_broken_poll" = yes
3395 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3396 [Define if poll() sets errno on invalid file descriptors.])
3399 # Before we can test tzset, we need to check if struct tm has a tm_zone
3400 # (which is not required by ISO C or UNIX spec) and/or if we support
3404 # check tzset(3) exists and works like we expect it to
3405 AC_MSG_CHECKING(for working tzset())
3406 AC_CACHE_VAL(ac_cv_working_tzset, [
3413 extern char *tzname[];
3418 /* Note that we need to ensure that not only does tzset(3)
3419 do 'something' with localtime, but it works as documented
3420 in the library reference and as expected by the test suite.
3421 This includes making sure that tzname is set properly if
3422 tm->tm_zone does not exist since it is the alternative way
3423 of getting timezone info.
3425 Red Hat 6.2 doesn't understand the southern hemisphere
3426 after New Year's Day.
3429 time_t groundhogday = 1044144000; /* GMT-based */
3430 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3434 if (localtime(&groundhogday)->tm_hour != 0)
3437 /* For UTC, tzname[1] is sometimes "", sometimes " " */
3438 if (strcmp(tzname[0], "UTC") ||
3439 (tzname[1][0] != 0 && tzname[1][0] != ' '))
3443 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
3445 if (localtime(&groundhogday)->tm_hour != 19)
3448 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
3452 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
3454 if (localtime(&groundhogday)->tm_hour != 11)
3457 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
3461 #if HAVE_STRUCT_TM_TM_ZONE
3462 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
3464 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
3471 ac_cv_working_tzset=yes,
3472 ac_cv_working_tzset=no,
3473 ac_cv_working_tzset=no)])
3474 AC_MSG_RESULT($ac_cv_working_tzset)
3475 if test "$ac_cv_working_tzset" = yes
3477 AC_DEFINE(HAVE_WORKING_TZSET, 1,
3478 [Define if tzset() actually switches the local timezone in a meaningful way.])
3481 # Look for subsecond timestamps in struct stat
3482 AC_MSG_CHECKING(for tv_nsec in struct stat)
3483 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
3484 AC_TRY_COMPILE([#include <sys/stat.h>], [
3486 st.st_mtim.tv_nsec = 1;
3488 ac_cv_stat_tv_nsec=yes,
3489 ac_cv_stat_tv_nsec=no,
3490 ac_cv_stat_tv_nsec=no))
3491 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
3492 if test "$ac_cv_stat_tv_nsec" = yes
3494 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
3495 [Define if you have struct stat.st_mtim.tv_nsec])
3498 # Look for BSD style subsecond timestamps in struct stat
3499 AC_MSG_CHECKING(for tv_nsec2 in struct stat)
3500 AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
3501 AC_TRY_COMPILE([#include <sys/stat.h>], [
3503 st.st_mtimespec.tv_nsec = 1;
3505 ac_cv_stat_tv_nsec2=yes,
3506 ac_cv_stat_tv_nsec2=no,
3507 ac_cv_stat_tv_nsec2=no))
3508 AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
3509 if test "$ac_cv_stat_tv_nsec2" = yes
3511 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
3512 [Define if you have struct stat.st_mtimensec])
3515 # On HP/UX 11.0, mvwdelch is a block with a return statement
3516 AC_MSG_CHECKING(whether mvwdelch is an expression)
3517 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
3518 AC_TRY_COMPILE([#include <curses.h>], [
3520 rtn = mvwdelch(0,0,0);
3521 ], ac_cv_mvwdelch_is_expression=yes,
3522 ac_cv_mvwdelch_is_expression=no,
3523 ac_cv_mvwdelch_is_expression=yes))
3524 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
3526 if test "$ac_cv_mvwdelch_is_expression" = yes
3528 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
3529 [Define if mvwdelch in curses.h is an expression.])
3532 AC_MSG_CHECKING(whether WINDOW has _flags)
3533 AC_CACHE_VAL(ac_cv_window_has_flags,
3534 AC_TRY_COMPILE([#include <curses.h>], [
3537 ], ac_cv_window_has_flags=yes,
3538 ac_cv_window_has_flags=no,
3539 ac_cv_window_has_flags=no))
3540 AC_MSG_RESULT($ac_cv_window_has_flags)
3543 if test "$ac_cv_window_has_flags" = yes
3545 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
3546 [Define if WINDOW in curses.h offers a field _flags.])
3549 AC_MSG_CHECKING(for is_term_resized)
3550 AC_TRY_COMPILE([#include <curses.h>], void *x=is_term_resized,
3551 AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
3556 AC_MSG_CHECKING(for resize_term)
3557 AC_TRY_COMPILE([#include <curses.h>], void *x=resize_term,
3558 AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
3563 AC_MSG_CHECKING(for resizeterm)
3564 AC_TRY_COMPILE([#include <curses.h>], void *x=resizeterm,
3565 AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
3570 AC_MSG_CHECKING(for /dev/ptmx)
3572 if test -r /dev/ptmx
3575 AC_DEFINE(HAVE_DEV_PTMX, 1,
3576 [Define if we have /dev/ptmx.])
3581 AC_MSG_CHECKING(for /dev/ptc)
3586 AC_DEFINE(HAVE_DEV_PTC, 1,
3587 [Define if we have /dev/ptc.])
3592 AC_MSG_CHECKING(for %zd printf() format support)
3593 AC_TRY_RUN([#include <stdio.h>
3597 #ifdef HAVE_SYS_TYPES_H
3598 #include <sys/types.h>
3602 typedef ssize_t Py_ssize_t;
3603 #elif SIZEOF_VOID_P == SIZEOF_LONG
3604 typedef long Py_ssize_t;
3606 typedef int Py_ssize_t;
3613 if(sprintf(buffer, "%zd", (size_t)123) < 0)
3616 if (strcmp(buffer, "123"))
3619 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
3622 if (strcmp(buffer, "-123"))
3628 AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
3631 AC_CHECK_TYPE(socklen_t,,
3632 AC_DEFINE(socklen_t,int,
3633 Define to `int' if <sys/socket.h> does not define.),[
3634 #ifdef HAVE_SYS_TYPES_H
3635 #include <sys/types.h>
3637 #ifdef HAVE_SYS_SOCKET_H
3638 #include <sys/socket.h>
3642 AC_MSG_CHECKING(for broken mbstowcs)
3647 const char *str = "text";
3648 len = mbstowcs(NULL, str, 0);
3652 ac_cv_broken_mbstowcs=no,
3653 ac_cv_broken_mbstowcs=yes,
3654 ac_cv_broken_mbstowcs=no)
3655 AC_MSG_RESULT($ac_cv_broken_mbstowcs)
3656 if test "$ac_cv_broken_mbstowcs" = yes
3658 AC_DEFINE(HAVE_BROKEN_MBSTOWCS, 1,
3659 [Define if mbstowcs(NULL, "text", 0) does not return the number of
3660 wide chars that would be converted.])
3663 # Check for --with-computed-gotos
3664 AC_MSG_CHECKING(for --with-computed-gotos)
3665 AC_ARG_WITH(computed-gotos,
3666 AC_HELP_STRING(--with-computed-gotos,
3667 Use computed gotos / threaded dispatch in evaluation loop (not available on all compilers)),
3669 if test "$withval" != no
3671 AC_DEFINE(USE_COMPUTED_GOTOS, 1,
3672 [Define if you want to use computed gotos in ceval.c.])
3674 else AC_MSG_RESULT(no)
3676 [AC_MSG_RESULT(no)])
3679 AC_SUBST(THREADHEADERS)
3681 for h in `(cd $srcdir;echo Python/thread_*.h)`
3683 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
3687 SRCDIRS="Parser Grammar Objects Python Modules Mac"
3688 AC_MSG_CHECKING(for build directories)
3689 for dir in $SRCDIRS; do
3690 if test ! -d $dir; then
3696 # generate output files
3697 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
3700 echo "creating Modules/Setup"
3701 if test ! -f Modules/Setup
3703 cp $srcdir/Modules/Setup.dist Modules/Setup
3706 echo "creating Modules/Setup.local"
3707 if test ! -f Modules/Setup.local
3709 echo "# Edit this file for local setup changes" >Modules/Setup.local
3712 echo "creating Makefile"
3713 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
3714 -s Modules Modules/Setup.config \
3715 Modules/Setup.local Modules/Setup