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++";;
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)
155 # If the user switches compilers, we can't believe the cache
156 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
158 AC_ERROR(cached CC is different -- throw away $cache_file
159 (it is also a good idea to do 'make clean' before compiling))
167 gcc) CC="$CC -D_HAVE_BSDI";;
171 case $ac_sys_system in
174 cc|*/cc) CC="$CC -Aa -D_HPUX_SOURCE";;
182 # LDLIBRARY is the name of the library to link against (as opposed to the
183 # name of the library into which to insert object files). On systems
184 # without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
186 AC_SUBST(MAKE_LDLIBRARY)
190 # LINKCC is the command that links the python executable -- default is $(CC).
191 # This is altered for AIX and BeOS in order to build the export list before
194 AC_MSG_CHECKING(LINKCC)
197 case $ac_sys_system in
199 LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
201 LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) \$(OPT)"
202 LDLIBRARY='libpython$(VERSION).so';;
204 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
205 *) LINKCC="\$(PURIFY) \$(CC)";;
208 AC_MSG_RESULT($LINKCC)
210 AC_MSG_CHECKING(LDLIBRARY)
212 # NeXT framework builds require that the 'ar' library be converted into
213 # a bundle using libtool.
214 if test "$with_next_framework"
216 LDLIBRARY='libpython$(VERSION).dylib'
219 # DG/UX requires some fancy ld contortions to produce a .so from an .a
220 if test "$MACHDEP" = "dguxR4"
222 LDLIBRARY='libpython$(VERSION).so'
225 AC_MSG_RESULT($LDLIBRARY)
227 # If LDLIBRARY is different from LIBRARY, emit a rule to build it.
228 if test -z "$LDLIBRARY"
230 LDLIBRARY='libpython$(VERSION).a'
231 MAKE_LDLIBRARY="true"
233 MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)'
238 AC_CHECK_PROGS(AR, ar aal, ar)
240 AC_SUBST(INSTALL_PROGRAM)
241 AC_SUBST(INSTALL_DATA)
242 # Install just never works :-(
243 if test -z "$INSTALL"
249 INSTALL_PROGRAM="$INSTALL"
250 INSTALL_DATA="$INSTALL -m 644"
253 # Not every filesystem supports hard links
255 if test -z "$LN" ; then
256 case $ac_sys_system in
262 # Optimizer/debugger flags passed between Makefiles
268 case $ac_cv_prog_cc_g in
277 if test "$ac_arch_flags"
279 OPT="$OPT $ac_arch_flags"
281 # checks for UNIX variants that set C preprocessor variables
285 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
286 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
288 CC="$CC -OPT:Olimit=0"
289 AC_TRY_RUN([int main() { return 0; }],
290 ac_cv_opt_olimit_ok=yes,
291 ac_cv_opt_olimit_ok=no)
293 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
294 if test $ac_cv_opt_olimit_ok = yes; then
295 OPT="$OPT -OPT:Olimit=0"
297 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
298 AC_CACHE_VAL(ac_cv_olimit_ok,
300 CC="$CC -Olimit 1500"
301 AC_TRY_RUN([int main() { return 0; }],
305 AC_MSG_RESULT($ac_cv_olimit_ok)
306 if test $ac_cv_olimit_ok = yes; then
307 OPT="$OPT -Olimit 1500"
311 # check for ANSI or K&R ("traditional") preprocessor
312 AC_MSG_CHECKING(for C preprocessor type)
314 #define spam(name, doc) {#name, &name, #name "() -- " doc}
316 struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
317 ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
318 AC_MSG_RESULT($cpp_type)
320 # checks for header files
322 AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h pthread.h \
323 signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
324 sys/audioio.h sys/file.h sys/lock.h \
325 sys/param.h sys/select.h sys/time.h sys/times.h \
326 sys/un.h sys/utsname.h sys/wait.h)
329 # checks for typedefs
331 AC_MSG_CHECKING(for clock_t in time.h)
332 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
333 AC_MSG_RESULT($was_it_defined)
335 # Add some code to confdefs.h so that the test for off_t works on SCO
336 cat >> confdefs.h <<\EOF
350 AC_CHECK_SIZEOF(long)
351 AC_CHECK_SIZEOF(void *)
353 AC_MSG_CHECKING(for long long support)
355 AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
356 AC_MSG_RESULT($have_long_long)
357 if test "$have_long_long" = yes ; then
358 AC_CHECK_SIZEOF(long long)
361 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
362 AC_MSG_CHECKING(size of off_t)
363 AC_CACHE_VAL(ac_cv_sizeof_off_t,
364 [AC_TRY_RUN([#include <stdio.h>
365 #include <sys/types.h>
368 FILE *f=fopen("conftestval", "w");
370 fprintf(f, "%d\n", sizeof(off_t));
372 }], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
374 AC_MSG_RESULT($ac_cv_sizeof_off_t)
375 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
377 AC_MSG_CHECKING(whether to enable large file support)
378 if test "$have_long_long" = yes -a \
379 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
380 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
381 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
388 # Minor variations in building a framework between NextStep versions 4 and 5
389 AC_SUBST(LIBTOOL_CRUFT)
390 case $ac_sys_system/$ac_sys_release in
392 ns_undef_sym='__environ'
393 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
395 ns_undef_sym='_environ'
396 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
399 AC_MSG_CHECKING(for --with-next-framework)
400 if test "$with_next_framework"
402 OPT="$OPT -fno-common"
403 # -U __environ is needed since bundles don't have access
404 # to crt0 when built but will always be linked against it
405 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
406 AC_DEFINE(WITH_NEXT_FRAMEWORK)
412 AC_MSG_CHECKING(for --with-dyld)
413 if test "$with_next_framework" -o "$with_dyld"
419 AC_MSG_RESULT(required for framework build)
427 # Set info about shared libraries.
431 AC_SUBST(LINKFORSHARED)
432 # SO is the extension of shared libraries `(including the dot!)
433 # -- usually .so, .sl on HP-UX
437 case $ac_sys_system in
443 # LDSHARED is the ld *command* used to create shared library
444 # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
445 # (Shared libraries in this instance are shared modules to be loaded into
446 # Python, as opposed to building Python itself as a shared library.)
447 AC_MSG_CHECKING(LDSHARED)
448 if test -z "$LDSHARED"
450 case $ac_sys_system/$ac_sys_release in
451 AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
452 BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";;
453 IRIX/5*) LDSHARED="ld -shared";;
454 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
455 SunOS/4*) LDSHARED="ld";;
456 SunOS/5*) LDSHARED="ld -G";;
457 hp*|HP*) LDSHARED="ld -b";;
458 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
459 DYNIX/ptx*) LDSHARED="ld -G";;
462 then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
463 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
465 if test "$with_next_framework" ; then
466 LDSHARED="$LDSHARED \$(LDLIBRARY)"
468 Linux*) LDSHARED="gcc -shared";;
469 dgux*) LDSHARED="ld -G";;
470 BSD/OS*/4*) LDSHARED="gcc -shared";;
471 FreeBSD*/[[34]]*) LDSHARED="gcc -shared";;
472 FreeBSD*|OpenBSD*) LDSHARED="ld -Bshareable";;
474 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
476 LDSHARED="cc -shared"
478 LDSHARED="ld -Bshareable"
480 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
484 AC_MSG_RESULT($LDSHARED)
485 # CCSHARED are the C *flags* used to create objects to go into a shared
486 # library (module) -- this is only needed for a few systems
487 AC_MSG_CHECKING(CCSHARED)
488 if test -z "$CCSHARED"
490 case $ac_sys_system/$ac_sys_release in
491 hp*|HP*) if test "$GCC" = yes;
492 then CCSHARED="-fpic";
495 Linux*) CCSHARED="-fpic";;
496 FreeBSD*|OpenBSD*) CCSHARED="-fpic";;
497 NetBSD*) CCSHARED="-fPIC";;
498 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
499 IRIX*/6*) case $CC in
500 *gcc*) CCSHARED="-shared";;
505 AC_MSG_RESULT($CCSHARED)
506 # LINKFORSHARED are the flags passed to the $(CC) command that links
507 # the python executable -- this is only needed for a few systems
508 AC_MSG_CHECKING(LINKFORSHARED)
509 if test -z "$LINKFORSHARED"
511 case $ac_sys_system/$ac_sys_release in
512 AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';;
514 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
515 FreeBSD/[[34]]*) LINKFORSHARED="-Xlinker -export-dynamic";;
516 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
517 # -u libsys_s pulls in all symbols in libsys
518 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
519 # -u __dummy makes the linker aware of the objc runtime
520 # in System.framework; otherwise, __objcInit (referenced in
521 # crt1.o) gets erroneously defined as common, which breaks dynamic
522 # loading of any modules which reference it in System.framework
523 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
524 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
526 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
528 LINKFORSHARED="-Wl,--export-dynamic"
530 SunOS/5*) case $CC in
532 if $CC -Xlinker -V 2>/dev/null | grep BFD >/dev/null
534 LINKFORSHARED="-Xlinker --export-dynamic"
539 AC_MSG_RESULT($LINKFORSHARED)
541 # checks for libraries
542 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
543 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
544 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
545 # However on SGI IRIX, these exist but are broken.
546 # BeOS' sockets are stashed in libnet.
547 case "$ac_sys_system" in
550 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
551 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
552 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
556 AC_MSG_CHECKING(for --with-libs)
557 AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [
558 AC_MSG_RESULT($withval)
559 LIBS="$withval $LIBS"
560 ], AC_MSG_RESULT(no))
562 AC_MSG_CHECKING(for --with(out)-readline)
563 AC_ARG_WITH(readline,
564 [--with(out)-readline obsolete, edit Modules/Setup instead],
565 [AC_MSG_RESULT($withval)
566 AC_ERROR(--with(out)-readline is obsolete, edit Modules/Setup instead)],
567 [AC_MSG_RESULT(not specified.)])
569 AC_SUBST(USE_THREAD_MODULE)
570 USE_THREAD_MODULE="#"
572 AC_MSG_CHECKING(for --with-dec-threads)
574 AC_ARG_WITH(dec-threads,
575 [--with-dec-threads use DEC Alpha/OSF1 thread-safe libraries],
576 [AC_MSG_RESULT($withval)
578 if test "${with_thread+set}" != set; then
579 with_thread="$withval";
583 AC_MSG_CHECKING(for --with-threads)
584 AC_ARG_WITH(threads, [--with-threads alias for --with-thread],
585 [AC_MSG_RESULT($withval)
586 if test "${with_thread+set}" != set; then
587 with_thread="$withval";
591 AC_MSG_CHECKING(for --with-thread)
592 AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
594 AC_MSG_RESULT($withval)
595 if test -d "$withval"
596 then LDFLAGS="$LDFLAGS -L$withval"
598 AC_DEFINE(_REENTRANT)
599 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
601 LIBOBJS="$LIBOBJS thread.o"],[
602 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
603 AC_DEFINE(_POSIX_THREADS)
604 LIBOBJS="$LIBOBJS thread.o"],[
605 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
606 AC_DEFINE(BEOS_THREADS)
607 LIBOBJS="$LIBOBJS thread.o"],[
608 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
609 AC_DEFINE(_POSIX_THREADS)
610 LIBS="$LIBS -lpthreads"
611 LIBOBJS="$LIBOBJS thread.o"], [
612 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
613 AC_DEFINE(_POSIX_THREADS)
614 LIBS="$LIBS -lpthread"
615 LIBOBJS="$LIBOBJS thread.o"], [
616 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
617 AC_DEFINE(_POSIX_THREADS)
619 LIBOBJS="$LIBOBJS thread.o"], [
620 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
621 AC_DEFINE(_POSIX_THREADS)
622 LIBS="$LIBS -lthread"
623 LIBOBJS="$LIBOBJS thread.o"], [
624 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
625 AC_DEFINE(_POSIX_THREADS)
627 LIBOBJS="$LIBOBJS thread.o"])
630 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
632 LIBOBJS="$LIBOBJS thread.o"])
633 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
634 LIBS="$LIBS -lthread"
635 LIBOBJS="$LIBOBJS thread.o"])
636 ], AC_MSG_RESULT(no))
638 # -I${DLINCLDIR} is added to the compile rule for importdl.o
642 AC_MSG_CHECKING(for --with-sgi-dl)
643 AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
644 AC_MSG_RESULT($withval)
645 AC_DEFINE(WITH_SGI_DL)
648 then LDFLAGS="$LDFLAGS -L$dldir"
649 else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
652 LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
654 AC_MSG_CHECKING(for --with-dl-dld)
655 AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
656 AC_MSG_RESULT($withval)
657 AC_DEFINE(WITH_DL_DLD)
658 dldir=`echo "$withval" | sed 's/,.*//'`
659 dlddir=`echo "$withval" | sed 's/.*,//'`
660 if test -d "$dldir" -a -d "$dlddir"
661 then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
662 else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
665 LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
667 # checks for library functions
668 AC_CHECK_FUNCS(alarm chown clock dlopen execv flock fork \
669 fsync fdatasync ftime ftruncate \
670 getpeername getpgrp getpid getpwent gettimeofday getwd \
671 kill link lstat mkfifo mktime nice pause plock pthread_init putenv readlink \
672 select setgid setlocale setuid setsid setpgid setpgrp setvbuf \
673 sigaction siginterrupt sigrelse strftime strptime symlink \
674 tcgetpgrp tcsetpgrp timegm times truncate uname waitpid)
676 # check for long file support functions
677 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
679 AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
680 AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
681 AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
682 AC_CHECK_FUNC(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
684 # checks for structures
689 AC_MSG_CHECKING(for time.h that defines altzone)
690 AC_CACHE_VAL(ac_cv_header_time_altzone,
691 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
692 ac_cv_header_time_altzone=yes,
693 ac_cv_header_time_altzone=no)])
694 AC_MSG_RESULT($ac_cv_header_time_altzone)
695 if test $ac_cv_header_time_altzone = yes; then
696 AC_DEFINE(HAVE_ALTZONE)
700 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
702 #include <sys/types.h>
703 #include <sys/select.h>
704 #include <sys/time.h>
705 ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
706 AC_MSG_RESULT($was_it_defined)
708 # checks for compiler characteristics
715 AC_MSG_CHECKING(for working volatile)
716 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
717 AC_MSG_RESULT($works)
720 AC_MSG_CHECKING(for working signed char)
721 AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
722 AC_MSG_RESULT($works)
725 AC_MSG_CHECKING(for prototypes)
726 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
727 AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
728 AC_MSG_RESULT($have_prototypes)
731 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
734 int foo(int x, ...) {
742 ], [return foo(10, "", 3.14);],
743 AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
744 AC_MSG_RESULT($works)
746 if test "$have_prototypes" = yes; then
748 AC_MSG_CHECKING(for bad exec* prototypes)
749 AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
750 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
751 AC_MSG_RESULT($bad_prototypes)
755 AC_MSG_CHECKING(for bad static forward)
757 struct s { int a; int b; };
764 static struct s foo = { 1, 2 };
766 exit(!((int)&foo == foobar()));
768 ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
769 AC_MSG_RESULT($bad_forward)
772 AC_MSG_CHECKING(whether va_list is an array)
774 #ifdef HAVE_STDARG_PROTOTYPES
779 ], [va_list list1, list2; list1 = list2;], ,
780 AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
781 AC_MSG_RESULT($va_list_is_array)
783 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
784 AC_CHECK_FUNC(gethostbyname_r, [
785 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
786 AC_MSG_CHECKING([gethostbyname_r with 6 args])
788 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
793 struct hostent *he, *res;
798 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
800 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
801 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
805 AC_MSG_CHECKING([gethostbyname_r with 5 args])
815 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
817 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
818 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
822 AC_MSG_CHECKING([gethostbyname_r with 3 args])
828 struct hostent_data data;
830 (void) gethostbyname_r(name, he, &data);
832 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
833 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
842 AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME))
844 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
845 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
846 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
847 AC_SUBST(HAVE_GETHOSTBYNAME_R)
848 AC_SUBST(HAVE_GETHOSTBYNAME)
850 # checks for system services
853 # Linux requires this for correct f.p. operations
854 AC_CHECK_LIB(ieee, __fpu_control)
856 # Check for --with-fpectl
857 AC_MSG_CHECKING(for --with-fpectl)
858 AC_ARG_WITH(fpectl, [--with-fpectl enable SIGFPE catching], [
859 if test "$withval" != no
860 then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
861 else AC_MSG_RESULT(no)
864 # check for --with-libm=...
866 case $ac_sys_system in
871 AC_MSG_CHECKING(for --with-libm=STRING)
872 AC_ARG_WITH(libm, [--with-libm=STRING math library], [
873 if test "$withval" = no
875 AC_MSG_RESULT(force LIBM empty)
876 elif test "$withval" != yes
878 AC_MSG_RESULT(set LIBM=\"$withval\")
879 else AC_ERROR(proper usage is --with-libm=STRING)
881 [AC_MSG_RESULT(default LIBM=\"$LIBM\")])
883 # check for --with-libc=...
885 AC_MSG_CHECKING(for --with-libc=STRING)
886 AC_ARG_WITH(libc, [--with-libc=STRING C library], [
887 if test "$withval" = no
889 AC_MSG_RESULT(force LIBC empty)
890 elif test "$withval" != yes
892 AC_MSG_RESULT(set LIBC=\"$withval\")
893 else AC_ERROR(proper usage is --with-libc=STRING)
895 [AC_MSG_RESULT(default LIBC=\"$LIBC\")])
897 # check for hypot() in math library
900 AC_CHECK_FUNCS(hypot)
901 AC_REPLACE_FUNCS(hypot)
905 AC_MSG_CHECKING(for genuine getopt)
906 AC_CACHE_VAL(ac_cv_func_getopt,
907 [AC_TRY_RUN([#include <stdio.h>
908 extern int optind, opterr, getopt();
911 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
913 if (getopt(3, av, "f:") == 'f') { exit(1); }
915 }], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
916 AC_MSG_RESULT($ac_cv_func_getopt)
917 test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
920 # check whether malloc(0) returns NULL or not
921 AC_MSG_CHECKING(what malloc(0) returns)
922 AC_CACHE_VAL(ac_cv_malloc_zero,
923 [AC_TRY_RUN([#include <stdio.h>
927 char *malloc(), *realloc();
933 if (p == NULL) exit(1);
935 if (p == NULL) exit(1);
938 }], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
939 AC_MSG_RESULT($ac_cv_malloc_zero)
940 if test "$ac_cv_malloc_zero" = null
942 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
945 # generate output files
950 Modules/Makefile.pre \
951 Modules/Setup.thread)