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, 2.7)
9 dnl Some m4 magic to ensure that the configure script is generated
10 dnl by the correct autoconf version.
11 m4_define([version_required],
12 [m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), 0,
14 [m4_fatal([Autoconf version $1 is required for Python], 63)])
16 version_required(2.61)
18 AC_REVISION($Revision$)
19 AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
20 AC_CONFIG_SRCDIR([Include/object.h])
21 AC_CONFIG_HEADER(pyconfig.h)
23 dnl Ensure that if prefix is specified, it does not end in a slash. If
24 dnl it does, we get path names containing '//' which is both ugly and
25 dnl can cause trouble.
27 dnl Last slash shouldn't be stripped if prefix=/
28 if test "$prefix" != "/"; then
29 prefix=`echo "$prefix" | sed -e 's/\/$//g'`
32 dnl This is for stuff that absolutely must end up in pyconfig.h.
33 dnl Please use pyport.h instead, if possible.
39 /* Define the macros needed if on a UnixWare 7.x system. */
40 #if defined(__USLC__) && defined(__SCO_VERSION__)
41 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
44 #endif /*Py_PYCONFIG_H*/
47 # We don't use PACKAGE_ variables, and they cause conflicts
48 # with other autoconf-based packages that include Python.h
49 grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
51 mv confdefs.h.new confdefs.h
54 VERSION=PYTHON_VERSION
59 # The later defininition of _XOPEN_SOURCE disables certain features
60 # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
61 AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
63 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
64 # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
66 AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
68 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
69 # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
71 AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
73 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
74 # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
75 AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
77 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
78 # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
80 AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
83 define_xopen_source=yes
85 # Arguments passed to configure.
87 CONFIG_ARGS="$ac_configure_args"
89 AC_ARG_ENABLE(universalsdk,
90 AC_HELP_STRING(--enable-universalsdk@<:@=SDKDIR@:>@, Build against Mac OS X 10.4u SDK (ppc/i386)),
94 enableval=/Developer/SDKs/MacOSX10.4u.sdk
103 UNIVERSALSDK=$enableval
110 AC_SUBST(UNIVERSALSDK)
112 AC_SUBST(ARCH_RUN_32BIT)
114 UNIVERSAL_ARCHS="32-bit"
115 AC_MSG_CHECKING(for --with-universal-archs)
116 AC_ARG_WITH(universal-archs,
117 AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")),
119 AC_MSG_RESULT($withval)
120 UNIVERSAL_ARCHS="$withval"
121 if test "${enable_universalsdk}" ; then
124 AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
128 AC_MSG_RESULT(32-bit)
133 AC_ARG_WITH(framework-name,
134 AC_HELP_STRING(--with-framework-name=FRAMEWORK,
135 specify an alternate name of the framework built with --enable-framework),
137 if test "${enable_framework}"; then
140 AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
142 PYTHONFRAMEWORK=${withval}
143 PYTHONFRAMEWORKDIR=${withval}.framework
144 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
146 PYTHONFRAMEWORK=Python
147 PYTHONFRAMEWORKDIR=Python.framework
148 PYTHONFRAMEWORKIDENTIFIER=org.python.python
150 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
151 AC_ARG_ENABLE(framework,
152 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
156 enableval=/Library/Frameworks
161 PYTHONFRAMEWORKDIR=no-framework
162 PYTHONFRAMEWORKPREFIX=
163 PYTHONFRAMEWORKINSTALLDIR=
164 FRAMEWORKINSTALLFIRST=
165 FRAMEWORKINSTALLLAST=
166 FRAMEWORKALTINSTALLFIRST=
167 FRAMEWORKALTINSTALLLAST=
168 if test "x${prefix}" = "xNONE"; then
169 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
171 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
176 PYTHONFRAMEWORKPREFIX=$enableval
177 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
178 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
179 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
180 if test "$UNIVERSAL_ARCHS" = "all"
182 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way"
183 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkaltinstallunixtools4way"
185 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
186 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
189 if test "x${prefix}" = "xNONE" ; then
190 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
192 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
194 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
196 # Add files for Mac specific code to the list of output
198 AC_CONFIG_FILES(Mac/Makefile)
199 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
200 AC_CONFIG_FILES(Mac/IDLE/Makefile)
201 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
202 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
206 PYTHONFRAMEWORKDIR=no-framework
207 PYTHONFRAMEWORKPREFIX=
208 PYTHONFRAMEWORKINSTALLDIR=
209 FRAMEWORKINSTALLFIRST=
210 FRAMEWORKINSTALLLAST=
211 FRAMEWORKALTINSTALLFIRST=
212 FRAMEWORKALTINSTALLLAST=
213 if test "x${prefix}" = "xNONE" ; then
214 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
216 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
220 if test "$UNIVERSAL_ARCHS" = "all"
222 FRAMEWORKINSTALLLAST=update4wayuniversal
223 FRAMEWORKALTINSTALLLAST=update4wayuniversal
226 AC_SUBST(PYTHONFRAMEWORK)
227 AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
228 AC_SUBST(PYTHONFRAMEWORKDIR)
229 AC_SUBST(PYTHONFRAMEWORKPREFIX)
230 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
231 AC_SUBST(FRAMEWORKINSTALLFIRST)
232 AC_SUBST(FRAMEWORKINSTALLLAST)
233 AC_SUBST(FRAMEWORKALTINSTALLFIRST)
234 AC_SUBST(FRAMEWORKALTINSTALLLAST)
235 AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
238 ## AC_HELP_STRING(--with-dyld,
239 ## Use (OpenStep|Rhapsody) dynamic linker))
241 # Set name for machine-dependent library files
243 AC_MSG_CHECKING(MACHDEP)
244 if test -z "$MACHDEP"
246 ac_sys_system=`uname -s`
247 if test "$ac_sys_system" = "AIX" \
248 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
249 ac_sys_release=`uname -v`
251 ac_sys_release=`uname -r`
253 ac_md_system=`echo $ac_sys_system |
254 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
255 ac_md_release=`echo $ac_sys_release |
256 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
257 MACHDEP="$ac_md_system$ac_md_release"
260 cygwin*) MACHDEP="cygwin";;
261 darwin*) MACHDEP="darwin";;
262 atheos*) MACHDEP="atheos";;
263 irix646) MACHDEP="irix6";;
264 '') MACHDEP="unknown";;
268 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
269 # disable features if it is defined, without any means to access these
270 # features as extensions. For these systems, we skip the definition of
271 # _XOPEN_SOURCE. Before adding a system to the list to gain access to
272 # some feature, make sure there is no alternative way to access this
273 # feature. Also, when using wildcards, make sure you have verified the
274 # need for not defining _XOPEN_SOURCE on all systems matching the
275 # wildcard, and that the wildcard does not include future systems
276 # (which may remove their limitations).
277 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
278 case $ac_sys_system/$ac_sys_release in
279 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
280 # even though select is a POSIX function. Reported by J. Ribbens.
281 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
282 OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123@:>@)
283 define_xopen_source=no
284 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
285 # also defined. This can be overridden by defining _BSD_SOURCE
286 # As this has a different meaning on Linux, only define it on OpenBSD
287 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
289 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
290 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
292 NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
293 define_xopen_source=no;;
294 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
295 # of union __?sigval. Reported by Stuart Bishop.
297 define_xopen_source=no;;
298 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
299 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
300 # Reconfirmed for 7.1.4 by Martin v. Loewis.
301 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
302 define_xopen_source=no;;
303 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
304 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
306 define_xopen_source=no;;
307 # On FreeBSD 4, the math functions C89 does not cover are never defined
308 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
310 define_xopen_source=no;;
311 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
312 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
313 # identifies itself as Darwin/7.*
314 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
315 # disables platform specific features beyond repair.
316 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
317 # has no effect, don't bother defining them
318 Darwin/@<:@6789@:>@.*)
319 define_xopen_source=no;;
320 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
321 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
322 # or has another value. By not (re)defining it, the defaults come in place.
324 define_xopen_source=no;;
326 if test `uname -r` -eq 1; then
327 define_xopen_source=no
330 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
331 # defining NI_NUMERICHOST.
333 define_xopen_source=no
338 if test $define_xopen_source = yes
340 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
341 # defined precisely as g++ defines it
342 # Furthermore, on Solaris 10, XPG6 requires the use of a C99
344 case $ac_sys_system/$ac_sys_release in
345 SunOS/5.8|SunOS/5.9|SunOS/5.10)
346 AC_DEFINE(_XOPEN_SOURCE, 500,
347 Define to the level of X/Open that your system supports)
350 AC_DEFINE(_XOPEN_SOURCE, 600,
351 Define to the level of X/Open that your system supports)
355 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
356 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
357 # several APIs are not declared. Since this is also needed in some
358 # cases for HP-UX, we define it globally.
359 # except for Solaris 10, where it must not be defined,
360 # as it implies XPG4.2
361 case $ac_sys_system/$ac_sys_release in
365 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
366 Define to activate Unix95-and-earlier features)
370 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
375 # SGI compilers allow the specification of the both the ABI and the
376 # ISA on the command line. Depending on the values of these switches,
377 # different and often incompatable code will be generated.
379 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
380 # thus supply support for various ABI/ISA combinations. The MACHDEP
381 # variable is also adjusted.
384 if test ! -z "$SGI_ABI"
387 LDFLAGS="$SGI_ABI $LDFLAGS"
388 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
390 AC_MSG_RESULT($MACHDEP)
392 # And add extra plat-mac for darwin
393 AC_SUBST(EXTRAPLATDIR)
394 AC_SUBST(EXTRAMACHDEPPATH)
395 AC_MSG_CHECKING(EXTRAPLATDIR)
396 if test -z "$EXTRAPLATDIR"
400 EXTRAPLATDIR="\$(PLATMACDIRS)"
401 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
409 AC_MSG_RESULT($EXTRAPLATDIR)
411 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
412 # it may influence the way we can build extensions, so distutils
414 AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
415 AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
416 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
417 EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
419 AC_MSG_CHECKING(machine type as reported by uname -m)
420 ac_sys_machine=`uname -m`
421 AC_MSG_RESULT($ac_sys_machine)
423 # checks for alternative programs
425 # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
426 # for debug/optimization stuff. BASECFLAGS is for flags that are required
427 # just to get things to compile and link. Users are free to override OPT
428 # when running configure or make. The build should not break if they do.
429 # BASECFLAGS should generally not be messed with, however.
431 # XXX shouldn't some/most/all of this code be merged with the stuff later
432 # on that fiddles with OPT and BASECFLAGS?
433 AC_MSG_CHECKING(for --without-gcc)
435 AC_HELP_STRING(--without-gcc,never use gcc),
443 without_gcc=$withval;;
445 case $ac_sys_system in
453 BASECFLAGS="$BASECFLAGS -export pragma"
455 LDFLAGS="$LDFLAGS -nodup"
463 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
466 AR="\$(srcdir)/Modules/ar_beos"
471 AC_MSG_RESULT($without_gcc)
473 # If the user switches compilers, we can't believe the cache
474 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
476 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
477 (it is also a good idea to do 'make clean' before compiling)])
484 AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
485 AC_ARG_WITH(cxx_main,
486 AC_HELP_STRING([--with-cxx-main=<compiler>],
487 [compile main() and link python executable with C++ compiler]),
493 yes) with_cxx_main=yes
505 AC_MSG_RESULT($with_cxx_main)
511 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
512 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
514 if test "$CXX" = "notfound"
521 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
522 if test "$CXX" = "notfound"
527 if test "$preset_cxx" != "$CXX"
531 By default, distutils will build C++ extension modules with "$CXX".
532 If this is not intended, then set CXX on the configure command line.
537 # checks for UNIX variants that set C preprocessor variables
540 # Check for unsupported systems
541 case $ac_sys_system/$ac_sys_release in
543 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
544 echo See README for details.
549 AC_MSG_CHECKING(for --with-suffix)
551 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
558 AC_MSG_RESULT($EXEEXT)
560 # Test whether we're running on a non-case-sensitive system, in which
561 # case we give a warning if no ext is given
562 AC_SUBST(BUILDEXEEXT)
563 AC_MSG_CHECKING(for case-insensitive build directory)
564 if test ! -d CaseSensitiveTestDir; then
565 mkdir CaseSensitiveTestDir
568 if test -d casesensitivetestdir
576 rmdir CaseSensitiveTestDir
581 gcc) CC="$CC -D_HAVE_BSDI";;
585 case $ac_sys_system in
588 cc|*/cc) CC="$CC -Ae";;
591 # Some functions have a prototype only with that define, e.g. confstr
592 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
598 AC_MSG_CHECKING(LIBRARY)
599 if test -z "$LIBRARY"
601 LIBRARY='libpython$(VERSION).a'
603 AC_MSG_RESULT($LIBRARY)
605 # LDLIBRARY is the name of the library to link against (as opposed to the
606 # name of the library into which to insert object files). BLDLIBRARY is also
607 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
608 # is blank as the main program is not linked directly against LDLIBRARY.
609 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
610 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
611 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
612 # DLLLIBRARY is the shared (i.e., DLL) library.
614 # RUNSHARED is used to run shared python without installed libraries
616 # INSTSONAME is the name of the shared library that will be use to install
617 # on the system - some systems like version suffix, others don't
621 AC_SUBST(LDLIBRARYDIR)
625 BLDLIBRARY='$(LDLIBRARY)'
626 INSTSONAME='$(LDLIBRARY)'
631 # LINKCC is the command that links the python executable -- default is $(CC).
632 # If CXX is set, and if it is needed to link a main function that was
633 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
634 # python might then depend on the C++ runtime
635 # This is altered for AIX in order to build the export list before
638 AC_MSG_CHECKING(LINKCC)
641 LINKCC='$(PURIFY) $(MAINCC)'
642 case $ac_sys_system in
645 if test $ac_sys_release -ge 5 -o \
646 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
649 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
651 # qcc must be used because the other compilers do not
656 AC_MSG_RESULT($LINKCC)
658 # GNULD is set to "yes" if the GNU linker is used. If this goes wrong
659 # make sure we default having it set to "no": this is used by
660 # distutils.unixccompiler to know if it should add --enable-new-dtags
661 # to linker command lines, and failing to detect GNU ld simply results
662 # in the same bahaviour as before.
664 AC_MSG_CHECKING(for GNU ld)
666 if test "$GCC" = yes; then
667 ac_prog=`$CC -print-prog-name=ld`
669 case `"$ac_prog" -V 2>&1 < /dev/null` in
675 AC_MSG_RESULT($GNULD)
677 AC_MSG_CHECKING(for --enable-shared)
678 AC_ARG_ENABLE(shared,
679 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
681 if test -z "$enable_shared"
683 case $ac_sys_system in
685 enable_shared="yes";;
690 AC_MSG_RESULT($enable_shared)
692 AC_MSG_CHECKING(for --enable-profiling)
693 AC_ARG_ENABLE(profiling,
694 AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
697 AC_TRY_RUN([int main() { return 0; }],
698 ac_enable_profiling="yes",
699 ac_enable_profiling="no",
700 ac_enable_profiling="no")
702 AC_MSG_RESULT($ac_enable_profiling)
704 case "$ac_enable_profiling" in
706 BASECFLAGS="-pg $BASECFLAGS"
707 LDFLAGS="-pg $LDFLAGS"
711 AC_MSG_CHECKING(LDLIBRARY)
713 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
714 # library that we build, but we do not want to link against it (we
715 # will find it with a -framework option). For this reason there is an
716 # extra variable BLDLIBRARY against which Python and the extension
717 # modules are linked, BLDLIBRARY. This is normally the same as
718 # LDLIBRARY, but empty for MacOSX framework builds.
719 if test "$enable_framework"
721 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
722 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
725 BLDLIBRARY='$(LDLIBRARY)'
728 # Other platforms follow
729 if test $enable_shared = "yes"; then
730 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
731 case $ac_sys_system in
733 LDLIBRARY='libpython$(VERSION).so'
736 LDLIBRARY='libpython$(VERSION).dll.a'
737 DLLLIBRARY='libpython$(VERSION).dll'
740 LDLIBRARY='libpython$(VERSION).so'
741 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
742 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
743 INSTSONAME="$LDLIBRARY".$SOVERSION
745 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
746 LDLIBRARY='libpython$(VERSION).so'
747 BLDLIBRARY='-L. -lpython$(VERSION)'
748 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
749 case $ac_sys_system in
751 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
754 INSTSONAME="$LDLIBRARY".$SOVERSION
759 LDLIBRARY='libpython$(VERSION).so'
762 LDLIBRARY='libpython$(VERSION).sl'
765 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
766 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
769 LDLIBRARY='libpython$(VERSION).so'
770 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
771 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
774 LDLIBRARY='libpython$(VERSION).so'
775 BLDLIBRARY='-L. -lpython$(VERSION)'
776 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
779 LDLIBRARY='libpython$(VERSION).dylib'
780 BLDLIBRARY='-L. -lpython$(VERSION)'
781 RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
785 else # shared is disabled
786 case $ac_sys_system in
788 BLDLIBRARY='$(LIBRARY)'
789 LDLIBRARY='libpython$(VERSION).dll.a'
794 AC_MSG_RESULT($LDLIBRARY)
798 AC_CHECK_PROGS(AR, ar aal, ar)
800 # tweak ARFLAGS only if the user didn't set it on the command line
802 if test -z "$ARFLAGS"
808 AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
809 if test $SVNVERSION = found
811 SVNVERSION="svnversion \$(srcdir)"
813 SVNVERSION="echo Unversioned directory"
818 # install -d does not work on BSDI or HP-UX
819 if test -z "$INSTALL"
821 INSTALL="${srcdir}/install-sh -c"
826 # Not every filesystem supports hard links
828 if test -z "$LN" ; then
829 case $ac_sys_system in
831 CYGWIN*) LN="ln -s";;
832 atheos*) LN="ln -s";;
837 # Check for --with-pydebug
838 AC_MSG_CHECKING(for --with-pydebug)
840 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
842 if test "$withval" != no
844 AC_DEFINE(Py_DEBUG, 1,
845 [Define if you want to build an interpreter with many run-time checks.])
848 else AC_MSG_RESULT(no); Py_DEBUG='false'
852 # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
853 # merged with this chunk of code?
855 # Optimizer/debugger flags
856 # ------------------------
857 # (The following bit of code is complicated enough - please keep things
858 # indented properly. Just pretend you're editing Python code. ;-)
860 # There are two parallel sets of case statements below, one that checks to
861 # see if OPT was set and one that does BASECFLAGS setting based upon
862 # compiler and platform. BASECFLAGS tweaks need to be made even if the
865 # tweak OPT based on compiler and platform, only if the user didn't set
866 # it on the command line
872 if test "$CC" != 'g++' ; then
873 STRICT_PROTO="-Wstrict-prototypes"
875 # For gcc 4.x we need to use -fwrapv so lets check if its supported
876 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
879 case $ac_cv_prog_cc_g in
881 if test "$Py_DEBUG" = 'true' ; then
882 # Optimization messes up debuggers, so turn it off for
884 OPT="-g -Wall $STRICT_PROTO"
886 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
890 OPT="-O3 -Wall $STRICT_PROTO"
893 case $ac_sys_system in
894 SCO_SV*) OPT="$OPT -m486 -DSCO5"
907 # The -arch flags for universal builds on OSX
908 UNIVERSAL_ARCH_FLAGS=
909 AC_SUBST(UNIVERSAL_ARCH_FLAGS)
911 # tweak BASECFLAGS based on compiler and platform
914 # Python violates C99 rules, by casting between incompatible
915 # pointer types. GCC may generate bad code as a result of that,
916 # so use -fno-strict-aliasing if supported.
917 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
919 CC="$CC -fno-strict-aliasing"
920 AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
921 AC_TRY_RUN([int main() { return 0; }],
922 ac_cv_no_strict_aliasing_ok=yes,
923 ac_cv_no_strict_aliasing_ok=no,
924 ac_cv_no_strict_aliasing_ok=no))
926 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
927 if test $ac_cv_no_strict_aliasing_ok = yes
929 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
932 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
933 # support. Without this, treatment of subnormals doesn't follow
935 case $ac_sys_machine in
937 BASECFLAGS="$BASECFLAGS -mieee"
941 case $ac_sys_system in
943 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
945 # is there any other compiler on Darwin besides gcc?
947 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
948 # used to be here, but non-Apple gcc doesn't accept them.
951 if test "${enable_universalsdk}"; then
952 UNIVERSAL_ARCH_FLAGS=""
953 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
954 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
957 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
958 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
959 ARCH_RUN_32BIT="true"
961 elif test "$UNIVERSAL_ARCHS" = "all" ; then
962 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
963 ARCH_RUN_32BIT="arch -i386 -ppc"
965 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
966 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
967 ARCH_RUN_32BIT="arch -i386"
969 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
970 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
971 ARCH_RUN_32BIT="arch -i386 -ppc"
974 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
979 BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
980 tgt=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
981 if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
982 CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
986 # Calculate the right deployment target for this build.
988 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
989 if test ${cur_target} '>' 10.2; then
991 if test ${enable_universalsdk}; then
992 if test "${UNIVERSAL_ARCHS}" = "all"; then
993 # Ensure that the default platform for a
994 # 4-way universal build is OSX 10.5,
995 # that's the first OS release where
996 # 4-way builds make sense.
999 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
1002 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
1005 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
1009 if test `arch` = "i386"; then
1010 # On Intel macs default to a deployment
1011 # target of 10.4, that's the first OSX
1012 # release with Intel support.
1017 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1019 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
1020 # environment with a value that is the same as what we'll use
1021 # in the Makefile to ensure that we'll get the same compiler
1022 # environment during configure and build time.
1023 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1024 export MACOSX_DEPLOYMENT_TARGET
1025 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1029 BASECFLAGS="$BASECFLAGS -mieee"
1035 case $ac_sys_system in
1036 OpenUNIX*|UnixWare*)
1037 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1040 BASECFLAGS="$BASECFLAGS -ieee -std"
1043 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1049 if test "$Py_DEBUG" = 'true'; then
1055 if test "$ac_arch_flags"
1057 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
1060 # disable check for icc since it seems to pass, but generates a warning
1063 ac_cv_opt_olimit_ok=no
1066 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1067 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1069 CC="$CC -OPT:Olimit=0"
1070 AC_TRY_RUN([int main() { return 0; }],
1071 ac_cv_opt_olimit_ok=yes,
1072 ac_cv_opt_olimit_ok=no,
1073 ac_cv_opt_olimit_ok=no)
1075 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
1076 if test $ac_cv_opt_olimit_ok = yes; then
1077 case $ac_sys_system in
1078 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1079 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1084 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1088 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1089 AC_CACHE_VAL(ac_cv_olimit_ok,
1091 CC="$CC -Olimit 1500"
1092 AC_TRY_RUN([int main() { return 0; }],
1093 ac_cv_olimit_ok=yes,
1097 AC_MSG_RESULT($ac_cv_olimit_ok)
1098 if test $ac_cv_olimit_ok = yes; then
1099 BASECFLAGS="$BASECFLAGS -Olimit 1500"
1103 # Check whether GCC supports PyArg_ParseTuple format
1104 if test "$GCC" = "yes"
1106 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1108 CFLAGS="$CFLAGS -Werror"
1110 void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
1112 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1119 # On some compilers, pthreads are available without further options
1120 # (e.g. MacOS X). On some of these systems, the compiler will not
1121 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1122 # So we have to see first whether pthreads are available without
1123 # options before we can check whether -Kpthread improves anything.
1124 AC_MSG_CHECKING(whether pthreads are available without options)
1125 AC_CACHE_VAL(ac_cv_pthread_is_default,
1127 #include <pthread.h>
1129 void* routine(void* p){return NULL;}
1133 if(pthread_create(&p,NULL,routine,NULL)!=0)
1135 (void)pthread_detach(p);
1140 ac_cv_pthread_is_default=yes
1144 ac_cv_pthread_is_default=no,
1145 ac_cv_pthread_is_default=no)
1147 AC_MSG_RESULT($ac_cv_pthread_is_default)
1150 if test $ac_cv_pthread_is_default = yes
1154 # -Kpthread, if available, provides the right #defines
1155 # and linker options to make pthread_create available
1156 # Some compilers won't report that they do not support -Kpthread,
1157 # so we need to run a program to see whether it really made the
1158 # function available.
1159 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1160 AC_CACHE_VAL(ac_cv_kpthread,
1164 #include <pthread.h>
1166 void* routine(void* p){return NULL;}
1170 if(pthread_create(&p,NULL,routine,NULL)!=0)
1172 (void)pthread_detach(p);
1180 AC_MSG_RESULT($ac_cv_kpthread)
1183 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
1185 # -Kthread, if available, provides the right #defines
1186 # and linker options to make pthread_create available
1187 # Some compilers won't report that they do not support -Kthread,
1188 # so we need to run a program to see whether it really made the
1189 # function available.
1190 AC_MSG_CHECKING(whether $CC accepts -Kthread)
1191 AC_CACHE_VAL(ac_cv_kthread,
1195 #include <pthread.h>
1197 void* routine(void* p){return NULL;}
1201 if(pthread_create(&p,NULL,routine,NULL)!=0)
1203 (void)pthread_detach(p);
1211 AC_MSG_RESULT($ac_cv_kthread)
1214 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
1216 # -pthread, if available, provides the right #defines
1217 # and linker options to make pthread_create available
1218 # Some compilers won't report that they do not support -pthread,
1219 # so we need to run a program to see whether it really made the
1220 # function available.
1221 AC_MSG_CHECKING(whether $CC accepts -pthread)
1222 AC_CACHE_VAL(ac_cv_thread,
1226 #include <pthread.h>
1228 void* routine(void* p){return NULL;}
1232 if(pthread_create(&p,NULL,routine,NULL)!=0)
1234 (void)pthread_detach(p);
1242 AC_MSG_RESULT($ac_cv_pthread)
1245 # If we have set a CC compiler flag for thread support then
1246 # check if it works for CXX, too.
1250 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1253 if test "$ac_cv_kpthread" = "yes"
1255 CXX="$CXX -Kpthread"
1256 ac_cv_cxx_thread=yes
1257 elif test "$ac_cv_kthread" = "yes"
1260 ac_cv_cxx_thread=yes
1261 elif test "$ac_cv_pthread" = "yes"
1264 ac_cv_cxx_thread=yes
1267 if test $ac_cv_cxx_thread = yes
1269 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1270 $CXX -c conftest.$ac_ext 2>&5
1271 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1272 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1274 ac_cv_cxx_thread=yes
1280 AC_MSG_RESULT($ac_cv_cxx_thread)
1284 dnl # check for ANSI or K&R ("traditional") preprocessor
1285 dnl AC_MSG_CHECKING(for C preprocessor type)
1286 dnl AC_TRY_COMPILE([
1287 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1289 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1290 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
1291 dnl AC_MSG_RESULT($cpp_type)
1293 # checks for header files
1295 AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1297 ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
1298 shadow.h signal.h stdint.h stropts.h termios.h thread.h \
1300 sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1301 sys/lock.h sys/mkdev.h sys/modem.h \
1302 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
1303 sys/termio.h sys/time.h \
1304 sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
1305 sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1306 bluetooth/bluetooth.h linux/tipc.h)
1310 # On Solaris, term.h requires curses.h
1311 AC_CHECK_HEADERS(term.h,,,[
1312 #ifdef HAVE_CURSES_H
1317 # On Linux, netlink.h requires asm/types.h
1318 AC_CHECK_HEADERS(linux/netlink.h,,,[
1319 #ifdef HAVE_ASM_TYPES_H
1320 #include <asm/types.h>
1322 #ifdef HAVE_SYS_SOCKET_H
1323 #include <sys/socket.h>
1327 # checks for typedefs
1329 AC_MSG_CHECKING(for clock_t in time.h)
1330 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1331 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1333 AC_MSG_RESULT($was_it_defined)
1335 # Check whether using makedev requires defining _OSF_SOURCE
1336 AC_MSG_CHECKING(for makedev)
1337 AC_TRY_LINK([#include <sys/types.h> ],
1339 ac_cv_has_makedev=yes,
1340 ac_cv_has_makedev=no)
1341 if test "$ac_cv_has_makedev" = "no"; then
1342 # we didn't link, try if _OSF_SOURCE will allow us to link
1344 #define _OSF_SOURCE 1
1345 #include <sys/types.h>
1348 ac_cv_has_makedev=yes,
1349 ac_cv_has_makedev=no)
1350 if test "$ac_cv_has_makedev" = "yes"; then
1351 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1354 AC_MSG_RESULT($ac_cv_has_makedev)
1355 if test "$ac_cv_has_makedev" = "yes"; then
1356 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1359 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1360 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1361 # defined, but the compiler does not support pragma redefine_extname,
1362 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1363 # structures (such as rlimit64) without declaring them. As a
1364 # work-around, disable LFS on such configurations
1367 AC_MSG_CHECKING(Solaris LFS bug)
1369 #define _LARGEFILE_SOURCE 1
1370 #define _FILE_OFFSET_BITS 64
1371 #include <sys/resource.h>
1372 ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1373 AC_MSG_RESULT($sol_lfs_bug)
1374 if test "$sol_lfs_bug" = "yes"; then
1378 if test "$use_lfs" = "yes"; then
1379 # Two defines needed to enable largefile support on various platforms
1380 # These may affect some typedefs
1381 AC_DEFINE(_LARGEFILE_SOURCE, 1,
1382 [This must be defined on some systems to enable large file support.])
1383 AC_DEFINE(_FILE_OFFSET_BITS, 64,
1384 [This must be set to 64 on some systems to enable large file support.])
1387 # Add some code to confdefs.h so that the test for off_t works on SCO
1388 cat >> confdefs.h <<\EOF
1394 # Type availability checks
1405 AC_CHECK_TYPE(ssize_t,
1406 AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
1408 # Sizes of various common basic types
1409 # ANSI C requires sizeof(char) == 1, so no need to check it
1410 AC_CHECK_SIZEOF(int, 4)
1411 AC_CHECK_SIZEOF(long, 4)
1412 AC_CHECK_SIZEOF(void *, 4)
1413 AC_CHECK_SIZEOF(short, 2)
1414 AC_CHECK_SIZEOF(float, 4)
1415 AC_CHECK_SIZEOF(double, 8)
1416 AC_CHECK_SIZEOF(fpos_t, 4)
1417 AC_CHECK_SIZEOF(size_t, 4)
1418 AC_CHECK_SIZEOF(pid_t, 4)
1420 AC_MSG_CHECKING(for long long support)
1422 AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1423 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1426 AC_MSG_RESULT($have_long_long)
1427 if test "$have_long_long" = yes ; then
1428 AC_CHECK_SIZEOF(long long, 8)
1431 AC_MSG_CHECKING(for long double support)
1433 AC_TRY_COMPILE([], [long double x; x = (long double)0.;], [
1434 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1435 have_long_double=yes
1437 AC_MSG_RESULT($have_long_double)
1438 if test "$have_long_double" = yes ; then
1439 AC_CHECK_SIZEOF(long double, 12)
1442 AC_MSG_CHECKING(for _Bool support)
1444 AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [
1445 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1448 AC_MSG_RESULT($have_c99_bool)
1449 if test "$have_c99_bool" = yes ; then
1450 AC_CHECK_SIZEOF(_Bool, 1)
1453 AC_CHECK_TYPES(uintptr_t,
1454 [AC_CHECK_SIZEOF(uintptr_t, 4)],
1455 [], [#ifdef HAVE_STDINT_H
1459 AC_CHECK_SIZEOF(off_t, [], [
1460 #ifdef HAVE_SYS_TYPES_H
1461 #include <sys/types.h>
1465 AC_MSG_CHECKING(whether to enable large file support)
1466 if test "$have_long_long" = yes -a \
1467 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1468 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1469 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1470 [Defined to enable large file support when an off_t is bigger than a long
1471 and long long is available and at least as big as an off_t. You may need
1472 to add some flags for configuration and compilation to enable this mode.
1473 (For Solaris and Linux, the necessary defines are already defined.)])
1479 AC_CHECK_SIZEOF(time_t, [], [
1480 #ifdef HAVE_SYS_TYPES_H
1481 #include <sys/types.h>
1488 # if have pthread_t then define SIZEOF_PTHREAD_T
1490 if test "$ac_cv_kpthread" = "yes"
1491 then CC="$CC -Kpthread"
1492 elif test "$ac_cv_kthread" = "yes"
1493 then CC="$CC -Kthread"
1494 elif test "$ac_cv_pthread" = "yes"
1495 then CC="$CC -pthread"
1497 AC_MSG_CHECKING(for pthread_t)
1499 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
1500 AC_MSG_RESULT($have_pthread_t)
1501 if test "$have_pthread_t" = yes ; then
1502 AC_CHECK_SIZEOF(pthread_t, [], [
1503 #ifdef HAVE_PTHREAD_H
1504 #include <pthread.h>
1510 AC_MSG_CHECKING(for --enable-toolbox-glue)
1511 AC_ARG_ENABLE(toolbox-glue,
1512 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
1514 if test -z "$enable_toolbox_glue"
1516 case $ac_sys_system/$ac_sys_release in
1518 enable_toolbox_glue="yes";;
1520 enable_toolbox_glue="no";;
1523 case "$enable_toolbox_glue" in
1525 extra_machdep_objs="Python/mactoolboxglue.o"
1526 extra_undefs="-u _PyMac_Error"
1527 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1528 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
1531 extra_machdep_objs=""
1535 AC_MSG_RESULT($enable_toolbox_glue)
1538 AC_SUBST(OTHER_LIBTOOL_OPT)
1539 case $ac_sys_system/$ac_sys_release in
1540 Darwin/@<:@01567@:>@\..*)
1541 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1544 OTHER_LIBTOOL_OPT=""
1550 AC_SUBST(LIBTOOL_CRUFT)
1551 case $ac_sys_system/$ac_sys_release in
1552 Darwin/@<:@01567@:>@\..*)
1553 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1554 if test "${enable_universalsdk}"; then
1557 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
1559 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1560 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1562 gcc_version=`gcc -v 2>&1 | grep version | cut -d\ -f3`
1563 if test ${gcc_version} '<' 4.0
1565 LIBTOOL_CRUFT="-lcc_dynamic"
1571 int main(int argc, char*argv[])
1573 if (sizeof(long) == 4) {
1579 ], ac_osx_32bit=yes,
1583 if test "${ac_osx_32bit}" = "yes"; then
1586 MACOSX_DEFAULT_ARCH="i386"
1589 MACOSX_DEFAULT_ARCH="ppc"
1592 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1598 MACOSX_DEFAULT_ARCH="x86_64"
1601 MACOSX_DEFAULT_ARCH="ppc64"
1604 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1608 #ARCH_RUN_32BIT="true"
1611 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
1612 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1613 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1616 AC_MSG_CHECKING(for --enable-framework)
1617 if test "$enable_framework"
1619 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
1620 # -F. is needed to allow linking to the framework while
1621 # in the build location.
1622 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1623 [Define if you want to produce an OpenStep/Rhapsody framework
1624 (shared library plus accessory files).])
1626 if test $enable_shared = "yes"
1628 AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.])
1634 AC_MSG_CHECKING(for dyld)
1635 case $ac_sys_system/$ac_sys_release in
1637 AC_DEFINE(WITH_DYLD, 1,
1638 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1639 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1640 linker (rld). Dyld is necessary to support frameworks.])
1641 AC_MSG_RESULT(always on for Darwin)
1648 # Set info about shared libraries.
1653 AC_SUBST(LINKFORSHARED)
1654 # SO is the extension of shared libraries `(including the dot!)
1655 # -- usually .so, .sl on HP-UX, .dll on Cygwin
1659 case $ac_sys_system in
1670 # this might also be a termcap variable, see #610332
1672 echo '====================================================================='
1674 echo '+ WARNING: You have set SO in your environment. +'
1675 echo '+ Do you really mean to change the extension for shared libraries? +'
1676 echo '+ Continuing in 10 seconds to let you to ponder. +'
1678 echo '====================================================================='
1683 AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
1684 # LDSHARED is the ld *command* used to create shared library
1685 # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
1686 # (Shared libraries in this instance are shared modules to be loaded into
1687 # Python, as opposed to building Python itself as a shared library.)
1688 AC_MSG_CHECKING(LDSHARED)
1689 if test -z "$LDSHARED"
1691 case $ac_sys_system/$ac_sys_release in
1693 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
1694 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
1697 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
1698 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
1700 IRIX/5*) LDSHARED="ld -shared";;
1701 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1703 if test "$GCC" = "yes"
1704 then LDSHARED='$(CC) -shared'
1705 else LDSHARED='$(CC) -G';
1708 if test "$GCC" = "yes"
1709 then LDSHARED='$(CC) -shared'
1710 else LDSHARED='ld -b';
1712 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1714 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1715 if test "$enable_framework" ; then
1716 # Link against the framework. All externals should be defined.
1717 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1718 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1720 # No framework. Ignore undefined symbols, assuming they come from Python
1721 LDSHARED="$LDSHARED -undefined suppress"
1723 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
1724 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1725 if test "$enable_framework" ; then
1726 # Link against the framework. All externals should be defined.
1727 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1728 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1730 # No framework, use the Python app as bundle-loader
1731 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1732 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1735 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1736 # This allows an extension to be used in any Python
1738 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
1740 if test "${enable_universalsdk}"; then
1741 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1743 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1744 BLDSHARED="$LDSHARED"
1746 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1747 if test "$enable_framework" ; then
1748 # Link against the framework. All externals should be defined.
1749 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1750 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1752 # No framework, use the Python app as bundle-loader
1753 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1754 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1758 Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';;
1759 BSD/OS*/4*) LDSHARED="gcc -shared";;
1761 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1763 LDSHARED="$CC -shared ${LDFLAGS}"
1765 LDSHARED="ld -Bshareable ${LDFLAGS}"
1768 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1770 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1773 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
1774 LDSHARED="ld -Bshareable ${LDFLAGS}"
1777 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1781 NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
1782 OpenUNIX*|UnixWare*)
1783 if test "$GCC" = "yes"
1784 then LDSHARED='$(CC) -shared'
1785 else LDSHARED='$(CC) -G'
1787 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1788 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1789 atheos*) LDSHARED="gcc -shared";;
1793 AC_MSG_RESULT($LDSHARED)
1794 BLDSHARED=${BLDSHARED-$LDSHARED}
1795 # CCSHARED are the C *flags* used to create objects to go into a shared
1796 # library (module) -- this is only needed for a few systems
1797 AC_MSG_CHECKING(CCSHARED)
1798 if test -z "$CCSHARED"
1800 case $ac_sys_system/$ac_sys_release in
1801 SunOS*) if test "$GCC" = yes;
1802 then CCSHARED="-fPIC";
1803 elif test `uname -p` = sparc;
1804 then CCSHARED="-xcode=pic32";
1805 else CCSHARED="-Kpic";
1807 hp*|HP*) if test "$GCC" = yes;
1808 then CCSHARED="-fPIC";
1811 Linux*|GNU*) CCSHARED="-fPIC";;
1812 BSD/OS*/4*) CCSHARED="-fpic";;
1813 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
1814 OpenUNIX*|UnixWare*)
1815 if test "$GCC" = "yes"
1816 then CCSHARED="-fPIC"
1817 else CCSHARED="-KPIC"
1820 if test "$GCC" = "yes"
1821 then CCSHARED="-fPIC"
1822 else CCSHARED="-Kpic -belf"
1824 IRIX*/6*) case $CC in
1825 *gcc*) CCSHARED="-shared";;
1828 atheos*) CCSHARED="-fPIC";;
1831 AC_MSG_RESULT($CCSHARED)
1832 # LINKFORSHARED are the flags passed to the $(CC) command that links
1833 # the python executable -- this is only needed for a few systems
1834 AC_MSG_CHECKING(LINKFORSHARED)
1835 if test -z "$LINKFORSHARED"
1837 case $ac_sys_system/$ac_sys_release in
1838 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1840 LINKFORSHARED="-Wl,-E -Wl,+s";;
1841 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1842 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1843 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1844 # -u libsys_s pulls in all symbols in libsys
1846 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1848 # not used by the core itself but which needs to be in the core so
1849 # that dynamically loaded extension modules have access to it.
1850 # -prebind is no longer used, because it actually seems to give a
1851 # slowdown in stead of a speedup, maybe due to the large number of
1852 # dynamic loads Python does.
1854 LINKFORSHARED="$extra_undefs"
1855 if test "$enable_framework"
1857 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1859 LINKFORSHARED="$LINKFORSHARED";;
1860 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1861 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1862 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1863 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
1864 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1866 LINKFORSHARED="-Wl,--export-dynamic"
1868 SunOS/5*) case $CC in
1870 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
1872 LINKFORSHARED="-Xlinker --export-dynamic"
1876 if test $enable_shared = "no"
1878 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1881 # -Wl,-E causes the symbols to be added to the dynamic
1882 # symbol table so that they can be found when a module
1883 # is loaded. -N 2048K causes the stack size to be set
1884 # to 2048 kilobytes so that the stack doesn't overflow
1885 # when running test_compile.py.
1886 LINKFORSHARED='-Wl,-E -N 2048K';;
1889 AC_MSG_RESULT($LINKFORSHARED)
1892 AC_SUBST(CFLAGSFORSHARED)
1893 AC_MSG_CHECKING(CFLAGSFORSHARED)
1894 if test ! "$LIBRARY" = "$LDLIBRARY"
1896 case $ac_sys_system in
1898 # Cygwin needs CCSHARED when building extension DLLs
1899 # but not when building the interpreter DLL.
1900 CFLAGSFORSHARED='';;
1902 CFLAGSFORSHARED='$(CCSHARED)'
1905 AC_MSG_RESULT($CFLAGSFORSHARED)
1907 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
1908 # library (with --enable-shared).
1909 # For platforms on which shared libraries are not allowed to have unresolved
1910 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
1911 # if it is not required, since it creates a dependency of the shared library
1912 # to LIBS. This, in turn, means that applications linking the shared libpython
1913 # don't need to link LIBS explicitly. The default should be only changed
1914 # on systems where this approach causes problems.
1916 AC_MSG_CHECKING(SHLIBS)
1917 case "$ac_sys_system" in
1921 AC_MSG_RESULT($SHLIBS)
1924 # checks for libraries
1925 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1926 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
1928 # only check for sem_init if thread support is requested
1929 if test "$with_threads" = "yes" -o -z "$with_threads"; then
1930 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
1931 # posix4 on Solaris 2.6
1932 # pthread (first!) on Linux
1935 # check if we need libintl for locale functions
1936 AC_CHECK_LIB(intl, textdomain,
1937 AC_DEFINE(WITH_LIBINTL, 1,
1938 [Define to 1 if libintl is needed for locale functions.]))
1940 # checks for system dependent C++ extensions support
1941 case "$ac_sys_system" in
1942 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1943 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1944 [loadAndInit("", 0, "")],
1945 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1946 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1947 and you want support for AIX C++ shared extension modules.])
1948 AC_MSG_RESULT(yes)],
1949 [AC_MSG_RESULT(no)]);;
1953 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1954 # BeOS' sockets are stashed in libnet.
1955 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
1956 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
1958 case "$ac_sys_system" in
1960 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1964 AC_MSG_CHECKING(for --with-libs)
1966 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1968 AC_MSG_RESULT($withval)
1969 LIBS="$withval $LIBS"
1971 [AC_MSG_RESULT(no)])
1973 # Check for use of the system libffi library
1974 AC_MSG_CHECKING(for --with-system-ffi)
1975 AC_ARG_WITH(system_ffi,
1976 AC_HELP_STRING(--with-system-ffi, build _ctypes module using an installed ffi library))
1978 AC_MSG_RESULT($with_system_ffi)
1980 # Check for --with-dbmliborder
1981 AC_MSG_CHECKING(for --with-dbmliborder)
1982 AC_ARG_WITH(dbmliborder,
1983 AC_HELP_STRING([--with-dbmliborder=db1:db2:...], [order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]),
1985 if test x$with_dbmliborder = xyes
1987 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
1989 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
1990 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
1992 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
1996 AC_MSG_RESULT($with_dbmliborder)
1998 # Determine if signalmodule should be used.
1999 AC_SUBST(USE_SIGNAL_MODULE)
2000 AC_SUBST(SIGNAL_OBJS)
2001 AC_MSG_CHECKING(for --with-signal-module)
2002 AC_ARG_WITH(signal-module,
2003 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
2005 if test -z "$with_signal_module"
2006 then with_signal_module="yes"
2008 AC_MSG_RESULT($with_signal_module)
2010 if test "${with_signal_module}" = "yes"; then
2011 USE_SIGNAL_MODULE=""
2014 USE_SIGNAL_MODULE="#"
2015 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2018 # This is used to generate Setup.config
2019 AC_SUBST(USE_THREAD_MODULE)
2020 USE_THREAD_MODULE=""
2022 AC_MSG_CHECKING(for --with-dec-threads)
2024 AC_ARG_WITH(dec-threads,
2025 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
2027 AC_MSG_RESULT($withval)
2029 if test "${with_thread+set}" != set; then
2030 with_thread="$withval";
2032 [AC_MSG_RESULT(no)])
2034 # Templates for things AC_DEFINEd more than once.
2035 # For a single AC_DEFINE, no template is needed.
2036 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2037 AH_TEMPLATE(_REENTRANT,
2038 [Define to force use of thread-safe errno, h_errno, and other functions])
2039 AH_TEMPLATE(WITH_THREAD,
2040 [Define if you want to compile in rudimentary thread support])
2042 AC_MSG_CHECKING(for --with-threads)
2043 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2044 AC_ARG_WITH(threads,
2045 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
2047 # --with-thread is deprecated, but check for it anyway
2048 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2050 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
2051 [with_threads=$with_thread])
2053 if test -z "$with_threads"
2054 then with_threads="yes"
2056 AC_MSG_RESULT($with_threads)
2059 if test "$with_threads" = "no"
2061 USE_THREAD_MODULE="#"
2062 elif test "$ac_cv_pthread_is_default" = yes
2064 AC_DEFINE(WITH_THREAD)
2065 # Defining _REENTRANT on system with POSIX threads should not hurt.
2066 AC_DEFINE(_REENTRANT)
2068 THREADOBJ="Python/thread.o"
2069 elif test "$ac_cv_kpthread" = "yes"
2072 if test "$ac_cv_cxx_thread" = "yes"; then
2073 CXX="$CXX -Kpthread"
2075 AC_DEFINE(WITH_THREAD)
2077 THREADOBJ="Python/thread.o"
2078 elif test "$ac_cv_kthread" = "yes"
2081 if test "$ac_cv_cxx_thread" = "yes"; then
2084 AC_DEFINE(WITH_THREAD)
2086 THREADOBJ="Python/thread.o"
2087 elif test "$ac_cv_pthread" = "yes"
2090 if test "$ac_cv_cxx_thread" = "yes"; then
2093 AC_DEFINE(WITH_THREAD)
2095 THREADOBJ="Python/thread.o"
2097 if test ! -z "$with_threads" -a -d "$with_threads"
2098 then LDFLAGS="$LDFLAGS -L$with_threads"
2100 if test ! -z "$withval" -a -d "$withval"
2101 then LDFLAGS="$LDFLAGS -L$withval"
2104 # According to the POSIX spec, a pthreads implementation must
2105 # define _POSIX_THREADS in unistd.h. Some apparently don't
2106 # (e.g. gnu pth with pthread emulation)
2107 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2111 #ifdef _POSIX_THREADS
2114 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2115 AC_MSG_RESULT($unistd_defines_pthreads)
2117 AC_DEFINE(_REENTRANT)
2118 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2119 AC_DEFINE(C_THREADS)
2120 AC_DEFINE(HURD_C_THREADS, 1,
2121 [Define if you are using Mach cthreads directly under /include])
2122 LIBS="$LIBS -lthreads"
2123 THREADOBJ="Python/thread.o"],[
2124 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2125 AC_DEFINE(C_THREADS)
2126 AC_DEFINE(MACH_C_THREADS, 1,
2127 [Define if you are using Mach cthreads under mach /])
2128 THREADOBJ="Python/thread.o"],[
2129 AC_MSG_CHECKING(for --with-pth)
2131 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
2132 [AC_MSG_RESULT($withval)
2133 AC_DEFINE([WITH_THREAD])
2134 AC_DEFINE([HAVE_PTH], 1,
2135 [Define if you have GNU PTH threads.])
2137 THREADOBJ="Python/thread.o"],
2140 # Just looking for pthread_create in libpthread is not enough:
2141 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2142 # So we really have to include pthread.h, and then link.
2144 LIBS="$LIBS -lpthread"
2145 AC_MSG_CHECKING([for pthread_create in -lpthread])
2146 AC_TRY_LINK([#include <pthread.h>
2148 void * start_routine (void *arg) { exit (0); }], [
2149 pthread_create (NULL, NULL, start_routine, NULL)], [
2151 AC_DEFINE(WITH_THREAD)
2153 THREADOBJ="Python/thread.o"],[
2155 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
2157 THREADOBJ="Python/thread.o"],[
2158 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2159 AC_DEFINE(ATHEOS_THREADS, 1,
2160 [Define this if you have AtheOS threads.])
2161 THREADOBJ="Python/thread.o"],[
2162 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
2163 AC_DEFINE(BEOS_THREADS, 1,
2164 [Define this if you have BeOS threads.])
2165 THREADOBJ="Python/thread.o"],[
2166 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
2168 LIBS="$LIBS -lpthreads"
2169 THREADOBJ="Python/thread.o"], [
2170 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
2173 THREADOBJ="Python/thread.o"], [
2174 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
2176 LIBS="$LIBS -lpthread"
2177 THREADOBJ="Python/thread.o"], [
2178 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
2181 THREADOBJ="Python/thread.o"],[
2182 USE_THREAD_MODULE="#"])
2183 ])])])])])])])])])])
2185 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2187 THREADOBJ="Python/thread.o"
2188 USE_THREAD_MODULE=""])
2190 if test "$posix_threads" != "yes"; then
2191 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2192 LIBS="$LIBS -lthread"
2193 THREADOBJ="Python/thread.o"
2194 USE_THREAD_MODULE=""])
2197 if test "$USE_THREAD_MODULE" != "#"
2199 # If the above checks didn't disable threads, (at least) OSF1
2200 # needs this '-threads' argument during linking.
2201 case $ac_sys_system in
2202 OSF1) LDLAST=-threads;;
2207 if test "$posix_threads" = "yes"; then
2208 if test "$unistd_defines_pthreads" = "no"; then
2209 AC_DEFINE(_POSIX_THREADS, 1,
2210 [Define if you have POSIX threads,
2211 and your system does not define that.])
2214 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2215 case $ac_sys_system/$ac_sys_release in
2216 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
2217 Defined for Solaris 2.6 bug in pthread header.)
2219 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2220 Define if the Posix semaphores do not work on your system)
2222 AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2223 Define if the Posix semaphores do not work on your system)
2227 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2228 AC_CACHE_VAL(ac_cv_pthread_system_supported,
2229 [AC_TRY_RUN([#include <pthread.h>
2230 void *foo(void *parm) {
2234 pthread_attr_t attr;
2236 if (pthread_attr_init(&attr)) exit(-1);
2237 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
2238 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
2241 ac_cv_pthread_system_supported=yes,
2242 ac_cv_pthread_system_supported=no,
2243 ac_cv_pthread_system_supported=no)
2245 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2246 if test "$ac_cv_pthread_system_supported" = "yes"; then
2247 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
2249 AC_CHECK_FUNCS(pthread_sigmask,
2250 [case $ac_sys_system in
2252 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2253 [Define if pthread_sigmask() does not work on your system.])
2259 # Check for enable-ipv6
2260 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
2261 AC_MSG_CHECKING([if --enable-ipv6 is specified])
2263 [ --enable-ipv6 Enable ipv6 (with ipv4) support
2264 --disable-ipv6 Disable ipv6 support],
2265 [ case "$enableval" in
2270 *) AC_MSG_RESULT(yes)
2271 AC_DEFINE(ENABLE_IPV6)
2277 dnl the check does not work on cross compilation case...
2278 AC_TRY_RUN([ /* AF_INET6 available check */
2279 #include <sys/types.h>
2280 #include <sys/socket.h>
2283 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
2297 if test "$ipv6" = "yes"; then
2298 AC_MSG_CHECKING(if RFC2553 API is available)
2299 AC_TRY_COMPILE([#include <sys/types.h>
2300 #include <netinet/in.h>],
2301 [struct sockaddr_in6 x;
2305 AC_MSG_RESULT(no, IPv6 disabled)
2309 if test "$ipv6" = "yes"; then
2310 AC_DEFINE(ENABLE_IPV6)
2318 if test "$ipv6" = "yes"; then
2319 AC_MSG_CHECKING([ipv6 stack type])
2320 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2324 dnl http://www.kame.net/
2326 #include <netinet/in.h>
2327 #ifdef IPV6_INRIA_VERSION
2333 dnl http://www.kame.net/
2335 #include <netinet/in.h>
2341 ipv6libdir=/usr/local/v6/lib
2345 dnl http://www.v6.linux.or.jp/
2347 #include <features.h>
2348 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2355 dnl http://www.v6.linux.or.jp/
2356 if test -d /usr/inet6; then
2359 ipv6libdir=/usr/inet6/lib
2360 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
2364 if test -f /etc/netconfig; then
2365 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
2373 #include <sys/param.h>
2374 #ifdef _TOSHIBA_INET6
2379 ipv6libdir=/usr/local/v6/lib])
2383 #include </usr/local/v6/include/sys/v6config.h>
2389 ipv6libdir=/usr/local/v6/lib;
2390 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
2394 #include <sys/param.h>
2395 #ifdef _ZETA_MINAMI_INET6
2400 ipv6libdir=/usr/local/v6/lib])
2403 if test "$ipv6type" != "unknown"; then
2407 AC_MSG_RESULT($ipv6type)
2410 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2411 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2412 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2413 echo "using lib$ipv6lib"
2415 if test $ipv6trylibc = "yes"; then
2418 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2419 echo "You need to fetch lib$ipv6lib.a from appropriate"
2420 echo 'ipv6 kit and compile beforehand.'
2426 AC_MSG_CHECKING(for OSX 10.5 SDK or later)
2427 AC_TRY_COMPILE([#include <Carbon/Carbon.h>], FSIORefNum fRef = 0,
2428 AC_DEFINE(HAVE_OSX105_SDK, 1, Define if compiling using MacOS X 10.5 SDK or later.)
2433 # Check for --with-doc-strings
2434 AC_MSG_CHECKING(for --with-doc-strings)
2435 AC_ARG_WITH(doc-strings,
2436 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
2438 if test -z "$with_doc_strings"
2439 then with_doc_strings="yes"
2441 if test "$with_doc_strings" != "no"
2443 AC_DEFINE(WITH_DOC_STRINGS, 1,
2444 [Define if you want documentation strings in extension modules])
2446 AC_MSG_RESULT($with_doc_strings)
2448 # Check for Python-specific malloc support
2449 AC_MSG_CHECKING(for --with-tsc)
2451 [ --with(out)-tsc enable/disable timestamp counter profile], [
2452 if test "$withval" != no
2454 AC_DEFINE(WITH_TSC, 1,
2455 [Define to profile with the Pentium timestamp counter])
2457 else AC_MSG_RESULT(no)
2459 [AC_MSG_RESULT(no)])
2461 # Check for Python-specific malloc support
2462 AC_MSG_CHECKING(for --with-pymalloc)
2463 AC_ARG_WITH(pymalloc,
2464 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
2466 if test -z "$with_pymalloc"
2467 then with_pymalloc="yes"
2469 if test "$with_pymalloc" != "no"
2471 AC_DEFINE(WITH_PYMALLOC, 1,
2472 [Define if you want to compile in Python-specific mallocs])
2474 AC_MSG_RESULT($with_pymalloc)
2476 # Check for --with-wctype-functions
2477 AC_MSG_CHECKING(for --with-wctype-functions)
2478 AC_ARG_WITH(wctype-functions,
2479 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
2481 if test "$withval" != no
2483 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2484 [Define if you want wctype.h functions to be used instead of the
2485 one supplied by Python itself. (see Include/unicodectype.h).])
2487 else AC_MSG_RESULT(no)
2489 [AC_MSG_RESULT(no)])
2491 # -I${DLINCLDIR} is added to the compile rule for importdl.o
2495 # the dlopen() function means we might want to use dynload_shlib.o. some
2496 # platforms, such as AIX, have dlopen(), but don't want to use it.
2497 AC_CHECK_FUNCS(dlopen)
2499 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2500 # loading of modules.
2501 AC_SUBST(DYNLOADFILE)
2502 AC_MSG_CHECKING(DYNLOADFILE)
2503 if test -z "$DYNLOADFILE"
2505 case $ac_sys_system/$ac_sys_release in
2506 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2507 if test "$ac_cv_func_dlopen" = yes
2508 then DYNLOADFILE="dynload_shlib.o"
2509 else DYNLOADFILE="dynload_aix.o"
2512 BeOS*) DYNLOADFILE="dynload_beos.o";;
2513 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
2514 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2515 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
2516 atheos*) DYNLOADFILE="dynload_atheos.o";;
2518 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2519 # out any dynamic loading
2520 if test "$ac_cv_func_dlopen" = yes
2521 then DYNLOADFILE="dynload_shlib.o"
2522 else DYNLOADFILE="dynload_stub.o"
2527 AC_MSG_RESULT($DYNLOADFILE)
2528 if test "$DYNLOADFILE" != "dynload_stub.o"
2530 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2531 [Defined when any dynamic module loading is enabled.])
2534 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
2536 AC_SUBST(MACHDEP_OBJS)
2537 AC_MSG_CHECKING(MACHDEP_OBJS)
2538 if test -z "$MACHDEP_OBJS"
2540 MACHDEP_OBJS=$extra_machdep_objs
2542 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
2544 AC_MSG_RESULT(MACHDEP_OBJS)
2546 # checks for library functions
2547 AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2548 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
2549 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2550 getpriority getpwent getspnam getspent getsid getwd \
2551 kill killpg lchmod lchown lstat mkfifo mknod mktime \
2552 mremap nice pathconf pause plock poll pthread_init \
2553 putenv readlink realpath \
2554 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
2556 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
2557 sigaction siginterrupt sigrelse strftime \
2558 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
2559 truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
2561 # For some functions, having a definition is not sufficient, since
2562 # we want to take their address.
2563 AC_MSG_CHECKING(for chroot)
2564 AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2565 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2569 AC_MSG_CHECKING(for link)
2570 AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2571 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2575 AC_MSG_CHECKING(for symlink)
2576 AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2577 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2581 AC_MSG_CHECKING(for fchdir)
2582 AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2583 AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2587 AC_MSG_CHECKING(for fsync)
2588 AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
2589 AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2593 AC_MSG_CHECKING(for fdatasync)
2594 AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2595 AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2599 AC_MSG_CHECKING(for epoll)
2600 AC_TRY_COMPILE([#include <sys/epoll.h>], void *x=epoll_create,
2601 AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2605 AC_MSG_CHECKING(for kqueue)
2607 #include <sys/types.h>
2608 #include <sys/event.h>
2610 AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2614 # On some systems (eg. FreeBSD 5), we would find a definition of the
2615 # functions ctermid_r, setgroups in the library, but no prototype
2616 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2617 # address to avoid compiler warnings and potential miscompilations
2618 # because of the missing prototypes.
2620 AC_MSG_CHECKING(for ctermid_r)
2622 #include "confdefs.h"
2624 ], void* p = ctermid_r,
2625 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2630 AC_MSG_CHECKING(for flock)
2632 #include "confdefs.h"
2633 #include <sys/file.h>
2635 AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2640 AC_MSG_CHECKING(for getpagesize)
2642 #include "confdefs.h"
2644 ], void* p = getpagesize,
2645 AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2651 AC_CHECK_PROGS(TRUE, true, /bin/true)
2653 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2654 dnl On others, they are in the C library, so we to take no action
2655 AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
2656 AC_CHECK_LIB(resolv, inet_aton)
2659 # On Tru64, chflags seems to be present, but calling it will
2661 AC_MSG_CHECKING(for chflags)
2662 AC_CACHE_VAL(ac_cv_have_chflags,
2664 #include <sys/stat.h>
2666 int main(int argc, char*argv[])
2668 if(chflags(argv[0], 0) != 0)
2672 ]], ac_cv_have_chflags=yes,
2673 ac_cv_have_chflags=no,
2674 ac_cv_have_chflags=no)
2676 AC_MSG_RESULT($ac_cv_have_chflags)
2677 if test $ac_cv_have_chflags = yes
2679 AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
2682 AC_MSG_CHECKING(for lchflags)
2683 AC_CACHE_VAL(ac_cv_have_lchflags,
2685 #include <sys/stat.h>
2687 int main(int argc, char*argv[])
2689 if(lchflags(argv[0], 0) != 0)
2693 ]], ac_cv_have_lchflags=yes,
2694 ac_cv_have_lchflags=no,
2695 ac_cv_have_lchflags=no)
2697 AC_MSG_RESULT($ac_cv_have_lchflags)
2698 if test $ac_cv_have_lchflags = yes
2700 AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
2703 dnl Check if system zlib has *Copy() functions
2705 dnl On MacOSX the linker will search for dylibs on the entire linker path
2706 dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
2707 dnl to revert to a more traditional unix behaviour and make it possible to
2708 dnl override the system libz with a local static library of libz. Temporarily
2709 dnl add that flag to our CFLAGS as well to ensure that we check the version
2710 dnl of libz that will be used by setup.py.
2711 dnl The -L/usr/local/lib is needed as wel to get the same compilation
2712 dnl environment as setup.py (and leaving it out can cause configure to use the
2713 dnl wrong version of the library)
2714 case $ac_sys_system/$ac_sys_release in
2716 _CUR_CFLAGS="${CFLAGS}"
2717 _CUR_LDFLAGS="${LDFLAGS}"
2718 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
2719 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
2723 AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, Define if the zlib library has inflateCopy))
2725 case $ac_sys_system/$ac_sys_release in
2727 CFLAGS="${_CUR_CFLAGS}"
2728 LDFLAGS="${_CUR_LDFLAGS}"
2732 AC_MSG_CHECKING(for hstrerror)
2734 #include "confdefs.h"
2736 ], void* p = hstrerror; hstrerror(0),
2737 AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2742 AC_MSG_CHECKING(for inet_aton)
2744 #include "confdefs.h"
2745 #include <sys/types.h>
2746 #include <sys/socket.h>
2747 #include <netinet/in.h>
2748 #include <arpa/inet.h>
2749 ], void* p = inet_aton;inet_aton(0,0),
2750 AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2755 AC_MSG_CHECKING(for inet_pton)
2757 #include "confdefs.h"
2758 #include <sys/types.h>
2759 #include <sys/socket.h>
2760 #include <netinet/in.h>
2761 #include <arpa/inet.h>
2762 ], void* p = inet_pton,
2763 AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2768 # On some systems, setgroups is in unistd.h, on others, in grp.h
2769 AC_MSG_CHECKING(for setgroups)
2771 #include "confdefs.h"
2777 void* p = setgroups,
2778 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2783 # check for openpty and forkpty
2785 AC_CHECK_FUNCS(openpty,,
2786 AC_CHECK_LIB(util,openpty,
2787 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2788 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2791 AC_CHECK_FUNCS(forkpty,,
2792 AC_CHECK_LIB(util,forkpty,
2793 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2794 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2799 AC_CHECK_FUNCS(memmove)
2801 # check for long file support functions
2802 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2804 AC_REPLACE_FUNCS(dup2 getcwd strdup)
2805 AC_CHECK_FUNCS(getpgrp,
2806 AC_TRY_COMPILE([#include <unistd.h>],
2808 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2809 [Define if getpgrp() must be called as getpgrp(0).])
2812 AC_CHECK_FUNCS(setpgrp,
2813 AC_TRY_COMPILE([#include <unistd.h>],
2815 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2816 [Define if setpgrp() must be called as setpgrp(0, 0).])
2819 AC_CHECK_FUNCS(gettimeofday,
2820 AC_TRY_COMPILE([#include <sys/time.h>],
2821 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2822 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2823 [Define if gettimeofday() does not have second (timezone) argument
2824 This is the case on Motorola V4 (R40V4.2)])
2828 AC_MSG_CHECKING(for major, minor, and makedev)
2830 #if defined(MAJOR_IN_MKDEV)
2831 #include <sys/mkdev.h>
2832 #elif defined(MAJOR_IN_SYSMACROS)
2833 #include <sys/sysmacros.h>
2835 #include <sys/types.h>
2838 makedev(major(0),minor(0));
2840 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2841 [Define to 1 if you have the device macros.])
2847 # On OSF/1 V5.1, getaddrinfo is available, but a define
2848 # for [no]getaddrinfo in netdb.h.
2849 AC_MSG_CHECKING(for getaddrinfo)
2851 #include <sys/types.h>
2852 #include <sys/socket.h>
2855 ], [getaddrinfo(NULL, NULL, NULL, NULL);],
2856 have_getaddrinfo=yes,
2857 have_getaddrinfo=no)
2858 AC_MSG_RESULT($have_getaddrinfo)
2859 if test $have_getaddrinfo = yes
2861 AC_MSG_CHECKING(getaddrinfo bug)
2862 AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
2864 #include <sys/types.h>
2867 #include <sys/socket.h>
2868 #include <netinet/in.h>
2872 int passive, gaierr, inet4 = 0, inet6 = 0;
2873 struct addrinfo hints, *ai, *aitop;
2874 char straddr[INET6_ADDRSTRLEN], strport[16];
2876 for (passive = 0; passive <= 1; passive++) {
2877 memset(&hints, 0, sizeof(hints));
2878 hints.ai_family = AF_UNSPEC;
2879 hints.ai_flags = passive ? AI_PASSIVE : 0;
2880 hints.ai_socktype = SOCK_STREAM;
2881 hints.ai_protocol = IPPROTO_TCP;
2882 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2883 (void)gai_strerror(gaierr);
2886 for (ai = aitop; ai; ai = ai->ai_next) {
2887 if (ai->ai_addr == NULL ||
2888 ai->ai_addrlen == 0 ||
2889 getnameinfo(ai->ai_addr, ai->ai_addrlen,
2890 straddr, sizeof(straddr), strport, sizeof(strport),
2891 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2894 switch (ai->ai_family) {
2896 if (strcmp(strport, "54321") != 0) {
2900 if (strcmp(straddr, "0.0.0.0") != 0) {
2904 if (strcmp(straddr, "127.0.0.1") != 0) {
2911 if (strcmp(strport, "54321") != 0) {
2915 if (strcmp(straddr, "::") != 0) {
2919 if (strcmp(straddr, "::1") != 0) {
2929 /* another family support? */
2935 if (!(inet4 == 0 || inet4 == 2))
2937 if (!(inet6 == 0 || inet6 == 2))
2941 freeaddrinfo(aitop);
2946 freeaddrinfo(aitop);
2949 ]], ac_cv_buggy_getaddrinfo=no,
2950 ac_cv_buggy_getaddrinfo=yes,
2951 ac_cv_buggy_getaddrinfo=yes))
2954 if test $have_getaddrinfo = no -o $ac_cv_buggy_getaddrinfo = yes
2958 echo 'Fatal: You must get working getaddrinfo() function.'
2959 echo ' or you can specify "--disable-ipv6"'.
2963 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
2965 AC_CHECK_FUNCS(getnameinfo)
2967 # checks for structures
2971 AC_CHECK_MEMBERS([struct stat.st_rdev])
2972 AC_CHECK_MEMBERS([struct stat.st_blksize])
2973 AC_CHECK_MEMBERS([struct stat.st_flags])
2974 AC_CHECK_MEMBERS([struct stat.st_gen])
2975 AC_CHECK_MEMBERS([struct stat.st_birthtime])
2978 AC_MSG_CHECKING(for time.h that defines altzone)
2979 AC_CACHE_VAL(ac_cv_header_time_altzone,
2980 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2981 ac_cv_header_time_altzone=yes,
2982 ac_cv_header_time_altzone=no)])
2983 AC_MSG_RESULT($ac_cv_header_time_altzone)
2984 if test $ac_cv_header_time_altzone = yes; then
2985 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
2989 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
2991 #include <sys/types.h>
2992 #include <sys/select.h>
2993 #include <sys/time.h>
2995 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
2996 [Define if you can safely include both <sys/select.h> and <sys/time.h>
2997 (which you can't on SCO ODT 3.0).])
3000 AC_MSG_RESULT($was_it_defined)
3002 AC_MSG_CHECKING(for addrinfo)
3003 AC_CACHE_VAL(ac_cv_struct_addrinfo,
3005 # include <netdb.h>],
3006 [struct addrinfo a],
3007 ac_cv_struct_addrinfo=yes,
3008 ac_cv_struct_addrinfo=no))
3009 AC_MSG_RESULT($ac_cv_struct_addrinfo)
3010 if test $ac_cv_struct_addrinfo = yes; then
3011 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
3014 AC_MSG_CHECKING(for sockaddr_storage)
3015 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
3017 # include <sys/types.h>
3018 # include <sys/socket.h>],
3019 [struct sockaddr_storage s],
3020 ac_cv_struct_sockaddr_storage=yes,
3021 ac_cv_struct_sockaddr_storage=no))
3022 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3023 if test $ac_cv_struct_sockaddr_storage = yes; then
3024 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
3027 # checks for compiler characteristics
3033 AC_MSG_CHECKING(for working volatile)
3034 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
3035 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
3037 AC_MSG_RESULT($works)
3040 AC_MSG_CHECKING(for working signed char)
3041 AC_TRY_COMPILE([], [signed char c;], works=yes,
3042 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
3044 AC_MSG_RESULT($works)
3047 AC_MSG_CHECKING(for prototypes)
3048 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
3049 AC_DEFINE(HAVE_PROTOTYPES, 1,
3050 [Define if your compiler supports function prototype])
3053 AC_MSG_RESULT($have_prototypes)
3056 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
3059 int foo(int x, ...) {
3067 ], [return foo(10, "", 3.14);], [
3068 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3069 [Define if your compiler supports variable length function prototypes
3070 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3073 AC_MSG_RESULT($works)
3075 # check for socketpair
3076 AC_MSG_CHECKING(for socketpair)
3078 #include <sys/types.h>
3079 #include <sys/socket.h>
3080 ], void *x=socketpair,
3081 AC_DEFINE(HAVE_SOCKETPAIR, 1, Define if you have the 'socketpair' function.)
3086 # check if sockaddr has sa_len member
3087 AC_MSG_CHECKING(if sockaddr has sa_len member)
3088 AC_TRY_COMPILE([#include <sys/types.h>
3089 #include <sys/socket.h>],
3093 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
3097 AC_MSG_CHECKING(whether va_list is an array)
3099 #ifdef HAVE_STDARG_PROTOTYPES
3102 #include <varargs.h>
3104 ], [va_list list1, list2; list1 = list2;], , [
3105 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3106 va_list_is_array=yes
3108 AC_MSG_RESULT($va_list_is_array)
3110 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
3111 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3112 [Define this if you have some version of gethostbyname_r()])
3114 AC_CHECK_FUNC(gethostbyname_r, [
3115 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3116 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3118 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
3123 struct hostent *he, *res;
3128 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
3130 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3131 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3132 [Define this if you have the 6-arg version of gethostbyname_r().])
3136 AC_MSG_CHECKING([gethostbyname_r with 5 args])
3146 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3148 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3149 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3150 [Define this if you have the 5-arg version of gethostbyname_r().])
3154 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3160 struct hostent_data data;
3162 (void) gethostbyname_r(name, he, &data);
3164 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3165 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3166 [Define this if you have the 3-arg version of gethostbyname_r().])
3175 AC_CHECK_FUNCS(gethostbyname)
3177 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3178 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3179 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
3180 AC_SUBST(HAVE_GETHOSTBYNAME_R)
3181 AC_SUBST(HAVE_GETHOSTBYNAME)
3183 # checks for system services
3186 # Linux requires this for correct f.p. operations
3187 AC_CHECK_FUNC(__fpu_control,
3189 [AC_CHECK_LIB(ieee, __fpu_control)
3192 # Check for --with-fpectl
3193 AC_MSG_CHECKING(for --with-fpectl)
3195 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
3197 if test "$withval" != no
3199 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3200 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3202 else AC_MSG_RESULT(no)
3204 [AC_MSG_RESULT(no)])
3206 # check for --with-libm=...
3208 case $ac_sys_system in
3213 AC_MSG_CHECKING(for --with-libm=STRING)
3215 AC_HELP_STRING(--with-libm=STRING, math library),
3217 if test "$withval" = no
3219 AC_MSG_RESULT(force LIBM empty)
3220 elif test "$withval" != yes
3222 AC_MSG_RESULT(set LIBM="$withval")
3223 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
3225 [AC_MSG_RESULT(default LIBM="$LIBM")])
3227 # check for --with-libc=...
3229 AC_MSG_CHECKING(for --with-libc=STRING)
3231 AC_HELP_STRING(--with-libc=STRING, C library),
3233 if test "$withval" = no
3235 AC_MSG_RESULT(force LIBC empty)
3236 elif test "$withval" != yes
3238 AC_MSG_RESULT(set LIBC="$withval")
3239 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
3241 [AC_MSG_RESULT(default LIBC="$LIBC")])
3243 # ************************************
3244 # * Check for mathematical functions *
3245 # ************************************
3250 # Detect whether system arithmetic is subject to x87-style double
3251 # rounding issues. The result of this test has little meaning on non
3252 # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3253 # mode is round-to-nearest and double rounding issues are present, and
3254 # 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3255 AC_MSG_CHECKING(for x87-style double rounding)
3256 AC_CACHE_VAL(ac_cv_x87_double_rounding, [
3261 volatile double x, y, z;
3262 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3263 x = 0.99999999999999989; /* 1-2**-53 */
3267 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3273 /* both tests show evidence of double rounding */
3277 ac_cv_x87_double_rounding=no,
3278 ac_cv_x87_double_rounding=yes,
3279 ac_cv_x87_double_rounding=no)])
3280 AC_MSG_RESULT($ac_cv_x87_double_rounding)
3281 if test "$ac_cv_x87_double_rounding" = yes
3283 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3284 [Define if arithmetic is subject to x87-style double rounding issue])
3287 # Multiprocessing check for broken sem_getvalue
3288 AC_MSG_CHECKING(for broken sem_getvalue)
3289 AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
3294 #include <semaphore.h>
3295 #include <sys/stat.h>
3298 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3306 res = sem_getvalue(a, &count);
3308 return res==-1 ? 1 : 0;
3310 ], ac_cv_broken_sem_getvalue=no,
3311 ac_cv_broken_sem_getvalue=yes,
3312 ac_cv_broken_sem_getvalue=yes)
3314 AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
3315 if test $ac_cv_broken_sem_getvalue = yes
3317 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
3318 [define to 1 if your sem_getvalue is broken.])
3321 # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3322 # -0. on some architectures.
3323 AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3324 AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
3329 /* return 0 if either negative zeros don't exist
3330 on this platform or if negative zeros exist
3331 and tanh(-0.) == -0. */
3332 if (atan2(0., -1.) == atan2(-0., -1.) ||
3333 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3337 ac_cv_tanh_preserves_zero_sign=yes,
3338 ac_cv_tanh_preserves_zero_sign=no,
3339 ac_cv_tanh_preserves_zero_sign=no)])
3340 AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3341 if test "$ac_cv_tanh_preserves_zero_sign" = yes
3343 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3344 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3347 AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
3348 AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
3349 AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3353 # determine what size digit to use for Python's longs
3354 AC_MSG_CHECKING([digit size for Python's longs])
3355 AC_ARG_ENABLE(big-digits,
3356 AC_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
3357 [case $enable_big_digits in
3359 enable_big_digits=30 ;;
3361 enable_big_digits=15 ;;
3365 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3367 AC_MSG_RESULT($enable_big_digits)
3368 AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3370 [AC_MSG_RESULT(no value specified)])
3373 AC_CHECK_HEADER(wchar.h, [
3374 AC_DEFINE(HAVE_WCHAR_H, 1,
3375 [Define if the compiler provides a wchar.h header file.])
3381 # determine wchar_t size
3382 if test "$wchar_h" = yes
3384 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
3387 AC_MSG_CHECKING(for UCS-4 tcl)
3391 #if TCL_UTF_MAX != 6
3392 # error "NOT UCS4_TCL"
3394 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3397 AC_MSG_RESULT($have_ucs4_tcl)
3399 # check whether wchar_t is signed or not
3400 if test "$wchar_h" = yes
3402 # check whether wchar_t is signed or not
3403 AC_MSG_CHECKING(whether wchar_t is signed)
3404 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
3409 /* Success: exit code 0 */
3410 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
3413 ac_cv_wchar_t_signed=yes,
3414 ac_cv_wchar_t_signed=no,
3415 ac_cv_wchar_t_signed=yes)])
3416 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3419 AC_MSG_CHECKING(what type to use for unicode)
3420 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
3421 AC_ARG_ENABLE(unicode,
3422 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
3424 [enable_unicode=yes])
3426 if test $enable_unicode = yes
3428 # Without any arguments, Py_UNICODE defaults to two-byte mode
3429 case "$have_ucs4_tcl" in
3430 yes) enable_unicode="ucs4"
3432 *) enable_unicode="ucs2"
3437 AH_TEMPLATE(Py_UNICODE_SIZE,
3438 [Define as the size of the unicode type.])
3439 case "$enable_unicode" in
3440 ucs2) unicode_size="2"
3441 AC_DEFINE(Py_UNICODE_SIZE,2)
3443 ucs4) unicode_size="4"
3444 AC_DEFINE(Py_UNICODE_SIZE,4)
3448 AH_TEMPLATE(PY_UNICODE_TYPE,
3449 [Define as the integral type used for Unicode representation.])
3451 AC_SUBST(UNICODE_OBJS)
3452 if test "$enable_unicode" = "no"
3455 AC_MSG_RESULT(not used)
3457 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
3458 AC_DEFINE(Py_USING_UNICODE, 1,
3459 [Define if you want to have a Unicode type.])
3461 # wchar_t is only usable if it maps to an unsigned type
3462 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
3463 -a "$ac_cv_wchar_t_signed" = "no"
3465 PY_UNICODE_TYPE="wchar_t"
3466 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3467 [Define if you have a useable wchar_t type defined in wchar.h; useable
3468 means wchar_t must be an unsigned type with at least 16 bits. (see
3469 Include/unicodeobject.h).])
3470 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3471 elif test "$ac_cv_sizeof_short" = "$unicode_size"
3473 PY_UNICODE_TYPE="unsigned short"
3474 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3475 elif test "$ac_cv_sizeof_long" = "$unicode_size"
3477 PY_UNICODE_TYPE="unsigned long"
3478 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3480 PY_UNICODE_TYPE="no type found"
3482 AC_MSG_RESULT($PY_UNICODE_TYPE)
3485 # check for endianness
3488 # Check whether right shifting a negative integer extends the sign bit
3489 # or fills with zeros (like the Cray J90, according to Tim Peters).
3490 AC_MSG_CHECKING(whether right shift extends the sign bit)
3491 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
3495 exit(((-1)>>3 == -1) ? 0 : 1);
3498 ac_cv_rshift_extends_sign=yes,
3499 ac_cv_rshift_extends_sign=no,
3500 ac_cv_rshift_extends_sign=yes)])
3501 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
3502 if test "$ac_cv_rshift_extends_sign" = no
3504 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
3505 [Define if i>>j for signed int i does not extend the sign bit
3509 # check for getc_unlocked and related locking functions
3510 AC_MSG_CHECKING(for getc_unlocked() and friends)
3511 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
3512 AC_TRY_LINK([#include <stdio.h>],[
3513 FILE *f = fopen("/dev/null", "r");
3517 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
3518 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
3519 if test "$ac_cv_have_getc_unlocked" = yes
3521 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
3522 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
3525 # check where readline lives
3526 # save the value of LIBS so we don't actually link Python with readline
3527 LIBS_no_readline=$LIBS
3529 # On some systems we need to link readline to a termcap compatible
3530 # library. NOTE: Keep the precedence of listed libraries synchronised
3532 py_cv_lib_readline=no
3533 AC_MSG_CHECKING([how to link readline libs])
3534 for py_libtermcap in "" ncursesw ncurses curses termcap; do
3535 if test -z "$py_libtermcap"; then
3536 READLINE_LIBS="-lreadline"
3538 READLINE_LIBS="-lreadline -l$py_libtermcap"
3540 LIBS="$READLINE_LIBS $LIBS_no_readline"
3542 [AC_LANG_CALL([],[readline])],
3543 [py_cv_lib_readline=yes])
3544 if test $py_cv_lib_readline = yes; then
3548 # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3549 #AC_SUBST([READLINE_LIBS])
3550 if test $py_cv_lib_readline = no; then
3551 AC_MSG_RESULT([none])
3553 AC_MSG_RESULT([$READLINE_LIBS])
3554 AC_DEFINE(HAVE_LIBREADLINE, 1,
3555 [Define if you have the readline library (-lreadline).])
3558 # check for readline 2.1
3559 AC_CHECK_LIB(readline, rl_callback_handler_install,
3560 AC_DEFINE(HAVE_RL_CALLBACK, 1,
3561 [Define if you have readline 2.1]), ,$READLINE_LIBS)
3563 # check for readline 2.2
3564 AC_TRY_CPP([#include <readline/readline.h>],
3565 have_readline=yes, have_readline=no)
3566 if test $have_readline = yes
3568 AC_EGREP_HEADER([extern int rl_completion_append_character;],
3569 [readline/readline.h],
3570 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
3571 [Define if you have readline 2.2]), )
3574 # check for readline 4.0
3575 AC_CHECK_LIB(readline, rl_pre_input_hook,
3576 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
3577 [Define if you have readline 4.0]), ,$READLINE_LIBS)
3580 AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
3581 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
3582 [Define if you have readline 4.0]), ,$READLINE_LIBS)
3584 # check for readline 4.2
3585 AC_CHECK_LIB(readline, rl_completion_matches,
3586 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
3587 [Define if you have readline 4.2]), ,$READLINE_LIBS)
3589 # also in readline 4.2
3590 AC_TRY_CPP([#include <readline/readline.h>],
3591 have_readline=yes, have_readline=no)
3592 if test $have_readline = yes
3594 AC_EGREP_HEADER([extern int rl_catch_signals;],
3595 [readline/readline.h],
3596 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3597 [Define if you can turn off readline's signal handling.]), )
3600 # End of readline checks: restore LIBS
3601 LIBS=$LIBS_no_readline
3603 AC_MSG_CHECKING(for broken nice())
3604 AC_CACHE_VAL(ac_cv_broken_nice, [
3609 if (val1 != -1 && val1 == nice(2))
3614 ac_cv_broken_nice=yes,
3615 ac_cv_broken_nice=no,
3616 ac_cv_broken_nice=no)])
3617 AC_MSG_RESULT($ac_cv_broken_nice)
3618 if test "$ac_cv_broken_nice" = yes
3620 AC_DEFINE(HAVE_BROKEN_NICE, 1,
3621 [Define if nice() returns success/failure instead of the new priority.])
3624 AC_MSG_CHECKING(for broken poll())
3625 AC_CACHE_VAL(ac_cv_broken_poll,
3631 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
3636 poll_test = poll(&poll_struct, 1, 0);
3639 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
3645 ac_cv_broken_poll=yes,
3646 ac_cv_broken_poll=no,
3647 ac_cv_broken_poll=no))
3648 AC_MSG_RESULT($ac_cv_broken_poll)
3649 if test "$ac_cv_broken_poll" = yes
3651 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3652 [Define if poll() sets errno on invalid file descriptors.])
3655 # Before we can test tzset, we need to check if struct tm has a tm_zone
3656 # (which is not required by ISO C or UNIX spec) and/or if we support
3660 # check tzset(3) exists and works like we expect it to
3661 AC_MSG_CHECKING(for working tzset())
3662 AC_CACHE_VAL(ac_cv_working_tzset, [
3669 extern char *tzname[];
3674 /* Note that we need to ensure that not only does tzset(3)
3675 do 'something' with localtime, but it works as documented
3676 in the library reference and as expected by the test suite.
3677 This includes making sure that tzname is set properly if
3678 tm->tm_zone does not exist since it is the alternative way
3679 of getting timezone info.
3681 Red Hat 6.2 doesn't understand the southern hemisphere
3682 after New Year's Day.
3685 time_t groundhogday = 1044144000; /* GMT-based */
3686 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3690 if (localtime(&groundhogday)->tm_hour != 0)
3693 /* For UTC, tzname[1] is sometimes "", sometimes " " */
3694 if (strcmp(tzname[0], "UTC") ||
3695 (tzname[1][0] != 0 && tzname[1][0] != ' '))
3699 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
3701 if (localtime(&groundhogday)->tm_hour != 19)
3704 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
3708 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
3710 if (localtime(&groundhogday)->tm_hour != 11)
3713 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
3717 #if HAVE_STRUCT_TM_TM_ZONE
3718 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
3720 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
3727 ac_cv_working_tzset=yes,
3728 ac_cv_working_tzset=no,
3729 ac_cv_working_tzset=no)])
3730 AC_MSG_RESULT($ac_cv_working_tzset)
3731 if test "$ac_cv_working_tzset" = yes
3733 AC_DEFINE(HAVE_WORKING_TZSET, 1,
3734 [Define if tzset() actually switches the local timezone in a meaningful way.])
3737 # Look for subsecond timestamps in struct stat
3738 AC_MSG_CHECKING(for tv_nsec in struct stat)
3739 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
3740 AC_TRY_COMPILE([#include <sys/stat.h>], [
3742 st.st_mtim.tv_nsec = 1;
3744 ac_cv_stat_tv_nsec=yes,
3745 ac_cv_stat_tv_nsec=no,
3746 ac_cv_stat_tv_nsec=no))
3747 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
3748 if test "$ac_cv_stat_tv_nsec" = yes
3750 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
3751 [Define if you have struct stat.st_mtim.tv_nsec])
3754 # Look for BSD style subsecond timestamps in struct stat
3755 AC_MSG_CHECKING(for tv_nsec2 in struct stat)
3756 AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
3757 AC_TRY_COMPILE([#include <sys/stat.h>], [
3759 st.st_mtimespec.tv_nsec = 1;
3761 ac_cv_stat_tv_nsec2=yes,
3762 ac_cv_stat_tv_nsec2=no,
3763 ac_cv_stat_tv_nsec2=no))
3764 AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
3765 if test "$ac_cv_stat_tv_nsec2" = yes
3767 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
3768 [Define if you have struct stat.st_mtimensec])
3771 # On HP/UX 11.0, mvwdelch is a block with a return statement
3772 AC_MSG_CHECKING(whether mvwdelch is an expression)
3773 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
3774 AC_TRY_COMPILE([#include <curses.h>], [
3776 rtn = mvwdelch(0,0,0);
3777 ], ac_cv_mvwdelch_is_expression=yes,
3778 ac_cv_mvwdelch_is_expression=no,
3779 ac_cv_mvwdelch_is_expression=yes))
3780 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
3782 if test "$ac_cv_mvwdelch_is_expression" = yes
3784 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
3785 [Define if mvwdelch in curses.h is an expression.])
3788 AC_MSG_CHECKING(whether WINDOW has _flags)
3789 AC_CACHE_VAL(ac_cv_window_has_flags,
3790 AC_TRY_COMPILE([#include <curses.h>], [
3793 ], ac_cv_window_has_flags=yes,
3794 ac_cv_window_has_flags=no,
3795 ac_cv_window_has_flags=no))
3796 AC_MSG_RESULT($ac_cv_window_has_flags)
3799 if test "$ac_cv_window_has_flags" = yes
3801 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
3802 [Define if WINDOW in curses.h offers a field _flags.])
3805 AC_MSG_CHECKING(for is_term_resized)
3806 AC_TRY_COMPILE([#include <curses.h>], void *x=is_term_resized,
3807 AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
3812 AC_MSG_CHECKING(for resize_term)
3813 AC_TRY_COMPILE([#include <curses.h>], void *x=resize_term,
3814 AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
3819 AC_MSG_CHECKING(for resizeterm)
3820 AC_TRY_COMPILE([#include <curses.h>], void *x=resizeterm,
3821 AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
3826 AC_MSG_CHECKING(for /dev/ptmx)
3828 if test -r /dev/ptmx
3831 AC_DEFINE(HAVE_DEV_PTMX, 1,
3832 [Define if we have /dev/ptmx.])
3837 AC_MSG_CHECKING(for /dev/ptc)
3842 AC_DEFINE(HAVE_DEV_PTC, 1,
3843 [Define if we have /dev/ptc.])
3848 AC_MSG_CHECKING(for %zd printf() format support)
3849 AC_CACHE_VAL(ac_cv_have_size_t_format,
3855 #ifdef HAVE_SYS_TYPES_H
3856 #include <sys/types.h>
3860 typedef ssize_t Py_ssize_t;
3861 #elif SIZEOF_VOID_P == SIZEOF_LONG
3862 typedef long Py_ssize_t;
3864 typedef int Py_ssize_t;
3871 if(sprintf(buffer, "%zd", (size_t)123) < 0)
3874 if (strcmp(buffer, "123"))
3877 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
3880 if (strcmp(buffer, "-123"))
3885 ]], ac_cv_have_size_t_format=yes,
3886 ac_cv_have_size_t_format=no,
3887 ac_cv_have_size_t_format=no)
3889 AC_MSG_RESULT($ac_cv_have_size_t_format)
3890 if test $ac_cv_have_size_t_format = yes
3892 AC_DEFINE(PY_FORMAT_SIZE_T, "z",
3893 [Define to printf format modifier for Py_ssize_t])
3896 AC_CHECK_TYPE(socklen_t,,
3897 AC_DEFINE(socklen_t,int,
3898 Define to `int' if <sys/socket.h> does not define.),[
3899 #ifdef HAVE_SYS_TYPES_H
3900 #include <sys/types.h>
3902 #ifdef HAVE_SYS_SOCKET_H
3903 #include <sys/socket.h>
3907 AC_SUBST(THREADHEADERS)
3909 for h in `(cd $srcdir;echo Python/thread_*.h)`
3911 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
3915 SRCDIRS="Parser Grammar Objects Python Modules Mac"
3916 AC_MSG_CHECKING(for build directories)
3917 for dir in $SRCDIRS; do
3918 if test ! -d $dir; then
3924 # generate output files
3925 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
3928 echo "creating Modules/Setup"
3929 if test ! -f Modules/Setup
3931 cp $srcdir/Modules/Setup.dist Modules/Setup
3934 echo "creating Modules/Setup.local"
3935 if test ! -f Modules/Setup.local
3937 echo "# Edit this file for local setup changes" >Modules/Setup.local
3940 echo "creating Makefile"
3941 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
3942 -s Modules Modules/Setup.config \
3943 Modules/Setup.local Modules/Setup
3945 case $ac_sys_system in
3949 Support for BeOS is deprecated as of Python 2.6.
3950 See PEP 11 for the gory details.