1 dnl Process this file with autoconf 2.0 or later to make a configure script.
2 AC_REVISION($Revision$)
4 AC_INIT(Include/object.h)
5 AC_CONFIG_HEADER(config.h)
7 # Set VERSION so we only need to edit in one place (i.e., here)
12 if test -f /usr/lib/NextStep/software_version -o -f /System/Library/CoreServices/software_version ; then
14 AC_MSG_CHECKING(for --with-next-archs)
15 AC_ARG_WITH(next-archs,
16 [ --with-next-archs='arch1 arch2 ..' build MAB binary], [
17 if test -n "$withval"; then
18 ac_arch_flags=`/usr/lib/arch_tool -archify_list $withval`
19 # GCC does not currently support multi archs on the NeXT
22 AC_MSG_RESULT($with_next_archs)
23 ], [AC_MSG_RESULT(none: using `arch`)])
27 set X `hostinfo | egrep '(NeXT Mach|Kernel Release).*:' | \
28 sed -e 's/://' -e 's/\./_/'` && \
29 ac_sys_system=next && ac_sys_release=$4
31 MACHDEP="$ac_sys_system$ac_sys_release"
35 AC_ARG_WITH(next-framework,
36 [ --with-next-framework Build (OpenStep|Rhapsody|MacOSX) framework],,)
38 [ --with-dyld Use (OpenStep|Rhapsody|MacOSX) dynamic linker],,)
40 # Set name for machine-dependent library files
42 AC_MSG_CHECKING(MACHDEP)
45 ac_sys_system=`uname -s`
46 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then
47 ac_sys_release=`uname -v`
49 ac_sys_release=`uname -r`
51 ac_md_system=`echo $ac_sys_system |
52 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
53 ac_md_release=`echo $ac_sys_release |
54 tr -d '[/ ]' | sed 's/\..*//'`
55 MACHDEP="$ac_md_system$ac_md_release"
58 '') MACHDEP="unknown";;
63 # SGI compilers allow the specification of the both the ABI and the
64 # ISA on the command line. Depending on the values of these switches,
65 # different and often incompatable code will be generated.
67 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
68 # thus supply support for various ABI/ISA combinations. The MACHDEP
69 # variable is also adjusted.
72 if test ! -z "$SGI_ABI"
75 LDFLAGS="$SGI_ABI $LDFLAGS"
76 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
78 AC_MSG_RESULT($MACHDEP)
81 # CCC is the command that compiles C++ programs
83 # Not all make programs have this predefined.
89 # case $ac_sys_system in
90 # IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";;
91 # Linux*) SET_CCC="CCC= g++";;
95 # SET_CCC="CCC= ${CCC}"
97 #AC_MSG_RESULT($SET_CCC)
100 # checks for alternative programs
101 AC_MSG_CHECKING(for --without-gcc)
102 AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
109 without_gcc=$withval;;
111 case $ac_sys_system in
115 # Dunno if it's a good idea to get this over with all at once, or
116 # to handle it in with the other goodies.
121 CC="mwcc -I$PWD/BeOS -nodup"
124 4.0*) OPT="-DUSE_DL_EXPORT -O7 -opt schedule604 -export pragma" ;;
125 *) OPT="-DUSE_DL_EXPORT -O2 -proc 604e -export pragma" ;;
127 CCSHARED=-UUSE_DL_EXPORT
128 LDFLAGS="$LDFLAGS -nodup"
130 AR="$PWD/BeOS/ar-fake"
133 AC_DEFINE(DL_EXPORT_HEADER,"dl_export.h")
138 OPT="-DUSE_DL_EXPORT -O"
139 CCSHARED=-UUSE_DL_EXPORT
141 AR="$PWD/BeOS/ar-fake"
144 AC_DEFINE(DL_EXPORT_HEADER,"dl_export.h")
147 AC_ERROR(Your BeOS system isn't PowerPC or x86... neat, but this won't work...)
156 AC_MSG_RESULT($without_gcc)
161 AC_MSG_CHECKING(for --with-cxx=<compiler>)
162 AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
172 AC_MSG_RESULT($with_cxx)
175 #AC_MSG_CHECKING(CCC)
178 # case $ac_sys_system in
179 # IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";;
180 # Linux*) SET_CCC="CCC= g++";;
184 # SET_CCC="CCC= ${CCC}"
186 #AC_MSG_RESULT($SET_CCC)
188 # If the user switches compilers, we can't believe the cache
189 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
191 AC_ERROR(cached CC is different -- throw away $cache_file
192 (it is also a good idea to do 'make clean' before compiling))
197 AC_MSG_CHECKING(for --with-suffix)
198 AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
209 gcc) CC="$CC -D_HAVE_BSDI";;
213 case $ac_sys_system in
216 cc|*/cc) CC="$CC -Ae";;
224 cc) CC="$CC -Wl,-Bexport";;
228 # LDLIBRARY is the name of the library to link against (as opposed to the
229 # name of the library into which to insert object files). On systems
230 # without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
232 AC_SUBST(MAKE_LDLIBRARY)
236 # LINKCC is the command that links the python executable -- default is $(CC).
237 # This is altered for AIX and BeOS in order to build the export list before
240 AC_MSG_CHECKING(LINKCC)
241 if test -z "$LINKCC" -a ! -z "$CXX"
247 case $ac_sys_system in
249 LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
251 LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) \$(OPT)"
252 LDLIBRARY='libpython$(VERSION).so';;
254 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
256 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
257 *) LINKCC="\$(PURIFY) \$(CC)";;
260 AC_MSG_RESULT($LINKCC)
262 AC_MSG_CHECKING(LDLIBRARY)
264 # NeXT framework builds require that the 'ar' library be converted into
265 # a bundle using libtool.
266 if test "$with_next_framework"
268 LDLIBRARY='libpython$(VERSION).dylib'
271 # DG/UX requires some fancy ld contortions to produce a .so from an .a
272 if test "$MACHDEP" = "dguxR4"
274 LDLIBRARY='libpython$(VERSION).so'
277 AC_MSG_RESULT($LDLIBRARY)
279 # If LDLIBRARY is different from LIBRARY, emit a rule to build it.
280 if test -z "$LDLIBRARY"
282 LDLIBRARY='libpython$(VERSION).a'
283 MAKE_LDLIBRARY="true"
285 MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)'
290 AC_CHECK_PROGS(AR, ar aal, ar)
292 AC_SUBST(INSTALL_PROGRAM)
293 AC_SUBST(INSTALL_DATA)
294 # Install just never works :-(
295 if test -z "$INSTALL"
301 INSTALL_PROGRAM="$INSTALL"
302 INSTALL_DATA="$INSTALL -m 644"
305 # Not every filesystem supports hard links
307 if test -z "$LN" ; then
308 case $ac_sys_system in
314 # Optimizer/debugger flags passed between Makefiles
320 case $ac_cv_prog_cc_g in
329 # The current (beta) Monterey compiler dies with optimizations
330 case $ac_sys_system in
334 if test "$ac_arch_flags"
336 OPT="$OPT $ac_arch_flags"
338 # checks for UNIX variants that set C preprocessor variables
342 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
343 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
345 CC="$CC -OPT:Olimit=0"
346 AC_TRY_RUN([int main() { return 0; }],
347 ac_cv_opt_olimit_ok=yes,
348 ac_cv_opt_olimit_ok=no)
350 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
351 if test $ac_cv_opt_olimit_ok = yes; then
352 OPT="$OPT -OPT:Olimit=0"
354 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
355 AC_CACHE_VAL(ac_cv_olimit_ok,
357 CC="$CC -Olimit 1500"
358 AC_TRY_RUN([int main() { return 0; }],
362 AC_MSG_RESULT($ac_cv_olimit_ok)
363 if test $ac_cv_olimit_ok = yes; then
364 OPT="$OPT -Olimit 1500"
368 dnl # check for ANSI or K&R ("traditional") preprocessor
369 dnl AC_MSG_CHECKING(for C preprocessor type)
371 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
373 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
374 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
375 dnl AC_MSG_RESULT($cpp_type)
377 # checks for header files
379 AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
380 signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
381 sys/audioio.h sys/file.h sys/lock.h db_185.h db.h \
382 sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \
383 sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
384 ndbm.h db1/ndbm.h gdbm/ndbm.h)
387 # checks for typedefs
389 AC_MSG_CHECKING(for clock_t in time.h)
390 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
391 AC_MSG_RESULT($was_it_defined)
393 # Add some code to confdefs.h so that the test for off_t works on SCO
394 cat >> confdefs.h <<\EOF
400 # Type availability checks
408 # Sizes of various common basic types
410 AC_CHECK_SIZEOF(long)
411 AC_CHECK_SIZEOF(void *)
412 AC_CHECK_SIZEOF(char)
413 AC_CHECK_SIZEOF(short)
414 AC_CHECK_SIZEOF(float)
415 AC_CHECK_SIZEOF(double)
416 AC_CHECK_SIZEOF(fpos_t)
418 AC_MSG_CHECKING(for long long support)
420 AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
421 AC_MSG_RESULT($have_long_long)
422 if test "$have_long_long" = yes ; then
423 AC_CHECK_SIZEOF(long long)
426 AC_MSG_CHECKING(for uintptr_t support)
428 AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
429 AC_MSG_RESULT($have_uintptr_t)
430 if test "$have_uintptr_t" = yes ; then
431 AC_CHECK_SIZEOF(uintptr_t)
434 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
435 AC_MSG_CHECKING(size of off_t)
436 AC_CACHE_VAL(ac_cv_sizeof_off_t,
437 [AC_TRY_RUN([#include <stdio.h>
438 #include <sys/types.h>
441 FILE *f=fopen("conftestval", "w");
443 fprintf(f, "%d\n", sizeof(off_t));
445 }], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
447 AC_MSG_RESULT($ac_cv_sizeof_off_t)
448 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
450 AC_MSG_CHECKING(whether to enable large file support)
451 if test "$have_long_long" = yes -a \
452 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
453 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
454 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
460 # AC_CHECK_SIZEOF() doesn't include <time.h>.
461 AC_MSG_CHECKING(size of time_t)
462 AC_CACHE_VAL(ac_cv_sizeof_time_t,
463 [AC_TRY_RUN([#include <stdio.h>
467 FILE *f=fopen("conftestval", "w");
469 fprintf(f, "%d\n", sizeof(time_t));
471 }], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
473 AC_MSG_RESULT($ac_cv_sizeof_time_t)
474 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
477 # if have pthread_t then define SIZEOF_PTHREAD_T
478 AC_MSG_CHECKING(for pthread_t)
480 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
481 AC_MSG_RESULT($have_pthread_t)
482 if test "$have_pthread_t" = yes ; then
483 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
484 AC_MSG_CHECKING(size of pthread_t)
485 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
486 [AC_TRY_RUN([#include <stdio.h>
490 FILE *f=fopen("conftestval", "w");
492 fprintf(f, "%d\n", sizeof(pthread_t));
494 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
496 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
497 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
501 # Minor variations in building a framework between NextStep versions 4 and 5
502 AC_SUBST(LIBTOOL_CRUFT)
503 case $ac_sys_system/$ac_sys_release in
505 ns_undef_sym='__environ'
506 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
508 ns_undef_sym='_environ'
509 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
512 AC_MSG_CHECKING(for --with-next-framework)
513 if test "$with_next_framework"
515 OPT="$OPT -fno-common"
516 # -U __environ is needed since bundles don't have access
517 # to crt0 when built but will always be linked against it
518 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
519 AC_DEFINE(WITH_NEXT_FRAMEWORK)
525 AC_MSG_CHECKING(for --with-dyld)
526 if test "$with_next_framework" -o "$with_dyld"
532 AC_MSG_RESULT(required for framework build)
540 # Set info about shared libraries.
544 AC_SUBST(LINKFORSHARED)
545 # SO is the extension of shared libraries `(including the dot!)
546 # -- usually .so, .sl on HP-UX
550 case $ac_sys_system in
556 # LDSHARED is the ld *command* used to create shared library
557 # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
558 # (Shared libraries in this instance are shared modules to be loaded into
559 # Python, as opposed to building Python itself as a shared library.)
560 AC_MSG_CHECKING(LDSHARED)
561 if test -z "$LDSHARED"
563 case $ac_sys_system/$ac_sys_release in
564 AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
565 BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";;
566 IRIX/5*) LDSHARED="ld -shared";;
567 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
568 SunOS/4*) LDSHARED="ld";;
570 if test "$GCC" = "yes"
571 then LDSHARED='$(CC) -G'
572 else LDSHARED="ld -G";
574 hp*|HP*) LDSHARED="ld -b";;
575 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
576 DYNIX/ptx*) LDSHARED="ld -G";;
579 then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
580 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
582 if test "$with_next_framework" ; then
583 LDSHARED="$LDSHARED \$(LDLIBRARY)"
585 Linux*) LDSHARED="gcc -shared";;
586 dgux*) LDSHARED="ld -G";;
587 BSD/OS*/4*) LDSHARED="gcc -shared";;
588 OpenBSD*) LDSHARED="ld -Bshareable";;
590 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
592 LDSHARED="cc -shared"
594 LDSHARED="ld -Bshareable"
597 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
599 LDSHARED="cc -shared ${LDFLAGS}"
601 LDSHARED="ld -Bshareable ${LDFLAGS}"
603 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
604 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
608 AC_MSG_RESULT($LDSHARED)
609 # CCSHARED are the C *flags* used to create objects to go into a shared
610 # library (module) -- this is only needed for a few systems
611 AC_MSG_CHECKING(CCSHARED)
612 if test -z "$CCSHARED"
614 case $ac_sys_system/$ac_sys_release in
615 hp*|HP*) if test "$GCC" = yes;
616 then CCSHARED="-fpic";
619 Linux*) CCSHARED="-fpic";;
620 BSD/OS*/4*) CCSHARED="-fpic";;
621 OpenBSD*) CCSHARED="-fpic";;
622 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
623 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
624 Monterey*) CCSHARED="-G";;
625 IRIX*/6*) case $CC in
626 *gcc*) CCSHARED="-shared";;
631 AC_MSG_RESULT($CCSHARED)
632 # LINKFORSHARED are the flags passed to the $(CC) command that links
633 # the python executable -- this is only needed for a few systems
634 AC_MSG_CHECKING(LINKFORSHARED)
635 if test -z "$LINKFORSHARED"
637 case $ac_sys_system/$ac_sys_release in
638 AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';;
640 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
641 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
642 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
643 # -u libsys_s pulls in all symbols in libsys
644 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
645 # -u __dummy makes the linker aware of the objc runtime
646 # in System.framework; otherwise, __objcInit (referenced in
647 # crt1.o) gets erroneously defined as common, which breaks dynamic
648 # loading of any modules which reference it in System.framework
649 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
650 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
651 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
653 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
655 LINKFORSHARED="-Wl,--export-dynamic"
657 SunOS/5*) case $CC in
659 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
661 LINKFORSHARED="-Xlinker --export-dynamic"
666 AC_MSG_RESULT($LINKFORSHARED)
668 # checks for libraries
669 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
670 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
672 # Check for --with-pydebug
673 AC_MSG_CHECKING(for --with-pydebug)
675 [ --with-pydebug build with Py_DEBUG defined], [
676 if test "$withval" != no
677 then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes)
678 else AC_MSG_RESULT(no)
682 # checks for system dependent C++ extensions support
683 case "$ac_sys_system" in
684 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
685 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
686 [loadAndInit("", 0, "")],
687 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
689 [AC_MSG_RESULT(no)]);;
693 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
694 # However on SGI IRIX, these exist but are broken.
695 # BeOS' sockets are stashed in libnet.
696 case "$ac_sys_system" in
699 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
700 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
703 case "$ac_sys_system" in
705 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
709 AC_MSG_CHECKING(for --with-libs)
711 [ --with-libs='lib1 ...' link against additional libs], [
712 AC_MSG_RESULT($withval)
713 LIBS="$withval $LIBS"
714 ], AC_MSG_RESULT(no))
716 AC_SUBST(USE_THREAD_MODULE)
719 AC_MSG_CHECKING(for --with-dec-threads)
721 AC_ARG_WITH(dec-threads,
722 [ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
723 AC_MSG_RESULT($withval)
725 if test "${with_thread+set}" != set; then
726 with_thread="$withval";
730 AC_MSG_CHECKING(for --with-threads)
732 [ --with(out)-threads[=DIRECTORY] disable/enable thread support])
734 # --with-thread is deprecated, but check for it anyway
736 [ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
737 with_threads=$with_thread])
739 if test -z "$with_threads"
740 then with_threads="yes"
742 AC_MSG_RESULT($with_threads)
744 if test "$with_threads" = "no"
746 USE_THREAD_MODULE="#"
748 if test -d "$with_threads"
749 then LDFLAGS="$LDFLAGS -L$with_threads"
751 if test -d "$withval"
752 then LDFLAGS="$LDFLAGS -L$withval"
754 AC_DEFINE(_REENTRANT)
755 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
757 LIBOBJS="$LIBOBJS thread.o"],[
758 AC_MSG_CHECKING(for --with-pth)
760 [ --with-pth use GNU pth threading libraries], [
761 AC_MSG_RESULT($withval)
762 AC_DEFINE(WITH_THREAD)
765 LIBOBJS="$LIBOBJS thread.o"],[
767 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
768 AC_DEFINE(_POSIX_THREADS)
769 LIBS="-lpthread $LIBS"
770 LIBOBJS="$LIBOBJS thread.o"],[
771 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
772 AC_DEFINE(_POSIX_THREADS)
773 LIBOBJS="$LIBOBJS thread.o"],[
774 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
775 AC_DEFINE(BEOS_THREADS)
776 LIBOBJS="$LIBOBJS thread.o"],[
777 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
778 AC_DEFINE(_POSIX_THREADS)
779 LIBS="$LIBS -lpthreads"
780 LIBOBJS="$LIBOBJS thread.o"], [
781 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
782 AC_DEFINE(_POSIX_THREADS)
784 LIBOBJS="$LIBOBJS thread.o"], [
785 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
786 AC_DEFINE(_POSIX_THREADS)
787 LIBS="$LIBS -lthread"
788 LIBOBJS="$LIBOBJS thread.o"], [
789 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
790 AC_DEFINE(_POSIX_THREADS)
792 LIBOBJS="$LIBOBJS thread.o"],[
793 USE_THREAD_MODULE="#"])
796 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
798 LIBOBJS="$LIBOBJS thread.o"
799 USE_THREAD_MODULE=""])
800 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
801 LIBS="$LIBS -lthread"
802 LIBOBJS="$LIBOBJS thread.o"
803 USE_THREAD_MODULE=""])
806 # Check for GC support
807 AC_SUBST(USE_GC_MODULE)
809 AC_MSG_CHECKING(for --with-cycle-gc)
810 AC_ARG_WITH(cycle-gc,
811 [ --with(out)-cycle-gc disable/enable garbage collection])
813 if test -z "$with_cycle_gc"
814 then with_cycle_gc="yes"
816 if test "$with_cycle_gc" = "no"
820 AC_DEFINE(WITH_CYCLE_GC)
822 AC_MSG_RESULT($with_cycle_gc)
824 # Check for LIBDB support
825 # either --with-libdb or, in its absence, the presence of db.h
826 AC_SUBST(USE_BSDDB_MODULE)
828 AC_MSG_CHECKING(for --with-libdb)
830 [ --with(out)-libdb disable/enable bsddb module])
832 # enabled by default, but db.h must be found
833 if test "$ac_cv_header_db_h" = "yes"
835 if test "$with_libdb" != "no"
836 then with_libdb="yes"
839 # make sure user knows why bsddb support wasn't enabled event
840 # though s/he requested it
841 if test "$with_libdb" = "yes"
842 then echo $ac_n "(requested, but db.h was not found) $ac_c"
847 if test "$with_libdb" = "no"
851 AC_DEFINE(WITH_LIBDB)
853 AC_MSG_RESULT($with_libdb)
855 if test "$with_libdb" = "yes"
857 # check for libdb; BSD systems have the DB routines in libc --tg
859 # If dbopen is not in libc, then checking whether it is in libdb
860 # is difficult: db_185.h may #define it as __db185_open
861 # Instead, we just trust it is in libdb; linking will fail if it
863 AC_CHECK_FUNC(dbopen, [HAVE_LIBDB=], [HAVE_LIBDB=-ldb])
866 # Check for --with-wctype-functions
867 AC_MSG_CHECKING(for --with-wctype-functions)
868 AC_ARG_WITH(wctype-functions,
869 [ --with-wctype-functions use wctype.h functions], [
870 if test "$withval" != no
871 then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
872 else AC_MSG_RESULT(no)
876 # -I${DLINCLDIR} is added to the compile rule for importdl.o
880 AC_MSG_CHECKING(for --with-sgi-dl)
882 [ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
883 AC_MSG_RESULT($withval)
884 AC_DEFINE(WITH_SGI_DL)
885 DYNLOADFILE="dynload_dl.o"
888 then LDFLAGS="$LDFLAGS -L$dldir"
889 else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
892 LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
894 AC_MSG_CHECKING(for --with-dl-dld)
895 AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
896 AC_MSG_RESULT($withval)
897 AC_DEFINE(WITH_DL_DLD)
898 DYNLOADFILE="dynload_dl.o"
899 dldir=`echo "$withval" | sed 's/,.*//'`
900 dlddir=`echo "$withval" | sed 's/.*,//'`
901 if test -d "$dldir" -a -d "$dlddir"
902 then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
903 else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
906 LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
908 # the dlopen() function means we might want to use dynload_shlib.o. some
909 # platforms, such as AIX, have dlopen(), but don't want to use it.
910 AC_CHECK_FUNCS(dlopen)
912 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
913 # loading of modules.
914 AC_SUBST(DYNLOADFILE)
915 AC_MSG_CHECKING(DYNLOADFILE)
916 if test -z "$DYNLOADFILE"
918 case $ac_sys_system/$ac_sys_release in
919 AIX*) DYNLOADFILE="dynload_aix.o";;
920 BeOS*) DYNLOADFILE="dynload_beos.o";;
921 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
922 next/*) DYNLOADFILE="dynload_next.o";;
924 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
925 # out any dynamic loading
926 if test "$ac_cv_func_dlopen" = yes
927 then DYNLOADFILE="dynload_shlib.o"
928 else DYNLOADFILE="dynload_stub.o"
933 AC_MSG_RESULT($DYNLOADFILE)
934 if test "$DYNLOADFILE" != "dynload_stub.o"
936 AC_DEFINE(HAVE_DYNAMIC_LOADING)
939 # checks for library functions
940 AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
941 flock fork fsync fdatasync fpathconf ftime ftruncate \
942 getgroups getlogin getpeername getpid getpwent getwd \
943 kill link lstat mkfifo mktime mremap \
944 nice pathconf pause plock poll pthread_init \
946 select setegid seteuid setgid \
947 setlocale setregid setreuid setsid setpgid setuid setvbuf \
948 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
949 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
950 truncate uname waitpid _getpty)
952 # check for openpty and forkpty
954 AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
955 AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
957 # check for long file support functions
958 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
960 AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
961 AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
962 AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
963 AC_CHECK_FUNCS(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
965 # checks for structures
970 AC_MSG_CHECKING(for time.h that defines altzone)
971 AC_CACHE_VAL(ac_cv_header_time_altzone,
972 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
973 ac_cv_header_time_altzone=yes,
974 ac_cv_header_time_altzone=no)])
975 AC_MSG_RESULT($ac_cv_header_time_altzone)
976 if test $ac_cv_header_time_altzone = yes; then
977 AC_DEFINE(HAVE_ALTZONE)
981 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
983 #include <sys/types.h>
984 #include <sys/select.h>
985 #include <sys/time.h>
986 ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
987 AC_MSG_RESULT($was_it_defined)
989 # checks for compiler characteristics
996 AC_MSG_CHECKING(for working volatile)
997 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
998 AC_MSG_RESULT($works)
1001 AC_MSG_CHECKING(for working signed char)
1002 AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1003 AC_MSG_RESULT($works)
1006 AC_MSG_CHECKING(for prototypes)
1007 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1008 AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
1009 AC_MSG_RESULT($have_prototypes)
1012 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
1015 int foo(int x, ...) {
1023 ], [return foo(10, "", 3.14);],
1024 AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1025 AC_MSG_RESULT($works)
1027 if test "$have_prototypes" = yes; then
1029 AC_MSG_CHECKING(for bad exec* prototypes)
1030 AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1031 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1032 AC_MSG_RESULT($bad_prototypes)
1036 AC_MSG_CHECKING(for bad static forward)
1038 struct s { int a; int b; };
1039 static struct s foo;
1042 random = (int) &foo;
1045 static struct s foo = { 1, 2 };
1047 exit(!((int)&foo == foobar()));
1049 ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
1050 AC_MSG_RESULT($bad_forward)
1053 AC_MSG_CHECKING(whether va_list is an array)
1055 #ifdef HAVE_STDARG_PROTOTYPES
1058 #include <varargs.h>
1060 ], [va_list list1, list2; list1 = list2;], ,
1061 AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1062 AC_MSG_RESULT($va_list_is_array)
1064 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1065 AC_CHECK_FUNC(gethostbyname_r, [
1066 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1067 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1069 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1074 struct hostent *he, *res;
1079 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1081 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1082 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1086 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1096 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1098 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1099 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1103 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1109 struct hostent_data data;
1111 (void) gethostbyname_r(name, he, &data);
1113 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1114 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1123 AC_CHECK_FUNCS(gethostbyname)
1125 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1126 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1127 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
1128 AC_SUBST(HAVE_GETHOSTBYNAME_R)
1129 AC_SUBST(HAVE_GETHOSTBYNAME)
1131 # checks for system services
1134 # Linux requires this for correct f.p. operations
1135 AC_CHECK_FUNC(__fpu_control,
1137 [AC_CHECK_LIB(ieee, __fpu_control)
1140 # Check for --with-fpectl
1141 AC_MSG_CHECKING(for --with-fpectl)
1143 [ --with-fpectl enable SIGFPE catching], [
1144 if test "$withval" != no
1145 then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1146 else AC_MSG_RESULT(no)
1148 [AC_MSG_RESULT(no)])
1150 # check for --with-libm=...
1152 case $ac_sys_system in
1157 AC_MSG_CHECKING(for --with-libm=STRING)
1158 AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
1159 if test "$withval" = no
1161 AC_MSG_RESULT(force LIBM empty)
1162 elif test "$withval" != yes
1164 AC_MSG_RESULT(set LIBM=\"$withval\")
1165 else AC_ERROR(proper usage is --with-libm=STRING)
1167 [AC_MSG_RESULT(default LIBM=\"$LIBM\")])
1169 # check for --with-libc=...
1171 AC_MSG_CHECKING(for --with-libc=STRING)
1172 AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
1173 if test "$withval" = no
1175 AC_MSG_RESULT(force LIBC empty)
1176 elif test "$withval" != yes
1178 AC_MSG_RESULT(set LIBC=\"$withval\")
1179 else AC_ERROR(proper usage is --with-libc=STRING)
1181 [AC_MSG_RESULT(default LIBC=\"$LIBC\")])
1183 # check for hypot() in math library
1186 AC_REPLACE_FUNCS(hypot)
1190 AC_MSG_CHECKING(for genuine getopt)
1191 AC_CACHE_VAL(ac_cv_func_getopt,
1192 [AC_TRY_RUN([#include <stdio.h>
1193 extern int optind, opterr, getopt();
1194 extern char* optarg;
1196 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
1198 if (getopt(3, av, "f:") == 'f') { exit(1); }
1200 }], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
1201 AC_MSG_RESULT($ac_cv_func_getopt)
1202 test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
1203 AC_SUBST(LIBOBJS)dnl
1205 # check whether malloc(0) returns NULL or not
1206 AC_MSG_CHECKING(what malloc(0) returns)
1207 AC_CACHE_VAL(ac_cv_malloc_zero,
1208 [AC_TRY_RUN([#include <stdio.h>
1212 char *malloc(), *realloc();
1218 if (p == NULL) exit(1);
1220 if (p == NULL) exit(1);
1223 }], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1224 AC_MSG_RESULT($ac_cv_malloc_zero)
1225 if test "$ac_cv_malloc_zero" = null
1227 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1231 AC_CHECK_HEADER(wchar.h,
1232 AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1236 # check for usable wchar_t
1237 usable_wchar_t="unkown"
1238 AC_MSG_CHECKING(for usable wchar_t)
1250 AC_DEFINE(HAVE_USABLE_WCHAR_T) usable_wchar_t="yes",
1251 usable_wchar_t="no")
1252 AC_MSG_RESULT($usable_wchar_t)
1254 # check for endianness
1257 # Check whether right shifting a negative integer extends the sign bit
1258 # or fills with zeros (like the Cray J90, according to Tim Peters).
1259 AC_MSG_CHECKING(whether right shift extends the sign bit)
1260 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
1264 exit(((-1)>>3 == -1) ? 0 : 1);
1266 ], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1267 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1268 if test "$ac_cv_rshift_extends_sign" = no
1270 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1274 # THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1275 # Add sys/socket.h to confdefs.h
1276 cat >> confdefs.h <<\EOF
1277 #ifdef HAVE_SYS_SOCKET_H
1278 #include <sys/socket.h>
1281 AC_CHECK_TYPE(socklen_t, int)
1283 # generate output files
1284 AC_OUTPUT(Makefile \
1289 Modules/Makefile.pre \
1290 Modules/Setup.config)