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.
52 dnl ### Checks for programs
55 dnl Check whether to use -n, \c, or newline-tab to separate
56 dnl checking messages from result messages.
57 dnl Idea borrowed from dist 3.0.
58 dnl Internal use only.
59 AC_DEFUN(AC_PROG_ECHO_N,
60 [if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
61 # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
62 if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
74 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
75 AC_CHECK_PROG(CC, gcc, gcc)
76 if test -z "$CC"; then
77 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
78 if test -z "$CC"; then
81 AC_CHECK_PROG(CC, cl, cl) ;;
84 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
90 if test $ac_cv_prog_gcc = yes; then
96 dnl Check whether -g works, even if CFLAGS is set, in case the package
97 dnl plays around with CFLAGS (such as to build both debugging and
98 dnl normal versions of a library), tasteless as that idea is.
99 ac_test_CFLAGS="${CFLAGS+set}"
100 ac_save_CFLAGS="$CFLAGS"
103 if test "$ac_test_CFLAGS" = set; then
104 CFLAGS="$ac_save_CFLAGS"
105 elif test $ac_cv_prog_cc_g = yes; then
106 if test "$GCC" = yes; then
112 if test "$GCC" = yes; then
120 AC_DEFUN(AC_PROG_CXX,
121 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
122 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, gcc)
127 if test $ac_cv_prog_gxx = yes; then
133 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
134 dnl plays around with CXXFLAGS (such as to build both debugging and
135 dnl normal versions of a library), tasteless as that idea is.
136 ac_test_CXXFLAGS="${CXXFLAGS+set}"
137 ac_save_CXXFLAGS="$CXXFLAGS"
140 if test "$ac_test_CXXFLAGS" = set; then
141 CXXFLAGS="$ac_save_CXXFLAGS"
142 elif test $ac_cv_prog_cxx_g = yes; then
143 if test "$GXX" = yes; then
149 if test "$GXX" = yes; then
156 AC_PROG_CXX_EXIT_DECLARATION
160 # AC_PROG_CXX_EXIT_DECLARATION
161 # -----------------------------
162 # Find a valid prototype for exit and declare it in confdefs.h.
163 AC_DEFUN(AC_PROG_CXX_EXIT_DECLARATION,
164 [for ac_declaration in \
166 '#include <stdlib.h>' \
167 'extern "C" void std::exit (int) throw (); using std::exit;' \
168 'extern "C" void std::exit (int); using std::exit;' \
169 'extern "C" void exit (int) throw ();' \
170 'extern "C" void exit (int);' \
173 AC_TRY_COMPILE([#include <stdlib.h>
178 AC_TRY_COMPILE([$ac_declaration],
182 if test -n "$ac_declaration"; then
183 echo '#ifdef __cplusplus' >>confdefs.h
184 echo $ac_declaration >>confdefs.h
185 echo '#endif' >>confdefs.h
187 ])# AC_PROG_CXX_EXIT_DECLARATION
190 dnl Determine a Fortran 77 compiler to use. If `F77' is not already set
191 dnl in the environment, check for `g77', `f77' and `f2c', in that order.
192 dnl Set the output variable `F77' to the name of the compiler found.
194 dnl If using `g77' (the GNU Fortran 77 compiler), then `AC_PROG_F77'
195 dnl will set the shell variable `G77' to `yes', and empty otherwise. If
196 dnl the output variable `FFLAGS' was not already set in the environment,
197 dnl then set it to `-g -02' for `g77' (or `-O2' where `g77' does not
198 dnl accept `-g'). Otherwise, set `FFLAGS' to `-g' for all other Fortran
202 AC_DEFUN(AC_PROG_F77,
203 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
204 if test -z "$F77"; then
205 AC_CHECK_PROGS(F77, g77 f77 f2c)
206 test -z "$F77" && AC_MSG_ERROR([no acceptable Fortran 77 compiler found in \$PATH])
212 if test $ac_cv_prog_g77 = yes; then
214 dnl Check whether -g works, even if FFLAGS is set, in case the package
215 dnl plays around with FFLAGS (such as to build both debugging and
216 dnl normal versions of a library), tasteless as that idea is.
217 ac_test_FFLAGS="${FFLAGS+set}"
218 ac_save_FFLAGS="$FFLAGS"
221 if test "$ac_test_FFLAGS" = set; then
222 FFLAGS="$ac_save_FFLAGS"
223 elif test $ac_cv_prog_f77_g = yes; then
230 test "${FFLAGS+set}" = set || FFLAGS="-g"
234 AC_DEFUN(AC_PROG_CC_WORKS,
235 [AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works])
238 AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross)
240 AC_MSG_RESULT($ac_cv_prog_cc_works)
241 if test $ac_cv_prog_cc_works = no; then
242 AC_MSG_ERROR([installation or configuration problem: C compiler cannot create executables.])
244 AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
245 AC_MSG_RESULT($ac_cv_prog_cc_cross)
246 cross_compiling=$ac_cv_prog_cc_cross
249 AC_DEFUN(AC_PROG_CXX_WORKS,
250 [AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
253 AC_TRY_COMPILER([int main(){return(0);}], ac_cv_prog_cxx_works, ac_cv_prog_cxx_cross)
255 AC_MSG_RESULT($ac_cv_prog_cxx_works)
256 if test $ac_cv_prog_cxx_works = no; then
257 AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
259 AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
260 AC_MSG_RESULT($ac_cv_prog_cxx_cross)
261 cross_compiling=$ac_cv_prog_cxx_cross
264 dnl Test whether the Fortran 77 compiler can compile and link a trivial
265 dnl Fortran program. Also, test whether the Fortran 77 compiler is a
266 dnl cross-compiler (which may realistically be the case if the Fortran
267 dnl compiler is `g77').
269 dnl AC_PROG_F77_WORKS()
270 AC_DEFUN(AC_PROG_F77_WORKS,
271 [AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) works])
277 ], ac_cv_prog_f77_works, ac_cv_prog_f77_cross)
279 AC_MSG_RESULT($ac_cv_prog_f77_works)
280 if test $ac_cv_prog_f77_works = no; then
281 AC_MSG_ERROR([installation or configuration problem: Fortran 77 compiler cannot create executables.])
283 AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler])
284 AC_MSG_RESULT($ac_cv_prog_f77_cross)
285 cross_compiling=$ac_cv_prog_f77_cross
288 AC_DEFUN(AC_PROG_CC_GNU,
289 [AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
290 [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
291 cat > conftest.c <<EOF
296 if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
302 AC_DEFUN(AC_PROG_CXX_GNU,
303 [AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx,
304 [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
305 cat > conftest.C <<EOF
310 if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | egrep yes >/dev/null 2>&1; then
316 dnl Test whether for Fortran 77 compiler is `g77' (the GNU Fortran 77
317 dnl Compiler). This test depends on whether the Fortran 77 compiler can
318 dnl do CPP pre-processing.
320 dnl AC_PROG_F77_GNU()
321 AC_DEFUN(AC_PROG_F77_GNU,
322 [AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77,
323 [cat > conftest.fpp <<EOF
328 if AC_TRY_COMMAND($F77 -E conftest.fpp) | egrep yes >/dev/null 2>&1; then
334 AC_DEFUN(AC_PROG_CC_G,
335 [AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g,
336 [echo 'void f(){}' > conftest.c
337 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
345 AC_DEFUN(AC_PROG_CXX_G,
346 [AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g,
347 [echo 'void f(){}' > conftest.cc
348 if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
356 dnl Test whether the Fortran 77 compiler can accept the `-g' option to
357 dnl enable debugging.
360 AC_DEFUN(AC_PROG_F77_G,
361 [AC_CACHE_CHECK(whether $F77 accepts -g, ac_cv_prog_f77_g,
362 [cat > conftest.f << EOF
366 if test -z "`$F77 -g -c conftest.f 2>&1`"; then
374 AC_DEFUN(AC_PROG_GCC_TRADITIONAL,
375 [AC_REQUIRE([AC_PROG_CC])dnl
376 AC_REQUIRE([AC_PROG_CPP])dnl
377 if test $ac_cv_prog_gcc = yes; then
378 AC_CACHE_CHECK(whether ${CC-cc} needs -traditional,
379 ac_cv_prog_gcc_traditional,
380 [ ac_pattern="Autoconf.*'x'"
381 AC_EGREP_CPP($ac_pattern, [#include <sgtty.h>
383 ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no)
385 if test $ac_cv_prog_gcc_traditional = no; then
386 AC_EGREP_CPP($ac_pattern, [#include <termio.h>
388 ac_cv_prog_gcc_traditional=yes)
390 if test $ac_cv_prog_gcc_traditional = yes; then
391 CC="$CC -traditional"
396 AC_DEFUN(AC_PROG_CC_C_O,
397 [if test "x$CC" != xcc; then
398 AC_MSG_CHECKING(whether $CC and cc understand -c and -o together)
400 AC_MSG_CHECKING(whether cc understands -c and -o together)
402 set dummy $CC; ac_cc="`echo [$]2 |
404 sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
406 AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
407 [echo 'foo(){}' > conftest.c
408 # Make sure it works both with $CC and with simple cc.
409 # We do the test twice because some compilers refuse to overwrite an
410 # existing .o file with -o, though they will create one.
411 ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&AC_FD_CC'
412 if AC_TRY_EVAL(ac_try) &&
413 test -f conftest.o && AC_TRY_EVAL(ac_try);
415 eval ac_cv_prog_cc_${ac_cc}_c_o=yes
416 if test "x$CC" != xcc; then
417 # Test first that cc exists at all.
418 if AC_TRY_COMMAND(cc -c conftest.c 1>&AC_FD_CC); then
419 ac_try='cc -c conftest.c -o conftest.o 1>&AC_FD_CC'
420 if AC_TRY_EVAL(ac_try) &&
421 test -f conftest.o && AC_TRY_EVAL(ac_try);
426 # cc exists but doesn't like -o.
427 eval ac_cv_prog_cc_${ac_cc}_c_o=no
432 eval ac_cv_prog_cc_${ac_cc}_c_o=no
436 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
440 AC_DEFINE(NO_MINUS_C_MINUS_O)
444 dnl Test if the Fortran 77 compiler accepts the options `-c' and `-o'
445 dnl simultaneously, and define `F77_NO_MINUS_C_MINUS_O' if it does not.
447 dnl The usefulness of this macro is questionable, as I can't really see
448 dnl why anyone would use it. The only reason I include it is for
449 dnl completeness, since a similar test exists for the C compiler.
452 AC_DEFUN(AC_PROG_F77_C_O,
453 [AC_BEFORE([$0], [AC_PROG_F77])dnl
454 AC_MSG_CHECKING(whether $F77 understand -c and -o together)
455 set dummy $F77; ac_f77="`echo [$]2 |
457 sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
459 AC_CACHE_VAL(ac_cv_prog_f77_${ac_f77}_c_o,
460 [cat > conftest.f << EOF
464 # We do the `AC_TRY_EVAL' test twice because some compilers refuse to
465 # overwrite an existing `.o' file with `-o', although they will create
467 ac_try='$F77 $FFLAGS -c conftest.f -o conftest.o 1>&AC_FD_CC'
468 if AC_TRY_EVAL(ac_try) && test -f conftest.o && AC_TRY_EVAL(ac_try); then
469 eval ac_cv_prog_f77_${ac_f77}_c_o=yes
471 eval ac_cv_prog_f77_${ac_f77}_c_o=no
475 if eval "test \"`echo '$ac_cv_prog_f77_'${ac_f77}_c_o`\" = yes"; then
479 AC_DEFINE(F77_NO_MINUS_C_MINUS_O)
483 dnl Define SET_MAKE to set ${MAKE} if make doesn't.
484 AC_DEFUN(AC_PROG_MAKE_SET,
485 [AC_MSG_CHECKING(whether ${MAKE-make} sets \${MAKE})
486 set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'`
487 AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
488 [cat > conftestmake <<\EOF
490 @echo 'ac_maketemp="${MAKE}"'
493 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
494 eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
496 if test -n "$ac_maketemp"; then
497 eval ac_cv_prog_make_${ac_make}_set=yes
499 eval ac_cv_prog_make_${ac_make}_set=no
501 rm -f conftestmake])dnl
502 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
507 SET_MAKE="MAKE=${MAKE-make}"
509 AC_SUBST([SET_MAKE])dnl
512 AC_DEFUN(AC_PROG_RANLIB,
513 [AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)])
515 dnl Don't check for mawk first even if it's generally faster.
516 AC_DEFUN(AC_PROG_AWK,
517 [AC_CHECK_PROGS(AWK, gawk mawk nawk awk, )])
519 AC_DEFUN(AC_PROG_YACC,
520 [AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)])
522 AC_DEFUN(AC_PROG_CPP,
523 [AC_MSG_CHECKING(how to run the C preprocessor)
524 # On Suns, sometimes $CPP names a directory.
525 if test -n "$CPP" && test -d "$CPP"; then
528 if test -z "$CPP"; then
529 AC_CACHE_VAL(ac_cv_prog_CPP,
530 [ # This must be in double quotes, not single quotes, because CPP may get
531 # substituted into the Makefile and "${CC-cc}" will confuse make.
533 # On the NeXT, cc -E runs the code through the compiler's parser,
534 # not just through cpp.
535 dnl Use a header file that comes with gcc, so configuring glibc
536 dnl with a fresh cross-compiler works.
537 AC_TRY_CPP([#include <assert.h>
539 CPP="${CC-cc} -E -traditional-cpp"
540 AC_TRY_CPP([#include <assert.h>
542 CPP="${CC-cc} -nologo -E"
543 AC_TRY_CPP([#include <assert.h>
544 Syntax Error], , CPP=/lib/cpp)))
545 ac_cv_prog_CPP="$CPP"])dnl
546 CPP="$ac_cv_prog_CPP"
548 ac_cv_prog_CPP="$CPP"
554 AC_DEFUN(AC_PROG_CXXCPP,
555 [AC_MSG_CHECKING(how to run the C++ preprocessor)
556 if test -z "$CXXCPP"; then
557 AC_CACHE_VAL(ac_cv_prog_CXXCPP,
559 AC_LANG_CPLUSPLUS[]dnl
560 CXXCPP="${CXX-g++} -E"
561 AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
562 ac_cv_prog_CXXCPP="$CXXCPP"
565 CXXCPP="$ac_cv_prog_CXXCPP"
566 AC_MSG_RESULT($CXXCPP)
570 dnl Require finding the C or C++ preprocessor, whichever is the
571 dnl current language.
572 AC_DEFUN(AC_REQUIRE_CPP,
573 [ifelse(AC_LANG, C, [AC_REQUIRE([AC_PROG_CPP])], [AC_REQUIRE([AC_PROG_CXXCPP])])])
575 AC_DEFUN(AC_PROG_LEX,
576 [AC_CHECK_PROG(LEX, flex, flex, lex)
583 AC_CHECK_LIB($ac_lib, yywrap, LEXLIB="-l$ac_lib")
587 dnl Check if lex declares yytext as a char * by default, not a char[].
588 undefine([AC_DECL_YYTEXT])
589 AC_DEFUN(AC_DECL_YYTEXT,
591 AC_REQUIRE([AC_PROG_LEX])dnl
592 AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,
593 [# The minimal lex program is just a single line: %%. But some broken lexes
594 # (Solaris, I think it was) want two %% lines, so accommodate them.
597 if test -f lex.yy.c; then
598 ac_cv_prog_lex_root=lex.yy
599 elif test -f lexyy.c; then
600 ac_cv_prog_lex_root=lexyy
602 AC_MSG_ERROR(cannot find output from $LEX; giving up)
604 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
605 AC_SUBST(LEX_OUTPUT_ROOT)dnl
607 AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer,
608 [# POSIX says lex can declare yytext either as a pointer or an array; the
609 # default is implementation-dependent. Figure out which it is, since
610 # not all implementations provide the %pointer and %array declarations.
611 ac_cv_prog_lex_yytext_pointer=no
612 echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
615 AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`, , ac_cv_prog_lex_yytext_pointer=yes)
617 rm -f "${LEX_OUTPUT_ROOT}.c"
620 if test $ac_cv_prog_lex_yytext_pointer = yes; then
621 AC_DEFINE(YYTEXT_POINTER)
625 AC_DEFUN(AC_PROG_INSTALL,
626 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
627 # Find a good install program. We prefer a C program (faster),
628 # so one script is as good as another. But avoid the broken or
629 # incompatible versions:
630 # SysV /etc/install, /usr/sbin/install
631 # SunOS /usr/etc/install
634 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
635 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
636 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
637 # ./install, which can be erroneously created by make from ./install.sh.
638 AC_MSG_CHECKING(for a BSD compatible install)
639 if test -z "$INSTALL"; then
640 AC_CACHE_VAL(ac_cv_path_install,
641 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
642 for ac_dir in $PATH; do
643 # Account for people who put trailing slashes in PATH elements.
645 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
647 # OSF1 and SCO ODT 3.0 have their own names for install.
648 # Don't use installbsd from OSF since it installs stuff as root
650 for ac_prog in ginstall scoinst install; do
651 if test -f $ac_dir/$ac_prog; then
652 if test $ac_prog = install &&
653 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
654 # AIX install. It has an incompatible calling convention.
657 ac_cv_path_install="$ac_dir/$ac_prog -c"
667 if test "${ac_cv_path_install+set}" = set; then
668 INSTALL="$ac_cv_path_install"
670 # As a last resort, use the slow shell script. We don't cache a
671 # path for INSTALL within a source directory, because that will
672 # break other packages using the cache if that directory is
673 # removed, or if the path is relative.
674 INSTALL="$ac_install_sh"
677 dnl We do special magic for INSTALL instead of AC_SUBST, to get
678 dnl relative paths right.
679 AC_MSG_RESULT($INSTALL)
681 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
682 # It thinks the first close brace ends the variable substitution.
683 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
684 AC_SUBST(INSTALL_PROGRAM)dnl
686 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
687 AC_SUBST(INSTALL_SCRIPT)dnl
689 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
690 AC_SUBST(INSTALL_DATA)dnl
693 AC_DEFUN(AC_PROG_LN_S,
694 [AC_MSG_CHECKING(whether ln -s works)
695 AC_CACHE_VAL(ac_cv_prog_LN_S,
697 if ln -s X conftestdata 2>/dev/null
700 ac_cv_prog_LN_S="ln -s"
704 LN_S="$ac_cv_prog_LN_S"
705 if test "$ac_cv_prog_LN_S" = "ln -s"; then
714 [errprint(__file__:__line__: [$0] has been removed; replace it with equivalent code
718 dnl ### Checks for header files
721 AC_DEFUN(AC_HEADER_STDC,
723 AC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc,
724 [AC_TRY_CPP([#include <stdlib.h>
727 #include <float.h>], ac_cv_header_stdc=yes, ac_cv_header_stdc=no)
729 if test $ac_cv_header_stdc = yes; then
730 # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
731 AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no)
734 if test $ac_cv_header_stdc = yes; then
735 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
736 AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no)
739 if test $ac_cv_header_stdc = yes; then
740 # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
741 AC_TRY_RUN([#include <ctype.h>
742 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
743 #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
744 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
745 int main () { int i; for (i = 0; i < 256; i++)
746 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
748 ], , ac_cv_header_stdc=no, :)
750 if test $ac_cv_header_stdc = yes; then
751 AC_DEFINE(STDC_HEADERS)
755 AC_DEFUN(AC_UNISTD_H,
756 [AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(unistd.h)])dnl
757 AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))])
761 [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H])dnl
762 AC_MSG_CHECKING([for BSD string and memory functions])
763 AC_TRY_LINK([#include <strings.h>], [rindex(0, 0); bzero(0, 0);],
764 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); AC_DEFINE(USG)])])
767 dnl If memchr and the like aren't declared in <string.h>, include <memory.h>.
768 dnl To avoid problems, don't check for gcc2 built-ins.
769 AC_DEFUN(AC_MEMORY_H,
770 [AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H])dnl
771 AC_MSG_CHECKING(whether string.h declares mem functions)
772 AC_EGREP_HEADER(memchr, string.h, ac_found=yes, ac_found=no)
773 AC_MSG_RESULT($ac_found)
774 if test $ac_found = no; then
775 AC_CHECK_HEADER(memory.h, [AC_DEFINE(NEED_MEMORY_H)])
779 AC_DEFUN(AC_HEADER_MAJOR,
780 [AC_CACHE_CHECK(whether sys/types.h defines makedev,
781 ac_cv_header_sys_types_h_makedev,
782 [AC_TRY_LINK([#include <sys/types.h>], [return makedev(0, 0);],
783 ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)
786 if test $ac_cv_header_sys_types_h_makedev = no; then
787 AC_CHECK_HEADER(sys/mkdev.h, [AC_DEFINE(MAJOR_IN_MKDEV)])
789 if test $ac_cv_header_sys_mkdev_h = no; then
790 AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)])
795 AC_DEFUN(AC_HEADER_DIRENT,
797 AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h,
798 [ac_header_dirent=$ac_hdr; break])
799 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
800 if test $ac_header_dirent = dirent.h; then
801 AC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir")
803 AC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx")
807 dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE
808 dnl defines the type `DIR'. dirent.h on NextStep 3.2 doesn't.
809 dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
810 AC_DEFUN(AC_CHECK_HEADER_DIRENT,
811 [ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
812 AC_MSG_CHECKING([for $1 that defines DIR])
813 AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe,
814 [AC_TRY_COMPILE([#include <sys/types.h>
815 #include <$1>], [DIR *dirp = 0;],
816 eval "ac_cv_header_dirent_$ac_safe=yes",
817 eval "ac_cv_header_dirent_$ac_safe=no")])dnl
818 if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
826 dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that
828 dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION])
829 define(AC_CHECK_HEADERS_DIRENT,
832 AC_CHECK_HEADER_DIRENT($ac_hdr,
834 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
836 AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnl
839 AC_DEFUN(AC_DIR_HEADER,
840 [AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl
842 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
843 AC_CHECK_HEADER_DIRENT($ac_hdr, [ac_header_dirent=$ac_hdr; break])
846 case "$ac_header_dirent" in
847 dirent.h) AC_DEFINE(DIRENT) ;;
848 sys/ndir.h) AC_DEFINE(SYSNDIR) ;;
849 sys/dir.h) AC_DEFINE(SYSDIR) ;;
850 ndir.h) AC_DEFINE(NDIR) ;;
853 AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
854 [AC_TRY_RUN([#include <sys/types.h>
855 #include <$ac_header_dirent>
856 int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
857 ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)])
858 if test $ac_cv_func_closedir_void = yes; then
859 AC_DEFINE(VOID_CLOSEDIR)
863 AC_DEFUN(AC_HEADER_STAT,
864 [AC_CACHE_CHECK(whether stat file-mode macros are broken,
865 ac_cv_header_stat_broken,
866 [AC_EGREP_CPP([You lose], [#include <sys/types.h>
867 #include <sys/stat.h>
869 #if defined(S_ISBLK) && defined(S_IFDIR)
870 # if S_ISBLK (S_IFDIR)
875 #if defined(S_ISBLK) && defined(S_IFCHR)
876 # if S_ISBLK (S_IFCHR)
881 #if defined(S_ISLNK) && defined(S_IFREG)
882 # if S_ISLNK (S_IFREG)
887 #if defined(S_ISSOCK) && defined(S_IFREG)
888 # if S_ISSOCK (S_IFREG)
892 ], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)])
893 if test $ac_cv_header_stat_broken = yes; then
894 AC_DEFINE(STAT_MACROS_BROKEN)
898 AC_DEFUN(AC_DECL_SYS_SIGLIST,
899 [AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
900 ac_cv_decl_sys_siglist,
901 [AC_TRY_COMPILE([#include <sys/types.h>
903 /* NetBSD declares sys_siglist in unistd.h. */
906 #endif], [char *msg = *(sys_siglist + 1);],
907 ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])
908 if test $ac_cv_decl_sys_siglist = yes; then
909 AC_DEFINE(SYS_SIGLIST_DECLARED)
913 AC_DEFUN(AC_HEADER_SYS_WAIT,
914 [AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible],
915 ac_cv_header_sys_wait_h,
916 [AC_TRY_COMPILE([#include <sys/types.h>
917 #include <sys/wait.h>
919 #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
922 #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
925 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;],
926 ac_cv_header_sys_wait_h=yes, ac_cv_header_sys_wait_h=no)])
927 if test $ac_cv_header_sys_wait_h = yes; then
928 AC_DEFINE(HAVE_SYS_WAIT_H)
933 dnl ### Checks for typedefs
936 AC_DEFUN(AC_TYPE_GETGROUPS,
937 [AC_REQUIRE([AC_TYPE_UID_T])dnl
938 AC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups,
940 changequote(<<, >>)dnl
942 /* Thanks to Mike Rendell for this test. */
943 #include <sys/types.h>
946 #define MAX(x, y) ((x) > (y) ? (x) : (y))
951 union { gid_t gval; long lval; } val;
954 for (i = 0; i < NGID; i++)
955 gidset[i] = val.gval;
956 n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
958 /* Exit non-zero if getgroups seems to require an array of ints. This
959 happens when gid_t is short but getgroups modifies an array of ints. */
960 exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0);
964 ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int,
965 ac_cv_type_getgroups=cross)
966 if test $ac_cv_type_getgroups = cross; then
967 dnl When we can't run the test program (we are cross compiling), presume
968 dnl that <unistd.h> has either an accurate prototype for getgroups or none.
969 dnl Old systems without prototypes probably use int.
970 AC_EGREP_HEADER([getgroups.*int.*gid_t], unistd.h,
971 ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int)
973 AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups)
976 AC_DEFUN(AC_TYPE_UID_T,
977 [AC_CACHE_CHECK(for uid_t in sys/types.h, ac_cv_type_uid_t,
978 [AC_EGREP_HEADER(uid_t, sys/types.h,
979 ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)])
980 if test $ac_cv_type_uid_t = no; then
981 AC_DEFINE(uid_t, int)
982 AC_DEFINE(gid_t, int)
986 AC_DEFUN(AC_TYPE_SIZE_T,
987 [AC_CHECK_TYPE(size_t, unsigned)])
989 AC_DEFUN(AC_TYPE_PID_T,
990 [AC_CHECK_TYPE(pid_t, int)])
992 AC_DEFUN(AC_TYPE_OFF_T,
993 [AC_CHECK_TYPE(off_t, long)])
995 AC_DEFUN(AC_TYPE_MODE_T,
996 [AC_CHECK_TYPE(mode_t, int)])
998 dnl Note that identifiers starting with SIG are reserved by ANSI C.
999 AC_DEFUN(AC_TYPE_SIGNAL,
1000 [AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal,
1001 [AC_TRY_COMPILE([#include <sys/types.h>
1007 extern "C" void (*signal (int, void (*)(int)))(int);
1009 void (*signal ()) ();
1012 [int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)])
1013 AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal)
1017 dnl ### Checks for functions
1020 AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
1021 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
1022 AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
1023 [AC_TRY_RUN([#include <sys/types.h>
1024 #include <$ac_header_dirent>
1025 int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
1026 ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)])
1027 if test $ac_cv_func_closedir_void = yes; then
1028 AC_DEFINE(CLOSEDIR_VOID)
1032 AC_DEFUN(AC_FUNC_FNMATCH,
1033 [AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works,
1034 # Some versions of Solaris or SCO have a broken fnmatch function.
1035 # So we run a test program. If we are cross-compiling, take no chance.
1036 # Thanks to John Oleynick and Franc,ois Pinard for this test.
1037 [AC_TRY_RUN([main() { exit (fnmatch ("a*", "abc", 0) != 0); }],
1038 ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no,
1039 ac_cv_func_fnmatch_works=no)])
1040 if test $ac_cv_func_fnmatch_works = yes; then
1041 AC_DEFINE(HAVE_FNMATCH)
1045 AC_DEFUN(AC_FUNC_MMAP,
1046 [AC_CHECK_HEADERS(stdlib.h unistd.h sys/stat.h sys/types.h)
1047 AC_CHECK_FUNCS(getpagesize)
1048 AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
1050 /* Thanks to Mike Haertel and Jim Avera for this test.
1051 Here is a matrix of mmap possibilities:
1052 mmap private not fixed
1053 mmap private fixed at somewhere currently unmapped
1054 mmap private fixed at somewhere already mapped
1055 mmap shared not fixed
1056 mmap shared fixed at somewhere currently unmapped
1057 mmap shared fixed at somewhere already mapped
1058 For private mappings, we should verify that changes cannot be read()
1059 back from the file, nor mmap's back from the file at a different
1060 address. (There have been systems where private was not correctly
1061 implemented like the infamous i386 svr4.0, and systems where the
1062 VM page cache was not coherent with the filesystem buffer cache
1063 like early versions of FreeBSD and possibly contemporary NetBSD.)
1064 For shared mappings, we should conversely verify that changes get
1065 propogated back to all the places they're supposed to be.
1067 Grep wants private fixed already mapped.
1068 The main things grep needs to know about mmap are:
1069 * does it exist and is it safe to write into the mmap'd area
1070 * how to use it (BSD variants) */
1071 #include <sys/types.h>
1073 #include <sys/mman.h>
1075 #if HAVE_SYS_TYPES_H
1076 # include <sys/types.h>
1080 # include <stdlib.h>
1084 # include <sys/stat.h>
1088 # include <unistd.h>
1091 /* This mess was copied from the GNU getpagesize.h. */
1092 #ifndef HAVE_GETPAGESIZE
1094 /* Assume that all systems that can run configure have sys/param.h. */
1095 # ifndef HAVE_SYS_PARAM_H
1096 # define HAVE_SYS_PARAM_H 1
1099 # ifdef _SC_PAGESIZE
1100 # define getpagesize() sysconf(_SC_PAGESIZE)
1101 # else /* no _SC_PAGESIZE */
1102 # ifdef HAVE_SYS_PARAM_H
1103 # include <sys/param.h>
1104 # ifdef EXEC_PAGESIZE
1105 # define getpagesize() EXEC_PAGESIZE
1106 # else /* no EXEC_PAGESIZE */
1108 # define getpagesize() NBPG * CLSIZE
1111 # endif /* no CLSIZE */
1112 # else /* no NBPG */
1114 # define getpagesize() NBPC
1115 # else /* no NBPC */
1117 # define getpagesize() PAGESIZE
1118 # endif /* PAGESIZE */
1119 # endif /* no NBPC */
1120 # endif /* no NBPG */
1121 # endif /* no EXEC_PAGESIZE */
1122 # else /* no HAVE_SYS_PARAM_H */
1123 # define getpagesize() 8192 /* punt totally */
1124 # endif /* no HAVE_SYS_PARAM_H */
1125 # endif /* no _SC_PAGESIZE */
1127 #endif /* no HAVE_GETPAGESIZE */
1130 extern "C" { void *malloc(unsigned); }
1138 char *data, *data2, *data3;
1142 pagesize = getpagesize();
1145 * First, make a file with some known garbage in it.
1147 data = malloc(pagesize);
1150 for (i = 0; i < pagesize; ++i)
1151 *(data + i) = rand();
1153 fd = creat("conftestmmap", 0600);
1156 if (write(fd, data, pagesize) != pagesize)
1161 * Next, try to mmap the file at a fixed address which
1162 * already has something else allocated at it. If we can,
1163 * also make sure that we see the same garbage.
1165 fd = open("conftestmmap", O_RDWR);
1168 data2 = malloc(2 * pagesize);
1171 data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
1172 if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
1173 MAP_PRIVATE | MAP_FIXED, fd, 0L))
1175 for (i = 0; i < pagesize; ++i)
1176 if (*(data + i) != *(data2 + i))
1180 * Finally, make sure that changes to the mapped area
1181 * do not percolate back to the file as seen by read().
1182 * (This is a bug on some variants of i386 svr4.0.)
1184 for (i = 0; i < pagesize; ++i)
1185 *(data2 + i) = *(data2 + i) + 1;
1186 data3 = malloc(pagesize);
1189 if (read(fd, data3, pagesize) != pagesize)
1191 for (i = 0; i < pagesize; ++i)
1192 if (*(data + i) != *(data3 + i))
1195 unlink("conftestmmap");
1198 ], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no,
1199 ac_cv_func_mmap_fixed_mapped=no)])
1200 if test $ac_cv_func_mmap_fixed_mapped = yes; then
1201 AC_DEFINE(HAVE_MMAP)
1205 AC_DEFUN(AC_FUNC_GETPGRP,
1206 [AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void,
1209 * If this system has a BSD-style getpgrp(),
1210 * which takes a pid argument, exit unsuccessfully.
1212 * Snarfed from Chet Ramey's bash pgrp.c test program
1215 #include <sys/types.h>
1218 int pg1, pg2, pg3, pg4;
1219 int ng, np, s, child;
1230 * If all of these values are the same, it's pretty sure that
1231 * we're on a system that ignores getpgrp's first argument.
1233 if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3)
1239 else if (child == 0) {
1242 * If this is Sys V, this will not work; pgrp will be
1243 * set to np because setpgrp just changes a pgrp to be
1244 * the same as the pid.
1247 ng = getpgrp(0); /* Same result for Sys V and BSD */
1258 ], ac_cv_func_getpgrp_void=yes, ac_cv_func_getpgrp_void=no,
1259 AC_MSG_ERROR(cannot check getpgrp if cross compiling))
1261 if test $ac_cv_func_getpgrp_void = yes; then
1262 AC_DEFINE(GETPGRP_VOID)
1266 AC_DEFUN(AC_FUNC_SETPGRP,
1267 [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
1269 #ifdef HAVE_UNISTD_H
1274 * If this system has a BSD-style setpgrp, which takes arguments, exit
1279 if (setpgrp(1,1) == -1)
1284 ], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
1285 AC_MSG_ERROR(cannot check setpgrp if cross compiling))
1287 if test $ac_cv_func_setpgrp_void = yes; then
1288 AC_DEFINE(SETPGRP_VOID)
1292 AC_DEFUN(AC_FUNC_VPRINTF,
1293 [AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
1294 if test "$ac_cv_func_vprintf" != yes; then
1295 AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))
1299 AC_DEFUN(AC_FUNC_VFORK,
1300 [AC_REQUIRE([AC_TYPE_PID_T])dnl
1301 AC_CHECK_HEADER(vfork.h, AC_DEFINE(HAVE_VFORK_H))
1302 AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
1303 [AC_TRY_RUN([/* Thanks to Paul Eggert for this test. */
1305 #include <sys/types.h>
1306 #include <sys/stat.h>
1307 #ifdef HAVE_UNISTD_H
1313 /* On some sparc systems, changes by the child to local and incoming
1314 argument registers are propagated back to the parent.
1315 The compiler is told about this with #include <vfork.h>,
1316 but some compilers (e.g. gcc -O) don't grok <vfork.h>.
1317 Test for this by using a static variable whose address
1318 is put into a register that is clobbered by the vfork. */
1321 sparc_address_test (int arg)
1323 sparc_address_test (arg) int arg;
1341 pid_t parent = getpid ();
1344 sparc_address_test ();
1349 /* Here is another test for sparc vfork register problems.
1350 This test uses lots of local variables, at least
1351 as many local variables as main has allocated so far
1352 including compiler temporaries. 4 locals are enough for
1353 gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
1354 A buggy compiler should reuse the register of parent
1355 for one of the local variables, since it will think that
1356 parent can't possibly be used any more in this routine.
1357 Assigning to the local variable will thus munge parent
1358 in the parent process. */
1360 p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
1361 p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
1362 /* Convince the compiler that p..p7 are live; otherwise, it might
1363 use the same hardware register for all 8 local variables. */
1364 if (p != p1 || p != p2 || p != p3 || p != p4
1365 || p != p5 || p != p6 || p != p7)
1368 /* On some systems (e.g. IRIX 3.3),
1369 vfork doesn't separate parent from child file descriptors.
1370 If the child closes a descriptor before it execs or exits,
1371 this munges the parent's descriptor as well.
1372 Test for this by closing stdout in the child. */
1373 _exit(close(fileno(stdout)) != 0);
1378 while (wait(&status) != child)
1381 /* Was there some problem with vforking? */
1384 /* Did the child fail? (This shouldn't happen.) */
1387 /* Did the vfork/compiler bug occur? */
1388 || parent != getpid()
1390 /* Did the file descriptor bug occur? */
1391 || fstat(fileno(stdout), &st) != 0
1395 ac_cv_func_vfork_works=yes, ac_cv_func_vfork_works=no, AC_CHECK_FUNC(vfork)
1396 ac_cv_func_vfork_works=$ac_cv_func_vfork)])
1397 if test $ac_cv_func_vfork_works = no; then
1398 AC_DEFINE(vfork, fork)
1402 AC_DEFUN(AC_FUNC_WAIT3,
1403 [AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage,
1404 [AC_TRY_RUN([#include <sys/types.h>
1405 #include <sys/time.h>
1406 #include <sys/resource.h>
1408 /* HP-UX has wait3 but does not fill in rusage at all. */
1412 /* Use a field that we can force nonzero --
1413 voluntary context switches.
1414 For systems like NeXT and OSF/1 that don't set it,
1415 also use the system CPU time. And page faults (I/O) for Linux. */
1417 r.ru_stime.tv_sec = 0;
1418 r.ru_stime.tv_usec = 0;
1419 r.ru_majflt = r.ru_minflt = 0;
1421 case 0: /* Child. */
1422 /* Unless we actually _do_ something, the kernel sometimes doesn't chalk up any system time to this process. */
1423 if(fork()) { i = 123; wait(NULL); } else { i = 234; exit(0); }
1424 sleep(1); /* Give up the CPU. */
1426 case -1: _exit(0); /* What can we do? */
1427 default: /* Parent. */
1429 sleep(2); /* Avoid "text file busy" from rm on fast HP-UX machines. */
1430 exit(r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0
1431 && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0);
1433 }], ac_cv_func_wait3_rusage=yes, ac_cv_func_wait3_rusage=no,
1434 ac_cv_func_wait3_rusage=no)])
1435 if test $ac_cv_func_wait3_rusage = yes; then
1436 AC_DEFINE(HAVE_WAIT3)
1440 AC_DEFUN(AC_FUNC_ALLOCA,
1441 [AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
1442 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
1443 # for constant arguments. Useless!
1444 AC_CACHE_CHECK([for working alloca.h], ac_cv_header_alloca_h,
1445 [AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
1446 ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)])
1447 if test $ac_cv_header_alloca_h = yes; then
1448 AC_DEFINE(HAVE_ALLOCA_H)
1451 AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
1454 # define alloca __builtin_alloca
1457 # include <malloc.h>
1458 # define alloca _alloca
1461 # include <alloca.h>
1466 # ifndef alloca /* predefined by HP cc +Olibcalls */
1473 ], [char *p = (char *) alloca(1);],
1474 ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)])
1475 if test $ac_cv_func_alloca_works = yes; then
1476 AC_DEFINE(HAVE_ALLOCA)
1479 if test $ac_cv_func_alloca_works = no; then
1480 # The SVR3 libPW and SVR4 libucb both contain incompatible functions
1481 # that cause trouble. Some versions do not even contain alloca or
1482 # contain a buggy version. If you still want to use their alloca,
1483 # use ar to extract alloca.o from them instead of compiling alloca.c.
1484 ALLOCA=alloca.${ac_objext}
1487 AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
1488 [AC_EGREP_CPP(webecray,
1489 [#if defined(CRAY) && ! defined(CRAY2)
1494 ], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
1495 if test $ac_cv_os_cray = yes; then
1496 for ac_func in _getb67 GETB67 getb67; do
1497 AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func)
1502 AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
1503 [AC_TRY_RUN([find_stack_direction ()
1505 static char *addr = 0;
1510 return find_stack_direction ();
1513 return (&dummy > addr) ? 1 : -1;
1517 exit (find_stack_direction() < 0);
1518 }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
1519 ac_cv_c_stack_direction=0)])
1520 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
1525 AC_DEFUN(AC_FUNC_GETLOADAVG,
1526 [ac_have_func=no # yes means we've found a way to get the load average.
1528 # Some systems with -lutil have (and need) -lkvm as well, some do not.
1529 # On Solaris, -lkvm requires nlist from -lelf, so check that first
1530 # to get the right answer into the cache.
1531 AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
1532 AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
1533 # Check for the 4.4BSD definition of getloadavg.
1534 AC_CHECK_LIB(util, getloadavg,
1535 [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
1537 if test $ac_have_func = no; then
1538 # There is a commonly available library for RS/6000 AIX.
1539 # Since it is not a standard part of AIX, it might be installed locally.
1540 ac_getloadavg_LIBS="$LIBS"; LIBS="-L/usr/local/lib $LIBS"
1541 AC_CHECK_LIB(getloadavg, getloadavg,
1542 LIBS="-lgetloadavg $LIBS", LIBS="$ac_getloadavg_LIBS")
1545 # Make sure it is really in the library, if we think we found it.
1546 AC_REPLACE_FUNCS(getloadavg)
1548 if test $ac_cv_func_getloadavg = yes; then
1549 AC_DEFINE(HAVE_GETLOADAVG)
1552 # Figure out what our getloadavg.c needs.
1554 AC_CHECK_HEADER(sys/dg_sys_info.h,
1555 [ac_have_func=yes; AC_DEFINE(DGUX)
1556 AC_CHECK_LIB(dgc, dg_sys_info)])
1558 # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
1559 # uses stabs), but it is still SVR4. We cannot check for <elf.h> because
1560 # Irix 4.0.5F has the header but not the library.
1561 if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then
1562 ac_have_func=yes; AC_DEFINE(SVR4)
1565 if test $ac_have_func = no; then
1566 AC_CHECK_HEADER(inq_stats/cpustats.h,
1567 [ac_have_func=yes; AC_DEFINE(UMAX)
1568 AC_DEFINE(UMAX4_3)])
1571 if test $ac_have_func = no; then
1572 AC_CHECK_HEADER(sys/cpustats.h,
1573 [ac_have_func=yes; AC_DEFINE(UMAX)])
1576 if test $ac_have_func = no; then
1577 AC_CHECK_HEADERS(mach/mach.h)
1580 AC_CHECK_HEADER(nlist.h,
1581 [AC_DEFINE(NLIST_STRUCT)
1582 AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
1583 [AC_TRY_COMPILE([#include <nlist.h>],
1584 [struct nlist n; n.n_un.n_name = 0;],
1585 ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
1586 if test $ac_cv_struct_nlist_n_un = yes; then
1587 AC_DEFINE(NLIST_NAME_UNION)
1590 fi # Do not have getloadavg in system libraries.
1592 # Some definitions of getloadavg require that the program be installed setgid.
1593 dnl FIXME Don't hardwire the path of getloadavg.c in the top-level directory.
1594 AC_CACHE_CHECK(whether getloadavg requires setgid,
1595 ac_cv_func_getloadavg_setgid,
1596 [AC_EGREP_CPP([Yowza Am I SETGID yet],
1597 [#include "$srcdir/getloadavg.c"
1598 #ifdef LDAV_PRIVILEGED
1599 Yowza Am I SETGID yet
1601 ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])
1602 if test $ac_cv_func_getloadavg_setgid = yes; then
1603 NEED_SETGID=true; AC_DEFINE(GETLOADAVG_PRIVILEGED)
1607 AC_SUBST(NEED_SETGID)dnl
1609 if test $ac_cv_func_getloadavg_setgid = yes; then
1610 AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem,
1612 # On Solaris, /dev/kmem is a symlink. Get info on the real file.
1613 ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
1614 # If we got an error (system does not support symlinks), try without -L.
1615 test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
1616 ac_cv_group_kmem=`echo $ac_ls_output \
1617 | sed -ne 's/[ ][ ]*/ /g;
1618 s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/;
1620 changequote([, ])dnl
1622 KMEM_GROUP=$ac_cv_group_kmem
1624 AC_SUBST(KMEM_GROUP)dnl
1627 AC_DEFUN(AC_FUNC_UTIME_NULL,
1628 [AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null,
1629 [rm -f conftestdata; > conftestdata
1630 # Sequent interprets utime(file, 0) to mean use start of epoch. Wrong.
1631 AC_TRY_RUN([#include <sys/types.h>
1632 #include <sys/stat.h>
1635 exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0
1636 && stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime
1637 && t.st_mtime - s.st_mtime < 120));
1638 }], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no,
1639 ac_cv_func_utime_null=no)
1640 rm -f core core.* *.core])
1641 if test $ac_cv_func_utime_null = yes; then
1642 AC_DEFINE(HAVE_UTIME_NULL)
1646 AC_DEFUN(AC_FUNC_STRCOLL,
1647 [AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,
1648 [AC_TRY_RUN([#include <string.h>
1651 exit (strcoll ("abc", "def") >= 0 ||
1652 strcoll ("ABC", "DEF") >= 0 ||
1653 strcoll ("123", "456") >= 0);
1654 }], ac_cv_func_strcoll_works=yes, ac_cv_func_strcoll_works=no,
1655 ac_cv_func_strcoll_works=no)])
1656 if test $ac_cv_func_strcoll_works = yes; then
1657 AC_DEFINE(HAVE_STRCOLL)
1661 AC_DEFUN(AC_FUNC_SETVBUF_REVERSED,
1662 [AC_CACHE_CHECK(whether setvbuf arguments are reversed,
1663 ac_cv_func_setvbuf_reversed,
1664 [AC_TRY_RUN([#include <stdio.h>
1665 /* If setvbuf has the reversed format, exit 0. */
1667 /* This call has the arguments reversed.
1668 A reversed system may check and see that the address of main
1669 is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */
1670 if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0)
1673 exit(0); /* Non-reversed systems segv here. */
1674 }], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no)
1675 rm -f core core.* *.core])
1676 if test $ac_cv_func_setvbuf_reversed = yes; then
1677 AC_DEFINE(SETVBUF_REVERSED)
1681 AC_DEFUN(AC_FUNC_GETMNTENT,
1682 [# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware.
1683 AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS",
1684 [AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS",
1685 [AC_CHECK_LIB(gen, getmntent, LIBS="-lgen $LIBS")])])
1686 AC_CHECK_FUNC(getmntent, [AC_DEFINE(HAVE_GETMNTENT)])])
1688 AC_DEFUN(AC_FUNC_STRFTIME,
1689 [AC_CHECK_FUNC(strftime, [AC_DEFINE(HAVE_STRFTIME)],
1690 [# strftime is in -lintl on SCO UNIX.
1691 AC_CHECK_LIB(intl, strftime,
1692 [AC_DEFINE(HAVE_STRFTIME)
1693 LIBS="-lintl $LIBS"])])])
1695 AC_DEFUN(AC_FUNC_MEMCMP,
1696 [AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean,
1700 char c0 = 0x40, c1 = 0x80, c2 = 0x81;
1701 exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
1703 ], ac_cv_func_memcmp_clean=yes, ac_cv_func_memcmp_clean=no,
1704 ac_cv_func_memcmp_clean=no)])
1705 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
1706 AC_SUBST(LIBOBJS)dnl
1709 AC_DEFUN(AC_FUNC_SELECT_ARGTYPES,
1710 [AC_MSG_CHECKING([types of arguments for select()])
1711 AC_CACHE_VAL(ac_cv_func_select_arg234,dnl
1712 [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl
1713 [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl
1714 [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
1715 for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
1716 for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
1718 [#ifdef HAVE_SYS_TYPES_H
1719 #include <sys/types.h>
1721 #ifdef HAVE_SYS_TIME_H
1722 #include <sys/time.h>
1724 #ifdef HAVE_SYS_SELECT_H
1725 #include <sys/select.h>
1727 #ifdef HAVE_SYS_SOCKET_H
1728 #include <sys/socket.h>
1730 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
1731 [ac_not_found=no ; break 3],ac_not_found=yes)
1738 if test "$ac_not_found" = yes; then
1739 ac_cv_func_select_arg1=int
1740 ac_cv_func_select_arg234='int *'
1741 ac_cv_func_select_arg5='struct timeval *'
1743 AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5])
1744 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1)
1745 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234))
1746 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5))
1750 dnl ### Checks for structure members
1753 AC_DEFUN(AC_HEADER_TIME,
1754 [AC_CACHE_CHECK([whether time.h and sys/time.h may both be included],
1756 [AC_TRY_COMPILE([#include <sys/types.h>
1757 #include <sys/time.h>
1759 [struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])
1760 if test $ac_cv_header_time = yes; then
1761 AC_DEFINE(TIME_WITH_SYS_TIME)
1765 AC_DEFUN(AC_STRUCT_TM,
1766 [AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h],
1768 [AC_TRY_COMPILE([#include <sys/types.h>
1770 [struct tm *tp; tp->tm_sec;],
1771 ac_cv_struct_tm=time.h, ac_cv_struct_tm=sys/time.h)])
1772 if test $ac_cv_struct_tm = sys/time.h; then
1773 AC_DEFINE(TM_IN_SYS_TIME)
1777 AC_DEFUN(AC_STRUCT_TIMEZONE,
1778 [AC_REQUIRE([AC_STRUCT_TM])dnl
1779 AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
1780 [AC_TRY_COMPILE([#include <sys/types.h>
1781 #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
1782 ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
1783 if test "$ac_cv_struct_tm_zone" = yes; then
1784 AC_DEFINE(HAVE_TM_ZONE)
1786 AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
1788 changequote(<<, >>)dnl
1790 #ifndef tzname /* For SGI. */
1791 extern char *tzname[]; /* RS6000 and others reject char **tzname. */
1793 changequote([, ])dnl
1794 [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
1795 if test $ac_cv_var_tzname = yes; then
1796 AC_DEFINE(HAVE_TZNAME)
1801 AC_DEFUN(AC_STRUCT_ST_BLOCKS,
1802 [AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
1803 [AC_TRY_COMPILE([#include <sys/types.h>
1804 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
1805 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
1806 if test $ac_cv_struct_st_blocks = yes; then
1807 AC_DEFINE(HAVE_ST_BLOCKS)
1809 LIBOBJS="$LIBOBJS fileblocks.${ac_objext}"
1811 AC_SUBST(LIBOBJS)dnl
1814 AC_DEFUN(AC_STRUCT_ST_BLKSIZE,
1815 [AC_CACHE_CHECK([for st_blksize in struct stat], ac_cv_struct_st_blksize,
1816 [AC_TRY_COMPILE([#include <sys/types.h>
1817 #include <sys/stat.h>], [struct stat s; s.st_blksize;],
1818 ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)])
1819 if test $ac_cv_struct_st_blksize = yes; then
1820 AC_DEFINE(HAVE_ST_BLKSIZE)
1824 AC_DEFUN(AC_STRUCT_ST_RDEV,
1825 [AC_CACHE_CHECK([for st_rdev in struct stat], ac_cv_struct_st_rdev,
1826 [AC_TRY_COMPILE([#include <sys/types.h>
1827 #include <sys/stat.h>], [struct stat s; s.st_rdev;],
1828 ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)])
1829 if test $ac_cv_struct_st_rdev = yes; then
1830 AC_DEFINE(HAVE_ST_RDEV)
1835 dnl ### Checks for compiler characteristics
1838 AC_DEFUN(AC_C_CROSS,
1839 [AC_OBSOLETE([$0], [; it has been merged into AC_PROG_CC])])
1841 AC_DEFUN(AC_C_CHAR_UNSIGNED,
1842 [AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned,
1843 [if test "$GCC" = yes; then
1844 # GCC predefines this symbol on systems where it applies.
1846 [#ifdef __CHAR_UNSIGNED__
1849 ], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)
1852 [/* volatile prevents gcc2 from optimizing the test away on sparcs. */
1853 #if !defined(__STDC__) || __STDC__ != 1
1857 volatile char c = 255; exit(c < 0);
1858 }], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)
1860 if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
1861 AC_DEFINE(__CHAR_UNSIGNED__)
1865 AC_DEFUN(AC_C_LONG_DOUBLE,
1866 [AC_CACHE_CHECK(for long double, ac_cv_c_long_double,
1867 [if test "$GCC" = yes; then
1868 ac_cv_c_long_double=yes
1870 AC_TRY_RUN([int main() {
1871 /* The Stardent Vistra knows sizeof(long double), but does not support it. */
1872 long double foo = 0.0;
1873 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
1874 exit(sizeof(long double) < sizeof(double)); }],
1875 ac_cv_c_long_double=yes, ac_cv_c_long_double=no)
1877 if test $ac_cv_c_long_double = yes; then
1878 AC_DEFINE(HAVE_LONG_DOUBLE)
1882 AC_DEFUN(AC_INT_16_BITS,
1883 [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(int)])dnl
1884 AC_MSG_CHECKING(whether int is 16 bits)
1885 AC_TRY_RUN([main() { exit(sizeof(int) != 2); }],
1887 AC_DEFINE(INT_16_BITS)], AC_MSG_RESULT(no))
1890 AC_DEFUN(AC_LONG_64_BITS,
1891 [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(long)])dnl
1892 AC_MSG_CHECKING(whether long int is 64 bits)
1893 AC_TRY_RUN([main() { exit(sizeof(long int) != 8); }],
1895 AC_DEFINE(LONG_64_BITS)], AC_MSG_RESULT(no))
1898 AC_DEFUN(AC_C_BIGENDIAN,
1899 [AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
1900 [ac_cv_c_bigendian=unknown
1901 # See if sys/param.h defines the BYTE_ORDER macro.
1902 AC_TRY_COMPILE([#include <sys/types.h>
1903 #include <sys/param.h>], [
1904 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
1906 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
1907 AC_TRY_COMPILE([#include <sys/types.h>
1908 #include <sys/param.h>], [
1909 #if BYTE_ORDER != BIG_ENDIAN
1911 #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
1912 if test $ac_cv_c_bigendian = unknown; then
1913 AC_TRY_RUN([main () {
1914 /* Are we little or big endian? From Harbison&Steele. */
1918 char c[sizeof (long)];
1921 exit (u.c[sizeof (long) - 1] == 1);
1922 }], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes)
1924 if test $ac_cv_c_bigendian = yes; then
1925 AC_DEFINE(WORDS_BIGENDIAN)
1929 dnl Do nothing if the compiler accepts the inline keyword.
1930 dnl Otherwise define inline to __inline__ or __inline if one of those work,
1931 dnl otherwise define inline to be empty.
1932 AC_DEFUN(AC_C_INLINE,
1933 [AC_CACHE_CHECK([for inline], ac_cv_c_inline,
1935 for ac_kw in inline __inline__ __inline; do
1936 AC_TRY_COMPILE(, [} $ac_kw foo() {], [ac_cv_c_inline=$ac_kw; break])
1939 case "$ac_cv_c_inline" in
1941 no) AC_DEFINE(inline, ) ;;
1942 *) AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;;
1946 AC_DEFUN(AC_C_CONST,
1947 [dnl This message is consistent in form with the other checking messages,
1948 dnl and with the result message.
1949 AC_CACHE_CHECK([for working const], ac_cv_c_const,
1951 changequote(<<, >>)dnl
1953 /* Ultrix mips cc rejects this. */
1954 typedef int charset[2]; const charset x;
1955 /* SunOS 4.1.1 cc rejects this. */
1956 char const *const *ccp;
1958 /* NEC SVR4.0.2 mips cc rejects this. */
1959 struct point {int x, y;};
1960 static struct point const zero = {0,0};
1961 /* AIX XL C 1.02.0.0 rejects this.
1962 It does not let you subtract one const X* pointer from another in an arm
1963 of an if-expression whose if-part is not a constant expression */
1964 const char *g = "string";
1965 ccp = &g + (g ? g-g : 0);
1966 /* HPUX 7.0 cc rejects these. */
1969 ccp = (char const *const *) p;
1970 { /* SCO 3.2v4 cc rejects this. */
1972 char const *s = 0 ? (char *) 0 : (char const *) 0;
1976 { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
1978 const int *foo = &x[0];
1981 { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
1982 typedef const int *iptr;
1986 { /* AIX XL C 1.02.0.0 rejects this saying
1987 "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
1988 struct s { int j; const int *ap[3]; };
1989 struct s *b; b->j = 5;
1991 { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
1995 changequote([, ])dnl
1996 ac_cv_c_const=yes, ac_cv_c_const=no)])
1997 if test $ac_cv_c_const = no; then
2002 AC_DEFUN(AC_C_STRINGIZE, [
2003 AC_REQUIRE([AC_PROG_CPP])
2004 AC_MSG_CHECKING([for preprocessor stringizing operator])
2005 AC_CACHE_VAL(ac_cv_c_stringize,
2006 AC_EGREP_CPP([#teststring],[
2009 char *s = x(teststring);
2010 ], ac_cv_c_stringize=no, ac_cv_c_stringize=yes))
2011 if test "${ac_cv_c_stringize}" = yes
2013 AC_DEFINE(HAVE_STRINGIZE)
2015 AC_MSG_RESULT([${ac_cv_c_stringize}])
2018 define(AC_ARG_ARRAY,
2019 [errprint(__file__:__line__: [$0] has been removed; don't do unportable things with arguments
2022 dnl Check the object extension used by the compiler: typically .o or
2023 dnl .obj. If this is called, some other behaviour will change,
2024 dnl determined by ac_objext.
2026 [AC_MSG_CHECKING([for object suffix])
2027 AC_CACHE_VAL(ac_cv_objext,
2029 echo 'int i = 1;' > conftest.$ac_ext
2030 if AC_TRY_EVAL(ac_compile); then
2031 for ac_file in conftest.*; do
2034 *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
2038 AC_MSG_ERROR([installation or configuration problem; compiler does not work])
2041 AC_MSG_RESULT($ac_cv_objext)
2042 OBJEXT=$ac_cv_objext
2043 ac_objext=$ac_cv_objext
2046 dnl Determine the linker flags (e.g. `-L' and `-l') for the Fortran 77
2047 dnl intrinsic and run-time libraries that are required to successfully
2048 dnl link a Fortran 77 program or shared library. The output variable
2049 dnl FLIBS is set to these flags.
2051 dnl This macro is intended to be used in those situations when it is
2052 dnl necessary to mix, e.g. C++ and Fortran 77, source code into a single
2053 dnl program or shared library.
2055 dnl For example, if object files from a C++ and Fortran 77 compiler must
2056 dnl be linked together, then the C++ compiler/linker must be used for
2057 dnl linking (since special C++-ish things need to happen at link time
2058 dnl like calling global constructors, instantiating templates, enabling
2059 dnl exception support, etc.).
2061 dnl However, the Fortran 77 intrinsic and run-time libraries must be
2062 dnl linked in as well, but the C++ compiler/linker doesn't know how to
2063 dnl add these Fortran 77 libraries. Hence, the macro
2064 dnl `AC_F77_LIBRARY_LDFLAGS' was created to determine these Fortran 77
2067 dnl This macro was packaged in its current form by Matthew D. Langston
2068 dnl <langston@SLAC.Stanford.EDU>. However, nearly all of this macro
2069 dnl came from the `OCTAVE_FLIBS' macro in `octave-2.0.13/aclocal.m4',
2070 dnl and full credit should go to John W. Eaton for writing this
2071 dnl extremely useful macro. Thank you John.
2073 dnl AC_F77_LIBRARY_LDFLAGS()
2074 AC_DEFUN(AC_F77_LIBRARY_LDFLAGS,
2075 [AC_MSG_CHECKING([for Fortran 77 libraries])
2076 AC_REQUIRE([AC_PROG_F77])
2077 AC_REQUIRE([AC_CANONICAL_HOST])
2078 AC_CACHE_VAL(ac_cv_flibs,
2080 dnl Write a minimal program and compile it with -v. I don't know what
2081 dnl to do if your compiler doesn't have -v...
2082 echo " END" > conftest.f
2083 foutput=`${F77} -v -o conftest conftest.f 2>&1`
2085 dnl The easiest thing to do for xlf output is to replace all the commas
2086 dnl with spaces. Try to only do that if the output is really from xlf,
2087 dnl since doing that causes problems on other systems.
2089 xlf_p=`echo $foutput | grep xlfentry`
2090 if test -n "$xlf_p"; then
2091 foutput=`echo $foutput | sed 's/,/ /g'`
2094 ld_run_path=`echo $foutput | \
2095 sed -n -e 's/^.*LD_RUN_PATH *= *\([^ ]*\).*/\1/p'`
2097 dnl We are only supposed to find this on Solaris systems...
2098 dnl Uh, the run path should be absolute, shouldn't it?
2100 case "$ld_run_path" in
2102 if test "$ac_cv_prog_gcc" = yes; then
2103 ld_run_path="-Xlinker -R -Xlinker $ld_run_path"
2105 ld_run_path="-R $ld_run_path"
2116 dnl If want_arg is set, we know we want the arg to be added to the list,
2117 dnl so we don't have to examine it.
2121 for arg in $foutput; do
2122 old_want_arg=$want_arg
2125 dnl None of the options that take arguments expect the argument to
2126 dnl start with a -, so pretend we didn't see anything special.
2128 if test -n "$old_want_arg"; then
2135 case "$old_want_arg" in
2140 for f in $lflags; do
2141 if test x$arg = x$f; then
2148 lflags="$lflags $arg"
2153 for f in $lflags; do
2154 if test x$arg = x$f; then
2161 if test "$ac_cv_prog_gcc" = yes; then
2162 lflags="$lflags -Xlinker $arg"
2164 lflags="$lflags $arg"
2168 -lang* | -lcrt0.o | -lc | -lgcc)
2177 for f in $lflags; do
2178 if test x$arg = x$f; then
2187 case "$canonical_host_type" in
2192 lflags="$lflags $arg"
2199 lflags="$lflags $arg"
2218 arg="$old_want_arg $arg"
2225 dnl Should probably try to ensure unique directory options here too.
2226 dnl This probably only applies to Solaris systems, and then will only
2227 dnl work with gcc...
2229 arg=`echo $arg | sed -e 's%^P,%%'`
2241 if test -n "$arg"; then
2245 if test -n "$ld_run_path"; then
2246 flibs_result="$ld_run_path $flibs"
2248 flibs_result="$flibs"
2250 changequote([, ])dnl
2251 ac_cv_flibs="$flibs_result"])
2252 FLIBS="$ac_cv_flibs"
2254 AC_MSG_RESULT($FLIBS)
2258 dnl ### Checks for operating system services
2261 AC_DEFUN(AC_SYS_INTERPRETER,
2262 [# Pull the hash mark out of the macro call to avoid m4 problems.
2263 ac_msg="whether #! works in shell scripts"
2264 AC_CACHE_CHECK($ac_msg, ac_cv_sys_interpreter,
2269 (SHELL=/bin/sh; export SHELL; ./conftest >/dev/null)
2270 if test $? -ne 69; then
2271 ac_cv_sys_interpreter=yes
2273 ac_cv_sys_interpreter=no
2276 interpval="$ac_cv_sys_interpreter"
2279 define(AC_HAVE_POUNDBANG,
2280 [errprint(__file__:__line__: [$0 has been replaced by AC_SYS_INTERPRETER, taking no arguments
2283 AC_DEFUN(AC_SYS_LONG_FILE_NAMES,
2284 [AC_CACHE_CHECK(for long file names, ac_cv_sys_long_file_names,
2285 [ac_cv_sys_long_file_names=yes
2286 # Test for long file names in all the places we know might matter:
2287 # . the current directory, where building will happen
2288 # $prefix/lib where we will be installing things
2289 # $exec_prefix/lib likewise
2290 # eval it to expand exec_prefix.
2291 # $TMPDIR if set, where it might want to write temporary files
2292 # if $TMPDIR is not set:
2293 # /tmp where it might want to write temporary files
2296 if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then
2297 ac_tmpdirs="$TMPDIR"
2299 ac_tmpdirs='/tmp /var/tmp /usr/tmp'
2301 for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do
2302 test -d $ac_dir || continue
2303 test -w $ac_dir || continue # It is less confusing to not echo anything here.
2304 (echo 1 > $ac_dir/conftest9012345) 2>/dev/null
2305 (echo 2 > $ac_dir/conftest9012346) 2>/dev/null
2306 val=`cat $ac_dir/conftest9012345 2>/dev/null`
2307 if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then
2308 ac_cv_sys_long_file_names=no
2309 rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null
2312 rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null
2314 if test $ac_cv_sys_long_file_names = yes; then
2315 AC_DEFINE(HAVE_LONG_FILE_NAMES)
2319 AC_DEFUN(AC_SYS_RESTARTABLE_SYSCALLS,
2320 [AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls,
2322 [/* Exit 0 (true) if wait returns something other than -1,
2323 i.e. the pid of the child, which means that wait was restarted
2324 after getting the signal. */
2325 #include <sys/types.h>
2329 int i = fork (), status;
2330 if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); }
2331 signal (SIGINT, ucatch);
2333 if (status == -1) wait(&i);
2334 exit (status == -1);
2336 ], ac_cv_sys_restartable_syscalls=yes, ac_cv_sys_restartable_syscalls=no)])
2337 if test $ac_cv_sys_restartable_syscalls = yes; then
2338 AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS)
2343 [AC_REQUIRE_CPP()dnl Set CPP; we run AC_PATH_X_DIRECT conditionally.
2344 # If we find X, set shell vars x_includes and x_libraries to the
2345 # paths, otherwise set no_x=yes.
2346 # Uses ac_ vars as temps to allow command line to override cache and checks.
2347 # --without-x overrides everything else, but does not touch the cache.
2348 AC_MSG_CHECKING(for X)
2350 AC_ARG_WITH(x, [ --with-x use the X Window System])
2351 # $have_x is `yes', `no', `disabled', or empty when we do not yet know.
2352 if test "x$with_x" = xno; then
2353 # The user explicitly disabled X.
2356 if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
2357 # Both variables are already set.
2360 AC_CACHE_VAL(ac_cv_have_x,
2361 [# One or both of the vars are not set, and there is no cached value.
2362 ac_x_includes=NO ac_x_libraries=NO
2365 if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
2366 # Didn't find X anywhere. Cache the known absence of X.
2367 ac_cv_have_x="have_x=no"
2369 # Record where we found X for the cache.
2370 ac_cv_have_x="have_x=yes \
2371 ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
2374 eval "$ac_cv_have_x"
2377 if test "$have_x" != yes; then
2378 AC_MSG_RESULT($have_x)
2381 # If each of the values was on the command line, it overrides each guess.
2382 test "x$x_includes" = xNONE && x_includes=$ac_x_includes
2383 test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
2384 # Update the cache value to reflect the command line values.
2385 ac_cv_have_x="have_x=yes \
2386 ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
2387 AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
2391 dnl Internal subroutine of AC_PATH_X.
2392 dnl Set ac_x_includes and/or ac_x_libraries.
2393 AC_DEFUN(AC_PATH_X_XMKMF,
2395 if mkdir conftestdir; then
2397 # Make sure to not put "make" in the Imakefile rules, since we grep it out.
2398 cat > Imakefile <<'EOF'
2400 @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
2402 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
2403 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
2404 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
2405 # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
2406 for ac_extension in a so sl; do
2407 if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
2408 test -f $ac_im_libdir/libX11.$ac_extension; then
2409 ac_im_usrlibdir=$ac_im_libdir; break
2412 # Screen out bogus values from the imake configuration. They are
2413 # bogus both because they are the default anyway, and because
2414 # using them would break gcc on systems where it needs fixed includes.
2415 case "$ac_im_incroot" in
2417 *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
2419 case "$ac_im_usrlibdir" in
2421 *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
2429 dnl Internal subroutine of AC_PATH_X.
2430 dnl Set ac_x_includes and/or ac_x_libraries.
2431 AC_DEFUN(AC_PATH_X_DIRECT,
2432 [if test "$ac_x_includes" = NO; then
2433 # Guess where to find include files, by looking for this one X11 .h file.
2434 test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
2436 # First, try using that file with no special directory specified.
2437 AC_TRY_CPP([#include <$x_direct_test_include>],
2438 [# We can compile using X headers with no special include directory.
2440 [# Look for the header file in a standard set of common directories.
2441 # Check X11 before X11Rn because it is often a symlink to the current release.
2444 /usr/X11R6/include \
2445 /usr/X11R5/include \
2446 /usr/X11R4/include \
2449 /usr/include/X11R6 \
2450 /usr/include/X11R5 \
2451 /usr/include/X11R4 \
2453 /usr/local/X11/include \
2454 /usr/local/X11R6/include \
2455 /usr/local/X11R5/include \
2456 /usr/local/X11R4/include \
2458 /usr/local/include/X11 \
2459 /usr/local/include/X11R6 \
2460 /usr/local/include/X11R5 \
2461 /usr/local/include/X11R4 \
2465 /usr/XFree86/include/X11 \
2468 /usr/local/include \
2469 /usr/unsupported/include \
2470 /usr/athena/include \
2471 /usr/local/x11r5/include \
2472 /usr/lpp/Xamples/include \
2474 /usr/openwin/include \
2475 /usr/openwin/share/include \
2478 if test -r "$ac_dir/$x_direct_test_include"; then
2479 ac_x_includes=$ac_dir
2483 fi # $ac_x_includes = NO
2485 if test "$ac_x_libraries" = NO; then
2486 # Check for the libraries.
2488 test -z "$x_direct_test_library" && x_direct_test_library=Xt
2489 test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
2491 # See if we find them without any special options.
2492 # Don't add to $LIBS permanently.
2493 ac_save_LIBS="$LIBS"
2494 LIBS="-l$x_direct_test_library $LIBS"
2495 AC_TRY_LINK(, [${x_direct_test_function}()],
2496 [LIBS="$ac_save_LIBS"
2497 # We can link X programs with no special library path.
2499 [LIBS="$ac_save_LIBS"
2500 # First see if replacing the include by lib works.
2501 # Check X11 before X11Rn because it is often a symlink to the current release.
2502 for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
2513 /usr/local/X11/lib \
2514 /usr/local/X11R6/lib \
2515 /usr/local/X11R5/lib \
2516 /usr/local/X11R4/lib \
2518 /usr/local/lib/X11 \
2519 /usr/local/lib/X11R6 \
2520 /usr/local/lib/X11R5 \
2521 /usr/local/lib/X11R4 \
2525 /usr/XFree86/lib/X11 \
2529 /usr/unsupported/lib \
2531 /usr/local/x11r5/lib \
2532 /usr/lpp/Xamples/lib \
2536 /usr/openwin/share/lib \
2539 dnl Don't even attempt the hair of trying to link an X program!
2540 for ac_extension in a so sl; do
2541 if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
2542 ac_x_libraries=$ac_dir
2547 fi # $ac_x_libraries = NO
2550 dnl Find additional X libraries, magic flags, etc.
2551 AC_DEFUN(AC_PATH_XTRA,
2552 [AC_REQUIRE([AC_PATH_X])dnl
2553 if test "$no_x" = yes; then
2554 # Not all programs may use this symbol, but it does not hurt to define it.
2555 AC_DEFINE(X_DISPLAY_MISSING)
2556 X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
2558 if test -n "$x_includes"; then
2559 X_CFLAGS="$X_CFLAGS -I$x_includes"
2562 # It would also be nice to do this for all -L options, not just this one.
2563 if test -n "$x_libraries"; then
2564 X_LIBS="$X_LIBS -L$x_libraries"
2565 dnl FIXME banish uname from this macro!
2566 # For Solaris; some versions of Sun CC require a space after -R and
2567 # others require no space. Words are not sufficient . . . .
2568 case "`(uname -sr) 2>/dev/null`" in
2570 AC_MSG_CHECKING(whether -R must be followed by a space)
2571 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
2572 AC_TRY_LINK(, , ac_R_nospace=yes, ac_R_nospace=no)
2573 if test $ac_R_nospace = yes; then
2575 X_LIBS="$X_LIBS -R$x_libraries"
2577 LIBS="$ac_xsave_LIBS -R $x_libraries"
2578 AC_TRY_LINK(, , ac_R_space=yes, ac_R_space=no)
2579 if test $ac_R_space = yes; then
2581 X_LIBS="$X_LIBS -R $x_libraries"
2583 AC_MSG_RESULT(neither works)
2586 LIBS="$ac_xsave_LIBS"
2590 # Check for system-dependent libraries X programs must link with.
2591 # Do this before checking for the system-independent R6 libraries
2592 # (-lICE), since we may need -lsocket or whatever for X linking.
2594 if test "$ISC" = yes; then
2595 X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
2597 # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
2598 # libraries were built with DECnet support. And karl@cs.umb.edu says
2599 # the Alpha needs dnet_stub (dnet does not exist).
2600 AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
2601 if test $ac_cv_lib_dnet_dnet_ntoa = no; then
2602 AC_CHECK_LIB(dnet_stub, dnet_ntoa,
2603 [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
2606 # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
2607 # to get the SysV transport functions.
2608 # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4)
2610 # The nsl library prevents programs from opening the X display
2611 # on Irix 5.2, according to dickey@clark.net.
2612 AC_CHECK_FUNC(gethostbyname)
2613 if test $ac_cv_func_gethostbyname = no; then
2614 AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
2617 # lieder@skyler.mavd.honeywell.com says without -lsocket,
2618 # socket/setsockopt and other routines are undefined under SCO ODT
2619 # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
2620 # on later versions), says simon@lia.di.epfl.ch: it contains
2621 # gethostby* variants that don't use the nameserver (or something).
2622 # -lsocket must be given before -lnsl if both are needed.
2623 # We assume that if connect needs -lnsl, so does gethostbyname.
2624 AC_CHECK_FUNC(connect)
2625 if test $ac_cv_func_connect = no; then
2626 AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
2630 # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
2631 AC_CHECK_FUNC(remove)
2632 if test $ac_cv_func_remove = no; then
2633 AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
2636 # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
2637 AC_CHECK_FUNC(shmat)
2638 if test $ac_cv_func_shmat = no; then
2639 AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
2643 # Check for libraries that X11R6 Xt/Xaw programs need.
2644 ac_save_LDFLAGS="$LDFLAGS"
2645 test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
2646 # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
2647 # check for ICE first), but we must link in the order -lSM -lICE or
2648 # we get undefined symbols. So assume we have SM if we have ICE.
2649 # These have to be linked with before -lX11, unlike the other
2650 # libraries we check for below, so use a different variable.
2651 # --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
2652 AC_CHECK_LIB(ICE, IceConnectionNumber,
2653 [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"], , $X_EXTRA_LIBS)
2654 LDFLAGS="$ac_save_LDFLAGS"
2657 AC_SUBST(X_CFLAGS)dnl
2658 AC_SUBST(X_PRE_LIBS)dnl
2660 AC_SUBST(X_EXTRA_LIBS)dnl
2663 dnl The old Cygwin32 macro is deprecated.
2664 AC_DEFUN(AC_CYGWIN32,
2665 [AC_OBSOLETE([$0], [; instead use AC_CYGWIN])dnl
2668 dnl Check for Cygwin. This is a way to set the right value for
2671 [AC_CACHE_CHECK(for Cygwin environment, ac_cv_cygwin,
2674 #define __CYGWIN__ __CYGWIN32__
2676 return __CYGWIN__;],
2677 ac_cv_cygwin=yes, ac_cv_cygwin=no)
2680 test "$ac_cv_cygwin" = yes && CYGWIN=yes])
2682 dnl Check for mingw32. This is another way to set the right value for
2684 AC_DEFUN(AC_MINGW32,
2685 [AC_CACHE_CHECK(for mingw32 environment, ac_cv_mingw32,
2686 [AC_TRY_COMPILE(,[return __MINGW32__;],
2687 ac_cv_mingw32=yes, ac_cv_mingw32=no)
2690 test "$ac_cv_mingw32" = yes && MINGW32=yes])
2692 dnl Check for the extension used for executables. This knows that we
2693 dnl add .exe for Cygwin or mingw32. Otherwise, it compiles a test
2694 dnl executable. If this is called, the executable extensions will be
2695 dnl automatically used by link commands run by the configure script.
2697 [AC_REQUIRE([AC_CYGWIN])
2698 AC_REQUIRE([AC_MINGW32])
2699 AC_MSG_CHECKING([for executable suffix])
2700 AC_CACHE_VAL(ac_cv_exeext,
2701 [if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
2705 echo 'int main () { return 0; }' > conftest.$ac_ext
2707 if AC_TRY_EVAL(ac_link); then
2708 for file in conftest.*; do
2710 *.c | *.o | *.obj) ;;
2711 *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
2715 AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.])
2718 test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
2721 test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
2722 AC_MSG_RESULT(${ac_cv_exeext})
2723 dnl Setting ac_exeext will implicitly change the ac_link command.
2728 dnl ### Checks for UNIX variants
2729 dnl These are kludges which should be replaced by a single POSIX check.
2730 dnl They aren't cached, to discourage their use.
2734 [AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
2735 AC_BEFORE([$0], [AC_TRY_RUN])dnl
2736 AC_MSG_CHECKING(for AIX)
2741 ], [AC_MSG_RESULT(yes); AC_DEFINE(_ALL_SOURCE)], AC_MSG_RESULT(no))
2745 [AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
2746 AC_BEFORE([$0], [AC_TRY_RUN])dnl
2747 AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=)
2748 if test "$MINIX" = yes; then
2749 AC_DEFINE(_POSIX_SOURCE)
2750 AC_DEFINE(_POSIX_1_SOURCE, 2)
2755 AC_DEFUN(AC_ISC_POSIX,
2756 [AC_REQUIRE([AC_PROG_CC])dnl
2757 AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
2758 AC_BEFORE([$0], [AC_TRY_RUN])dnl
2759 AC_MSG_CHECKING(for POSIXized ISC)
2760 if test -d /etc/conf/kconfig.d &&
2761 grep _POSIX_VERSION [/usr/include/sys/unistd.h] >/dev/null 2>&1
2764 ISC=yes # If later tests want to check for ISC.
2765 AC_DEFINE(_POSIX_SOURCE)
2766 if test "$GCC" = yes; then
2777 AC_DEFUN(AC_XENIX_DIR,
2778 [AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl
2779 AC_REQUIRE([AC_DIR_HEADER])dnl
2780 AC_MSG_CHECKING(for Xenix)
2782 [#if defined(M_XENIX) && !defined(M_UNIX)
2785 ], [AC_MSG_RESULT(yes); XENIX=yes], [AC_MSG_RESULT(no); XENIX=])
2786 if test "$XENIX" = yes; then
2787 # Make sure -ldir precedes -lx.
2788 test $ac_header_dirent = dirent.h && LIBS="-ldir $LIBS"
2793 AC_DEFUN(AC_DYNIX_SEQ,
2794 [AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT])dnl
2795 AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS")
2798 AC_DEFUN(AC_IRIX_SUN,
2799 [AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT or AC_CHECK_LIB(sun, getpwnam)])dnl
2800 AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS")
2803 AC_DEFUN(AC_SCO_INTL,
2804 [AC_OBSOLETE([$0], [; instead use AC_FUNC_STRFTIME])dnl
2805 AC_CHECK_LIB(intl, strftime, LIBS="-lintl $LIBS")