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|MacOS10) framework],,)
38 [--with-dyld Use (OpenStep|Rhapsody|MacOS10) 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" ; 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 -O3 -mpentiumpro"
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...)
153 AC_MSG_RESULT($without_gcc)
158 AC_MSG_CHECKING(for --with-cxx=<compiler>)
159 AC_ARG_WITH(cxx, [--with-cxx=<compiler> enable C++ support],[
169 AC_MSG_RESULT($with_cxx)
172 #AC_MSG_CHECKING(CCC)
175 # case $ac_sys_system in
176 # IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";;
177 # Linux*) SET_CCC="CCC= g++";;
181 # SET_CCC="CCC= ${CCC}"
183 #AC_MSG_RESULT($SET_CCC)
185 # If the user switches compilers, we can't believe the cache
186 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
188 AC_ERROR(cached CC is different -- throw away $cache_file
189 (it is also a good idea to do 'make clean' before compiling))
197 gcc) CC="$CC -D_HAVE_BSDI";;
201 case $ac_sys_system in
204 cc|*/cc) CC="$CC -Aa -D_HPUX_SOURCE";;
212 # LDLIBRARY is the name of the library to link against (as opposed to the
213 # name of the library into which to insert object files). On systems
214 # without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
216 AC_SUBST(MAKE_LDLIBRARY)
220 # LINKCC is the command that links the python executable -- default is $(CC).
221 # This is altered for AIX and BeOS in order to build the export list before
224 AC_MSG_CHECKING(LINKCC)
225 if test -z "$LINKCC" -a ! -z "$CXX"
231 case $ac_sys_system in
233 LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
235 LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) \$(OPT)"
236 LDLIBRARY='libpython$(VERSION).so';;
238 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
239 *) LINKCC="\$(PURIFY) \$(CC)";;
242 AC_MSG_RESULT($LINKCC)
244 AC_MSG_CHECKING(LDLIBRARY)
246 # NeXT framework builds require that the 'ar' library be converted into
247 # a bundle using libtool.
248 if test "$with_next_framework"
250 LDLIBRARY='libpython$(VERSION).dylib'
253 # DG/UX requires some fancy ld contortions to produce a .so from an .a
254 if test "$MACHDEP" = "dguxR4"
256 LDLIBRARY='libpython$(VERSION).so'
259 AC_MSG_RESULT($LDLIBRARY)
261 # If LDLIBRARY is different from LIBRARY, emit a rule to build it.
262 if test -z "$LDLIBRARY"
264 LDLIBRARY='libpython$(VERSION).a'
265 MAKE_LDLIBRARY="true"
267 MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)'
272 AC_CHECK_PROGS(AR, ar aal, ar)
274 AC_SUBST(INSTALL_PROGRAM)
275 AC_SUBST(INSTALL_DATA)
276 # Install just never works :-(
277 if test -z "$INSTALL"
283 INSTALL_PROGRAM="$INSTALL"
284 INSTALL_DATA="$INSTALL -m 644"
287 # Not every filesystem supports hard links
289 if test -z "$LN" ; then
290 case $ac_sys_system in
296 # Optimizer/debugger flags passed between Makefiles
302 case $ac_cv_prog_cc_g in
311 if test "$ac_arch_flags"
313 OPT="$OPT $ac_arch_flags"
315 # checks for UNIX variants that set C preprocessor variables
319 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
320 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
322 CC="$CC -OPT:Olimit=0"
323 AC_TRY_RUN([int main() { return 0; }],
324 ac_cv_opt_olimit_ok=yes,
325 ac_cv_opt_olimit_ok=no)
327 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
328 if test $ac_cv_opt_olimit_ok = yes; then
329 OPT="$OPT -OPT:Olimit=0"
331 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
332 AC_CACHE_VAL(ac_cv_olimit_ok,
334 CC="$CC -Olimit 1500"
335 AC_TRY_RUN([int main() { return 0; }],
339 AC_MSG_RESULT($ac_cv_olimit_ok)
340 if test $ac_cv_olimit_ok = yes; then
341 OPT="$OPT -Olimit 1500"
345 # check for ANSI or K&R ("traditional") preprocessor
346 AC_MSG_CHECKING(for C preprocessor type)
348 #define spam(name, doc) {#name, &name, #name "() -- " doc}
350 struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
351 ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
352 AC_MSG_RESULT($cpp_type)
354 # checks for header files
356 AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h pthread.h \
357 signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
358 sys/audioio.h sys/file.h sys/lock.h \
359 sys/param.h sys/select.h sys/time.h sys/times.h \
360 sys/un.h sys/utsname.h sys/wait.h)
363 # checks for typedefs
365 AC_MSG_CHECKING(for clock_t in time.h)
366 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
367 AC_MSG_RESULT($was_it_defined)
369 # Add some code to confdefs.h so that the test for off_t works on SCO
370 cat >> confdefs.h <<\EOF
384 AC_CHECK_SIZEOF(long)
385 AC_CHECK_SIZEOF(void *)
387 AC_MSG_CHECKING(for long long support)
389 AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
390 AC_MSG_RESULT($have_long_long)
391 if test "$have_long_long" = yes ; then
392 AC_CHECK_SIZEOF(long long)
395 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
396 AC_MSG_CHECKING(size of off_t)
397 AC_CACHE_VAL(ac_cv_sizeof_off_t,
398 [AC_TRY_RUN([#include <stdio.h>
399 #include <sys/types.h>
402 FILE *f=fopen("conftestval", "w");
404 fprintf(f, "%d\n", sizeof(off_t));
406 }], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
408 AC_MSG_RESULT($ac_cv_sizeof_off_t)
409 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
411 AC_MSG_CHECKING(whether to enable large file support)
412 if test "$have_long_long" = yes -a \
413 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
414 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
415 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
422 # Minor variations in building a framework between NextStep versions 4 and 5
423 AC_SUBST(LIBTOOL_CRUFT)
424 case $ac_sys_system/$ac_sys_release in
426 ns_undef_sym='__environ'
427 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
429 ns_undef_sym='_environ'
430 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
433 AC_MSG_CHECKING(for --with-next-framework)
434 if test "$with_next_framework"
436 OPT="$OPT -fno-common"
437 # -U __environ is needed since bundles don't have access
438 # to crt0 when built but will always be linked against it
439 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
440 AC_DEFINE(WITH_NEXT_FRAMEWORK)
446 AC_MSG_CHECKING(for --with-dyld)
447 if test "$with_next_framework" -o "$with_dyld"
453 AC_MSG_RESULT(required for framework build)
461 # Set info about shared libraries.
465 AC_SUBST(LINKFORSHARED)
466 # SO is the extension of shared libraries `(including the dot!)
467 # -- usually .so, .sl on HP-UX
471 case $ac_sys_system in
477 # LDSHARED is the ld *command* used to create shared library
478 # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
479 # (Shared libraries in this instance are shared modules to be loaded into
480 # Python, as opposed to building Python itself as a shared library.)
481 AC_MSG_CHECKING(LDSHARED)
482 if test -z "$LDSHARED"
484 case $ac_sys_system/$ac_sys_release in
485 AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
486 BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";;
487 IRIX/5*) LDSHARED="ld -shared";;
488 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
489 SunOS/4*) LDSHARED="ld";;
490 SunOS/5*) LDSHARED="ld -G";;
491 hp*|HP*) LDSHARED="ld -b";;
492 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
493 DYNIX/ptx*) LDSHARED="ld -G";;
496 then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
497 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
499 if test "$with_next_framework" ; then
500 LDSHARED="$LDSHARED \$(LDLIBRARY)"
502 Linux*) LDSHARED="gcc -shared";;
503 dgux*) LDSHARED="ld -G";;
504 BSD/OS*/4*) LDSHARED="gcc -shared";;
505 FreeBSD*/[[34]]*) LDSHARED="gcc -shared";;
506 FreeBSD*|OpenBSD*) LDSHARED="ld -Bshareable";;
508 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
510 LDSHARED="cc -shared"
512 LDSHARED="ld -Bshareable"
514 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
518 AC_MSG_RESULT($LDSHARED)
519 # CCSHARED are the C *flags* used to create objects to go into a shared
520 # library (module) -- this is only needed for a few systems
521 AC_MSG_CHECKING(CCSHARED)
522 if test -z "$CCSHARED"
524 case $ac_sys_system/$ac_sys_release in
525 hp*|HP*) if test "$GCC" = yes;
526 then CCSHARED="-fpic";
529 Linux*) CCSHARED="-fpic";;
530 BSD/OS*/4*) CCSHARED="-fpic";;
531 FreeBSD*|OpenBSD*) CCSHARED="-fpic";;
532 NetBSD*) CCSHARED="-fPIC";;
533 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
534 IRIX*/6*) case $CC in
535 *gcc*) CCSHARED="-shared";;
540 AC_MSG_RESULT($CCSHARED)
541 # LINKFORSHARED are the flags passed to the $(CC) command that links
542 # the python executable -- this is only needed for a few systems
543 AC_MSG_CHECKING(LINKFORSHARED)
544 if test -z "$LINKFORSHARED"
546 case $ac_sys_system/$ac_sys_release in
547 AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';;
549 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
550 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
551 FreeBSD/[[34]]*) LINKFORSHARED="-Xlinker -export-dynamic";;
552 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
553 # -u libsys_s pulls in all symbols in libsys
554 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
555 # -u __dummy makes the linker aware of the objc runtime
556 # in System.framework; otherwise, __objcInit (referenced in
557 # crt1.o) gets erroneously defined as common, which breaks dynamic
558 # loading of any modules which reference it in System.framework
559 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
560 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
562 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
564 LINKFORSHARED="-Wl,--export-dynamic"
566 SunOS/5*) case $CC in
568 if $CC -Xlinker -V 2>/dev/null | grep BFD >/dev/null
570 LINKFORSHARED="-Xlinker --export-dynamic"
575 AC_MSG_RESULT($LINKFORSHARED)
577 # checks for libraries
578 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
579 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
581 # checks for system dependent C++ extensions support
582 case "$ac_sys_system" in
583 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
584 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
585 [loadAndInit("", 0, "")],
586 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
588 [AC_MSG_RESULT(no)]);;
592 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
593 # However on SGI IRIX, these exist but are broken.
594 # BeOS' sockets are stashed in libnet.
595 case "$ac_sys_system" in
598 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
599 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
600 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
604 AC_MSG_CHECKING(for --with-libs)
605 AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [
606 AC_MSG_RESULT($withval)
607 LIBS="$withval $LIBS"
608 ], AC_MSG_RESULT(no))
610 AC_MSG_CHECKING(for --with(out)-readline)
611 AC_ARG_WITH(readline,
612 [--with(out)-readline obsolete, edit Modules/Setup instead],
613 [AC_MSG_RESULT($withval)
614 AC_ERROR(--with(out)-readline is obsolete, edit Modules/Setup instead)],
615 [AC_MSG_RESULT(not specified.)])
617 AC_SUBST(USE_THREAD_MODULE)
618 USE_THREAD_MODULE="#"
620 AC_MSG_CHECKING(for --with-dec-threads)
622 AC_ARG_WITH(dec-threads,
623 [--with-dec-threads use DEC Alpha/OSF1 thread-safe libraries],
624 [AC_MSG_RESULT($withval)
626 if test "${with_thread+set}" != set; then
627 with_thread="$withval";
631 AC_MSG_CHECKING(for --with-threads)
632 AC_ARG_WITH(threads, [--with-threads alias for --with-thread],
633 [AC_MSG_RESULT($withval)
634 if test "${with_thread+set}" != set; then
635 with_thread="$withval";
639 AC_MSG_CHECKING(for --with-thread)
640 AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
642 AC_MSG_RESULT($withval)
643 if test -d "$withval"
644 then LDFLAGS="$LDFLAGS -L$withval"
646 AC_DEFINE(_REENTRANT)
647 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
649 LIBOBJS="$LIBOBJS thread.o"],[
650 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
651 AC_DEFINE(_POSIX_THREADS)
652 LIBOBJS="$LIBOBJS thread.o"],[
653 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
654 AC_DEFINE(BEOS_THREADS)
655 LIBOBJS="$LIBOBJS thread.o"],[
656 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
657 AC_DEFINE(_POSIX_THREADS)
658 LIBS="$LIBS -lpthreads"
659 LIBOBJS="$LIBOBJS thread.o"], [
660 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
661 AC_DEFINE(_POSIX_THREADS)
662 LIBS="$LIBS -lpthread"
663 LIBOBJS="$LIBOBJS thread.o"], [
664 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
665 AC_DEFINE(_POSIX_THREADS)
667 LIBOBJS="$LIBOBJS thread.o"], [
668 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
669 AC_DEFINE(_POSIX_THREADS)
670 LIBS="$LIBS -lthread"
671 LIBOBJS="$LIBOBJS thread.o"], [
672 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
673 AC_DEFINE(_POSIX_THREADS)
675 LIBOBJS="$LIBOBJS thread.o"])
678 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
680 LIBOBJS="$LIBOBJS thread.o"])
681 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
682 LIBS="$LIBS -lthread"
683 LIBOBJS="$LIBOBJS thread.o"])
684 ], AC_MSG_RESULT(no))
686 # -I${DLINCLDIR} is added to the compile rule for importdl.o
690 AC_MSG_CHECKING(for --with-sgi-dl)
691 AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
692 AC_MSG_RESULT($withval)
693 AC_DEFINE(WITH_SGI_DL)
694 DYNLOADFILE="dynload_dl.o"
697 then LDFLAGS="$LDFLAGS -L$dldir"
698 else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
701 LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
703 AC_MSG_CHECKING(for --with-dl-dld)
704 AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
705 AC_MSG_RESULT($withval)
706 AC_DEFINE(WITH_DL_DLD)
707 DYNLOADFILE="dynload_dl.o"
708 dldir=`echo "$withval" | sed 's/,.*//'`
709 dlddir=`echo "$withval" | sed 's/.*,//'`
710 if test -d "$dldir" -a -d "$dlddir"
711 then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
712 else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
715 LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
717 # the dlopen() function means we might want to use dynload_shlib.o. some
718 # platforms, such as AIX, have dlopen(), but don't want to use it.
719 AC_CHECK_FUNC(dlopen)
721 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
722 # loading of modules.
723 AC_SUBST(DYNLOADFILE)
724 AC_MSG_CHECKING(DYNLOADFILE)
725 if test -z "$DYNLOADFILE"
727 case $ac_sys_system/$ac_sys_release in
728 AIX*) DYNLOADFILE="dynload_aix.o";;
729 BeOS*) DYNLOADFILE="dynload_beos.o";;
730 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
731 next/*) DYNLOADFILE="dynload_next.o";;
733 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
734 # out any dynamic loading
735 if test "$ac_cv_func_dlopen" = yes
736 then DYNLOADFILE="dynload_shlib.o"
737 else DYNLOADFILE="dynload_stub.o"
742 AC_MSG_RESULT($DYNLOADFILE)
743 if test "$DYNLOADFILE" != "dynload_stub.o"
745 AC_DEFINE(HAVE_DYNAMIC_LOADING)
748 # checks for library functions
749 AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \
750 flock fork fsync fdatasync fpathconf ftime ftruncate \
751 getgroups getlogin getpeername getpgrp getpid getpwent gettimeofday getwd \
752 kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \
754 select setgid setlocale setuid setsid setpgid setpgrp setvbuf \
755 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
756 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
757 truncate uname waitpid)
759 # check for long file support functions
760 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
762 AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
763 AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
764 AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
765 AC_CHECK_FUNC(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
767 # checks for structures
772 AC_MSG_CHECKING(for time.h that defines altzone)
773 AC_CACHE_VAL(ac_cv_header_time_altzone,
774 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
775 ac_cv_header_time_altzone=yes,
776 ac_cv_header_time_altzone=no)])
777 AC_MSG_RESULT($ac_cv_header_time_altzone)
778 if test $ac_cv_header_time_altzone = yes; then
779 AC_DEFINE(HAVE_ALTZONE)
783 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
785 #include <sys/types.h>
786 #include <sys/select.h>
787 #include <sys/time.h>
788 ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
789 AC_MSG_RESULT($was_it_defined)
791 # checks for compiler characteristics
798 AC_MSG_CHECKING(for working volatile)
799 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
800 AC_MSG_RESULT($works)
803 AC_MSG_CHECKING(for working signed char)
804 AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
805 AC_MSG_RESULT($works)
808 AC_MSG_CHECKING(for prototypes)
809 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
810 AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
811 AC_MSG_RESULT($have_prototypes)
814 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
817 int foo(int x, ...) {
825 ], [return foo(10, "", 3.14);],
826 AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
827 AC_MSG_RESULT($works)
829 if test "$have_prototypes" = yes; then
831 AC_MSG_CHECKING(for bad exec* prototypes)
832 AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
833 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
834 AC_MSG_RESULT($bad_prototypes)
838 AC_MSG_CHECKING(for bad static forward)
840 struct s { int a; int b; };
847 static struct s foo = { 1, 2 };
849 exit(!((int)&foo == foobar()));
851 ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
852 AC_MSG_RESULT($bad_forward)
855 AC_MSG_CHECKING(whether va_list is an array)
857 #ifdef HAVE_STDARG_PROTOTYPES
862 ], [va_list list1, list2; list1 = list2;], ,
863 AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
864 AC_MSG_RESULT($va_list_is_array)
866 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
867 AC_CHECK_FUNC(gethostbyname_r, [
868 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
869 AC_MSG_CHECKING([gethostbyname_r with 6 args])
871 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
876 struct hostent *he, *res;
881 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
883 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
884 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
888 AC_MSG_CHECKING([gethostbyname_r with 5 args])
898 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
900 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
901 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
905 AC_MSG_CHECKING([gethostbyname_r with 3 args])
911 struct hostent_data data;
913 (void) gethostbyname_r(name, he, &data);
915 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
916 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
925 AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME))
927 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
928 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
929 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
930 AC_SUBST(HAVE_GETHOSTBYNAME_R)
931 AC_SUBST(HAVE_GETHOSTBYNAME)
933 # checks for system services
936 # Linux requires this for correct f.p. operations
937 AC_CHECK_LIB(ieee, __fpu_control)
939 # Check for --with-fpectl
940 AC_MSG_CHECKING(for --with-fpectl)
941 AC_ARG_WITH(fpectl, [--with-fpectl enable SIGFPE catching], [
942 if test "$withval" != no
943 then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
944 else AC_MSG_RESULT(no)
947 # check for --with-libm=...
949 case $ac_sys_system in
954 AC_MSG_CHECKING(for --with-libm=STRING)
955 AC_ARG_WITH(libm, [--with-libm=STRING math library], [
956 if test "$withval" = no
958 AC_MSG_RESULT(force LIBM empty)
959 elif test "$withval" != yes
961 AC_MSG_RESULT(set LIBM=\"$withval\")
962 else AC_ERROR(proper usage is --with-libm=STRING)
964 [AC_MSG_RESULT(default LIBM=\"$LIBM\")])
966 # check for --with-libc=...
968 AC_MSG_CHECKING(for --with-libc=STRING)
969 AC_ARG_WITH(libc, [--with-libc=STRING C library], [
970 if test "$withval" = no
972 AC_MSG_RESULT(force LIBC empty)
973 elif test "$withval" != yes
975 AC_MSG_RESULT(set LIBC=\"$withval\")
976 else AC_ERROR(proper usage is --with-libc=STRING)
978 [AC_MSG_RESULT(default LIBC=\"$LIBC\")])
980 # check for hypot() in math library
983 AC_CHECK_FUNCS(hypot)
984 AC_REPLACE_FUNCS(hypot)
988 AC_MSG_CHECKING(for genuine getopt)
989 AC_CACHE_VAL(ac_cv_func_getopt,
990 [AC_TRY_RUN([#include <stdio.h>
991 extern int optind, opterr, getopt();
994 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
996 if (getopt(3, av, "f:") == 'f') { exit(1); }
998 }], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
999 AC_MSG_RESULT($ac_cv_func_getopt)
1000 test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
1001 AC_SUBST(LIBOBJS)dnl
1003 # check whether malloc(0) returns NULL or not
1004 AC_MSG_CHECKING(what malloc(0) returns)
1005 AC_CACHE_VAL(ac_cv_malloc_zero,
1006 [AC_TRY_RUN([#include <stdio.h>
1010 char *malloc(), *realloc();
1016 if (p == NULL) exit(1);
1018 if (p == NULL) exit(1);
1021 }], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1022 AC_MSG_RESULT($ac_cv_malloc_zero)
1023 if test "$ac_cv_malloc_zero" = null
1025 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1028 # generate output files
1029 AC_OUTPUT(Makefile \
1033 Modules/Makefile.pre \
1034 Modules/Setup.thread)