home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / lynx2.8.1dev.10.tar.gz / lynx2.8.1dev.10.tar / lynx2-8 / aclocal.m4 next >
Text File  |  1998-05-02  |  46KB  |  1,525 lines

  1. dnl Macros for auto-configure script.
  2. dnl by T.E.Dickey <dickey@clark.net>
  3. dnl and Jim Spath <jspath@mail.bcpl.lib.md.us>
  4. dnl and Philippe De Muyter <phdm@macqel.be>
  5. dnl
  6. dnl Created: 1997/1/28
  7. dnl Updated: 1997/12/23
  8. dnl
  9. dnl ---------------------------------------------------------------------------
  10. dnl ---------------------------------------------------------------------------
  11. dnl Add an include-directory to $CPPFLAGS.  Don't add /usr/include, since it's
  12. dnl redundant.  We don't normally need to add -I/usr/local/include for gcc,
  13. dnl but old versions (and some misinstalled ones) need that.
  14. AC_DEFUN([CF_ADD_INCDIR],
  15. [
  16. for cf_add_incdir in $1
  17. do
  18.     while true
  19.     do
  20.         case $cf_add_incdir in
  21.         /usr/include) # (vi
  22.             ;;
  23.         *) # (vi
  24.             CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
  25.             ;;
  26.         esac
  27.         cf_top_incdir=`echo $cf_add_incdir | sed -e 's:/include/.*$:/include:'`
  28.         test "$cf_top_incdir" = "$cf_add_incdir" && break
  29.         cf_add_incdir="$cf_top_incdir"
  30.     done
  31. done
  32. ])dnl
  33. dnl ---------------------------------------------------------------------------
  34. dnl Check for existence of alternate-character-set support in curses, so we
  35. dnl can decide to use it for box characters.
  36. dnl 
  37. AC_DEFUN([CF_ALT_CHAR_SET],
  38. [
  39. AC_MSG_CHECKING([if curses supports alternate-character set])
  40. AC_CACHE_VAL(cf_cv_alt_char_set,[
  41. for mapname in acs_map _acs_map
  42. do
  43.     AC_TRY_LINK([
  44. #include <${cf_cv_ncurses_header-curses.h}>
  45.     ],[chtype x = acs_map['l']; acs_map['m'] = 0],
  46.     [cf_cv_alt_char_set=$mapname
  47.      break],  
  48.     [cf_cv_alt_char_set=no])
  49. done
  50.     ])
  51. AC_MSG_RESULT($cf_cv_alt_char_set)
  52. test $cf_cv_alt_char_set != no && AC_DEFINE_UNQUOTED(ALT_CHAR_SET,$mapname)
  53. ])dnl
  54. dnl ---------------------------------------------------------------------------
  55. dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
  56. dnl in the sharutils 4.2 distribution.
  57. AC_DEFUN([CF_ANSI_CC_CHECK],
  58. [
  59. AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
  60. AC_CACHE_VAL(cf_cv_ansi_cc,[
  61. cf_cv_ansi_cc=no
  62. cf_save_CFLAGS="$CFLAGS"
  63. # Don't try gcc -ansi; that turns off useful extensions and
  64. # breaks some systems' header files.
  65. # AIX            -qlanglvl=ansi
  66. # Ultrix and OSF/1    -std1
  67. # HP-UX            -Aa -D_HPUX_SOURCE
  68. # SVR4            -Xc
  69. # UnixWare 1.2        (cannot use -Xc, since ANSI/POSIX clashes)
  70. for cf_arg in "-DCC_HAS_PROTOS" \
  71.     "" \
  72.     -qlanglvl=ansi \
  73.     -std1 \
  74.     "-Aa -D_HPUX_SOURCE +e" \
  75.     "-Aa -D_HPUX_SOURCE" \
  76.     -Xc
  77. do
  78.     CFLAGS="$cf_save_CFLAGS $cf_arg"
  79.     AC_TRY_COMPILE(
  80. [
  81. #ifndef CC_HAS_PROTOS
  82. #if !defined(__STDC__) || __STDC__ != 1
  83. choke me
  84. #endif
  85. #endif
  86. ],[
  87.     int test (int i, double x);
  88.     struct s1 {int (*f) (int a);};
  89.     struct s2 {int (*f) (double a);};],
  90.     [cf_cv_ansi_cc="$cf_arg"; break])
  91. done
  92. CFLAGS="$cf_save_CFLAGS"
  93. ])
  94. AC_MSG_RESULT($cf_cv_ansi_cc)
  95.  
  96. if test "$cf_cv_ansi_cc" != "no"; then
  97. if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
  98.     CFLAGS="$CFLAGS $cf_cv_ansi_cc"
  99. else
  100.     AC_DEFINE(CC_HAS_PROTOS)
  101. fi
  102. fi
  103. ])dnl
  104. dnl ---------------------------------------------------------------------------
  105. dnl Allow user to disable a normally-on option.
  106. AC_DEFUN([CF_ARG_DISABLE],
  107. [CF_ARG_OPTION($1,[$2 (default: on)],[$3],[$4],yes)])dnl
  108. dnl ---------------------------------------------------------------------------
  109. dnl Allow user to enable a normally-off option.
  110. AC_DEFUN([CF_ARG_ENABLE],
  111. [CF_ARG_OPTION($1,[$2 (default: off)],[$3],[$4],no)])dnl
  112. dnl ---------------------------------------------------------------------------
  113. dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
  114. dnl values.
  115. dnl
  116. dnl Parameters:
  117. dnl $1 = option name
  118. dnl $2 = help-string
  119. dnl $3 = action to perform if option is not default
  120. dnl $4 = action if perform if option is default
  121. dnl $5 = default option value (either 'yes' or 'no')
  122. AC_DEFUN([CF_ARG_OPTION],
  123. [AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
  124.   if test "$enableval" != "$5" ; then
  125. ifelse($3,,[    :]dnl
  126. ,[    $3]) ifelse($4,,,[
  127.   else
  128.     $4])
  129.   fi],[enableval=$5 ifelse($4,,,[
  130.   $4
  131. ])dnl
  132.   ])])dnl
  133. dnl ---------------------------------------------------------------------------
  134. dnl Check if curses.h defines TRUE/FALSE (it does under SVr4).
  135. AC_DEFUN([CF_BOOL_DEFS],
  136. [
  137. AC_MSG_CHECKING(if TRUE/FALSE are defined)
  138. AC_CACHE_VAL(cf_cv_bool_defs,[
  139. AC_TRY_COMPILE([
  140. #include <${cf_cv_ncurses_header-curses.h}>
  141. #include <stdio.h>],[int x = TRUE, y = FALSE],
  142.     [cf_cv_bool_defs=yes],
  143.     [cf_cv_bool_defs=no])])
  144. AC_MSG_RESULT($cf_cv_bool_defs)
  145. if test "$cf_cv_bool_defs" = no ; then
  146.     AC_DEFINE(TRUE,(1))
  147.     AC_DEFINE(FALSE,(0))
  148. fi
  149. ])dnl
  150. dnl ---------------------------------------------------------------------------
  151. dnl Check for data that is usually declared in <stdio.h> or <errno.h>
  152. dnl $1 = the name to check
  153. AC_DEFUN([CF_CHECK_ERRNO],
  154. [
  155. AC_MSG_CHECKING([declaration of $1])
  156. AC_CACHE_VAL(cf_cv_dcl_$1,[
  157.     AC_TRY_COMPILE([
  158. #if HAVE_STDLIB_H
  159. #include <stdlib.h>
  160. #endif
  161. #include <stdio.h>
  162. #include <sys/types.h>
  163. #include <errno.h> ],
  164.     [long x = (long) $1],
  165.     [eval 'cf_cv_dcl_'$1'=yes'],
  166.     [eval 'cf_cv_dcl_'$1'=no]')])
  167. eval 'cf_result=$cf_cv_dcl_'$1
  168. AC_MSG_RESULT($cf_result)
  169.  
  170. # It's possible (for near-UNIX clones) that the data doesn't exist
  171. AC_CACHE_VAL(cf_cv_have_$1,[
  172. if test $cf_result = no ; then
  173.     eval 'cf_result=DECL_'$1
  174.     CF_UPPER(cf_result,$cf_result)
  175.     AC_DEFINE_UNQUOTED($cf_result)
  176.     AC_MSG_CHECKING([existence of $1])
  177.         AC_TRY_LINK([
  178. #undef $1
  179. extern long $1;
  180. ],
  181.             [$1 = 2],
  182.             [eval 'cf_cv_have_'$1'=yes'],
  183.             [eval 'cf_cv_have_'$1'=no'])
  184.         eval 'cf_result=$cf_cv_have_'$1
  185.         AC_MSG_RESULT($cf_result)
  186. else
  187.     eval 'cf_cv_have_'$1'=yes'
  188. fi
  189. ])
  190. eval 'cf_result=HAVE_'$1
  191. CF_UPPER(cf_result,$cf_result)
  192. eval 'test $cf_cv_have_'$1' = yes && AC_DEFINE_UNQUOTED($cf_result)'
  193. ])dnl
  194. dnl ---------------------------------------------------------------------------
  195. dnl Check if a function is declared by including a set of include files.
  196. dnl Invoke the corresponding actions according to whether it is found or not.
  197. dnl
  198. dnl Gcc (unlike other compilers) will only warn about the miscast assignment
  199. dnl in the first test, but most compilers will oblige with an error in the
  200. dnl second test.
  201. dnl
  202. dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  203. AC_DEFUN(CF_CHECK_FUNCDECL,
  204. [
  205. AC_MSG_CHECKING([for $2 declaration])
  206. AC_CACHE_VAL(ac_cv_func_decl_$2,
  207. [AC_TRY_COMPILE([$1],
  208. [#ifndef ${ac_func}
  209. extern    int    ${ac_func}();
  210. #endif],[
  211. AC_TRY_COMPILE([$1],
  212. [#ifndef ${ac_func}
  213. int    (*p)() = ${ac_func};
  214. #endif],[
  215. eval "ac_cv_func_decl_$2=yes"],[
  216. eval "ac_cv_func_decl_$2=no"])],[
  217. eval "ac_cv_func_decl_$2=yes"])])
  218. if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then
  219.   AC_MSG_RESULT(yes)
  220.   ifelse([$3], , :, [$3])
  221. else
  222.   AC_MSG_RESULT(no)
  223. ifelse([$4], , , [$4
  224. ])dnl
  225. fi
  226. ])dnl
  227. dnl ---------------------------------------------------------------------------
  228. dnl Check if functions are declared by including a set of include files.
  229. dnl and define DECL_XXX if not.
  230. dnl
  231. dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  232. AC_DEFUN(CF_CHECK_FUNCDECLS,
  233. [for ac_func in $2
  234. do
  235. CF_CHECK_FUNCDECL([$1], $ac_func,
  236. [$3],
  237. [
  238.   CF_UPPER(ac_tr_func,DECL_$ac_func)
  239.   AC_DEFINE_UNQUOTED($ac_tr_func) $4])dnl
  240. done
  241. ])dnl
  242. dnl ---------------------------------------------------------------------------
  243. dnl Check if curses supports color.  (Note that while SVr3 curses supports
  244. dnl color, it does this differently from SVr4 curses; more work would be needed
  245. dnl to accommodate SVr3).
  246. dnl 
  247. AC_DEFUN([CF_COLOR_CURSES],
  248. [
  249. AC_MSG_CHECKING(if curses supports color attributes)
  250. AC_CACHE_VAL(cf_cv_color_curses,[
  251.     AC_TRY_LINK([
  252. #include <${cf_cv_ncurses_header-curses.h}>
  253. ],
  254.     [chtype x = COLOR_BLUE;
  255.      has_colors();
  256.      start_color();
  257. #ifndef NCURSES_BROKEN
  258.      wbkgd(curscr, getbkgd(stdscr)); /* X/Open XPG4 aka SVr4 Curses */
  259. #endif
  260.     ],
  261.     [cf_cv_color_curses=yes],
  262.     [cf_cv_color_curses=no])
  263.     ])
  264. AC_MSG_RESULT($cf_cv_color_curses)
  265. if test $cf_cv_color_curses = yes ; then
  266.     AC_DEFINE(COLOR_CURSES)
  267.     test ".$cf_cv_ncurses_broken" != .yes && AC_DEFINE(HAVE_GETBKGD)
  268. fi
  269. ])
  270. dnl ---------------------------------------------------------------------------
  271. dnl Look for the curses libraries.  Older curses implementations may require
  272. dnl termcap/termlib to be linked as well.
  273. AC_DEFUN([CF_CURSES_LIBS],[
  274. AC_CHECK_FUNC(initscr,,[
  275. case $host_os in #(vi
  276. freebsd*) #(vi
  277.     AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
  278.     ;;
  279. hpux10.*)
  280.     AC_CHECK_LIB(cur_colr,initscr,[
  281.         LIBS="-lcur_colr $LIBS"
  282.         CFLAGS="-I/usr/include/curses_colr $CFLAGS"
  283.         ac_cv_func_initscr=yes
  284.         ],[
  285.     AC_CHECK_LIB(Hcurses,initscr,[
  286.         # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
  287.         LIBS="-lHcurses $LIBS"
  288.         CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS"
  289.         ac_cv_func_initscr=yes
  290.         ])])
  291.     ;;
  292. esac
  293.  
  294. if test ".$With5lib" != ".no" ; then
  295. if test -d /usr/5lib ; then
  296.     # SunOS 3.x or 4.x
  297.     CPPFLAGS="$CPPFLAGS -I/usr/5include"
  298.     LIBS="$LIBS -L/usr/5lib"
  299. fi
  300. fi
  301.  
  302. if test ".$ac_cv_func_initscr" != .yes ; then
  303.     cf_save_LIBS="$LIBS"
  304.     cf_term_lib=""
  305.     cf_curs_lib=""
  306.  
  307.     # Check for library containing tgoto.  Do this before curses library
  308.     # because it may be needed to link the test-case for initscr.
  309.     AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
  310.         for cf_term_lib in termcap termlib unknown
  311.         do
  312.             AC_CHECK_LIB($cf_term_lib,tgoto,[break])
  313.         done
  314.     ])
  315.  
  316.     # Check for library containing initscr
  317.     test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
  318.     for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown
  319.     do
  320.         AC_CHECK_LIB($cf_curs_lib,initscr,[break])
  321.     done
  322.     test $cf_curs_lib = unknown && AC_ERROR(no curses library found)
  323.  
  324.     LIBS="-l$cf_curs_lib $cf_save_LIBS"
  325.     if test "$cf_term_lib" = unknown ; then
  326.         AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
  327.         AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
  328.             [initscr()],
  329.             [cf_result=yes],
  330.             [cf_result=no])
  331.         AC_MSG_RESULT($cf_result)
  332.         test $cf_result = no && AC_ERROR(Cannot link curses library)
  333.     elif test "$cf_term_lib" != predefined ; then
  334.         AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
  335.         AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
  336.             [initscr(); tgoto((char *)0, 0, 0);],
  337.             [cf_result=no],
  338.             [
  339.             LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
  340.             AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
  341.                 [initscr()],
  342.                 [cf_result=yes],
  343.                 [cf_result=error])
  344.             ])
  345.         AC_MSG_RESULT($cf_result)
  346.     fi
  347. fi
  348.  
  349. ])])
  350. dnl ---------------------------------------------------------------------------
  351. dnl Solaris 2.x curses provides a "performance" tradeoff according to whether
  352. dnl CURS_PERFORMANCE is defined.  If defined, the implementation defines macros
  353. dnl that access the WINDOW structure.  Otherwise, function calls are used.
  354. AC_DEFUN([CF_CURS_PERFORMANCE],
  355. [
  356. AC_MSG_CHECKING([for curses performance tradeoff])
  357. AC_CACHE_VAL(cf_cv_curs_performance,[
  358.     cf_cv_curs_performance=no
  359.     AC_TRY_COMPILE([
  360. #include <${cf_cv_ncurses_header-curses.h}>],[
  361. #if defined(wbkgdset) && defined(clearok) && defined(getbkgd)
  362.     int x = ERR;
  363. #else
  364.     int x = ;    /* force an error */
  365. #endif
  366.     ],[
  367.     AC_TRY_COMPILE([
  368. #define CURS_PERFORMANCE
  369. #include <${cf_cv_ncurses_header-curses.h}>],[
  370. #if defined(wbkgdset) && defined(clearok) && defined(getbkgd)
  371.     int x = ;    /* force an error */
  372. #else
  373.     int x = ERR;
  374. #endif
  375.     ],[cf_cv_curs_performance=yes])])])
  376. AC_MSG_RESULT($cf_cv_curs_performance)
  377. test $cf_cv_curs_performance = yes && AC_DEFINE(CURS_PERFORMANCE)
  378. ])dnl
  379. dnl ---------------------------------------------------------------------------
  380. dnl Check for a program in the given list $3, defining the corresponding
  381. dnl program variable $2.
  382. dnl
  383. AC_DEFUN([CF_DEFINE_PROG],[
  384. AC_MSG_CHECKING(for $1)
  385. AC_CACHE_VAL(cf_cv_$2,[
  386.     cf_cv_$2=unknown
  387.     for cv_path in $3
  388.     do
  389.         if test -f $cv_path ; then
  390.             cf_cv_$2=$cv_path
  391.             break
  392.         fi
  393.     done
  394.     ])
  395. AC_MSG_RESULT($cf_cv_$2)
  396. AC_DEFINE_UNQUOTED($2,"$cf_cv_$2")
  397. ])
  398. dnl ---------------------------------------------------------------------------
  399. dnl You can always use "make -n" to see the actual options, but it's hard to
  400. dnl pick out/analyze warning messages when the compile-line is long.
  401. dnl
  402. dnl Sets:
  403. dnl    ECHO_LD - symbol to prefix "cc -o" lines
  404. dnl    RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
  405. dnl    SHOW_CC - symbol to put before explicit "cc -c" lines
  406. dnl    ECHO_CC - symbol to put before any "cc" line
  407. dnl
  408. AC_DEFUN([CF_DISABLE_ECHO],[
  409. AC_MSG_CHECKING(if you want to see long compiling messages)
  410. CF_ARG_DISABLE(echo,
  411.     [  --disable-echo          test: display "compiling" commands],
  412.     [
  413.     ECHO_LD='@echo linking [$]@;'
  414.     RULE_CC='    @echo compiling [$]<'
  415.     SHOW_CC='    @echo compiling [$]@'
  416.     ECHO_CC='@'
  417. ],[
  418.     ECHO_LD=''
  419.     RULE_CC='# compiling'
  420.     SHOW_CC='# compiling'
  421.     ECHO_CC=''
  422. ])
  423. AC_MSG_RESULT($enableval)
  424. AC_SUBST(ECHO_LD)
  425. AC_SUBST(RULE_CC)
  426. AC_SUBST(SHOW_CC)
  427. AC_SUBST(ECHO_CC)
  428. ])dnl
  429. dnl ---------------------------------------------------------------------------
  430. dnl Check if 'errno' is declared in <errno.h>
  431. AC_DEFUN([CF_ERRNO],
  432. [
  433. CF_CHECK_ERRNO(errno)
  434. ])dnl
  435. dnl ---------------------------------------------------------------------------
  436. AC_DEFUN([CF_FANCY_CURSES],
  437. [
  438. AC_MSG_CHECKING(if curses supports fancy attributes)
  439. AC_CACHE_VAL(cf_cv_fancy_curses,[
  440.     AC_TRY_LINK([
  441. #include <${cf_cv_ncurses_header-curses.h}>
  442. ],
  443.     [attrset(A_UNDERLINE|A_BOLD|A_REVERSE);
  444.      wattrset(stdscr, A_BLINK|A_DIM);
  445.      attroff(A_BOLD);
  446.      keypad(stdscr,TRUE);
  447.     ],
  448.     [cf_cv_fancy_curses=yes],
  449.     [cf_cv_fancy_curses=no])
  450.     ])
  451. AC_MSG_RESULT($cf_cv_fancy_curses)
  452. test $cf_cv_fancy_curses = yes && AC_DEFINE(FANCY_CURSES)
  453. ])
  454. dnl ---------------------------------------------------------------------------
  455. dnl Look for a non-standard library, given parameters for AC_TRY_LINK.  We
  456. dnl prefer a standard location, and use -L options only if we do not find the
  457. dnl library in the standard library location(s).
  458. dnl    $1 = library name
  459. dnl    $2 = includes
  460. dnl    $3 = code fragment to compile/link
  461. dnl    $4 = corresponding function-name
  462. dnl
  463. dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
  464. dnl to use a -L option.
  465. AC_DEFUN([CF_FIND_LIBRARY],
  466. [
  467.     cf_cv_have_lib_$1=no
  468.     cf_libdir=""
  469.     AC_CHECK_FUNC($4,cf_cv_have_lib_$1=yes,[
  470.         cf_save_LIBS="$LIBS"
  471.         AC_MSG_CHECKING(for $4 in -l$1)
  472.         LIBS="-l$1 $LIBS"
  473.         AC_TRY_LINK([$2],[$3],
  474.             [AC_MSG_RESULT(yes)
  475.              cf_cv_have_lib_$1=yes
  476.             ],
  477.             [AC_MSG_RESULT(no)
  478.             CF_LIBRARY_PATH(cf_search,$1)
  479.             for cf_libdir in $cf_search
  480.             do
  481.                 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
  482.                 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
  483.                 AC_TRY_LINK([$2],[$3],
  484.                     [AC_MSG_RESULT(yes)
  485.                       cf_cv_have_lib_$1=yes
  486.                      break],
  487.                     [AC_MSG_RESULT(no)
  488.                      LIBS="$cf_save_LIBS"])
  489.             done
  490.             ])
  491.         ])
  492. if test $cf_cv_have_lib_$1 = no ; then
  493.     AC_ERROR(Cannot link $1 library)
  494. fi
  495. case $host_os in #(vi
  496. linux*) # Suse Linux does not follow /usr/lib convention
  497.     $1="[$]$1 /lib"
  498.     ;;
  499. esac
  500. ])dnl
  501. dnl ---------------------------------------------------------------------------
  502. dnl Check for availability of fcntl versus ioctl(,FIONBIO,).  Lynx uses this
  503. dnl for Sequent (ptx), and it is needed for OS/2 EMX.
  504. AC_DEFUN([CF_FIONBIO],
  505. [
  506. AC_CACHE_CHECK(if we should use fcntl or ioctl,cf_cv_fionbio,[
  507. AC_TRY_LINK([
  508. #include <sys/types.h>
  509. #include <sys/ioctl.h>
  510. ],[
  511.         int ret = ioctl(0, FIONBIO, (char *)0);
  512.     ],[cf_cv_fionbio=ioctl],[
  513. AC_TRY_LINK([
  514. #include <sys/types.h>
  515. #if HAVE_FCNTL_H
  516. #include <fcntl.h>
  517. #else
  518. #if HAVE_SYS_FCNTL_H
  519. #include <sys/fcntl.h>
  520. #endif
  521. #endif],[
  522.         int ret = fcntl(0, F_SETFL, O_NONBLOCK);
  523.     ],
  524.     [cf_cv_fionbio=fcntl],
  525.     [cf_cv_fionbio=unknown])])
  526. ])
  527. test "$cf_cv_fionbio" = "fcntl" && AC_DEFINE(USE_FCNTL)
  528. ])dnl
  529. dnl ---------------------------------------------------------------------------
  530. dnl A conventional existence-check for 'lstat' won't work with the Linux
  531. dnl version of gcc 2.7.0, since the symbol is defined only within <sys/stat.h>
  532. dnl as an inline function.
  533. dnl
  534. dnl So much for portability.
  535. AC_DEFUN([CF_FUNC_LSTAT],
  536. [
  537. AC_MSG_CHECKING(for lstat)
  538. AC_CACHE_VAL(ac_cv_func_lstat,[
  539. AC_TRY_LINK([
  540. #include <sys/types.h>
  541. #include <sys/stat.h>],
  542.     [lstat(".", (struct stat *)0)],
  543.     [ac_cv_func_lstat=yes],
  544.     [ac_cv_func_lstat=no])
  545.     ])
  546. AC_MSG_RESULT($ac_cv_func_lstat )
  547. if test $ac_cv_func_lstat = yes; then
  548.     AC_DEFINE(HAVE_LSTAT)
  549. fi
  550. ])dnl
  551. dnl ---------------------------------------------------------------------------
  552. dnl Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()'
  553. dnl and/or 'waitpid()'.
  554. dnl
  555. dnl Note that we cannot simply grep for 'union wait' in the wait.h file,
  556. dnl because some Posix systems turn this on only when a BSD variable is
  557. dnl defined.
  558. dnl
  559. dnl I don't use AC_HEADER_SYS_WAIT, because it defines HAVE_SYS_WAIT_H, which
  560. dnl would conflict with an attempt to test that header directly.
  561. dnl
  562. AC_DEFUN([CF_FUNC_WAIT],
  563. [
  564. AC_REQUIRE([CF_UNION_WAIT])
  565. if test $cf_cv_type_unionwait = yes; then
  566.  
  567.     AC_MSG_CHECKING(if union wait can be used as wait-arg)
  568.     AC_CACHE_VAL(cf_cv_arg_union_wait,[
  569.         AC_TRY_COMPILE($cf_wait_headers,
  570.              [union wait x; wait(&x)],
  571.             [cf_cv_arg_union_wait=yes],
  572.             [cf_cv_arg_union_wait=no])
  573.         ])
  574.     AC_MSG_RESULT($cf_cv_arg_union_wait)
  575.     test $cf_cv_arg_union_wait = yes && AC_DEFINE(WAIT_USES_UNION)
  576.  
  577.     AC_MSG_CHECKING(if union wait can be used as waitpid-arg)
  578.     AC_CACHE_VAL(cf_cv_arg_union_waitpid,[
  579.         AC_TRY_COMPILE($cf_wait_headers,
  580.              [union wait x; waitpid(0, &x, 0)],
  581.             [cf_cv_arg_union_waitpid=yes],
  582.             [cf_cv_arg_union_waitpid=no])
  583.         ])
  584.     AC_MSG_RESULT($cf_cv_arg_union_waitpid)
  585.     test $cf_cv_arg_union_waitpid = yes && AC_DEFINE(WAITPID_USES_UNION)
  586.  
  587. fi
  588. ])dnl
  589. dnl ---------------------------------------------------------------------------
  590. dnl Test for availability of useful gcc __attribute__ directives to quiet
  591. dnl compiler warnings.  Though useful, not all are supported -- and contrary
  592. dnl to documentation, unrecognized directives cause older compilers to barf.
  593. AC_DEFUN([CF_GCC_ATTRIBUTES],
  594. [
  595. if test -n "$GCC"
  596. then
  597. cat > conftest.i <<EOF
  598. #ifndef GCC_PRINTF
  599. #define GCC_PRINTF 0
  600. #endif
  601. #ifndef GCC_SCANF
  602. #define GCC_SCANF 0
  603. #endif
  604. #ifndef GCC_NORETURN
  605. #define GCC_NORETURN /* nothing */
  606. #endif
  607. #ifndef GCC_UNUSED
  608. #define GCC_UNUSED /* nothing */
  609. #endif
  610. EOF
  611. if test -n "$GCC"
  612. then
  613.     AC_CHECKING([for gcc __attribute__ directives])
  614.     changequote(,)dnl
  615. cat > conftest.$ac_ext <<EOF
  616. #line __oline__ "configure"
  617. #include "confdefs.h"
  618. #include "conftest.h"
  619. #include "conftest.i"
  620. #if    GCC_PRINTF
  621. #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
  622. #else
  623. #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
  624. #endif
  625. #if    GCC_SCANF
  626. #define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
  627. #else
  628. #define GCC_SCANFLIKE(fmt,var)  /*nothing*/
  629. #endif
  630. extern void wow(char *,...) GCC_SCANFLIKE(1,2);
  631. extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
  632. extern void foo(void) GCC_NORETURN;
  633. int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; }
  634. EOF
  635.     changequote([,])dnl
  636.     for cf_attribute in scanf printf unused noreturn
  637.     do
  638.         CF_UPPER(CF_ATTRIBUTE,$cf_attribute)
  639.         cf_directive="__attribute__(($cf_attribute))"
  640.         echo "checking for gcc $cf_directive" 1>&AC_FD_CC
  641.         case $cf_attribute in
  642.         scanf|printf)
  643.         cat >conftest.h <<EOF
  644. #define GCC_$CF_ATTRIBUTE 1
  645. EOF
  646.             ;;
  647.         *)
  648.         cat >conftest.h <<EOF
  649. #define GCC_$CF_ATTRIBUTE $cf_directive
  650. EOF
  651.             ;;
  652.         esac
  653.         if AC_TRY_EVAL(ac_compile); then
  654.             test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
  655.             cat conftest.h >>confdefs.h
  656. #        else
  657. #            sed -e 's/__attr.*/\/*nothing*\//' conftest.h >>confdefs.h
  658.         fi
  659.     done
  660. else
  661.     fgrep define conftest.i >>confdefs.h
  662. fi
  663. rm -rf conftest*
  664. fi
  665. ])dnl
  666. dnl ---------------------------------------------------------------------------
  667. dnl Check if the compiler supports useful warning options.  There's a few that
  668. dnl we don't use, simply because they're too noisy:
  669. dnl
  670. dnl    -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
  671. dnl    -Wredundant-decls (system headers make this too noisy)
  672. dnl    -Wtraditional (combines too many unrelated messages, only a few useful)
  673. dnl    -Wwrite-strings (too noisy, but should review occasionally)
  674. dnl    -pedantic
  675. dnl
  676. AC_DEFUN([CF_GCC_WARNINGS],
  677. [
  678. if test -n "$GCC"
  679. then
  680.     changequote(,)dnl
  681.     cat > conftest.$ac_ext <<EOF
  682. #line __oline__ "configure"
  683. int main(int argc, char *argv[]) { return argv[argc-1] == 0; }
  684. EOF
  685.     changequote([,])dnl
  686.     AC_CHECKING([for gcc warning options])
  687.     cf_save_CFLAGS="$CFLAGS"
  688.     EXTRA_CFLAGS="-W -Wall"
  689.     cf_warn_CONST=""
  690.     test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
  691.     for cf_opt in \
  692.         Wbad-function-cast \
  693.         Wcast-align \
  694.         Wcast-qual \
  695.         Winline \
  696.         Wmissing-declarations \
  697.         Wmissing-prototypes \
  698.         Wnested-externs \
  699.         Wpointer-arith \
  700.         Wshadow \
  701.         Wstrict-prototypes $cf_warn_CONST
  702.     do
  703.         CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
  704.         if AC_TRY_EVAL(ac_compile); then
  705.             test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
  706.             EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
  707.             test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES"
  708.         fi
  709.     done
  710.     rm -f conftest*
  711.     CFLAGS="$cf_save_CFLAGS"
  712. fi
  713. AC_SUBST(EXTRA_CFLAGS)
  714. ])dnl
  715. dnl ---------------------------------------------------------------------------
  716. dnl Construct a search-list for a nonstandard header-file
  717. AC_DEFUN([CF_HEADER_PATH],
  718. [$1=""
  719. if test -d "$includedir"  ; then
  720. test "$includedir" != NONE       && $1="[$]$1 $includedir $includedir/$2"
  721. fi
  722. if test -d "$oldincludedir"  ; then
  723. test "$oldincludedir" != NONE    && $1="[$]$1 $oldincludedir $oldincludedir/$2"
  724. fi
  725. if test -d "$prefix"; then
  726. test "$prefix" != NONE           && $1="[$]$1 $prefix/include $prefix/include/$2"
  727. fi
  728. test "$prefix" != /usr/local     && $1="[$]$1 /usr/local/include /usr/local/include/$2"
  729. test "$prefix" != /usr           && $1="[$]$1 /usr/include /usr/include/$2"
  730. ])dnl
  731. dnl ---------------------------------------------------------------------------
  732. dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
  733. AC_DEFUN([CF_HELP_MESSAGE],
  734. [AC_DIVERT_HELP([$1])dnl
  735. ])dnl
  736. dnl ---------------------------------------------------------------------------
  737. dnl Construct a search-list for a nonstandard library-file
  738. AC_DEFUN([CF_LIBRARY_PATH],
  739. [$1=""
  740. if test -d "$libdir"  ; then
  741. test "$libdir" != NONE           && $1="[$]$1 $libdir $libdir/$2"
  742. fi
  743. if test -d "$exec_prefix"; then
  744. test "$exec_prefix" != NONE      && $1="[$]$1 $exec_prefix/lib $exec_prefix/lib/$2"
  745. fi
  746. if test -d "$prefix"; then
  747. test "$prefix" != NONE           && \
  748. test "$prefix" != "$exec_prefix" && $1="[$]$1 $prefix/lib $prefix/lib/$2"
  749. fi
  750. test "$prefix" != /usr/local     && $1="[$]$1 /usr/local/lib /usr/local/lib/$2"
  751. test "$prefix" != /usr           && $1="[$]$1 /usr/lib /usr/lib/$2"
  752. ])dnl
  753. dnl ---------------------------------------------------------------------------
  754. dnl Check if we've got setlocale() and its header, <locale.h>
  755. AC_DEFUN([CF_LOCALE],
  756. [
  757. AC_MSG_CHECKING(for setlocale())
  758. AC_CACHE_VAL(cf_cv_locale,[
  759. AC_TRY_LINK([#include <locale.h>],
  760.     [setlocale(LC_ALL, "")],
  761.     [cf_cv_locale=yes],
  762.     [cf_cv_locale=no])
  763.     ])
  764. AC_MSG_RESULT($cf_cv_locale)
  765. test $cf_cv_locale = yes && AC_DEFINE(LOCALE)
  766. ])
  767. dnl ---------------------------------------------------------------------------
  768. dnl Check for the use of 'include' in 'make' (BSDI is a special case)
  769. dnl The symbol $ac_make is set in AC_MAKE_SET, as a side-effect.
  770. AC_DEFUN([CF_MAKE_INCLUDE],
  771. [
  772. AC_MSG_CHECKING(for style of include in makefiles)
  773.  
  774. make_include_left=""
  775. make_include_right=""
  776. make_include_quote="unknown"
  777.  
  778. cf_inc=head$$
  779. cf_dir=subd$$
  780. echo 'RESULT=OK' >$cf_inc
  781. mkdir $cf_dir
  782.  
  783. for cf_include in "include" ".include" "!include"
  784. do
  785.     for cf_quote in '' '"'
  786.     do
  787.         cat >$cf_dir/makefile <<CF_EOF
  788. SHELL=/bin/sh
  789. ${cf_include} ${cf_quote}../$cf_inc${cf_quote}
  790. all :
  791.     @echo 'cf_make_include=\$(RESULT)'
  792. CF_EOF
  793.     cf_make_include=""
  794.     eval `cd $cf_dir && ${MAKE-make} 2>&AC_FD_CC | grep cf_make_include=OK`
  795.     if test -n "$cf_make_include"; then
  796.         make_include_left="$cf_include"
  797.         make_include_quote="$cf_quote"
  798.         break
  799.     else
  800.         echo Tried 1>&AC_FD_CC
  801.         cat $cf_dir/makefile 1>&AC_FD_CC
  802.     fi
  803.     done
  804.     test -n "$cf_make_include" && break
  805. done
  806.  
  807. rm -rf $cf_inc $cf_dir
  808.  
  809. if test -z "$make_include_left" ; then
  810.     AC_ERROR(Your $ac_make program does not support includes)
  811. fi
  812. if test ".$make_include_quote" != .unknown ; then
  813.     make_include_left="$make_include_left $make_include_quote"
  814.     make_include_right="$make_include_quote"
  815. fi
  816.  
  817. AC_MSG_RESULT(${make_include_left}file${make_include_right})
  818.  
  819. AC_SUBST(make_include_left)
  820. AC_SUBST(make_include_right)
  821. ])dnl
  822. dnl ---------------------------------------------------------------------------
  823. dnl Check for pre-1.9.9g ncurses (among other problems, the most obvious is
  824. dnl that color combinations don't work).
  825. AC_DEFUN([CF_NCURSES_BROKEN],
  826. [
  827. AC_REQUIRE([CF_NCURSES_VERSION])
  828. if test "$cf_cv_ncurses_version" != no ; then
  829. AC_MSG_CHECKING(for obsolete/broken version of ncurses)
  830. AC_CACHE_VAL(cf_cv_ncurses_broken,[
  831. AC_TRY_COMPILE([
  832. #include <${cf_cv_ncurses_header-curses.h}>],[
  833. #if defined(NCURSES_VERSION) && defined(wgetbkgd)
  834.     make an error
  835. #else
  836.     int x = 1
  837. #endif
  838. ],
  839.     [cf_cv_ncurses_broken=no],
  840.     [cf_cv_ncurses_broken=yes])
  841. ])
  842. AC_MSG_RESULT($cf_cv_ncurses_broken)
  843. if test "$cf_cv_ncurses_broken" = yes ; then
  844.     AC_MSG_WARN(hmm... you should get an up-to-date version of ncurses)
  845.     AC_DEFINE(NCURSES_BROKEN)
  846. fi
  847. fi
  848. ])dnl
  849. dnl ---------------------------------------------------------------------------
  850. dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
  851. dnl the CPPFLAGS variable.
  852. dnl
  853. dnl The header files may be installed as either curses.h, or ncurses.h
  854. dnl (obsolete).  If not installed for overwrite, the curses.h file would be
  855. dnl in an ncurses subdirectory (e.g., /usr/include/ncurses), but someone may
  856. dnl have installed overwriting the vendor's curses.  Only very old versions
  857. dnl (pre-1.9.2d, the first autoconf'd version) of ncurses don't define
  858. dnl either __NCURSES_H or NCURSES_VERSION in the header.
  859. dnl
  860. dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
  861. dnl is already in the include-path, don't even bother with this, since we cannot
  862. dnl easily determine which file it is.  In this case, it has to be <curses.h>.
  863. dnl
  864. AC_DEFUN([CF_NCURSES_CPPFLAGS],
  865. [
  866. AC_MSG_CHECKING(for ncurses header file)
  867. AC_CACHE_VAL(cf_cv_ncurses_header,[
  868.     AC_TRY_COMPILE([#include <curses.h>],[
  869. #ifdef NCURSES_VERSION
  870. printf("%s\n", NCURSES_VERSION);
  871. #else
  872. #ifdef __NCURSES_H
  873. printf("old\n");
  874. #else
  875. make an error
  876. #endif
  877. #endif
  878.     ],
  879.     [cf_cv_ncurses_header=predefined],[
  880.     CF_HEADER_PATH(cf_search,ncurses)
  881.     test -n "$verbose" && echo
  882.     for cf_incdir in $cf_search
  883.     do
  884.         for cf_header in \
  885.             curses.h \
  886.             ncurses.h
  887.         do
  888. changequote(,)dnl
  889.             if egrep "NCURSES_[VH]" $cf_incdir/$cf_header 1>&AC_FD_CC 2>&1; then
  890. changequote([,])dnl
  891.                 cf_cv_ncurses_header=$cf_incdir/$cf_header
  892.                 test -n "$verbose" && echo $ac_n "    ... found $ac_c" 1>&AC_FD_MSG
  893.                 break
  894.             fi
  895.             test -n "$verbose" && echo "    ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
  896.         done
  897.         test -n "$cf_cv_ncurses_header" && break
  898.     done
  899.     test -z "$cf_cv_ncurses_header" && AC_ERROR(not found)
  900.     ])])
  901. AC_MSG_RESULT($cf_cv_ncurses_header)
  902. AC_DEFINE(NCURSES)
  903.  
  904. changequote(,)dnl
  905. cf_incdir=`echo $cf_cv_ncurses_header | sed -e 's:/[^/]*$::'`
  906. changequote([,])dnl
  907.  
  908. case $cf_cv_ncurses_header in # (vi
  909. */ncurses.h)
  910.     AC_DEFINE(HAVE_NCURSES_H)
  911.     ;;
  912. esac
  913.  
  914. case $cf_cv_ncurses_header in # (vi
  915. predefined) # (vi
  916.     cf_cv_ncurses_header=curses.h
  917.     ;;
  918. *)
  919.     CF_ADD_INCDIR($cf_incdir)
  920.     ;;
  921. esac
  922. CF_NCURSES_VERSION
  923. ])dnl
  924. dnl ---------------------------------------------------------------------------
  925. dnl Look for the ncurses library.  This is a little complicated on Linux,
  926. dnl because it may be linked with the gpm (general purpose mouse) library.
  927. dnl Some distributions have gpm linked with (bsd) curses, which makes it
  928. dnl unusable with ncurses.  However, we don't want to link with gpm unless
  929. dnl ncurses has a dependency, since gpm is normally set up as a shared library,
  930. dnl and the linker will record a dependency.
  931. AC_DEFUN([CF_NCURSES_LIBS],
  932. [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
  933.  
  934.     # This works, except for the special case where we find gpm, but
  935.     # ncurses is in a nonstandard location via $LIBS, and we really want
  936.     # to link gpm.
  937. cf_ncurses_LIBS=""
  938. cf_ncurses_SAVE="$LIBS"
  939. AC_CHECK_LIB(gpm,Gpm_Open,
  940.     [AC_CHECK_LIB(gpm,initscr,
  941.         [LIBS="$cf_ncurses_SAVE"],
  942.         [cf_ncurses_LIBS="-lgpm"])])
  943.  
  944. case $host_os in #(vi
  945. freebsd*)
  946.     # This is only necessary if you are linking against an obsolete
  947.     # version of ncurses (but it should do no harm, since it's static).
  948.     AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
  949.     ;;
  950. esac
  951.  
  952. LIBS="$cf_ncurses_LIBS $LIBS"
  953. CF_FIND_LIBRARY(ncurses,
  954.     [#include <${cf_cv_ncurses_header-curses.h}>],
  955.     [initscr()],
  956.     initscr)
  957.  
  958. if test -n "$cf_ncurses_LIBS" ; then
  959.     AC_MSG_CHECKING(if we can link ncurses without $cf_ncurses_LIBS)
  960.     cf_ncurses_SAVE="$LIBS"
  961.     for p in $cf_ncurses_LIBS ; do
  962.         q=`echo $LIBS | sed -e 's/'$p' //' -e 's/'$p'$//'`
  963.         if test "$q" != "$LIBS" ; then
  964.             LIBS="$q"
  965.         fi
  966.     done
  967.     AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
  968.         [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
  969.         [AC_MSG_RESULT(yes)],
  970.         [AC_MSG_RESULT(no)
  971.          LIBS="$cf_ncurses_SAVE"])
  972. fi
  973. ])dnl
  974. dnl ---------------------------------------------------------------------------
  975. dnl Check for the version of ncurses, to aid in reporting bugs, etc.
  976. AC_DEFUN([CF_NCURSES_VERSION],
  977. [AC_MSG_CHECKING(for ncurses version)
  978. AC_CACHE_VAL(cf_cv_ncurses_version,[
  979.     cf_cv_ncurses_version=no
  980.     cf_tempfile=out$$
  981.     AC_TRY_RUN([
  982. #include <${cf_cv_ncurses_header-curses.h}>
  983. int main()
  984. {
  985.     FILE *fp = fopen("$cf_tempfile", "w");
  986. #ifdef NCURSES_VERSION
  987. # ifdef NCURSES_VERSION_PATCH
  988.     fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
  989. # else
  990.     fprintf(fp, "%s\n", NCURSES_VERSION);
  991. # endif
  992. #else
  993. # ifdef __NCURSES_H
  994.     fprintf(fp, "old\n");
  995. # else
  996.     make an error
  997. # endif
  998. #endif
  999.     exit(0);
  1000. }],[
  1001.     cf_cv_ncurses_version=`cat $cf_tempfile`
  1002.     rm -f $cf_tempfile],,[
  1003.  
  1004.     # This will not work if the preprocessor splits the line after the
  1005.     # Autoconf token.  The 'unproto' program does that.
  1006.     cat > conftest.$ac_ext <<EOF
  1007. #include <${cf_cv_ncurses_header-curses.h}>
  1008. #undef Autoconf
  1009. #ifdef NCURSES_VERSION
  1010. Autoconf NCURSES_VERSION
  1011. #else
  1012. #ifdef __NCURSES_H
  1013. Autoconf "old"
  1014. #endif
  1015. ;
  1016. #endif
  1017. EOF
  1018.     cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
  1019.     AC_TRY_EVAL(cf_try)
  1020.     if test -f conftest.out ; then
  1021. changequote(,)dnl
  1022.         cf_out=`cat conftest.out | sed -e 's@^Autoconf @@' -e 's@^[^"]*"@@' -e 's@".*@@'`
  1023. changequote([,])dnl
  1024.         test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
  1025.         rm -f conftest.out
  1026.     fi
  1027. ])])
  1028. AC_MSG_RESULT($cf_cv_ncurses_version)
  1029. ])
  1030. dnl ---------------------------------------------------------------------------
  1031. dnl After checking for functions in the default $LIBS, make a further check
  1032. dnl for the functions that are netlib-related (these aren't always in the
  1033. dnl libc, etc., and have to be handled specially because there are conflicting
  1034. dnl and broken implementations.
  1035. dnl Common library requirements (in order):
  1036. dnl    -lresolv -lsocket -lnsl
  1037. dnl    -lnsl -lsocket
  1038. dnl    -lsocket
  1039. dnl    -lbsd
  1040. AC_DEFUN([CF_NETLIBS],[
  1041. cf_test_netlibs=no
  1042. AC_MSG_CHECKING(for network libraries)
  1043. AC_CACHE_VAL(cf_cv_netlibs,[
  1044. AC_MSG_RESULT(working...)
  1045. cf_cv_netlibs=""
  1046. cf_test_netlibs=yes
  1047. AC_CHECK_FUNCS(gethostname,,[
  1048.     CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
  1049.         CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
  1050. #
  1051. # FIXME:  sequent needs this library (i.e., -lsocket -linet -lnsl), but
  1052. # I don't know the entrypoints - 97/7/22 TD
  1053. AC_HAVE_LIBRARY(inet,cf_cv_netlibs="-linet $cf_cv_netlibs")
  1054. #
  1055. if test "$ac_cv_func_lsocket" != no ; then
  1056. AC_CHECK_FUNCS(socket,,[
  1057.     CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
  1058.         CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
  1059. fi
  1060. #
  1061. AC_CHECK_FUNCS(gethostbyname,,[
  1062.     CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
  1063. #
  1064. AC_CHECK_FUNCS(strcasecmp,,[
  1065.     CF_RECHECK_FUNC(strcasecmp,resolv,cf_cv_netlibs)])
  1066. ])
  1067. LIBS="$LIBS $cf_cv_netlibs"
  1068. test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG
  1069. ])dnl
  1070. dnl ---------------------------------------------------------------------------
  1071. dnl Check for the symbol NGROUPS
  1072. AC_DEFUN([CF_NGROUPS],
  1073. [
  1074. AC_MSG_CHECKING(if NGROUPS is defined)
  1075. AC_CACHE_VAL(cf_cv_ngroups,[
  1076. AC_TRY_COMPILE([
  1077. #if HAVE_SYS_PARAM_H
  1078. #include <sys/param.h>
  1079. #endif
  1080. #if HAVE_LIMITS_H
  1081. #include <limits.h>
  1082. #endif
  1083. ],[int x = NGROUPS],
  1084.     [cf_cv_ngroups=yes],
  1085.     [AC_TRY_COMPILE([
  1086. #if HAVE_SYS_PARAM_H
  1087. #include <sys/param.h>
  1088. #endif
  1089. #if HAVE_LIMITS_H
  1090. #include <limits.h>
  1091. #endif
  1092. ],[int x = NGROUPS_MAX],
  1093.         [cf_cv_ngroups=NGROUPS_MAX],
  1094.         [cf_cv_ngroups=no])
  1095.     ])
  1096. AC_MSG_RESULT($cf_cv_ngroups)
  1097. if test "$cf_cv_ngroups" = no ; then
  1098.     AC_DEFINE(NGROUPS,16)
  1099. elif test "$cf_cv_ngroups" = NGROUPS_MAX ; then
  1100.     AC_DEFINE(NGROUPS,NGROUPS_MAX)
  1101. fi
  1102. ])
  1103. ])dnl
  1104. dnl ---------------------------------------------------------------------------
  1105. dnl Check for a given program, defining corresponding symbol.
  1106. dnl    $1 = environment variable, which is suffixed by "_PATH" in the #define.
  1107. dnl    $2 = program name to find.
  1108. dnl
  1109. dnl If there is more than one token in the result, #define the remaining tokens
  1110. dnl to $1_ARGS.  We need this for 'install' in particular.
  1111. dnl
  1112. dnl FIXME: we should allow this to be overridden by environment variables
  1113. dnl
  1114. AC_DEFUN([CF_PATH_PROG],[
  1115. test -z "[$]$1" && $1=$2
  1116. if test "$with_full_paths" = yes ; then
  1117.     AC_PATH_PROG($1,$2,[$]$1)
  1118. else
  1119.     AC_MSG_CHECKING(for $2)
  1120.     AC_MSG_RESULT([$]$1)
  1121. fi
  1122.  
  1123. cf_path_prog=""
  1124. cf_path_args=""
  1125. IFS="${IFS=     }"; cf_save_ifs="$IFS"; IFS="${IFS}:"
  1126. for cf_temp in $ac_cv_path_$1
  1127. do
  1128.     if test -z "$cf_path_prog" ; then
  1129.         cf_path_prog="$cf_temp"
  1130.     elif test -z "$cf_path_args" ; then
  1131.         cf_path_args="$cf_temp"
  1132.     else
  1133.         cf_path_args="$cf_path_args $cf_temp"
  1134.     fi
  1135. done
  1136. IFS="$cf_save_ifs"
  1137.  
  1138. AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog")
  1139. test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args")
  1140. ])dnl
  1141. dnl ---------------------------------------------------------------------------
  1142. dnl Re-check on a function to see if we can pick it up by adding a library.
  1143. dnl    $1 = function to check
  1144. dnl    $2 = library to check in
  1145. dnl    $3 = environment to update (e.g., $LIBS)
  1146. dnl    $4 = what to do if this fails
  1147. dnl
  1148. dnl This uses 'unset' if the shell happens to support it, but leaves the
  1149. dnl configuration variable set to 'unknown' if not.  This is a little better
  1150. dnl than the normal autoconf test, which gives misleading results if a test
  1151. dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is
  1152. dnl used (autoconf does not distinguish between a null token and one that is
  1153. dnl set to 'no').
  1154. AC_DEFUN([CF_RECHECK_FUNC],[
  1155. AC_CHECK_LIB($2,$1,[
  1156.     CF_UPPER(cf_tr_func,$1)
  1157.     AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func)
  1158.     ac_cv_func_$1=yes
  1159.     $3="-l$2 [$]$3"],[
  1160.     ac_cv_func_$1=unknown
  1161.     unset ac_cv_func_$1 2>/dev/null
  1162.     $4],
  1163.     [[$]$3])
  1164. ])dnl
  1165. dnl ---------------------------------------------------------------------------
  1166. dnl Check for broken definition of 'remove()'.  This is (in particular) broken
  1167. dnl on the older version of SCO (I'd cite version if I knew where to look) by
  1168. dnl having <stdio.h> #define remove to __unlink, which appears in no library.
  1169. dnl
  1170. dnl Fortuitously, we can combine this with a more general test: do we have
  1171. dnl 'unlink()' but no 'remove()'.  Note, however, that we cannot simply #define
  1172. dnl remove to unlink, but have to make a fallback function.
  1173. dnl
  1174. AC_DEFUN([CF_REMOVE_BROKEN],
  1175. [
  1176. AC_MSG_CHECKING(for broken/missing definition of remove)
  1177. AC_CACHE_VAL(cf_cv_baddef_remove,[
  1178. AC_TRY_LINK(
  1179.     [#include <stdio.h>],
  1180.     [remove("dummy")],
  1181.     [cf_cv_baddef_remove=no],
  1182.     [AC_TRY_LINK(
  1183.         [#include <stdio.h>
  1184.         int __unlink(name) { return unlink(name); } ],
  1185.         [remove("dummy")],
  1186.         [cf_cv_baddef_remove=yes],
  1187.         [cf_cv_baddef_remove=unknown])
  1188.     ])
  1189. ])
  1190. AC_MSG_RESULT($cf_cv_baddef_remove)
  1191. test "$cf_cv_baddef_remove" != no && AC_DEFINE(NEED_REMOVE)
  1192. ])dnl
  1193. dnl ---------------------------------------------------------------------------
  1194. dnl Check for definitions & structures needed for window size-changing
  1195. dnl FIXME: check that this works with "snake" (HP-UX 10.x)
  1196. AC_DEFUN([CF_SIZECHANGE],
  1197. [
  1198. AC_MSG_CHECKING([declaration of size-change])
  1199. AC_CACHE_VAL(cf_cv_sizechange,[
  1200.     cf_cv_sizechange=unknown
  1201.     cf_save_CFLAGS="$CFLAGS"
  1202.  
  1203. for cf_opts in "" "NEED_PTEM_H"
  1204. do
  1205.  
  1206.     CFLAGS="$cf_save_CFLAGS"
  1207.     test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts"
  1208.     AC_TRY_COMPILE([#include <sys/types.h>
  1209. #if HAVE_TERMIOS_H
  1210. #include <termios.h>
  1211. #else
  1212. #if HAVE_TERMIO_H
  1213. #include <termio.h>
  1214. #endif
  1215. #endif
  1216. #if NEED_PTEM_H
  1217. /* This is a workaround for SCO:  they neglected to define struct winsize in
  1218.  * termios.h -- it's only in termio.h and ptem.h
  1219.  */
  1220. #include        <sys/stream.h>
  1221. #include        <sys/ptem.h>
  1222. #endif
  1223. #if !defined(sun) || !defined(HAVE_TERMIOS_H)
  1224. #include <sys/ioctl.h>
  1225. #endif
  1226. ],[
  1227. #ifdef TIOCGSIZE
  1228.     struct ttysize win;    /* FIXME: what system is this? */
  1229.     int y = win.ts_lines;
  1230.     int x = win.ts_cols;
  1231. #else
  1232. #ifdef TIOCGWINSZ
  1233.     struct winsize win;
  1234.     int y = win.ws_row;
  1235.     int x = win.ws_col;
  1236. #else
  1237.     no TIOCGSIZE or TIOCGWINSZ
  1238. #endif /* TIOCGWINSZ */
  1239. #endif /* TIOCGSIZE */
  1240.     ],
  1241.     [cf_cv_sizechange=yes],
  1242.     [cf_cv_sizechange=no])
  1243.  
  1244.     CFLAGS="$cf_save_CFLAGS"
  1245.     if test "$cf_cv_sizechange" = yes ; then
  1246.         echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
  1247.         test -n "$cf_opts" && AC_DEFINE_UNQUOTED($cf_opts)
  1248.         break
  1249.     fi
  1250. done
  1251.     ])
  1252. AC_MSG_RESULT($cf_cv_sizechange)
  1253. test $cf_cv_sizechange != no && AC_DEFINE(HAVE_SIZECHANGE)
  1254. ])dnl
  1255. dnl ---------------------------------------------------------------------------
  1256. dnl Look for the slang header files in the standard places, adjusting the
  1257. dnl CPPFLAGS variable.
  1258. dnl
  1259. AC_DEFUN([CF_SLANG_CPPFLAGS],
  1260. [
  1261. AC_MSG_CHECKING(for slang header file)
  1262. AC_CACHE_VAL(cf_cv_slang_header,[
  1263.     AC_TRY_COMPILE([#include <slang.h>],
  1264.     [printf("%s\n", SLANG_VERSION)],
  1265.     [cf_cv_slang_header=predefined],[
  1266.     CF_HEADER_PATH(cf_search,slang)
  1267.     for cf_incdir in $cf_search
  1268.     do
  1269.         for cf_header in \
  1270.             slang.h
  1271.         do
  1272.             echo trying $cf_incdir/$cf_header 1>&AC_FD_CC
  1273.             if egrep "SLANG_VERSION" $cf_incdir/$cf_header 1>&AC_FD_CC 2>&1; then
  1274.                 cf_cv_slang_header=$cf_incdir/$cf_header 
  1275.                 break
  1276.             fi
  1277.         done
  1278.         test -n "$cf_cv_slang_header" && break
  1279.     done
  1280.     test -z "$cf_cv_slang_header" && AC_ERROR(not found)
  1281.     ])])
  1282. AC_MSG_RESULT($cf_cv_slang_header)
  1283. AC_DEFINE(USE_SLANG)
  1284.  
  1285. changequote(,)dnl
  1286. cf_incdir=`echo $cf_cv_slang_header | sed -e 's:/[^/]*$::'`
  1287. changequote([,])dnl
  1288.  
  1289. case $cf_cv_slang_header in # (vi
  1290. predefined) # (vi
  1291.     ;;
  1292. *)
  1293.     CF_ADD_INCDIR($cf_incdir)
  1294.     ;;
  1295. esac
  1296. ])dnl
  1297. dnl ---------------------------------------------------------------------------
  1298. dnl Look for the slang library.
  1299. AC_DEFUN([CF_SLANG_LIBS],
  1300. [
  1301. cf_slang_LIBS1="$LIBS"
  1302. CF_TERMCAP_LIBS
  1303. cf_slang_LIBS2="$LIBS"
  1304. AC_CHECK_FUNC(acos,,[CF_RECHECK_FUNC(acos,m,LIBS)])
  1305. CF_FIND_LIBRARY(slang,
  1306.     [#include <slang.h>],
  1307.     [SLtt_get_screen_size()],
  1308.     SLtt_get_screen_size)
  1309. cf_slang_LIBS3="$LIBS"
  1310. AC_MSG_CHECKING(if we can link slang without termcap)
  1311. if test -n "`echo $cf_slang_LIBS1 | sed -e 's/ //g'`" ; then
  1312.     cf_exclude=`echo ".$cf_slang_LIBS2" | sed -e "s@$cf_slang_LIBS1@@" -e 's@^.@@'`
  1313. else
  1314.     cf_exclude="$cf_slang_LIBS2"
  1315. fi
  1316. LIBS=`echo ".$cf_slang_LIBS3" | sed -e "s@$cf_exclude@@" -e 's@^.@@'`
  1317. AC_TRY_LINK([#include <slang.h>],
  1318.     [SLtt_get_screen_size()],
  1319.     [cf_result=yes],
  1320.     [cf_result=no])
  1321. AC_MSG_RESULT($cf_result)
  1322. test $cf_result = no && LIBS="$cf_slang_LIBS3"
  1323. ])dnl
  1324. dnl ---------------------------------------------------------------------------
  1325. dnl    Remove "-g" option from the compiler options
  1326. AC_DEFUN([CF_STRIP_G_OPT],
  1327. [$1=`echo ${$1} | sed -e 's/-g //' -e 's/-g$//'`])dnl
  1328. dnl ---------------------------------------------------------------------------
  1329. dnl    Remove "-O" option from the compiler options
  1330. AC_DEFUN([CF_STRIP_O_OPT],[
  1331. changequote(,)dnl
  1332. $1=`echo ${$1} | sed -e 's/-O[1-9]\? //' -e 's/-O[1-9]\?$//'`
  1333. changequote([,])dnl
  1334. ])dnl
  1335. dnl ---------------------------------------------------------------------------
  1336. AC_DEFUN([CF_SYSTEM_MAIL_FLAGS], 
  1337. [
  1338. AC_MSG_CHECKING([system mail flags])
  1339. AC_CACHE_VAL(cf_cv_system_mail_flags,[
  1340.     case $cf_cv_SYSTEM_MAIL in
  1341.     */mmdf/*)
  1342.         [cf_cv_system_mail_flags="-mlruxto,cc\\\\*"]
  1343.             ;; 
  1344.     *)
  1345.             [cf_cv_system_mail_flags="-t -oi"]
  1346.     esac
  1347.     ])
  1348. AC_MSG_RESULT($cf_cv_system_mail_flags)
  1349. AC_DEFINE_UNQUOTED(SYSTEM_MAIL_FLAGS, "$cf_cv_system_mail_flags")
  1350. ])dnl
  1351. dnl ---------------------------------------------------------------------------
  1352. dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and
  1353. dnl errno.h.  Declaration of sys_errlist on BSD4.4 interferes with our
  1354. dnl declaration.  Reported by Keith Bostic.
  1355. AC_DEFUN([CF_SYS_ERRLIST],
  1356. [
  1357. for cf_name in sys_nerr sys_errlist
  1358. do
  1359.     CF_CHECK_ERRNO($cf_name)
  1360. done
  1361. ])dnl
  1362. dnl ---------------------------------------------------------------------------
  1363. dnl Look for termcap libraries, needed by some versions of slang.
  1364. AC_DEFUN([CF_TERMCAP_LIBS],
  1365. [
  1366. AC_CACHE_VAL(cf_cv_lib_termcap,[
  1367. cf_cv_lib_termcap=none
  1368. # HP-UX 9.x terminfo has setupterm, but no tigetstr.
  1369. if test "$termlib" = none; then
  1370.     AC_CHECK_LIB(termlib, tigetstr, [LIBS="$LIBS -ltermlib" cf_cv_lib_termcap=terminfo])
  1371. fi
  1372. if test "$cf_cv_lib_termcap" = none; then
  1373.     AC_CHECK_LIB(termlib, tgoto, [LIBS="$LIBS -ltermlib" cf_cv_lib_termcap=termcap])
  1374. fi
  1375. if test "$cf_cv_lib_termcap" = none; then
  1376.     # allow curses library for broken AIX system.
  1377.     AC_CHECK_LIB(curses, initscr, [LIBS="$LIBS -lcurses" cf_cv_lib_termcap=termcap])
  1378.     AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap" cf_cv_lib_termcap=termcap])
  1379. fi
  1380. if test "$cf_cv_lib_termcap" = none; then
  1381.     AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap" cf_cv_lib_termcap=termcap])
  1382. fi
  1383. if test "$cf_cv_lib_termcap" = none; then
  1384.     AC_CHECK_LIB(ncurses, tgoto, [LIBS="$LIBS -lncurses" cf_cv_lib_termcap=ncurses])
  1385. fi
  1386. ])
  1387. if test "$cf_cv_lib_termcap" = none; then
  1388.     AC_ERROR([Can't find -ltermlib, -lcurses, or -ltermcap])
  1389. fi
  1390. ])dnl
  1391. dnl ---------------------------------------------------------------------------
  1392. dnl Check if including both termio.h and termios.h die like on DG.UX
  1393. AC_DEFUN([CF_TERMIO_AND_TERMIOS],
  1394. [
  1395. AC_MSG_CHECKING([termio.h and termios.h])
  1396. AC_CACHE_VAL(cf_cv_termio_and_termios,[
  1397.     AC_TRY_COMPILE([
  1398. #if HAVE_TERMIO_H
  1399. #include <termio.h>
  1400. #endif
  1401. #if HAVE_TERMIOS_H
  1402. #include <termios.h>
  1403. #endif ],
  1404.     [putchar (0x0a)],
  1405.     [cf_cv_termio_and_termios=yes],
  1406.     [cf_cv_termio_and_termios=no])])
  1407. AC_MSG_RESULT($cf_cv_termio_and_termios)
  1408. test $cf_cv_termio_and_termios = no && AC_DEFINE(TERMIO_AND_TERMIOS)
  1409. ])dnl
  1410. dnl ---------------------------------------------------------------------------
  1411. AC_DEFUN([CF_TTYTYPE],
  1412. [
  1413. AC_MSG_CHECKING(if ttytype is declared in curses library)
  1414. AC_CACHE_VAL(cf_cv_have_ttytype,[
  1415.     AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
  1416.     [char *x = &ttytype[1]; *x = 1],
  1417.     [cf_cv_have_ttytype=yes],
  1418.     [cf_cv_have_ttytype=no])
  1419.     ])
  1420. AC_MSG_RESULT($cf_cv_have_ttytype)
  1421. test $cf_cv_have_ttytype = yes && AC_DEFINE(HAVE_TTYTYPE)
  1422. ])
  1423. dnl ---------------------------------------------------------------------------
  1424. dnl Check to see if the BSD-style union wait is declared.  Some platforms may
  1425. dnl use this, though it is deprecated in favor of the 'int' type in Posix.
  1426. dnl Some vendors provide a bogus implementation that declares union wait, but
  1427. dnl uses the 'int' type instead; we try to spot these by checking for the
  1428. dnl associated macros.
  1429. dnl
  1430. dnl Ahem.  Some implementers cast the status value to an int*, as an attempt to
  1431. dnl use the macros for either union wait or int.  So we do a check compile to
  1432. dnl see if the macros are defined and apply to an int.
  1433. dnl
  1434. dnl Sets: $cf_cv_type_unionwait
  1435. dnl Defines: HAVE_TYPE_UNIONWAIT
  1436. AC_DEFUN([CF_UNION_WAIT],
  1437. [
  1438. AC_REQUIRE([CF_WAIT_HEADERS])
  1439. AC_MSG_CHECKING([for union wait])
  1440. AC_CACHE_VAL(cf_cv_type_unionwait,[
  1441.     AC_TRY_LINK($cf_wait_headers,
  1442.     [int x;
  1443.      int y = WEXITSTATUS(x);
  1444.      int z = WTERMSIG(x);
  1445.      wait(&x);
  1446.     ],
  1447.     [cf_cv_type_unionwait=no
  1448.      echo compiles ok w/o union wait 1>&AC_FD_CC
  1449.     ],[
  1450.     AC_TRY_LINK($cf_wait_headers,
  1451.     [union wait x;
  1452. #ifdef WEXITSTATUS
  1453.      int y = WEXITSTATUS(x);
  1454. #endif
  1455. #ifdef WTERMSIG
  1456.      int z = WTERMSIG(x);
  1457. #endif
  1458.      wait(&x);
  1459.     ],
  1460.     [cf_cv_type_unionwait=yes
  1461.      echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC
  1462.     ],
  1463.     [cf_cv_type_unionwait=no])])])
  1464. AC_MSG_RESULT($cf_cv_type_unionwait)
  1465. test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT)
  1466. ])dnl
  1467. dnl ---------------------------------------------------------------------------
  1468. dnl Make an uppercase version of a variable
  1469. dnl $1=uppercase($2)
  1470. AC_DEFUN([CF_UPPER],
  1471. [
  1472. changequote(,)dnl
  1473. $1=`echo $2 | tr '[a-z]' '[A-Z]'`
  1474. changequote([,])dnl
  1475. ])dnl
  1476. dnl ---------------------------------------------------------------------------
  1477. AC_DEFUN([CF_UTMP],
  1478. [
  1479. AC_MSG_CHECKING(if struct utmp is declared)
  1480. AC_CACHE_VAL(cf_cv_have_utmp,[
  1481.     AC_TRY_COMPILE([
  1482. #include <sys/types.h>
  1483. #include <utmp.h>],
  1484.     [struct utmp x; char *y = &x.ut_host[0]],
  1485.     [cf_cv_have_utmp=yes],
  1486.     [AC_TRY_COMPILE([#include <utmpx.h>],
  1487.         [struct utmpx x; char *y = &x.ut_host[0]],
  1488.         [cf_cv_have_utmp=utmpx],
  1489.         [cf_cv_have_utmp=no])
  1490.         ])
  1491.     ])
  1492. AC_MSG_RESULT($cf_cv_have_utmp)
  1493. test $cf_cv_have_utmp != no && AC_DEFINE(HAVE_UTMP)
  1494. test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP)
  1495. ])
  1496. dnl ---------------------------------------------------------------------------
  1497. dnl Build up an expression $cf_wait_headers with the header files needed to
  1498. dnl compile against the prototypes for 'wait()', 'waitpid()', etc.  Assume it's
  1499. dnl Posix, which uses <sys/types.h> and <sys/wait.h>, but allow SVr4 variation
  1500. dnl with <wait.h>.
  1501. AC_DEFUN([CF_WAIT_HEADERS],
  1502. [
  1503. AC_HAVE_HEADERS(sys/wait.h)
  1504. cf_wait_headers="#include <sys/types.h>
  1505. "
  1506. if test $ac_cv_header_sys_wait_h = yes; then
  1507. cf_wait_headers="$cf_wait_headers
  1508. #include <sys/wait.h>
  1509. "
  1510. else
  1511. AC_HAVE_HEADERS(wait.h)
  1512. AC_HAVE_HEADERS(waitstatus.h)
  1513. if test $ac_cv_header_wait_h = yes; then
  1514. cf_wait_headers="$cf_wait_headers
  1515. #include <wait.h>
  1516. "
  1517. fi
  1518. if test $ac_cv_header_waitstatus_h = yes; then
  1519. cf_wait_headers="$cf_wait_headers
  1520. #include <waitstatus.h>
  1521. "
  1522. fi
  1523. fi
  1524. ])dnl
  1525.