1 dnl Macros that test for specific features.
2 dnl This file is part of Autoconf.
3 dnl Copyright (C) 1992, 93, 94, 95, 96, 1998 Free Software Foundation, Inc.
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 2, or (at your option)
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; if not, write to the Free Software
17 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 dnl As a special exception, the Free Software Foundation gives unlimited
21 dnl permission to copy, distribute and modify the configure scripts that
22 dnl are the output of Autoconf. You need not follow the terms of the GNU
23 dnl General Public License when using or distributing such scripts, even
24 dnl though portions of the text of Autoconf appear in them. The GNU
25 dnl General Public License (GPL) does govern all other use of the material
26 dnl that constitutes the Autoconf program.
28 dnl Certain portions of the Autoconf source text are designed to be copied
29 dnl (in certain cases, depending on the input) into the output of
30 dnl Autoconf. We call these the "data" portions. The rest of the Autoconf
31 dnl source text consists of comments plus executable code that decides which
32 dnl of the data portions to output in any given case. We call these
33 dnl comments and executable code the "non-data" portions. Autoconf never
34 dnl copies any of the non-data portions into its output.
36 dnl This special exception to the GPL applies to versions of Autoconf
37 dnl released by the Free Software Foundation. When you make and
38 dnl distribute a modified version of Autoconf, you may extend this special
39 dnl exception to the GPL to apply to your modified version as well, *unless*
40 dnl your modified version has the potential to copy into its output some
41 dnl of the text that was the non-data portion of the version that you started
42 dnl with. (In other words, unless your change moves or copies text from
43 dnl the non-data portions to the data portions.) If your modification has
44 dnl such potential, you must delete any notice of this special exception
45 dnl to the GPL from your modified version.
47 dnl Written by David MacKenzie, with help from
48 dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
49 dnl Roland McGrath, Noah Friedman, david d zuhn, and many others.
51 dnl Changed by Bruno Haible, 18 January 1999
54 dnl ### Checks for programs
57 dnl Check whether to use -n, \c, or newline-tab to separate
58 dnl checking messages from result messages.
59 dnl Idea borrowed from dist 3.0.
60 dnl Internal use only.
61 AC_DEFUN(AC_PROG_ECHO_N,
62 [if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
63 # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
64 if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
68 ac_n=-n ac_c= ac_t= ac_tt='
72 ac_n= ac_c='\c' ac_t= ac_tt='
78 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
79 AC_CHECK_PROG(CC, gcc, gcc)
80 if test -z "$CC"; then
81 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
82 if test -z "$CC"; then
85 AC_CHECK_PROG(CC, cl, cl) ;;
88 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
94 if test $ac_cv_prog_gcc = yes; then
100 dnl Check whether -g works, even if CFLAGS is set, in case the package
101 dnl plays around with CFLAGS (such as to build both debugging and
102 dnl normal versions of a library), tasteless as that idea is.
103 ac_test_CFLAGS="${CFLAGS+set}"
104 ac_save_CFLAGS="$CFLAGS"
107 if test "$ac_test_CFLAGS" = set; then
108 CFLAGS="$ac_save_CFLAGS"
109 dnl # This doesn't work on Linux (libc-4.5.26): Because of differences between
110 dnl # the shared and the static libraries there are less symbols available
111 dnl # without -g than with -g. It is therefore better to run the configuration
112 dnl # without -g and to add -g afterwards than the contrary. So don't add
113 dnl # -g to the CFLAGS now.
114 dnl elif test $ac_cv_prog_cc_g = yes; then
115 dnl if test "$GCC" = yes; then
121 if test "$GCC" = yes; then
123 # Add "-O" to both the CC and CPP commands, to eliminate possible confusion
124 # that results from __OPTIMIZE__ being defined for CC but not CPP.
126 if echo "$CC " | grep ' -O[1-9 ]' > /dev/null 2>&1; then
128 : # already optimizing
139 AC_DEFUN(AC_PROG_CXX,
140 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
141 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, gcc)
146 if test $ac_cv_prog_gxx = yes; then
152 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
153 dnl plays around with CXXFLAGS (such as to build both debugging and
154 dnl normal versions of a library), tasteless as that idea is.
155 ac_test_CXXFLAGS="${CXXFLAGS+set}"
156 ac_save_CXXFLAGS="$CXXFLAGS"
159 if test "$ac_test_CXXFLAGS" = set; then
160 CXXFLAGS="$ac_save_CXXFLAGS"
161 dnl # This doesn't work on Linux (libc-4.5.26): Because of differences between
162 dnl # the shared and the static libraries there are less symbols available
163 dnl # without -g than with -g. It is therefore better to run the configuration
164 dnl # without -g and to add -g afterwards than the contrary. So don't add
165 dnl # -g to the CFLAGS now.
166 dnl elif test $ac_cv_prog_cxx_g = yes; then
167 dnl if test "$GXX" = yes; then
168 dnl CXXFLAGS="-g -O2"
173 if test "$GXX" = yes; then
175 # Add "-O" to both the CXX and CXXCPP commands, to eliminate possible confu-
176 # sion that results from __OPTIMIZE__ being defined for CXX but not CXXCPP.
178 if echo "$CXX " | grep ' -O[1-9 ]' > /dev/null; then
180 : # already optimizing
183 ac_cv_prog_CXX="$CXX"
191 dnl Determine a Fortran 77 compiler to use. If `F77' is not already set
192 dnl in the environment, check for `g77', `f77' and `f2c', in that order.
193 dnl Set the output variable `F77' to the name of the compiler found.
195 dnl If using `g77' (the GNU Fortran 77 compiler), then `AC_PROG_F77'
196 dnl will set the shell variable `G77' to `yes', and empty otherwise. If
197 dnl the output variable `FFLAGS' was not already set in the environment,
198 dnl then set it to `-g -02' for `g77' (or `-O2' where `g77' does not
199 dnl accept `-g'). Otherwise, set `FFLAGS' to `-g' for all other Fortran
203 AC_DEFUN(AC_PROG_F77,
204 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
205 if test -z "$F77"; then
206 AC_CHECK_PROGS(F77, g77 f77 f2c)
207 test -z "$F77" && AC_MSG_ERROR([no acceptable Fortran 77 compiler found in \$PATH])
213 if test $ac_cv_prog_g77 = yes; then
215 dnl Check whether -g works, even if FFLAGS is set, in case the package
216 dnl plays around with FFLAGS (such as to build both debugging and
217 dnl normal versions of a library), tasteless as that idea is.
218 ac_test_FFLAGS="${FFLAGS+set}"
219 ac_save_FFLAGS="$FFLAGS"
222 if test "$ac_test_FFLAGS" = set; then
223 FFLAGS="$ac_save_FFLAGS"
224 elif test $ac_cv_prog_f77_g = yes; then
231 test "${FFLAGS+set}" = set || FFLAGS="-g"
235 AC_DEFUN(AC_PROG_CC_WORKS,
236 [AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works])
239 AC_TRY_COMPILER([int main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross)
241 AC_MSG_RESULT($ac_cv_prog_cc_works)
242 if test $ac_cv_prog_cc_works = no; then
243 AC_MSG_ERROR([installation or configuration problem: C compiler cannot create executables.])
245 AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
246 AC_MSG_RESULT($ac_cv_prog_cc_cross)
247 cross_compiling=$ac_cv_prog_cc_cross
250 AC_DEFUN(AC_PROG_CXX_WORKS,
251 [AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
254 AC_TRY_COMPILER([int main(){return(0);}], ac_cv_prog_cxx_works, ac_cv_prog_cxx_cross)
256 AC_MSG_RESULT($ac_cv_prog_cxx_works)
257 if test $ac_cv_prog_cxx_works = no; then
258 AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
260 AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
261 AC_MSG_RESULT($ac_cv_prog_cxx_cross)
262 cross_compiling=$ac_cv_prog_cxx_cross
265 dnl Test whether the Fortran 77 compiler can compile and link a trivial
266 dnl Fortran program. Also, test whether the Fortran 77 compiler is a
267 dnl cross-compiler (which may realistically be the case if the Fortran
268 dnl compiler is `g77').
270 dnl AC_PROG_F77_WORKS()
271 AC_DEFUN(AC_PROG_F77_WORKS,
272 [AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) works])
278 ], ac_cv_prog_f77_works, ac_cv_prog_f77_cross)
280 AC_MSG_RESULT($ac_cv_prog_f77_works)
281 if test $ac_cv_prog_f77_works = no; then
282 AC_MSG_ERROR([installation or configuration problem: Fortran 77 compiler cannot create executables.])
284 AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler])
285 AC_MSG_RESULT($ac_cv_prog_f77_cross)
286 cross_compiling=$ac_cv_prog_f77_cross
289 AC_DEFUN(AC_PROG_CC_GNU,
290 [AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
291 [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
292 cat > conftest.c <<EOF
297 if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
303 AC_DEFUN(AC_PROG_CXX_GNU,
304 [AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
305 [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
306 cat > conftest.C <<EOF
311 if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | egrep yes >/dev/null 2>&1; then
317 dnl Test whether for Fortran 77 compiler is `g77' (the GNU Fortran 77
318 dnl Compiler). This test depends on whether the Fortran 77 compiler can
319 dnl do CPP pre-processing.
321 dnl AC_PROG_F77_GNU()
322 AC_DEFUN(AC_PROG_F77_GNU,
323 [AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77,
324 [cat > conftest.fpp <<EOF
329 if AC_TRY_COMMAND($F77 -E conftest.fpp) | egrep yes >/dev/null 2>&1; then
335 AC_DEFUN(AC_PROG_CC_G,
336 [AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
337 [echo 'void f(){}' > conftest.c
338 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
346 AC_DEFUN(AC_PROG_CXX_G,
347 [AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
348 [echo 'void f(){}' > conftest.cc
349 if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
357 dnl Test whether the Fortran 77 compiler can accept the `-g' option to
358 dnl enable debugging.
361 AC_DEFUN(AC_PROG_F77_G,
362 [AC_CACHE_CHECK(whether $F77 accepts -g, ac_cv_prog_f77_g,
363 [cat > conftest.f << EOF
367 if test -z "`$F77 -g -c conftest.f 2>&1`"; then
375 AC_DEFUN(AC_PROG_GCC_TRADITIONAL,
376 [AC_REQUIRE([AC_PROG_CC])dnl
377 AC_REQUIRE([AC_PROG_CPP])dnl
378 if test $ac_cv_prog_gcc = yes; then
379 AC_CACHE_CHECK(whether -traditional is needed for ${CC-cc} on this system,
380 ac_cv_prog_gcc_traditional,
381 [ ac_pattern="Autoconf.*'x'"
382 AC_EGREP_CPP($ac_pattern, [#include <sgtty.h>
384 ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no)
386 if test $ac_cv_prog_gcc_traditional = no; then
387 AC_EGREP_CPP($ac_pattern, [#include <termio.h>
389 ac_cv_prog_gcc_traditional=yes)
391 if test $ac_cv_prog_gcc_traditional = no; then
392 # On some USL SVR4 systems, gcc's fixinc.svr4 modifies <signal.h> and
393 # <sys/signal.h> in such a way that "#include <signal.h>" results in a
394 # syntax error because of `sigset_t' if gcc is called with __STDC__=1
395 # but __STRICT_ANSI__ undefined. Remedy: use -traditional.
397 #include <sys/types.h>
400 extern "C" void exit(int);
402 int main() { exit(0); }'
403 echo "$ac_prog" > conftest.c
404 if eval $ac_link; then
409 #include <sys/types.h>
412 extern "C" void exit(int);
414 int main() { exit(0); }'
415 echo "$ac_prog" > conftest.c
416 if eval $ac_link; then
417 ac_cv_prog_gcc_traditional=yes
422 if test $ac_cv_prog_gcc_traditional = yes; then
423 CC="$CC -traditional"
428 AC_DEFUN(AC_PROG_CC_C_O,
429 [if test "x$CC" != xcc; then
430 AC_MSG_CHECKING(whether $CC and cc understand -c and -o together)
432 AC_MSG_CHECKING(whether cc understands -c and -o together)
434 set dummy $CC; ac_cc="`echo [$]2 |
436 sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
438 AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
439 [echo 'foo(){}' > conftest.c
440 # Make sure it works both with $CC and with simple cc.
441 # We do the test twice because some compilers refuse to overwrite an
442 # existing .o file with -o, though they will create one.
443 ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&AC_FD_CC'
444 if AC_TRY_EVAL(ac_try) &&
445 test -f conftest.o && AC_TRY_EVAL(ac_try);
447 eval ac_cv_prog_cc_${ac_cc}_c_o=yes
448 if test "x$CC" != xcc; then
449 # Test first that cc exists at all.
450 if AC_TRY_COMMAND(cc -c conftest.c 1>&AC_FD_CC); then
451 ac_try='cc -c conftest.c -o conftest.o 1>&AC_FD_CC'
452 if AC_TRY_EVAL(ac_try) &&
453 test -f conftest.o && AC_TRY_EVAL(ac_try);
458 # cc exists but doesn't like -o.
459 eval ac_cv_prog_cc_${ac_cc}_c_o=no
464 eval ac_cv_prog_cc_${ac_cc}_c_o=no
468 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
472 AC_DEFINE(NO_MINUS_C_MINUS_O)
476 dnl Test if the Fortran 77 compiler accepts the options `-c' and `-o'
477 dnl simultaneously, and define `F77_NO_MINUS_C_MINUS_O' if it does not.
479 dnl The usefulness of this macro is questionable, as I can't really see
480 dnl why anyone would use it. The only reason I include it is for
481 dnl completeness, since a similar test exists for the C compiler.
484 AC_DEFUN(AC_PROG_F77_C_O,
485 [AC_BEFORE([$0], [AC_PROG_F77])dnl
486 AC_MSG_CHECKING(whether $F77 understand -c and -o together)
487 set dummy $F77; ac_f77="`echo [$]2 |
489 sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
491 AC_CACHE_VAL(ac_cv_prog_f77_${ac_f77}_c_o,
492 [cat > conftest.f << EOF
496 # We do the `AC_TRY_EVAL' test twice because some compilers refuse to
497 # overwrite an existing `.o' file with `-o', although they will create
499 ac_try='$F77 $FFLAGS -c conftest.f -o conftest.o 1>&AC_FD_CC'
500 if AC_TRY_EVAL(ac_try) && test -f conftest.o && AC_TRY_EVAL(ac_try); then
501 eval ac_cv_prog_f77_${ac_f77}_c_o=yes
503 eval ac_cv_prog_f77_${ac_f77}_c_o=no
507 if eval "test \"`echo '$ac_cv_prog_f77_'${ac_f77}_c_o`\" = yes"; then
511 AC_DEFINE(F77_NO_MINUS_C_MINUS_O)
515 dnl Define SET_MAKE to set ${MAKE} if make doesn't.
516 AC_DEFUN(AC_PROG_MAKE_SET,
517 [AC_MSG_CHECKING([whether ${MAKE-make} sets \$(MAKE)])
518 set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'`
519 AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
520 [cat > conftestmake <<\EOF
522 @echo 'ac_maketemp="${MAKE}"'
525 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
526 eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
528 if test -n "$ac_maketemp"; then
529 eval ac_cv_prog_make_${ac_make}_set=yes
531 eval ac_cv_prog_make_${ac_make}_set=no
533 rm -f conftestmake])dnl
534 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
539 SET_MAKE="MAKE=${MAKE-make}"
541 AC_SUBST([SET_MAKE])dnl
544 AC_DEFUN(AC_PROG_RANLIB,
545 [AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)])
547 dnl Check for mawk first since it's generally faster.
548 AC_DEFUN(AC_PROG_AWK,
549 [AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )])
551 AC_DEFUN(AC_PROG_YACC,
552 [AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)])
554 AC_DEFUN(AC_PROG_CPP,
555 [AC_MSG_CHECKING(how to run the C preprocessor)
556 # On Suns, sometimes $CPP names a directory.
557 if test -n "$CPP" && test -d "$CPP"; then
560 if test -z "$CPP"; then
561 AC_CACHE_VAL(ac_cv_prog_CPP,
562 [ # This must be in double quotes, not single quotes, because CPP may get
563 # substituted into the Makefile and "${CC-cc}" will confuse make.
565 if test -n "$GCC"; then
566 dnl This is already part of AC_PROG_CC.
567 dnl # Use the same optimization flags than for CC, because some things may
568 dnl # depend upon __OPTIMIZE__.
570 # Suppress warning messages.
571 dnl # When using gcc -traditional on machines that have <sys/cdefs.h>,
572 dnl # the "-Dconst=" from AC_C_CONST and the "#define const __const" from
573 dnl # <sys/cdefs.h> generate a warning. Unless suppressed, this warning
574 dnl # causes later tests using AC_TRY_CPP to fail.
577 # On the NeXT, cc -E runs the code through the compiler's parser,
578 # not just through cpp. On NeXTstep 3.1 the same holds for /lib/cpp; use
579 # "cc -E -traditional-cpp" instead.
580 dnl Use a header file that comes with gcc, so configuring glibc
581 dnl with a fresh cross-compiler works.
582 AC_TRY_CPP([#include <assert.h>
583 Syntax Error], ac_have_cpp=1)
584 if test -z "$ac_have_cpp"; then
585 CPP="${CC-cc} -E -traditional-cpp"
586 AC_TRY_CPP([#include <assert.h>
587 Syntax Error], ac_have_cpp=1)
588 if test -n "$ac_have_cpp"; then
589 CC="${CC-cc} -traditional-cpp"
591 CPP="${CC-cc} -nologo -E"
592 AC_TRY_CPP([#include <assert.h>
593 Syntax Error], ac_have_cpp=1)
594 if test -n "$ac_have_cpp"; then
595 CC="${CC-cc} -nologo"
602 ac_cv_prog_CPP="$CPP"])dnl
603 CPP="$ac_cv_prog_CPP"
605 ac_cv_prog_CPP="$CPP"
611 AC_DEFUN(AC_PROG_CXXCPP,
612 [AC_MSG_CHECKING(how to run the C++ preprocessor)
613 if test -z "$CXXCPP"; then
614 AC_CACHE_VAL(ac_cv_prog_CXXCPP,
616 AC_LANG_CPLUSPLUS[]dnl
617 CXXCPP="${CXX-g++} -E"
618 AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
619 ac_cv_prog_CXXCPP="$CXXCPP"
622 CXXCPP="$ac_cv_prog_CXXCPP"
623 AC_MSG_RESULT($CXXCPP)
627 dnl Require finding the C or C++ preprocessor, whichever is the
628 dnl current language.
629 AC_DEFUN(AC_REQUIRE_CPP,
630 [ifelse(AC_LANG, C, [AC_REQUIRE([AC_PROG_CPP])], [AC_REQUIRE([AC_PROG_CXXCPP])])])
632 AC_DEFUN(AC_PROG_LEX,
633 [AC_CHECK_PROG(LEX, flex, flex, lex)
640 AC_CHECK_LIB($ac_lib, yywrap, LEXLIB="-l$ac_lib")
644 dnl Check if lex declares yytext as a char * by default, not a char[].
645 undefine([AC_DECL_YYTEXT])
646 AC_DEFUN(AC_DECL_YYTEXT,
648 AC_REQUIRE([AC_PROG_LEX])dnl
649 AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,
650 [# The minimal lex program is just a single line: %%. But some broken lexes
651 # (Solaris, I think it was) want two %% lines, so accommodate them.
654 if test -f lex.yy.c; then
655 ac_cv_prog_lex_root=lex.yy
656 elif test -f lexyy.c; then
657 ac_cv_prog_lex_root=lexyy
659 AC_MSG_ERROR(cannot find output from $LEX; giving up)
661 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
662 AC_SUBST(LEX_OUTPUT_ROOT)dnl
664 AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer,
665 [# POSIX says lex can declare yytext either as a pointer or an array; the
666 # default is implementation-dependent. Figure out which it is, since
667 # not all implementations provide the %pointer and %array declarations.
668 ac_cv_prog_lex_yytext_pointer=no
669 echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
672 AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`, , ac_cv_prog_lex_yytext_pointer=yes)
674 rm -f "${LEX_OUTPUT_ROOT}.c"
676 if test $ac_cv_prog_lex_yytext_pointer = yes; then
677 AC_DEFINE(YYTEXT_POINTER)
681 AC_DEFUN(AC_PROG_INSTALL,
682 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
683 # Find a good install program. We prefer a C program (faster),
684 # so one script is as good as another. But avoid the broken or
685 # incompatible versions:
686 # SysV /etc/install, /usr/sbin/install
687 # SunOS /usr/etc/install
690 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
691 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
692 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
693 # ./install, which can be erroneously created by make from ./install.sh.
694 AC_MSG_CHECKING(for a BSD compatible install)
695 if test -z "$INSTALL"; then
696 AC_CACHE_VAL(ac_cv_path_install,
697 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
698 for ac_dir in $PATH; do
699 # Account for people who put trailing slashes in PATH elements.
701 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
703 # OSF1 and SCO ODT 3.0 have their own names for install.
704 # Don't use installbsd from OSF since it installs stuff as root
706 for ac_prog in ginstall scoinst install; do
707 if test -f $ac_dir/$ac_prog; then
708 if test $ac_prog = install &&
709 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
710 # AIX install. It has an incompatible calling convention.
713 if test $ac_prog = installbsd &&
714 grep src/bos $ac_dir/$ac_prog >/dev/null 2>&1; then
715 # AIX installbsd doesn't work without option "-g".
718 ac_cv_path_install="$ac_dir/$ac_prog -c"
729 if test "${ac_cv_path_install+set}" = set; then
730 INSTALL="$ac_cv_path_install"
732 # As a last resort, use the slow shell script. We don't cache a
733 # path for INSTALL within a source directory, because that will
734 # break other packages using the cache if that directory is
735 # removed, or if the path is relative.
736 INSTALL="$ac_install_sh"
739 dnl We do special magic for INSTALL instead of AC_SUBST, to get
740 dnl relative paths right.
741 AC_MSG_RESULT($INSTALL)
743 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
744 # It thinks the first close brace ends the variable substitution.
745 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
746 AC_SUBST(INSTALL_PROGRAM)dnl
748 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
749 AC_SUBST(INSTALL_SCRIPT)dnl
751 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
752 AC_SUBST(INSTALL_DATA)dnl
755 AC_DEFUN(AC_PROG_LN_S,
756 [AC_MSG_CHECKING(whether ln -s works)
757 AC_CACHE_VAL(ac_cv_prog_LN_S,
759 if ln -s X conftestdata 2>/dev/null
762 ac_cv_prog_LN_S="ln -s"
766 LN_S="$ac_cv_prog_LN_S"
767 if test "$ac_cv_prog_LN_S" = "ln -s"; then
776 [errprint(__file__:__line__: [$0] has been removed; replace it with equivalent code
780 dnl ### Checks for header files
783 AC_DEFUN(AC_HEADER_STDC,
785 AC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc,
786 [AC_TRY_CPP([#include <stdlib.h>
789 #include <float.h>], ac_cv_header_stdc=yes, ac_cv_header_stdc=no)
791 if test $ac_cv_header_stdc = yes; then
792 # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
793 AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no)
796 if test $ac_cv_header_stdc = yes; then
797 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
798 AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no)
801 if test $ac_cv_header_stdc = yes; then
802 # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
803 AC_TRY_RUN([#include <ctype.h>
804 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
805 #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
806 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
807 int main () { int i; for (i = 0; i < 256; i++)
808 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
810 ], , ac_cv_header_stdc=no, :)
812 if test $ac_cv_header_stdc = yes; then
813 AC_DEFINE(STDC_HEADERS)
817 AC_DEFUN(AC_UNISTD_H,
818 [AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(unistd.h)])dnl
819 AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))])
823 [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H])dnl
824 AC_MSG_CHECKING([for BSD string and memory functions])
825 AC_TRY_LINK([#include <strings.h>], [rindex(0, 0); bzero(0, 0);],
826 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); AC_DEFINE(USG)])])
829 dnl If memchr and the like aren't declared in <string.h>, include <memory.h>.
830 dnl To avoid problems, don't check for gcc2 built-ins.
831 AC_DEFUN(AC_MEMORY_H,
832 [AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H])dnl
833 AC_MSG_CHECKING(whether string.h declares mem functions)
834 AC_EGREP_HEADER(memchr, string.h, ac_found=yes, ac_found=no)
835 AC_MSG_RESULT($ac_found)
836 if test $ac_found = no; then
837 AC_CHECK_HEADER(memory.h, [AC_DEFINE(NEED_MEMORY_H)])
841 AC_DEFUN(AC_HEADER_MAJOR,
842 [AC_CACHE_CHECK(whether sys/types.h defines makedev,
843 ac_cv_header_sys_types_h_makedev,
844 [AC_TRY_LINK([#include <sys/types.h>], [return makedev(0, 0);],
845 ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)
848 if test $ac_cv_header_sys_types_h_makedev = no; then
849 AC_CHECK_HEADER(sys/mkdev.h, [AC_DEFINE(MAJOR_IN_MKDEV)])
851 if test $ac_cv_header_sys_mkdev_h = no; then
852 AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)])
857 AC_DEFUN(AC_HEADER_DIRENT,
859 AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h,
860 [ac_header_dirent=$ac_hdr; break])
861 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
862 if test $ac_header_dirent = dirent.h; then
863 AC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir")
865 AC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx")
869 dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE
870 dnl defines the type `DIR'. dirent.h on NextStep 3.2 doesn't.
871 dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
872 AC_DEFUN(AC_CHECK_HEADER_DIRENT,
873 [ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
874 AC_MSG_CHECKING([for $1 that defines DIR])
875 AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe,
876 [AC_TRY_COMPILE([#include <sys/types.h>
877 #include <$1>], [DIR *dirp = 0;],
878 eval "ac_cv_header_dirent_$ac_safe=yes",
879 eval "ac_cv_header_dirent_$ac_safe=no")])dnl
880 if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
888 dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that
890 dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION])
891 define(AC_CHECK_HEADERS_DIRENT,
894 AC_CHECK_HEADER_DIRENT($ac_hdr,
896 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
898 AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnl
901 AC_DEFUN(AC_DIR_HEADER,
902 [AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl
904 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
905 AC_CHECK_HEADER_DIRENT($ac_hdr, [ac_header_dirent=$ac_hdr; break])
908 case "$ac_header_dirent" in
909 dirent.h) AC_DEFINE(DIRENT) ;;
910 sys/ndir.h) AC_DEFINE(SYSNDIR) ;;
911 sys/dir.h) AC_DEFINE(SYSDIR) ;;
912 ndir.h) AC_DEFINE(NDIR) ;;
915 AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
916 [AC_TRY_RUN([#include <sys/types.h>
917 #include <$ac_header_dirent>
918 int closedir(); int main() { exit(closedir(opendir(".")) != 0); }],
919 ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)])
920 if test $ac_cv_func_closedir_void = yes; then
921 AC_DEFINE(VOID_CLOSEDIR)
925 AC_DEFUN(AC_HEADER_STAT,
926 [AC_CACHE_CHECK(whether stat file-mode macros are broken,
927 ac_cv_header_stat_broken,
928 [AC_EGREP_CPP([You lose], [#include <sys/types.h>
929 #include <sys/stat.h>
931 #if defined(S_ISBLK) && defined(S_IFDIR)
932 # if S_ISBLK (S_IFDIR)
937 #if defined(S_ISBLK) && defined(S_IFCHR)
938 # if S_ISBLK (S_IFCHR)
943 #if defined(S_ISLNK) && defined(S_IFREG)
944 # if S_ISLNK (S_IFREG)
949 #if defined(S_ISSOCK) && defined(S_IFREG)
950 # if S_ISSOCK (S_IFREG)
954 ], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)])
955 if test $ac_cv_header_stat_broken = yes; then
956 AC_DEFINE(STAT_MACROS_BROKEN)
960 AC_DEFUN(AC_DECL_SYS_SIGLIST,
961 [AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
962 ac_cv_decl_sys_siglist,
963 [AC_TRY_COMPILE([#include <sys/types.h>
965 /* NetBSD declares sys_siglist in unistd.h. */
968 #endif], [char *msg = *(sys_siglist + 1);],
969 ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])
970 if test $ac_cv_decl_sys_siglist = yes; then
971 AC_DEFINE(SYS_SIGLIST_DECLARED)
975 AC_DEFUN(AC_HEADER_SYS_WAIT,
976 [AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible],
977 ac_cv_header_sys_wait_h,
978 [AC_TRY_COMPILE([#include <sys/types.h>
979 #include <sys/wait.h>
981 #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
984 #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
987 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;],
988 ac_cv_header_sys_wait_h=yes, ac_cv_header_sys_wait_h=no)])
989 if test $ac_cv_header_sys_wait_h = yes; then
990 AC_DEFINE(HAVE_SYS_WAIT_H)
995 dnl ### Checks for typedefs
998 AC_DEFUN(AC_TYPE_GETGROUPS,
999 [AC_REQUIRE([AC_TYPE_UID_T])dnl
1000 AC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups,
1002 changequote(<<, >>)dnl
1004 /* Thanks to Mike Rendell for this test. */
1005 #include <sys/types.h>
1008 #define MAX(x, y) ((x) > (y) ? (x) : (y))
1013 union { gid_t gval; long lval; } val;
1016 for (i = 0; i < NGID; i++)
1017 gidset[i] = val.gval;
1018 n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
1020 /* Exit non-zero if getgroups seems to require an array of ints. This
1021 happens when gid_t is short but getgroups modifies an array of ints. */
1022 exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0);
1025 changequote([, ])dnl
1026 ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int,
1027 ac_cv_type_getgroups=cross)
1028 if test $ac_cv_type_getgroups = cross; then
1029 dnl When we can't run the test program (we are cross compiling), presume
1030 dnl that <unistd.h> has either an accurate prototype for getgroups or none.
1031 dnl Old systems without prototypes probably use int.
1032 AC_EGREP_HEADER([getgroups.*int.*gid_t], unistd.h,
1033 ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int)
1035 AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups)
1038 AC_DEFUN(AC_TYPE_UID_T,
1039 [AC_CACHE_CHECK(for uid_t in sys/types.h, ac_cv_type_uid_t,
1040 [AC_EGREP_HEADER(uid_t, sys/types.h,
1041 ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)])
1042 if test $ac_cv_type_uid_t = no; then
1043 AC_DEFINE(uid_t, int)
1044 AC_DEFINE(gid_t, int)
1048 AC_DEFUN(AC_TYPE_SIZE_T,
1049 [AC_CHECK_TYPE(size_t, unsigned)])
1051 AC_DEFUN(AC_TYPE_PID_T,
1052 [AC_CHECK_TYPE(pid_t, int)])
1054 AC_DEFUN(AC_TYPE_OFF_T,
1055 [AC_CHECK_TYPE(off_t, long)])
1057 AC_DEFUN(AC_TYPE_MODE_T,
1058 [AC_CHECK_TYPE(mode_t, int)])
1060 dnl Note that identifiers starting with SIG are reserved by ANSI C.
1061 AC_DEFUN(AC_TYPE_SIGNAL,
1062 [AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal,
1063 [AC_TRY_COMPILE([#include <sys/types.h>
1070 "C" void (*signal (int, void (*)(int)))(int);
1072 void (*signal ()) ();
1075 [int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)])
1076 AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal)
1080 dnl ### Checks for functions
1083 AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
1084 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
1085 AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
1086 [AC_TRY_RUN([#include <sys/types.h>
1087 #include <$ac_header_dirent>
1088 int closedir(); int main() { exit(closedir(opendir(".")) != 0); }],
1089 ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)])
1090 if test $ac_cv_func_closedir_void = yes; then
1091 AC_DEFINE(CLOSEDIR_VOID)
1095 AC_DEFUN(AC_FUNC_FNMATCH,
1096 [AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works,
1097 # Some versions of Solaris or SCO have a broken fnmatch function.
1098 # So we run a test program. If we are cross-compiling, take no chance.
1099 # Thanks to John Oleynick and Franc,ois Pinard for this test.
1100 [AC_TRY_RUN([int main() { exit (fnmatch ("a*", "abc", 0) != 0); }],
1101 ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no,
1102 ac_cv_func_fnmatch_works=no)])
1103 if test $ac_cv_func_fnmatch_works = yes; then
1104 AC_DEFINE(HAVE_FNMATCH)
1108 AC_DEFUN(AC_FUNC_MMAP,
1109 [AC_CHECK_HEADERS(unistd.h)
1110 AC_CHECK_FUNCS(getpagesize)
1111 AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
1113 /* Thanks to Mike Haertel and Jim Avera for this test.
1114 Here is a matrix of mmap possibilities:
1115 mmap private not fixed
1116 mmap private fixed at somewhere currently unmapped
1117 mmap private fixed at somewhere already mapped
1118 mmap shared not fixed
1119 mmap shared fixed at somewhere currently unmapped
1120 mmap shared fixed at somewhere already mapped
1121 For private mappings, we should verify that changes cannot be read()
1122 back from the file, nor mmap's back from the file at a different
1123 address. (There have been systems where private was not correctly
1124 implemented like the infamous i386 svr4.0, and systems where the
1125 VM page cache was not coherent with the filesystem buffer cache
1126 like early versions of FreeBSD and possibly contemporary NetBSD.)
1127 For shared mappings, we should conversely verify that changes get
1128 propogated back to all the places they're supposed to be.
1130 Grep wants private fixed already mapped.
1131 The main things grep needs to know about mmap are:
1132 * does it exist and is it safe to write into the mmap'd area
1133 * how to use it (BSD variants) */
1134 #include <sys/types.h>
1136 #include <sys/mman.h>
1138 /* This mess was copied from the GNU getpagesize.h. */
1139 #ifndef HAVE_GETPAGESIZE
1140 # ifdef HAVE_UNISTD_H
1141 # include <unistd.h>
1144 /* Assume that all systems that can run configure have sys/param.h. */
1145 # ifndef HAVE_SYS_PARAM_H
1146 # define HAVE_SYS_PARAM_H 1
1149 # ifdef _SC_PAGESIZE
1150 # define getpagesize() sysconf(_SC_PAGESIZE)
1151 # else /* no _SC_PAGESIZE */
1152 # ifdef HAVE_SYS_PARAM_H
1153 # include <sys/param.h>
1154 # ifdef EXEC_PAGESIZE
1155 # define getpagesize() EXEC_PAGESIZE
1156 # else /* no EXEC_PAGESIZE */
1158 # define getpagesize() NBPG * CLSIZE
1161 # endif /* no CLSIZE */
1162 # else /* no NBPG */
1164 # define getpagesize() NBPC
1165 # else /* no NBPC */
1167 # define getpagesize() PAGESIZE
1168 # endif /* PAGESIZE */
1169 # endif /* no NBPC */
1170 # endif /* no NBPG */
1171 # endif /* no EXEC_PAGESIZE */
1172 # else /* no HAVE_SYS_PARAM_H */
1173 # define getpagesize() 8192 /* punt totally */
1174 # endif /* no HAVE_SYS_PARAM_H */
1175 # endif /* no _SC_PAGESIZE */
1177 #endif /* no HAVE_GETPAGESIZE */
1180 extern "C" { void *malloc(unsigned); }
1188 char *data, *data2, *data3;
1192 pagesize = getpagesize();
1195 * First, make a file with some known garbage in it.
1197 data = malloc(pagesize);
1200 for (i = 0; i < pagesize; ++i)
1201 *(data + i) = rand();
1203 fd = creat("conftestmmap", 0600);
1206 if (write(fd, data, pagesize) != pagesize)
1211 * Next, try to mmap the file at a fixed address which
1212 * already has something else allocated at it. If we can,
1213 * also make sure that we see the same garbage.
1215 fd = open("conftestmmap", O_RDWR);
1218 data2 = malloc(2 * pagesize);
1221 data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
1222 if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
1223 MAP_PRIVATE | MAP_FIXED, fd, 0L))
1225 for (i = 0; i < pagesize; ++i)
1226 if (*(data + i) != *(data2 + i))
1230 * Finally, make sure that changes to the mapped area
1231 * do not percolate back to the file as seen by read().
1232 * (This is a bug on some variants of i386 svr4.0.)
1234 for (i = 0; i < pagesize; ++i)
1235 *(data2 + i) = *(data2 + i) + 1;
1236 data3 = malloc(pagesize);
1239 if (read(fd, data3, pagesize) != pagesize)
1241 for (i = 0; i < pagesize; ++i)
1242 if (*(data + i) != *(data3 + i))
1245 unlink("conftestmmap");
1248 ], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no,
1249 ac_cv_func_mmap_fixed_mapped=no)])
1250 if test $ac_cv_func_mmap_fixed_mapped = yes; then
1251 AC_DEFINE(HAVE_MMAP)
1255 AC_DEFUN(AC_FUNC_GETPGRP,
1256 [AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void,
1259 * If this system has a BSD-style getpgrp(),
1260 * which takes a pid argument, exit unsuccessfully.
1262 * Snarfed from Chet Ramey's bash pgrp.c test program
1265 #include <sys/types.h>
1268 int pg1, pg2, pg3, pg4;
1269 int ng, np, s, child;
1280 * If all of these values are the same, it's pretty sure that
1281 * we're on a system that ignores getpgrp's first argument.
1283 if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3)
1289 else if (child == 0) {
1292 * If this is Sys V, this will not work; pgrp will be
1293 * set to np because setpgrp just changes a pgrp to be
1294 * the same as the pid.
1297 ng = getpgrp(0); /* Same result for Sys V and BSD */
1308 ], ac_cv_func_getpgrp_void=yes, ac_cv_func_getpgrp_void=no,
1309 AC_MSG_ERROR(cannot check getpgrp if cross compiling))
1311 if test $ac_cv_func_getpgrp_void = yes; then
1312 AC_DEFINE(GETPGRP_VOID)
1316 AC_DEFUN(AC_FUNC_SETPGRP,
1317 [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
1319 #ifdef HAVE_UNISTD_H
1324 * If this system has a BSD-style setpgrp, which takes arguments, exit
1329 if (setpgrp(1,1) == -1)
1334 ], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
1335 AC_MSG_ERROR(cannot check setpgrp if cross compiling))
1337 if test $ac_cv_func_setpgrp_void = yes; then
1338 AC_DEFINE(SETPGRP_VOID)
1342 AC_DEFUN(AC_FUNC_VPRINTF,
1343 [AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
1344 if test "$ac_cv_func_vprintf" != yes; then
1345 AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))
1349 AC_DEFUN(AC_FUNC_VFORK,
1350 [AC_REQUIRE([AC_TYPE_PID_T])dnl
1351 AC_CHECK_HEADER(vfork.h, AC_DEFINE(HAVE_VFORK_H))
1352 AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
1353 [AC_TRY_RUN([/* Thanks to Paul Eggert for this test. */
1355 #include <sys/types.h>
1356 #include <sys/stat.h>
1357 #ifdef HAVE_UNISTD_H
1363 /* On some sparc systems, changes by the child to local and incoming
1364 argument registers are propagated back to the parent.
1365 The compiler is told about this with #include <vfork.h>,
1366 but some compilers (e.g. gcc -O) don't grok <vfork.h>.
1367 Test for this by using a static variable whose address
1368 is put into a register that is clobbered by the vfork. */
1371 sparc_address_test (int arg)
1373 sparc_address_test (arg) int arg;
1391 pid_t parent = getpid ();
1394 ((int (*)()) sparc_address_test) ();
1399 /* Here is another test for sparc vfork register problems.
1400 This test uses lots of local variables, at least
1401 as many local variables as main has allocated so far
1402 including compiler temporaries. 4 locals are enough for
1403 gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
1404 A buggy compiler should reuse the register of parent
1405 for one of the local variables, since it will think that
1406 parent can't possibly be used any more in this routine.
1407 Assigning to the local variable will thus munge parent
1408 in the parent process. */
1410 p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
1411 p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
1412 /* Convince the compiler that p..p7 are live; otherwise, it might
1413 use the same hardware register for all 8 local variables. */
1414 if (p != p1 || p != p2 || p != p3 || p != p4
1415 || p != p5 || p != p6 || p != p7)
1418 /* On some systems (e.g. IRIX 3.3),
1419 vfork doesn't separate parent from child file descriptors.
1420 If the child closes a descriptor before it execs or exits,
1421 this munges the parent's descriptor as well.
1422 Test for this by closing stdout in the child. */
1423 _exit(close(fileno(stdout)) != 0);
1428 while (wait(&status) != child)
1431 /* Was there some problem with vforking? */
1434 /* Did the child fail? (This shouldn't happen.) */
1437 /* Did the vfork/compiler bug occur? */
1438 || parent != getpid()
1440 /* Did the file descriptor bug occur? */
1441 || fstat(fileno(stdout), &st) != 0
1445 ac_cv_func_vfork_works=yes, ac_cv_func_vfork_works=no, AC_CHECK_FUNC(vfork)
1446 ac_cv_func_vfork_works=$ac_cv_func_vfork)])
1447 if test $ac_cv_func_vfork_works = no; then
1448 AC_DEFINE(vfork, fork)
1452 AC_DEFUN(AC_FUNC_WAIT3,
1453 [AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage,
1454 [AC_TRY_RUN([#include <sys/types.h>
1455 #include <sys/time.h>
1456 #include <sys/resource.h>
1458 /* HP-UX has wait3 but does not fill in rusage at all. */
1462 /* Use a field that we can force nonzero --
1463 voluntary context switches.
1464 For systems like NeXT and OSF/1 that don't set it,
1465 also use the system CPU time. And page faults (I/O) for Linux. */
1467 r.ru_stime.tv_sec = 0;
1468 r.ru_stime.tv_usec = 0;
1469 r.ru_majflt = r.ru_minflt = 0;
1471 case 0: /* Child. */
1472 sleep(1); /* Give up the CPU. */
1474 case -1: _exit(0); /* What can we do? */
1475 default: /* Parent. */
1477 sleep(2); /* Avoid "text file busy" from rm on fast HP-UX machines. */
1478 exit(r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0
1479 && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0);
1481 }], ac_cv_func_wait3_rusage=yes, ac_cv_func_wait3_rusage=no,
1482 ac_cv_func_wait3_rusage=no)])
1483 if test $ac_cv_func_wait3_rusage = yes; then
1484 AC_DEFINE(HAVE_WAIT3)
1488 AC_DEFUN(AC_FUNC_ALLOCA,
1489 [AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
1490 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
1491 # for constant arguments. Useless!
1492 AC_CACHE_CHECK([for working alloca.h], ac_cv_header_alloca_h,
1493 [AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
1494 ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)])
1495 if test $ac_cv_header_alloca_h = yes; then
1496 AC_DEFINE(HAVE_ALLOCA_H)
1499 AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
1502 # define alloca __builtin_alloca
1505 # include <malloc.h>
1506 # define alloca _alloca
1509 # include <alloca.h>
1514 # ifndef alloca /* predefined by HP cc +Olibcalls */
1521 ], [char *p = (char *) alloca(1);],
1522 ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)])
1523 if test $ac_cv_func_alloca_works = yes; then
1524 AC_DEFINE(HAVE_ALLOCA)
1527 if test $ac_cv_func_alloca_works = no; then
1528 # The SVR3 libPW and SVR4 libucb both contain incompatible functions
1529 # that cause trouble. Some versions do not even contain alloca or
1530 # contain a buggy version. If you still want to use their alloca,
1531 # use ar to extract alloca.o from them instead of compiling alloca.c.
1532 ALLOCA=alloca.${ac_objext}
1535 AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
1536 [AC_EGREP_CPP(webecray,
1537 [#if defined(CRAY) && ! defined(CRAY2)
1542 ], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
1543 if test $ac_cv_os_cray = yes; then
1544 for ac_func in _getb67 GETB67 getb67; do
1545 AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func)
1550 AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
1551 [AC_TRY_RUN([find_stack_direction ()
1553 static char *addr = 0;
1558 return find_stack_direction ();
1561 return (&dummy > addr) ? 1 : -1;
1565 exit (find_stack_direction() < 0);
1566 }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
1567 ac_cv_c_stack_direction=0)])
1568 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
1573 AC_DEFUN(AC_FUNC_GETLOADAVG,
1574 [ac_have_func=no # yes means we've found a way to get the load average.
1576 # Some systems with -lutil have (and need) -lkvm as well, some do not.
1577 # On Solaris, -lkvm requires nlist from -lelf, so check that first
1578 # to get the right answer into the cache.
1579 AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
1580 AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
1581 # Check for the 4.4BSD definition of getloadavg.
1582 AC_CHECK_LIB(util, getloadavg,
1583 [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
1585 if test $ac_have_func = no; then
1586 # There is a commonly available library for RS/6000 AIX.
1587 # Since it is not a standard part of AIX, it might be installed locally.
1588 ac_getloadavg_LIBS="$LIBS"; LIBS="-L/usr/local/lib $LIBS"
1589 AC_CHECK_LIB(getloadavg, getloadavg,
1590 LIBS="-lgetloadavg $LIBS", LIBS="$ac_getloadavg_LIBS")
1593 # Make sure it is really in the library, if we think we found it.
1594 AC_REPLACE_FUNCS(getloadavg)
1596 if test $ac_cv_func_getloadavg = yes; then
1597 AC_DEFINE(HAVE_GETLOADAVG)
1600 # Figure out what our getloadavg.c needs.
1602 AC_CHECK_HEADER(sys/dg_sys_info.h,
1603 [ac_have_func=yes; AC_DEFINE(DGUX)
1604 AC_CHECK_LIB(dgc, dg_sys_info)])
1606 # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
1607 # uses stabs), but it is still SVR4. We cannot check for <elf.h> because
1608 # Irix 4.0.5F has the header but not the library.
1609 if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then
1610 ac_have_func=yes; AC_DEFINE(SVR4)
1613 if test $ac_have_func = no; then
1614 AC_CHECK_HEADER(inq_stats/cpustats.h,
1615 [ac_have_func=yes; AC_DEFINE(UMAX)
1616 AC_DEFINE(UMAX4_3)])
1619 if test $ac_have_func = no; then
1620 AC_CHECK_HEADER(sys/cpustats.h,
1621 [ac_have_func=yes; AC_DEFINE(UMAX)])
1624 if test $ac_have_func = no; then
1625 AC_CHECK_HEADERS(mach/mach.h)
1628 AC_CHECK_HEADER(nlist.h,
1629 [AC_DEFINE(NLIST_STRUCT)
1630 AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
1631 [AC_TRY_COMPILE([#include <nlist.h>],
1632 [struct nlist n; n.n_un.n_name = 0;],
1633 ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
1634 if test $ac_cv_struct_nlist_n_un = yes; then
1635 AC_DEFINE(NLIST_NAME_UNION)
1638 fi # Do not have getloadavg in system libraries.
1640 # Some definitions of getloadavg require that the program be installed setgid.
1641 dnl FIXME Don't hardwire the path of getloadavg.c in the top-level directory.
1642 AC_CACHE_CHECK(whether getloadavg requires setgid,
1643 ac_cv_func_getloadavg_setgid,
1644 [AC_EGREP_CPP([Yowza Am I SETGID yet],
1645 [#include "$srcdir/getloadavg.c"
1646 #ifdef LDAV_PRIVILEGED
1647 Yowza Am I SETGID yet
1649 ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])
1650 if test $ac_cv_func_getloadavg_setgid = yes; then
1651 NEED_SETGID=true; AC_DEFINE(GETLOADAVG_PRIVILEGED)
1655 AC_SUBST(NEED_SETGID)dnl
1657 if test $ac_cv_func_getloadavg_setgid = yes; then
1658 AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem,
1660 # On Solaris, /dev/kmem is a symlink. Get info on the real file.
1661 ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
1662 # If we got an error (system does not support symlinks), try without -L.
1663 test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
1664 ac_cv_group_kmem=`echo $ac_ls_output \
1665 | sed -ne 's/[ ][ ]*/ /g;
1666 s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/;
1668 changequote([, ])dnl
1670 KMEM_GROUP=$ac_cv_group_kmem
1672 AC_SUBST(KMEM_GROUP)dnl
1675 AC_DEFUN(AC_FUNC_UTIME_NULL,
1676 [AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null,
1677 [rm -f conftestdata; > conftestdata
1678 # Sequent interprets utime(file, 0) to mean use start of epoch. Wrong.
1679 AC_TRY_RUN([#include <sys/types.h>
1680 #include <sys/stat.h>
1683 exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0
1684 && stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime
1685 && t.st_mtime - s.st_mtime < 120));
1686 }], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no,
1687 ac_cv_func_utime_null=no)
1689 if test $ac_cv_func_utime_null = yes; then
1690 AC_DEFINE(HAVE_UTIME_NULL)
1694 AC_DEFUN(AC_FUNC_STRCOLL,
1695 [AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,
1696 [AC_TRY_RUN([#include <string.h>
1699 exit (strcoll ("abc", "def") >= 0 ||
1700 strcoll ("ABC", "DEF") >= 0 ||
1701 strcoll ("123", "456") >= 0);
1702 }], ac_cv_func_strcoll_works=yes, ac_cv_func_strcoll_works=no,
1703 ac_cv_func_strcoll_works=no)])
1704 if test $ac_cv_func_strcoll_works = yes; then
1705 AC_DEFINE(HAVE_STRCOLL)
1709 AC_DEFUN(AC_FUNC_SETVBUF_REVERSED,
1710 [AC_CACHE_CHECK(whether setvbuf arguments are reversed,
1711 ac_cv_func_setvbuf_reversed,
1712 [AC_TRY_RUN([#include <stdio.h>
1713 /* If setvbuf has the reversed format, exit 0. */
1715 /* This call has the arguments reversed.
1716 A reversed system may check and see that the address of main
1717 is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */
1718 if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0)
1721 exit(0); /* Non-reversed systems segv here. */
1722 }], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no)
1724 if test $ac_cv_func_setvbuf_reversed = yes; then
1725 AC_DEFINE(SETVBUF_REVERSED)
1729 AC_DEFUN(AC_FUNC_GETMNTENT,
1730 [# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware.
1731 AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS",
1732 [AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS",
1733 [AC_CHECK_LIB(gen, getmntent, LIBS="-lgen $LIBS")])])
1734 AC_CHECK_FUNC(getmntent, [AC_DEFINE(HAVE_GETMNTENT)])])
1736 AC_DEFUN(AC_FUNC_STRFTIME,
1737 [AC_CHECK_FUNC(strftime, [AC_DEFINE(HAVE_STRFTIME)],
1738 [# strftime is in -lintl on SCO UNIX.
1739 AC_CHECK_LIB(intl, strftime,
1740 [AC_DEFINE(HAVE_STRFTIME)
1741 LIBS="-lintl $LIBS"])])])
1743 AC_DEFUN(AC_FUNC_MEMCMP,
1744 [AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean,
1748 char c0 = 0x40, c1 = 0x80, c2 = 0x81;
1749 exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
1751 ], ac_cv_func_memcmp_clean=yes, ac_cv_func_memcmp_clean=no,
1752 ac_cv_func_memcmp_clean=no)])
1753 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
1754 AC_SUBST(LIBOBJS)dnl
1757 AC_DEFUN(AC_FUNC_SELECT_ARGTYPES,
1758 [AC_MSG_CHECKING([types of arguments for select()])
1759 AC_CACHE_VAL(ac_cv_func_select_arg234,dnl
1760 [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl
1761 [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl
1762 [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
1763 for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
1764 for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
1766 [#ifdef HAVE_SYS_TYPES_H
1767 #include <sys/types.h>
1769 #ifdef HAVE_SYS_TIME_H
1770 #include <sys/time.h>
1772 #ifdef HAVE_SYS_SELECT_H
1773 #include <sys/select.h>
1775 #ifdef HAVE_SYS_SOCKET_H
1776 #include <sys/socket.h>
1778 extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl
1779 [ac_not_found=no ; break 3],ac_not_found=yes)
1786 if test "$ac_not_found" = yes; then
1787 ac_cv_func_select_arg1=int
1788 ac_cv_func_select_arg234='int *'
1789 ac_cv_func_select_arg5='struct timeval *'
1791 AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5])
1792 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1)
1793 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234))
1794 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5))
1798 dnl ### Checks for structure members
1801 AC_DEFUN(AC_HEADER_TIME,
1802 [AC_CACHE_CHECK([whether time.h and sys/time.h may both be included],
1804 [AC_TRY_COMPILE([#include <sys/types.h>
1805 #include <sys/time.h>
1807 [struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])
1808 if test $ac_cv_header_time = yes; then
1809 AC_DEFINE(TIME_WITH_SYS_TIME)
1813 AC_DEFUN(AC_STRUCT_TM,
1814 [AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h],
1816 [AC_TRY_COMPILE([#include <sys/types.h>
1818 [struct tm *tp; tp->tm_sec;],
1819 ac_cv_struct_tm=time.h, ac_cv_struct_tm=sys/time.h)])
1820 if test $ac_cv_struct_tm = sys/time.h; then
1821 AC_DEFINE(TM_IN_SYS_TIME)
1825 AC_DEFUN(AC_STRUCT_TIMEZONE,
1826 [AC_REQUIRE([AC_STRUCT_TM])dnl
1827 AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
1828 [AC_TRY_COMPILE([#include <sys/types.h>
1829 #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
1830 ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
1831 if test "$ac_cv_struct_tm_zone" = yes; then
1832 AC_DEFINE(HAVE_TM_ZONE)
1834 AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
1836 changequote(<<, >>)dnl
1838 #ifndef tzname /* For SGI. */
1839 extern char *tzname[]; /* RS6000 and others reject char **tzname. */
1841 changequote([, ])dnl
1842 [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
1843 if test $ac_cv_var_tzname = yes; then
1844 AC_DEFINE(HAVE_TZNAME)
1849 AC_DEFUN(AC_STRUCT_ST_BLOCKS,
1850 [AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
1851 [AC_TRY_COMPILE([#include <sys/types.h>
1852 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
1853 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
1854 if test $ac_cv_struct_st_blocks = yes; then
1855 AC_DEFINE(HAVE_ST_BLOCKS)
1857 LIBOBJS="$LIBOBJS fileblocks.${ac_objext}"
1859 AC_SUBST(LIBOBJS)dnl
1862 AC_DEFUN(AC_STRUCT_ST_BLKSIZE,
1863 [AC_CACHE_CHECK([for st_blksize in struct stat], ac_cv_struct_st_blksize,
1864 [AC_TRY_COMPILE([#include <sys/types.h>
1865 #include <sys/stat.h>], [struct stat s; s.st_blksize;],
1866 ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)])
1867 if test $ac_cv_struct_st_blksize = yes; then
1868 AC_DEFINE(HAVE_ST_BLKSIZE)
1872 AC_DEFUN(AC_STRUCT_ST_RDEV,
1873 [AC_CACHE_CHECK([for st_rdev in struct stat], ac_cv_struct_st_rdev,
1874 [AC_TRY_COMPILE([#include <sys/types.h>
1875 #include <sys/stat.h>], [struct stat s; s.st_rdev;],
1876 ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)])
1877 if test $ac_cv_struct_st_rdev = yes; then
1878 AC_DEFINE(HAVE_ST_RDEV)
1883 dnl ### Checks for compiler characteristics
1886 AC_DEFUN(AC_C_CROSS,
1887 [AC_OBSOLETE([$0], [; it has been merged into AC_PROG_CC])])
1889 AC_DEFUN(AC_C_CHAR_UNSIGNED,
1890 [AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned,
1891 [if test "$GCC" = yes; then
1892 # GCC predefines this symbol on systems where it applies.
1894 [#ifdef __CHAR_UNSIGNED__
1897 ], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)
1900 [/* volatile prevents gcc2 from optimizing the test away on sparcs. */
1901 #if !defined(__STDC__) || __STDC__ != 1
1905 volatile char c = 255; exit(c < 0);
1906 }], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)
1908 if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
1909 AC_DEFINE(__CHAR_UNSIGNED__)
1913 AC_DEFUN(AC_C_LONG_DOUBLE,
1914 [AC_CACHE_CHECK(for long double, ac_cv_c_long_double,
1915 [if test "$GCC" = yes; then
1916 ac_cv_c_long_double=yes
1918 AC_TRY_RUN([int main() {
1919 /* The Stardent Vistra knows sizeof(long double), but does not support it. */
1920 long double foo = 0.0;
1921 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
1922 exit(sizeof(long double) < sizeof(double)); }],
1923 ac_cv_c_long_double=yes, ac_cv_c_long_double=no)
1925 if test $ac_cv_c_long_double = yes; then
1926 AC_DEFINE(HAVE_LONG_DOUBLE)
1930 AC_DEFUN(AC_INT_16_BITS,
1931 [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(int)])dnl
1932 AC_MSG_CHECKING(whether int is 16 bits)
1933 AC_TRY_RUN([int main() { exit(sizeof(int) != 2); }],
1935 AC_DEFINE(INT_16_BITS)], AC_MSG_RESULT(no))
1938 AC_DEFUN(AC_LONG_64_BITS,
1939 [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(long)])dnl
1940 AC_MSG_CHECKING(whether long int is 64 bits)
1941 AC_TRY_RUN([int main() { exit(sizeof(long int) != 8); }],
1943 AC_DEFINE(LONG_64_BITS)], AC_MSG_RESULT(no))
1946 AC_DEFUN(AC_C_BIGENDIAN,
1947 [AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
1948 [ac_cv_c_bigendian=unknown
1949 # See if sys/param.h defines the BYTE_ORDER macro.
1950 AC_TRY_COMPILE([#include <sys/types.h>
1951 #include <sys/param.h>], [
1952 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
1954 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
1955 AC_TRY_COMPILE([#include <sys/types.h>
1956 #include <sys/param.h>], [
1957 #if BYTE_ORDER != BIG_ENDIAN
1959 #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
1960 if test $ac_cv_c_bigendian = unknown; then
1961 AC_TRY_RUN([int main () {
1962 /* Are we little or big endian? From Harbison&Steele. */
1966 char c[sizeof (long)];
1969 exit (u.c[sizeof (long) - 1] == 1);
1970 }], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes)
1972 if test $ac_cv_c_bigendian = yes; then
1973 AC_DEFINE(WORDS_BIGENDIAN)
1977 dnl Do nothing if the compiler accepts the inline keyword.
1978 dnl Otherwise define inline to __inline__ or __inline if one of those work,
1979 dnl otherwise define inline to be empty.
1980 AC_DEFUN(AC_C_INLINE,
1981 [AC_CACHE_CHECK([for inline], ac_cv_c_inline,
1983 for ac_kw in inline __inline__ __inline; do
1984 AC_TRY_COMPILE(, [} $ac_kw foo() {], [ac_cv_c_inline=$ac_kw; break])
1987 case "$ac_cv_c_inline" in
1989 no) AC_DEFINE(inline, ) ;;
1990 *) AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;;
1994 AC_DEFUN(AC_C_CONST,
1995 [dnl This message is consistent in form with the other checking messages,
1996 dnl and with the result message.
1997 AC_CACHE_CHECK([for working const], ac_cv_c_const,
1999 changequote(<<, >>)dnl
2002 /* Ultrix mips cc rejects this. */
2003 typedef int charset[2]; const charset x;
2005 /* SunOS 4.1.1 cc rejects this. */
2006 char const *const *ccp;
2008 /* NEC SVR4.0.2 mips cc rejects this. */
2009 struct point {int x, y;};
2010 static struct point const zero = {0,0};
2011 /* AIX XL C 1.02.0.0 rejects this.
2012 It does not let you subtract one const X* pointer from another in an arm
2013 of an if-expression whose if-part is not a constant expression */
2014 const char *g = "string";
2015 ccp = &g + (g ? g-g : 0);
2016 /* HPUX 7.0 cc rejects these. */
2019 ccp = (char const *const *) p;
2020 { /* SCO 3.2v4 cc rejects this. */
2022 char const *s = 0 ? (char *) 0 : (char const *) 0;
2026 { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
2028 const int *foo = &x[0];
2031 { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
2032 typedef const int *iptr;
2036 { /* AIX XL C 1.02.0.0 rejects this saying
2037 "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
2038 struct s { int j; const int *ap[3]; };
2039 struct s *b; b->j = 5;
2041 { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
2045 changequote([, ])dnl
2046 ac_cv_c_const=yes, ac_cv_c_const=no)])
2047 if test $ac_cv_c_const = no; then
2052 AC_DEFUN(AC_C_STRINGIZE, [
2053 AC_REQUIRE([AC_PROG_CPP])
2054 AC_MSG_CHECKING([for preprocessor stringizing operator])
2055 AC_CACHE_VAL(ac_cv_c_stringize,
2056 AC_EGREP_CPP([#teststring],[
2059 char *s = x(teststring);
2060 ], ac_cv_c_stringize=no, ac_cv_c_stringize=yes))
2061 if test "${ac_cv_c_stringize}" = yes
2063 AC_DEFINE(HAVE_STRINGIZE)
2065 AC_MSG_RESULT([${ac_cv_c_stringize}])
2068 define(AC_ARG_ARRAY,
2069 [errprint(__file__:__line__: [$0] has been removed; don't do unportable things with arguments
2072 dnl Check the object extension used by the compiler: typically .o or
2073 dnl .obj. If this is called, some other behaviour will change,
2074 dnl determined by ac_objext.
2076 [AC_MSG_CHECKING([for object suffix])
2077 AC_CACHE_VAL(ac_cv_objext,
2079 echo 'int i = 1;' > conftest.$ac_ext
2080 if AC_TRY_EVAL(ac_compile); then
2081 for ac_file in conftest.*; do
2084 *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
2088 AC_MSG_ERROR([installation or configuration problem; compiler does not work])
2091 AC_MSG_RESULT($ac_cv_objext)
2092 OBJEXT=$ac_cv_objext
2093 ac_objext=$ac_cv_objext
2096 dnl Determine the linker flags (e.g. `-L' and `-l') for the Fortran 77
2097 dnl intrinsic and run-time libraries that are required to successfully
2098 dnl link a Fortran 77 program or shared library. The output variable
2099 dnl FLIBS is set to these flags.
2101 dnl This macro is intended to be used in those situations when it is
2102 dnl necessary to mix, e.g. C++ and Fortran 77, source code into a single
2103 dnl program or shared library.
2105 dnl For example, if object files from a C++ and Fortran 77 compiler must
2106 dnl be linked together, then the C++ compiler/linker must be used for
2107 dnl linking (since special C++-ish things need to happen at link time
2108 dnl like calling global constructors, instantiating templates, enabling
2109 dnl exception support, etc.).
2111 dnl However, the Fortran 77 intrinsic and run-time libraries must be
2112 dnl linked in as well, but the C++ compiler/linker doesn't know how to
2113 dnl add these Fortran 77 libraries. Hence, the macro
2114 dnl `AC_F77_LIBRARY_LDFLAGS' was created to determine these Fortran 77
2117 dnl This macro was packaged in its current form by Matthew D. Langston
2118 dnl <langston@SLAC.Stanford.EDU>. However, nearly all of this macro
2119 dnl came from the `OCTAVE_FLIBS' macro in `octave-2.0.13/aclocal.m4',
2120 dnl and full credit should go to John W. Eaton for writing this
2121 dnl extremely useful macro. Thank you John.
2123 dnl AC_F77_LIBRARY_LDFLAGS()
2124 AC_DEFUN(AC_F77_LIBRARY_LDFLAGS,
2125 [AC_MSG_CHECKING([for Fortran 77 libraries])
2126 AC_REQUIRE([AC_PROG_F77])
2127 AC_REQUIRE([AC_CANONICAL_HOST])
2128 AC_CACHE_VAL(ac_cv_flibs,
2130 dnl Write a minimal program and compile it with -v. I don't know what
2131 dnl to do if your compiler doesn't have -v...
2132 echo " END" > conftest.f
2133 foutput=`${F77} -v -o conftest conftest.f 2>&1`
2135 dnl The easiest thing to do for xlf output is to replace all the commas
2136 dnl with spaces. Try to only do that if the output is really from xlf,
2137 dnl since doing that causes problems on other systems.
2139 xlf_p=`echo $foutput | grep xlfentry`
2140 if test -n "$xlf_p"; then
2141 foutput=`echo $foutput | sed 's/,/ /g'`
2144 ld_run_path=`echo $foutput | \
2145 sed -n -e 's/^.*LD_RUN_PATH *= *\([^ ]*\).*/\1/p'`
2147 dnl We are only supposed to find this on Solaris systems...
2148 dnl Uh, the run path should be absolute, shouldn't it?
2150 case "$ld_run_path" in
2152 if test "$ac_cv_prog_gcc" = yes; then
2153 ld_run_path="-Xlinker -R -Xlinker $ld_run_path"
2155 ld_run_path="-R $ld_run_path"
2166 dnl If want_arg is set, we know we want the arg to be added to the list,
2167 dnl so we don't have to examine it.
2171 for arg in $foutput; do
2172 old_want_arg=$want_arg
2175 dnl None of the options that take arguments expect the argument to
2176 dnl start with a -, so pretend we didn't see anything special.
2178 if test -n "$old_want_arg"; then
2185 case "$old_want_arg" in
2190 for f in $lflags; do
2191 if test x$arg = x$f; then
2198 lflags="$lflags $arg"
2203 for f in $lflags; do
2204 if test x$arg = x$f; then
2211 if test "$ac_cv_prog_gcc" = yes; then
2212 lflags="$lflags -Xlinker $arg"
2214 lflags="$lflags $arg"
2218 -lang* | -lcrt0.o | -lc | -lgcc)
2227 for f in $lflags; do
2228 if test x$arg = x$f; then
2237 case "$canonical_host_type" in
2242 lflags="$lflags $arg"
2249 lflags="$lflags $arg"
2268 arg="$old_want_arg $arg"
2275 dnl Should probably try to ensure unique directory options here too.
2276 dnl This probably only applies to Solaris systems, and then will only
2277 dnl work with gcc...
2279 arg=`echo $arg | sed -e 's%^P,%%'`
2291 if test -n "$arg"; then
2295 if test -n "$ld_run_path"; then
2296 flibs_result="$ld_run_path $flibs"
2298 flibs_result="$flibs"
2300 changequote([, ])dnl
2301 ac_cv_flibs="$flibs_result"])
2302 FLIBS="$ac_cv_flibs"
2304 AC_MSG_RESULT($FLIBS)
2308 dnl ### Checks for operating system services
2311 AC_DEFUN(AC_SYS_INTERPRETER,
2312 [# Pull the hash mark out of the macro call to avoid m4 problems.
2313 ac_msg="whether #! works in shell scripts"
2314 AC_CACHE_CHECK($ac_msg, ac_cv_sys_interpreter,
2319 (SHELL=/bin/sh; export SHELL; ./conftest >/dev/null)
2320 if test $? -ne 69; then
2321 ac_cv_sys_interpreter=yes
2323 ac_cv_sys_interpreter=no
2326 interpval="$ac_cv_sys_interpreter"
2329 define(AC_HAVE_POUNDBANG,
2330 [errprint(__file__:__line__: [$0 has been replaced by AC_SYS_INTERPRETER, taking no arguments
2333 AC_DEFUN(AC_SYS_LONG_FILE_NAMES,
2334 [AC_CACHE_CHECK(for long file names, ac_cv_sys_long_file_names,
2335 [ac_cv_sys_long_file_names=yes
2336 # Test for long file names in all the places we know might matter:
2337 # . the current directory, where building will happen
2338 # $prefix/lib where we will be installing things
2339 # $exec_prefix/lib likewise
2340 # eval it to expand exec_prefix.
2341 # $TMPDIR if set, where it might want to write temporary files
2342 # if $TMPDIR is not set:
2343 # /tmp where it might want to write temporary files
2346 if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then
2347 ac_tmpdirs="$TMPDIR"
2349 ac_tmpdirs='/tmp /var/tmp /usr/tmp'
2351 for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do
2352 test -d $ac_dir || continue
2353 test -w $ac_dir || continue # It is less confusing to not echo anything here.
2354 (echo 1 > $ac_dir/conftest9012345) 2>/dev/null
2355 (echo 2 > $ac_dir/conftest9012346) 2>/dev/null
2356 val=`cat $ac_dir/conftest9012345 2>/dev/null`
2357 if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then
2358 ac_cv_sys_long_file_names=no
2359 rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null
2362 rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null
2364 if test $ac_cv_sys_long_file_names = yes; then
2365 AC_DEFINE(HAVE_LONG_FILE_NAMES)
2369 AC_DEFUN(AC_SYS_RESTARTABLE_SYSCALLS,
2370 [AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls,
2372 [/* Exit 0 (true) if wait returns something other than -1,
2373 i.e. the pid of the child, which means that wait was restarted
2374 after getting the signal. */
2375 #include <sys/types.h>
2379 int i = fork (), status;
2380 if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); }
2381 signal (SIGINT, ucatch);
2383 if (status == -1) wait(&i);
2384 exit (status == -1);
2386 ], ac_cv_sys_restartable_syscalls=yes, ac_cv_sys_restartable_syscalls=no)])
2387 if test $ac_cv_sys_restartable_syscalls = yes; then
2388 AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS)
2393 [AC_REQUIRE_CPP()dnl Set CPP; we run AC_PATH_X_DIRECT conditionally.
2394 # If we find X, set shell vars x_includes and x_libraries to the
2395 # paths, otherwise set no_x=yes.
2396 # Uses ac_ vars as temps to allow command line to override cache and checks.
2397 # --without-x overrides everything else, but does not touch the cache.
2398 AC_MSG_CHECKING(for X)
2400 AC_ARG_WITH(x, [ --with-x use the X Window System])
2401 # $have_x is `yes', `no', `disabled', or empty when we do not yet know.
2402 if test "x$with_x" = xno; then
2403 # The user explicitly disabled X.
2406 if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
2407 # Both variables are already set.
2410 AC_CACHE_VAL(ac_cv_have_x,
2411 [# One or both of the vars are not set, and there is no cached value.
2412 ac_x_includes=NO ac_x_libraries=NO
2415 if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
2416 # Didn't find X anywhere. Cache the known absence of X.
2417 ac_cv_have_x="have_x=no"
2419 # Record where we found X for the cache.
2420 ac_cv_have_x="have_x=yes \
2421 ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
2424 eval "$ac_cv_have_x"
2427 if test "$have_x" != yes; then
2428 AC_MSG_RESULT($have_x)
2431 # If each of the values was on the command line, it overrides each guess.
2432 test "x$x_includes" = xNONE && x_includes=$ac_x_includes
2433 test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
2434 # Update the cache value to reflect the command line values.
2435 ac_cv_have_x="have_x=yes \
2436 ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
2437 AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
2441 dnl Internal subroutine of AC_PATH_X.
2442 dnl Set ac_x_includes and/or ac_x_libraries.
2443 AC_DEFUN(AC_PATH_X_XMKMF,
2445 if mkdir conftestdir; then
2447 # Make sure to not put "make" in the Imakefile rules, since we grep it out.
2448 cat > Imakefile <<'EOF'
2450 @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
2452 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
2453 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
2454 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
2455 # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
2456 for ac_extension in a so sl; do
2457 if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
2458 test -f $ac_im_libdir/libX11.$ac_extension; then
2459 ac_im_usrlibdir=$ac_im_libdir; break
2462 # Screen out bogus values from the imake configuration. They are
2463 # bogus both because they are the default anyway, and because
2464 # using them would break gcc on systems where it needs fixed includes.
2465 case "$ac_im_incroot" in
2467 *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
2469 case "$ac_im_usrlibdir" in
2471 *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
2479 dnl Internal subroutine of AC_PATH_X.
2480 dnl Set ac_x_includes and/or ac_x_libraries.
2481 AC_DEFUN(AC_PATH_X_DIRECT,
2482 [if test "$ac_x_includes" = NO; then
2483 # Guess where to find include files, by looking for this one X11 .h file.
2484 test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
2486 # First, try using that file with no special directory specified.
2487 AC_TRY_CPP([#include <$x_direct_test_include>],
2488 [# We can compile using X headers with no special include directory.
2490 [# Look for the header file in a standard set of common directories.
2491 # Check X11 before X11Rn because it is often a symlink to the current release.
2494 /usr/X11R6/include \
2495 /usr/X11R5/include \
2496 /usr/X11R4/include \
2499 /usr/include/X11R6 \
2500 /usr/include/X11R5 \
2501 /usr/include/X11R4 \
2503 /usr/local/X11/include \
2504 /usr/local/X11R6/include \
2505 /usr/local/X11R5/include \
2506 /usr/local/X11R4/include \
2508 /usr/local/include/X11 \
2509 /usr/local/include/X11R6 \
2510 /usr/local/include/X11R5 \
2511 /usr/local/include/X11R4 \
2515 /usr/XFree86/include/X11 \
2518 /usr/local/include \
2519 /usr/unsupported/include \
2520 /usr/athena/include \
2521 /usr/local/x11r5/include \
2522 /usr/lpp/Xamples/include \
2524 /usr/openwin/include \
2525 /usr/openwin/share/include \
2528 if test -r "$ac_dir/$x_direct_test_include"; then
2529 ac_x_includes=$ac_dir
2533 fi # $ac_x_includes = NO
2535 if test "$ac_x_libraries" = NO; then
2536 # Check for the libraries.
2538 test -z "$x_direct_test_library" && x_direct_test_library=Xt
2539 test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
2541 # See if we find them without any special options.
2542 # Don't add to $LIBS permanently.
2543 ac_save_LIBS="$LIBS"
2544 LIBS="-l$x_direct_test_library $LIBS"
2545 AC_TRY_LINK(, [${x_direct_test_function}()],
2546 [LIBS="$ac_save_LIBS"
2547 # We can link X programs with no special library path.
2549 [LIBS="$ac_save_LIBS"
2550 # First see if replacing the include by lib works.
2551 # Check X11 before X11Rn because it is often a symlink to the current release.
2552 for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
2563 /usr/local/X11/lib \
2564 /usr/local/X11R6/lib \
2565 /usr/local/X11R5/lib \
2566 /usr/local/X11R4/lib \
2568 /usr/local/lib/X11 \
2569 /usr/local/lib/X11R6 \
2570 /usr/local/lib/X11R5 \
2571 /usr/local/lib/X11R4 \
2575 /usr/XFree86/lib/X11 \
2579 /usr/unsupported/lib \
2581 /usr/local/x11r5/lib \
2582 /usr/lpp/Xamples/lib \
2586 /usr/openwin/share/lib \
2589 dnl Don't even attempt the hair of trying to link an X program!
2590 for ac_extension in a so sl; do
2591 if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
2592 ac_x_libraries=$ac_dir
2597 fi # $ac_x_libraries = NO
2600 dnl Find additional X libraries, magic flags, etc.
2601 AC_DEFUN(AC_PATH_XTRA,
2602 [AC_REQUIRE([AC_PATH_X])dnl
2603 if test "$no_x" = yes; then
2604 # Not all programs may use this symbol, but it does not hurt to define it.
2605 AC_DEFINE(X_DISPLAY_MISSING)
2606 X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
2608 if test -n "$x_includes"; then
2609 X_CFLAGS="$X_CFLAGS -I$x_includes"
2612 # It would also be nice to do this for all -L options, not just this one.
2613 if test -n "$x_libraries"; then
2614 X_LIBS="$X_LIBS -L$x_libraries"
2615 dnl FIXME banish uname from this macro!
2616 # For Solaris; some versions of Sun CC require a space after -R and
2617 # others require no space. Words are not sufficient . . . .
2618 case "`(uname -sr) 2>/dev/null`" in
2620 AC_MSG_CHECKING(whether -R must be followed by a space)
2621 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
2622 AC_TRY_LINK(, , ac_R_nospace=yes, ac_R_nospace=no)
2623 if test $ac_R_nospace = yes; then
2625 X_LIBS="$X_LIBS -R$x_libraries"
2627 LIBS="$ac_xsave_LIBS -R $x_libraries"
2628 AC_TRY_LINK(, , ac_R_space=yes, ac_R_space=no)
2629 if test $ac_R_space = yes; then
2631 X_LIBS="$X_LIBS -R $x_libraries"
2633 AC_MSG_RESULT(neither works)
2636 LIBS="$ac_xsave_LIBS"
2640 # Check for system-dependent libraries X programs must link with.
2641 # Do this before checking for the system-independent R6 libraries
2642 # (-lICE), since we may need -lsocket or whatever for X linking.
2644 if test "$ISC" = yes; then
2645 X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
2647 # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
2648 # libraries were built with DECnet support. And karl@cs.umb.edu says
2649 # the Alpha needs dnet_stub (dnet does not exist).
2650 AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
2651 if test $ac_cv_lib_dnet_dnet_ntoa = no; then
2652 AC_CHECK_LIB(dnet_stub, dnet_ntoa,
2653 [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
2656 # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
2657 # to get the SysV transport functions.
2658 # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4)
2660 # The nsl library prevents programs from opening the X display
2661 # on Irix 5.2, according to dickey@clark.net.
2662 AC_CHECK_FUNC(gethostbyname)
2663 if test $ac_cv_func_gethostbyname = no; then
2664 AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
2667 # lieder@skyler.mavd.honeywell.com says without -lsocket,
2668 # socket/setsockopt and other routines are undefined under SCO ODT
2669 # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
2670 # on later versions), says simon@lia.di.epfl.ch: it contains
2671 # gethostby* variants that don't use the nameserver (or something).
2672 # -lsocket must be given before -lnsl if both are needed.
2673 # We assume that if connect needs -lnsl, so does gethostbyname.
2674 AC_CHECK_FUNC(connect)
2675 if test $ac_cv_func_connect = no; then
2676 AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
2680 # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
2681 AC_CHECK_FUNC(remove)
2682 if test $ac_cv_func_remove = no; then
2683 AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
2686 # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
2687 AC_CHECK_FUNC(shmat)
2688 if test $ac_cv_func_shmat = no; then
2689 AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
2693 # Check for libraries that X11R6 Xt/Xaw programs need.
2694 ac_save_LDFLAGS="$LDFLAGS"
2695 test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
2696 # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
2697 # check for ICE first), but we must link in the order -lSM -lICE or
2698 # we get undefined symbols. So assume we have SM if we have ICE.
2699 # These have to be linked with before -lX11, unlike the other
2700 # libraries we check for below, so use a different variable.
2701 # --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
2702 AC_CHECK_LIB(ICE, IceConnectionNumber,
2703 [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"], , $X_EXTRA_LIBS)
2704 LDFLAGS="$ac_save_LDFLAGS"
2707 AC_SUBST(X_CFLAGS)dnl
2708 AC_SUBST(X_PRE_LIBS)dnl
2710 AC_SUBST(X_EXTRA_LIBS)dnl
2713 dnl The old Cygwin32 macro is deprecated.
2714 AC_DEFUN(AC_CYGWIN32,
2715 [AC_OBSOLETE([$0], [; instead use AC_CYGWIN])dnl
2718 dnl Check for Cygwin. This is a way to set the right value for
2721 [AC_CACHE_CHECK(for Cygwin environment, ac_cv_cygwin,
2724 #define __CYGWIN__ __CYGWIN32__
2726 return __CYGWIN__;],
2727 ac_cv_cygwin=yes, ac_cv_cygwin=no)
2730 test "$ac_cv_cygwin" = yes && CYGWIN=yes])
2732 dnl Check for mingw32. This is another way to set the right value for
2734 AC_DEFUN(AC_MINGW32,
2735 [AC_CACHE_CHECK(for mingw32 environment, ac_cv_mingw32,
2736 [AC_TRY_COMPILE(,[return __MINGW32__;],
2737 ac_cv_mingw32=yes, ac_cv_mingw32=no)
2740 test "$ac_cv_mingw32" = yes && MINGW32=yes])
2742 dnl Check for the extension used for executables. This knows that we
2743 dnl add .exe for Cygwin or mingw32. Otherwise, it compiles a test
2744 dnl executable. If this is called, the executable extensions will be
2745 dnl automatically used by link commands run by the configure script.
2747 [AC_REQUIRE([AC_CYGWIN])
2748 AC_REQUIRE([AC_MINGW32])
2749 AC_MSG_CHECKING([for executable suffix])
2750 AC_CACHE_VAL(ac_cv_exeext,
2751 [if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
2755 echo 'int main () { return 0; }' > conftest.$ac_ext
2757 if AC_TRY_EVAL(ac_link); then
2758 for file in conftest.*; do
2760 *.c | *.o | *.obj) ;;
2761 *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
2765 AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.])
2768 test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
2771 test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
2772 AC_MSG_RESULT(${ac_cv_exeext})
2773 dnl Setting ac_exeext will implicitly change the ac_link command.
2778 dnl ### Checks for UNIX variants
2779 dnl These are kludges which should be replaced by a single POSIX check.
2780 dnl They aren't cached, to discourage their use.
2784 [AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
2785 AC_BEFORE([$0], [AC_TRY_RUN])dnl
2786 AC_MSG_CHECKING(for AIX)
2787 AC_CACHE_VAL(ac_cv_sys_aix,[
2792 ], [ac_cv_sys_aix=yes], [ac_cv_sys_aix=no])])
2793 AC_MSG_RESULT($ac_cv_sys_aix)
2794 if test $ac_cv_sys_aix = yes; then
2795 AC_DEFINE(_ALL_SOURCE)
2800 [AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
2801 AC_BEFORE([$0], [AC_TRY_RUN])dnl
2802 AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=)
2803 if test "$MINIX" = yes; then
2804 AC_DEFINE(_POSIX_SOURCE)
2805 AC_DEFINE(_POSIX_1_SOURCE, 2)
2810 AC_DEFUN(AC_ISC_POSIX,
2811 [AC_REQUIRE([AC_PROG_CC])dnl
2812 AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
2813 AC_BEFORE([$0], [AC_TRY_RUN])dnl
2814 AC_MSG_CHECKING(for POSIXized ISC)
2815 AC_CACHE_VAL(ac_cv_sys_isc_posix,[
2816 if test -d /etc/conf/kconfig.d &&
2817 grep _POSIX_VERSION [/usr/include/sys/unistd.h] >/dev/null 2>&1
2819 ac_cv_sys_isc_posix=yes
2821 ac_cv_sys_isc_posix=no
2824 AC_MSG_RESULT($ac_cv_sys_isc_posix)
2825 if test $ac_cv_sys_isc_posix = yes; then
2826 ISC=yes # If later tests want to check for ISC.
2827 AC_DEFINE(_POSIX_SOURCE)
2828 if test "$GCC" = yes; then
2838 AC_DEFUN(AC_XENIX_DIR,
2839 [AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl
2840 AC_REQUIRE([AC_DIR_HEADER])dnl
2841 AC_MSG_CHECKING(for Xenix)
2843 [#if defined(M_XENIX) && !defined(M_UNIX)
2846 ], [AC_MSG_RESULT(yes); XENIX=yes], [AC_MSG_RESULT(no); XENIX=])
2847 if test "$XENIX" = yes; then
2848 # Make sure -ldir precedes -lx.
2849 test $ac_header_dirent = dirent.h && LIBS="-ldir $LIBS"
2854 AC_DEFUN(AC_DYNIX_SEQ,
2855 [AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT])dnl
2856 AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS")
2859 AC_DEFUN(AC_IRIX_SUN,
2860 [AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT or AC_CHECK_LIB(sun, getpwnam)])dnl
2861 AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS")
2864 AC_DEFUN(AC_SCO_INTL,
2865 [AC_OBSOLETE([$0], [; instead use AC_FUNC_STRFTIME])dnl
2866 AC_CHECK_LIB(intl, strftime, LIBS="-lintl $LIBS")