home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / src / amiga / autoconf-2.1-src.lha / autoconf-2.1 / acspecific.m4 < prev    next >
Encoding:
M4 Source File  |  1994-11-12  |  57.8 KB  |  1,971 lines

  1. dnl Macros that test for specific features.
  2. dnl This file is part of Autoconf.
  3. dnl Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  4. dnl
  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)
  8. dnl any later version.
  9. dnl
  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.
  14. dnl
  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., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. dnl
  19. dnl As a special exception, the Free Software Foundation gives unlimited
  20. dnl permission to copy, distribute and modify the configure scripts that
  21. dnl are the output of Autoconf.  You need not follow the terms of the GNU
  22. dnl General Public License when using or distributing such scripts, even
  23. dnl though portions of the text of Autoconf appear in them.  The GNU
  24. dnl General Public License (GPL) does govern all other use of the material
  25. dnl that constitutes the Autoconf program.
  26. dnl
  27. dnl Certain portions of the Autoconf source text are designed to be copied
  28. dnl (in certain cases, depending on the input) into the output of
  29. dnl Autoconf.  We call these the "data" portions.  The rest of the Autoconf
  30. dnl source text consists of comments plus executable code that decides which
  31. dnl of the data portions to output in any given case.  We call these
  32. dnl comments and executable code the "non-data" portions.  Autoconf never
  33. dnl copies any of the non-data portions into its output.
  34. dnl
  35. dnl This special exception to the GPL applies to versions of Autoconf
  36. dnl released by the Free Software Foundation.  When you make and
  37. dnl distribute a modified version of Autoconf, you may extend this special
  38. dnl exception to the GPL to apply to your modified version as well, *unless*
  39. dnl your modified version has the potential to copy into its output some
  40. dnl of the text that was the non-data portion of the version that you started
  41. dnl with.  (In other words, unless your change moves or copies text from
  42. dnl the non-data portions to the data portions.)  If your modification has
  43. dnl such potential, you must delete any notice of this special exception
  44. dnl to the GPL from your modified version.
  45. dnl
  46. dnl Written by David MacKenzie, with help from
  47. dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
  48. dnl Roland McGrath, Noah Friedman, david d zuhn, and many others.
  49.  
  50.  
  51. dnl ### Checks for programs
  52.  
  53.  
  54. dnl Check whether to use -n, \c, or newline-tab to separate
  55. dnl checking messages from result messages.
  56. dnl Idea borrowed from dist 3.0.
  57. dnl Internal use only.
  58. AC_DEFUN(AC_PROG_ECHO_N,
  59. [if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  60.   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  61.   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
  62.     ac_n= ac_c='
  63. ' ac_t='    '
  64.   else
  65.     ac_n=-n ac_c= ac_t=
  66.   fi
  67. else
  68.   ac_n= ac_c='\c' ac_t=
  69. fi
  70. ])
  71.  
  72. AC_DEFUN(AC_PROG_CC,
  73. [AC_BEFORE([$0], [AC_PROG_CPP])dnl
  74. AC_CHECK_PROG(CC, gcc, gcc, cc)
  75.  
  76. AC_MSG_CHECKING(whether we are using GNU C)
  77. AC_CACHE_VAL(ac_cv_prog_gcc,
  78. [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
  79. cat > conftest.c <<EOF
  80. #ifdef __GNUC__
  81.   yes;
  82. #endif
  83. EOF
  84. if ${CC-cc} -E conftest.c 2>&AC_FD_CC | egrep yes >/dev/null 2>&1; then
  85.   ac_cv_prog_gcc=yes
  86. else
  87.   ac_cv_prog_gcc=no
  88. fi])dnl
  89. AC_MSG_RESULT($ac_cv_prog_gcc)
  90. if test $ac_cv_prog_gcc = yes; then
  91.   GCC=yes
  92.   if test "${CFLAGS+set}" != set; then
  93.     AC_MSG_CHECKING(whether ${CC-cc} accepts -g)
  94. AC_CACHE_VAL(ac_cv_prog_gcc_g,
  95. [echo 'void f(){}' > conftest.c
  96. if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
  97.   ac_cv_prog_gcc_g=yes
  98. else
  99.   ac_cv_prog_gcc_g=no
  100. fi
  101. rm -f conftest*
  102. ])dnl
  103.     AC_MSG_RESULT($ac_cv_prog_gcc_g)
  104.     if test $ac_cv_prog_gcc_g = yes; then
  105.       # Amiga hack - suppress automatically using -g for now
  106.       # Also default to using -O2
  107.       CFLAGS="-O2"
  108.     else
  109.       CFLAGS="-O2"
  110.     fi
  111.   fi
  112. else
  113.   GCC=
  114.   test "${CFLAGS+set}" = set || CFLAGS="-g"
  115. fi
  116. ])
  117.  
  118. AC_DEFUN(AC_PROG_CXX,
  119. [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
  120. AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx, gcc)
  121.  
  122. AC_MSG_CHECKING(whether we are using GNU C++)
  123. AC_CACHE_VAL(ac_cv_prog_gxx,
  124. [dnl The semicolon is to pacify NeXT's syntax-checking cpp.
  125. cat > conftest.C <<EOF
  126. #ifdef __GNUC__
  127.   yes;
  128. #endif
  129. EOF
  130. if ${CXX-g++} -E conftest.C 2>&AC_FD_CC | egrep yes >/dev/null 2>&1; then
  131.   ac_cv_prog_gxx=yes
  132. else
  133.   ac_cv_prog_gxx=no
  134. fi])dnl
  135. AC_MSG_RESULT($ac_cv_prog_gxx)
  136. if test $ac_cv_prog_gxx = yes; then
  137.   GXX=yes
  138.   if test "${CXXFLAGS+set}" != set; then
  139.     AC_MSG_CHECKING(whether ${CXX-g++} accepts -g)
  140. AC_CACHE_VAL(ac_cv_prog_gxx_g,
  141. [echo 'void f(){}' > conftest.cc
  142. if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
  143.   ac_cv_prog_gxx_g=yes
  144. else
  145.   ac_cv_prog_gxx_g=no
  146. fi
  147. rm -f conftest*
  148. ])dnl
  149.     AC_MSG_RESULT($ac_cv_prog_gxx_g)
  150.     if test $ac_cv_prog_gxx_g = yes; then
  151.       # Amiga hack - suppress automatically using -g for now
  152.       # Also default to using -O2
  153.       CXXFLAGS="-O2"
  154.     else
  155.       CXXFLAGS="-O2"
  156.     fi
  157.   fi
  158. else
  159.   GXX=
  160.   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
  161. fi
  162. ])
  163.  
  164. AC_DEFUN(AC_PROG_GCC_TRADITIONAL,
  165. [AC_REQUIRE([AC_PROG_CC])dnl
  166. AC_REQUIRE([AC_PROG_CPP])dnl
  167. if test $ac_cv_prog_gcc = yes; then
  168.   AC_MSG_CHECKING(whether ${CC-cc} needs -traditional)
  169. AC_CACHE_VAL(ac_cv_prog_gcc_traditional,
  170. [  ac_pattern="Autoconf.*'x'"
  171.   AC_EGREP_CPP($ac_pattern, [#include <sgtty.h>
  172. Autoconf TIOCGETP],
  173.   ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no)
  174.  
  175.   if test $ac_cv_prog_gcc_traditional = no; then
  176.     AC_EGREP_CPP($ac_pattern, [#include <termio.h>
  177. Autoconf TCGETA],
  178.     ac_cv_prog_gcc_traditional=yes)
  179.   fi])dnl
  180.   AC_MSG_RESULT($ac_cv_prog_gcc_traditional)
  181.   if test $ac_cv_prog_gcc_traditional = yes; then
  182.     CC="$CC -traditional"
  183.   fi
  184. fi
  185. ])
  186.  
  187. AC_DEFUN(AC_PROG_CC_C_O,
  188. [if test "x$CC" != xcc; then
  189.   AC_MSG_CHECKING(whether $CC and cc understand -c and -o together)
  190. else
  191.   AC_MSG_CHECKING(whether cc understands -c and -o together)
  192. fi
  193. set dummy $CC; ac_cc=[$]2
  194. AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
  195. [eval ac_cv_prog_cc_${ac_cc}_c_o=no
  196. echo 'foo(){}' > conftest.c
  197. # Make sure it works both with $CC and with simple cc.
  198. # We do the test twice because some compilers refuse to overwrite an
  199. # existing .o file with -o, though they will create one.
  200. if ${CC-cc} -c conftest.c -o conftest.o 1>&AC_FD_CC 2>&AC_FD_CC &&
  201.   test -f conftest.o && ${CC-cc} -c conftest.c -o conftest.o 1>&AC_FD_CC 2>&AC_FD_CC
  202. then
  203.   if test "x$CC" != xcc; then
  204.     # Test first that cc exists at all.
  205.     if cc -c conftest.c 1>&AC_FD_CC 2>&AC_FD_CC
  206.     then
  207.       if cc -c conftest.c -o conftest2.o 1>&AC_FD_CC 2>&AC_FD_CC &&
  208.         test -f conftest2.o && cc -c conftest.c -o conftest2.o 1>&AC_FD_CC 2>&AC_FD_CC
  209.       then
  210.         eval ac_cv_prog_cc_${ac_cc}_c_o=yes
  211.       fi
  212.     fi
  213.   fi
  214. fi
  215. rm -f conftest*
  216. ])dnl
  217. if eval "test \"`/bin/echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
  218.   AC_MSG_RESULT(yes)
  219. else
  220.   AC_MSG_RESULT(no)
  221.   AC_DEFINE(NO_MINUS_C_MINUS_O)
  222. fi
  223. ])
  224.  
  225. dnl Define SET_MAKE to set ${MAKE} if make doesn't.
  226. AC_DEFUN(AC_PROG_MAKE_SET,
  227. [AC_MSG_CHECKING(whether ${MAKE-make} sets \$MAKE)
  228. set dummy ${MAKE-make}; ac_make=[$]2
  229. AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,
  230. [cat > conftestmake <<\EOF
  231. all:
  232.     @/bin/echo 'ac_maketemp="${MAKE}"'
  233. EOF
  234. changequote(, )dnl
  235. # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
  236. eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
  237. changequote([, ])dnl
  238. if test -n "$ac_maketemp"; then
  239.   eval ac_cv_prog_make_${ac_make}_set=yes
  240. else
  241.   eval ac_cv_prog_make_${ac_make}_set=no
  242. fi
  243. rm -f conftestmake])dnl
  244. if eval "test \"`/bin/echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
  245.   AC_MSG_RESULT(yes)
  246.   SET_MAKE=
  247. else
  248.   AC_MSG_RESULT(no)
  249.   SET_MAKE="MAKE=${MAKE-make}"
  250. fi
  251. AC_SUBST([SET_MAKE])dnl
  252. ])
  253.  
  254. AC_DEFUN(AC_PROG_RANLIB,
  255. [AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)])
  256.  
  257. dnl Check for mawk first since it's said to be faster.
  258. AC_DEFUN(AC_PROG_AWK,
  259. [AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )])
  260.  
  261. AC_DEFUN(AC_PROG_YACC,
  262. [AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)])
  263.  
  264. AC_DEFUN(AC_PROG_CPP,
  265. [AC_MSG_CHECKING(how to run the C preprocessor)
  266. # On Suns, sometimes $CPP names a directory.
  267. if test -n "$CPP" && test -d "$CPP"; then
  268.   CPP=
  269. fi
  270. if test -z "$CPP"; then
  271. AC_CACHE_VAL(ac_cv_prog_CPP,
  272. [  # This must be in double quotes, not single quotes, because CPP may get
  273.   # substituted into the Makefile and "${CC-cc}" will confuse make.
  274.   CPP="${CC-cc} -E"
  275.   # On the NeXT, cc -E runs the code through the compiler's parser,
  276.   # not just through cpp.
  277. dnl Use a header file that comes with gcc, so configuring glibc
  278. dnl with a fresh cross-compiler works.
  279.   AC_TRY_CPP([#include <assert.h>
  280. Syntax Error], ,
  281.   CPP="${CC-cc} -E -traditional-cpp"
  282.   AC_TRY_CPP([#include <assert.h>
  283. Syntax Error], , CPP=/lib/cpp))
  284.   ac_cv_prog_CPP="$CPP"])dnl
  285. fi
  286. CPP="$ac_cv_prog_CPP"
  287. AC_MSG_RESULT($CPP)
  288. AC_SUBST(CPP)dnl
  289. ])
  290.  
  291. AC_DEFUN(AC_PROG_CXXCPP,
  292. [AC_MSG_CHECKING(how to run the C++ preprocessor)
  293. if test -z "$CXXCPP"; then
  294. AC_CACHE_VAL(ac_cv_prog_CXXCPP,
  295. [AC_LANG_SAVE[]dnl
  296. AC_LANG_CPLUSPLUS[]dnl
  297.   CXXCPP="${CXX-g++} -E"
  298.   AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
  299.   ac_cv_prog_CXXCPP="$CXXCPP"
  300. AC_LANG_RESTORE[]dnl
  301. fi])dnl
  302. CXXCPP="$ac_cv_prog_CXXCPP"
  303. AC_MSG_RESULT($CXXCPP)
  304. AC_SUBST(CXXCPP)dnl
  305. ])
  306.  
  307. dnl Require finding the C or C++ preprocessor, whichever is the
  308. dnl current language.
  309. AC_DEFUN(AC_REQUIRE_CPP,
  310. [ifelse(AC_LANG, C, [AC_REQUIRE([AC_PROG_CPP])], [AC_REQUIRE([AC_PROG_CXXCPP])])])
  311.  
  312. AC_DEFUN(AC_PROG_LEX,
  313. [AC_CHECK_PROG(LEX, flex, flex, lex)
  314. if test -z "$LEXLIB"
  315. then
  316.   case "$LEX" in
  317.   flex*) ac_lib=fl ;;
  318.   *) ac_lib=l ;;
  319.   esac
  320.   AC_CHECK_LIB($ac_lib, main, LEXLIB="-l$ac_lib")
  321. fi
  322. AC_SUBST(LEXLIB)])
  323.  
  324. AC_DEFUN(AC_DECL_YYTEXT,
  325. [AC_REQUIRE_CPP()dnl
  326. AC_REQUIRE([AC_PROG_LEX])dnl
  327. AC_MSG_CHECKING(for yytext declaration)
  328. AC_CACHE_VAL(ac_cv_prog_lex_yytext_pointer,
  329. [# POSIX says lex can declare yytext either as a pointer or an array; the
  330. # default is implementation-dependent. Figure out which it is, since
  331. # not all implementations provide the %pointer and %array declarations.
  332. #
  333. # The minimal lex program is just a single line: %%.  But some broken lexes
  334. # (Solaris, I think it was) want two %% lines, so accommodate them.
  335. ac_cv_prog_lex_yytext_pointer=no
  336.   echo '%%
  337. %%' | $LEX
  338. if test -f lex.yy.c; then
  339.   LEX_OUTPUT_ROOT=lex.yy
  340. elif test -f lexyy.c; then
  341.   LEX_OUTPUT_ROOT=lexyy
  342. else
  343.   AC_MSG_ERROR(cannot find output from $LEX, giving up)
  344. fi
  345. echo 'extern char *yytext; main () { exit (0); }' >>$LEX_OUTPUT_ROOT.c
  346. ac_save_LIBS="$LIBS"
  347. LIBS="$LIBS $LEXLIB"
  348. AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`, ac_cv_prog_lex_yytext_pointer=yes)
  349. LIBS="$ac_save_LIBS"
  350. rm -f "${LEX_OUTPUT_ROOT}.c"])dnl
  351. AC_MSG_RESULT($ac_cv_prog_lex_yytext_pointer)
  352. if test $ac_cv_prog_lex_yytext_pointer = yes; then
  353.   AC_DEFINE(YYTEXT_POINTER)
  354. fi
  355. AC_SUBST(LEX_OUTPUT_ROOT)dnl
  356. ])
  357.  
  358. AC_DEFUN(AC_PROG_INSTALL,
  359. [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
  360. # Find a good install program.  We prefer a C program (faster),
  361. # so one script is as good as another.  But avoid the broken or
  362. # incompatible versions:
  363. # SysV /etc/install, /usr/sbin/install
  364. # SunOS /usr/etc/install
  365. # IRIX /sbin/install
  366. # AIX /bin/install
  367. # AFS /usr/afsws/bin/install, which mishandles nonexistent args
  368. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
  369. # ./install, which can be erroneously created by make from ./install.sh.
  370. AC_MSG_CHECKING(for a BSD compatible install)
  371. if test -z "$INSTALL"; then
  372. AC_CACHE_VAL(ac_cv_path_install,
  373. [  IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  374.   for ac_dir in $PATH; do
  375.     case "$ac_dir" in
  376.     ''|.|/gnu/etc) ;;
  377.     *)
  378.       # OSF1 and SCO ODT 3.0 have their own names for install.
  379.       for ac_prog in ginstall installbsd scoinst install; do
  380.         if test -f $ac_dir/$ac_prog; then
  381.       if test $ac_prog = install &&
  382.             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
  383.         # AIX install.  It has an incompatible calling convention.
  384.         # OSF/1 installbsd also uses dspmsg, but is usable.
  385.         :
  386.       else
  387.         ac_cv_path_install="$ac_dir/$ac_prog -c"
  388.         break 2
  389.       fi
  390.     fi
  391.       done
  392.       ;;
  393.     esac
  394.   done
  395.   IFS="$ac_save_ifs"
  396.   # As a last resort, use the slow shell script.
  397.   test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh"])dnl
  398.   INSTALL="$ac_cv_path_install"
  399. fi
  400. dnl We do special magic for INSTALL instead of AC_SUBST, to get
  401. dnl relative paths right. 
  402. AC_MSG_RESULT($INSTALL)
  403.  
  404. # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
  405. # It thinks the first close brace ends the variable substitution.
  406. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
  407. AC_SUBST(INSTALL_PROGRAM)dnl
  408.  
  409. test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
  410. AC_SUBST(INSTALL_DATA)dnl
  411. ])
  412.  
  413. # Symbolic links do work, however they need to be created in
  414. # canonical AmigaDOS format (foo:path/file) rather than
  415. # the current Unix style (/foo/path/file).  So for now,
  416. # act as if they don't work.  -fnf
  417. AC_DEFUN(AC_PROG_LN_S,
  418. [AC_MSG_CHECKING(whether ln -s works)
  419. AC_CACHE_VAL(ac_cv_prog_LN_S,
  420. [rm -f conftestdata
  421. if ln -s X conftestdata 2>/dev/null
  422. then
  423.   rm -f conftestdata
  424.   ac_cv_prog_LN_S="ln"        # hack; was "ln -s"; see note above; fnf
  425. else
  426.   ac_cv_prog_LN_S=ln
  427. fi])dnl
  428. LN_S="$ac_cv_prog_LN_S"
  429. if test "$ac_cv_prog_LN_S" = "ln -s"; then
  430.   AC_MSG_RESULT(yes)
  431. else
  432.   AC_MSG_RESULT(no)
  433. fi
  434. AC_SUBST(LN_S)dnl
  435. ])
  436.  
  437. define(AC_RSH,
  438. [errprint(__file__:__line__: [$0] has been removed; replace it with equivalent code
  439. )m4exit(4)])
  440.  
  441.  
  442. dnl ### Checks for header files
  443.  
  444.  
  445. AC_DEFUN(AC_HEADER_STDC,
  446. [AC_REQUIRE_CPP()dnl
  447. AC_MSG_CHECKING(for ANSI C header files)
  448. AC_CACHE_VAL(ac_cv_header_stdc,
  449. [AC_TRY_CPP([#include <stdlib.h>
  450. #include <stdarg.h>
  451. #include <string.h>
  452. #include <float.h>], ac_cv_header_stdc=yes, ac_cv_header_stdc=no)
  453.  
  454. if test $ac_cv_header_stdc = yes; then
  455.   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  456. AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no)
  457. fi
  458.  
  459. if test $ac_cv_header_stdc = yes; then
  460.   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
  461. AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no)
  462. fi
  463.  
  464. if test $ac_cv_header_stdc = yes; then
  465.   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  466. AC_TRY_RUN([#include <ctype.h>
  467. #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  468. #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  469. #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
  470. int main () { int i; for (i = 0; i < 256; i++)
  471. if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
  472. exit (0); }
  473. ], , ac_cv_header_stdc=no, ac_cv_header_stdc=no)
  474. fi])dnl
  475. AC_MSG_RESULT($ac_cv_header_stdc)
  476. if test $ac_cv_header_stdc = yes; then
  477.   AC_DEFINE(STDC_HEADERS)
  478. fi
  479. ])
  480.  
  481. AC_DEFUN(AC_UNISTD_H,
  482. [AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(unistd.h)])dnl
  483. AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))])
  484.  
  485. AC_DEFUN(AC_USG,
  486. [AC_OBSOLETE([$0],
  487.   [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H])dnl
  488. AC_MSG_CHECKING([for BSD string and memory functions])
  489. AC_TRY_LINK([#include <strings.h>], [rindex(0, 0); bzero(0, 0);],
  490.   [AC_MSG_RESULT(yes); AC_DEFINE(USG)], [AC_MSG_RESULT(no)])])
  491.  
  492.  
  493. dnl If memchr and the like aren't declared in <string.h>, include <memory.h>.
  494. dnl To avoid problems, don't check for gcc2 built-ins.
  495. AC_DEFUN(AC_MEMORY_H,
  496. [AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H])dnl
  497. AC_MSG_CHECKING(whether string.h declares mem functions)
  498. AC_EGREP_HEADER(memchr, string.h, ac_found=yes, ac_found=no)
  499. AC_MSG_RESULT($ac_found)
  500. if test $ac_found = no; then
  501.   AC_CHECK_HEADER(memory.h, [AC_DEFINE(NEED_MEMORY_H)])
  502. fi
  503. ])
  504.  
  505. AC_DEFUN(AC_HEADER_MAJOR,
  506. [AC_MSG_CHECKING(whether sys/types.h defines makedev)
  507. AC_CACHE_VAL(ac_cv_header_sys_types_h_makedev,
  508. [AC_TRY_LINK([#include <sys/types.h>], [return makedev(0, 0);],
  509.   ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)
  510. ])dnl
  511. AC_MSG_RESULT($ac_cv_header_sys_types_h_makedev)
  512.  
  513. if test $ac_cv_header_sys_types_h_makedev = no; then
  514. AC_CHECK_HEADER(sys/mkdev.h, [AC_DEFINE(MAJOR_IN_MKDEV)])
  515.  
  516.   if test $ac_cv_header_sys_mkdev_h = no; then
  517. AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)])
  518.   fi
  519. fi
  520. ])
  521.  
  522. AC_DEFUN(AC_HEADER_DIRENT,
  523. [ac_header_dirent=no
  524. AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h,
  525.   [ac_header_dirent=$ac_hdr; break])
  526. # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
  527. if test $ac_header_dirent = dirent.h; then
  528. AC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir")
  529. else
  530. AC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx")
  531. fi
  532. ])
  533.  
  534. dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE
  535. dnl defines the type `DIR'.  dirent.h on NextStep 3.2 doesn't.
  536. dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
  537. AC_DEFUN(AC_CHECK_HEADER_DIRENT,
  538. [ac_safe=`/bin/echo "$1" | tr './\055' '___'`
  539. AC_MSG_CHECKING([for $1 that defines DIR])
  540. AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe,
  541. [AC_TRY_COMPILE([#include <sys/types.h>
  542. #include <$1>], [DIR *dirp = 0;],
  543.   eval "ac_cv_header_dirent_$ac_safe=yes",
  544.   eval "ac_cv_header_dirent_$ac_safe=no")])dnl
  545. if eval "test \"`/bin/echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
  546.   AC_MSG_RESULT(yes)
  547.   $2
  548. else
  549.   AC_MSG_RESULT(no)
  550. fi
  551. ])
  552.  
  553. dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that
  554. dnl defines `DIR'.
  555. dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION])
  556. define(AC_CHECK_HEADERS_DIRENT,
  557. [for ac_hdr in $1
  558. do
  559. AC_CHECK_HEADER_DIRENT($ac_hdr,
  560. [changequote(, )dnl
  561.   ac_tr_hdr=HAVE_`/bin/echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
  562. changequote([, ])dnl
  563.   AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnl
  564. done])
  565.  
  566. AC_DEFUN(AC_DIR_HEADER,
  567. [AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl
  568. ac_header_dirent=no
  569. for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
  570.   AC_CHECK_HEADER_DIRENT($ac_hdr, [ac_header_dirent=$ac_hdr; break])
  571. done
  572.  
  573. case "$ac_header_dirent" in
  574. dirent.h) AC_DEFINE(DIRENT) ;;
  575. sys/ndir.h) AC_DEFINE(SYSNDIR) ;;
  576. sys/dir.h) AC_DEFINE(SYSDIR) ;;
  577. ndir.h) AC_DEFINE(NDIR) ;;
  578. esac
  579.  
  580. AC_MSG_CHECKING(whether closedir returns void)
  581. AC_CACHE_VAL(ac_cv_func_closedir_void,
  582. [AC_TRY_RUN([#include <sys/types.h>
  583. #include <$ac_header_dirent>
  584. int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
  585.   ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
  586. AC_MSG_RESULT($ac_cv_func_closedir_void)
  587. if test $ac_cv_func_closedir_void = yes; then
  588.   AC_DEFINE(VOID_CLOSEDIR)
  589. fi
  590. ])
  591.  
  592. AC_DEFUN(AC_HEADER_STAT,
  593. [AC_MSG_CHECKING(whether stat file-mode macros are broken)
  594. AC_CACHE_VAL(ac_cv_header_stat_broken,
  595. [AC_EGREP_CPP([You lose], [#include <sys/types.h>
  596. #include <sys/stat.h>
  597. #ifdef S_ISBLK
  598. # if S_ISBLK (S_IFDIR)
  599. You lose.
  600. # endif
  601. # ifdef S_IFCHR
  602. #  if S_ISBLK (S_IFCHR)
  603. You lose.
  604. #  endif
  605. # endif
  606. #endif
  607.  
  608. #ifdef S_ISLNK
  609. # if S_ISLNK (S_IFREG)
  610. You lose.
  611. # endif
  612. #endif
  613.  
  614. #ifdef S_ISSOCK
  615. # if S_ISSOCK (S_IFREG)
  616. You lose.
  617. # endif
  618. #endif
  619. ], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)])dnl
  620. AC_MSG_RESULT($ac_cv_header_stat_broken)
  621. if test $ac_cv_header_stat_broken = yes; then
  622.   AC_DEFINE(STAT_MACROS_BROKEN)
  623. fi
  624. ])
  625.  
  626. AC_DEFUN(AC_DECL_SYS_SIGLIST,
  627. [AC_MSG_CHECKING([for sys_siglist declaration in signal.h or unistd.h])
  628. AC_CACHE_VAL(ac_cv_decl_sys_siglist,
  629. [AC_TRY_COMPILE([#include <sys/types.h>
  630. #include <signal.h>
  631. /* NetBSD declares sys_siglist in unistd.h.  */
  632. #ifdef HAVE_UNISTD_H
  633. #include <unistd.h>
  634. #endif], [char *msg = *(sys_siglist + 1);],
  635.   ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])dnl
  636. AC_MSG_RESULT($ac_cv_decl_sys_siglist)
  637. if test $ac_cv_decl_sys_siglist = yes; then
  638.   AC_DEFINE(SYS_SIGLIST_DECLARED)
  639. fi
  640. ])
  641.  
  642. AC_DEFUN(AC_HEADER_SYS_WAIT,
  643. [AC_MSG_CHECKING([for sys/wait.h that is POSIX.1 compatible])
  644. AC_CACHE_VAL(ac_cv_header_sys_wait_h,
  645. [AC_TRY_COMPILE([#include <sys/types.h>
  646. #include <sys/wait.h>
  647. #ifndef WEXITSTATUS
  648. #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
  649. #endif
  650. #ifndef WIFEXITED
  651. #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
  652. #endif], [int s;
  653. wait (&s);
  654. s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;],
  655. ac_cv_header_sys_wait_h=yes, ac_cv_header_sys_wait_h=no)])dnl
  656. AC_MSG_RESULT($ac_cv_header_sys_wait_h)
  657. if test $ac_cv_header_sys_wait_h = yes; then
  658.   AC_DEFINE(HAVE_SYS_WAIT_H)
  659. fi
  660. ])
  661.  
  662.  
  663. dnl ### Checks for typedefs
  664.  
  665.  
  666. AC_DEFUN(AC_TYPE_GETGROUPS,
  667. [AC_REQUIRE([AC_TYPE_UID_T])dnl
  668. AC_MSG_CHECKING(type of array argument to getgroups)
  669. AC_CACHE_VAL(ac_cv_type_getgroups,
  670. [AC_TRY_RUN(
  671. changequote(<<, >>)dnl
  672. <<
  673. /* Thanks to Mike Rendell for this test.  */
  674. #include <sys/types.h>
  675. #define NGID 256
  676. #undef MAX
  677. #define MAX(x, y) ((x) > (y) ? (x) : (y))
  678. main()
  679. {
  680.   gid_t gidset[NGID];
  681.   int i, n;
  682.   union { gid_t gval; long lval; }  val;
  683.  
  684.   val.lval = -1;
  685.   for (i = 0; i < NGID; i++)
  686.     gidset[i] = val.gval;
  687.   n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
  688.                  gidset);
  689.   /* Exit non-zero if getgroups seems to require an array of ints.  This
  690.      happens when gid_t is short but getgroups modifies an array of ints.  */
  691.   exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0);
  692. }
  693. >>,
  694. changequote([, ])dnl
  695.   ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int,
  696.   ac_cv_type_getgroups=cross)
  697. if test $ac_cv_type_getgroups = cross; then
  698.   dnl When we can't run the test program (we are cross compiling), presume
  699.   dnl that <unistd.h> has either an accurate prototype for getgroups or none.
  700.   dnl Old systems without prototypes probably use int.
  701.   AC_EGREP_HEADER([getgroups.*int.*gid_t], unistd.h,
  702.           ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int)
  703. fi])dnl
  704. AC_MSG_RESULT($ac_cv_type_getgroups)
  705. AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups)
  706. ])
  707.  
  708. AC_DEFUN(AC_TYPE_UID_T,
  709. [AC_MSG_CHECKING(for uid_t in sys/types.h)
  710. AC_CACHE_VAL(ac_cv_type_uid_t,
  711. [AC_EGREP_HEADER(uid_t, sys/types.h,
  712.   ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)])dnl
  713. AC_MSG_RESULT($ac_cv_type_uid_t)
  714. if test $ac_cv_type_uid_t = no; then
  715.   AC_DEFINE(uid_t, int)
  716.   AC_DEFINE(gid_t, int)
  717. fi
  718. ])
  719.  
  720. AC_DEFUN(AC_TYPE_SIZE_T,
  721. [AC_CHECK_TYPE(size_t, unsigned)])
  722.  
  723. AC_DEFUN(AC_TYPE_PID_T,
  724. [AC_CHECK_TYPE(pid_t, int)])
  725.  
  726. AC_DEFUN(AC_TYPE_OFF_T,
  727. [AC_CHECK_TYPE(off_t, long)])
  728.  
  729. AC_DEFUN(AC_TYPE_MODE_T,
  730. [AC_CHECK_TYPE(mode_t, int)])
  731.  
  732. dnl Note that identifiers starting with SIG are reserved by ANSI C.
  733. AC_DEFUN(AC_TYPE_SIGNAL,
  734. [AC_MSG_CHECKING([return type of signal handlers])
  735. AC_CACHE_VAL(ac_cv_type_signal,
  736. [AC_TRY_COMPILE([#include <sys/types.h>
  737. #include <signal.h>
  738. #ifdef signal
  739. #undef signal
  740. #endif
  741. extern void (*signal ()) ();],
  742. [int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)])dnl
  743. AC_MSG_RESULT($ac_cv_type_signal)
  744. AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal)
  745. ])
  746.  
  747.  
  748. dnl ### Checks for functions
  749.  
  750.  
  751. AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
  752. [AC_REQUIRE([AC_HEADER_DIRENT])dnl
  753. AC_MSG_CHECKING(whether closedir returns void)
  754. AC_CACHE_VAL(ac_cv_func_closedir_void,
  755. [AC_TRY_RUN([#include <sys/types.h>
  756. #include <$ac_header_dirent>
  757. int closedir(); main() { exit(closedir(opendir(".")) != 0); }],
  758.   ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes)])dnl
  759. AC_MSG_RESULT($ac_cv_func_closedir_void)
  760. if test $ac_cv_func_closedir_void = yes; then
  761.   AC_DEFINE(CLOSEDIR_VOID)
  762. fi
  763. ])
  764.  
  765. AC_DEFUN(AC_FUNC_MMAP,
  766. [AC_MSG_CHECKING(for working mmap)
  767. AC_CACHE_VAL(ac_cv_func_mmap,
  768. [AC_TRY_RUN([
  769. /* Thanks to Mike Haertel and Jim Avera for this test. */
  770. #include <sys/types.h>
  771. #include <fcntl.h>
  772. #include <sys/mman.h>
  773.  
  774. #ifdef BSD
  775. # ifndef BSD4_1
  776. #  define HAVE_GETPAGESIZE
  777. # endif
  778. #endif
  779.  
  780. #ifndef HAVE_GETPAGESIZE
  781. # include <sys/param.h>
  782. # ifdef EXEC_PAGESIZE
  783. #  define getpagesize() EXEC_PAGESIZE
  784. # else
  785. #  ifdef NBPG
  786. #   define getpagesize() NBPG * CLSIZE
  787. #   ifndef CLSIZE
  788. #    define CLSIZE 1
  789. #   endif
  790. #  else
  791. #   ifdef NBPC
  792. #    define getpagesize() NBPC
  793. #   else
  794. #    define getpagesize() PAGESIZE /* SVR4 */
  795. #   endif
  796. #  endif
  797. # endif
  798. #endif
  799.  
  800. #ifdef __osf__
  801. # define valloc malloc
  802. #endif
  803.  
  804. #ifdef __cplusplus
  805. extern "C" { void *valloc(unsigned), *malloc(unsigned); }
  806. #else
  807. char *valloc(), *malloc();
  808. #endif
  809.  
  810. int
  811. main()
  812. {
  813.   char *buf1, *buf2, *buf3;
  814.   int i = getpagesize(), j;
  815.   int i2 = getpagesize()*2;
  816.   int fd;
  817.  
  818.   buf1 = (char *)valloc(i2);
  819.   buf2 = (char *)valloc(i);
  820.   buf3 = (char *)malloc(i2);
  821.   for (j = 0; j < i2; ++j)
  822.     *(buf1 + j) = rand();
  823.   fd = open("conftestmmap", O_CREAT | O_RDWR, 0666);
  824.   write(fd, buf1, i2);
  825.   mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, fd, 0);
  826.   for (j = 0; j < i; ++j)
  827.     if (*(buf1 + j) != *(buf2 + j))
  828.       exit(1);
  829.   lseek(fd, (long)i, 0);
  830.   read(fd, buf2, i); /* read into mapped memory -- file should not change */
  831.   /* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */
  832.   lseek(fd, (long)0, 0);
  833.   read(fd, buf3, i2);
  834.   for (j = 0; j < i2; ++j)
  835.     if (*(buf1 + j) != *(buf3 + j))
  836.       exit(1);
  837.   exit(0);
  838. }
  839. ], ac_cv_func_mmap=yes, ac_cv_func_mmap=no, ac_cv_func_mmap=no)])dnl
  840. AC_MSG_RESULT($ac_cv_func_mmap)
  841. if test $ac_cv_func_mmap = yes; then
  842.   AC_DEFINE(HAVE_MMAP)
  843. fi
  844. ])
  845.  
  846. AC_DEFUN(AC_FUNC_VPRINTF,
  847. [AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))
  848. if test "$ac_cv_func_vprintf" != yes; then
  849. AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))
  850. fi
  851. ])
  852.  
  853. AC_DEFUN(AC_FUNC_VFORK,
  854. [AC_REQUIRE([AC_TYPE_PID_T])dnl
  855. AC_CHECK_HEADER(vfork.h, AC_DEFINE(HAVE_VFORK_H))
  856. AC_MSG_CHECKING(for working vfork)
  857. AC_CACHE_VAL(ac_cv_func_vfork,
  858. [AC_REQUIRE([AC_TYPE_SIGNAL])
  859. AC_TRY_RUN([/* Thanks to Paul Eggert for this test.  */
  860. #include <stdio.h>
  861. #include <sys/types.h>
  862. #include <sys/stat.h>
  863. #include <signal.h>
  864. #ifdef HAVE_UNISTD_H
  865. #include <unistd.h>
  866. #endif
  867. #ifdef HAVE_VFORK_H
  868. #include <vfork.h>
  869. #endif
  870. /* On sparc systems, changes by the child to local and incoming
  871.    argument registers are propagated back to the parent.
  872.    The compiler is told about this with #include <vfork.h>,
  873.    but some compilers (e.g. gcc -O) don't grok <vfork.h>.
  874.    Test for this by using a static variable whose address
  875.    is put into a register that is clobbered by the vfork.  */
  876. static
  877. #ifdef __cplusplus
  878. sparc_address_test (int arg)
  879. #else
  880. sparc_address_test (arg) int arg;
  881. #endif
  882. {
  883.   static pid_t child;
  884.   if (!child) {
  885.     child = vfork ();
  886.     if (child < 0)
  887.       perror ("vfork");
  888.     if (!child) {
  889.       arg = getpid();
  890.       write(-1, "", 0);
  891.       _exit (arg);
  892.     }
  893.   }
  894. }
  895. static int signalled;
  896. static RETSIGTYPE catch (s) int s; { signalled = 1; }
  897. main() {
  898.   pid_t parent = getpid ();
  899.   pid_t child;
  900.  
  901.   sparc_address_test ();
  902.  
  903. #ifdef __amigados__
  904.   /* Force this test to succeed for AmigaDOS, which has a fairly good
  905.      vfork() emulation, but doesn't support fork() at all.  -fnf */
  906.   exit (0);
  907. #endif
  908.   signal (SIGINT, catch);
  909.  
  910.   child = vfork ();
  911.  
  912.   if (child == 0) {
  913.     /* Here is another test for sparc vfork register problems.
  914.        This test uses lots of local variables, at least
  915.        as many local variables as main has allocated so far
  916.        including compiler temporaries.  4 locals are enough for
  917.        gcc 1.40.3 on a sparc, but we use 8 to be safe.
  918.        A buggy compiler should reuse the register of parent
  919.        for one of the local variables, since it will think that
  920.        parent can't possibly be used any more in this routine.
  921.        Assigning to the local variable will thus munge parent
  922.        in the parent process.  */
  923.     pid_t
  924.       p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
  925.       p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
  926.     /* Convince the compiler that p..p7 are live; otherwise, it might
  927.        use the same hardware register for all 8 local variables.  */
  928.     if (p != p1 || p != p2 || p != p3 || p != p4
  929.     || p != p5 || p != p6 || p != p7)
  930.       _exit(1);
  931.  
  932.     /* On some systems (e.g. SunOS 5.2), if the parent is catching
  933.        a signal, the child ignores the signal before execing,
  934.        and the parent later receives that signal, the parent dumps core.
  935.        Test for this by ignoring SIGINT in the child.  */
  936.     signal (SIGINT, SIG_IGN);
  937.  
  938.     /* On some systems (e.g. IRIX 3.3),
  939.        vfork doesn't separate parent from child file descriptors.
  940.        If the child closes a descriptor before it execs or exits,
  941.        this munges the parent's descriptor as well.
  942.        Test for this by closing stdout in the child.  */
  943.     _exit(close(fileno(stdout)) != 0);
  944.   } else {
  945.     int status;
  946.     struct stat st;
  947.  
  948.     while (wait(&status) != child)
  949.       ;
  950.     exit(
  951.      /* Was there some problem with vforking?  */
  952.      child < 0
  953.  
  954.      /* Did the child fail?  (This shouldn't happen.)  */
  955.      || status
  956.  
  957.      /* Did the vfork/compiler bug occur?  */
  958.      || parent != getpid()
  959.  
  960.      /* Did the signal handling bug occur?  */
  961.      || kill(parent, SIGINT) != 0
  962.      || signalled != 1
  963.  
  964.      /* Did the file descriptor bug occur?  */
  965.      || fstat(fileno(stdout), &st) != 0
  966.      );
  967.   }
  968. }], ac_cv_func_vfork=yes, ac_cv_func_vfork=no, ac_cv_func_vfork=no)])dnl
  969. AC_MSG_RESULT($ac_cv_func_vfork)
  970. if test $ac_cv_func_vfork = no; then
  971.   AC_DEFINE(vfork, fork)
  972. fi
  973. ])
  974.  
  975. AC_DEFUN(AC_FUNC_WAIT3,
  976. [AC_MSG_CHECKING(for wait3 that fills in rusage)
  977. AC_CACHE_VAL(ac_cv_func_wait3,
  978. [AC_TRY_RUN([#include <sys/types.h>
  979. #include <sys/time.h>
  980. #include <sys/resource.h>
  981. #include <stdio.h>
  982. /* HP-UX has wait3 but does not fill in rusage at all.  */
  983. main() {
  984.   struct rusage r;
  985.   int i;
  986.   /* Use a field that we can force nonzero --
  987.      voluntary context switches.
  988.      For systems like NeXT and OSF/1 that don't set it,
  989.      also use the system CPU time.  */
  990.   r.ru_nvcsw = 0;
  991.   r.ru_stime.tv_sec = 0;
  992.   r.ru_stime.tv_usec = 0;
  993.   switch (fork()) {
  994.   case 0: /* Child.  */
  995.     sleep(1); /* Give up the CPU.  */
  996.     _exit(0);
  997.   case -1: _exit(0); /* What can we do?  */
  998.   default: /* Parent.  */
  999.     wait3(&i, 0, &r);
  1000.     sleep(1); /* Avoid "text file busy" from rm on fast HP-UX machines.  */
  1001.     exit(r.ru_nvcsw == 0
  1002.      && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0);
  1003.   }
  1004. }], ac_cv_func_wait3=yes, ac_cv_func_wait3=no, ac_cv_func_wait3=no)])dnl
  1005. AC_MSG_RESULT($ac_cv_func_wait3)
  1006. if test $ac_cv_func_wait3 = yes; then
  1007.   AC_DEFINE(HAVE_WAIT3)
  1008. fi
  1009. ])
  1010.  
  1011. AC_DEFUN(AC_FUNC_ALLOCA,
  1012. [AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
  1013. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  1014. # for constant arguments.  Useless!
  1015. AC_MSG_CHECKING([for working alloca.h])
  1016. AC_CACHE_VAL(ac_cv_header_alloca_h,
  1017. [AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
  1018.   ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)])dnl
  1019. AC_MSG_RESULT($ac_cv_header_alloca_h)
  1020. if test $ac_cv_header_alloca_h = yes; then
  1021.   AC_DEFINE(HAVE_ALLOCA_H)
  1022. fi
  1023.  
  1024. AC_MSG_CHECKING([for alloca])
  1025. AC_CACHE_VAL(ac_cv_func_alloca,
  1026. [AC_TRY_LINK([
  1027. #ifdef __GNUC__
  1028. # define alloca __builtin_alloca
  1029. #else
  1030. # if HAVE_ALLOCA_H
  1031. #  include <alloca.h>
  1032. # else
  1033. #  ifdef _AIX
  1034.  #pragma alloca
  1035. #  else
  1036. #   ifndef alloca /* predefined by HP cc +Olibcalls */
  1037. char *alloca ();
  1038. #   endif
  1039. #  endif
  1040. # endif
  1041. #endif
  1042. ], [char *p = (char *) alloca(1);],
  1043.   ac_cv_func_alloca=yes, ac_cv_func_alloca=no)])dnl
  1044. AC_MSG_RESULT($ac_cv_func_alloca)
  1045. if test $ac_cv_func_alloca = yes; then
  1046.   AC_DEFINE(HAVE_ALLOCA)
  1047. fi
  1048.  
  1049. if test $ac_cv_func_alloca = no; then
  1050.   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  1051.   # that cause trouble.  Some versions do not even contain alloca or
  1052.   # contain a buggy version.  If you still want to use their alloca,
  1053.   # use ar to extract alloca.o from them instead of compiling alloca.c.
  1054.   ALLOCA=alloca.o
  1055.   AC_DEFINE(C_ALLOCA)
  1056.  
  1057. AC_MSG_CHECKING(whether alloca needs Cray hooks)
  1058. AC_CACHE_VAL(ac_cv_os_cray,
  1059. [AC_EGREP_CPP(webecray,
  1060. [#if defined(CRAY) && ! defined(CRAY2)
  1061. webecray
  1062. #else
  1063. wenotbecray
  1064. #endif
  1065. ], ac_cv_os_cray=yes, ac_cv_os_cray=no)])dnl
  1066. AC_MSG_RESULT($ac_cv_os_cray)
  1067. if test $ac_cv_os_cray = yes; then
  1068. AC_CHECK_FUNC(_getb67, AC_DEFINE(CRAY_STACKSEG_END, _getb67),
  1069. AC_CHECK_FUNC(GETB67, AC_DEFINE(CRAY_STACKSEG_END, GETB67),
  1070. AC_CHECK_FUNC(getb67, AC_DEFINE(CRAY_STACKSEG_END, getb67))))
  1071. fi
  1072.  
  1073. AC_MSG_CHECKING(stack direction for C alloca)
  1074. AC_CACHE_VAL(ac_cv_c_stack_direction,
  1075. [AC_TRY_RUN([find_stack_direction ()
  1076. {
  1077.   static char *addr = 0;
  1078.   auto char dummy;
  1079.   if (addr == 0)
  1080.     {
  1081.       addr = &dummy;
  1082.       return find_stack_direction ();
  1083.     }
  1084.   else
  1085.     return (&dummy > addr) ? 1 : -1;
  1086. }
  1087. main ()
  1088. {
  1089.   exit (find_stack_direction() < 0);
  1090. }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
  1091.   ac_cv_c_stack_direction=0)])dnl
  1092. AC_MSG_RESULT($ac_cv_c_stack_direction)
  1093. AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
  1094. fi
  1095. AC_SUBST(ALLOCA)dnl
  1096. ])
  1097.  
  1098. AC_DEFUN(AC_FUNC_GETLOADAVG,
  1099. [# Some definitions of getloadavg require that the program be installed setgid.
  1100. NEED_SETGID=false
  1101. AC_SUBST(NEED_SETGID)dnl
  1102. ac_have_func=no
  1103.  
  1104. # Check for the 4.4BSD definition of getloadavg.
  1105. AC_CHECK_LIB(util, getloadavg, [LIBS="$LIBS -lutil" ac_have_func=yes
  1106. # Some systems with -lutil have (and need) -lkvm as well, some do not.
  1107. AC_CHECK_LIB(kvm, kvm_open,  LIBS="$LIBS -lkvm")])
  1108.  
  1109. if test $ac_have_func = no; then
  1110. # There is a commonly available library for RS/6000 AIX.
  1111. # Since it is not a standard part of AIX, it might be installed locally.
  1112. ac_save_LIBS="$LIBS" LIBS="-L/local/lib $LIBS"
  1113. AC_CHECK_LIB(getloadavg, getloadavg, LIBS="$LIBS -lgetloadavg", LIBS="$ac_save_LIBS")
  1114. fi
  1115.  
  1116. # Make sure it is really in the library, if we think we found it.
  1117. AC_REPLACE_FUNCS(getloadavg)
  1118.  
  1119. if test $ac_cv_func_getloadavg = yes; then
  1120.   AC_DEFINE(HAVE_GETLOADAVG)
  1121. else
  1122. ac_have_func=no
  1123. AC_CHECK_HEADER(sys/dg_sys_info.h,
  1124. [ac_have_func=yes AC_DEFINE(DGUX)
  1125. AC_CHECK_LIB(dgc, dg_sys_info)])
  1126. if test $ac_have_func = no; then
  1127. # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
  1128. # uses stabs), but it is still SVR4.  We cannot check for <elf.h> because
  1129. # Irix 4.0.5F has the header but not the library.
  1130. AC_CHECK_LIB(elf, elf_read,
  1131.   [LIBS="$LIBS -lelf" ac_have_func=yes AC_DEFINE(SVR4)
  1132.   AC_CHECK_LIB(kvm, kvm_open, LIBS="$LIBS -lkvm")])
  1133. fi
  1134. if test $ac_have_func = no; then
  1135. AC_CHECK_HEADER(inq_stats/cpustats.h,
  1136.   [ac_have_func=yes AC_DEFINE(UMAX)
  1137.    AC_DEFINE(UMAX4_3)])
  1138. fi
  1139. if test $ac_have_func = no; then
  1140. AC_CHECK_HEADER(sys/cpustats.h,
  1141.   [ac_have_func=yes AC_DEFINE(UMAX)])
  1142. fi
  1143. if test $ac_have_func = no; then
  1144. AC_CHECK_HEADERS(mach/mach.h)
  1145. fi
  1146.  
  1147. AC_CHECK_HEADER(nlist.h,
  1148. [AC_DEFINE(NLIST_STRUCT)
  1149. AC_MSG_CHECKING([for n_un in struct nlist])
  1150. AC_CACHE_VAL(ac_cv_struct_nlist_n_un,
  1151. [AC_TRY_COMPILE([#include <nlist.h>],
  1152. [struct nlist n; n.n_un.n_name = 0;],
  1153. ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])dnl
  1154. AC_MSG_RESULT($ac_cv_struct_nlist_n_un)
  1155. if test $ac_cv_struct_nlist_n_un = yes; then
  1156.   AC_DEFINE(NLIST_NAME_UNION)
  1157. fi
  1158. ])dnl
  1159.  
  1160. dnl FIXME two bugs here:
  1161. dnl Hardwiring the path of getloadavg.c in the top-level directory,
  1162. dnl and not checking whether a getloadavg from a library needs privileges.
  1163. AC_MSG_CHECKING(whether getloadavg requires setgid)
  1164. AC_CACHE_VAL(ac_cv_func_getloadavg_setgid,
  1165. [AC_EGREP_CPP([Yowza Am I SETGID yet],
  1166. [#include "$srcdir/getloadavg.c"
  1167. #ifdef LDAV_PRIVILEGED
  1168. Yowza Am I SETGID yet
  1169. #endif],
  1170.   ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])dnl
  1171. AC_MSG_RESULT($ac_cv_func_getloadavg_setgid)
  1172. if test $ac_cv_func_getloadavg_setgid = yes; then
  1173.   NEED_SETGID=true AC_DEFINE(GETLOADAVG_PRIVILEGED)
  1174. fi
  1175.  
  1176. fi # Do not have getloadavg in system libraries.
  1177.  
  1178. if test "$NEED_SETGID" = true; then
  1179.   AC_MSG_CHECKING(group of /dev/kmem)
  1180. AC_CACHE_VAL(ac_cv_group_kmem,
  1181. [changequote(, )dnl
  1182.   # On Solaris, /dev/kmem is a symlink.  Get info on the real file.
  1183.   ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
  1184.   # If we got an error (system does not support symlinks), try without -L.
  1185.   test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
  1186.   ac_cv_group_kmem=`/bin/echo $ac_ls_output \
  1187.     | sed -ne 's/[     ][     ]*/ /g;
  1188.            s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/;
  1189.            / /s/.* //;p;'`
  1190. changequote([, ])dnl
  1191. ])dnl
  1192.   KMEM_GROUP=$ac_cv_group_kmem
  1193.   AC_MSG_RESULT($KMEM_GROUP)
  1194. fi
  1195. AC_SUBST(KMEM_GROUP)dnl
  1196. ])
  1197.  
  1198. AC_DEFUN(AC_FUNC_UTIME_NULL,
  1199. [AC_MSG_CHECKING(whether utime accepts a null argument)
  1200. AC_CACHE_VAL(ac_cv_func_utime_null,
  1201. [rm -f conftestdata; > conftestdata
  1202. # Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.
  1203. AC_TRY_RUN([#include <sys/types.h>
  1204. #include <sys/stat.h>
  1205. main() {
  1206. struct stat s, t;
  1207. exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0
  1208. && stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime
  1209. && t.st_mtime - s.st_mtime < 120));
  1210. }], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no,
  1211.   ac_cv_func_utime_null=no)
  1212. rm -f core])dnl
  1213. AC_MSG_RESULT($ac_cv_func_utime_null)
  1214. if test $ac_cv_func_utime_null = yes; then
  1215.   AC_DEFINE(HAVE_UTIME_NULL)
  1216. fi
  1217. ])
  1218.  
  1219. AC_DEFUN(AC_FUNC_STRCOLL,
  1220. [AC_MSG_CHECKING(for strcoll)
  1221. AC_CACHE_VAL(ac_cv_func_strcoll,
  1222. [AC_TRY_RUN([#include <string.h>
  1223. main ()
  1224. {
  1225.   exit (strcoll ("abc", "def") >= 0 ||
  1226.     strcoll ("ABC", "DEF") >= 0 ||
  1227.     strcoll ("123", "456") >= 0);
  1228. }], ac_cv_func_strcoll=yes, ac_cv_func_strcoll=no, ac_cv_func_strcoll=no)])dnl
  1229. AC_MSG_RESULT($ac_cv_func_strcoll)
  1230. if test $ac_cv_func_strcoll = yes; then
  1231.   AC_DEFINE(HAVE_STRCOLL)
  1232. fi
  1233. ])
  1234.  
  1235. AC_DEFUN(AC_FUNC_SETVBUF_REVERSED,
  1236. [AC_MSG_CHECKING(whether setvbuf arguments are reversed)
  1237. AC_CACHE_VAL(ac_cv_func_setvbuf_reversed,
  1238. [AC_TRY_RUN([#include <stdio.h>
  1239. /* If setvbuf has the reversed format, exit 0. */
  1240. main () {
  1241. #ifdef __amigados__
  1242.   /* AmigaDOS is a non-reversed system.  Instead of the test program
  1243.      getting a segfault (no memory protection), it causes enforcer hits
  1244.      or other nastiness, so don't run the test program, just exit with
  1245.      status 1 to indicate that it is non-reversed.  -fnf */
  1246.   exit(1);
  1247. #endif
  1248.   /* This call has the arguments reversed.
  1249.      A reversed system may check and see that the address of main
  1250.      is not _IOLBF, _IONBF, or _IOFBF, and return nonzero.  */
  1251.   if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0)
  1252.     exit(1);
  1253.   putc('\r', stdout);
  1254.   exit(0);            /* Non-reversed systems segv here.  */
  1255. }], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no)
  1256. rm -f core])dnl
  1257. AC_MSG_RESULT($ac_cv_func_setvbuf_reversed)
  1258. if test $ac_cv_func_setvbuf_reversed = yes; then
  1259.   AC_DEFINE(SETVBUF_REVERSED)
  1260. fi
  1261. ])
  1262.  
  1263. AC_DEFUN(AC_FUNC_GETMNTENT,
  1264. [# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX.
  1265. AC_CHECK_LIB(sun, getmntent, LIBS="$LIBS -lsun",
  1266.   [AC_CHECK_LIB(seq, getmntent, LIBS="$LIBS -lseq")])
  1267. AC_CHECK_FUNC(getmntent, [AC_DEFINE(HAVE_GETMNTENT)])])
  1268.  
  1269. AC_DEFUN(AC_FUNC_STRFTIME,
  1270. [# strftime is in -lintl on SCO UNIX.
  1271. AC_CHECK_LIB(intl, strftime, LIBS="$LIBS -lintl")
  1272. AC_CHECK_FUNC(strftime, [AC_DEFINE(HAVE_STRFTIME)])])
  1273.  
  1274. AC_DEFUN(AC_FUNC_MEMCMP,
  1275. [AC_MSG_CHECKING(for 8-bit clean memcmp)
  1276. AC_CACHE_VAL(ac_cv_func_memcmp,
  1277. [AC_TRY_RUN([
  1278. main()
  1279. {
  1280.   char c0 = 0x40, c1 = 0x80, c2 = 0x81;
  1281.   exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
  1282. }
  1283. ], ac_cv_func_memcmp=yes, ac_cv_func_memcmp=no, ac_cv_func_memcmp=no)])dnl
  1284. AC_MSG_RESULT($ac_cv_func_memcmp)
  1285. test $ac_cv_func_memcmp = no && LIBOBJS="$LIBOBJS memcmp.o"
  1286. AC_SUBST(LIBOBJS)dnl
  1287. ])
  1288.  
  1289.  
  1290. dnl ### Checks for structure members
  1291.  
  1292.  
  1293. AC_DEFUN(AC_HEADER_TIME,
  1294. [AC_MSG_CHECKING([whether time.h and sys/time.h may both be included])
  1295. AC_CACHE_VAL(ac_cv_header_time,
  1296. [AC_TRY_COMPILE([#include <sys/types.h>
  1297. #include <sys/time.h>
  1298. #include <time.h>],
  1299. [struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])dnl
  1300. AC_MSG_RESULT($ac_cv_header_time)
  1301. if test $ac_cv_header_time = yes; then
  1302.   AC_DEFINE(TIME_WITH_SYS_TIME)
  1303. fi
  1304. ])
  1305.  
  1306. AC_DEFUN(AC_STRUCT_TM,
  1307. [AC_MSG_CHECKING([whether struct tm is in sys/time.h or time.h])
  1308. AC_CACHE_VAL(ac_cv_struct_tm,
  1309. [AC_TRY_COMPILE([#include <sys/types.h>
  1310. #include <time.h>],
  1311. [struct tm *tp; tp->tm_sec;],
  1312.   ac_cv_struct_tm=time.h, ac_cv_struct_tm=sys/time.h)])dnl
  1313. AC_MSG_RESULT($ac_cv_struct_tm)
  1314. if test $ac_cv_struct_tm = sys/time.h; then
  1315.   AC_DEFINE(TM_IN_SYS_TIME)
  1316. fi
  1317. ])
  1318.  
  1319. AC_DEFUN(AC_STRUCT_TIMEZONE,
  1320. [AC_REQUIRE([AC_STRUCT_TM])dnl
  1321. AC_MSG_CHECKING([for tm_zone in struct tm])
  1322. AC_CACHE_VAL(ac_cv_struct_tm_zone,
  1323. [AC_TRY_COMPILE([#include <sys/types.h>
  1324. #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
  1325.   ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])dnl
  1326. AC_MSG_RESULT($ac_cv_struct_tm_zone)
  1327. if test "$ac_cv_struct_tm_zone" = yes; then
  1328.   AC_DEFINE(HAVE_TM_ZONE)
  1329. else
  1330.   AC_MSG_CHECKING([for tzname])
  1331. AC_CACHE_VAL(ac_cv_var_tzname,
  1332. [AC_TRY_LINK(
  1333. changequote(<<, >>)dnl
  1334. <<#include <time.h>
  1335. #ifndef tzname /* For SGI.  */
  1336. extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
  1337. #endif>>,
  1338. changequote([, ])dnl
  1339. [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])dnl
  1340.   AC_MSG_RESULT($ac_cv_var_tzname)
  1341.   if test $ac_cv_var_tzname = yes; then
  1342.     AC_DEFINE(HAVE_TZNAME)
  1343.   fi
  1344. fi
  1345. ])
  1346.  
  1347. AC_DEFUN(AC_STRUCT_ST_BLOCKS,
  1348. [AC_MSG_CHECKING([for st_blocks in struct stat])
  1349. AC_CACHE_VAL(ac_cv_struct_st_blocks,
  1350. [AC_TRY_COMPILE([#include <sys/types.h>
  1351. #include <sys/stat.h>], [struct stat s; s.st_blocks;],
  1352. ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])dnl
  1353. AC_MSG_RESULT($ac_cv_struct_st_blocks)
  1354. if test $ac_cv_struct_st_blocks = yes; then
  1355.   AC_DEFINE(HAVE_ST_BLOCKS)
  1356. else
  1357.   LIBOBJS="$LIBOBJS fileblocks.o"
  1358. fi
  1359. AC_SUBST(LIBOBJS)dnl
  1360. ])
  1361.  
  1362. AC_DEFUN(AC_STRUCT_ST_BLKSIZE,
  1363. [AC_MSG_CHECKING([for st_blksize in struct stat])
  1364. AC_CACHE_VAL(ac_cv_struct_st_blksize,
  1365. [AC_TRY_COMPILE([#include <sys/types.h>
  1366. #include <sys/stat.h>], [struct stat s; s.st_blksize;],
  1367. ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)])dnl
  1368. AC_MSG_RESULT($ac_cv_struct_st_blksize)
  1369. if test $ac_cv_struct_st_blksize = yes; then
  1370.   AC_DEFINE(HAVE_ST_BLKSIZE)
  1371. fi
  1372. ])
  1373.  
  1374. AC_DEFUN(AC_STRUCT_ST_RDEV,
  1375. [AC_MSG_CHECKING([for st_rdev in struct stat])
  1376. AC_CACHE_VAL(ac_cv_struct_st_rdev,
  1377. [AC_TRY_COMPILE([#include <sys/types.h>
  1378. #include <sys/stat.h>], [struct stat s; s.st_rdev;],
  1379. ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)])dnl
  1380. AC_MSG_RESULT($ac_cv_struct_st_rdev)
  1381. if test $ac_cv_struct_st_rdev = yes; then
  1382.   AC_DEFINE(HAVE_ST_RDEV)
  1383. fi
  1384. ])
  1385.  
  1386.  
  1387. dnl ### Checks for compiler characteristics
  1388.  
  1389.  
  1390. AC_DEFUN(AC_C_CROSS,
  1391. [# If we cannot run a trivial program, we must be cross compiling.
  1392. AC_MSG_CHECKING(whether cross-compiling)
  1393. AC_CACHE_VAL(ac_cv_c_cross,
  1394. [AC_TRY_RUN([main(){return(0);}],
  1395.   ac_cv_c_cross=no, ac_cv_c_cross=yes, ac_cv_cross=yes)])dnl
  1396. cross_compiling=$ac_cv_c_cross
  1397. AC_MSG_RESULT($ac_cv_c_cross)
  1398. ])
  1399.  
  1400. AC_DEFUN(AC_C_CHAR_UNSIGNED,
  1401. [AC_MSG_CHECKING(whether char is unsigned)
  1402. AC_CACHE_VAL(ac_cv_c_char_unsigned,
  1403. [if test "$GCC" = yes; then
  1404.   # GCC predefines this symbol on systems where it applies.
  1405. AC_EGREP_CPP(yes,
  1406. [#ifdef __CHAR_UNSIGNED__
  1407.   yes
  1408. #endif
  1409. ], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)
  1410. else
  1411. AC_TRY_RUN(
  1412. [/* volatile prevents gcc2 from optimizing the test away on sparcs.  */
  1413. #if !defined(__STDC__) || __STDC__ != 1
  1414. #define volatile
  1415. #endif
  1416. main() {
  1417.   volatile char c = 255; exit(c < 0);
  1418. }], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)
  1419. fi])dnl
  1420. AC_MSG_RESULT($ac_cv_c_char_unsigned)
  1421. if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
  1422.   AC_DEFINE(__CHAR_UNSIGNED__)
  1423. fi
  1424. ])
  1425.  
  1426. AC_DEFUN(AC_C_LONG_DOUBLE,
  1427. [AC_MSG_CHECKING(for long double)
  1428. AC_CACHE_VAL(ac_cv_c_long_double,
  1429. [if test "$GCC" = yes; then
  1430.   ac_cv_c_long_double=yes
  1431. else
  1432. AC_TRY_RUN([int main() {
  1433. /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
  1434. long double foo = 0.0;
  1435. /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
  1436. exit(sizeof(long double) < sizeof(double)); }],
  1437. ac_cv_c_long_double=yes, ac_cv_c_long_double=no)
  1438. fi])dnl
  1439. AC_MSG_RESULT($ac_cv_c_long_double)
  1440. if test $ac_cv_c_long_double = yes; then
  1441.   AC_DEFINE(HAVE_LONG_DOUBLE)
  1442. fi
  1443. ])
  1444.  
  1445. AC_DEFUN(AC_INT_16_BITS,
  1446. [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(int)])dnl
  1447. AC_MSG_CHECKING(whether int is 16 bits)
  1448. AC_TRY_RUN([main() { exit(sizeof(int) != 2); }],
  1449.  [AC_MSG_RESULT(yes)
  1450.  AC_DEFINE(INT_16_BITS)], AC_MSG_RESULT(no))
  1451. ])
  1452.  
  1453. AC_DEFUN(AC_LONG_64_BITS,
  1454. [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(long)])dnl
  1455. AC_MSG_CHECKING(whether long int is 64 bits)
  1456. AC_TRY_RUN([main() { exit(sizeof(long int) != 8); }],
  1457.  [AC_MSG_RESULT(yes)
  1458.  AC_DEFINE(LONG_64_BITS)], AC_MSG_RESULT(no))
  1459. ])
  1460.  
  1461. AC_DEFUN(AC_C_BIGENDIAN,
  1462. [AC_MSG_CHECKING(whether byte ordering is bigendian)
  1463. AC_CACHE_VAL(ac_cv_c_bigendian,
  1464. [AC_TRY_RUN([main () {
  1465.   /* Are we little or big endian?  From Harbison&Steele.  */
  1466.   union
  1467.   {
  1468.     long l;
  1469.     char c[sizeof (long)];
  1470.   } u;
  1471.   u.l = 1;
  1472.   exit (u.c[sizeof (long) - 1] == 1);
  1473. }], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes)])dnl
  1474. AC_MSG_RESULT($ac_cv_c_bigendian)
  1475. if test $ac_cv_c_bigendian = yes; then
  1476.   AC_DEFINE(WORDS_BIGENDIAN)
  1477. fi
  1478. ])
  1479.  
  1480. AC_DEFUN(AC_C_INLINE,
  1481. [AC_MSG_CHECKING([for inline])
  1482. AC_CACHE_VAL(ac_cv_c_inline,
  1483. [if test "$GCC" = yes; then
  1484. AC_TRY_COMPILE(, [} inline foo() {], ac_cv_c_inline=yes, ac_cv_c_inline=no)
  1485. else
  1486.   ac_cv_c_inline=no
  1487. fi])dnl
  1488. AC_MSG_RESULT($ac_cv_c_inline)
  1489. if test $ac_cv_c_inline = no; then
  1490.   AC_DEFINE(inline, __inline)
  1491. fi
  1492. ])
  1493.  
  1494. AC_DEFUN(AC_C_CONST,
  1495. [dnl This message is consistent in form with the other checking messages,
  1496. dnl and with the result message.
  1497. AC_MSG_CHECKING([for working const])
  1498. AC_CACHE_VAL(ac_cv_c_const,
  1499. [AC_TRY_COMPILE(,
  1500. changequote(<<, >>)dnl
  1501. <<
  1502. /* Ultrix mips cc rejects this.  */
  1503. typedef int charset[2]; const charset x;
  1504. /* SunOS 4.1.1 cc rejects this.  */
  1505. char const *const *ccp;
  1506. char **p;
  1507. /* NEC SVR4.0.2 mips cc rejects this.  */
  1508. struct point {int x, y;};
  1509. static struct point const zero;
  1510. /* AIX XL C 1.02.0.0 rejects this.
  1511.    It does not let you subtract one const X* pointer from another in an arm
  1512.    of an if-expression whose if-part is not a constant expression */
  1513. const char *g = "string";
  1514. ccp = &g + (g ? g-g : 0);
  1515. /* HPUX 7.0 cc rejects these. */
  1516. ++ccp;
  1517. p = (char**) ccp;
  1518. ccp = (char const *const *) p;
  1519. { /* SCO 3.2v4 cc rejects this.  */
  1520.   char *t;
  1521.   char const *s = 0 ? (char *) 0 : (char const *) 0;
  1522.  
  1523.   *t++ = 0;
  1524. }
  1525. { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  1526.   int x[] = {25, 17};
  1527.   const int *foo = &x[0];
  1528.   ++foo;
  1529. }
  1530. { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  1531.   typedef const int *iptr;
  1532.   iptr p = 0;
  1533.   ++p;
  1534. }
  1535. { /* AIX XL C 1.02.0.0 rejects this saying
  1536.      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  1537.   struct s { int j; const int *ap[3]; };
  1538.   struct s *b; b->j = 5;
  1539. }
  1540. { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
  1541.   const int foo = 10;
  1542. }
  1543. >>,
  1544. changequote([, ])dnl
  1545. ac_cv_c_const=yes, ac_cv_c_const=no)])dnl
  1546. AC_MSG_RESULT($ac_cv_c_const)
  1547. if test $ac_cv_c_const = no; then
  1548.   AC_DEFINE(const, )
  1549. fi
  1550. ])
  1551.  
  1552. define(AC_ARG_ARRAY,
  1553. [errprint(__file__:__line__: [$0] has been removed; don't do unportable things with arguments
  1554. )m4exit(4)])
  1555.  
  1556.  
  1557. dnl ### Checks for operating system services
  1558.  
  1559.  
  1560. AC_DEFUN(AC_SYS_INTERPRETER,
  1561. [# Pull the hash mark out of the macro call to avoid m4 problems.
  1562. ac_msg="whether #! works in shell scripts"
  1563. AC_MSG_CHECKING($ac_msg)
  1564. AC_CACHE_VAL(ac_cv_sys_interpreter,
  1565. [echo '#!/bin/cat
  1566. exit 69
  1567. ' > conftest
  1568. chmod u+x conftest
  1569. (SHELL=/bin/sh; export SHELL; ./conftest >/dev/null)
  1570. if test $? -ne 69; then
  1571.    ac_cv_sys_interpreter=yes
  1572. else
  1573.    ac_cv_sys_interpreter=no
  1574. fi
  1575. rm -f conftest])dnl
  1576. AC_MSG_RESULT($ac_cv_sys_interpreter)
  1577. ])
  1578.  
  1579. define(AC_HAVE_POUNDBANG,
  1580. [errprint(__file__:__line__: [$0 has been replaced by AC_SYS_INTERPRETER, taking no arguments
  1581. ])m4exit(4)])
  1582.  
  1583. AC_DEFUN(AC_SYS_LONG_FILE_NAMES,
  1584. [AC_MSG_CHECKING(for long file names)
  1585. AC_CACHE_VAL(ac_cv_sys_long_file_names,
  1586. [ac_cv_sys_long_file_names=yes
  1587. # Test for long file names in all the places we know might matter:
  1588. #      .        the current directory, where building will happen
  1589. #      /tmp        where it might want to write temporary files
  1590. #      /var/tmp        likewise
  1591. #      /usr/tmp        likewise
  1592. #      $prefix/lib    where we will be installing things
  1593. #      $exec_prefix/lib    likewise
  1594. # eval it to expand exec_prefix.
  1595. for ac_dir in `eval echo . /tmp $prefix/lib $exec_prefix/lib` ; do
  1596.   test -d $ac_dir || continue
  1597.   test -w $ac_dir || continue # It is less confusing to not echo anything here.
  1598.   (echo 1 > $ac_dir/conftest9012345) 2>/dev/null
  1599.   (echo 2 > $ac_dir/conftest9012346) 2>/dev/null
  1600.   val=`cat $ac_dir/conftest9012345 2>/dev/null`
  1601.   if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then
  1602.     ac_cv_sys_long_file_names=no
  1603.     rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null
  1604.     break
  1605.   fi
  1606.   rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null
  1607. done])dnl
  1608. AC_MSG_RESULT($ac_cv_sys_long_file_names)
  1609. if test $ac_cv_sys_long_file_names = yes; then
  1610.   AC_DEFINE(HAVE_LONG_FILE_NAMES)
  1611. fi
  1612. ])
  1613.  
  1614. AC_DEFUN(AC_SYS_RESTARTABLE_SYSCALLS,
  1615. [AC_MSG_CHECKING(for restartable system calls)
  1616. AC_CACHE_VAL(ac_cv_sys_restartable_syscalls,
  1617. [AC_TRY_RUN(
  1618. [/* Exit 0 (true) if wait returns something other than -1,
  1619.    i.e. the pid of the child, which means that wait was restarted
  1620.    after getting the signal.  */
  1621. #include <sys/types.h>
  1622. #include <signal.h>
  1623. ucatch (isig) { }
  1624. main () {
  1625.   int i = fork (), status;
  1626.   if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); }
  1627.   signal (SIGINT, ucatch);
  1628.   status = wait(&i);
  1629.   if (status == -1) wait(&i);
  1630.   exit (status == -1);
  1631. }
  1632. ], ac_cv_sys_restartable_syscalls=yes, ac_cv_sys_restartable_syscalls=no)])dnl
  1633. AC_MSG_RESULT($ac_cv_sys_restartable_syscalls)
  1634. if test $ac_cv_sys_restartable_syscalls = yes; then
  1635.   AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS)
  1636. fi
  1637. ])
  1638.  
  1639. AC_DEFUN(AC_PATH_X,
  1640. [AC_REQUIRE_CPP()dnl Set CPP; we run AC_PATH_X_DIRECT conditionally.
  1641. # If we find X, set shell vars x_includes and x_libraries to the
  1642. # paths, otherwise set no_x=yes.
  1643. # Uses ac_ vars as temps to allow command line to override cache and checks.
  1644. # --without-x overrides everything else, but does not touch the cache.
  1645. AC_MSG_CHECKING(for X)
  1646.  
  1647. AC_ARG_WITH(x, [  --with-x                use the X Window System])
  1648. if test "x$with_x" = xno; then
  1649.   no_x=yes
  1650. else
  1651.   if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
  1652.     no_x=
  1653.   else
  1654. AC_CACHE_VAL(ac_cv_path_x,
  1655. [# One or both of the vars are not set, and there is no cached value.
  1656. no_x=yes
  1657. AC_PATH_X_XMKMF
  1658. if test "$no_x" = yes; then
  1659. AC_PATH_X_DIRECT
  1660. fi
  1661. if test "$no_x" = yes; then
  1662.   ac_cv_path_x="no_x=yes"
  1663. else
  1664.   ac_cv_path_x="no_x= ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
  1665. fi])dnl
  1666.   fi
  1667.   eval "$ac_cv_path_x"
  1668. fi # $with_x != no
  1669.  
  1670. if test "$no_x" = yes; then
  1671.   AC_MSG_RESULT(no)
  1672. else
  1673.   test "x$x_includes" = xNONE && x_includes=$ac_x_includes
  1674.   test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
  1675.   ac_cv_path_x="no_x= ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
  1676.   AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
  1677. fi
  1678. ])
  1679.  
  1680. dnl Internal subroutine of AC_PATH_X.
  1681. dnl Set ac_x_includes, ac_x_libraries, and no_x (initially yes).
  1682. AC_DEFUN(AC_PATH_X_XMKMF,
  1683. [rm -fr conftestdir
  1684. if mkdir conftestdir; then
  1685.   cd conftestdir
  1686.   # Make sure to not put "make" in the Imakefile rules, since we grep it out.
  1687.   cat > Imakefile <<'EOF'
  1688. acfindx:
  1689.     @/bin/echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
  1690. EOF
  1691.   if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
  1692.     no_x=
  1693.     # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
  1694.     eval `make acfindx 2>/dev/null | grep -v make`
  1695.     # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
  1696.     if test ! -f $ac_im_usrlibdir/libX11.a && test -f $ac_im_libdir/libX11.a
  1697.     then
  1698.       ac_im_usrlibdir=$ac_im_libdir
  1699.     fi
  1700.     case "$ac_im_incroot" in
  1701.     /gnu/include) ;;
  1702.     *) ac_x_includes="$ac_im_incroot" ;;
  1703.     esac
  1704.     case "$ac_im_usrlibdir" in
  1705.     /gnu/lib) ;;
  1706.     *) ac_x_libraries="$ac_im_usrlibdir" ;;
  1707.     esac
  1708.   fi
  1709.   cd ..
  1710.   rm -fr conftestdir
  1711. fi
  1712. ])
  1713.  
  1714. dnl Internal subroutine of AC_PATH_X.
  1715. dnl Set ac_x_includes, ac_x_libraries, and no_x (initially yes).
  1716. AC_DEFUN(AC_PATH_X_DIRECT,
  1717. [test -z "$x_direct_test_library" && x_direct_test_library=Xt
  1718. test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
  1719. test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
  1720. AC_TRY_CPP([#include <$x_direct_test_include>],
  1721. [no_x= ac_x_includes=],
  1722. [  for ac_dir in               \
  1723.     /usr/X11R6/include        \
  1724.     /usr/X11R5/include        \
  1725.     /usr/X11R4/include        \
  1726.                               \
  1727.     /gnu/include/X11R6        \
  1728.     /gnu/include/X11R5        \
  1729.     /gnu/include/X11R4        \
  1730.                               \
  1731.     /usr/local/X11R6/include  \
  1732.     /usr/local/X11R5/include  \
  1733.     /usr/local/X11R4/include  \
  1734.                               \
  1735.     /usr/local/include/X11R6  \
  1736.     /usr/local/include/X11R5  \
  1737.     /usr/local/include/X11R4  \
  1738.                               \
  1739.     /usr/X11/include          \
  1740.     /gnu/include/X11          \
  1741.     /usr/local/X11/include    \
  1742.     /usr/local/include/X11    \
  1743.                               \
  1744.     /usr/X386/include         \
  1745.     /usr/x386/include         \
  1746.     /usr/XFree86/include/X11  \
  1747.                               \
  1748.     /gnu/include              \
  1749.     /usr/local/include        \
  1750.     /usr/unsupported/include  \
  1751.     /usr/athena/include       \
  1752.     /usr/local/x11r5/include  \
  1753.     /usr/lpp/Xamples/include  \
  1754.                               \
  1755.     /usr/openwin/include      \
  1756.     /usr/openwin/share/include \
  1757.     ; \
  1758.   do
  1759.     if test -r "$ac_dir/$x_direct_test_include"; then
  1760.       no_x= ac_x_includes=$ac_dir
  1761.       break
  1762.     fi
  1763.   done])
  1764.  
  1765. # Check for the libraries.
  1766. # See if we find them without any special options.
  1767. # Don't add to $LIBS permanently.
  1768. ac_save_LIBS="$LIBS"
  1769. LIBS="$LIBS -l$x_direct_test_library"
  1770. AC_TRY_LINK(, [${x_direct_test_function}()],
  1771. [LIBS="$ac_save_LIBS" no_x= ac_x_libraries=],
  1772. [LIBS="$ac_save_LIBS"
  1773. # First see if replacing the include by lib works.
  1774. for ac_dir in `/bin/echo "$ac_x_includes" | sed s/include/lib/` \
  1775.     /usr/X11R6/lib        \
  1776.     /usr/X11R5/lib        \
  1777.     /usr/X11R4/lib        \
  1778.                           \
  1779.     /usr/lib/X11R6        \
  1780.     /usr/lib/X11R5        \
  1781.     /usr/lib/X11R4        \
  1782.                           \
  1783.     /usr/local/X11R6/lib  \
  1784.     /usr/local/X11R5/lib  \
  1785.     /usr/local/X11R4/lib  \
  1786.                           \
  1787.     /usr/local/lib/X11R6  \
  1788.     /usr/local/lib/X11R5  \
  1789.     /usr/local/lib/X11R4  \
  1790.                           \
  1791.     /usr/X11/lib          \
  1792.     /usr/lib/X11          \
  1793.     /usr/local/X11/lib    \
  1794.     /usr/local/lib/X11    \
  1795.                           \
  1796.     /usr/X386/lib         \
  1797.     /usr/x386/lib         \
  1798.     /usr/XFree86/lib/X11  \
  1799.                           \
  1800.     /usr/lib              \
  1801.     /usr/local/lib        \
  1802.     /usr/unsupported/lib  \
  1803.     /usr/athena/lib       \
  1804.     /usr/local/x11r5/lib  \
  1805.     /usr/lpp/Xamples/lib  \
  1806.                           \
  1807.     /usr/openwin/lib      \
  1808.     /usr/openwin/share/lib \
  1809.     ; \
  1810. do
  1811.   for ac_extension in a so sl; do
  1812.     if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
  1813.       no_x= ac_x_libraries=$ac_dir
  1814.       break 2
  1815.     fi
  1816.   done
  1817. done])])
  1818.  
  1819. dnl Find additional X libraries, magic flags, etc.
  1820. AC_DEFUN(AC_PATH_XTRA,
  1821. [AC_REQUIRE([AC_ISC_POSIX])dnl
  1822. AC_REQUIRE([AC_PATH_X])dnl
  1823. if test "$no_x" = yes; then 
  1824.   # Not all programs may use this symbol, but it does not hurt to define it.
  1825.   X_CFLAGS="$X_CFLAGS -DX_DISPLAY_MISSING"
  1826. else
  1827.   if test -n "$x_includes"; then
  1828.     X_CFLAGS="$X_CFLAGS -I$x_includes"
  1829.   fi
  1830.  
  1831.   # It would be nice to have a more robust check for the -R ld option than
  1832.   # just checking for Solaris.
  1833.   # It would also be nice to do this for all -L options, not just this one.
  1834.   if test -n "$x_libraries"; then
  1835.     X_LIBS="$X_LIBS -L$x_libraries"
  1836.     if test "`(uname) 2>/dev/null`" = SunOS &&
  1837.       uname -r | grep '^5' >/dev/null; then
  1838.       X_LIBS="$X_LIBS -R$x_libraries"
  1839.     fi
  1840.   fi
  1841.  
  1842.   # Check for libraries that X11R6 Xt/Xaw programs need.
  1843.  
  1844.   ac_save_LDFLAGS="$LDFLAGS"
  1845.   LDFLAGS="$LDFLAGS -L$x_libraries"
  1846.   # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
  1847.   # check for ICE first), but we must link in the order -lSM -lICE or
  1848.   # we get undefined symbols.  So assume we have SM if we have ICE.
  1849.   # These have to be linked with before -lX11, unlike the other
  1850.   # libraries we check for below, so use a different variable.
  1851.   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
  1852.   AC_CHECK_LIB(ICE, IceConnectionNumbers,
  1853.     [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"])
  1854.   LDFLAGS="$ac_save_LDFLAGS"
  1855.  
  1856.   # Check for system-dependent libraries X programs must link with.
  1857.  
  1858.   if test "$ISC" = yes; then
  1859.     X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
  1860.   else
  1861.     # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
  1862.     # libraries were built with DECnet support.  And karl@cs.umb.edu says
  1863.     # the Alpha needs dnet_stub (dnet does not exist).
  1864.     AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
  1865.     if test $ac_cv_lib_dnet = no; then
  1866.       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
  1867.         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
  1868.     fi
  1869.  
  1870.     # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
  1871.     # to get the SysV transport functions.
  1872.     # Not sure which flavor of 386 UNIX this is, but it seems harmless to
  1873.     # check for it.
  1874.     AC_CHECK_LIB(nsl, t_accept, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"])
  1875.  
  1876.     # lieder@skyler.mavd.honeywell.com says without -lsocket,
  1877.     # socket/setsockopt and other routines are undefined under SCO ODT 2.0.
  1878.     # But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
  1879.     if test "`(uname) 2>/dev/null`" != IRIX; then
  1880.       AC_CHECK_LIB(socket, socket, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"])
  1881.     fi
  1882.   fi
  1883. fi
  1884. AC_SUBST(X_CFLAGS)dnl
  1885. AC_SUBST(X_PRE_LIBS)dnl
  1886. AC_SUBST(X_LIBS)dnl
  1887. AC_SUBST(X_EXTRA_LIBS)dnl
  1888. ])
  1889.  
  1890.  
  1891. dnl ### Checks for UNIX variants
  1892. dnl These are kludges which should be replaced by a single POSIX check.
  1893.  
  1894.  
  1895. AC_DEFUN(AC_AIX,
  1896. [AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
  1897. AC_BEFORE([$0], [AC_TRY_LINK])dnl
  1898. AC_BEFORE([$0], [AC_TRY_RUN])dnl
  1899. AC_MSG_CHECKING(for AIX)
  1900. AC_EGREP_CPP(yes,
  1901. [#ifdef _AIX
  1902.   yes
  1903. #endif
  1904. ], [AC_MSG_RESULT(yes); AC_DEFINE(_ALL_SOURCE)], AC_MSG_RESULT(no))
  1905. ])
  1906.  
  1907. AC_DEFUN(AC_MINIX,
  1908. [AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
  1909. AC_BEFORE([$0], [AC_TRY_LINK])dnl
  1910. AC_BEFORE([$0], [AC_TRY_RUN])dnl
  1911. AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=)
  1912. if test "$MINIX" = yes; then
  1913.   AC_DEFINE(_POSIX_SOURCE)
  1914.   AC_DEFINE(_POSIX_1_SOURCE, 2)
  1915.   AC_DEFINE(_MINIX)
  1916. fi
  1917. ])
  1918.  
  1919. AC_DEFUN(AC_ISC_POSIX,
  1920. [AC_BEFORE([$0], [AC_TRY_LINK])dnl
  1921. AC_BEFORE([$0], [AC_TRY_LINK])dnl
  1922. AC_BEFORE([$0], [AC_TRY_RUN])dnl
  1923. AC_MSG_CHECKING(for POSIXized ISC)
  1924. if test -d /gnu/etc/conf/kconfig.d &&
  1925.   grep _POSIX_VERSION [/gnu/include/sys/unistd.h] >/dev/null 2>&1
  1926. then
  1927.   AC_MSG_RESULT(yes)
  1928.   ISC=yes # If later tests want to check for ISC.
  1929.   AC_DEFINE(_POSIX_SOURCE)
  1930.   if test "$GCC" = yes; then
  1931.     CC="$CC -posix"
  1932.   else
  1933.     CC="$CC -Xp"
  1934.   fi
  1935. else
  1936.   AC_MSG_RESULT(no)
  1937.   ISC=
  1938. fi
  1939. ])
  1940.  
  1941. AC_DEFUN(AC_XENIX_DIR,
  1942. [AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl
  1943. AC_REQUIRE([AC_DIR_HEADER])dnl
  1944. AC_MSG_CHECKING(for Xenix)
  1945. AC_EGREP_CPP(yes,
  1946. [#if defined(M_XENIX) && !defined(M_UNIX)
  1947.   yes
  1948. #endif
  1949. ], [AC_MSG_RESULT(yes); XENIX=yes], [AC_MSG_RESULT(no); XENIX=])
  1950. if test "$XENIX" = yes; then
  1951.   # Make sure -ldir precedes -lx.
  1952.   test $ac_header_dirent = dirent.h && LIBS="$LIBS -ldir"
  1953.   LIBS="$LIBS -lx"
  1954. fi
  1955. ])
  1956.  
  1957. AC_DEFUN(AC_DYNIX_SEQ,
  1958. [AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT])dnl
  1959. AC_CHECK_LIB(seq, getmntent, LIBS="$LIBS -lseq")
  1960. ])
  1961.  
  1962. AC_DEFUN(AC_IRIX_SUN,
  1963. [AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT or AC_CHECK_LIB(sun, getpwnam)])dnl
  1964. AC_CHECK_LIB(sun, getmntent, LIBS="$LIBS -lsun")
  1965. ])
  1966.  
  1967. AC_DEFUN(AC_SCO_INTL,
  1968. [AC_OBSOLETE([$0], [; instead use AC_FUNC_STRFTIME])dnl
  1969. AC_CHECK_LIB(intl, strftime, LIBS="$LIBS -lintl")
  1970. ])
  1971.