1dnl Macros that test for specific features. 2dnl This file is part of Autoconf. 3dnl Copyright (C) 1992, 93, 94, 95, 96, 1998 Free Software Foundation, Inc. 4dnl 5dnl This program is free software; you can redistribute it and/or modify 6dnl it under the terms of the GNU General Public License as published by 7dnl the Free Software Foundation; either version 2, or (at your option) 8dnl any later version. 9dnl 10dnl This program is distributed in the hope that it will be useful, 11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13dnl GNU General Public License for more details. 14dnl 15dnl You should have received a copy of the GNU General Public License 16dnl along with this program; if not, write to the Free Software 17dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18dnl 02111-1307, USA. 19dnl 20dnl As a special exception, the Free Software Foundation gives unlimited 21dnl permission to copy, distribute and modify the configure scripts that 22dnl are the output of Autoconf. You need not follow the terms of the GNU 23dnl General Public License when using or distributing such scripts, even 24dnl though portions of the text of Autoconf appear in them. The GNU 25dnl General Public License (GPL) does govern all other use of the material 26dnl that constitutes the Autoconf program. 27dnl 28dnl Certain portions of the Autoconf source text are designed to be copied 29dnl (in certain cases, depending on the input) into the output of 30dnl Autoconf. We call these the "data" portions. The rest of the Autoconf 31dnl source text consists of comments plus executable code that decides which 32dnl of the data portions to output in any given case. We call these 33dnl comments and executable code the "non-data" portions. Autoconf never 34dnl copies any of the non-data portions into its output. 35dnl 36dnl This special exception to the GPL applies to versions of Autoconf 37dnl released by the Free Software Foundation. When you make and 38dnl distribute a modified version of Autoconf, you may extend this special 39dnl exception to the GPL to apply to your modified version as well, *unless* 40dnl your modified version has the potential to copy into its output some 41dnl of the text that was the non-data portion of the version that you started 42dnl with. (In other words, unless your change moves or copies text from 43dnl the non-data portions to the data portions.) If your modification has 44dnl such potential, you must delete any notice of this special exception 45dnl to the GPL from your modified version. 46dnl 47dnl Written by David MacKenzie, with help from 48dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, 49dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. 50 51 52dnl ### Checks for programs 53 54 55dnl Check whether to use -n, \c, or newline-tab to separate 56dnl checking messages from result messages. 57dnl Idea borrowed from dist 3.0. 58dnl Internal use only. 59AC_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 63 ac_n= ac_c=' 64' ac_t=' ' 65 else 66 ac_n=-n ac_c= ac_t= 67 fi 68else 69 ac_n= ac_c='\c' ac_t= 70fi 71]) 72 73AC_DEFUN(AC_PROG_CC, 74[AC_BEFORE([$0], [AC_PROG_CPP])dnl 75AC_CHECK_PROG(CC, gcc, gcc) 76if test -z "$CC"; then 77 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) 78 if test -z "$CC"; then 79 case "`uname -s`" in 80 *win32* | *WIN32*) 81 AC_CHECK_PROG(CC, cl, cl) ;; 82 esac 83 fi 84 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) 85fi 86 87AC_PROG_CC_WORKS 88AC_PROG_CC_GNU 89 90if test $ac_cv_prog_gcc = yes; then 91 GCC=yes 92else 93 GCC= 94fi 95 96dnl Check whether -g works, even if CFLAGS is set, in case the package 97dnl plays around with CFLAGS (such as to build both debugging and 98dnl normal versions of a library), tasteless as that idea is. 99ac_test_CFLAGS="${CFLAGS+set}" 100ac_save_CFLAGS="$CFLAGS" 101CFLAGS= 102AC_PROG_CC_G 103if test "$ac_test_CFLAGS" = set; then 104 CFLAGS="$ac_save_CFLAGS" 105elif test $ac_cv_prog_cc_g = yes; then 106 if test "$GCC" = yes; then 107 CFLAGS="-g -O2" 108 else 109 CFLAGS="-g" 110 fi 111else 112 if test "$GCC" = yes; then 113 CFLAGS="-O2" 114 else 115 CFLAGS= 116 fi 117fi 118]) 119 120AC_DEFUN(AC_PROG_CXX, 121[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl 122AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, gcc) 123 124AC_PROG_CXX_WORKS 125AC_PROG_CXX_GNU 126 127if test $ac_cv_prog_gxx = yes; then 128 GXX=yes 129else 130 GXX= 131fi 132 133dnl Check whether -g works, even if CXXFLAGS is set, in case the package 134dnl plays around with CXXFLAGS (such as to build both debugging and 135dnl normal versions of a library), tasteless as that idea is. 136ac_test_CXXFLAGS="${CXXFLAGS+set}" 137ac_save_CXXFLAGS="$CXXFLAGS" 138CXXFLAGS= 139AC_PROG_CXX_G 140if test "$ac_test_CXXFLAGS" = set; then 141 CXXFLAGS="$ac_save_CXXFLAGS" 142elif test $ac_cv_prog_cxx_g = yes; then 143 if test "$GXX" = yes; then 144 CXXFLAGS="-g -O2" 145 else 146 CXXFLAGS="-g" 147 fi 148else 149 if test "$GXX" = yes; then 150 CXXFLAGS="-O2" 151 else 152 CXXFLAGS= 153 fi 154fi 155]) 156 157dnl Determine a Fortran 77 compiler to use. If `F77' is not already set 158dnl in the environment, check for `g77', `f77' and `f2c', in that order. 159dnl Set the output variable `F77' to the name of the compiler found. 160dnl 161dnl If using `g77' (the GNU Fortran 77 compiler), then `AC_PROG_F77' 162dnl will set the shell variable `G77' to `yes', and empty otherwise. If 163dnl the output variable `FFLAGS' was not already set in the environment, 164dnl then set it to `-g -02' for `g77' (or `-O2' where `g77' does not 165dnl accept `-g'). Otherwise, set `FFLAGS' to `-g' for all other Fortran 166dnl 77 compilers. 167dnl 168dnl AC_PROG_F77() 169AC_DEFUN(AC_PROG_F77, 170[AC_BEFORE([$0], [AC_PROG_CPP])dnl 171if test -z "$F77"; then 172 AC_CHECK_PROGS(F77, g77 f77 f2c) 173 test -z "$F77" && AC_MSG_ERROR([no acceptable Fortran 77 compiler found in \$PATH]) 174fi 175 176AC_PROG_F77_WORKS 177AC_PROG_F77_GNU 178 179if test $ac_cv_prog_g77 = yes; then 180 G77=yes 181dnl Check whether -g works, even if FFLAGS is set, in case the package 182dnl plays around with FFLAGS (such as to build both debugging and 183dnl normal versions of a library), tasteless as that idea is. 184 ac_test_FFLAGS="${FFLAGS+set}" 185 ac_save_FFLAGS="$FFLAGS" 186 FFLAGS= 187 AC_PROG_F77_G 188 if test "$ac_test_FFLAGS" = set; then 189 FFLAGS="$ac_save_FFLAGS" 190 elif test $ac_cv_prog_f77_g = yes; then 191 FFLAGS="-g -O2" 192 else 193 FFLAGS="-O2" 194 fi 195else 196 G77= 197 test "${FFLAGS+set}" = set || FFLAGS="-g" 198fi 199]) 200 201AC_DEFUN(AC_PROG_CC_WORKS, 202[AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works]) 203AC_LANG_SAVE 204AC_LANG_C 205AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross) 206AC_LANG_RESTORE 207AC_MSG_RESULT($ac_cv_prog_cc_works) 208if test $ac_cv_prog_cc_works = no; then 209 AC_MSG_ERROR([installation or configuration problem: C compiler cannot create executables.]) 210fi 211AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler]) 212AC_MSG_RESULT($ac_cv_prog_cc_cross) 213cross_compiling=$ac_cv_prog_cc_cross 214]) 215 216AC_DEFUN(AC_PROG_CXX_WORKS, 217[AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works]) 218AC_LANG_SAVE 219AC_LANG_CPLUSPLUS 220AC_TRY_COMPILER([int main(){return(0);}], ac_cv_prog_cxx_works, ac_cv_prog_cxx_cross) 221AC_LANG_RESTORE 222AC_MSG_RESULT($ac_cv_prog_cxx_works) 223if test $ac_cv_prog_cxx_works = no; then 224 AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.]) 225fi 226AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler]) 227AC_MSG_RESULT($ac_cv_prog_cxx_cross) 228cross_compiling=$ac_cv_prog_cxx_cross 229]) 230 231dnl Test whether the Fortran 77 compiler can compile and link a trivial 232dnl Fortran program. Also, test whether the Fortran 77 compiler is a 233dnl cross-compiler (which may realistically be the case if the Fortran 234dnl compiler is `g77'). 235dnl 236dnl AC_PROG_F77_WORKS() 237AC_DEFUN(AC_PROG_F77_WORKS, 238[AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) works]) 239AC_LANG_SAVE 240AC_LANG_FORTRAN77 241AC_TRY_COMPILER(dnl 242[ program conftest 243 end 244], ac_cv_prog_f77_works, ac_cv_prog_f77_cross) 245AC_LANG_RESTORE 246AC_MSG_RESULT($ac_cv_prog_f77_works) 247if test $ac_cv_prog_f77_works = no; then 248 AC_MSG_ERROR([installation or configuration problem: Fortran 77 compiler cannot create executables.]) 249fi 250AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler]) 251AC_MSG_RESULT($ac_cv_prog_f77_cross) 252cross_compiling=$ac_cv_prog_f77_cross 253]) 254 255AC_DEFUN(AC_PROG_CC_GNU, 256[AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc, 257[dnl The semicolon is to pacify NeXT's syntax-checking cpp. 258cat > conftest.c <<EOF 259#ifdef __GNUC__ 260 yes; 261#endif 262EOF 263if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then 264 ac_cv_prog_gcc=yes 265else 266 ac_cv_prog_gcc=no 267fi])]) 268 269AC_DEFUN(AC_PROG_CXX_GNU, 270[AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx, 271[dnl The semicolon is to pacify NeXT's syntax-checking cpp. 272cat > conftest.C <<EOF 273#ifdef __GNUC__ 274 yes; 275#endif 276EOF 277if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | egrep yes >/dev/null 2>&1; then 278 ac_cv_prog_gxx=yes 279else 280 ac_cv_prog_gxx=no 281fi])]) 282 283dnl Test whether for Fortran 77 compiler is `g77' (the GNU Fortran 77 284dnl Compiler). This test depends on whether the Fortran 77 compiler can 285dnl do CPP pre-processing. 286dnl 287dnl AC_PROG_F77_GNU() 288AC_DEFUN(AC_PROG_F77_GNU, 289[AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77, 290[cat > conftest.fpp <<EOF 291#ifdef __GNUC__ 292 yes 293#endif 294EOF 295if AC_TRY_COMMAND($F77 -E conftest.fpp) | egrep yes >/dev/null 2>&1; then 296 ac_cv_prog_g77=yes 297else 298 ac_cv_prog_g77=no 299fi])]) 300 301AC_DEFUN(AC_PROG_CC_G, 302[AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g, 303[echo 'void f(){}' > conftest.c 304if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then 305 ac_cv_prog_cc_g=yes 306else 307 ac_cv_prog_cc_g=no 308fi 309rm -f conftest* 310])]) 311 312AC_DEFUN(AC_PROG_CXX_G, 313[AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g, 314[echo 'void f(){}' > conftest.cc 315if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then 316 ac_cv_prog_cxx_g=yes 317else 318 ac_cv_prog_cxx_g=no 319fi 320rm -f conftest* 321])]) 322 323dnl Test whether the Fortran 77 compiler can accept the `-g' option to 324dnl enable debugging. 325dnl 326dnl AC_PROG_F77_G() 327AC_DEFUN(AC_PROG_F77_G, 328[AC_CACHE_CHECK(whether $F77 accepts -g, ac_cv_prog_f77_g, 329[cat > conftest.f << EOF 330 program conftest 331 end 332EOF 333if test -z "`$F77 -g -c conftest.f 2>&1`"; then 334 ac_cv_prog_f77_g=yes 335else 336 ac_cv_prog_f77_g=no 337fi 338rm -f conftest* 339])]) 340 341AC_DEFUN(AC_PROG_GCC_TRADITIONAL, 342[AC_REQUIRE([AC_PROG_CC])dnl 343AC_REQUIRE([AC_PROG_CPP])dnl 344if test $ac_cv_prog_gcc = yes; then 345 AC_CACHE_CHECK(whether ${CC-cc} needs -traditional, 346 ac_cv_prog_gcc_traditional, 347[ ac_pattern="Autoconf.*'x'" 348 AC_EGREP_CPP($ac_pattern, [#include <sgtty.h> 349Autoconf TIOCGETP], 350 ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no) 351 352 if test $ac_cv_prog_gcc_traditional = no; then 353 AC_EGREP_CPP($ac_pattern, [#include <termio.h> 354Autoconf TCGETA], 355 ac_cv_prog_gcc_traditional=yes) 356 fi]) 357 if test $ac_cv_prog_gcc_traditional = yes; then 358 CC="$CC -traditional" 359 fi 360fi 361]) 362 363AC_DEFUN(AC_PROG_CC_C_O, 364[if test "x$CC" != xcc; then 365 AC_MSG_CHECKING(whether $CC and cc understand -c and -o together) 366else 367 AC_MSG_CHECKING(whether cc understands -c and -o together) 368fi 369set dummy $CC; ac_cc="`echo [$]2 | 370changequote(, )dnl 371 sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" 372changequote([, ])dnl 373AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o, 374[echo 'foo(){}' > conftest.c 375# Make sure it works both with $CC and with simple cc. 376# We do the test twice because some compilers refuse to overwrite an 377# existing .o file with -o, though they will create one. 378ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&AC_FD_CC' 379if AC_TRY_EVAL(ac_try) && 380 test -f conftest.o && AC_TRY_EVAL(ac_try); 381then 382 eval ac_cv_prog_cc_${ac_cc}_c_o=yes 383 if test "x$CC" != xcc; then 384 # Test first that cc exists at all. 385 if AC_TRY_COMMAND(cc -c conftest.c 1>&AC_FD_CC); then 386 ac_try='cc -c conftest.c -o conftest.o 1>&AC_FD_CC' 387 if AC_TRY_EVAL(ac_try) && 388 test -f conftest.o && AC_TRY_EVAL(ac_try); 389 then 390 # cc works too. 391 : 392 else 393 # cc exists but doesn't like -o. 394 eval ac_cv_prog_cc_${ac_cc}_c_o=no 395 fi 396 fi 397 fi 398else 399 eval ac_cv_prog_cc_${ac_cc}_c_o=no 400fi 401rm -f conftest* 402])dnl 403if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then 404 AC_MSG_RESULT(yes) 405else 406 AC_MSG_RESULT(no) 407 AC_DEFINE(NO_MINUS_C_MINUS_O) 408fi 409]) 410 411dnl Test if the Fortran 77 compiler accepts the options `-c' and `-o' 412dnl simultaneously, and define `F77_NO_MINUS_C_MINUS_O' if it does not. 413dnl 414dnl The usefulness of this macro is questionable, as I can't really see 415dnl why anyone would use it. The only reason I include it is for 416dnl completeness, since a similar test exists for the C compiler. 417dnl 418dnl AC_PROG_F77_C_O 419AC_DEFUN(AC_PROG_F77_C_O, 420[AC_BEFORE([$0], [AC_PROG_F77])dnl 421AC_MSG_CHECKING(whether $F77 understand -c and -o together) 422set dummy $F77; ac_f77="`echo [$]2 | 423changequote(, )dnl 424sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" 425changequote([, ])dnl 426AC_CACHE_VAL(ac_cv_prog_f77_${ac_f77}_c_o, 427[cat > conftest.f << EOF 428 program conftest 429 end 430EOF 431# We do the `AC_TRY_EVAL' test twice because some compilers refuse to 432# overwrite an existing `.o' file with `-o', although they will create 433# one. 434ac_try='$F77 $FFLAGS -c conftest.f -o conftest.o 1>&AC_FD_CC' 435if AC_TRY_EVAL(ac_try) && test -f conftest.o && AC_TRY_EVAL(ac_try); then 436 eval ac_cv_prog_f77_${ac_f77}_c_o=yes 437else 438 eval ac_cv_prog_f77_${ac_f77}_c_o=no 439fi 440rm -f conftest* 441])dnl 442if eval "test \"`echo '$ac_cv_prog_f77_'${ac_f77}_c_o`\" = yes"; then 443 AC_MSG_RESULT(yes) 444else 445 AC_MSG_RESULT(no) 446 AC_DEFINE(F77_NO_MINUS_C_MINUS_O) 447fi 448]) 449 450dnl Define SET_MAKE to set ${MAKE} if make doesn't. 451AC_DEFUN(AC_PROG_MAKE_SET, 452[AC_MSG_CHECKING(whether ${MAKE-make} sets \${MAKE}) 453set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'` 454AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set, 455[cat > conftestmake <<\EOF 456all: 457 @echo 'ac_maketemp="${MAKE}"' 458EOF 459changequote(, )dnl 460# GNU make sometimes prints "make[1]: Entering...", which would confuse us. 461eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` 462changequote([, ])dnl 463if test -n "$ac_maketemp"; then 464 eval ac_cv_prog_make_${ac_make}_set=yes 465else 466 eval ac_cv_prog_make_${ac_make}_set=no 467fi 468rm -f conftestmake])dnl 469if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then 470 AC_MSG_RESULT(yes) 471 SET_MAKE= 472else 473 AC_MSG_RESULT(no) 474 SET_MAKE="MAKE=${MAKE-make}" 475fi 476AC_SUBST([SET_MAKE])dnl 477]) 478 479AC_DEFUN(AC_PROG_RANLIB, 480[AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)]) 481 482dnl Check for mawk first since it's generally faster. 483AC_DEFUN(AC_PROG_AWK, 484[AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )]) 485 486AC_DEFUN(AC_PROG_YACC, 487[AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)]) 488 489AC_DEFUN(AC_PROG_CPP, 490[AC_MSG_CHECKING(how to run the C preprocessor) 491# On Suns, sometimes $CPP names a directory. 492if test -n "$CPP" && test -d "$CPP"; then 493 CPP= 494fi 495if test -z "$CPP"; then 496AC_CACHE_VAL(ac_cv_prog_CPP, 497[ # This must be in double quotes, not single quotes, because CPP may get 498 # substituted into the Makefile and "${CC-cc}" will confuse make. 499 CPP="${CC-cc} -E" 500 # On the NeXT, cc -E runs the code through the compiler's parser, 501 # not just through cpp. 502dnl Use a header file that comes with gcc, so configuring glibc 503dnl with a fresh cross-compiler works. 504 AC_TRY_CPP([#include <assert.h> 505Syntax Error], , 506 CPP="${CC-cc} -E -traditional-cpp" 507 AC_TRY_CPP([#include <assert.h> 508Syntax Error], , 509 CPP="${CC-cc} -nologo -E" 510 AC_TRY_CPP([#include <assert.h> 511Syntax Error], , CPP=/lib/cpp))) 512 ac_cv_prog_CPP="$CPP"])dnl 513 CPP="$ac_cv_prog_CPP" 514else 515 ac_cv_prog_CPP="$CPP" 516fi 517AC_MSG_RESULT($CPP) 518AC_SUBST(CPP)dnl 519]) 520 521AC_DEFUN(AC_PROG_CXXCPP, 522[AC_MSG_CHECKING(how to run the C++ preprocessor) 523if test -z "$CXXCPP"; then 524AC_CACHE_VAL(ac_cv_prog_CXXCPP, 525[AC_LANG_SAVE[]dnl 526AC_LANG_CPLUSPLUS[]dnl 527 CXXCPP="${CXX-g++} -E" 528 AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp) 529 ac_cv_prog_CXXCPP="$CXXCPP" 530AC_LANG_RESTORE[]dnl 531fi])dnl 532CXXCPP="$ac_cv_prog_CXXCPP" 533AC_MSG_RESULT($CXXCPP) 534AC_SUBST(CXXCPP)dnl 535]) 536 537dnl Require finding the C or C++ preprocessor, whichever is the 538dnl current language. 539AC_DEFUN(AC_REQUIRE_CPP, 540[ifelse(AC_LANG, C, [AC_REQUIRE([AC_PROG_CPP])], [AC_REQUIRE([AC_PROG_CXXCPP])])]) 541 542AC_DEFUN(AC_PROG_LEX, 543[AC_CHECK_PROG(LEX, flex, flex, lex) 544if test -z "$LEXLIB" 545then 546 case "$LEX" in 547 flex*) ac_lib=fl ;; 548 *) ac_lib=l ;; 549 esac 550 AC_CHECK_LIB($ac_lib, yywrap, LEXLIB="-l$ac_lib") 551fi 552AC_SUBST(LEXLIB)]) 553 554dnl Check if lex declares yytext as a char * by default, not a char[]. 555undefine([AC_DECL_YYTEXT]) 556AC_DEFUN(AC_DECL_YYTEXT, 557[AC_REQUIRE_CPP()dnl 558AC_REQUIRE([AC_PROG_LEX])dnl 559AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root, 560[# The minimal lex program is just a single line: %%. But some broken lexes 561# (Solaris, I think it was) want two %% lines, so accommodate them. 562echo '%% 563%%' | $LEX 564if test -f lex.yy.c; then 565 ac_cv_prog_lex_root=lex.yy 566elif test -f lexyy.c; then 567 ac_cv_prog_lex_root=lexyy 568else 569 AC_MSG_ERROR(cannot find output from $LEX; giving up) 570fi]) 571LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root 572AC_SUBST(LEX_OUTPUT_ROOT)dnl 573 574AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer, 575[# POSIX says lex can declare yytext either as a pointer or an array; the 576# default is implementation-dependent. Figure out which it is, since 577# not all implementations provide the %pointer and %array declarations. 578ac_cv_prog_lex_yytext_pointer=no 579echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c 580ac_save_LIBS="$LIBS" 581LIBS="$LIBS $LEXLIB" 582AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`, , ac_cv_prog_lex_yytext_pointer=yes) 583LIBS="$ac_save_LIBS" 584rm -f "${LEX_OUTPUT_ROOT}.c" 585]) 586dnl 587if test $ac_cv_prog_lex_yytext_pointer = yes; then 588 AC_DEFINE(YYTEXT_POINTER) 589fi 590]) 591 592AC_DEFUN(AC_PROG_INSTALL, 593[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 594# Find a good install program. We prefer a C program (faster), 595# so one script is as good as another. But avoid the broken or 596# incompatible versions: 597# SysV /etc/install, /usr/sbin/install 598# SunOS /usr/etc/install 599# IRIX /sbin/install 600# AIX /bin/install 601# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag 602# AFS /usr/afsws/bin/install, which mishandles nonexistent args 603# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" 604# ./install, which can be erroneously created by make from ./install.sh. 605AC_MSG_CHECKING(for a BSD compatible install) 606if test -z "$INSTALL"; then 607AC_CACHE_VAL(ac_cv_path_install, 608[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" 609 for ac_dir in $PATH; do 610 # Account for people who put trailing slashes in PATH elements. 611 case "$ac_dir/" in 612 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; 613 *) 614 # OSF1 and SCO ODT 3.0 have their own names for install. 615 # Don't use installbsd from OSF since it installs stuff as root 616 # by default. 617 for ac_prog in ginstall scoinst install; do 618 if test -f $ac_dir/$ac_prog; then 619 if test $ac_prog = install && 620 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then 621 # AIX install. It has an incompatible calling convention. 622 : 623 else 624 ac_cv_path_install="$ac_dir/$ac_prog -c" 625 break 2 626 fi 627 fi 628 done 629 ;; 630 esac 631 done 632 IFS="$ac_save_IFS" 633])dnl 634 if test "${ac_cv_path_install+set}" = set; then 635 INSTALL="$ac_cv_path_install" 636 else 637 # As a last resort, use the slow shell script. We don't cache a 638 # path for INSTALL within a source directory, because that will 639 # break other packages using the cache if that directory is 640 # removed, or if the path is relative. 641 INSTALL="$ac_install_sh" 642 fi 643fi 644dnl We do special magic for INSTALL instead of AC_SUBST, to get 645dnl relative paths right. 646AC_MSG_RESULT($INSTALL) 647 648# Use test -z because SunOS4 sh mishandles braces in ${var-val}. 649# It thinks the first close brace ends the variable substitution. 650test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' 651AC_SUBST(INSTALL_PROGRAM)dnl 652 653test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' 654AC_SUBST(INSTALL_SCRIPT)dnl 655 656test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' 657AC_SUBST(INSTALL_DATA)dnl 658]) 659 660AC_DEFUN(AC_PROG_LN_S, 661[AC_MSG_CHECKING(whether ln -s works) 662AC_CACHE_VAL(ac_cv_prog_LN_S, 663[rm -f conftestdata 664if ln -s X conftestdata 2>/dev/null 665then 666 rm -f conftestdata 667 ac_cv_prog_LN_S="ln -s" 668else 669 ac_cv_prog_LN_S=ln 670fi])dnl 671LN_S="$ac_cv_prog_LN_S" 672if test "$ac_cv_prog_LN_S" = "ln -s"; then 673 AC_MSG_RESULT(yes) 674else 675 AC_MSG_RESULT(no) 676fi 677AC_SUBST(LN_S)dnl 678]) 679 680define(AC_RSH, 681[errprint(__file__:__line__: [$0] has been removed; replace it with equivalent code 682)m4exit(4)]) 683 684 685dnl ### Checks for header files 686 687 688AC_DEFUN(AC_HEADER_STDC, 689[AC_REQUIRE_CPP()dnl 690AC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc, 691[AC_TRY_CPP([#include <stdlib.h> 692#include <stdarg.h> 693#include <string.h> 694#include <float.h>], ac_cv_header_stdc=yes, ac_cv_header_stdc=no) 695 696if test $ac_cv_header_stdc = yes; then 697 # SunOS 4.x string.h does not declare mem*, contrary to ANSI. 698AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no) 699fi 700 701if test $ac_cv_header_stdc = yes; then 702 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. 703AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no) 704fi 705 706if test $ac_cv_header_stdc = yes; then 707 # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. 708AC_TRY_RUN([#include <ctype.h> 709#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') 710#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) 711#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) 712int main () { int i; for (i = 0; i < 256; i++) 713if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); 714exit (0); } 715], , ac_cv_header_stdc=no, :) 716fi]) 717if test $ac_cv_header_stdc = yes; then 718 AC_DEFINE(STDC_HEADERS) 719fi 720]) 721 722AC_DEFUN(AC_UNISTD_H, 723[AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(unistd.h)])dnl 724AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))]) 725 726AC_DEFUN(AC_USG, 727[AC_OBSOLETE([$0], 728 [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H])dnl 729AC_MSG_CHECKING([for BSD string and memory functions]) 730AC_TRY_LINK([#include <strings.h>], [rindex(0, 0); bzero(0, 0);], 731 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); AC_DEFINE(USG)])]) 732 733 734dnl If memchr and the like aren't declared in <string.h>, include <memory.h>. 735dnl To avoid problems, don't check for gcc2 built-ins. 736AC_DEFUN(AC_MEMORY_H, 737[AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H])dnl 738AC_MSG_CHECKING(whether string.h declares mem functions) 739AC_EGREP_HEADER(memchr, string.h, ac_found=yes, ac_found=no) 740AC_MSG_RESULT($ac_found) 741if test $ac_found = no; then 742 AC_CHECK_HEADER(memory.h, [AC_DEFINE(NEED_MEMORY_H)]) 743fi 744]) 745 746AC_DEFUN(AC_HEADER_MAJOR, 747[AC_CACHE_CHECK(whether sys/types.h defines makedev, 748 ac_cv_header_sys_types_h_makedev, 749[AC_TRY_LINK([#include <sys/types.h>], [return makedev(0, 0);], 750 ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no) 751]) 752 753if test $ac_cv_header_sys_types_h_makedev = no; then 754AC_CHECK_HEADER(sys/mkdev.h, [AC_DEFINE(MAJOR_IN_MKDEV)]) 755 756 if test $ac_cv_header_sys_mkdev_h = no; then 757AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)]) 758 fi 759fi 760]) 761 762AC_DEFUN(AC_HEADER_DIRENT, 763[ac_header_dirent=no 764AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h, 765 [ac_header_dirent=$ac_hdr; break]) 766# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. 767if test $ac_header_dirent = dirent.h; then 768AC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir") 769else 770AC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx") 771fi 772]) 773 774dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE 775dnl defines the type `DIR'. dirent.h on NextStep 3.2 doesn't. 776dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND) 777AC_DEFUN(AC_CHECK_HEADER_DIRENT, 778[ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` 779AC_MSG_CHECKING([for $1 that defines DIR]) 780AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe, 781[AC_TRY_COMPILE([#include <sys/types.h> 782#include <$1>], [DIR *dirp = 0;], 783 eval "ac_cv_header_dirent_$ac_safe=yes", 784 eval "ac_cv_header_dirent_$ac_safe=no")])dnl 785if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then 786 AC_MSG_RESULT(yes) 787 $2 788else 789 AC_MSG_RESULT(no) 790fi 791]) 792 793dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that 794dnl defines `DIR'. 795dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION]) 796define(AC_CHECK_HEADERS_DIRENT, 797[for ac_hdr in $1 798do 799AC_CHECK_HEADER_DIRENT($ac_hdr, 800[changequote(, )dnl 801 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` 802changequote([, ])dnl 803 AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnl 804done]) 805 806AC_DEFUN(AC_DIR_HEADER, 807[AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl 808ac_header_dirent=no 809for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do 810 AC_CHECK_HEADER_DIRENT($ac_hdr, [ac_header_dirent=$ac_hdr; break]) 811done 812 813case "$ac_header_dirent" in 814dirent.h) AC_DEFINE(DIRENT) ;; 815sys/ndir.h) AC_DEFINE(SYSNDIR) ;; 816sys/dir.h) AC_DEFINE(SYSDIR) ;; 817ndir.h) AC_DEFINE(NDIR) ;; 818esac 819 820AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void, 821[AC_TRY_RUN([#include <sys/types.h> 822#include <$ac_header_dirent> 823int closedir(); main() { exit(closedir(opendir(".")) != 0); }], 824 ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)]) 825if test $ac_cv_func_closedir_void = yes; then 826 AC_DEFINE(VOID_CLOSEDIR) 827fi 828]) 829 830AC_DEFUN(AC_HEADER_STAT, 831[AC_CACHE_CHECK(whether stat file-mode macros are broken, 832 ac_cv_header_stat_broken, 833[AC_EGREP_CPP([You lose], [#include <sys/types.h> 834#include <sys/stat.h> 835 836#if defined(S_ISBLK) && defined(S_IFDIR) 837# if S_ISBLK (S_IFDIR) 838You lose. 839# endif 840#endif 841 842#if defined(S_ISBLK) && defined(S_IFCHR) 843# if S_ISBLK (S_IFCHR) 844You lose. 845# endif 846#endif 847 848#if defined(S_ISLNK) && defined(S_IFREG) 849# if S_ISLNK (S_IFREG) 850You lose. 851# endif 852#endif 853 854#if defined(S_ISSOCK) && defined(S_IFREG) 855# if S_ISSOCK (S_IFREG) 856You lose. 857# endif 858#endif 859], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)]) 860if test $ac_cv_header_stat_broken = yes; then 861 AC_DEFINE(STAT_MACROS_BROKEN) 862fi 863]) 864 865AC_DEFUN(AC_DECL_SYS_SIGLIST, 866[AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h], 867 ac_cv_decl_sys_siglist, 868[AC_TRY_COMPILE([#include <sys/types.h> 869#include <signal.h> 870/* NetBSD declares sys_siglist in unistd.h. */ 871#ifdef HAVE_UNISTD_H 872#include <unistd.h> 873#endif], [char *msg = *(sys_siglist + 1);], 874 ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)]) 875if test $ac_cv_decl_sys_siglist = yes; then 876 AC_DEFINE(SYS_SIGLIST_DECLARED) 877fi 878]) 879 880AC_DEFUN(AC_HEADER_SYS_WAIT, 881[AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible], 882 ac_cv_header_sys_wait_h, 883[AC_TRY_COMPILE([#include <sys/types.h> 884#include <sys/wait.h> 885#ifndef WEXITSTATUS 886#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) 887#endif 888#ifndef WIFEXITED 889#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) 890#endif], [int s; 891wait (&s); 892s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;], 893ac_cv_header_sys_wait_h=yes, ac_cv_header_sys_wait_h=no)]) 894if test $ac_cv_header_sys_wait_h = yes; then 895 AC_DEFINE(HAVE_SYS_WAIT_H) 896fi 897]) 898 899 900dnl ### Checks for typedefs 901 902 903AC_DEFUN(AC_TYPE_GETGROUPS, 904[AC_REQUIRE([AC_TYPE_UID_T])dnl 905AC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups, 906[AC_TRY_RUN( 907changequote(<<, >>)dnl 908<< 909/* Thanks to Mike Rendell for this test. */ 910#include <sys/types.h> 911#define NGID 256 912#undef MAX 913#define MAX(x, y) ((x) > (y) ? (x) : (y)) 914main() 915{ 916 gid_t gidset[NGID]; 917 int i, n; 918 union { gid_t gval; long lval; } val; 919 920 val.lval = -1; 921 for (i = 0; i < NGID; i++) 922 gidset[i] = val.gval; 923 n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, 924 gidset); 925 /* Exit non-zero if getgroups seems to require an array of ints. This 926 happens when gid_t is short but getgroups modifies an array of ints. */ 927 exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); 928} 929>>, 930changequote([, ])dnl 931 ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int, 932 ac_cv_type_getgroups=cross) 933if test $ac_cv_type_getgroups = cross; then 934 dnl When we can't run the test program (we are cross compiling), presume 935 dnl that <unistd.h> has either an accurate prototype for getgroups or none. 936 dnl Old systems without prototypes probably use int. 937 AC_EGREP_HEADER([getgroups.*int.*gid_t], unistd.h, 938 ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int) 939fi]) 940AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups) 941]) 942 943AC_DEFUN(AC_TYPE_UID_T, 944[AC_CACHE_CHECK(for uid_t in sys/types.h, ac_cv_type_uid_t, 945[AC_EGREP_HEADER(uid_t, sys/types.h, 946 ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)]) 947if test $ac_cv_type_uid_t = no; then 948 AC_DEFINE(uid_t, int) 949 AC_DEFINE(gid_t, int) 950fi 951]) 952 953AC_DEFUN(AC_TYPE_SIZE_T, 954[AC_CHECK_TYPE(size_t, unsigned)]) 955 956AC_DEFUN(AC_TYPE_PID_T, 957[AC_CHECK_TYPE(pid_t, int)]) 958 959AC_DEFUN(AC_TYPE_OFF_T, 960[AC_CHECK_TYPE(off_t, long)]) 961 962AC_DEFUN(AC_TYPE_MODE_T, 963[AC_CHECK_TYPE(mode_t, int)]) 964 965dnl Note that identifiers starting with SIG are reserved by ANSI C. 966AC_DEFUN(AC_TYPE_SIGNAL, 967[AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal, 968[AC_TRY_COMPILE([#include <sys/types.h> 969#include <signal.h> 970#ifdef signal 971#undef signal 972#endif 973#ifdef __cplusplus 974extern "C" void (*signal (int, void (*)(int)))(int); 975#else 976void (*signal ()) (); 977#endif 978], 979[int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)]) 980AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal) 981]) 982 983 984dnl ### Checks for functions 985 986 987AC_DEFUN(AC_FUNC_CLOSEDIR_VOID, 988[AC_REQUIRE([AC_HEADER_DIRENT])dnl 989AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void, 990[AC_TRY_RUN([#include <sys/types.h> 991#include <$ac_header_dirent> 992int closedir(); main() { exit(closedir(opendir(".")) != 0); }], 993 ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)]) 994if test $ac_cv_func_closedir_void = yes; then 995 AC_DEFINE(CLOSEDIR_VOID) 996fi 997]) 998 999AC_DEFUN(AC_FUNC_FNMATCH, 1000[AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works, 1001# Some versions of Solaris or SCO have a broken fnmatch function. 1002# So we run a test program. If we are cross-compiling, take no chance. 1003# Thanks to John Oleynick and Franc,ois Pinard for this test. 1004[AC_TRY_RUN([main() { exit (fnmatch ("a*", "abc", 0) != 0); }], 1005ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no, 1006ac_cv_func_fnmatch_works=no)]) 1007if test $ac_cv_func_fnmatch_works = yes; then 1008 AC_DEFINE(HAVE_FNMATCH) 1009fi 1010]) 1011 1012AC_DEFUN(AC_FUNC_MMAP, 1013[AC_CHECK_HEADERS(unistd.h) 1014AC_CHECK_FUNCS(getpagesize) 1015AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, 1016[AC_TRY_RUN([ 1017/* Thanks to Mike Haertel and Jim Avera for this test. 1018 Here is a matrix of mmap possibilities: 1019 mmap private not fixed 1020 mmap private fixed at somewhere currently unmapped 1021 mmap private fixed at somewhere already mapped 1022 mmap shared not fixed 1023 mmap shared fixed at somewhere currently unmapped 1024 mmap shared fixed at somewhere already mapped 1025 For private mappings, we should verify that changes cannot be read() 1026 back from the file, nor mmap's back from the file at a different 1027 address. (There have been systems where private was not correctly 1028 implemented like the infamous i386 svr4.0, and systems where the 1029 VM page cache was not coherent with the filesystem buffer cache 1030 like early versions of FreeBSD and possibly contemporary NetBSD.) 1031 For shared mappings, we should conversely verify that changes get 1032 propogated back to all the places they're supposed to be. 1033 1034 Grep wants private fixed already mapped. 1035 The main things grep needs to know about mmap are: 1036 * does it exist and is it safe to write into the mmap'd area 1037 * how to use it (BSD variants) */ 1038#include <sys/types.h> 1039#include <fcntl.h> 1040#include <sys/mman.h> 1041 1042/* This mess was copied from the GNU getpagesize.h. */ 1043#ifndef HAVE_GETPAGESIZE 1044# ifdef HAVE_UNISTD_H 1045# include <unistd.h> 1046# endif 1047 1048/* Assume that all systems that can run configure have sys/param.h. */ 1049# ifndef HAVE_SYS_PARAM_H 1050# define HAVE_SYS_PARAM_H 1 1051# endif 1052 1053# ifdef _SC_PAGESIZE 1054# define getpagesize() sysconf(_SC_PAGESIZE) 1055# else /* no _SC_PAGESIZE */ 1056# ifdef HAVE_SYS_PARAM_H 1057# include <sys/param.h> 1058# ifdef EXEC_PAGESIZE 1059# define getpagesize() EXEC_PAGESIZE 1060# else /* no EXEC_PAGESIZE */ 1061# ifdef NBPG 1062# define getpagesize() NBPG * CLSIZE 1063# ifndef CLSIZE 1064# define CLSIZE 1 1065# endif /* no CLSIZE */ 1066# else /* no NBPG */ 1067# ifdef NBPC 1068# define getpagesize() NBPC 1069# else /* no NBPC */ 1070# ifdef PAGESIZE 1071# define getpagesize() PAGESIZE 1072# endif /* PAGESIZE */ 1073# endif /* no NBPC */ 1074# endif /* no NBPG */ 1075# endif /* no EXEC_PAGESIZE */ 1076# else /* no HAVE_SYS_PARAM_H */ 1077# define getpagesize() 8192 /* punt totally */ 1078# endif /* no HAVE_SYS_PARAM_H */ 1079# endif /* no _SC_PAGESIZE */ 1080 1081#endif /* no HAVE_GETPAGESIZE */ 1082 1083#ifdef __cplusplus 1084extern "C" { void *malloc(unsigned); } 1085#else 1086char *malloc(); 1087#endif 1088 1089int 1090main() 1091{ 1092 char *data, *data2, *data3; 1093 int i, pagesize; 1094 int fd; 1095 1096 pagesize = getpagesize(); 1097 1098 /* 1099 * First, make a file with some known garbage in it. 1100 */ 1101 data = malloc(pagesize); 1102 if (!data) 1103 exit(1); 1104 for (i = 0; i < pagesize; ++i) 1105 *(data + i) = rand(); 1106 umask(0); 1107 fd = creat("conftestmmap", 0600); 1108 if (fd < 0) 1109 exit(1); 1110 if (write(fd, data, pagesize) != pagesize) 1111 exit(1); 1112 close(fd); 1113 1114 /* 1115 * Next, try to mmap the file at a fixed address which 1116 * already has something else allocated at it. If we can, 1117 * also make sure that we see the same garbage. 1118 */ 1119 fd = open("conftestmmap", O_RDWR); 1120 if (fd < 0) 1121 exit(1); 1122 data2 = malloc(2 * pagesize); 1123 if (!data2) 1124 exit(1); 1125 data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); 1126 if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, 1127 MAP_PRIVATE | MAP_FIXED, fd, 0L)) 1128 exit(1); 1129 for (i = 0; i < pagesize; ++i) 1130 if (*(data + i) != *(data2 + i)) 1131 exit(1); 1132 1133 /* 1134 * Finally, make sure that changes to the mapped area 1135 * do not percolate back to the file as seen by read(). 1136 * (This is a bug on some variants of i386 svr4.0.) 1137 */ 1138 for (i = 0; i < pagesize; ++i) 1139 *(data2 + i) = *(data2 + i) + 1; 1140 data3 = malloc(pagesize); 1141 if (!data3) 1142 exit(1); 1143 if (read(fd, data3, pagesize) != pagesize) 1144 exit(1); 1145 for (i = 0; i < pagesize; ++i) 1146 if (*(data + i) != *(data3 + i)) 1147 exit(1); 1148 close(fd); 1149 unlink("conftestmmap"); 1150 exit(0); 1151} 1152], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no, 1153ac_cv_func_mmap_fixed_mapped=no)]) 1154if test $ac_cv_func_mmap_fixed_mapped = yes; then 1155 AC_DEFINE(HAVE_MMAP) 1156fi 1157]) 1158 1159AC_DEFUN(AC_FUNC_GETPGRP, 1160[AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void, 1161[AC_TRY_RUN([ 1162/* 1163 * If this system has a BSD-style getpgrp(), 1164 * which takes a pid argument, exit unsuccessfully. 1165 * 1166 * Snarfed from Chet Ramey's bash pgrp.c test program 1167 */ 1168#include <stdio.h> 1169#include <sys/types.h> 1170 1171int pid; 1172int pg1, pg2, pg3, pg4; 1173int ng, np, s, child; 1174 1175main() 1176{ 1177 pid = getpid(); 1178 pg1 = getpgrp(0); 1179 pg2 = getpgrp(); 1180 pg3 = getpgrp(pid); 1181 pg4 = getpgrp(1); 1182 1183 /* 1184 * If all of these values are the same, it's pretty sure that 1185 * we're on a system that ignores getpgrp's first argument. 1186 */ 1187 if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3) 1188 exit(0); 1189 1190 child = fork(); 1191 if (child < 0) 1192 exit(1); 1193 else if (child == 0) { 1194 np = getpid(); 1195 /* 1196 * If this is Sys V, this will not work; pgrp will be 1197 * set to np because setpgrp just changes a pgrp to be 1198 * the same as the pid. 1199 */ 1200 setpgrp(np, pg1); 1201 ng = getpgrp(0); /* Same result for Sys V and BSD */ 1202 if (ng == pg1) { 1203 exit(1); 1204 } else { 1205 exit(0); 1206 } 1207 } else { 1208 wait(&s); 1209 exit(s>>8); 1210 } 1211} 1212], ac_cv_func_getpgrp_void=yes, ac_cv_func_getpgrp_void=no, 1213 AC_MSG_ERROR(cannot check getpgrp if cross compiling)) 1214]) 1215if test $ac_cv_func_getpgrp_void = yes; then 1216 AC_DEFINE(GETPGRP_VOID) 1217fi 1218]) 1219 1220AC_DEFUN(AC_FUNC_SETPGRP, 1221[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void, 1222AC_TRY_RUN([ 1223#ifdef HAVE_UNISTD_H 1224#include <unistd.h> 1225#endif 1226 1227/* 1228 * If this system has a BSD-style setpgrp, which takes arguments, exit 1229 * successfully. 1230 */ 1231main() 1232{ 1233 if (setpgrp(1,1) == -1) 1234 exit(0); 1235 else 1236 exit(1); 1237} 1238], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes, 1239 AC_MSG_ERROR(cannot check setpgrp if cross compiling)) 1240) 1241if test $ac_cv_func_setpgrp_void = yes; then 1242 AC_DEFINE(SETPGRP_VOID) 1243fi 1244]) 1245 1246AC_DEFUN(AC_FUNC_VPRINTF, 1247[AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF)) 1248if test "$ac_cv_func_vprintf" != yes; then 1249AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT)) 1250fi 1251]) 1252 1253AC_DEFUN(AC_FUNC_VFORK, 1254[AC_REQUIRE([AC_TYPE_PID_T])dnl 1255AC_CHECK_HEADER(vfork.h, AC_DEFINE(HAVE_VFORK_H)) 1256AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works, 1257[AC_TRY_RUN([/* Thanks to Paul Eggert for this test. */ 1258#include <stdio.h> 1259#include <sys/types.h> 1260#include <sys/stat.h> 1261#ifdef HAVE_UNISTD_H 1262#include <unistd.h> 1263#endif 1264#ifdef HAVE_VFORK_H 1265#include <vfork.h> 1266#endif 1267/* On some sparc systems, changes by the child to local and incoming 1268 argument registers are propagated back to the parent. 1269 The compiler is told about this with #include <vfork.h>, 1270 but some compilers (e.g. gcc -O) don't grok <vfork.h>. 1271 Test for this by using a static variable whose address 1272 is put into a register that is clobbered by the vfork. */ 1273static 1274#ifdef __cplusplus 1275sparc_address_test (int arg) 1276#else 1277sparc_address_test (arg) int arg; 1278#endif 1279{ 1280 static pid_t child; 1281 if (!child) { 1282 child = vfork (); 1283 if (child < 0) { 1284 perror ("vfork"); 1285 _exit(2); 1286 } 1287 if (!child) { 1288 arg = getpid(); 1289 write(-1, "", 0); 1290 _exit (arg); 1291 } 1292 } 1293} 1294main() { 1295 pid_t parent = getpid (); 1296 pid_t child; 1297 1298 sparc_address_test (); 1299 1300 child = vfork (); 1301 1302 if (child == 0) { 1303 /* Here is another test for sparc vfork register problems. 1304 This test uses lots of local variables, at least 1305 as many local variables as main has allocated so far 1306 including compiler temporaries. 4 locals are enough for 1307 gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. 1308 A buggy compiler should reuse the register of parent 1309 for one of the local variables, since it will think that 1310 parent can't possibly be used any more in this routine. 1311 Assigning to the local variable will thus munge parent 1312 in the parent process. */ 1313 pid_t 1314 p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), 1315 p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); 1316 /* Convince the compiler that p..p7 are live; otherwise, it might 1317 use the same hardware register for all 8 local variables. */ 1318 if (p != p1 || p != p2 || p != p3 || p != p4 1319 || p != p5 || p != p6 || p != p7) 1320 _exit(1); 1321 1322 /* On some systems (e.g. IRIX 3.3), 1323 vfork doesn't separate parent from child file descriptors. 1324 If the child closes a descriptor before it execs or exits, 1325 this munges the parent's descriptor as well. 1326 Test for this by closing stdout in the child. */ 1327 _exit(close(fileno(stdout)) != 0); 1328 } else { 1329 int status; 1330 struct stat st; 1331 1332 while (wait(&status) != child) 1333 ; 1334 exit( 1335 /* Was there some problem with vforking? */ 1336 child < 0 1337 1338 /* Did the child fail? (This shouldn't happen.) */ 1339 || status 1340 1341 /* Did the vfork/compiler bug occur? */ 1342 || parent != getpid() 1343 1344 /* Did the file descriptor bug occur? */ 1345 || fstat(fileno(stdout), &st) != 0 1346 ); 1347 } 1348}], 1349ac_cv_func_vfork_works=yes, ac_cv_func_vfork_works=no, AC_CHECK_FUNC(vfork) 1350ac_cv_func_vfork_works=$ac_cv_func_vfork)]) 1351if test $ac_cv_func_vfork_works = no; then 1352 AC_DEFINE(vfork, fork) 1353fi 1354]) 1355 1356AC_DEFUN(AC_FUNC_WAIT3, 1357[AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage, 1358[AC_TRY_RUN([#include <sys/types.h> 1359#include <sys/time.h> 1360#include <sys/resource.h> 1361#include <stdio.h> 1362/* HP-UX has wait3 but does not fill in rusage at all. */ 1363main() { 1364 struct rusage r; 1365 int i; 1366 /* Use a field that we can force nonzero -- 1367 voluntary context switches. 1368 For systems like NeXT and OSF/1 that don't set it, 1369 also use the system CPU time. And page faults (I/O) for Linux. */ 1370 r.ru_nvcsw = 0; 1371 r.ru_utime.tv_sec = 0; 1372 r.ru_utime.tv_usec = 0; 1373 r.ru_stime.tv_sec = 0; 1374 r.ru_stime.tv_usec = 0; 1375 r.ru_majflt = r.ru_minflt = 0; 1376 switch (fork()) { 1377 case 0: /* Child. */ 1378 sleep(1); /* Give up the CPU. */ 1379 for (i=200000; --i > 0;) getpid(); /* Use up some CPU time */ 1380 _exit(0); 1381 case -1: _exit(0); /* What can we do? */ 1382 default: /* Parent. */ 1383 wait3(&i, 0, &r); 1384 sleep(2); /* Avoid "text file busy" from rm on fast HP-UX machines. */ 1385 exit(r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0 1386 && r.ru_utime.tv_sec == 0 && r.ru_utime.tv_usec == 0 1387 && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0); 1388 } 1389}], ac_cv_func_wait3_rusage=yes, ac_cv_func_wait3_rusage=no, 1390ac_cv_func_wait3_rusage=no)]) 1391if test $ac_cv_func_wait3_rusage = yes; then 1392 AC_DEFINE(HAVE_WAIT3) 1393fi 1394]) 1395 1396AC_DEFUN(AC_FUNC_ALLOCA, 1397[AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally. 1398# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works 1399# for constant arguments. Useless! 1400AC_CACHE_CHECK([for working alloca.h], ac_cv_header_alloca_h, 1401[AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));], 1402 ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)]) 1403if test $ac_cv_header_alloca_h = yes; then 1404 AC_DEFINE(HAVE_ALLOCA_H) 1405fi 1406 1407AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works, 1408[AC_TRY_LINK([ 1409#ifdef __GNUC__ 1410# define alloca __builtin_alloca 1411#else 1412# ifdef _MSC_VER 1413# include <malloc.h> 1414# define alloca _alloca 1415# else 1416# if HAVE_ALLOCA_H 1417# include <alloca.h> 1418# else 1419# ifdef _AIX 1420 #pragma alloca 1421# else 1422# ifndef alloca /* predefined by HP cc +Olibcalls */ 1423char *alloca (); 1424# endif 1425# endif 1426# endif 1427# endif 1428#endif 1429], [char *p = (char *) alloca(1);], 1430 ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)]) 1431if test $ac_cv_func_alloca_works = yes; then 1432 AC_DEFINE(HAVE_ALLOCA) 1433fi 1434 1435if test $ac_cv_func_alloca_works = no; then 1436 # The SVR3 libPW and SVR4 libucb both contain incompatible functions 1437 # that cause trouble. Some versions do not even contain alloca or 1438 # contain a buggy version. If you still want to use their alloca, 1439 # use ar to extract alloca.o from them instead of compiling alloca.c. 1440 ALLOCA=alloca.${ac_objext} 1441 AC_DEFINE(C_ALLOCA) 1442 1443AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray, 1444[AC_EGREP_CPP(webecray, 1445[#if defined(CRAY) && ! defined(CRAY2) 1446webecray 1447#else 1448wenotbecray 1449#endif 1450], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) 1451if test $ac_cv_os_cray = yes; then 1452for ac_func in _getb67 GETB67 getb67; do 1453 AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func) 1454 break]) 1455done 1456fi 1457 1458AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, 1459[AC_TRY_RUN([find_stack_direction () 1460{ 1461 static char *addr = 0; 1462 auto char dummy; 1463 if (addr == 0) 1464 { 1465 addr = &dummy; 1466 return find_stack_direction (); 1467 } 1468 else 1469 return (&dummy > addr) ? 1 : -1; 1470} 1471main () 1472{ 1473 exit (find_stack_direction() < 0); 1474}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1, 1475 ac_cv_c_stack_direction=0)]) 1476AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) 1477fi 1478AC_SUBST(ALLOCA)dnl 1479]) 1480 1481AC_DEFUN(AC_FUNC_GETLOADAVG, 1482[ac_have_func=no # yes means we've found a way to get the load average. 1483 1484# Some systems with -lutil have (and need) -lkvm as well, some do not. 1485# On Solaris, -lkvm requires nlist from -lelf, so check that first 1486# to get the right answer into the cache. 1487AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS") 1488AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS") 1489# Check for the 4.4BSD definition of getloadavg. 1490AC_CHECK_LIB(util, getloadavg, 1491 [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes]) 1492 1493if test $ac_have_func = no; then 1494 # There is a commonly available library for RS/6000 AIX. 1495 # Since it is not a standard part of AIX, it might be installed locally. 1496 ac_getloadavg_LIBS="$LIBS"; LIBS="-L/usr/local/lib $LIBS" 1497 AC_CHECK_LIB(getloadavg, getloadavg, 1498 LIBS="-lgetloadavg $LIBS", LIBS="$ac_getloadavg_LIBS") 1499fi 1500 1501# Make sure it is really in the library, if we think we found it. 1502AC_REPLACE_FUNCS(getloadavg) 1503 1504if test $ac_cv_func_getloadavg = yes; then 1505 AC_DEFINE(HAVE_GETLOADAVG) 1506 ac_have_func=yes 1507else 1508 # Figure out what our getloadavg.c needs. 1509 ac_have_func=no 1510 AC_CHECK_HEADER(sys/dg_sys_info.h, 1511 [ac_have_func=yes; AC_DEFINE(DGUX) 1512 AC_CHECK_LIB(dgc, dg_sys_info)]) 1513 1514 # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it 1515 # uses stabs), but it is still SVR4. We cannot check for <elf.h> because 1516 # Irix 4.0.5F has the header but not the library. 1517 if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then 1518 ac_have_func=yes; AC_DEFINE(SVR4) 1519 fi 1520 1521 if test $ac_have_func = no; then 1522 AC_CHECK_HEADER(inq_stats/cpustats.h, 1523 [ac_have_func=yes; AC_DEFINE(UMAX) 1524 AC_DEFINE(UMAX4_3)]) 1525 fi 1526 1527 if test $ac_have_func = no; then 1528 AC_CHECK_HEADER(sys/cpustats.h, 1529 [ac_have_func=yes; AC_DEFINE(UMAX)]) 1530 fi 1531 1532 if test $ac_have_func = no; then 1533 AC_CHECK_HEADERS(mach/mach.h) 1534 fi 1535 1536 AC_CHECK_HEADER(nlist.h, 1537 [AC_DEFINE(NLIST_STRUCT) 1538 AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un, 1539 [AC_TRY_COMPILE([#include <nlist.h>], 1540 [struct nlist n; n.n_un.n_name = 0;], 1541 ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)]) 1542 if test $ac_cv_struct_nlist_n_un = yes; then 1543 AC_DEFINE(NLIST_NAME_UNION) 1544 fi 1545 ])dnl 1546fi # Do not have getloadavg in system libraries. 1547 1548# Some definitions of getloadavg require that the program be installed setgid. 1549dnl FIXME Don't hardwire the path of getloadavg.c in the top-level directory. 1550AC_CACHE_CHECK(whether getloadavg requires setgid, 1551 ac_cv_func_getloadavg_setgid, 1552[AC_EGREP_CPP([Yowza Am I SETGID yet], 1553[#include "$srcdir/getloadavg.c" 1554#ifdef LDAV_PRIVILEGED 1555Yowza Am I SETGID yet 1556#endif], 1557 ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)]) 1558if test $ac_cv_func_getloadavg_setgid = yes; then 1559 NEED_SETGID=true; AC_DEFINE(GETLOADAVG_PRIVILEGED) 1560else 1561 NEED_SETGID=false 1562fi 1563AC_SUBST(NEED_SETGID)dnl 1564 1565if test $ac_cv_func_getloadavg_setgid = yes; then 1566 AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem, 1567[changequote(, )dnl 1568 # On Solaris, /dev/kmem is a symlink. Get info on the real file. 1569 ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null` 1570 # If we got an error (system does not support symlinks), try without -L. 1571 test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem` 1572 ac_cv_group_kmem=`echo $ac_ls_output \ 1573 | sed -ne 's/[ ][ ]*/ /g; 1574 s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/; 1575 / /s/.* //;p;'` 1576changequote([, ])dnl 1577]) 1578 KMEM_GROUP=$ac_cv_group_kmem 1579fi 1580AC_SUBST(KMEM_GROUP)dnl 1581]) 1582 1583AC_DEFUN(AC_FUNC_UTIME_NULL, 1584[AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null, 1585[rm -f conftestdata; > conftestdata 1586# Sequent interprets utime(file, 0) to mean use start of epoch. Wrong. 1587AC_TRY_RUN([#include <sys/types.h> 1588#include <sys/stat.h> 1589main() { 1590struct stat s, t; 1591exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0 1592&& stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime 1593&& t.st_mtime - s.st_mtime < 120)); 1594}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no, 1595 ac_cv_func_utime_null=no) 1596rm -f core core.* *.core]) 1597if test $ac_cv_func_utime_null = yes; then 1598 AC_DEFINE(HAVE_UTIME_NULL) 1599fi 1600]) 1601 1602AC_DEFUN(AC_FUNC_STRCOLL, 1603[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works, 1604[AC_TRY_RUN([#include <string.h> 1605main () 1606{ 1607 exit (strcoll ("abc", "def") >= 0 || 1608 strcoll ("ABC", "DEF") >= 0 || 1609 strcoll ("123", "456") >= 0); 1610}], ac_cv_func_strcoll_works=yes, ac_cv_func_strcoll_works=no, 1611ac_cv_func_strcoll_works=no)]) 1612if test $ac_cv_func_strcoll_works = yes; then 1613 AC_DEFINE(HAVE_STRCOLL) 1614fi 1615]) 1616 1617AC_DEFUN(AC_FUNC_SETVBUF_REVERSED, 1618[AC_CACHE_CHECK(whether setvbuf arguments are reversed, 1619 ac_cv_func_setvbuf_reversed, 1620[AC_TRY_RUN([#include <stdio.h> 1621/* If setvbuf has the reversed format, exit 0. */ 1622main () { 1623 /* This call has the arguments reversed. 1624 A reversed system may check and see that the address of main 1625 is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ 1626 if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0) 1627 exit(1); 1628 putc('\r', stdout); 1629 exit(0); /* Non-reversed systems segv here. */ 1630}], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no) 1631rm -f core core.* *.core]) 1632if test $ac_cv_func_setvbuf_reversed = yes; then 1633 AC_DEFINE(SETVBUF_REVERSED) 1634fi 1635]) 1636 1637AC_DEFUN(AC_FUNC_GETMNTENT, 1638[# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware. 1639AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS", 1640 [AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS", 1641 [AC_CHECK_LIB(gen, getmntent, LIBS="-lgen $LIBS")])]) 1642AC_CHECK_FUNC(getmntent, [AC_DEFINE(HAVE_GETMNTENT)])]) 1643 1644AC_DEFUN(AC_FUNC_STRFTIME, 1645[AC_CHECK_FUNC(strftime, [AC_DEFINE(HAVE_STRFTIME)], 1646[# strftime is in -lintl on SCO UNIX. 1647AC_CHECK_LIB(intl, strftime, 1648[AC_DEFINE(HAVE_STRFTIME) 1649LIBS="-lintl $LIBS"])])]) 1650 1651AC_DEFUN(AC_FUNC_MEMCMP, 1652[AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean, 1653[AC_TRY_RUN([ 1654main() 1655{ 1656 char c0 = 0x40, c1 = 0x80, c2 = 0x81; 1657 exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1); 1658} 1659], ac_cv_func_memcmp_clean=yes, ac_cv_func_memcmp_clean=no, 1660ac_cv_func_memcmp_clean=no)]) 1661test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" 1662AC_SUBST(LIBOBJS)dnl 1663]) 1664 1665AC_DEFUN(AC_FUNC_SELECT_ARGTYPES, 1666[AC_MSG_CHECKING([types of arguments for select()]) 1667 AC_CACHE_VAL(ac_cv_func_select_arg234,dnl 1668 [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl 1669 [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl 1670 [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do 1671 for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do 1672 for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do 1673 AC_TRY_COMPILE(dnl 1674[#ifdef HAVE_SYS_TYPES_H 1675#include <sys/types.h> 1676#endif 1677#ifdef HAVE_SYS_TIME_H 1678#include <sys/time.h> 1679#endif 1680#ifdef HAVE_SYS_SELECT_H 1681#include <sys/select.h> 1682#endif 1683#ifdef HAVE_SYS_SOCKET_H 1684#include <sys/socket.h> 1685#endif 1686extern 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 1687 [ac_not_found=no ; break 3],ac_not_found=yes) 1688 done 1689 done 1690 done 1691 ])dnl AC_CACHE_VAL 1692 ])dnl AC_CACHE_VAL 1693 ])dnl AC_CACHE_VAL 1694 if test "$ac_not_found" = yes; then 1695 ac_cv_func_select_arg1=int 1696 ac_cv_func_select_arg234='int *' 1697 ac_cv_func_select_arg5='struct timeval *' 1698 fi 1699 AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5]) 1700 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1) 1701 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234)) 1702 AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5)) 1703]) 1704 1705 1706dnl ### Checks for structure members 1707 1708 1709AC_DEFUN(AC_HEADER_TIME, 1710[AC_CACHE_CHECK([whether time.h and sys/time.h may both be included], 1711 ac_cv_header_time, 1712[AC_TRY_COMPILE([#include <sys/types.h> 1713#include <sys/time.h> 1714#include <time.h>], 1715[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)]) 1716if test $ac_cv_header_time = yes; then 1717 AC_DEFINE(TIME_WITH_SYS_TIME) 1718fi 1719]) 1720 1721AC_DEFUN(AC_STRUCT_TM, 1722[AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h], 1723 ac_cv_struct_tm, 1724[AC_TRY_COMPILE([#include <sys/types.h> 1725#include <time.h>], 1726[struct tm *tp; tp->tm_sec;], 1727 ac_cv_struct_tm=time.h, ac_cv_struct_tm=sys/time.h)]) 1728if test $ac_cv_struct_tm = sys/time.h; then 1729 AC_DEFINE(TM_IN_SYS_TIME) 1730fi 1731]) 1732 1733AC_DEFUN(AC_STRUCT_TIMEZONE, 1734[AC_REQUIRE([AC_STRUCT_TM])dnl 1735AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone, 1736[AC_TRY_COMPILE([#include <sys/types.h> 1737#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;], 1738 ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)]) 1739if test "$ac_cv_struct_tm_zone" = yes; then 1740 AC_DEFINE(HAVE_TM_ZONE) 1741else 1742 AC_CACHE_CHECK(for tzname, ac_cv_var_tzname, 1743[AC_TRY_LINK( 1744changequote(<<, >>)dnl 1745<<#include <time.h> 1746#ifndef tzname /* For SGI. */ 1747extern char *tzname[]; /* RS6000 and others reject char **tzname. */ 1748#endif>>, 1749changequote([, ])dnl 1750[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)]) 1751 if test $ac_cv_var_tzname = yes; then 1752 AC_DEFINE(HAVE_TZNAME) 1753 fi 1754fi 1755]) 1756 1757AC_DEFUN(AC_STRUCT_ST_BLOCKS, 1758[AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks, 1759[AC_TRY_COMPILE([#include <sys/types.h> 1760#include <sys/stat.h>], [struct stat s; s.st_blocks;], 1761ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)]) 1762if test $ac_cv_struct_st_blocks = yes; then 1763 AC_DEFINE(HAVE_ST_BLOCKS) 1764else 1765 LIBOBJS="$LIBOBJS fileblocks.${ac_objext}" 1766fi 1767AC_SUBST(LIBOBJS)dnl 1768]) 1769 1770AC_DEFUN(AC_STRUCT_ST_BLKSIZE, 1771[AC_CACHE_CHECK([for st_blksize in struct stat], ac_cv_struct_st_blksize, 1772[AC_TRY_COMPILE([#include <sys/types.h> 1773#include <sys/stat.h>], [struct stat s; s.st_blksize;], 1774ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)]) 1775if test $ac_cv_struct_st_blksize = yes; then 1776 AC_DEFINE(HAVE_ST_BLKSIZE) 1777fi 1778]) 1779 1780AC_DEFUN(AC_STRUCT_ST_RDEV, 1781[AC_CACHE_CHECK([for st_rdev in struct stat], ac_cv_struct_st_rdev, 1782[AC_TRY_COMPILE([#include <sys/types.h> 1783#include <sys/stat.h>], [struct stat s; s.st_rdev;], 1784ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)]) 1785if test $ac_cv_struct_st_rdev = yes; then 1786 AC_DEFINE(HAVE_ST_RDEV) 1787fi 1788]) 1789 1790 1791dnl ### Checks for compiler characteristics 1792 1793 1794AC_DEFUN(AC_C_CROSS, 1795[AC_OBSOLETE([$0], [; it has been merged into AC_PROG_CC])]) 1796 1797AC_DEFUN(AC_C_CHAR_UNSIGNED, 1798[AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, 1799[if test "$GCC" = yes; then 1800 # GCC predefines this symbol on systems where it applies. 1801AC_EGREP_CPP(yes, 1802[#ifdef __CHAR_UNSIGNED__ 1803 yes 1804#endif 1805], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no) 1806else 1807AC_TRY_RUN( 1808[/* volatile prevents gcc2 from optimizing the test away on sparcs. */ 1809#if !defined(__STDC__) || __STDC__ != 1 1810#define volatile 1811#endif 1812main() { 1813 volatile char c = 255; exit(c < 0); 1814}], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no) 1815fi]) 1816if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then 1817 AC_DEFINE(__CHAR_UNSIGNED__) 1818fi 1819]) 1820 1821AC_DEFUN(AC_C_LONG_DOUBLE, 1822[AC_CACHE_CHECK(for long double, ac_cv_c_long_double, 1823[if test "$GCC" = yes; then 1824 ac_cv_c_long_double=yes 1825else 1826AC_TRY_RUN([int main() { 1827/* The Stardent Vistra knows sizeof(long double), but does not support it. */ 1828long double foo = 0.0; 1829/* On Ultrix 4.3 cc, long double is 4 and double is 8. */ 1830exit(sizeof(long double) < sizeof(double)); }], 1831ac_cv_c_long_double=yes, ac_cv_c_long_double=no) 1832fi]) 1833if test $ac_cv_c_long_double = yes; then 1834 AC_DEFINE(HAVE_LONG_DOUBLE) 1835fi 1836]) 1837 1838AC_DEFUN(AC_INT_16_BITS, 1839[AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(int)])dnl 1840AC_MSG_CHECKING(whether int is 16 bits) 1841AC_TRY_RUN([main() { exit(sizeof(int) != 2); }], 1842 [AC_MSG_RESULT(yes) 1843 AC_DEFINE(INT_16_BITS)], AC_MSG_RESULT(no)) 1844]) 1845 1846AC_DEFUN(AC_LONG_64_BITS, 1847[AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(long)])dnl 1848AC_MSG_CHECKING(whether long int is 64 bits) 1849AC_TRY_RUN([main() { exit(sizeof(long int) != 8); }], 1850 [AC_MSG_RESULT(yes) 1851 AC_DEFINE(LONG_64_BITS)], AC_MSG_RESULT(no)) 1852]) 1853 1854AC_DEFUN(AC_C_BIGENDIAN, 1855[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, 1856[ac_cv_c_bigendian=unknown 1857# See if sys/param.h defines the BYTE_ORDER macro. 1858AC_TRY_COMPILE([#include <sys/types.h> 1859#include <sys/param.h>], [ 1860#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN 1861 bogus endian macros 1862#endif], [# It does; now see whether it defined to BIG_ENDIAN or not. 1863AC_TRY_COMPILE([#include <sys/types.h> 1864#include <sys/param.h>], [ 1865#if BYTE_ORDER != BIG_ENDIAN 1866 not big endian 1867#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) 1868if test $ac_cv_c_bigendian = unknown; then 1869AC_TRY_RUN([main () { 1870 /* Are we little or big endian? From Harbison&Steele. */ 1871 union 1872 { 1873 long l; 1874 char c[sizeof (long)]; 1875 } u; 1876 u.l = 1; 1877 exit (u.c[sizeof (long) - 1] == 1); 1878}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes) 1879fi]) 1880if test $ac_cv_c_bigendian = yes; then 1881 AC_DEFINE(WORDS_BIGENDIAN) 1882fi 1883]) 1884 1885dnl Do nothing if the compiler accepts the inline keyword. 1886dnl Otherwise define inline to __inline__ or __inline if one of those work, 1887dnl otherwise define inline to be empty. 1888AC_DEFUN(AC_C_INLINE, 1889[AC_CACHE_CHECK([for inline], ac_cv_c_inline, 1890[ac_cv_c_inline=no 1891for ac_kw in inline __inline__ __inline; do 1892 AC_TRY_COMPILE(, [} $ac_kw foo() {], [ac_cv_c_inline=$ac_kw; break]) 1893done 1894]) 1895case "$ac_cv_c_inline" in 1896 inline | yes) ;; 1897 no) AC_DEFINE(inline, ) ;; 1898 *) AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;; 1899esac 1900]) 1901 1902AC_DEFUN(AC_C_CONST, 1903[dnl This message is consistent in form with the other checking messages, 1904dnl and with the result message. 1905AC_CACHE_CHECK([for working const], ac_cv_c_const, 1906[AC_TRY_COMPILE(, 1907changequote(<<, >>)dnl 1908<< 1909/* Ultrix mips cc rejects this. */ 1910typedef int charset[2]; const charset x; 1911/* SunOS 4.1.1 cc rejects this. */ 1912char const *const *ccp; 1913char **p; 1914/* NEC SVR4.0.2 mips cc rejects this. */ 1915struct point {int x, y;}; 1916static struct point const zero = {0,0}; 1917/* AIX XL C 1.02.0.0 rejects this. 1918 It does not let you subtract one const X* pointer from another in an arm 1919 of an if-expression whose if-part is not a constant expression */ 1920const char *g = "string"; 1921ccp = &g + (g ? g-g : 0); 1922/* HPUX 7.0 cc rejects these. */ 1923++ccp; 1924p = (char**) ccp; 1925ccp = (char const *const *) p; 1926{ /* SCO 3.2v4 cc rejects this. */ 1927 char *t; 1928 char const *s = 0 ? (char *) 0 : (char const *) 0; 1929 1930 *t++ = 0; 1931} 1932{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ 1933 int x[] = {25, 17}; 1934 const int *foo = &x[0]; 1935 ++foo; 1936} 1937{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ 1938 typedef const int *iptr; 1939 iptr p = 0; 1940 ++p; 1941} 1942{ /* AIX XL C 1.02.0.0 rejects this saying 1943 "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ 1944 struct s { int j; const int *ap[3]; }; 1945 struct s *b; b->j = 5; 1946} 1947{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ 1948 const int foo = 10; 1949} 1950>>, 1951changequote([, ])dnl 1952ac_cv_c_const=yes, ac_cv_c_const=no)]) 1953if test $ac_cv_c_const = no; then 1954 AC_DEFINE(const, ) 1955fi 1956]) 1957 1958AC_DEFUN(AC_C_STRINGIZE, [ 1959AC_REQUIRE([AC_PROG_CPP]) 1960AC_MSG_CHECKING([for preprocessor stringizing operator]) 1961AC_CACHE_VAL(ac_cv_c_stringize, 1962AC_EGREP_CPP([#teststring],[ 1963#define x(y) #y 1964 1965char *s = x(teststring); 1966], ac_cv_c_stringize=no, ac_cv_c_stringize=yes)) 1967if test "${ac_cv_c_stringize}" = yes 1968then 1969 AC_DEFINE(HAVE_STRINGIZE) 1970fi 1971AC_MSG_RESULT([${ac_cv_c_stringize}]) 1972])dnl 1973 1974define(AC_ARG_ARRAY, 1975[errprint(__file__:__line__: [$0] has been removed; don't do unportable things with arguments 1976)m4exit(4)]) 1977 1978dnl Check the object extension used by the compiler: typically .o or 1979dnl .obj. If this is called, some other behaviour will change, 1980dnl determined by ac_objext. 1981AC_DEFUN(AC_OBJEXT, 1982[AC_MSG_CHECKING([for object suffix]) 1983AC_CACHE_VAL(ac_cv_objext, 1984[rm -f conftest* 1985echo 'int i = 1;' > conftest.$ac_ext 1986if AC_TRY_EVAL(ac_compile); then 1987 for ac_file in conftest.*; do 1988 case $ac_file in 1989 *.c) ;; 1990 *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; 1991 esac 1992 done 1993else 1994 AC_MSG_ERROR([installation or configuration problem; compiler does not work]) 1995fi 1996rm -f conftest*]) 1997AC_MSG_RESULT($ac_cv_objext) 1998OBJEXT=$ac_cv_objext 1999ac_objext=$ac_cv_objext 2000AC_SUBST(OBJEXT)]) 2001 2002dnl Determine the linker flags (e.g. `-L' and `-l') for the Fortran 77 2003dnl intrinsic and run-time libraries that are required to successfully 2004dnl link a Fortran 77 program or shared library. The output variable 2005dnl FLIBS is set to these flags. 2006dnl 2007dnl This macro is intended to be used in those situations when it is 2008dnl necessary to mix, e.g. C++ and Fortran 77, source code into a single 2009dnl program or shared library. 2010dnl 2011dnl For example, if object files from a C++ and Fortran 77 compiler must 2012dnl be linked together, then the C++ compiler/linker must be used for 2013dnl linking (since special C++-ish things need to happen at link time 2014dnl like calling global constructors, instantiating templates, enabling 2015dnl exception support, etc.). 2016dnl 2017dnl However, the Fortran 77 intrinsic and run-time libraries must be 2018dnl linked in as well, but the C++ compiler/linker doesn't know how to 2019dnl add these Fortran 77 libraries. Hence, the macro 2020dnl `AC_F77_LIBRARY_LDFLAGS' was created to determine these Fortran 77 2021dnl libraries. 2022dnl 2023dnl This macro was packaged in its current form by Matthew D. Langston 2024dnl <langston@SLAC.Stanford.EDU>. However, nearly all of this macro 2025dnl came from the `OCTAVE_FLIBS' macro in `octave-2.0.13/aclocal.m4', 2026dnl and full credit should go to John W. Eaton for writing this 2027dnl extremely useful macro. Thank you John. 2028dnl 2029dnl AC_F77_LIBRARY_LDFLAGS() 2030AC_DEFUN(AC_F77_LIBRARY_LDFLAGS, 2031[AC_MSG_CHECKING([for Fortran 77 libraries]) 2032AC_REQUIRE([AC_PROG_F77]) 2033AC_REQUIRE([AC_CANONICAL_HOST]) 2034AC_CACHE_VAL(ac_cv_flibs, 2035[changequote(, )dnl 2036dnl Write a minimal program and compile it with -v. I don't know what 2037dnl to do if your compiler doesn't have -v... 2038echo " END" > conftest.f 2039foutput=`${F77} -v -o conftest conftest.f 2>&1` 2040dnl 2041dnl The easiest thing to do for xlf output is to replace all the commas 2042dnl with spaces. Try to only do that if the output is really from xlf, 2043dnl since doing that causes problems on other systems. 2044dnl 2045xlf_p=`echo $foutput | grep xlfentry` 2046if test -n "$xlf_p"; then 2047 foutput=`echo $foutput | sed 's/,/ /g'` 2048fi 2049dnl 2050ld_run_path=`echo $foutput | \ 2051 sed -n -e 's/^.*LD_RUN_PATH *= *\([^ ]*\).*/\1/p'` 2052dnl 2053dnl We are only supposed to find this on Solaris systems... 2054dnl Uh, the run path should be absolute, shouldn't it? 2055dnl 2056case "$ld_run_path" in 2057 /*) 2058 if test "$ac_cv_prog_gcc" = yes; then 2059 ld_run_path="-Xlinker -R -Xlinker $ld_run_path" 2060 else 2061 ld_run_path="-R $ld_run_path" 2062 fi 2063 ;; 2064 *) 2065 ld_run_path= 2066 ;; 2067esac 2068dnl 2069flibs= 2070lflags= 2071dnl 2072dnl If want_arg is set, we know we want the arg to be added to the list, 2073dnl so we don't have to examine it. 2074dnl 2075want_arg= 2076dnl 2077for arg in $foutput; do 2078 old_want_arg=$want_arg 2079 want_arg= 2080dnl 2081dnl None of the options that take arguments expect the argument to 2082dnl start with a -, so pretend we didn't see anything special. 2083dnl 2084 if test -n "$old_want_arg"; then 2085 case "$arg" in 2086 -*) 2087 old_want_arg= 2088 ;; 2089 esac 2090 fi 2091 case "$old_want_arg" in 2092 '') 2093 case $arg in 2094 /*.a) 2095 exists=false 2096 for f in $lflags; do 2097 if test x$arg = x$f; then 2098 exists=true 2099 fi 2100 done 2101 if $exists; then 2102 arg= 2103 else 2104 lflags="$lflags $arg" 2105 fi 2106 ;; 2107 -bI:*) 2108 exists=false 2109 for f in $lflags; do 2110 if test x$arg = x$f; then 2111 exists=true 2112 fi 2113 done 2114 if $exists; then 2115 arg= 2116 else 2117 if test "$ac_cv_prog_gcc" = yes; then 2118 lflags="$lflags -Xlinker $arg" 2119 else 2120 lflags="$lflags $arg" 2121 fi 2122 fi 2123 ;; 2124 -lang* | -lcrt0.o | -lc | -lgcc) 2125 arg= 2126 ;; 2127 -[lLR]) 2128 want_arg=$arg 2129 arg= 2130 ;; 2131 -[lLR]*) 2132 exists=false 2133 for f in $lflags; do 2134 if test x$arg = x$f; then 2135 exists=true 2136 fi 2137 done 2138 if $exists; then 2139 arg= 2140 else 2141 case "$arg" in 2142 -lkernel32) 2143 case "$canonical_host_type" in 2144 *-*-cygwin*) 2145 arg= 2146 ;; 2147 *) 2148 lflags="$lflags $arg" 2149 ;; 2150 esac 2151 ;; 2152 -lm) 2153 ;; 2154 *) 2155 lflags="$lflags $arg" 2156 ;; 2157 esac 2158 fi 2159 ;; 2160 -u) 2161 want_arg=$arg 2162 arg= 2163 ;; 2164 -Y) 2165 want_arg=$arg 2166 arg= 2167 ;; 2168 *) 2169 arg= 2170 ;; 2171 esac 2172 ;; 2173 -[lLR]) 2174 arg="$old_want_arg $arg" 2175 ;; 2176 -u) 2177 arg="-u $arg" 2178 ;; 2179 -Y) 2180dnl 2181dnl Should probably try to ensure unique directory options here too. 2182dnl This probably only applies to Solaris systems, and then will only 2183dnl work with gcc... 2184dnl 2185 arg=`echo $arg | sed -e 's%^P,%%'` 2186 SAVE_IFS=$IFS 2187 IFS=: 2188 list= 2189 for elt in $arg; do 2190 list="$list -L$elt" 2191 done 2192 IFS=$SAVE_IFS 2193 arg="$list" 2194 ;; 2195 esac 2196dnl 2197 if test -n "$arg"; then 2198 flibs="$flibs $arg" 2199 fi 2200done 2201if test -n "$ld_run_path"; then 2202 flibs_result="$ld_run_path $flibs" 2203else 2204 flibs_result="$flibs" 2205fi 2206changequote([, ])dnl 2207ac_cv_flibs="$flibs_result"]) 2208FLIBS="$ac_cv_flibs" 2209AC_SUBST(FLIBS)dnl 2210AC_MSG_RESULT($FLIBS) 2211]) 2212 2213 2214dnl ### Checks for operating system services 2215 2216 2217AC_DEFUN(AC_SYS_INTERPRETER, 2218[# Pull the hash mark out of the macro call to avoid m4 problems. 2219ac_msg="whether #! works in shell scripts" 2220AC_CACHE_CHECK($ac_msg, ac_cv_sys_interpreter, 2221[echo '#! /bin/cat 2222exit 69 2223' > conftest 2224chmod u+x conftest 2225(SHELL=/bin/sh; export SHELL; ./conftest >/dev/null) 2226if test $? -ne 69; then 2227 ac_cv_sys_interpreter=yes 2228else 2229 ac_cv_sys_interpreter=no 2230fi 2231rm -f conftest]) 2232interpval="$ac_cv_sys_interpreter" 2233]) 2234 2235define(AC_HAVE_POUNDBANG, 2236[errprint(__file__:__line__: [$0 has been replaced by AC_SYS_INTERPRETER, taking no arguments 2237])m4exit(4)]) 2238 2239AC_DEFUN(AC_SYS_LONG_FILE_NAMES, 2240[AC_CACHE_CHECK(for long file names, ac_cv_sys_long_file_names, 2241[ac_cv_sys_long_file_names=yes 2242# Test for long file names in all the places we know might matter: 2243# . the current directory, where building will happen 2244# $prefix/lib where we will be installing things 2245# $exec_prefix/lib likewise 2246# eval it to expand exec_prefix. 2247# $TMPDIR if set, where it might want to write temporary files 2248# if $TMPDIR is not set: 2249# /tmp where it might want to write temporary files 2250# /var/tmp likewise 2251# /usr/tmp likewise 2252if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then 2253 ac_tmpdirs="$TMPDIR" 2254else 2255 ac_tmpdirs='/tmp /var/tmp /usr/tmp' 2256fi 2257for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do 2258 test -d $ac_dir || continue 2259 test -w $ac_dir || continue # It is less confusing to not echo anything here. 2260 (echo 1 > $ac_dir/conftest9012345) 2>/dev/null 2261 (echo 2 > $ac_dir/conftest9012346) 2>/dev/null 2262 val=`cat $ac_dir/conftest9012345 2>/dev/null` 2263 if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then 2264 ac_cv_sys_long_file_names=no 2265 rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null 2266 break 2267 fi 2268 rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null 2269done]) 2270if test $ac_cv_sys_long_file_names = yes; then 2271 AC_DEFINE(HAVE_LONG_FILE_NAMES) 2272fi 2273]) 2274 2275AC_DEFUN(AC_SYS_RESTARTABLE_SYSCALLS, 2276[AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls, 2277[AC_TRY_RUN( 2278[/* Exit 0 (true) if wait returns something other than -1, 2279 i.e. the pid of the child, which means that wait was restarted 2280 after getting the signal. */ 2281#include <sys/types.h> 2282#include <signal.h> 2283ucatch (isig) { } 2284main () { 2285 int i = fork (), status; 2286 if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); } 2287 signal (SIGINT, ucatch); 2288 status = wait(&i); 2289 if (status == -1) wait(&i); 2290 exit (status == -1); 2291} 2292], ac_cv_sys_restartable_syscalls=yes, ac_cv_sys_restartable_syscalls=no)]) 2293if test $ac_cv_sys_restartable_syscalls = yes; then 2294 AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS) 2295fi 2296]) 2297 2298AC_DEFUN(AC_PATH_X, 2299[AC_REQUIRE_CPP()dnl Set CPP; we run AC_PATH_X_DIRECT conditionally. 2300# If we find X, set shell vars x_includes and x_libraries to the 2301# paths, otherwise set no_x=yes. 2302# Uses ac_ vars as temps to allow command line to override cache and checks. 2303# --without-x overrides everything else, but does not touch the cache. 2304AC_MSG_CHECKING(for X) 2305 2306AC_ARG_WITH(x, [ --with-x use the X Window System]) 2307# $have_x is `yes', `no', `disabled', or empty when we do not yet know. 2308if test "x$with_x" = xno; then 2309 # The user explicitly disabled X. 2310 have_x=disabled 2311else 2312 if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then 2313 # Both variables are already set. 2314 have_x=yes 2315 else 2316AC_CACHE_VAL(ac_cv_have_x, 2317[# One or both of the vars are not set, and there is no cached value. 2318ac_x_includes=NO ac_x_libraries=NO 2319AC_PATH_X_XMKMF 2320AC_PATH_X_DIRECT 2321if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then 2322 # Didn't find X anywhere. Cache the known absence of X. 2323 ac_cv_have_x="have_x=no" 2324else 2325 # Record where we found X for the cache. 2326 ac_cv_have_x="have_x=yes \ 2327 ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" 2328fi])dnl 2329 fi 2330 eval "$ac_cv_have_x" 2331fi # $with_x != no 2332 2333if test "$have_x" != yes; then 2334 AC_MSG_RESULT($have_x) 2335 no_x=yes 2336else 2337 # If each of the values was on the command line, it overrides each guess. 2338 test "x$x_includes" = xNONE && x_includes=$ac_x_includes 2339 test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries 2340 # Update the cache value to reflect the command line values. 2341 ac_cv_have_x="have_x=yes \ 2342 ac_x_includes=$x_includes ac_x_libraries=$x_libraries" 2343 AC_MSG_RESULT([libraries $x_libraries, headers $x_includes]) 2344fi 2345]) 2346 2347dnl Internal subroutine of AC_PATH_X. 2348dnl Set ac_x_includes and/or ac_x_libraries. 2349AC_DEFUN(AC_PATH_X_XMKMF, 2350[rm -fr conftestdir 2351if mkdir conftestdir; then 2352 cd conftestdir 2353 # Make sure to not put "make" in the Imakefile rules, since we grep it out. 2354 cat > Imakefile <<'EOF' 2355acfindx: 2356 @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' 2357EOF 2358 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then 2359 # GNU make sometimes prints "make[1]: Entering...", which would confuse us. 2360 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` 2361 # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. 2362 for ac_extension in a so sl; do 2363 if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && 2364 test -f $ac_im_libdir/libX11.$ac_extension; then 2365 ac_im_usrlibdir=$ac_im_libdir; break 2366 fi 2367 done 2368 # Screen out bogus values from the imake configuration. They are 2369 # bogus both because they are the default anyway, and because 2370 # using them would break gcc on systems where it needs fixed includes. 2371 case "$ac_im_incroot" in 2372 /usr/include) ;; 2373 *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; 2374 esac 2375 case "$ac_im_usrlibdir" in 2376 /usr/lib | /lib) ;; 2377 *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; 2378 esac 2379 fi 2380 cd .. 2381 rm -fr conftestdir 2382fi 2383]) 2384 2385dnl Internal subroutine of AC_PATH_X. 2386dnl Set ac_x_includes and/or ac_x_libraries. 2387AC_DEFUN(AC_PATH_X_DIRECT, 2388[if test "$ac_x_includes" = NO; then 2389 # Guess where to find include files, by looking for this one X11 .h file. 2390 test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h 2391 2392 # First, try using that file with no special directory specified. 2393AC_TRY_CPP([#include <$x_direct_test_include>], 2394[# We can compile using X headers with no special include directory. 2395ac_x_includes=], 2396[# Look for the header file in a standard set of common directories. 2397# Check X11 before X11Rn because it is often a symlink to the current release. 2398 for ac_dir in \ 2399 /usr/X11/include \ 2400 /usr/X11R6/include \ 2401 /usr/X11R5/include \ 2402 /usr/X11R4/include \ 2403 \ 2404 /usr/include/X11 \ 2405 /usr/include/X11R6 \ 2406 /usr/include/X11R5 \ 2407 /usr/include/X11R4 \ 2408 \ 2409 /usr/local/X11/include \ 2410 /usr/local/X11R6/include \ 2411 /usr/local/X11R5/include \ 2412 /usr/local/X11R4/include \ 2413 \ 2414 /usr/local/include/X11 \ 2415 /usr/local/include/X11R6 \ 2416 /usr/local/include/X11R5 \ 2417 /usr/local/include/X11R4 \ 2418 \ 2419 /usr/X386/include \ 2420 /usr/x386/include \ 2421 /usr/XFree86/include/X11 \ 2422 \ 2423 /usr/include \ 2424 /usr/local/include \ 2425 /usr/unsupported/include \ 2426 /usr/athena/include \ 2427 /usr/local/x11r5/include \ 2428 /usr/lpp/Xamples/include \ 2429 \ 2430 /usr/openwin/include \ 2431 /usr/openwin/share/include \ 2432 ; \ 2433 do 2434 if test -r "$ac_dir/$x_direct_test_include"; then 2435 ac_x_includes=$ac_dir 2436 break 2437 fi 2438 done]) 2439fi # $ac_x_includes = NO 2440 2441if test "$ac_x_libraries" = NO; then 2442 # Check for the libraries. 2443 2444 test -z "$x_direct_test_library" && x_direct_test_library=Xt 2445 test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc 2446 2447 # See if we find them without any special options. 2448 # Don't add to $LIBS permanently. 2449 ac_save_LIBS="$LIBS" 2450 LIBS="-l$x_direct_test_library $LIBS" 2451AC_TRY_LINK(, [${x_direct_test_function}()], 2452[LIBS="$ac_save_LIBS" 2453# We can link X programs with no special library path. 2454ac_x_libraries=], 2455[LIBS="$ac_save_LIBS" 2456# First see if replacing the include by lib works. 2457# Check X11 before X11Rn because it is often a symlink to the current release. 2458for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ 2459 /usr/X11/lib \ 2460 /usr/X11R6/lib \ 2461 /usr/X11R5/lib \ 2462 /usr/X11R4/lib \ 2463 \ 2464 /usr/lib/X11 \ 2465 /usr/lib/X11R6 \ 2466 /usr/lib/X11R5 \ 2467 /usr/lib/X11R4 \ 2468 \ 2469 /usr/local/X11/lib \ 2470 /usr/local/X11R6/lib \ 2471 /usr/local/X11R5/lib \ 2472 /usr/local/X11R4/lib \ 2473 \ 2474 /usr/local/lib/X11 \ 2475 /usr/local/lib/X11R6 \ 2476 /usr/local/lib/X11R5 \ 2477 /usr/local/lib/X11R4 \ 2478 \ 2479 /usr/X386/lib \ 2480 /usr/x386/lib \ 2481 /usr/XFree86/lib/X11 \ 2482 \ 2483 /usr/lib \ 2484 /usr/local/lib \ 2485 /usr/unsupported/lib \ 2486 /usr/athena/lib \ 2487 /usr/local/x11r5/lib \ 2488 /usr/lpp/Xamples/lib \ 2489 /lib/usr/lib/X11 \ 2490 \ 2491 /usr/openwin/lib \ 2492 /usr/openwin/share/lib \ 2493 ; \ 2494do 2495dnl Don't even attempt the hair of trying to link an X program! 2496 for ac_extension in a so sl; do 2497 if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then 2498 ac_x_libraries=$ac_dir 2499 break 2 2500 fi 2501 done 2502done]) 2503fi # $ac_x_libraries = NO 2504]) 2505 2506dnl Find additional X libraries, magic flags, etc. 2507AC_DEFUN(AC_PATH_XTRA, 2508[AC_REQUIRE([AC_PATH_X])dnl 2509if test "$no_x" = yes; then 2510 # Not all programs may use this symbol, but it does not hurt to define it. 2511 AC_DEFINE(X_DISPLAY_MISSING) 2512 X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= 2513else 2514 if test -n "$x_includes"; then 2515 X_CFLAGS="$X_CFLAGS -I$x_includes" 2516 fi 2517 2518 # It would also be nice to do this for all -L options, not just this one. 2519 if test -n "$x_libraries"; then 2520 X_LIBS="$X_LIBS -L$x_libraries" 2521dnl FIXME banish uname from this macro! 2522 # For Solaris; some versions of Sun CC require a space after -R and 2523 # others require no space. Words are not sufficient . . . . 2524 case "`(uname -sr) 2>/dev/null`" in 2525 "SunOS 5"*) 2526 AC_MSG_CHECKING(whether -R must be followed by a space) 2527 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" 2528 AC_TRY_LINK(, , ac_R_nospace=yes, ac_R_nospace=no) 2529 if test $ac_R_nospace = yes; then 2530 AC_MSG_RESULT(no) 2531 X_LIBS="$X_LIBS -R$x_libraries" 2532 else 2533 LIBS="$ac_xsave_LIBS -R $x_libraries" 2534 AC_TRY_LINK(, , ac_R_space=yes, ac_R_space=no) 2535 if test $ac_R_space = yes; then 2536 AC_MSG_RESULT(yes) 2537 X_LIBS="$X_LIBS -R $x_libraries" 2538 else 2539 AC_MSG_RESULT(neither works) 2540 fi 2541 fi 2542 LIBS="$ac_xsave_LIBS" 2543 esac 2544 fi 2545 2546 # Check for system-dependent libraries X programs must link with. 2547 # Do this before checking for the system-independent R6 libraries 2548 # (-lICE), since we may need -lsocket or whatever for X linking. 2549 2550 if test "$ISC" = yes; then 2551 X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" 2552 else 2553 # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X 2554 # libraries were built with DECnet support. And karl@cs.umb.edu says 2555 # the Alpha needs dnet_stub (dnet does not exist). 2556 AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) 2557 if test $ac_cv_lib_dnet_dnet_ntoa = no; then 2558 AC_CHECK_LIB(dnet_stub, dnet_ntoa, 2559 [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) 2560 fi 2561 2562 # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, 2563 # to get the SysV transport functions. 2564 # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) 2565 # needs -lnsl. 2566 # The nsl library prevents programs from opening the X display 2567 # on Irix 5.2, according to dickey@clark.net. 2568 AC_CHECK_FUNC(gethostbyname) 2569 if test $ac_cv_func_gethostbyname = no; then 2570 AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") 2571 fi 2572 2573 # lieder@skyler.mavd.honeywell.com says without -lsocket, 2574 # socket/setsockopt and other routines are undefined under SCO ODT 2575 # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary 2576 # on later versions), says simon@lia.di.epfl.ch: it contains 2577 # gethostby* variants that don't use the nameserver (or something). 2578 # -lsocket must be given before -lnsl if both are needed. 2579 # We assume that if connect needs -lnsl, so does gethostbyname. 2580 AC_CHECK_FUNC(connect) 2581 if test $ac_cv_func_connect = no; then 2582 AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , 2583 $X_EXTRA_LIBS) 2584 fi 2585 2586 # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. 2587 AC_CHECK_FUNC(remove) 2588 if test $ac_cv_func_remove = no; then 2589 AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") 2590 fi 2591 2592 # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. 2593 AC_CHECK_FUNC(shmat) 2594 if test $ac_cv_func_shmat = no; then 2595 AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc") 2596 fi 2597 fi 2598 2599 # Check for libraries that X11R6 Xt/Xaw programs need. 2600 ac_save_LDFLAGS="$LDFLAGS" 2601 test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" 2602 # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to 2603 # check for ICE first), but we must link in the order -lSM -lICE or 2604 # we get undefined symbols. So assume we have SM if we have ICE. 2605 # These have to be linked with before -lX11, unlike the other 2606 # libraries we check for below, so use a different variable. 2607 # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. 2608 AC_CHECK_LIB(ICE, IceConnectionNumber, 2609 [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"], , $X_EXTRA_LIBS) 2610 LDFLAGS="$ac_save_LDFLAGS" 2611 2612fi 2613AC_SUBST(X_CFLAGS)dnl 2614AC_SUBST(X_PRE_LIBS)dnl 2615AC_SUBST(X_LIBS)dnl 2616AC_SUBST(X_EXTRA_LIBS)dnl 2617]) 2618 2619dnl The old Cygwin32 macro is deprecated. 2620AC_DEFUN(AC_CYGWIN32, 2621[AC_OBSOLETE([$0], [; instead use AC_CYGWIN])dnl 2622AC_CYGWIN]) 2623 2624dnl Check for Cygwin. This is a way to set the right value for 2625dnl EXEEXT. 2626AC_DEFUN(AC_CYGWIN, 2627[AC_CACHE_CHECK(for Cygwin environment, ac_cv_cygwin, 2628[AC_TRY_COMPILE(,[ 2629#ifndef __CYGWIN__ 2630#define __CYGWIN__ __CYGWIN32__ 2631#endif 2632return __CYGWIN__;], 2633ac_cv_cygwin=yes, ac_cv_cygwin=no) 2634rm -f conftest*]) 2635CYGWIN= 2636test "$ac_cv_cygwin" = yes && CYGWIN=yes]) 2637 2638dnl Check for mingw32. This is another way to set the right value for 2639dnl EXEEXT. 2640AC_DEFUN(AC_MINGW32, 2641[AC_CACHE_CHECK(for mingw32 environment, ac_cv_mingw32, 2642[AC_TRY_COMPILE(,[return __MINGW32__;], 2643ac_cv_mingw32=yes, ac_cv_mingw32=no) 2644rm -f conftest*]) 2645MINGW32= 2646test "$ac_cv_mingw32" = yes && MINGW32=yes]) 2647 2648dnl Check for EMX/OS2. This is another way to set the right value for 2649dnl EXEEXT. 2650AC_DEFUN(AC_EMXOS2, 2651[AC_CACHE_CHECK(for EMX/OS2 environment, ac_cv_emxos2, 2652[AC_TRY_COMPILE(,[return __EMX__;], 2653ac_cv_emxos2=yes, ac_cv_emxos2=no) 2654rm -f conftest*]) 2655AC_CACHE_VAL(ac_cv_libpre, 2656if test "$ac_cv_emxos2" = yes ; then 2657 ac_cv_libpre= 2658else 2659 ac_cv_libpre=lib 2660fi 2661) 2662EMXOS2= 2663test "$ac_cv_emxos2" = yes && EMXOS2=yes]) 2664 2665dnl Check for the extension used for executables. This knows that we 2666dnl add .exe for Cygwin or mingw32. Otherwise, it compiles a test 2667dnl executable. If this is called, the executable extensions will be 2668dnl automatically used by link commands run by the configure script. 2669AC_DEFUN(AC_EXEEXT, 2670[AC_REQUIRE([AC_CYGWIN]) 2671AC_REQUIRE([AC_MINGW32]) 2672AC_REQUIRE([AC_EMXOS2]) 2673AC_MSG_CHECKING([for executable suffix]) 2674AC_CACHE_VAL(ac_cv_exeext, 2675[if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = yes; then 2676 ac_cv_exeext=.exe 2677else 2678 rm -f conftest* 2679 echo 'int main () { return 0; }' > conftest.$ac_ext 2680 ac_cv_exeext= 2681 if AC_TRY_EVAL(ac_link); then 2682 for file in conftest.*; do 2683 case $file in 2684 *.c | *.o | *.obj) ;; 2685 *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; 2686 esac 2687 done 2688 else 2689 AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.]) 2690 fi 2691 rm -f conftest* 2692 test x"${ac_cv_exeext}" = x && ac_cv_exeext=no 2693fi]) 2694EXEEXT="" 2695test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} 2696AC_MSG_RESULT(${ac_cv_exeext}) 2697dnl Setting ac_exeext will implicitly change the ac_link command. 2698ac_exeext=$EXEEXT 2699AC_SUBST(EXEEXT)]) 2700 2701 2702dnl ### Checks for UNIX variants 2703dnl These are kludges which should be replaced by a single POSIX check. 2704dnl They aren't cached, to discourage their use. 2705 2706 2707AC_DEFUN(AC_AIX, 2708[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl 2709AC_BEFORE([$0], [AC_TRY_RUN])dnl 2710AC_MSG_CHECKING(for AIX) 2711AC_EGREP_CPP(yes, 2712[#ifdef _AIX 2713 yes 2714#endif 2715], [AC_MSG_RESULT(yes); AC_DEFINE(_ALL_SOURCE)], AC_MSG_RESULT(no)) 2716]) 2717 2718AC_DEFUN(AC_MINIX, 2719[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl 2720AC_BEFORE([$0], [AC_TRY_RUN])dnl 2721AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=) 2722if test "$MINIX" = yes; then 2723 AC_DEFINE(_POSIX_SOURCE) 2724 AC_DEFINE(_POSIX_1_SOURCE, 2) 2725 AC_DEFINE(_MINIX) 2726fi 2727]) 2728 2729AC_DEFUN(AC_ISC_POSIX, 2730[AC_REQUIRE([AC_PROG_CC])dnl 2731AC_BEFORE([$0], [AC_TRY_COMPILE])dnl 2732AC_BEFORE([$0], [AC_TRY_RUN])dnl 2733AC_MSG_CHECKING(for POSIXized ISC) 2734if test -d /etc/conf/kconfig.d && 2735 grep _POSIX_VERSION [/usr/include/sys/unistd.h] >/dev/null 2>&1 2736then 2737 AC_MSG_RESULT(yes) 2738 ISC=yes # If later tests want to check for ISC. 2739 AC_DEFINE(_POSIX_SOURCE) 2740 if test "$GCC" = yes; then 2741 CC="$CC -posix" 2742 else 2743 CC="$CC -Xp" 2744 fi 2745else 2746 AC_MSG_RESULT(no) 2747 ISC= 2748fi 2749]) 2750 2751AC_DEFUN(AC_XENIX_DIR, 2752[AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl 2753AC_REQUIRE([AC_DIR_HEADER])dnl 2754AC_MSG_CHECKING(for Xenix) 2755AC_EGREP_CPP(yes, 2756[#if defined(M_XENIX) && !defined(M_UNIX) 2757 yes 2758#endif 2759], [AC_MSG_RESULT(yes); XENIX=yes], [AC_MSG_RESULT(no); XENIX=]) 2760if test "$XENIX" = yes; then 2761 # Make sure -ldir precedes -lx. 2762 test $ac_header_dirent = dirent.h && LIBS="-ldir $LIBS" 2763 LIBS="$LIBS -lx" 2764fi 2765]) 2766 2767AC_DEFUN(AC_DYNIX_SEQ, 2768[AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT])dnl 2769AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS") 2770]) 2771 2772AC_DEFUN(AC_IRIX_SUN, 2773[AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT or AC_CHECK_LIB(sun, getpwnam)])dnl 2774AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS") 2775]) 2776 2777AC_DEFUN(AC_SCO_INTL, 2778[AC_OBSOLETE([$0], [; instead use AC_FUNC_STRFTIME])dnl 2779AC_CHECK_LIB(intl, strftime, LIBS="-lintl $LIBS") 2780]) 2781