"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.3/aclocal.m4" (4 Dec 2018, 194403 Bytes) of package /linux/misc/tin-2.4.3.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "aclocal.m4": 2.4.2_vs_2.4.3.

    1 dnl Project   : tin - a Usenet reader
    2 dnl Module    : aclocal.m4
    3 dnl Author    : Thomas E. Dickey <dickey@invisible-island.net>
    4 dnl Created   : 1995-08-24
    5 dnl Updated   : 2018-12-03
    6 dnl Notes     :
    7 dnl
    8 dnl Copyright (c) 1995-2019 Thomas E. Dickey <dickey@invisible-island.net>
    9 dnl All rights reserved.
   10 dnl
   11 dnl Redistribution and use in source and binary forms, with or without
   12 dnl modification, are permitted provided that the following conditions
   13 dnl are met:
   14 dnl 1. Redistributions of source code must retain the above copyright
   15 dnl    notice, this list of conditions and the following disclaimer.
   16 dnl 2. Redistributions in binary form must reproduce the above copyright
   17 dnl    notice, this list of conditions and the following disclaimer in the
   18 dnl    documentation and/or other materials provided with the distribution.
   19 dnl 3. The name of the author may not be used to endorse or promote
   20 dnl    products derived from this software without specific prior written
   21 dnl    permission.
   22 dnl
   23 dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
   24 dnl OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   25 dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   26 dnl ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
   27 dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   28 dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
   29 dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   30 dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   31 dnl WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   32 dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   33 dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   34 dnl
   35 dnl
   36 dnl Macros used in TIN auto-configuration script.
   37 dnl
   38 dnl ---------------------------------------------------------------------------
   39 dnl ---------------------------------------------------------------------------
   40 dnl AC_ISC_POSIX version: 2 updated: 2002/04/17 21:09:56
   41 dnl ------------
   42 dnl Inserted as requested by gettext 0.10.40
   43 dnl File from /usr/share/aclocal
   44 dnl isc-posix.m4
   45 dnl ====================
   46 #serial 1
   47 # This test replaces the one in autoconf.
   48 # Currently this macro should have the same name as the autoconf macro
   49 # because gettext's gettext.m4 (distributed in the automake package)
   50 # still uses it.  Otherwise, the use in gettext.m4 makes autoheader
   51 # give these diagnostics:
   52 #   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
   53 #   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
   54 
   55 undefine([AC_ISC_POSIX])
   56 
   57 AC_DEFUN([AC_ISC_POSIX],
   58   [
   59     dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
   60     AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
   61   ]
   62 )
   63 dnl ---------------------------------------------------------------------------
   64 dnl AM_GNU_GETTEXT version: 14 updated: 2015/04/15 19:08:48
   65 dnl --------------
   66 dnl Usage: Just like AM_WITH_NLS, which see.
   67 AC_DEFUN([AM_GNU_GETTEXT],
   68   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
   69    AC_REQUIRE([AC_CANONICAL_HOST])dnl
   70    AC_REQUIRE([AC_PROG_RANLIB])dnl
   71    AC_REQUIRE([AC_HEADER_STDC])dnl
   72    AC_REQUIRE([AC_C_INLINE])dnl
   73    AC_REQUIRE([AC_TYPE_OFF_T])dnl
   74    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
   75    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
   76    AC_REQUIRE([AC_FUNC_MMAP])dnl
   77    AC_REQUIRE([jm_GLIBC21])dnl
   78    AC_REQUIRE([CF_PROG_CC])dnl
   79 
   80    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
   81 stdlib.h string.h unistd.h sys/param.h])
   82    AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
   83 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
   84 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
   85 
   86    AM_ICONV
   87    AM_LANGINFO_CODESET
   88    AM_LC_MESSAGES
   89    AM_WITH_NLS([$1],[$2],[$3],[$4])
   90 
   91    if test "x$CATOBJEXT" != "x"; then
   92      if test "x$ALL_LINGUAS" = "x"; then
   93        LINGUAS=
   94      else
   95        AC_MSG_CHECKING(for catalogs to be installed)
   96        NEW_LINGUAS=
   97        for presentlang in $ALL_LINGUAS; do
   98          useit=no
   99          for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
  100            # Use the presentlang catalog if desiredlang is
  101            #   a. equal to presentlang, or
  102            #   b. a variant of presentlang (because in this case,
  103            #      presentlang can be used as a fallback for messages
  104            #      which are not translated in the desiredlang catalog).
  105            case "$desiredlang" in
  106              ("$presentlang"*) useit=yes;;
  107            esac
  108          done
  109          if test $useit = yes; then
  110            NEW_LINGUAS="$NEW_LINGUAS $presentlang"
  111          fi
  112        done
  113        LINGUAS=$NEW_LINGUAS
  114        AC_MSG_RESULT($LINGUAS)
  115      fi
  116 
  117      dnl Construct list of names of catalog files to be constructed.
  118      if test -n "$LINGUAS"; then
  119        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  120      fi
  121    fi
  122 
  123    dnl Enable libtool support if the surrounding package wishes it.
  124    INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
  125    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
  126 ])dnl
  127 dnl ---------------------------------------------------------------------------
  128 dnl AM_ICONV version: 12 updated: 2007/07/30 19:12:03
  129 dnl --------
  130 dnl Inserted as requested by gettext 0.10.40
  131 dnl File from /usr/share/aclocal
  132 dnl iconv.m4
  133 dnl ====================
  134 dnl serial AM2
  135 dnl
  136 dnl From Bruno Haible.
  137 dnl
  138 dnl ====================
  139 dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the
  140 dnl range of locations searched.  Retain the same cache-variable naming to
  141 dnl allow reuse with the other gettext macros -Thomas E Dickey
  142 AC_DEFUN([AM_ICONV],
  143 [
  144   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
  145   dnl those with the standalone portable GNU libiconv installed).
  146 
  147   AC_ARG_WITH([libiconv-prefix],
  148 [  --with-libiconv-prefix=DIR
  149                           search for libiconv in DIR/include and DIR/lib], [
  150     CF_ADD_OPTIONAL_PATH($withval, libiconv)
  151    ])
  152 
  153   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
  154     CF_FIND_LINKAGE(CF__ICONV_HEAD,
  155       CF__ICONV_BODY,
  156       iconv,
  157       am_cv_func_iconv=yes,
  158       am_cv_func_iconv=["no, consider installing GNU libiconv"])])
  159 
  160   if test "$am_cv_func_iconv" = yes; then
  161     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
  162 
  163     AC_CACHE_CHECK([if the declaration of iconv() needs const.],
  164 		   am_cv_proto_iconv_const,[
  165       AC_TRY_COMPILE(CF__ICONV_HEAD [
  166 extern
  167 #ifdef __cplusplus
  168 "C"
  169 #endif
  170 #if defined(__STDC__) || defined(__cplusplus)
  171 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
  172 #else
  173 size_t iconv();
  174 #endif
  175 ],[], am_cv_proto_iconv_const=no,
  176       am_cv_proto_iconv_const=yes)])
  177 
  178     if test "$am_cv_proto_iconv_const" = yes ; then
  179       am_cv_proto_iconv_arg1="const"
  180     else
  181       am_cv_proto_iconv_arg1=""
  182     fi
  183 
  184     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
  185       [Define as const if the declaration of iconv() needs const.])
  186   fi
  187 
  188   LIBICONV=
  189   if test "$cf_cv_find_linkage_iconv" = yes; then
  190     CF_ADD_INCDIR($cf_cv_header_path_iconv)
  191     if test -n "$cf_cv_library_file_iconv" ; then
  192       LIBICONV="-liconv"
  193       CF_ADD_LIBDIR($cf_cv_library_path_iconv)
  194     fi
  195   fi
  196 
  197   AC_SUBST(LIBICONV)
  198 ])dnl
  199 dnl ---------------------------------------------------------------------------
  200 dnl AM_LANGINFO_CODESET version: 4 updated: 2015/04/18 08:56:57
  201 dnl -------------------
  202 dnl Inserted as requested by gettext 0.10.40
  203 dnl File from /usr/share/aclocal
  204 dnl codeset.m4
  205 dnl ====================
  206 dnl serial AM1
  207 dnl
  208 dnl From Bruno Haible.
  209 AC_DEFUN([AM_LANGINFO_CODESET],
  210 [
  211 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
  212 	[AC_TRY_LINK([#include <langinfo.h>],
  213 	[char* cs = nl_langinfo(CODESET);],
  214 	am_cv_langinfo_codeset=yes,
  215 	am_cv_langinfo_codeset=no)
  216 	])
  217 	if test $am_cv_langinfo_codeset = yes; then
  218 		AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
  219 		[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
  220 	fi
  221 ])dnl
  222 dnl ---------------------------------------------------------------------------
  223 dnl AM_LC_MESSAGES version: 5 updated: 2015/05/10 19:52:14
  224 dnl --------------
  225 dnl Inserted as requested by gettext 0.10.40
  226 dnl File from /usr/share/aclocal
  227 dnl lcmessage.m4
  228 dnl ====================
  229 dnl Check whether LC_MESSAGES is available in <locale.h>.
  230 dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
  231 dnl
  232 dnl This file can be copied and used freely without restrictions.  It can
  233 dnl be used in projects which are not available under the GNU General Public
  234 dnl License or the GNU Library General Public License but which still want
  235 dnl to provide support for the GNU gettext functionality.
  236 dnl Please note that the actual code of the GNU gettext library is covered
  237 dnl by the GNU Library General Public License, and the rest of the GNU
  238 dnl gettext package package is covered by the GNU General Public License.
  239 dnl They are *not* in the public domain.
  240 dnl
  241 dnl serial 2
  242 dnl
  243 AC_DEFUN([AM_LC_MESSAGES],
  244 [if test $ac_cv_header_locale_h = yes; then
  245 	AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
  246 		[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  247 		am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
  248 	if test $am_cv_val_LC_MESSAGES = yes; then
  249 		AC_DEFINE(HAVE_LC_MESSAGES, 1,
  250 		[Define if your <locale.h> file defines LC_MESSAGES.])
  251 	fi
  252 fi])dnl
  253 dnl ---------------------------------------------------------------------------
  254 dnl AM_MULTIBYTE_ABLE version: 9 updated: 2013/12/06 19:12:41
  255 dnl -----------------
  256 dnl
  257 dnl check for required multibyte/widechar functions
  258 dnl Urs Janssen <urs@tin.org> 20021006
  259 dnl Usage: AM_MULTIBYTE_ABLE
  260 AC_DEFUN([AM_MULTIBYTE_ABLE],
  261 [
  262   AC_CACHE_CHECK([for wide char and multibyte support], am_cv_multibyte_able,
  263    [AC_TRY_LINK([#include <stdio.h>
  264 #ifdef HAVE_STDLIB_H
  265 #	include <stdlib.h>
  266 #endif /* HAVE_STDLIB_H */
  267 #ifdef HAVE_WCHAR_H
  268 #	include <wchar.h>
  269 #endif /* HAVE_WCHAR_H */
  270 #ifdef HAVE_WCTYPE_H
  271 #	include <wctype.h>
  272 #endif /* HAVE_WCTYPE_H */
  273 ],
  274      [const char icb[5] = {0xa4, 0xa4, 0xa4, 0xe5, 0x00};
  275       char ocb[5];
  276       wchar_t wcb[5];
  277       wchar_t wcb2[5];
  278       wchar_t format[3];
  279 
  280       putwc(0, 0);
  281       fputwc(0, 0);
  282       fwide(0, 0);
  283       mbtowc(wcb, icb, MB_CUR_MAX);
  284       mbstowcs(wcb, icb, 5);
  285       (void) iswalnum((wint_t) wcb[0]);
  286       (void) iswcntrl((wint_t) wcb[0]);
  287       (void) iswdigit((wint_t) wcb[0]);
  288       (void) iswgraph((wint_t) wcb[0]);
  289       (void) iswprint((wint_t) wcb[0]);
  290       (void) iswspace((wint_t) wcb[0]);
  291       (void) towupper((wint_t) wcb[0]);
  292       /* (void) iswupper((wint_t) wcb[0]); */
  293       /* (void) towlower((wint_t) wcb[0]); */
  294       /* (void) iswlower((wint_t) wcb[0]); */
  295       (void) iswalpha((wint_t) wcb[0]);
  296       /* (void) iswblank((wint_t) wcb[0]); */
  297       /* (void) iswpunct((wint_t) wcb[0]); */
  298       /* (void) iswxdigit((wint_t) wcb[0]); */
  299       /* (void) iswctype((wint_t) wcb[0], wctype("print")); */
  300       /* (void) towctranse((wint_t) wcb[0], wctrans("toupper")); */
  301       (void) wcslen(wcb);
  302       /* (void) wcsnlen(wcb, 4); */
  303       wcwidth((wint_t) wcb[0]);
  304       wcswidth(wcb, 5);
  305       wcstombs(ocb, wcb, 5);
  306       wctomb(ocb, wcb[0]);
  307       wcscat(wcb2, wcb);
  308       wcscpy(wcb2, wcb);
  309       mbstowcs(format, "%s", 2);
  310       swprintf(wcb, 5, format, "test");
  311       wcsncat(wcb2, wcb, 5);],
  312      am_cv_multibyte_able=yes,
  313      [cf_save_LIBS="$LIBS"
  314       LIBS="-lutf8 $LIBS"
  315       AC_TRY_LINK([#include <libutf8.h>],
  316        [const char icb[5] = {0xa4, 0xa4, 0xa4, 0xe5, 0x00};
  317         char ocb[5];
  318         wchar_t wcb[5];
  319         wchar_t wcb2[5];
  320         wchar_t format[3];
  321 
  322         putwc(0, 0);
  323         fputwc(0, 0);
  324         fwide(0, 0);
  325         mbtowc(wcb, icb, MB_CUR_MAX);
  326         mbstowcs(wcb, icb, 5);
  327         (void) iswalnum((wint_t) wcb[0]);
  328         (void) iswcntrl((wint_t) wcb[0]);
  329         (void) iswdigit((wint_t) wcb[0]);
  330         (void) iswgraph((wint_t) wcb[0]);
  331         (void) iswprint((wint_t) wcb[0]);
  332         (void) iswspace((wint_t) wcb[0]);
  333         (void) towupper((wint_t) wcb[0]);
  334         /* (void) iswupper((wint_t) wcb[0]); */
  335         /* (void) towlower((wint_t) wcb[0]); */
  336         /* (void) iswlower((wint_t) wcb[0]); */
  337         (void) iswalpha((wint_t) wcb[0]);
  338         /* (void) iswblank((wint_t) wcb[0]); */
  339         /* (void) iswpunct((wint_t) wcb[0]); */
  340         /* (void) iswxdigit((wint_t) wcb[0]); */
  341         /* (void) iswctype((wint_t) wcb[0], wctype("print")); */
  342         /* (void) towctranse((wint_t) wcb[0], wctrans("toupper")); */
  343         (void) wcslen(wcb);
  344         /* (void) wcsnlen(wcb, 4); */
  345         wcwidth((wint_t) wcb[0]);
  346         wcswidth(wcb, 5);
  347         wcstombs(ocb, wcb, 5);
  348         wctomb(ocb, wcb[0]);
  349         wcscat(wcb2, wcb);
  350         wcscpy(wcb2, wcb);
  351         mbstowcs(format, "%s", 2);
  352         swprintf(wcb, 5, format, "test");
  353         wcsncat(wcb2, wcb, 5);],
  354         [am_cv_multibyte_able=libutf8],
  355         [am_cv_multibyte_able=no])
  356       LIBS="$cf_save_LIBS"
  357    ])
  358   ])
  359   if test "$am_cv_multibyte_able" != no; then
  360     if test "$am_cv_multibyte_able" = libutf8; then
  361       AC_DEFINE(HAVE_LIBUTF8_H)
  362       LIBS="-lutf8 $LIBS"
  363     fi
  364     AC_DEFINE(MULTIBYTE_ABLE, 1,
  365       [Define if you have swprintf() and co.])
  366   fi
  367 ])
  368 dnl ---------------------------------------------------------------------------
  369 dnl AM_PATH_PROG_WITH_TEST version: 9 updated: 2015/04/15 19:08:48
  370 dnl ----------------------
  371 dnl Inserted as requested by gettext 0.10.40
  372 dnl File from /usr/share/aclocal
  373 dnl progtest.m4
  374 dnl ====================
  375 dnl Search path for a program which passes the given test.
  376 dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
  377 dnl
  378 dnl This file can be copied and used freely without restrictions.  It can
  379 dnl be used in projects which are not available under the GNU General Public
  380 dnl License or the GNU Library General Public License but which still want
  381 dnl to provide support for the GNU gettext functionality.
  382 dnl Please note that the actual code of the GNU gettext library is covered
  383 dnl by the GNU Library General Public License, and the rest of the GNU
  384 dnl gettext package package is covered by the GNU General Public License.
  385 dnl They are *not* in the public domain.
  386 dnl
  387 dnl serial 2
  388 dnl
  389 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
  390 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  391 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
  392 [# Extract the first word of "$2", so it can be a program name with args.
  393 AC_REQUIRE([CF_PATHSEP])
  394 set dummy $2; ac_word=[$]2
  395 AC_MSG_CHECKING([for $ac_word])
  396 AC_CACHE_VAL(ac_cv_path_$1,
  397 [case "[$]$1" in
  398   ([[\\/]*|?:[\\/]]*)
  399   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  400   ;;
  401   (*)
  402   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
  403   for ac_dir in ifelse([$5], , $PATH, [$5]); do
  404     test -z "$ac_dir" && ac_dir=.
  405     if test -f $ac_dir/$ac_word$ac_exeext; then
  406       if [$3]; then
  407 	ac_cv_path_$1="$ac_dir/$ac_word$ac_exeext"
  408 	break
  409       fi
  410     fi
  411   done
  412   IFS="$ac_save_ifs"
  413 dnl If no 4th arg is given, leave the cache variable unset,
  414 dnl so AC_PATH_PROGS will keep looking.
  415 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  416 ])dnl
  417   ;;
  418 esac])dnl
  419 $1="$ac_cv_path_$1"
  420 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
  421   AC_MSG_RESULT([$]$1)
  422 else
  423   AC_MSG_RESULT(no)
  424 fi
  425 AC_SUBST($1)dnl
  426 ])dnl
  427 dnl ---------------------------------------------------------------------------
  428 dnl AM_WITH_NLS version: 29 updated: 2018/02/21 21:26:03
  429 dnl -----------
  430 dnl Inserted as requested by gettext 0.10.40
  431 dnl File from /usr/share/aclocal
  432 dnl gettext.m4
  433 dnl ====================
  434 dnl Macro to add for using GNU gettext.
  435 dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
  436 dnl ====================
  437 dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the
  438 dnl range of locations searched.  Retain the same cache-variable naming to
  439 dnl allow reuse with the other gettext macros -Thomas E Dickey
  440 dnl ====================
  441 dnl
  442 dnl This file can be copied and used freely without restrictions.  It can
  443 dnl be used in projects which are not available under the GNU General Public
  444 dnl License or the GNU Library General Public License but which still want
  445 dnl to provide support for the GNU gettext functionality.
  446 dnl Please note that the actual code of the GNU gettext library is covered
  447 dnl by the GNU Library General Public License, and the rest of the GNU
  448 dnl gettext package package is covered by the GNU General Public License.
  449 dnl They are *not* in the public domain.
  450 dnl
  451 dnl serial 10
  452 dnl
  453 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR], [ENABLED]).
  454 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
  455 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
  456 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
  457 dnl    AM-DISABLE-SHARED). Otherwise, a static library
  458 dnl    $(top_builddir)/intl/libintl.a will be created.
  459 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
  460 dnl    implementations (in libc or libintl) without the ngettext() function
  461 dnl    will be ignored.
  462 dnl LIBDIR is used to find the intl libraries.  If empty,
  463 dnl    the value `$(top_builddir)/intl/' is used.
  464 dnl ENABLED is used to control the default for the related --enable-nls, since
  465 dnl    not all application developers want this feature by default, e.g., lynx.
  466 dnl
  467 dnl The result of the configuration is one of three cases:
  468 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
  469 dnl    and used.
  470 dnl    Catalog format: GNU --> install in $(datadir)
  471 dnl    Catalog extension: .mo after installation, .gmo in source tree
  472 dnl 2) GNU gettext has been found in the system's C library.
  473 dnl    Catalog format: GNU --> install in $(datadir)
  474 dnl    Catalog extension: .mo after installation, .gmo in source tree
  475 dnl 3) No internationalization, always use English msgid.
  476 dnl    Catalog format: none
  477 dnl    Catalog extension: none
  478 dnl The use of .gmo is historical (it was needed to avoid overwriting the
  479 dnl GNU format catalogs when building on a platform with an X/Open gettext),
  480 dnl but we keep it in order not to force irrelevant filename changes on the
  481 dnl maintainers.
  482 dnl
  483 AC_DEFUN([AM_WITH_NLS],
  484 [AC_MSG_CHECKING([whether NLS is requested])
  485   dnl Default is enabled NLS
  486   ifelse([$4],,[
  487   AC_ARG_ENABLE(nls,
  488     [  --disable-nls           do not use Native Language Support],
  489     USE_NLS=$enableval, USE_NLS=yes)],[
  490   AC_ARG_ENABLE(nls,
  491     [  --enable-nls            use Native Language Support],
  492     USE_NLS=$enableval, USE_NLS=no)])
  493   AC_MSG_RESULT($USE_NLS)
  494   AC_SUBST(USE_NLS)
  495 
  496   BUILD_INCLUDED_LIBINTL=no
  497   USE_INCLUDED_LIBINTL=no
  498   INTLLIBS=
  499 
  500   dnl If we use NLS figure out what method
  501   if test "$USE_NLS" = "yes"; then
  502     dnl We need to process the po/ directory.
  503     POSUB=po
  504     AC_DEFINE(ENABLE_NLS, 1,
  505       [Define to 1 if translation of program messages to the user's native language
  506  is requested.])
  507     AC_MSG_CHECKING([whether included gettext is requested])
  508     AC_ARG_WITH(included-gettext,
  509       [  --with-included-gettext use the GNU gettext library included here],
  510       nls_cv_force_use_gnu_gettext=$withval,
  511       nls_cv_force_use_gnu_gettext=no)
  512     AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
  513 
  514     nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
  515     if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
  516       dnl User does not insist on using GNU NLS library.  Figure out what
  517       dnl to use.  If GNU gettext is available we use this.  Else we may have
  518       dnl to fall back to GNU NLS library.
  519       CATOBJEXT=NONE
  520 
  521       dnl Save these (possibly-set) variables for reference.  If the user
  522       dnl overrode these to provide full pathnames, then warn if not actually
  523       dnl GNU gettext, but do not override their values.  Also, if they were
  524       dnl overridden, suppress the part of the library test which prevents it
  525       dnl from finding anything other than GNU gettext.  Doing this also
  526       dnl suppresses a bogus search for the intl library.
  527       cf_save_msgfmt_path="$MSGFMT"
  528       cf_save_xgettext_path="$XGETTEXT"
  529 
  530       dnl Search for GNU msgfmt in the PATH.
  531       AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  532           [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
  533       AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  534       AC_SUBST(MSGFMT)
  535 
  536       dnl Search for GNU xgettext in the PATH.
  537       AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  538           [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
  539 
  540       cf_save_OPTS_1="$CPPFLAGS"
  541       if test "x$cf_save_msgfmt_path" = "x$MSGFMT" && \
  542          test "x$cf_save_xgettext_path" = "x$XGETTEXT" ; then
  543           CF_ADD_CFLAGS(-DIGNORE_MSGFMT_HACK)
  544       fi
  545 
  546       cf_save_LIBS_1="$LIBS"
  547       CF_ADD_LIBS($LIBICONV)
  548 
  549       CF_FIND_LINKAGE(CF__INTL_HEAD,
  550         CF__INTL_BODY($2),
  551         intl,
  552         cf_cv_func_gettext=yes,
  553         cf_cv_func_gettext=no)
  554 
  555       AC_MSG_CHECKING([for libintl.h and gettext()])
  556       AC_MSG_RESULT($cf_cv_func_gettext)
  557 
  558       LIBS="$cf_save_LIBS_1"
  559       CPPFLAGS="$cf_save_OPTS_1"
  560 
  561       if test "$cf_cv_func_gettext" = yes ; then
  562         AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have libintl.h])
  563 
  564         dnl If an already present or preinstalled GNU gettext() is found,
  565         dnl use it.  But if this macro is used in GNU gettext, and GNU
  566         dnl gettext is already preinstalled in libintl, we update this
  567         dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
  568         if test "$PACKAGE" != gettext; then
  569           AC_DEFINE(HAVE_GETTEXT, 1,
  570               [Define if the GNU gettext() function is already present or preinstalled.])
  571 
  572           CF_ADD_INCDIR($cf_cv_header_path_intl)
  573 
  574           if test -n "$cf_cv_library_file_intl" ; then
  575             dnl If iconv() is in a separate libiconv library, then anyone
  576             dnl linking with libintl{.a,.so} also needs to link with
  577             dnl libiconv.
  578             INTLLIBS="$cf_cv_library_file_intl $LIBICONV"
  579             CF_ADD_LIBDIR($cf_cv_library_path_intl,INTLLIBS)
  580           fi
  581 
  582           gt_save_LIBS="$LIBS"
  583           LIBS="$LIBS $INTLLIBS"
  584           AC_CHECK_FUNCS(dcgettext)
  585           LIBS="$gt_save_LIBS"
  586 
  587           CATOBJEXT=.gmo
  588         fi
  589       elif test -z "$MSGFMT" || test -z "$XGETTEXT" ; then
  590         AC_MSG_WARN(disabling NLS feature)
  591         sed -e /ENABLE_NLS/d confdefs.h >confdefs.tmp
  592         mv confdefs.tmp confdefs.h
  593         ALL_LINGUAS=
  594         CATOBJEXT=.ignored
  595         MSGFMT=":"
  596         GMSGFMT=":"
  597         XGETTEXT=":"
  598         POSUB=
  599         BUILD_INCLUDED_LIBINTL=no
  600         USE_INCLUDED_LIBINTL=no
  601         USE_NLS=no
  602         nls_cv_use_gnu_gettext=no
  603       fi
  604 
  605       if test "$CATOBJEXT" = "NONE"; then
  606         dnl GNU gettext is not found in the C library.
  607         dnl Fall back on GNU gettext library.
  608         nls_cv_use_gnu_gettext=maybe
  609       fi
  610     fi
  611 
  612     if test "$nls_cv_use_gnu_gettext" != "no"; then
  613       CATOBJEXT=.gmo
  614       if test -f $srcdir/intl/libintl.h ; then
  615         dnl Mark actions used to generate GNU NLS library.
  616         INTLOBJS="\$(GETTOBJS)"
  617         BUILD_INCLUDED_LIBINTL=yes
  618         USE_INCLUDED_LIBINTL=yes
  619         INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
  620         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
  621       elif test "$nls_cv_use_gnu_gettext" = "yes"; then
  622         nls_cv_use_gnu_gettext=no
  623         AC_MSG_WARN(no NLS library is packaged with this application)
  624       fi
  625     fi
  626 
  627     dnl Test whether we really found GNU msgfmt.
  628     if test "$GMSGFMT" != ":"; then
  629       if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
  630         : ;
  631       else
  632         AC_MSG_WARN([found msgfmt program is not GNU msgfmt])
  633       fi
  634     fi
  635 
  636     dnl Test whether we really found GNU xgettext.
  637     if test "$XGETTEXT" != ":"; then
  638       if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
  639         : ;
  640       else
  641         AC_MSG_WARN([found xgettext program is not GNU xgettext])
  642       fi
  643     fi
  644   fi
  645 
  646   if test "$XGETTEXT" != ":"; then
  647     AC_OUTPUT_COMMANDS(
  648      [for ac_file in $CONFIG_FILES; do
  649 
  650         # Support "outfile[:infile[:infile...]]"
  651         case "$ac_file" in
  652           (*:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  653         esac
  654 
  655         # PO directories have a Makefile.in generated from Makefile.inn.
  656         case "$ac_file" in
  657         (*/[Mm]akefile.in)
  658           # Adjust a relative srcdir.
  659           ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
  660           ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
  661           ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
  662           ac_base=`basename $ac_file .in`
  663           # In autoconf-2.13 it is called $ac_given_srcdir.
  664           # In autoconf-2.50 it is called $srcdir.
  665           test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
  666 
  667           case "$ac_given_srcdir" in
  668             (.)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
  669             (/*) top_srcdir="$ac_given_srcdir" ;;
  670             (*)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
  671           esac
  672 
  673           if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
  674             rm -f "$ac_dir/POTFILES"
  675             test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
  676             sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
  677             test -n "$as_me" && echo "$as_me: creating $ac_dir/$ac_base" || echo "creating $ac_dir/$ac_base"
  678             sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/$ac_base.in" > "$ac_dir/$ac_base"
  679           fi
  680           ;;
  681         esac
  682       done])
  683 
  684     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
  685     dnl to 'yes' because some of the testsuite requires it.
  686     if test "$PACKAGE" = gettext; then
  687       BUILD_INCLUDED_LIBINTL=yes
  688     fi
  689 
  690     dnl intl/plural.c is generated from intl/plural.y. It requires bison,
  691     dnl because plural.y uses bison specific features. It requires at least
  692     dnl bison-1.26 because earlier versions generate a plural.c that doesn't
  693     dnl compile.
  694     dnl bison is only needed for the maintainer (who touches plural.y). But in
  695     dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
  696     dnl the rule in general Makefile. Now, some people carelessly touch the
  697     dnl files or have a broken "make" program, hence the plural.c rule will
  698     dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
  699     dnl present or too old.
  700     if test "$nls_cv_use_gnu_gettext" = "yes"; then
  701       AC_CHECK_PROGS([INTLBISON], [bison])
  702       if test -z "$INTLBISON"; then
  703         ac_verc_fail=yes
  704       else
  705         dnl Found it, now check the version.
  706         AC_MSG_CHECKING([version of bison])
  707 changequote(<<,>>)dnl
  708         ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
  709         case $ac_prog_version in
  710           ('') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
  711           (1.2[6-9]*|1.[3-9][0-9]*|[2-9].*)
  712 changequote([,])dnl
  713              ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
  714           (*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
  715         esac
  716       AC_MSG_RESULT([$ac_prog_version])
  717       fi
  718       if test $ac_verc_fail = yes; then
  719         INTLBISON=:
  720       fi
  721     fi
  722 
  723     dnl These rules are solely for the distribution goal.  While doing this
  724     dnl we only have to keep exactly one list of the available catalogs
  725     dnl in configure.in.
  726     for lang in $ALL_LINGUAS; do
  727       GMOFILES="$GMOFILES $lang.gmo"
  728       POFILES="$POFILES $lang.po"
  729     done
  730   fi
  731 
  732   dnl Make all variables we use known to autoconf.
  733   AC_SUBST(BUILD_INCLUDED_LIBINTL)
  734   AC_SUBST(USE_INCLUDED_LIBINTL)
  735   AC_SUBST(CATALOGS)
  736   AC_SUBST(CATOBJEXT)
  737   AC_SUBST(GMOFILES)
  738   AC_SUBST(INTLLIBS)
  739   AC_SUBST(INTLOBJS)
  740   AC_SUBST(POFILES)
  741   AC_SUBST(POSUB)
  742 
  743   dnl For backward compatibility. Some configure.ins may be using this.
  744   nls_cv_header_intl=
  745   nls_cv_header_libgt=
  746 
  747   dnl For backward compatibility. Some Makefiles may be using this.
  748   DATADIRNAME=share
  749   AC_SUBST(DATADIRNAME)
  750 
  751   dnl For backward compatibility. Some Makefiles may be using this.
  752   INSTOBJEXT=.mo
  753   AC_SUBST(INSTOBJEXT)
  754 
  755   dnl For backward compatibility. Some Makefiles may be using this.
  756   GENCAT=gencat
  757   AC_SUBST(GENCAT)
  758 ])dnl
  759 dnl ---------------------------------------------------------------------------
  760 dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
  761 dnl ------------------
  762 dnl Conditionally generate script according to whether we're using a given autoconf.
  763 dnl
  764 dnl $1 = version to compare against
  765 dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
  766 dnl $3 = code to use if AC_ACVERSION is older than $1.
  767 define([CF_ACVERSION_CHECK],
  768 [
  769 ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
  770 ifdef([m4_version_compare],
  771 [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
  772 [CF_ACVERSION_COMPARE(
  773 AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
  774 AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
  775 dnl ---------------------------------------------------------------------------
  776 dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
  777 dnl --------------------
  778 dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
  779 dnl                      MAJOR2, MINOR2, TERNARY2,
  780 dnl                      PRINTABLE2, not FOUND, FOUND)
  781 define([CF_ACVERSION_COMPARE],
  782 [ifelse(builtin([eval], [$2 < $5]), 1,
  783 [ifelse([$8], , ,[$8])],
  784 [ifelse([$9], , ,[$9])])])dnl
  785 dnl ---------------------------------------------------------------------------
  786 dnl CF_ADD_CFLAGS version: 13 updated: 2017/02/25 18:57:40
  787 dnl -------------
  788 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
  789 dnl The second parameter if given makes this macro verbose.
  790 dnl
  791 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
  792 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
  793 dnl confused by the quotes (which require backslashes to keep them usable).
  794 AC_DEFUN([CF_ADD_CFLAGS],
  795 [
  796 cf_fix_cppflags=no
  797 cf_new_cflags=
  798 cf_new_cppflags=
  799 cf_new_extra_cppflags=
  800 
  801 for cf_add_cflags in $1
  802 do
  803 case $cf_fix_cppflags in
  804 (no)
  805 	case $cf_add_cflags in
  806 	(-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C)
  807 		case $cf_add_cflags in
  808 		(-D*)
  809 			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
  810 
  811 			test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
  812 				&& test -z "${cf_tst_cflags}" \
  813 				&& cf_fix_cppflags=yes
  814 
  815 			if test $cf_fix_cppflags = yes ; then
  816 				CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
  817 				continue
  818 			elif test "${cf_tst_cflags}" = "\"'" ; then
  819 				CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
  820 				continue
  821 			fi
  822 			;;
  823 		esac
  824 		case "$CPPFLAGS" in
  825 		(*$cf_add_cflags)
  826 			;;
  827 		(*)
  828 			case $cf_add_cflags in
  829 			(-D*)
  830 				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
  831 				CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
  832 				;;
  833 			esac
  834 			CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags)
  835 			;;
  836 		esac
  837 		;;
  838 	(*)
  839 		CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags)
  840 		;;
  841 	esac
  842 	;;
  843 (yes)
  844 	CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
  845 
  846 	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
  847 
  848 	test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
  849 		&& test -z "${cf_tst_cflags}" \
  850 		&& cf_fix_cppflags=no
  851 	;;
  852 esac
  853 done
  854 
  855 if test -n "$cf_new_cflags" ; then
  856 	ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
  857 	CF_APPEND_TEXT(CFLAGS,$cf_new_cflags)
  858 fi
  859 
  860 if test -n "$cf_new_cppflags" ; then
  861 	ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
  862 	CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags)
  863 fi
  864 
  865 if test -n "$cf_new_extra_cppflags" ; then
  866 	ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
  867 	CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags)
  868 fi
  869 
  870 AC_SUBST(EXTRA_CPPFLAGS)
  871 
  872 ])dnl
  873 dnl ---------------------------------------------------------------------------
  874 dnl CF_ADD_INCDIR version: 15 updated: 2018/06/20 20:23:13
  875 dnl -------------
  876 dnl Add an include-directory to $CPPFLAGS.  Don't add /usr/include, since it's
  877 dnl redundant.  We don't normally need to add -I/usr/local/include for gcc,
  878 dnl but old versions (and some misinstalled ones) need that.  To make things
  879 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
  880 dnl the include-path).
  881 AC_DEFUN([CF_ADD_INCDIR],
  882 [
  883 if test -n "$1" ; then
  884   for cf_add_incdir in $1
  885   do
  886 	while test $cf_add_incdir != /usr/include
  887 	do
  888 	  if test -d $cf_add_incdir
  889 	  then
  890 		cf_have_incdir=no
  891 		if test -n "$CFLAGS$CPPFLAGS" ; then
  892 		  # a loop is needed to ensure we can add subdirs of existing dirs
  893 		  for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
  894 			if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
  895 			  cf_have_incdir=yes; break
  896 			fi
  897 		  done
  898 		fi
  899 
  900 		if test "$cf_have_incdir" = no ; then
  901 		  if test "$cf_add_incdir" = /usr/local/include ; then
  902 			if test "$GCC" = yes
  903 			then
  904 			  cf_save_CPPFLAGS=$CPPFLAGS
  905 			  CF_APPEND_TEXT(CPPFLAGS,-I$cf_add_incdir)
  906 			  AC_TRY_COMPILE([#include <stdio.h>],
  907 				  [printf("Hello")],
  908 				  [],
  909 				  [cf_have_incdir=yes])
  910 			  CPPFLAGS=$cf_save_CPPFLAGS
  911 			fi
  912 		  fi
  913 		fi
  914 
  915 		if test "$cf_have_incdir" = no ; then
  916 		  CF_VERBOSE(adding $cf_add_incdir to include-path)
  917 		  ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
  918 
  919 		  cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
  920 		  test "$cf_top_incdir" = "$cf_add_incdir" && break
  921 		  cf_add_incdir="$cf_top_incdir"
  922 		else
  923 		  break
  924 		fi
  925 	  else
  926 		break
  927 	  fi
  928 	done
  929   done
  930 fi
  931 ])dnl
  932 dnl ---------------------------------------------------------------------------
  933 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
  934 dnl ----------
  935 dnl Add a library, used to enforce consistency.
  936 dnl
  937 dnl $1 = library to add, without the "-l"
  938 dnl $2 = variable to update (default $LIBS)
  939 AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
  940 dnl ---------------------------------------------------------------------------
  941 dnl CF_ADD_LIBDIR version: 10 updated: 2015/04/18 08:56:57
  942 dnl -------------
  943 dnl	Adds to the library-path
  944 dnl
  945 dnl	Some machines have trouble with multiple -L options.
  946 dnl
  947 dnl $1 is the (list of) directory(s) to add
  948 dnl $2 is the optional name of the variable to update (default LDFLAGS)
  949 dnl
  950 AC_DEFUN([CF_ADD_LIBDIR],
  951 [
  952 if test -n "$1" ; then
  953 	for cf_add_libdir in $1
  954 	do
  955 		if test $cf_add_libdir = /usr/lib ; then
  956 			:
  957 		elif test -d $cf_add_libdir
  958 		then
  959 			cf_have_libdir=no
  960 			if test -n "$LDFLAGS$LIBS" ; then
  961 				# a loop is needed to ensure we can add subdirs of existing dirs
  962 				for cf_test_libdir in $LDFLAGS $LIBS ; do
  963 					if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
  964 						cf_have_libdir=yes; break
  965 					fi
  966 				done
  967 			fi
  968 			if test "$cf_have_libdir" = no ; then
  969 				CF_VERBOSE(adding $cf_add_libdir to library-path)
  970 				ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
  971 			fi
  972 		fi
  973 	done
  974 fi
  975 ])dnl
  976 dnl ---------------------------------------------------------------------------
  977 dnl CF_ADD_LIBS version: 2 updated: 2014/07/13 14:33:27
  978 dnl -----------
  979 dnl Add one or more libraries, used to enforce consistency.  Libraries are
  980 dnl prepended to an existing list, since their dependencies are assumed to
  981 dnl already exist in the list.
  982 dnl
  983 dnl $1 = libraries to add, with the "-l", etc.
  984 dnl $2 = variable to update (default $LIBS)
  985 AC_DEFUN([CF_ADD_LIBS],[
  986 cf_add_libs="$1"
  987 # Filter out duplicates - this happens with badly-designed ".pc" files...
  988 for cf_add_1lib in [$]ifelse($2,,LIBS,[$2])
  989 do
  990 	for cf_add_2lib in $cf_add_libs
  991 	do
  992 		if test "x$cf_add_1lib" = "x$cf_add_2lib"
  993 		then
  994 			cf_add_1lib=
  995 			break
  996 		fi
  997 	done
  998 	test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib"
  999 done
 1000 ifelse($2,,LIBS,[$2])="$cf_add_libs"
 1001 ])dnl
 1002 dnl ---------------------------------------------------------------------------
 1003 dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22
 1004 dnl ----------------
 1005 dnl Add a given library after another, e.g., following the one it satisfies a
 1006 dnl dependency for.
 1007 dnl
 1008 dnl $1 = the first library
 1009 dnl $2 = its dependency
 1010 AC_DEFUN([CF_ADD_LIB_AFTER],[
 1011 CF_VERBOSE(...before $LIBS)
 1012 LIBS=`echo "$LIBS" | sed -e "s/[[ 	]][[ 	]]*/ /g" -e "s%$1 %$1 $2 %" -e 's%  % %g'`
 1013 CF_VERBOSE(...after  $LIBS)
 1014 ])dnl
 1015 dnl ---------------------------------------------------------------------------
 1016 dnl CF_ADD_OPTIONAL_PATH version: 3 updated: 2015/05/10 19:52:14
 1017 dnl --------------------
 1018 dnl Add an optional search-path to the compile/link variables.
 1019 dnl See CF_WITH_PATH
 1020 dnl
 1021 dnl $1 = shell variable containing the result of --with-XXX=[DIR]
 1022 dnl $2 = module to look for.
 1023 AC_DEFUN([CF_ADD_OPTIONAL_PATH],[
 1024 case "$1" in
 1025 (no)
 1026 	;;
 1027 (yes)
 1028 	;;
 1029 (*)
 1030 	CF_ADD_SEARCHPATH([$1], [AC_MSG_ERROR(cannot find $2 under $1)])
 1031 	;;
 1032 esac
 1033 ])dnl
 1034 dnl ---------------------------------------------------------------------------
 1035 dnl CF_ADD_SEARCHPATH version: 5 updated: 2009/01/11 20:40:21
 1036 dnl -----------------
 1037 dnl Set $CPPFLAGS and $LDFLAGS with the directories given via the parameter.
 1038 dnl They can be either the common root of include- and lib-directories, or the
 1039 dnl lib-directory (to allow for things like lib64 directories).
 1040 dnl See also CF_FIND_LINKAGE.
 1041 dnl
 1042 dnl $1 is the list of colon-separated directory names to search.
 1043 dnl $2 is the action to take if a parameter does not yield a directory.
 1044 AC_DEFUN([CF_ADD_SEARCHPATH],
 1045 [
 1046 AC_REQUIRE([CF_PATHSEP])
 1047 for cf_searchpath in `echo "$1" | tr $PATH_SEPARATOR ' '`; do
 1048 	if test -d $cf_searchpath/include; then
 1049 		CF_ADD_INCDIR($cf_searchpath/include)
 1050 	elif test -d $cf_searchpath/../include ; then
 1051 		CF_ADD_INCDIR($cf_searchpath/../include)
 1052 	ifelse([$2],,,[else
 1053 $2])
 1054 	fi
 1055 	if test -d $cf_searchpath/lib; then
 1056 		CF_ADD_LIBDIR($cf_searchpath/lib)
 1057 	elif test -d $cf_searchpath ; then
 1058 		CF_ADD_LIBDIR($cf_searchpath)
 1059 	ifelse([$2],,,[else
 1060 $2])
 1061 	fi
 1062 done
 1063 ])
 1064 dnl ---------------------------------------------------------------------------
 1065 dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05
 1066 dnl ------------------
 1067 dnl Append to a search-list for a nonstandard header/lib-file
 1068 dnl	$1 = the variable to return as result
 1069 dnl	$2 = the package name
 1070 dnl	$3 = the subdirectory, e.g., bin, include or lib
 1071 dnl $4 = the directory under which we will test for subdirectories
 1072 dnl $5 = a directory that we do not want $4 to match
 1073 AC_DEFUN([CF_ADD_SUBDIR_PATH],
 1074 [
 1075 test "x$4" != "x$5" && \
 1076 test -d "$4" && \
 1077 ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) {
 1078 	test -n "$verbose" && echo "	... testing for $3-directories under $4"
 1079 	test -d $4/$3 &&          $1="[$]$1 $4/$3"
 1080 	test -d $4/$3/$2 &&       $1="[$]$1 $4/$3/$2"
 1081 	test -d $4/$3/$2/$3 &&    $1="[$]$1 $4/$3/$2/$3"
 1082 	test -d $4/$2/$3 &&       $1="[$]$1 $4/$2/$3"
 1083 	test -d $4/$2/$3/$2 &&    $1="[$]$1 $4/$2/$3/$2"
 1084 }
 1085 ])dnl
 1086 dnl ---------------------------------------------------------------------------
 1087 dnl CF_ANSI_CC_CHECK version: 13 updated: 2012/10/06 11:17:15
 1088 dnl ----------------
 1089 dnl This was originally adapted from the macros 'fp_PROG_CC_STDC' and
 1090 dnl 'fp_C_PROTOTYPES' in the sharutils 4.2 distribution.
 1091 AC_DEFUN([CF_ANSI_CC_CHECK],
 1092 [
 1093 CF_CC_ENV_FLAGS
 1094 
 1095 AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
 1096 cf_cv_ansi_cc=no
 1097 cf_save_CFLAGS="$CFLAGS"
 1098 cf_save_CPPFLAGS="$CPPFLAGS"
 1099 # Don't try gcc -ansi; that turns off useful extensions and
 1100 # breaks some systems' header files.
 1101 # AIX			-qlanglvl=ansi
 1102 # Ultrix and OSF/1	-std1
 1103 # HP-UX			-Aa -D_HPUX_SOURCE
 1104 # SVR4			-Xc
 1105 # UnixWare 1.2		(cannot use -Xc, since ANSI/POSIX clashes)
 1106 for cf_arg in "-DCC_HAS_PROTOS" \
 1107 	"" \
 1108 	-qlanglvl=ansi \
 1109 	-std1 \
 1110 	-Ae \
 1111 	"-Aa -D_HPUX_SOURCE" \
 1112 	-Xc
 1113 do
 1114 	CF_ADD_CFLAGS($cf_arg)
 1115 	AC_TRY_COMPILE(
 1116 [
 1117 #ifndef CC_HAS_PROTOS
 1118 #if !defined(__STDC__) || (__STDC__ != 1)
 1119 choke me
 1120 #endif
 1121 #endif
 1122 ],[
 1123 	int test (int i, double x);
 1124 	struct s1 {int (*f) (int a);};
 1125 	struct s2 {int (*f) (double a);};],
 1126 	[cf_cv_ansi_cc="$cf_arg"; break])
 1127 done
 1128 CFLAGS="$cf_save_CFLAGS"
 1129 CPPFLAGS="$cf_save_CPPFLAGS"
 1130 ])
 1131 
 1132 if test "$cf_cv_ansi_cc" != "no"; then
 1133 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
 1134 	CF_ADD_CFLAGS($cf_cv_ansi_cc)
 1135 else
 1136 	AC_DEFINE(CC_HAS_PROTOS,1,[Define to 1 if C compiler supports prototypes])
 1137 fi
 1138 fi
 1139 ])dnl
 1140 dnl ---------------------------------------------------------------------------
 1141 dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
 1142 dnl ---------------
 1143 dnl For programs that must use an ANSI compiler, obtain compiler options that
 1144 dnl will make it recognize prototypes.  We'll do preprocessor checks in other
 1145 dnl macros, since tools such as unproto can fake prototypes, but only part of
 1146 dnl the preprocessor.
 1147 AC_DEFUN([CF_ANSI_CC_REQD],
 1148 [AC_REQUIRE([CF_ANSI_CC_CHECK])
 1149 if test "$cf_cv_ansi_cc" = "no"; then
 1150 	AC_MSG_ERROR(
 1151 [Your compiler does not appear to recognize prototypes.
 1152 You have the following choices:
 1153 	a. adjust your compiler options
 1154 	b. get an up-to-date compiler
 1155 	c. use a wrapper such as unproto])
 1156 fi
 1157 ])dnl
 1158 dnl ---------------------------------------------------------------------------
 1159 dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55
 1160 dnl --------------
 1161 dnl use this macro for appending text without introducing an extra blank at
 1162 dnl the beginning
 1163 define([CF_APPEND_TEXT],
 1164 [
 1165 	test -n "[$]$1" && $1="[$]$1 "
 1166 	$1="[$]{$1}$2"
 1167 ])dnl
 1168 dnl ---------------------------------------------------------------------------
 1169 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
 1170 dnl --------------
 1171 dnl Allow user to disable a normally-on option.
 1172 AC_DEFUN([CF_ARG_DISABLE],
 1173 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
 1174 dnl ---------------------------------------------------------------------------
 1175 dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
 1176 dnl -------------
 1177 dnl Allow user to enable a normally-off option.
 1178 AC_DEFUN([CF_ARG_ENABLE],
 1179 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
 1180 dnl ---------------------------------------------------------------------------
 1181 dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14
 1182 dnl -------------
 1183 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
 1184 dnl values.
 1185 dnl
 1186 dnl Parameters:
 1187 dnl $1 = option name
 1188 dnl $2 = help-string
 1189 dnl $3 = action to perform if option is not default
 1190 dnl $4 = action if perform if option is default
 1191 dnl $5 = default option value (either 'yes' or 'no')
 1192 AC_DEFUN([CF_ARG_OPTION],
 1193 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
 1194 	if test "$enableval" != "$5" ; then
 1195 ifelse([$3],,[    :]dnl
 1196 ,[    $3]) ifelse([$4],,,[
 1197 	else
 1198 		$4])
 1199 	fi],[enableval=$5 ifelse([$4],,,[
 1200 	$4
 1201 ])dnl
 1202 ])])dnl
 1203 dnl ---------------------------------------------------------------------------
 1204 dnl CF_ARG_WITH version: 4 updated: 2008/03/23 14:48:54
 1205 dnl -----------
 1206 dnl Restricted form of AC_ARG_WITH that requires user to specify a value
 1207 dnl $1 = option name
 1208 dnl $2 = help message
 1209 dnl $3 = variable to set with the --with value
 1210 dnl $4 = default value, if any, must be constant.
 1211 dnl $5 = default value shown for --help if $4 is empty.
 1212 AC_DEFUN([CF_ARG_WITH],
 1213 [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,ifelse($5,,empty,$5),$4)),,
 1214 ifelse($4,,[withval="${$3}"],[withval="${$3-$4}"]))dnl
 1215 ifelse($4,,[test -n "$withval" && \
 1216 ],[test -z "$withval" && withval=no
 1217 ])dnl
 1218 case "$withval" in #(vi
 1219 yes)
 1220   AC_MSG_ERROR(expected a value for --with-$1)
 1221   ;; #(vi
 1222 no) withval=""
 1223   ;;
 1224 esac
 1225 $3="$withval"
 1226 ])dnl
 1227 dnl ---------------------------------------------------------------------------
 1228 dnl CF_AR_FLAGS version: 6 updated: 2015/10/10 15:25:05
 1229 dnl -----------
 1230 dnl Check for suitable "ar" (archiver) options for updating an archive.
 1231 dnl
 1232 dnl In particular, handle some obsolete cases where the "-" might be omitted,
 1233 dnl as well as a workaround for breakage of make's archive rules by the GNU
 1234 dnl binutils "ar" program.
 1235 AC_DEFUN([CF_AR_FLAGS],[
 1236 AC_REQUIRE([CF_PROG_AR])
 1237 
 1238 AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[
 1239 	cf_cv_ar_flags=unknown
 1240 	for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv
 1241 	do
 1242 
 1243 		# check if $ARFLAGS already contains this choice
 1244 		if test "x$ARFLAGS" != "x" ; then
 1245 			cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"`
 1246 			if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then
 1247 				cf_cv_ar_flags=
 1248 				break
 1249 			fi
 1250 		fi
 1251 
 1252 		rm -f conftest.$ac_cv_objext
 1253 		rm -f conftest.a
 1254 
 1255 		cat >conftest.$ac_ext <<EOF
 1256 #line __oline__ "configure"
 1257 int	testdata[[3]] = { 123, 456, 789 };
 1258 EOF
 1259 		if AC_TRY_EVAL(ac_compile) ; then
 1260 			echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC
 1261 			$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null
 1262 			if test -f conftest.a ; then
 1263 				cf_cv_ar_flags=$cf_ar_flags
 1264 				break
 1265 			fi
 1266 		else
 1267 			CF_VERBOSE(cannot compile test-program)
 1268 			break
 1269 		fi
 1270 	done
 1271 	rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext
 1272 ])
 1273 
 1274 if test -n "$ARFLAGS" ; then
 1275 	if test -n "$cf_cv_ar_flags" ; then
 1276 		ARFLAGS="$ARFLAGS $cf_cv_ar_flags"
 1277 	fi
 1278 else
 1279 	ARFLAGS=$cf_cv_ar_flags
 1280 fi
 1281 
 1282 AC_SUBST(ARFLAGS)
 1283 ])
 1284 dnl ---------------------------------------------------------------------------
 1285 dnl CF_BUILD_CC version: 8 updated: 2018/01/04 20:31:04
 1286 dnl -----------
 1287 dnl If we're cross-compiling, allow the user to override the tools and their
 1288 dnl options.  The configure script is oriented toward identifying the host
 1289 dnl compiler, etc., but we need a build compiler to generate parts of the
 1290 dnl source.
 1291 dnl
 1292 dnl $1 = default for $CPPFLAGS
 1293 dnl $2 = default for $LIBS
 1294 AC_DEFUN([CF_BUILD_CC],[
 1295 CF_ACVERSION_CHECK(2.52,,
 1296 	[AC_REQUIRE([CF_PROG_EXT])])
 1297 if test "$cross_compiling" = yes ; then
 1298 
 1299 	# defaults that we might want to override
 1300 	: ${BUILD_CFLAGS:=''}
 1301 	: ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
 1302 	: ${BUILD_LDFLAGS:=''}
 1303 	: ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
 1304 	: ${BUILD_EXEEXT:='$x'}
 1305 	: ${BUILD_OBJEXT:='o'}
 1306 
 1307 	AC_ARG_WITH(build-cc,
 1308 		[  --with-build-cc=XXX     the build C compiler ($BUILD_CC)],
 1309 		[BUILD_CC="$withval"],
 1310 		[AC_CHECK_PROGS(BUILD_CC, [gcc clang c99 c89 cc cl],none)])
 1311 	AC_MSG_CHECKING(for native build C compiler)
 1312 	AC_MSG_RESULT($BUILD_CC)
 1313 
 1314 	AC_MSG_CHECKING(for native build C preprocessor)
 1315 	AC_ARG_WITH(build-cpp,
 1316 		[  --with-build-cpp=XXX    the build C preprocessor ($BUILD_CPP)],
 1317 		[BUILD_CPP="$withval"],
 1318 		[BUILD_CPP='${BUILD_CC} -E'])
 1319 	AC_MSG_RESULT($BUILD_CPP)
 1320 
 1321 	AC_MSG_CHECKING(for native build C flags)
 1322 	AC_ARG_WITH(build-cflags,
 1323 		[  --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
 1324 		[BUILD_CFLAGS="$withval"])
 1325 	AC_MSG_RESULT($BUILD_CFLAGS)
 1326 
 1327 	AC_MSG_CHECKING(for native build C preprocessor-flags)
 1328 	AC_ARG_WITH(build-cppflags,
 1329 		[  --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
 1330 		[BUILD_CPPFLAGS="$withval"])
 1331 	AC_MSG_RESULT($BUILD_CPPFLAGS)
 1332 
 1333 	AC_MSG_CHECKING(for native build linker-flags)
 1334 	AC_ARG_WITH(build-ldflags,
 1335 		[  --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
 1336 		[BUILD_LDFLAGS="$withval"])
 1337 	AC_MSG_RESULT($BUILD_LDFLAGS)
 1338 
 1339 	AC_MSG_CHECKING(for native build linker-libraries)
 1340 	AC_ARG_WITH(build-libs,
 1341 		[  --with-build-libs=XXX   the build libraries (${BUILD_LIBS})],
 1342 		[BUILD_LIBS="$withval"])
 1343 	AC_MSG_RESULT($BUILD_LIBS)
 1344 
 1345 	# this assumes we're on Unix.
 1346 	BUILD_EXEEXT=
 1347 	BUILD_OBJEXT=o
 1348 
 1349 	: ${BUILD_CC:='${CC}'}
 1350 
 1351 	if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
 1352 		AC_MSG_ERROR([Cross-build requires two compilers.
 1353 Use --with-build-cc to specify the native compiler.])
 1354 	fi
 1355 
 1356 else
 1357 	: ${BUILD_CC:='${CC}'}
 1358 	: ${BUILD_CPP:='${CPP}'}
 1359 	: ${BUILD_CFLAGS:='${CFLAGS}'}
 1360 	: ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
 1361 	: ${BUILD_LDFLAGS:='${LDFLAGS}'}
 1362 	: ${BUILD_LIBS:='${LIBS}'}
 1363 	: ${BUILD_EXEEXT:='$x'}
 1364 	: ${BUILD_OBJEXT:='o'}
 1365 fi
 1366 
 1367 AC_SUBST(BUILD_CC)
 1368 AC_SUBST(BUILD_CPP)
 1369 AC_SUBST(BUILD_CFLAGS)
 1370 AC_SUBST(BUILD_CPPFLAGS)
 1371 AC_SUBST(BUILD_LDFLAGS)
 1372 AC_SUBST(BUILD_LIBS)
 1373 AC_SUBST(BUILD_EXEEXT)
 1374 AC_SUBST(BUILD_OBJEXT)
 1375 ])dnl
 1376 dnl ---------------------------------------------------------------------------
 1377 dnl CF_BUNDLED_INTL version: 19 updated: 2018/06/20 20:23:13
 1378 dnl ---------------
 1379 dnl Top-level macro for configuring an application with a bundled copy of
 1380 dnl the intl and po directories for gettext.
 1381 dnl
 1382 dnl $1 specifies either Makefile or makefile, defaulting to the former.
 1383 dnl $2 if nonempty sets the option to --enable-nls rather than to --disable-nls
 1384 dnl
 1385 dnl Sets variables which can be used to substitute in makefiles:
 1386 dnl	GT_YES       - "#" comment unless building intl library, otherwise empty
 1387 dnl	GT_NO        - "#" comment if building intl library, otherwise empty
 1388 dnl	INTLDIR_MAKE - to make ./intl directory
 1389 dnl	MSG_DIR_MAKE - to make ./po directory
 1390 dnl	SUB_MAKEFILE - list of makefiles in ./intl, ./po directories
 1391 dnl
 1392 dnl Defines:
 1393 dnl	HAVE_LIBGETTEXT_H if we're using ./intl
 1394 dnl	NLS_TEXTDOMAIN
 1395 dnl
 1396 dnl Environment:
 1397 dnl	ALL_LINGUAS if set, lists the root names of the ".po" files.
 1398 dnl	CONFIG_H assumed to be "config.h"
 1399 dnl	PACKAGE must be set, used as default for textdomain
 1400 dnl	VERSION may be set, otherwise extract from "VERSION" file.
 1401 dnl
 1402 AC_DEFUN([CF_BUNDLED_INTL],[
 1403 cf_makefile=ifelse($1,,Makefile,$1)
 1404 
 1405 dnl Set of available languages (based on source distribution).  Note that
 1406 dnl setting $LINGUAS overrides $ALL_LINGUAS.  Some environments set $LINGUAS
 1407 dnl rather than $LC_ALL
 1408 test -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'`
 1409 
 1410 # Allow override of "config.h" definition:
 1411 : ${CONFIG_H:=config.h}
 1412 AC_SUBST(CONFIG_H)
 1413 
 1414 if test -z "$PACKAGE" ; then
 1415 	AC_MSG_ERROR([[CF_BUNDLED_INTL] used without setting [PACKAGE] variable])
 1416 fi
 1417 
 1418 if test -z "$VERSION" ; then
 1419 if test -f $srcdir/VERSION ; then
 1420 	VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
 1421 else
 1422 	VERSION=unknown
 1423 fi
 1424 fi
 1425 AC_SUBST(VERSION)
 1426 
 1427 AM_GNU_GETTEXT(,,,[$2])
 1428 
 1429 if test "$USE_NLS" = yes ; then
 1430 	AC_ARG_WITH(textdomain,
 1431 		[  --with-textdomain=PKG   NLS text-domain (default is package name)],
 1432 		[NLS_TEXTDOMAIN=$withval],
 1433 		[NLS_TEXTDOMAIN=$PACKAGE])
 1434 	AC_DEFINE_UNQUOTED(NLS_TEXTDOMAIN,"$NLS_TEXTDOMAIN",[Define to the nls textdomain value])
 1435 	AC_SUBST(NLS_TEXTDOMAIN)
 1436 fi
 1437 
 1438 INTLDIR_MAKE=
 1439 MSG_DIR_MAKE=
 1440 SUB_MAKEFILE=
 1441 
 1442 dnl this updates SUB_MAKEFILE and MSG_DIR_MAKE:
 1443 CF_OUR_MESSAGES($1)
 1444 
 1445 if test "$USE_INCLUDED_LIBINTL" = yes ; then
 1446 	if test "$nls_cv_force_use_gnu_gettext" = yes ; then
 1447 		:
 1448 	elif test "$nls_cv_use_gnu_gettext" = yes ; then
 1449 		:
 1450 	else
 1451 		INTLDIR_MAKE="#"
 1452 	fi
 1453 	if test -z "$INTLDIR_MAKE"; then
 1454 		AC_DEFINE(HAVE_LIBGETTEXT_H,1,[Define to 1 if we have libgettext.h])
 1455 		for cf_makefile in \
 1456 			$srcdir/intl/Makefile.in \
 1457 			$srcdir/intl/makefile.in
 1458 		do
 1459 			if test -f "$cf_makefile" ; then
 1460 				SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}"
 1461 				break
 1462 			fi
 1463 		done
 1464 	fi
 1465 else
 1466 	INTLDIR_MAKE="#"
 1467 	if test "$USE_NLS" = yes ; then
 1468 		AC_CHECK_HEADERS(libintl.h)
 1469 	fi
 1470 fi
 1471 
 1472 if test -z "$INTLDIR_MAKE" ; then
 1473 	CF_APPEND_TEXT(CPPFLAGS,-I../intl)
 1474 fi
 1475 
 1476 dnl FIXME:  we use this in lynx (the alternative is a spurious dependency upon
 1477 dnl GNU make)
 1478 if test "$BUILD_INCLUDED_LIBINTL" = yes ; then
 1479 	GT_YES="#"
 1480 	GT_NO=
 1481 else
 1482 	GT_YES=
 1483 	GT_NO="#"
 1484 fi
 1485 
 1486 AC_SUBST(INTLDIR_MAKE)
 1487 AC_SUBST(MSG_DIR_MAKE)
 1488 AC_SUBST(GT_YES)
 1489 AC_SUBST(GT_NO)
 1490 
 1491 dnl FIXME:  the underlying AM_GNU_GETTEXT macro either needs some fixes or a
 1492 dnl little documentation.  It doesn't define anything so that we can ifdef our
 1493 dnl own code, except ENABLE_NLS, which is too vague to be of any use.
 1494 
 1495 if test "$USE_INCLUDED_LIBINTL" = yes ; then
 1496 	if test "$nls_cv_force_use_gnu_gettext" = yes ; then
 1497 		AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
 1498 	elif test "$nls_cv_use_gnu_gettext" = yes ; then
 1499 		AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
 1500 	fi
 1501 	if test -n "$nls_cv_header_intl" ; then
 1502 		AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have header-file for libintl])
 1503 	fi
 1504 fi
 1505 ])dnl
 1506 dnl ---------------------------------------------------------------------------
 1507 dnl CF_BUNDLED_PCRE version: 4 updated: 2009/12/24 04:20:51
 1508 dnl ---------------
 1509 dnl Top-level macro for configuring an application with a bundled copy of
 1510 dnl the pcre library.
 1511 dnl
 1512 dnl $1 specifies the top of the directory containing PCRE's include, lib dirs.
 1513 AC_DEFUN([CF_BUNDLED_PCRE],
 1514 [
 1515 cf_pcre_home=$1
 1516 PCREDIR_MAKE=
 1517 PCREDIR_LIBS=
 1518 PCREDIR_CPPFLAGS=
 1519 case .$cf_pcre_home in #(vi
 1520 .no) #(vi
 1521 	# setup to compile the bundled PCRE:
 1522 #	. $srcdir/pcre/version.sh
 1523 	AC_SUBST(PCRE_MAJOR)
 1524 	AC_SUBST(PCRE_MINOR)
 1525 	AC_SUBST(PCRE_DATE)
 1526 	AC_SUBST(PCRE_DEFINES)
 1527 	;;
 1528 .yes) #(vi
 1529 	PCREDIR_MAKE='#'
 1530 	PCREDIR_LIBS="-lpcre"
 1531 	;;
 1532 .*)
 1533 	CF_PATH_SYNTAX(cf_pcre_home)
 1534 	PCREDIR_MAKE='#'
 1535 	PCREDIR_LIBS="-L${cf_pcre_home}/lib -lpcre"
 1536 	PCREDIR_CPPFLAGS="-I${cf_pcre_home}/include"
 1537 	;;
 1538 esac
 1539 AC_SUBST(PCREDIR_MAKE)
 1540 AC_SUBST(PCREDIR_LIBS)
 1541 AC_SUBST(PCREDIR_CPPFLAGS)
 1542 ])dnl
 1543 dnl ---------------------------------------------------------------------------
 1544 dnl CF_CC_ENV_FLAGS version: 9 updated: 2018/07/29 18:03:26
 1545 dnl ---------------
 1546 dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
 1547 dnl into CC.  This will not help with broken scripts that wrap the compiler
 1548 dnl with options, but eliminates a more common category of user confusion.
 1549 dnl
 1550 dnl In particular, it addresses the problem of being able to run the C
 1551 dnl preprocessor in a consistent manner.
 1552 dnl
 1553 dnl Caveat: this also disallows blanks in the pathname for the compiler, but
 1554 dnl the nuisance of having inconsistent settings for compiler and preprocessor
 1555 dnl outweighs that limitation.
 1556 AC_DEFUN([CF_CC_ENV_FLAGS],
 1557 [
 1558 # This should have been defined by AC_PROG_CC
 1559 : ${CC:=cc}
 1560 
 1561 AC_MSG_CHECKING(\$CFLAGS variable)
 1562 case "x$CFLAGS" in
 1563 (*-[[IUD]]*)
 1564 	AC_MSG_RESULT(broken)
 1565 	AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options)
 1566 	cf_flags="$CFLAGS"
 1567 	CFLAGS=
 1568 	for cf_arg in $cf_flags
 1569 	do
 1570 		CF_ADD_CFLAGS($cf_arg)
 1571 	done
 1572 	;;
 1573 (*)
 1574 	AC_MSG_RESULT(ok)
 1575 	;;
 1576 esac
 1577 
 1578 AC_MSG_CHECKING(\$CC variable)
 1579 case "$CC" in
 1580 (*[[\ \	]]-*)
 1581 	AC_MSG_RESULT(broken)
 1582 	AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options)
 1583 	# humor him...
 1584 	cf_prog=`echo "$CC" | sed -e 's/	/ /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'`
 1585 	cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'`
 1586 	CC="$cf_prog"
 1587 	for cf_arg in $cf_flags
 1588 	do
 1589 		case "x$cf_arg" in
 1590 		(x-[[IUDfgOW]]*)
 1591 			CF_ADD_CFLAGS($cf_arg)
 1592 			;;
 1593 		(*)
 1594 			CC="$CC $cf_arg"
 1595 			;;
 1596 		esac
 1597 	done
 1598 	CF_VERBOSE(resulting CC: '$CC')
 1599 	CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
 1600 	CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
 1601 	;;
 1602 (*)
 1603 	AC_MSG_RESULT(ok)
 1604 	;;
 1605 esac
 1606 ])dnl
 1607 dnl ---------------------------------------------------------------------------
 1608 dnl CF_CHECK_1_DECL version: 5 updated: 2001/07/22 21:09:16
 1609 dnl ---------------
 1610 dnl Check for missing declarations in the system headers (adapted from vile).
 1611 dnl
 1612 dnl CHECK_DECL_FLAG and CHECK_DECL_HDRS must be set in configure.in
 1613 AC_DEFUN([CF_CHECK_1_DECL],
 1614 [
 1615 AC_MSG_CHECKING([for missing "$1" extern])
 1616 AC_CACHE_VAL([cf_cv_func_$1],[
 1617 CF_MSG_LOG([for missing "$1" external])
 1618 cf_save_CFLAGS="$CFLAGS"
 1619 CFLAGS="$CFLAGS $CHECK_DECL_FLAG"
 1620 AC_TRY_LINK([
 1621 $CHECK_DECL_HDRS
 1622 
 1623 #undef $1
 1624 struct zowie { int a; double b; struct zowie *c; char d; };
 1625 extern struct zowie *$1();
 1626 ],
 1627 [
 1628 ],
 1629 [if test -n "$CHECK_DECL_HDRS" ; then
 1630 # try to work around system headers which are infested with non-standard syntax
 1631 CF_UPPER(cf_1_up,$1)
 1632 AC_TRY_COMPILE([
 1633 #define DECL_${cf_1_up}
 1634 $CHECK_DECL_HDRS
 1635 ],[long x = 0],
 1636 [eval 'cf_cv_func_'$1'=yes'],
 1637 [eval 'cf_cv_func_'$1'=no'])
 1638 else
 1639 eval 'cf_cv_func_'$1'=yes'
 1640 fi
 1641 ],
 1642 [eval 'cf_cv_func_'$1'=no'])
 1643 CFLAGS="$cf_save_CFLAGS"
 1644 ])
 1645 eval 'cf_result=$cf_cv_func_'$1
 1646 AC_MSG_RESULT($cf_result)
 1647 test $cf_result = yes && AC_DEFINE_UNQUOTED(DECL_$2)
 1648 ])dnl
 1649 dnl ---------------------------------------------------------------------------
 1650 dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
 1651 dnl --------------
 1652 dnl Check if we're accidentally using a cache from a different machine.
 1653 dnl Derive the system name, as a check for reusing the autoconf cache.
 1654 dnl
 1655 dnl If we've packaged config.guess and config.sub, run that (since it does a
 1656 dnl better job than uname).  Normally we'll use AC_CANONICAL_HOST, but allow
 1657 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
 1658 dnl which is useful in cross-compiles.
 1659 dnl
 1660 dnl Note: we would use $ac_config_sub, but that is one of the places where
 1661 dnl autoconf 2.5x broke compatibility with autoconf 2.13
 1662 AC_DEFUN([CF_CHECK_CACHE],
 1663 [
 1664 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
 1665 	ifelse([$1],,[AC_CANONICAL_HOST],[$1])
 1666 	system_name="$host_os"
 1667 else
 1668 	system_name="`(uname -s -r) 2>/dev/null`"
 1669 	if test -z "$system_name" ; then
 1670 		system_name="`(hostname) 2>/dev/null`"
 1671 	fi
 1672 fi
 1673 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
 1674 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
 1675 
 1676 test -z "$system_name" && system_name="$cf_cv_system_name"
 1677 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
 1678 
 1679 if test ".$system_name" != ".$cf_cv_system_name" ; then
 1680 	AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
 1681 	AC_MSG_ERROR("Please remove config.cache and try again.")
 1682 fi
 1683 ])dnl
 1684 dnl ---------------------------------------------------------------------------
 1685 dnl CF_CHECK_CFLAGS version: 3 updated: 2014/07/22 05:32:57
 1686 dnl ---------------
 1687 dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
 1688 dnl a build-configuration such as imake.  These have the pitfall that they
 1689 dnl often contain compiler-specific options which we cannot use, mixed with
 1690 dnl preprocessor options that we usually can.
 1691 AC_DEFUN([CF_CHECK_CFLAGS],
 1692 [
 1693 CF_VERBOSE(checking additions to CFLAGS)
 1694 cf_check_cflags="$CFLAGS"
 1695 cf_check_cppflags="$CPPFLAGS"
 1696 CF_ADD_CFLAGS($1,yes)
 1697 if test "x$cf_check_cflags" != "x$CFLAGS" ; then
 1698 AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
 1699 	[CF_VERBOSE(test-compile failed.  Undoing change to \$CFLAGS)
 1700 	 if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then
 1701 		 CF_VERBOSE(but keeping change to \$CPPFLAGS)
 1702 	 fi
 1703 	 CFLAGS="$cf_check_flags"])
 1704 fi
 1705 ])dnl
 1706 dnl ---------------------------------------------------------------------------
 1707 dnl CF_CHECK_DECL version: 2 updated: 1997/08/28 23:57:55
 1708 dnl -------------
 1709 AC_DEFUN([CF_CHECK_DECL],
 1710 [for ac_func in $1
 1711 do
 1712 CF_UPPER(ac_tr_func,$ac_func)
 1713 CF_CHECK_1_DECL(${ac_func}, ${ac_tr_func})dnl
 1714 done
 1715 ])dnl
 1716 dnl ---------------------------------------------------------------------------
 1717 dnl CF_CHECK_ERRNO version: 12 updated: 2015/04/18 08:56:57
 1718 dnl --------------
 1719 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
 1720 dnl the 'errno' variable.  Define a DECL_xxx symbol if we must declare it
 1721 dnl ourselves.
 1722 dnl
 1723 dnl $1 = the name to check
 1724 dnl $2 = the assumed type
 1725 AC_DEFUN([CF_CHECK_ERRNO],
 1726 [
 1727 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
 1728 	AC_TRY_COMPILE([
 1729 #ifdef HAVE_STDLIB_H
 1730 #include <stdlib.h>
 1731 #endif
 1732 #include <stdio.h>
 1733 #include <sys/types.h>
 1734 #include <errno.h> ],
 1735 	ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1,
 1736 	[cf_cv_dcl_$1=yes],
 1737 	[cf_cv_dcl_$1=no])
 1738 ])
 1739 
 1740 if test "$cf_cv_dcl_$1" = no ; then
 1741 	CF_UPPER(cf_result,decl_$1)
 1742 	AC_DEFINE_UNQUOTED($cf_result)
 1743 fi
 1744 
 1745 # It's possible (for near-UNIX clones) that the data doesn't exist
 1746 CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
 1747 ])dnl
 1748 dnl ---------------------------------------------------------------------------
 1749 dnl CF_CHECK_EXTERN_DATA version: 4 updated: 2015/04/18 08:56:57
 1750 dnl --------------------
 1751 dnl Check for existence of external data in the current set of libraries.  If
 1752 dnl we can modify it, it's real enough.
 1753 dnl $1 = the name to check
 1754 dnl $2 = its type
 1755 AC_DEFUN([CF_CHECK_EXTERN_DATA],
 1756 [
 1757 AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
 1758 	AC_TRY_LINK([
 1759 #undef $1
 1760 extern $2 $1;
 1761 ],
 1762 	[$1 = 2],
 1763 	[cf_cv_have_$1=yes],
 1764 	[cf_cv_have_$1=no])
 1765 ])
 1766 
 1767 if test "$cf_cv_have_$1" = yes ; then
 1768 	CF_UPPER(cf_result,have_$1)
 1769 	AC_DEFINE_UNQUOTED($cf_result)
 1770 fi
 1771 
 1772 ])dnl
 1773 dnl ---------------------------------------------------------------------------
 1774 dnl CF_CHECK_HEADERS version: 3 updated: 2000/11/03 11:14:19
 1775 dnl ----------------
 1776 dnl AC_CHECK_HEADERS(sys/socket.h) fails on OS/2 EMX because it demands that
 1777 dnl <sys/types.h> be included first.
 1778 dnl
 1779 dnl Also <sys/dir.h> and <sys/dirent.h> and <sys/stat.h>, but we normally do
 1780 dnl not do our own tests via AC_CHECK_HEADERS for those.
 1781 AC_DEFUN([CF_CHECK_HEADERS],[
 1782 for cf_hdr in $1
 1783 do
 1784 	AC_MSG_CHECKING(for $cf_hdr)
 1785 	AC_TRY_CPP([
 1786 #include <sys/types.h>
 1787 #include <$cf_hdr>
 1788 ],[cf_found=yes],[cf_found=no])
 1789 AC_MSG_RESULT($cf_found)
 1790 if test $cf_found = yes ; then
 1791 	CF_UPPER(cf_tr_hdr,$cf_hdr)
 1792 	AC_DEFINE_UNQUOTED(HAVE_${cf_tr_hdr})
 1793 fi
 1794 done
 1795 ])dnl
 1796 dnl ---------------------------------------------------------------------------
 1797 dnl CF_CHECK_IPV6 version: 3 updated: 2004/01/22 17:38:22
 1798 dnl -------------
 1799 dnl Check for IPV6 configuration.
 1800 AC_DEFUN([CF_CHECK_IPV6],[
 1801 CF_FIND_IPV6_TYPE
 1802 CF_FIND_IPV6_LIBS
 1803 
 1804 CF_FUNC_GETADDRINFO
 1805 
 1806 if test "$cf_cv_getaddrinfo" != "yes"; then
 1807 	if test "$cf_cv_ipv6type" != "linux"; then
 1808 		AC_MSG_WARN(
 1809 [You must get working getaddrinfo() function,
 1810 or you can specify "--disable-ipv6"])
 1811 	else
 1812 		AC_MSG_WARN(
 1813 [The getaddrinfo() implementation on your system seems be buggy.
 1814 You should upgrade your system library to the newest version
 1815 of GNU C library (aka glibc).])
 1816 	fi
 1817 fi
 1818 
 1819 ])dnl
 1820 dnl ---------------------------------------------------------------------------
 1821 dnl CF_CHECK_NESTED_PARAMS version: 2 updated: 1997/08/28 23:57:55
 1822 dnl ----------------------
 1823 dnl Check if the compiler allows nested parameter lists (some don't)
 1824 AC_DEFUN([CF_CHECK_NESTED_PARAMS],
 1825 [
 1826 AC_MSG_CHECKING([if nested parameters work])
 1827 AC_CACHE_VAL(cf_cv_nested_params,[
 1828 	AC_TRY_COMPILE([],
 1829 	[extern void (*sigdisp(int sig, void (*func)(int sig)))(int sig)],
 1830 	[cf_cv_nested_params=yes],
 1831 	[cf_cv_nested_params=no])
 1832 ])
 1833 AC_MSG_RESULT($cf_cv_nested_params)
 1834 test $cf_cv_nested_params = yes && AC_DEFINE(HAVE_NESTED_PARAMS)
 1835 ])dnl
 1836 dnl ---------------------------------------------------------------------------
 1837 dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35
 1838 dnl -----------------
 1839 dnl Check if the given compiler is really clang.  clang's C driver defines
 1840 dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
 1841 dnl not ignore some gcc options.
 1842 dnl
 1843 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
 1844 dnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
 1845 dnl the wrappers for gcc and g++ warnings.
 1846 dnl
 1847 dnl $1 = GCC (default) or GXX
 1848 dnl $2 = CLANG_COMPILER (default)
 1849 dnl $3 = CFLAGS (default) or CXXFLAGS
 1850 AC_DEFUN([CF_CLANG_COMPILER],[
 1851 ifelse([$2],,CLANG_COMPILER,[$2])=no
 1852 
 1853 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
 1854 	AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
 1855 	cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
 1856 	ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
 1857 	AC_TRY_COMPILE([],[
 1858 #ifdef __clang__
 1859 #else
 1860 make an error
 1861 #endif
 1862 ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
 1863 cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
 1864 ],[])
 1865 	ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
 1866 	AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
 1867 fi
 1868 ])
 1869 dnl ---------------------------------------------------------------------------
 1870 dnl CF_COLOR_CURSES version: 8 updated: 2012/11/08 20:57:52
 1871 dnl ---------------
 1872 dnl Check if curses supports color.  (Note that while SVr3 curses supports
 1873 dnl color, it does this differently from SVr4 curses; more work would be needed
 1874 dnl to accommodate SVr3).
 1875 dnl
 1876 AC_DEFUN([CF_COLOR_CURSES],
 1877 [
 1878 AC_MSG_CHECKING(if curses supports color attributes)
 1879 AC_CACHE_VAL(cf_cv_color_curses,[
 1880 	AC_TRY_LINK([
 1881 #include <${cf_cv_ncurses_header:-curses.h}>
 1882 ],
 1883 	[chtype x = COLOR_BLUE;
 1884 	 has_colors();
 1885 	 start_color();
 1886 #ifndef NCURSES_BROKEN
 1887 	 wbkgd(curscr, getbkgd(stdscr)); /* X/Open XPG4 aka SVr4 Curses */
 1888 #endif
 1889 	],
 1890 	[cf_cv_color_curses=yes],
 1891 	[cf_cv_color_curses=no])
 1892 	])
 1893 AC_MSG_RESULT($cf_cv_color_curses)
 1894 if test $cf_cv_color_curses = yes ; then
 1895 	AC_DEFINE(COLOR_CURSES,1,[Define to 1 if if curses supports color attributes])
 1896 	test ".$cf_cv_ncurses_broken" != .yes && AC_DEFINE(HAVE_GETBKGD,1,[Define to 1 if curses has getbkgd function])
 1897 fi
 1898 ])dnl
 1899 dnl ---------------------------------------------------------------------------
 1900 dnl CF_COMPTYPE version: 2 updated: 1997/08/28 23:57:55
 1901 dnl -----------
 1902 dnl Check if the compiler uses 'void *' for qsort's compare function parameters
 1903 dnl (i.e., it's an ANSI prototype).
 1904 AC_DEFUN([CF_COMPTYPE],
 1905 [
 1906 AC_MSG_CHECKING([for ANSI qsort])
 1907 AC_CACHE_VAL(cf_cv_comptype,[
 1908 	AC_TRY_COMPILE([
 1909 #ifdef HAVE_STDLIB_H
 1910 #include <stdlib.h>
 1911 #endif],
 1912 	[extern int compare(const void *, const void *);
 1913 	 char *foo = "string";
 1914 	 qsort(foo, sizeof(foo)/sizeof(*foo), sizeof(*foo), compare)],
 1915 	[cf_cv_comptype=yes],
 1916 	[cf_cv_comptype=no])
 1917 ])
 1918 AC_MSG_RESULT($cf_cv_comptype)
 1919 if test $cf_cv_comptype = yes; then
 1920 	AC_DEFINE(HAVE_COMPTYPE_VOID)
 1921 else
 1922 	AC_DEFINE(HAVE_COMPTYPE_CHAR)
 1923 fi
 1924 ])dnl
 1925 dnl ---------------------------------------------------------------------------
 1926 dnl CF_COREFILE version: 4 updated: 2010/10/23 15:52:32
 1927 dnl -----------
 1928 dnl Check if the application can dump core (for debugging).
 1929 AC_DEFUN([CF_COREFILE],
 1930 [
 1931 AC_MSG_CHECKING([if application can dump core])
 1932 AC_CACHE_VAL(cf_cv_corefile,[
 1933 	AC_TRY_RUN([
 1934 #include <signal.h>
 1935 #include <sys/types.h>
 1936 #include <sys/stat.h>
 1937 int found()
 1938 {
 1939 	struct stat sb;
 1940 	return ((stat("core", &sb) == 0			/* UNIX */
 1941 	   ||    stat("conftest.core", &sb) == 0	/* FreeBSD */
 1942 		)
 1943 		&& ((sb.st_mode & S_IFMT) == S_IFREG));
 1944 }
 1945 int main()
 1946 {
 1947 #ifdef __amiga__
 1948 /* Nicholas d'Alterio (nagd@ic.ac.uk) reports that the check for ability to
 1949  * core dump causes the machine to crash - reason unknown (gcc 2.7.2)
 1950  */
 1951 	${cf_cv_main_return:-return}(1);
 1952 #else
 1953 	int	pid, status;
 1954 	if (found())
 1955 		unlink("core");
 1956 	if (found())
 1957 		${cf_cv_main_return:-return}(1);
 1958 	if ((pid = fork()) != 0) {
 1959 		while (wait(&status) <= 0)
 1960 			;
 1961 	} else {
 1962 		abort();	/* this will dump core, if anything will */
 1963 	}
 1964 	if (found()) {
 1965 		unlink("core");
 1966 		${cf_cv_main_return:-return}(0);
 1967 	}
 1968 	${cf_cv_main_return:-return}(1);
 1969 #endif
 1970 }],
 1971 	[cf_cv_corefile=yes],
 1972 	[cf_cv_corefile=no],
 1973 	[cf_cv_corefile=unknown])])
 1974 AC_MSG_RESULT($cf_cv_corefile)
 1975 test $cf_cv_corefile = yes && AC_DEFINE(HAVE_COREFILE)
 1976 ])dnl
 1977 dnl ---------------------------------------------------------------------------
 1978 dnl CF_CPP_CONCATS version: 2 updated: 1997/08/28 23:57:55
 1979 dnl --------------
 1980 dnl Test for ANSI token expansion (used in 'assert').
 1981 AC_DEFUN([CF_CPP_CONCATS],
 1982 [
 1983 AC_MSG_CHECKING([for ansi token concatenation])
 1984 AC_CACHE_VAL(cf_cv_cpp_concats,[
 1985 	AC_TRY_COMPILE([
 1986 #define concat(a,b) a ## b],
 1987 	[char *firstlast = "y", *s = concat(first,last)],
 1988 	[cf_cv_cpp_concats=yes],
 1989 	[cf_cv_cpp_concats=no])
 1990 ])
 1991 AC_MSG_RESULT($cf_cv_cpp_concats)
 1992 test $cf_cv_cpp_concats = yes && AC_DEFINE(CPP_DOES_CONCAT)
 1993 ])dnl
 1994 dnl ---------------------------------------------------------------------------
 1995 dnl CF_CPP_EXPANDS version: 2 updated: 1997/08/28 23:57:55
 1996 dnl --------------
 1997 dnl Test for ANSI token expansion (used in 'assert').
 1998 AC_DEFUN([CF_CPP_EXPANDS],
 1999 [
 2000 AC_MSG_CHECKING([for ansi token expansion/substitution])
 2001 AC_CACHE_VAL(cf_cv_cpp_expands,[
 2002 	AC_TRY_COMPILE([
 2003 #define string(n) #n],
 2004 	[char *s = string(token)],
 2005 	[cf_cv_cpp_expands=yes],
 2006 	[cf_cv_cpp_expands=no])
 2007 ])
 2008 AC_MSG_RESULT($cf_cv_cpp_expands)
 2009 test $cf_cv_cpp_expands = yes && AC_DEFINE(CPP_DOES_EXPAND)
 2010 ])dnl
 2011 dnl ---------------------------------------------------------------------------
 2012 dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
 2013 dnl ----------------
 2014 dnl Tie together the configure-script macros for curses.  It may be ncurses,
 2015 dnl but unless asked, we do not make a special search for ncurses.  However,
 2016 dnl still check for the ncurses version number, for use in other macros.
 2017 AC_DEFUN([CF_CURSES_CONFIG],
 2018 [
 2019 CF_CURSES_CPPFLAGS
 2020 CF_NCURSES_VERSION
 2021 CF_CURSES_LIBS
 2022 ])dnl
 2023 dnl ---------------------------------------------------------------------------
 2024 dnl CF_CURSES_CPPFLAGS version: 13 updated: 2018/06/20 20:23:13
 2025 dnl ------------------
 2026 dnl Look for the curses headers.
 2027 AC_DEFUN([CF_CURSES_CPPFLAGS],[
 2028 
 2029 AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
 2030 cf_cv_curses_incdir=no
 2031 case $host_os in
 2032 (hpux10.*)
 2033 	if test "x$cf_cv_screen" = "xcurses_colr"
 2034 	then
 2035 		test -d /usr/include/curses_colr && \
 2036 		cf_cv_curses_incdir="-I/usr/include/curses_colr"
 2037 	fi
 2038 	;;
 2039 (sunos3*|sunos4*)
 2040 	if test "x$cf_cv_screen" = "xcurses_5lib"
 2041 	then
 2042 		test -d /usr/5lib && \
 2043 		test -d /usr/5include && \
 2044 		cf_cv_curses_incdir="-I/usr/5include"
 2045 	fi
 2046 	;;
 2047 esac
 2048 ])
 2049 if test "$cf_cv_curses_incdir" != no
 2050 then
 2051 	CF_APPEND_TEXT(CPPFLAGS,$cf_cv_curses_incdir)
 2052 fi
 2053 
 2054 CF_CURSES_HEADER
 2055 CF_TERM_HEADER
 2056 ])dnl
 2057 dnl ---------------------------------------------------------------------------
 2058 dnl CF_CURSES_HEADER version: 5 updated: 2015/04/23 20:35:30
 2059 dnl ----------------
 2060 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
 2061 dnl variations of ncurses' installs.
 2062 dnl
 2063 dnl $1 = ncurses when looking for ncurses, or is empty
 2064 AC_DEFUN([CF_CURSES_HEADER],[
 2065 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
 2066 cf_cv_ncurses_header=none
 2067 for cf_header in \
 2068 	ncurses.h ifelse($1,,,[$1/ncurses.h]) \
 2069 	curses.h ifelse($1,,,[$1/curses.h]) ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
 2070 do
 2071 AC_TRY_COMPILE([#include <${cf_header}>],
 2072 	[initscr(); tgoto("?", 0,0)],
 2073 	[cf_cv_ncurses_header=$cf_header; break],[])
 2074 done
 2075 ])
 2076 
 2077 if test "$cf_cv_ncurses_header" = none ; then
 2078 	AC_MSG_ERROR(No curses header-files found)
 2079 fi
 2080 
 2081 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
 2082 AC_CHECK_HEADERS($cf_cv_ncurses_header)
 2083 ])dnl
 2084 dnl ---------------------------------------------------------------------------
 2085 dnl CF_CURSES_LIBS version: 42 updated: 2018/06/20 20:23:13
 2086 dnl --------------
 2087 dnl Look for the curses libraries.  Older curses implementations may require
 2088 dnl termcap/termlib to be linked as well.  Call CF_CURSES_CPPFLAGS first.
 2089 AC_DEFUN([CF_CURSES_LIBS],[
 2090 
 2091 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
 2092 AC_MSG_CHECKING(if we have identified curses libraries)
 2093 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 2094 	[initscr(); tgoto("?", 0,0)],
 2095 	cf_result=yes,
 2096 	cf_result=no)
 2097 AC_MSG_RESULT($cf_result)
 2098 
 2099 if test "$cf_result" = no ; then
 2100 case $host_os in
 2101 (freebsd*)
 2102 	AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
 2103 	;;
 2104 (hpux10.*)
 2105 	# Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr
 2106 	# next (1998), and xcurses "newer" (2000).  There is no header file for
 2107 	# Hcurses; the subdirectory curses_colr has the headers (curses.h and
 2108 	# term.h) for cur_colr
 2109 	if test "x$cf_cv_screen" = "xcurses_colr"
 2110 	then
 2111 		AC_CHECK_LIB(cur_colr,initscr,[
 2112 			CF_ADD_LIBS(-lcur_colr)
 2113 			ac_cv_func_initscr=yes
 2114 			],[
 2115 		AC_CHECK_LIB(Hcurses,initscr,[
 2116 			# HP's header uses __HP_CURSES, but user claims _HP_CURSES.
 2117 			CF_ADD_LIBS(-lHcurses)
 2118 			CF_APPEND_TEXT(CPPFLAGS,-D__HP_CURSES -D_HP_CURSES)
 2119 			ac_cv_func_initscr=yes
 2120 			])])
 2121 	fi
 2122 	;;
 2123 (linux*)
 2124 	case `arch 2>/dev/null` in
 2125 	(x86_64)
 2126 		if test -d /lib64
 2127 		then
 2128 			CF_ADD_LIBDIR(/lib64)
 2129 		else
 2130 			CF_ADD_LIBDIR(/lib)
 2131 		fi
 2132 		;;
 2133 	(*)
 2134 		CF_ADD_LIBDIR(/lib)
 2135 		;;
 2136 	esac
 2137 	;;
 2138 (sunos3*|sunos4*)
 2139 	if test "x$cf_cv_screen" = "xcurses_5lib"
 2140 	then
 2141 		if test -d /usr/5lib ; then
 2142 			CF_ADD_LIBDIR(/usr/5lib)
 2143 			CF_ADD_LIBS(-lcurses -ltermcap)
 2144 		fi
 2145 	fi
 2146 	ac_cv_func_initscr=yes
 2147 	;;
 2148 esac
 2149 
 2150 if test ".$ac_cv_func_initscr" != .yes ; then
 2151 	cf_save_LIBS="$LIBS"
 2152 
 2153 	if test ".${cf_cv_ncurses_version:-no}" != .no
 2154 	then
 2155 		cf_check_list="ncurses curses cursesX"
 2156 	else
 2157 		cf_check_list="cursesX curses ncurses"
 2158 	fi
 2159 
 2160 	# Check for library containing tgoto.  Do this before curses library
 2161 	# because it may be needed to link the test-case for initscr.
 2162 	if test "x$cf_term_lib" = x
 2163 	then
 2164 		AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
 2165 			for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown
 2166 			do
 2167 				AC_CHECK_LIB($cf_term_lib,tgoto,[
 2168 					: ${cf_nculib_root:=$cf_term_lib}
 2169 					break
 2170 				])
 2171 			done
 2172 		])
 2173 	fi
 2174 
 2175 	# Check for library containing initscr
 2176 	test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
 2177 	if test "x$cf_curs_lib" = x
 2178 	then
 2179 		for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
 2180 		do
 2181 			LIBS="-l$cf_curs_lib $cf_save_LIBS"
 2182 			if test "$cf_term_lib" = unknown || test "$cf_term_lib" = "$cf_curs_lib" ; then
 2183 				AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
 2184 				AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 2185 					[initscr()],
 2186 					[cf_result=yes],
 2187 					[cf_result=no])
 2188 				AC_MSG_RESULT($cf_result)
 2189 				test $cf_result = yes && break
 2190 			elif test "$cf_curs_lib" = "$cf_term_lib" ; then
 2191 				cf_result=no
 2192 			elif test "$cf_term_lib" != predefined ; then
 2193 				AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
 2194 				AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 2195 					[initscr(); tgoto((char *)0, 0, 0);],
 2196 					[cf_result=no],
 2197 					[
 2198 					LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
 2199 					AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 2200 						[initscr()],
 2201 						[cf_result=yes],
 2202 						[cf_result=error])
 2203 					])
 2204 				AC_MSG_RESULT($cf_result)
 2205 				test $cf_result != error && break
 2206 			fi
 2207 		done
 2208 	fi
 2209 	test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
 2210 fi
 2211 fi
 2212 
 2213 ])dnl
 2214 dnl ---------------------------------------------------------------------------
 2215 dnl CF_CURSES_TERMCAP version: 12 updated: 2015/05/15 19:42:24
 2216 dnl -----------------
 2217 dnl Check if we should include <curses.h> to pick up prototypes for termcap
 2218 dnl functions.  On terminfo systems, these are normally declared in <curses.h>,
 2219 dnl but may be in <term.h>.  We check for termcap.h as an alternate, but it
 2220 dnl isn't standard (usually associated with GNU termcap).
 2221 dnl
 2222 dnl The 'tgoto()' function is declared in both terminfo and termcap.
 2223 dnl
 2224 dnl See CF_TYPE_OUTCHAR for more details.
 2225 AC_DEFUN([CF_CURSES_TERMCAP],
 2226 [
 2227 AC_REQUIRE([CF_CURSES_TERM_H])
 2228 AC_CACHE_CHECK(if we should include curses.h or termcap.h, cf_cv_need_curses_h,[
 2229 cf_save_CPPFLAGS="$CPPFLAGS"
 2230 cf_cv_need_curses_h=no
 2231 
 2232 for cf_t_opts in "" "NEED_TERMCAP_H"
 2233 do
 2234 for cf_c_opts in "" "NEED_CURSES_H"
 2235 do
 2236 
 2237     CPPFLAGS="$cf_save_CPPFLAGS $CHECK_DECL_FLAG"
 2238     test -n "$cf_c_opts" && CPPFLAGS="$CPPFLAGS -D$cf_c_opts"
 2239     test -n "$cf_t_opts" && CPPFLAGS="$CPPFLAGS -D$cf_t_opts"
 2240 
 2241     AC_TRY_LINK([/* $cf_c_opts $cf_t_opts */
 2242 $CHECK_DECL_HDRS],
 2243 	[char *x = (char *)tgoto("")],
 2244 	[test "$cf_cv_need_curses_h" = no && {
 2245 	     cf_cv_need_curses_h=maybe
 2246 	     cf_ok_c_opts=$cf_c_opts
 2247 	     cf_ok_t_opts=$cf_t_opts
 2248 	}],
 2249 	[echo "Recompiling with corrected call (C:$cf_c_opts, T:$cf_t_opts)" >&AC_FD_CC
 2250 	AC_TRY_LINK([
 2251 $CHECK_DECL_HDRS],
 2252 	[char *x = (char *)tgoto("",0,0)],
 2253 	[cf_cv_need_curses_h=yes
 2254 	 cf_ok_c_opts=$cf_c_opts
 2255 	 cf_ok_t_opts=$cf_t_opts])])
 2256 
 2257 	CPPFLAGS="$cf_save_CPPFLAGS"
 2258 	test "$cf_cv_need_curses_h" = yes && break
 2259 done
 2260 	test "$cf_cv_need_curses_h" = yes && break
 2261 done
 2262 
 2263 if test "$cf_cv_need_curses_h" != no ; then
 2264 	echo "Curses/termcap test = $cf_cv_need_curses_h (C:$cf_ok_c_opts, T:$cf_ok_t_opts)" >&AC_FD_CC
 2265 	if test -n "$cf_ok_c_opts" ; then
 2266 		if test -n "$cf_ok_t_opts" ; then
 2267 			cf_cv_need_curses_h=both
 2268 		else
 2269 			cf_cv_need_curses_h=curses.h
 2270 		fi
 2271 	elif test -n "$cf_ok_t_opts" ; then
 2272 		cf_cv_need_curses_h=termcap.h
 2273 	elif test "$cf_cv_term_header" != no ; then
 2274 		cf_cv_need_curses_h=term.h
 2275 	else
 2276 		cf_cv_need_curses_h=no
 2277 	fi
 2278 fi
 2279 ])
 2280 
 2281 case $cf_cv_need_curses_h in
 2282 (both)
 2283 	AC_DEFINE_UNQUOTED(NEED_CURSES_H,1,[Define to 1 if we must include curses.h])
 2284 	AC_DEFINE_UNQUOTED(NEED_TERMCAP_H,1,[Define to 1 if we must include termcap.h])
 2285 	;;
 2286 (curses.h)
 2287 	AC_DEFINE_UNQUOTED(NEED_CURSES_H,1,[Define to 1 if we must include curses.h])
 2288 	;;
 2289 (term.h)
 2290 	AC_DEFINE_UNQUOTED(NEED_TERM_H,1,[Define to 1 if we must include term.h])
 2291 	;;
 2292 (termcap.h)
 2293 	AC_DEFINE_UNQUOTED(NEED_TERMCAP_H,1,[Define to 1 if we must include termcap.h])
 2294 	;;
 2295 esac
 2296 
 2297 ])dnl
 2298 dnl ---------------------------------------------------------------------------
 2299 dnl CF_CURSES_TERM_H version: 11 updated: 2015/04/15 19:08:48
 2300 dnl ----------------
 2301 dnl SVr4 curses should have term.h as well (where it puts the definitions of
 2302 dnl the low-level interface).  This may not be true in old/broken implementations,
 2303 dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
 2304 dnl running with Solaris 2.5.1).
 2305 AC_DEFUN([CF_CURSES_TERM_H],
 2306 [
 2307 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
 2308 
 2309 AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
 2310 
 2311 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
 2312 # for <term.h> if we do not find the variant.
 2313 
 2314 cf_header_list="term.h ncurses/term.h ncursesw/term.h"
 2315 
 2316 case ${cf_cv_ncurses_header:-curses.h} in
 2317 (*/*)
 2318 	cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
 2319 	cf_header_list="$cf_header_item $cf_header_list"
 2320 	;;
 2321 esac
 2322 
 2323 for cf_header in $cf_header_list
 2324 do
 2325 	AC_TRY_COMPILE([
 2326 #include <${cf_cv_ncurses_header:-curses.h}>
 2327 #include <${cf_header}>],
 2328 	[WINDOW *x],
 2329 	[cf_cv_term_header=$cf_header
 2330 	 break],
 2331 	[cf_cv_term_header=no])
 2332 done
 2333 
 2334 case $cf_cv_term_header in
 2335 (no)
 2336 	# If curses is ncurses, some packagers still mess it up by trying to make
 2337 	# us use GNU termcap.  This handles the most common case.
 2338 	for cf_header in ncurses/term.h ncursesw/term.h
 2339 	do
 2340 		AC_TRY_COMPILE([
 2341 #include <${cf_cv_ncurses_header:-curses.h}>
 2342 #ifdef NCURSES_VERSION
 2343 #include <${cf_header}>
 2344 #else
 2345 make an error
 2346 #endif],
 2347 			[WINDOW *x],
 2348 			[cf_cv_term_header=$cf_header
 2349 			 break],
 2350 			[cf_cv_term_header=no])
 2351 	done
 2352 	;;
 2353 esac
 2354 ])
 2355 
 2356 case $cf_cv_term_header in
 2357 (term.h)
 2358 	AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
 2359 	;;
 2360 (ncurses/term.h)
 2361 	AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
 2362 	;;
 2363 (ncursesw/term.h)
 2364 	AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
 2365 	;;
 2366 esac
 2367 ])dnl
 2368 dnl ---------------------------------------------------------------------------
 2369 dnl CF_DEFAULT_SHELL version: 6 updated: 2005/09/29 07:32:03
 2370 dnl ----------------
 2371 dnl Look for a Bourne-shell compatible program from a list that we know about:
 2372 dnl	ash	Almquist Shell (sh based)
 2373 dnl	bash	Bourne Again Shell (sh, ksh based)
 2374 dnl	dash	Debian Almquist Shell (sh based)
 2375 dnl	jsh	Job Control Bourne Shell (sh based)
 2376 dnl	keysh	Key Shell (ksh based)
 2377 dnl	ksh	Korn Shell (sh based)
 2378 dnl	mksh	MirBSD Korn shell (pdksh based)
 2379 dnl	pdksh	Public-domain ksh
 2380 dnl	sh	Bourne Shell or POSIX Shell
 2381 dnl	zsh	Z Shell (sh, ksh based)
 2382 dnl On BSD systems look for a C Shell compatible program:
 2383 dnl	csh	C Shell
 2384 dnl	tcsh	TENEX C Shell (csh based)
 2385 AC_DEFUN([CF_DEFAULT_SHELL],
 2386 [
 2387 AC_MSG_CHECKING(for the default shell program)
 2388 cf_shell_progs="ifelse($1,,sh,[$1])"
 2389 if test -z "$cf_shell_progs" ; then
 2390 	cf_shell_progs="sh ksh bash zsh pdksh mksh jsh keysh ash dash"
 2391 	# TIN preferred default shell for BSD systems is csh. Others are sh.
 2392 	AC_TRY_COMPILE([
 2393 #include <sys/params.h>],[
 2394 #if (defined(BSD) && (BSD >= 199103))
 2395 #else
 2396 make an error
 2397 #endif
 2398 ],[$cf_shell_progs="csh tcsh $cf_shell_progs"])
 2399 fi
 2400 CF_MSG_LOG(paths of shell programs: $cf_shell_progs)
 2401 if test -s /etc/shells && test `egrep -c -v '^(#| |    |$)' /etc/shells` -gt 0; then
 2402 	CF_MSG_LOG(/etc/shells)
 2403 	for cf_prog in $cf_shell_progs
 2404 	do
 2405 		case $cf_prog in
 2406 			/*)
 2407 				cf_pattern="^"$cf_prog"$"
 2408 				;;
 2409 			*/*)
 2410 				AC_MSG_ERROR(Program name must be absolute or filename: $cf_prog)
 2411 				;;
 2412 			*)
 2413 				cf_pattern="/"$cf_prog"$"
 2414 				;;
 2415 		esac
 2416 		cf_path=`egrep $cf_pattern /etc/shells 2>/dev/null`
 2417 		if test -n "$cf_path"
 2418 		then
 2419 			for cf_shell in $cf_path
 2420 			do
 2421 				if test -f "$cf_shell"
 2422 				then
 2423 					DEFAULT_SHELL="$cf_shell"
 2424 					break
 2425 				fi
 2426 			done
 2427 		fi
 2428 		if test -n "$DEFAULT_SHELL"
 2429 		then
 2430 			break
 2431 		fi
 2432 	done
 2433 	AC_MSG_RESULT($DEFAULT_SHELL)
 2434 else
 2435 	CF_MSG_LOG($PATH)
 2436 AC_PATH_PROGS(DEFAULT_SHELL,
 2437 	$cf_shell_progs,,
 2438 	$PATH:/bin:/usr/bin:/usr/xpg4/bin:/bin/posix:/usr/bin/posix:/usr/old/bin:/usr/local/bin)
 2439 fi
 2440 if test -z "$DEFAULT_SHELL" ; then
 2441 	AC_MSG_WARN(
 2442 Cannot find the default shell you specified: $cf_shell_progs)
 2443 	if test -f /bin/false ; then
 2444 		AC_MSG_WARN(Using /bin/false instead)
 2445 		DEFAULT_SHELL=/bin/false
 2446 	else
 2447 		AC_MSG_ERROR(Cannot use /bin/false because it does not exist)
 2448 	fi
 2449 fi
 2450 AC_DEFINE_UNQUOTED(DEFAULT_SHELL,"$DEFAULT_SHELL")
 2451 ])dnl
 2452 dnl ---------------------------------------------------------------------------
 2453 dnl CF_DEFINE_STRING version: 2 updated: 2001/07/22 21:09:16
 2454 dnl ----------------
 2455 dnl Define a string which may contain escaped quotes or backslashes
 2456 dnl $1 = symbol to define
 2457 dnl $2 = the information we want to quote
 2458 AC_DEFUN([CF_DEFINE_STRING],
 2459 [
 2460 cf_define=`echo $2|sed -e 's/\\\\/\\\\134/g' -e 's/^[[ 	]]\\+//' -e 's/[[ 	]]\\+$//' -e 's/"/\\\\042/g'`
 2461 AC_DEFINE_UNQUOTED($1, "$cf_define")
 2462 ])dnl
 2463 dnl ---------------------------------------------------------------------------
 2464 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
 2465 dnl ----------
 2466 dnl "dirname" is not portable, so we fake it with a shell script.
 2467 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
 2468 dnl ---------------------------------------------------------------------------
 2469 dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57
 2470 dnl ---------------
 2471 dnl You can always use "make -n" to see the actual options, but it's hard to
 2472 dnl pick out/analyze warning messages when the compile-line is long.
 2473 dnl
 2474 dnl Sets:
 2475 dnl	ECHO_LT - symbol to control if libtool is verbose
 2476 dnl	ECHO_LD - symbol to prefix "cc -o" lines
 2477 dnl	RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
 2478 dnl	SHOW_CC - symbol to put before explicit "cc -c" lines
 2479 dnl	ECHO_CC - symbol to put before any "cc" line
 2480 dnl
 2481 AC_DEFUN([CF_DISABLE_ECHO],[
 2482 AC_MSG_CHECKING(if you want to see long compiling messages)
 2483 CF_ARG_DISABLE(echo,
 2484 	[  --disable-echo          do not display "compiling" commands],
 2485 	[
 2486 	ECHO_LT='--silent'
 2487 	ECHO_LD='@echo linking [$]@;'
 2488 	RULE_CC='@echo compiling [$]<'
 2489 	SHOW_CC='@echo compiling [$]@'
 2490 	ECHO_CC='@'
 2491 ],[
 2492 	ECHO_LT=''
 2493 	ECHO_LD=''
 2494 	RULE_CC=''
 2495 	SHOW_CC=''
 2496 	ECHO_CC=''
 2497 ])
 2498 AC_MSG_RESULT($enableval)
 2499 AC_SUBST(ECHO_LT)
 2500 AC_SUBST(ECHO_LD)
 2501 AC_SUBST(RULE_CC)
 2502 AC_SUBST(SHOW_CC)
 2503 AC_SUBST(ECHO_CC)
 2504 ])dnl
 2505 dnl ---------------------------------------------------------------------------
 2506 dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
 2507 dnl --------
 2508 dnl Check if 'errno' is declared in <errno.h>
 2509 AC_DEFUN([CF_ERRNO],
 2510 [
 2511 CF_CHECK_ERRNO(errno)
 2512 ])dnl
 2513 dnl ---------------------------------------------------------------------------
 2514 dnl CF_FIND_IPV6_LIBS version: 8 updated: 2015/04/15 19:08:48
 2515 dnl -----------------
 2516 dnl Based on the IPV6 stack type, look for the corresponding library.
 2517 AC_DEFUN([CF_FIND_IPV6_LIBS],[
 2518 AC_REQUIRE([CF_FIND_IPV6_TYPE])
 2519 
 2520 cf_ipv6lib=none
 2521 cf_ipv6dir=none
 2522 
 2523 AC_MSG_CHECKING(for IPv6 library if required)
 2524 case $cf_cv_ipv6type in
 2525 (solaris)
 2526 	;;
 2527 (inria)
 2528 	;;
 2529 (kame)
 2530 	dnl http://www.kame.net/
 2531 	cf_ipv6lib=inet6
 2532 	cf_ipv6dir=v6
 2533 	;;
 2534 (linux-glibc)
 2535 	;;
 2536 (linux-libinet6)
 2537 	dnl http://www.v6.linux.or.jp/
 2538 	cf_ipv6lib=inet6
 2539 	cf_ipv6dir=inet6
 2540 	;;
 2541 (toshiba)
 2542 	cf_ipv6lib=inet6
 2543 	cf_ipv6dir=v6
 2544 	;;
 2545 (v6d)
 2546 	cf_ipv6lib=v6
 2547 	cf_ipv6dir=v6
 2548 	;;
 2549 (zeta)
 2550 	cf_ipv6lib=inet6
 2551 	cf_ipv6dir=v6
 2552 	;;
 2553 esac
 2554 AC_MSG_RESULT($cf_ipv6lib)
 2555 
 2556 if test "$cf_ipv6lib" != "none"; then
 2557 
 2558 	AC_TRY_LINK([
 2559 #include <sys/types.h>
 2560 #include <netdb.h>
 2561 #include <netinet/in.h>
 2562 #include <netinet/ip6.h>],
 2563 	[getaddrinfo(0, 0, 0, 0)],,[
 2564 	CF_HEADER_PATH(cf_search,$cf_ipv6dir)
 2565 	for cf_incdir in $cf_search
 2566 	do
 2567 		cf_header=$cf_incdir/netinet/ip6.h
 2568 		if test -f $cf_header
 2569 		then
 2570 			CF_ADD_INCDIR($cf_incdir)
 2571 			test -n "$verbose" && echo "	... found $cf_header" 1>&AC_FD_MSG
 2572 			break
 2573 		fi
 2574 		test -n "$verbose" && echo "	... tested $cf_header" 1>&AC_FD_MSG
 2575 	done
 2576 	])
 2577 
 2578 	CF_FIND_LIBRARY([$cf_ipv6lib],[$cf_ipv6dir],[
 2579 #include <sys/types.h>
 2580 #include <netdb.h>
 2581 #include <netinet/in.h>
 2582 #include <netinet/ip6.h>],
 2583 	[getaddrinfo(0, 0, 0, 0)],
 2584 	[getaddrinfo],
 2585 	noexit)
 2586 	if test $cf_found_library = no ; then
 2587 		AC_MSG_ERROR(
 2588 [No $cf_ipv6lib library found, cannot continue.  You must fetch lib$cf_ipv6lib.a
 2589 from an appropriate IPv6 kit and compile beforehand.])
 2590 	fi
 2591 fi
 2592 
 2593 ])dnl
 2594 dnl ---------------------------------------------------------------------------
 2595 dnl CF_FIND_IPV6_TYPE version: 6 updated: 2015/04/15 19:08:48
 2596 dnl -----------------
 2597 AC_DEFUN([CF_FIND_IPV6_TYPE],[
 2598 AC_CACHE_CHECK(ipv6 stack type, cf_cv_ipv6type, [
 2599 cf_cv_ipv6type=unknown
 2600 for i in solaris inria kame linux-glibc linux-libinet6 toshiba v6d zeta
 2601 do
 2602 	case $i in
 2603 	(solaris)
 2604 		if test "SunOS" = "`uname -s`"
 2605 		then
 2606 		  if test -f /usr/include/netinet/ip6.h
 2607 		  then
 2608 			cf_cv_ipv6type=$i
 2609 		  fi
 2610 		fi
 2611 		;;
 2612 	(inria)
 2613 		dnl http://www.kame.net/
 2614 		AC_EGREP_CPP(yes, [
 2615 #include <netinet/in.h>
 2616 #ifdef IPV6_INRIA_VERSION
 2617 yes
 2618 #endif],	[cf_cv_ipv6type=$i])
 2619 		;;
 2620 	(kame)
 2621 		dnl http://www.kame.net/
 2622 		AC_EGREP_CPP(yes, [
 2623 #include <netinet/in.h>
 2624 #ifdef __KAME__
 2625 yes
 2626 #endif],	[cf_cv_ipv6type=$i])
 2627 		;;
 2628 	(linux-glibc)
 2629 		dnl http://www.v6.linux.or.jp/
 2630 		AC_EGREP_CPP(yes, [
 2631 #include <features.h>
 2632 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
 2633 yes
 2634 #endif],	[cf_cv_ipv6type=$i])
 2635 		;;
 2636 	(linux-libinet6)
 2637 		dnl http://www.v6.linux.or.jp/
 2638 		if test -d /usr/inet6
 2639 		then
 2640 			cf_cv_ipv6type=$i
 2641 		elif test -f /usr/include/netinet/ip6.h
 2642 		then
 2643 			cf_cv_ipv6type=$i
 2644 		fi
 2645 		;;
 2646 	(toshiba)
 2647 		AC_EGREP_CPP(yes, [
 2648 #include <sys/param.h>
 2649 #ifdef _TOSHIBA_INET6
 2650 yes
 2651 #endif],	[cf_cv_ipv6type=$i])
 2652 		;;
 2653 	(v6d)
 2654 		AC_EGREP_CPP(yes, [
 2655 #include </usr/local/v6/include/sys/v6config.h>
 2656 #ifdef __V6D__
 2657 yes
 2658 #endif],	[cf_cv_ipv6type=$i])
 2659 		;;
 2660 	(zeta)
 2661 		AC_EGREP_CPP(yes, [
 2662 #include <sys/param.h>
 2663 #ifdef _ZETA_MINAMI_INET6
 2664 yes
 2665 #endif],	[cf_cv_ipv6type=$i])
 2666 		;;
 2667 	esac
 2668 	if test "$cf_cv_ipv6type" != "unknown"; then
 2669 		break
 2670 	fi
 2671 done
 2672 ])
 2673 ])dnl
 2674 dnl ---------------------------------------------------------------------------
 2675 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
 2676 dnl ---------------
 2677 dnl Look for a non-standard library, given parameters for AC_TRY_LINK.  We
 2678 dnl prefer a standard location, and use -L options only if we do not find the
 2679 dnl library in the standard library location(s).
 2680 dnl	$1 = library name
 2681 dnl	$2 = library class, usually the same as library name
 2682 dnl	$3 = includes
 2683 dnl	$4 = code fragment to compile/link
 2684 dnl	$5 = corresponding function-name
 2685 dnl	$6 = flag, nonnull if failure should not cause an error-exit
 2686 dnl
 2687 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
 2688 dnl to use a -L option.
 2689 AC_DEFUN([CF_FIND_LIBRARY],
 2690 [
 2691 	eval 'cf_cv_have_lib_'$1'=no'
 2692 	cf_libdir=""
 2693 	AC_CHECK_FUNC($5,
 2694 		eval 'cf_cv_have_lib_'$1'=yes',[
 2695 		cf_save_LIBS="$LIBS"
 2696 		AC_MSG_CHECKING(for $5 in -l$1)
 2697 		LIBS="-l$1 $LIBS"
 2698 		AC_TRY_LINK([$3],[$4],
 2699 			[AC_MSG_RESULT(yes)
 2700 			 eval 'cf_cv_have_lib_'$1'=yes'
 2701 			],
 2702 			[AC_MSG_RESULT(no)
 2703 			CF_LIBRARY_PATH(cf_search,$2)
 2704 			for cf_libdir in $cf_search
 2705 			do
 2706 				AC_MSG_CHECKING(for -l$1 in $cf_libdir)
 2707 				LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
 2708 				AC_TRY_LINK([$3],[$4],
 2709 					[AC_MSG_RESULT(yes)
 2710 			 		 eval 'cf_cv_have_lib_'$1'=yes'
 2711 					 break],
 2712 					[AC_MSG_RESULT(no)
 2713 					 LIBS="$cf_save_LIBS"])
 2714 			done
 2715 			])
 2716 		])
 2717 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
 2718 ifelse($6,,[
 2719 if test $cf_found_library = no ; then
 2720 	AC_MSG_ERROR(Cannot link $1 library)
 2721 fi
 2722 ])
 2723 ])dnl
 2724 dnl ---------------------------------------------------------------------------
 2725 dnl CF_FIND_LINKAGE version: 21 updated: 2018/06/20 20:23:13
 2726 dnl ---------------
 2727 dnl Find a library (specifically the linkage used in the code fragment),
 2728 dnl searching for it if it is not already in the library path.
 2729 dnl See also CF_ADD_SEARCHPATH.
 2730 dnl
 2731 dnl Parameters (4-on are optional):
 2732 dnl     $1 = headers for library entrypoint
 2733 dnl     $2 = code fragment for library entrypoint
 2734 dnl     $3 = the library name without the "-l" option or ".so" suffix.
 2735 dnl     $4 = action to perform if successful (default: update CPPFLAGS, etc)
 2736 dnl     $5 = action to perform if not successful
 2737 dnl     $6 = module name, if not the same as the library name
 2738 dnl     $7 = extra libraries
 2739 dnl
 2740 dnl Sets these variables:
 2741 dnl     $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
 2742 dnl     $cf_cv_header_path_$3 - include-directory if needed
 2743 dnl     $cf_cv_library_path_$3 - library-directory if needed
 2744 dnl     $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
 2745 AC_DEFUN([CF_FIND_LINKAGE],[
 2746 
 2747 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
 2748 # will be set on completion of the AC_TRY_LINK below.
 2749 cf_cv_header_path_$3=
 2750 cf_cv_library_path_$3=
 2751 
 2752 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
 2753 
 2754 cf_save_LIBS="$LIBS"
 2755 
 2756 AC_TRY_LINK([$1],[$2],[
 2757 	cf_cv_find_linkage_$3=yes
 2758 	cf_cv_header_path_$3=/usr/include
 2759 	cf_cv_library_path_$3=/usr/lib
 2760 ],[
 2761 
 2762 LIBS="-l$3 $7 $cf_save_LIBS"
 2763 
 2764 AC_TRY_LINK([$1],[$2],[
 2765 	cf_cv_find_linkage_$3=yes
 2766 	cf_cv_header_path_$3=/usr/include
 2767 	cf_cv_library_path_$3=/usr/lib
 2768 	cf_cv_library_file_$3="-l$3"
 2769 ],[
 2770 	cf_cv_find_linkage_$3=no
 2771 	LIBS="$cf_save_LIBS"
 2772 
 2773 	CF_VERBOSE(find linkage for $3 library)
 2774 	CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
 2775 
 2776 	cf_save_CPPFLAGS="$CPPFLAGS"
 2777 	cf_test_CPPFLAGS="$CPPFLAGS"
 2778 
 2779 	CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
 2780 	for cf_cv_header_path_$3 in $cf_search
 2781 	do
 2782 		if test -d $cf_cv_header_path_$3 ; then
 2783 			CF_VERBOSE(... testing $cf_cv_header_path_$3)
 2784 			CPPFLAGS="$cf_save_CPPFLAGS"
 2785 			CF_APPEND_TEXT(CPPFLAGS,-I$cf_cv_header_path_$3)
 2786 			AC_TRY_COMPILE([$1],[$2],[
 2787 				CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
 2788 				cf_cv_find_linkage_$3=maybe
 2789 				cf_test_CPPFLAGS="$CPPFLAGS"
 2790 				break],[
 2791 				CPPFLAGS="$cf_save_CPPFLAGS"
 2792 				])
 2793 		fi
 2794 	done
 2795 
 2796 	if test "$cf_cv_find_linkage_$3" = maybe ; then
 2797 
 2798 		CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
 2799 
 2800 		cf_save_LIBS="$LIBS"
 2801 		cf_save_LDFLAGS="$LDFLAGS"
 2802 
 2803 		ifelse([$6],,,[
 2804 		CPPFLAGS="$cf_test_CPPFLAGS"
 2805 		LIBS="-l$3 $7 $cf_save_LIBS"
 2806 		AC_TRY_LINK([$1],[$2],[
 2807 			CF_VERBOSE(... found $3 library in system)
 2808 			cf_cv_find_linkage_$3=yes])
 2809 			CPPFLAGS="$cf_save_CPPFLAGS"
 2810 			LIBS="$cf_save_LIBS"
 2811 			])
 2812 
 2813 		if test "$cf_cv_find_linkage_$3" != yes ; then
 2814 			CF_LIBRARY_PATH(cf_search,$3)
 2815 			for cf_cv_library_path_$3 in $cf_search
 2816 			do
 2817 				if test -d $cf_cv_library_path_$3 ; then
 2818 					CF_VERBOSE(... testing $cf_cv_library_path_$3)
 2819 					CPPFLAGS="$cf_test_CPPFLAGS"
 2820 					LIBS="-l$3 $7 $cf_save_LIBS"
 2821 					LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
 2822 					AC_TRY_LINK([$1],[$2],[
 2823 					CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
 2824 					cf_cv_find_linkage_$3=yes
 2825 					cf_cv_library_file_$3="-l$3"
 2826 					break],[
 2827 					CPPFLAGS="$cf_save_CPPFLAGS"
 2828 					LIBS="$cf_save_LIBS"
 2829 					LDFLAGS="$cf_save_LDFLAGS"
 2830 					])
 2831 				fi
 2832 			done
 2833 			CPPFLAGS="$cf_save_CPPFLAGS"
 2834 			LDFLAGS="$cf_save_LDFLAGS"
 2835 		fi
 2836 
 2837 	else
 2838 		cf_cv_find_linkage_$3=no
 2839 	fi
 2840 	],$7)
 2841 ])
 2842 
 2843 LIBS="$cf_save_LIBS"
 2844 
 2845 if test "$cf_cv_find_linkage_$3" = yes ; then
 2846 ifelse([$4],,[
 2847 	CF_ADD_INCDIR($cf_cv_header_path_$3)
 2848 	CF_ADD_LIBDIR($cf_cv_library_path_$3)
 2849 	CF_ADD_LIB($3)
 2850 ],[$4])
 2851 else
 2852 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
 2853 fi
 2854 ])dnl
 2855 dnl ---------------------------------------------------------------------------
 2856 dnl CF_FIX_SLASHES version: 2 updated: 2001/05/27 21:36:02
 2857 dnl --------------
 2858 dnl OS/2 and Cygwin ports may pick up backslashes in pathnames, which are not
 2859 dnl usable in quoted strings.  Fix them.
 2860 dnl	$1=fixed($2)
 2861 AC_DEFUN([CF_FIX_SLASHES],
 2862 [
 2863 case $cf_cv_system_name in #(vi
 2864 os2*|cygwin*)
 2865 	$1=`echo "[$]$1" | sed -e 's%\\\\%/%g'`
 2866 	;;
 2867 esac
 2868 ])dnl
 2869 dnl ---------------------------------------------------------------------------
 2870 dnl CF_FUNC_ALLOCA version: 2 updated: 2009/01/06 19:35:17
 2871 dnl --------------
 2872 dnl workaround for bison 1.875c (compound breakage in Linux stdlib.h and
 2873 dnl bison's output make bison try to use alloca()).
 2874 AC_DEFUN([CF_FUNC_ALLOCA],
 2875 [
 2876 AC_FUNC_ALLOCA
 2877 
 2878 case $host_os in
 2879 linux*|gnu*)
 2880 	# workaround for bison 1.875c (compound breakage in Linux stdlib.h
 2881 	# and bison's output make bison try to use alloca()).
 2882 	if test -z "$GCC" ; then
 2883 		CPPFLAGS="$CPPFLAGS -DYYSTACK_USE_ALLOCA=0"
 2884 		ALLOCA=""
 2885 	elif test "$INTEL_COMPILER" = yes ; then
 2886 		CPPFLAGS="$CPPFLAGS -DYYSTACK_USE_ALLOCA=0"
 2887 		ALLOCA=""
 2888 	fi
 2889 	;;
 2890 esac
 2891 ])dnl
 2892 dnl ---------------------------------------------------------------------------
 2893 dnl CF_FUNC_FORK version: 4 updated: 2010/10/23 15:52:32
 2894 dnl ------------
 2895 dnl Check if 'fork()' is available, and working.  Amiga (and possibly other
 2896 dnl machines) have a non-working 'fork()' entrypoint.
 2897 AC_DEFUN([CF_FUNC_FORK],
 2898 [AC_MSG_CHECKING([for fork])
 2899 AC_CACHE_VAL(cf_cv_func_fork,[
 2900 AC_TRY_RUN([
 2901 int main()
 2902 {
 2903 	if (fork() < 0)
 2904 		${cf_cv_main_return:-return}(1);
 2905 	${cf_cv_main_return:-return}(0);
 2906 }],	[cf_cv_func_fork=yes],
 2907 	[cf_cv_func_fork=no],
 2908 	[cf_cv_func_fork=unknown])
 2909 ])dnl
 2910 AC_MSG_RESULT($cf_cv_func_fork)
 2911 test $cf_cv_func_fork = yes && AC_DEFINE(HAVE_FORK)
 2912 ])dnl
 2913 dnl ---------------------------------------------------------------------------
 2914 dnl CF_FUNC_GETADDRINFO version: 9 updated: 2017/05/10 18:31:29
 2915 dnl -------------------
 2916 dnl Look for a working version of getaddrinfo(), for IPV6 support.
 2917 AC_DEFUN([CF_FUNC_GETADDRINFO],[
 2918 AC_CACHE_CHECK(working getaddrinfo, cf_cv_getaddrinfo,[
 2919 AC_TRY_RUN([
 2920 #include <sys/types.h>
 2921 #include <netdb.h>
 2922 #include <string.h>
 2923 #include <sys/socket.h>
 2924 #include <netinet/in.h>
 2925 
 2926 #define expect(a,b) if (strcmp(a,b) != 0) goto bad
 2927 
 2928 int main(void)
 2929 {
 2930    int passive, gaierr, inet4 = 0, inet6 = 0;
 2931    struct addrinfo hints, *ai, *aitop;
 2932    char straddr[INET6_ADDRSTRLEN], strport[16];
 2933 
 2934    for (passive = 0; passive <= 1; passive++) {
 2935      memset(&hints, 0, sizeof(hints));
 2936      hints.ai_family = AF_UNSPEC;
 2937      hints.ai_flags = passive ? AI_PASSIVE : 0;
 2938      hints.ai_socktype = SOCK_STREAM;
 2939      if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
 2940        (void)gai_strerror(gaierr);
 2941        goto bad;
 2942      }
 2943      for (ai = aitop; ai; ai = ai->ai_next) {
 2944        if (ai->ai_addr == NULL ||
 2945            ai->ai_addrlen == 0 ||
 2946            getnameinfo(ai->ai_addr, ai->ai_addrlen,
 2947                        straddr, sizeof(straddr), strport, sizeof(strport),
 2948                        NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
 2949          goto bad;
 2950        }
 2951        switch (ai->ai_family) {
 2952        case AF_INET:
 2953          expect(strport, "54321");
 2954          if (passive) {
 2955            expect(straddr, "0.0.0.0");
 2956          } else {
 2957            expect(straddr, "127.0.0.1");
 2958          }
 2959          inet4++;
 2960          break;
 2961        case AF_INET6:
 2962          expect(strport, "54321");
 2963          if (passive) {
 2964            expect(straddr, "::");
 2965          } else {
 2966            expect(straddr, "::1");
 2967          }
 2968          inet6++;
 2969          break;
 2970        case AF_UNSPEC:
 2971          goto bad;
 2972          break;
 2973        default:
 2974          /* another family support? */
 2975          break;
 2976        }
 2977      }
 2978    }
 2979 
 2980    if (!(inet4 == 0 || inet4 == 2))
 2981      goto bad;
 2982    if (!(inet6 == 0 || inet6 == 2))
 2983      goto bad;
 2984 
 2985    if (aitop)
 2986      freeaddrinfo(aitop);
 2987    ${cf_cv_main_return:-return}(0);
 2988 
 2989   bad:
 2990    if (aitop)
 2991      freeaddrinfo(aitop);
 2992    ${cf_cv_main_return:-return}(1);
 2993 }
 2994 ],
 2995 [cf_cv_getaddrinfo=yes],
 2996 [cf_cv_getaddrinfo=no],
 2997 [cf_cv_getaddrinfo=unknown])
 2998 ])
 2999 if test "$cf_cv_getaddrinfo" = yes ; then
 3000 	AC_DEFINE(HAVE_GAI_STRERROR,1,[Define to 1 if we have gai_strerror function])
 3001 	AC_DEFINE(HAVE_GETADDRINFO,1,[Define to 1 if we have getaddrinfo function])
 3002 fi
 3003 ])dnl
 3004 dnl ---------------------------------------------------------------------------
 3005 dnl CF_FUNC_MEMMOVE version: 9 updated: 2017/01/21 11:06:25
 3006 dnl ---------------
 3007 dnl Check for memmove, or a bcopy that can handle overlapping copy.  If neither
 3008 dnl is found, add our own version of memmove to the list of objects.
 3009 AC_DEFUN([CF_FUNC_MEMMOVE],
 3010 [
 3011 AC_CHECK_FUNC(memmove,,[
 3012 AC_CHECK_FUNC(bcopy,[
 3013 	AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
 3014 		AC_TRY_RUN([
 3015 int main(void) {
 3016 	static char data[] = "abcdefghijklmnopqrstuwwxyz";
 3017 	char temp[40];
 3018 	bcopy(data, temp, sizeof(data));
 3019 	bcopy(temp+10, temp, 15);
 3020 	bcopy(temp+5, temp+15, 10);
 3021 	${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
 3022 }
 3023 		],
 3024 		[cf_cv_good_bcopy=yes],
 3025 		[cf_cv_good_bcopy=no],
 3026 		[cf_cv_good_bcopy=unknown])
 3027 		])
 3028 	],[cf_cv_good_bcopy=no])
 3029 	if test "$cf_cv_good_bcopy" = yes ; then
 3030 		AC_DEFINE(USE_OK_BCOPY,1,[Define to 1 to use bcopy when memmove is unavailable])
 3031 	else
 3032 		AC_DEFINE(USE_MY_MEMMOVE,1,[Define to 1 to use replacement function when memmove is unavailable])
 3033 	fi
 3034 ])])dnl
 3035 dnl ---------------------------------------------------------------------------
 3036 dnl CF_FUNC_SYSTEM version: 5 updated: 2010/10/23 15:52:32
 3037 dnl --------------
 3038 dnl Check if the 'system()' function returns a usable status, or if not, try
 3039 dnl to use the status returned by a SIGCHLD.
 3040 AC_DEFUN([CF_FUNC_SYSTEM],
 3041 [
 3042 AC_REQUIRE([CF_UNION_WAIT])
 3043 AC_MSG_CHECKING(if the system function returns usable child-status)
 3044 AC_CACHE_VAL(cf_cv_system_status,[
 3045 	AC_TRY_RUN([
 3046 #include <stdio.h>
 3047 #include <signal.h>
 3048 #if HAVE_SYS_WAIT_H
 3049 #include <sys/wait.h>
 3050 #endif
 3051 
 3052 RETSIGTYPE signal_handler (int sig)
 3053 {
 3054 #if HAVE_TYPE_UNIONWAIT
 3055 	union wait wait_status;
 3056 #else
 3057 	int wait_status = 1;
 3058 #endif
 3059 	int system_status;
 3060 	wait (&wait_status);
 3061 	system_status = WEXITSTATUS(wait_status); /* should be nonzero */
 3062 	${cf_cv_main_return:-return}(system_status != 23);
 3063 }
 3064 
 3065 int main()
 3066 {
 3067 	/* this looks weird, but apparently the SIGCHLD gets there first on
 3068 	 * machines where 'system()' doesn't return a usable code, so ...
 3069 	 */
 3070 	signal (SIGCHLD, signal_handler);
 3071 	system("exit 23");
 3072 	${cf_cv_main_return:-return}(1);
 3073 }
 3074 ],
 3075 	[cf_cv_system_status=no],
 3076 	[AC_TRY_RUN(
 3077 	[int main() { ${cf_cv_main_return:-return}(system("exit 23") != (23 << 8)); }],
 3078 	[cf_cv_system_status=yes],
 3079 	[cf_cv_system_status=unknown],
 3080 	[cf_cv_system_status=unknown])],
 3081 	[cf_cv_system_status=unknown])
 3082 ])
 3083 AC_MSG_RESULT($cf_cv_system_status)
 3084 test $cf_cv_system_status = no && AC_DEFINE(USE_SYSTEM_STATUS)
 3085 ])dnl
 3086 dnl ---------------------------------------------------------------------------
 3087 dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
 3088 dnl --------------
 3089 dnl Find version of gcc
 3090 AC_DEFUN([CF_GCC_VERSION],[
 3091 AC_REQUIRE([AC_PROG_CC])
 3092 GCC_VERSION=none
 3093 if test "$GCC" = yes ; then
 3094 	AC_MSG_CHECKING(version of $CC)
 3095 	GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
 3096 	test -z "$GCC_VERSION" && GCC_VERSION=unknown
 3097 	AC_MSG_RESULT($GCC_VERSION)
 3098 fi
 3099 ])dnl
 3100 dnl ---------------------------------------------------------------------------
 3101 dnl CF_GCC_WARNINGS version: 33 updated: 2018/06/20 20:23:13
 3102 dnl ---------------
 3103 dnl Check if the compiler supports useful warning options.  There's a few that
 3104 dnl we don't use, simply because they're too noisy:
 3105 dnl
 3106 dnl	-Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
 3107 dnl	-Wredundant-decls (system headers make this too noisy)
 3108 dnl	-Wtraditional (combines too many unrelated messages, only a few useful)
 3109 dnl	-Wwrite-strings (too noisy, but should review occasionally).  This
 3110 dnl		is enabled for ncurses using "--enable-const".
 3111 dnl	-pedantic
 3112 dnl
 3113 dnl Parameter:
 3114 dnl	$1 is an optional list of gcc warning flags that a particular
 3115 dnl		application might want to use, e.g., "no-unused" for
 3116 dnl		-Wno-unused
 3117 dnl Special:
 3118 dnl	If $with_ext_const is "yes", add a check for -Wwrite-strings
 3119 dnl
 3120 AC_DEFUN([CF_GCC_WARNINGS],
 3121 [
 3122 AC_REQUIRE([CF_GCC_VERSION])
 3123 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
 3124 CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
 3125 
 3126 cat > conftest.$ac_ext <<EOF
 3127 #line __oline__ "${as_me:-configure}"
 3128 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
 3129 EOF
 3130 
 3131 if test "$INTEL_COMPILER" = yes
 3132 then
 3133 # The "-wdXXX" options suppress warnings:
 3134 # remark #1419: external declaration in primary source file
 3135 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
 3136 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
 3137 # remark #193: zero used for undefined preprocessing identifier
 3138 # remark #593: variable "curs_sb_left_arrow" was set but never used
 3139 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
 3140 # remark #869: parameter "tw" was never referenced
 3141 # remark #981: operands are evaluated in unspecified order
 3142 # warning #279: controlling expression is constant
 3143 
 3144 	AC_CHECKING([for $CC warning options])
 3145 	cf_save_CFLAGS="$CFLAGS"
 3146 	EXTRA_CFLAGS="-Wall"
 3147 	for cf_opt in \
 3148 		wd1419 \
 3149 		wd1683 \
 3150 		wd1684 \
 3151 		wd193 \
 3152 		wd593 \
 3153 		wd279 \
 3154 		wd810 \
 3155 		wd869 \
 3156 		wd981
 3157 	do
 3158 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
 3159 		if AC_TRY_EVAL(ac_compile); then
 3160 			test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
 3161 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 3162 		fi
 3163 	done
 3164 	CFLAGS="$cf_save_CFLAGS"
 3165 
 3166 elif test "$GCC" = yes
 3167 then
 3168 	AC_CHECKING([for $CC warning options])
 3169 	cf_save_CFLAGS="$CFLAGS"
 3170 	EXTRA_CFLAGS=
 3171 	cf_warn_CONST=""
 3172 	test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
 3173 	cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs"
 3174 	test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings=
 3175 	for cf_opt in W Wall \
 3176 		Wbad-function-cast \
 3177 		Wcast-align \
 3178 		Wcast-qual \
 3179 		Wdeclaration-after-statement \
 3180 		Wextra \
 3181 		Winline \
 3182 		Wmissing-declarations \
 3183 		Wmissing-prototypes \
 3184 		Wnested-externs \
 3185 		Wpointer-arith \
 3186 		Wshadow \
 3187 		Wstrict-prototypes \
 3188 		Wundef $cf_gcc_warnings $cf_warn_CONST $1
 3189 	do
 3190 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
 3191 		if AC_TRY_EVAL(ac_compile); then
 3192 			test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
 3193 			case $cf_opt in
 3194 			(Wcast-qual)
 3195 				CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES)
 3196 				;;
 3197 			(Winline)
 3198 				case $GCC_VERSION in
 3199 				([[34]].*)
 3200 					CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
 3201 					continue;;
 3202 				esac
 3203 				;;
 3204 			(Wpointer-arith)
 3205 				case $GCC_VERSION in
 3206 				([[12]].*)
 3207 					CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
 3208 					continue;;
 3209 				esac
 3210 				;;
 3211 			esac
 3212 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 3213 		fi
 3214 	done
 3215 	CFLAGS="$cf_save_CFLAGS"
 3216 fi
 3217 rm -rf conftest*
 3218 
 3219 AC_SUBST(EXTRA_CFLAGS)
 3220 ])dnl
 3221 dnl ---------------------------------------------------------------------------
 3222 dnl CF_GNU_SOURCE version: 9 updated: 2018/06/20 20:23:13
 3223 dnl -------------
 3224 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
 3225 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend.  This is a defect
 3226 dnl (or misfeature) of glibc2, which breaks portability of many applications,
 3227 dnl since it is interwoven with GNU extensions.
 3228 dnl
 3229 dnl Well, yes we could work around it...
 3230 dnl
 3231 dnl Parameters:
 3232 dnl	$1 is the nominal value for _XOPEN_SOURCE
 3233 AC_DEFUN([CF_GNU_SOURCE],
 3234 [
 3235 cf_gnu_xopen_source=ifelse($1,,500,$1)
 3236 
 3237 AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[
 3238 AC_TRY_COMPILE([#include <sys/types.h>],[
 3239 	#if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0
 3240 		return 0;
 3241 	#else
 3242 	#	error not GNU C library
 3243 	#endif],
 3244 	[cf_cv_gnu_library=yes],
 3245 	[cf_cv_gnu_library=no])
 3246 ])
 3247 
 3248 if test x$cf_cv_gnu_library = xyes; then
 3249 
 3250 	# With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE
 3251 	# was changed to help a little...
 3252 	AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[
 3253 		cf_save="$CPPFLAGS"
 3254 		CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
 3255 		AC_TRY_COMPILE([#include <sys/types.h>],[
 3256 			#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2)
 3257 				return 0;
 3258 			#else
 3259 			#	error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old
 3260 			#endif],
 3261 			[cf_cv_gnu_library_219=yes],
 3262 			[cf_cv_gnu_library_219=no])
 3263 		CPPFLAGS="$cf_save"
 3264 	])
 3265 
 3266 	if test "x$cf_cv_gnu_library_219" = xyes; then
 3267 		cf_save="$CPPFLAGS"
 3268 		AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[
 3269 			CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source)
 3270 			AC_TRY_COMPILE([
 3271 				#include <limits.h>
 3272 				#include <sys/types.h>
 3273 				],[
 3274 				#if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1)
 3275 					return 0;
 3276 				#else
 3277 				#	error GNU C library is too old
 3278 				#endif],
 3279 				[cf_cv_gnu_dftsrc_219=yes],
 3280 				[cf_cv_gnu_dftsrc_219=no])
 3281 			])
 3282 		test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save"
 3283 	else
 3284 		cf_cv_gnu_dftsrc_219=maybe
 3285 	fi
 3286 
 3287 	if test "x$cf_cv_gnu_dftsrc_219" != xyes; then
 3288 
 3289 		AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
 3290 		AC_TRY_COMPILE([#include <sys/types.h>],[
 3291 			#ifndef _XOPEN_SOURCE
 3292 			#error	expected _XOPEN_SOURCE to be defined
 3293 			#endif],
 3294 			[cf_cv_gnu_source=no],
 3295 			[cf_save="$CPPFLAGS"
 3296 			 CF_ADD_CFLAGS(-D_GNU_SOURCE)
 3297 			 AC_TRY_COMPILE([#include <sys/types.h>],[
 3298 				#ifdef _XOPEN_SOURCE
 3299 				#error	expected _XOPEN_SOURCE to be undefined
 3300 				#endif],
 3301 				[cf_cv_gnu_source=no],
 3302 				[cf_cv_gnu_source=yes])
 3303 			CPPFLAGS="$cf_save"
 3304 			])
 3305 		])
 3306 
 3307 		if test "$cf_cv_gnu_source" = yes
 3308 		then
 3309 		AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[
 3310 			CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE)
 3311 			AC_TRY_COMPILE([#include <sys/types.h>],[
 3312 				#ifdef _DEFAULT_SOURCE
 3313 				#error	expected _DEFAULT_SOURCE to be undefined
 3314 				#endif],
 3315 				[cf_cv_default_source=no],
 3316 				[cf_cv_default_source=yes])
 3317 			])
 3318 			if test "$cf_cv_default_source" = yes
 3319 			then
 3320 				CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
 3321 			fi
 3322 		fi
 3323 	fi
 3324 
 3325 fi
 3326 ])dnl
 3327 dnl ---------------------------------------------------------------------------
 3328 dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48
 3329 dnl --------------
 3330 dnl Construct a search-list of directories for a nonstandard header-file
 3331 dnl
 3332 dnl Parameters
 3333 dnl	$1 = the variable to return as result
 3334 dnl	$2 = the package name
 3335 AC_DEFUN([CF_HEADER_PATH],
 3336 [
 3337 $1=
 3338 
 3339 # collect the current set of include-directories from compiler flags
 3340 cf_header_path_list=""
 3341 if test -n "${CFLAGS}${CPPFLAGS}" ; then
 3342 	for cf_header_path in $CPPFLAGS $CFLAGS
 3343 	do
 3344 		case $cf_header_path in
 3345 		(-I*)
 3346 			cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
 3347 			CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
 3348 			cf_header_path_list="$cf_header_path_list [$]$1"
 3349 			;;
 3350 		esac
 3351 	done
 3352 fi
 3353 
 3354 # add the variations for the package we are looking for
 3355 CF_SUBDIR_PATH($1,$2,include)
 3356 
 3357 test "$includedir" != NONE && \
 3358 test "$includedir" != "/usr/include" && \
 3359 test -d "$includedir" && {
 3360 	test -d $includedir &&    $1="[$]$1 $includedir"
 3361 	test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
 3362 }
 3363 
 3364 test "$oldincludedir" != NONE && \
 3365 test "$oldincludedir" != "/usr/include" && \
 3366 test -d "$oldincludedir" && {
 3367 	test -d $oldincludedir    && $1="[$]$1 $oldincludedir"
 3368 	test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
 3369 }
 3370 
 3371 $1="[$]$1 $cf_header_path_list"
 3372 ])dnl
 3373 dnl ---------------------------------------------------------------------------
 3374 dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00
 3375 dnl -----------------
 3376 dnl Check if the given compiler is really the Intel compiler for Linux.  It
 3377 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
 3378 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
 3379 dnl
 3380 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
 3381 dnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
 3382 dnl the wrappers for gcc and g++ warnings.
 3383 dnl
 3384 dnl $1 = GCC (default) or GXX
 3385 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
 3386 dnl $3 = CFLAGS (default) or CXXFLAGS
 3387 AC_DEFUN([CF_INTEL_COMPILER],[
 3388 AC_REQUIRE([AC_CANONICAL_HOST])
 3389 ifelse([$2],,INTEL_COMPILER,[$2])=no
 3390 
 3391 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
 3392 	case $host_os in
 3393 	(linux*|gnu*)
 3394 		AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
 3395 		cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
 3396 		ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
 3397 		AC_TRY_COMPILE([],[
 3398 #ifdef __INTEL_COMPILER
 3399 #else
 3400 make an error
 3401 #endif
 3402 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
 3403 cf_save_CFLAGS="$cf_save_CFLAGS -we147"
 3404 ],[])
 3405 		ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
 3406 		AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
 3407 		;;
 3408 	esac
 3409 fi
 3410 ])dnl
 3411 dnl ---------------------------------------------------------------------------
 3412 dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48
 3413 dnl ---------------
 3414 dnl Construct a search-list of directories for a nonstandard library-file
 3415 dnl
 3416 dnl Parameters
 3417 dnl	$1 = the variable to return as result
 3418 dnl	$2 = the package name
 3419 AC_DEFUN([CF_LIBRARY_PATH],
 3420 [
 3421 $1=
 3422 cf_library_path_list=""
 3423 if test -n "${LDFLAGS}${LIBS}" ; then
 3424 	for cf_library_path in $LDFLAGS $LIBS
 3425 	do
 3426 		case $cf_library_path in
 3427 		(-L*)
 3428 			cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
 3429 			CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
 3430 			cf_library_path_list="$cf_library_path_list [$]$1"
 3431 			;;
 3432 		esac
 3433 	done
 3434 fi
 3435 
 3436 CF_SUBDIR_PATH($1,$2,lib)
 3437 
 3438 $1="$cf_library_path_list [$]$1"
 3439 ])dnl
 3440 dnl ---------------------------------------------------------------------------
 3441 dnl CF_LIB_PREFIX version: 12 updated: 2015/10/17 19:03:33
 3442 dnl -------------
 3443 dnl Compute the library-prefix for the given host system
 3444 dnl $1 = variable to set
 3445 define([CF_LIB_PREFIX],
 3446 [
 3447 	case $cf_cv_system_name in
 3448 	(OS/2*|os2*)
 3449 		if test "$DFT_LWR_MODEL" = libtool; then
 3450 			LIB_PREFIX='lib'
 3451 		else
 3452 			LIB_PREFIX=''
 3453 		fi
 3454 		;;
 3455 	(*)	LIB_PREFIX='lib'
 3456 		;;
 3457 	esac
 3458 ifelse($1,,,[$1=$LIB_PREFIX])
 3459 	AC_SUBST(LIB_PREFIX)
 3460 ])dnl
 3461 dnl ---------------------------------------------------------------------------
 3462 dnl CF_LOCKFILE version: 2 updated: 2001/05/26 12:41:02
 3463 dnl -----------
 3464 dnl Check for functions that we can use for file-locking.  Simply checking for
 3465 dnl existence is not sufficient, since fcntl, for example, uses definitions
 3466 dnl that are not in every version of the header.
 3467 AC_DEFUN([CF_LOCKFILE],
 3468 [
 3469 AC_CHECK_HEADERS(unistd.h fcntl.h sys/file.h)
 3470 AC_CHECK_FUNC(fcntl)
 3471 AC_CHECK_FUNC(lockf)
 3472 AC_CHECK_FUNC(flock,,,[
 3473 	CF_RECHECK_FUNC(flock,bsd,cf_cv_lockfile,[AC_MSG_WARN(no lock function found)])])
 3474 
 3475 AC_CACHE_CHECK(for file-locking functions,cf_cv_lockfile,[
 3476 cf_cv_lockfile=
 3477 for cf_lock in fcntl lockf flock
 3478 do
 3479 if eval 'test ${ac_cv_func_'$cf_lock'+set} = set'; then
 3480 	case $cf_lock in #(vi
 3481 	fcntl) #(vi
 3482 		AC_TRY_COMPILE([
 3483 #include <stdio.h>
 3484 #ifdef HAVE_UNISTD_H
 3485 #include <unistd.h>
 3486 #endif
 3487 #ifdef HAVE_FCNTL_H
 3488 #include <fcntl.h>
 3489 #endif
 3490 ],[
 3491 	struct flock flk;
 3492 	int block = 1;
 3493 	int fd = 0;
 3494 	int rc;
 3495 
 3496 	flk.l_type = F_WRLCK;
 3497 	flk.l_whence = SEEK_SET;
 3498 	flk.l_start = 0;
 3499 	flk.l_len = 0;
 3500 	rc = fcntl(fd, block ? F_SETLKW : F_SETLK, &flk)
 3501 	&& fcntl(fd, F_GETLK, &flk)
 3502 	&& fcntl(fd, F_SETLK, &flk);
 3503 	],,continue)
 3504 		;;
 3505 	lockf) #(vi
 3506 		AC_TRY_COMPILE([
 3507 #include <stdio.h>
 3508 #ifdef HAVE_UNISTD_H
 3509 #include <unistd.h>
 3510 #endif
 3511 #ifdef HAVE_FCNTL_H
 3512 #include <fcntl.h>
 3513 #endif
 3514 ],[
 3515 	int block = 1, fd = 0;
 3516 	int ret = lockf(fd, block ? F_LOCK : F_TLOCK, 0L)
 3517 	 && lockf(fd, F_TEST, 0L)
 3518 	 && lockf(fd, F_ULOCK, 0L);
 3519 	],,[continue])
 3520 		;;
 3521 	flock)
 3522 		AC_TRY_COMPILE([
 3523 #include <stdio.h>
 3524 #ifdef HAVE_UNISTD_H
 3525 #include <unistd.h>
 3526 #endif
 3527 #ifdef HAVE_FCNTL_H
 3528 #include <fcntl.h>
 3529 #endif
 3530 #ifdef HAVE_SYS_FILE_H
 3531 #include <sys/file.h>
 3532 #endif
 3533 ],[
 3534 	int block = 1, fd = 0;
 3535 	int ret = flock(fd, (LOCK_EX|LOCK_NB))
 3536 	 && flock(fd, LOCK_UN)
 3537 	 && flock(fd, block ? LOCK_EX : (LOCK_EX | LOCK_NB));
 3538 	],,[continue])
 3539 		;;
 3540 	esac
 3541 	cf_cv_lockfile="$cf_cv_lockfile $cf_lock"
 3542 fi
 3543 done
 3544 ])
 3545 ])dnl
 3546 dnl ---------------------------------------------------------------------------
 3547 dnl CF_MAKEFLAGS version: 18 updated: 2018/02/21 21:26:03
 3548 dnl ------------
 3549 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
 3550 dnl options to lower-levels.  It's very useful for "make -n" -- if we have it.
 3551 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
 3552 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
 3553 AC_DEFUN([CF_MAKEFLAGS],
 3554 [
 3555 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
 3556 	cf_cv_makeflags=''
 3557 	for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
 3558 	do
 3559 		cat >cf_makeflags.tmp <<CF_EOF
 3560 SHELL = $SHELL
 3561 all :
 3562 	@ echo '.$cf_option'
 3563 CF_EOF
 3564 		cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ 	]]*$,,'`
 3565 		case "$cf_result" in
 3566 		(.*k|.*kw)
 3567 			cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
 3568 			case "$cf_result" in
 3569 			(.*CC=*)	cf_cv_makeflags=
 3570 				;;
 3571 			(*)	cf_cv_makeflags=$cf_option
 3572 				;;
 3573 			esac
 3574 			break
 3575 			;;
 3576 		(.-)
 3577 			;;
 3578 		(*)
 3579 			CF_MSG_LOG(given option \"$cf_option\", no match \"$cf_result\")
 3580 			;;
 3581 		esac
 3582 	done
 3583 	rm -f cf_makeflags.tmp
 3584 ])
 3585 
 3586 AC_SUBST(cf_cv_makeflags)
 3587 ])dnl
 3588 dnl ---------------------------------------------------------------------------
 3589 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
 3590 dnl ----------
 3591 dnl Write a debug message to config.log, along with the line number in the
 3592 dnl configure script.
 3593 AC_DEFUN([CF_MSG_LOG],[
 3594 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
 3595 ])dnl
 3596 dnl ---------------------------------------------------------------------------
 3597 dnl CF_NCURSES_BROKEN version: 8 updated: 2012/11/08 20:57:52
 3598 dnl -----------------
 3599 dnl Check for pre-1.9.9g ncurses (among other problems, the most obvious is
 3600 dnl that color combinations don't work).
 3601 AC_DEFUN([CF_NCURSES_BROKEN],
 3602 [
 3603 AC_REQUIRE([CF_NCURSES_VERSION])
 3604 if test "$cf_cv_ncurses_version" != no ; then
 3605 AC_MSG_CHECKING(for obsolete/broken version of ncurses)
 3606 AC_CACHE_VAL(cf_cv_ncurses_broken,[
 3607 AC_TRY_COMPILE([
 3608 #include <${cf_cv_ncurses_header:-curses.h}>],[
 3609 #if defined(NCURSES_VERSION) && defined(wgetbkgd)
 3610 	make an error
 3611 #else
 3612 	int x = 1
 3613 #endif
 3614 ],
 3615 	[cf_cv_ncurses_broken=no],
 3616 	[cf_cv_ncurses_broken=yes])
 3617 ])
 3618 AC_MSG_RESULT($cf_cv_ncurses_broken)
 3619 if test "$cf_cv_ncurses_broken" = yes ; then
 3620 	AC_MSG_WARN(hmm... you should get an up-to-date version of ncurses)
 3621 	AC_DEFINE(NCURSES_BROKEN,1,[Define to 1 if you have an obsolete version of ncurses])
 3622 fi
 3623 fi
 3624 ])dnl
 3625 dnl ---------------------------------------------------------------------------
 3626 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
 3627 dnl -------------------
 3628 dnl Check if we can compile with ncurses' header file
 3629 dnl $1 is the cache variable to set
 3630 dnl $2 is the header-file to include
 3631 dnl $3 is the root name (ncurses or ncursesw)
 3632 AC_DEFUN([CF_NCURSES_CC_CHECK],[
 3633 	AC_TRY_COMPILE([
 3634 ]ifelse($3,ncursesw,[
 3635 #define _XOPEN_SOURCE_EXTENDED
 3636 #undef  HAVE_LIBUTF8_H	/* in case we used CF_UTF8_LIB */
 3637 #define HAVE_LIBUTF8_H	/* to force ncurses' header file to use cchar_t */
 3638 ])[
 3639 #include <$2>],[
 3640 #ifdef NCURSES_VERSION
 3641 ]ifelse($3,ncursesw,[
 3642 #ifndef WACS_BSSB
 3643 	make an error
 3644 #endif
 3645 ])[
 3646 printf("%s\n", NCURSES_VERSION);
 3647 #else
 3648 #ifdef __NCURSES_H
 3649 printf("old\n");
 3650 #else
 3651 	make an error
 3652 #endif
 3653 #endif
 3654 	]
 3655 	,[$1=$2]
 3656 	,[$1=no])
 3657 ])dnl
 3658 dnl ---------------------------------------------------------------------------
 3659 dnl CF_NCURSES_CONFIG version: 21 updated: 2018/06/20 20:23:13
 3660 dnl -----------------
 3661 dnl Tie together the configure-script macros for ncurses, preferring these in
 3662 dnl order:
 3663 dnl a) ".pc" files for pkg-config, using $NCURSES_CONFIG_PKG
 3664 dnl b) the "-config" script from ncurses, using $NCURSES_CONFIG
 3665 dnl c) just plain libraries
 3666 dnl
 3667 dnl $1 is the root library name (default: "ncurses")
 3668 AC_DEFUN([CF_NCURSES_CONFIG],[
 3669 AC_REQUIRE([CF_PKG_CONFIG])
 3670 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
 3671 cf_have_ncuconfig=no
 3672 
 3673 if test "x${PKG_CONFIG:=none}" != xnone; then
 3674 	AC_MSG_CHECKING(pkg-config for $cf_ncuconfig_root)
 3675 	if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then
 3676 		AC_MSG_RESULT(yes)
 3677 
 3678 		AC_MSG_CHECKING(if the $cf_ncuconfig_root package files work)
 3679 		cf_have_ncuconfig=unknown
 3680 
 3681 		cf_save_CPPFLAGS="$CPPFLAGS"
 3682 		cf_save_LIBS="$LIBS"
 3683 
 3684 		CF_ADD_CFLAGS(`$PKG_CONFIG --cflags $cf_ncuconfig_root`)
 3685 		CF_ADD_LIBS(`$PKG_CONFIG --libs $cf_ncuconfig_root`)
 3686 
 3687 		AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 3688 			[initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
 3689 			[AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}>
 3690 				int main(void)
 3691 				{ char *xx = curses_version(); return (xx == 0); }],
 3692 				[cf_have_ncuconfig=yes],
 3693 				[cf_have_ncuconfig=no],
 3694 				[cf_have_ncuconfig=maybe])],
 3695 			[cf_have_ncuconfig=no])
 3696 		AC_MSG_RESULT($cf_have_ncuconfig)
 3697 		test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes
 3698 		if test "$cf_have_ncuconfig" != "yes"
 3699 		then
 3700 			CPPFLAGS="$cf_save_CPPFLAGS"
 3701 			LIBS="$cf_save_LIBS"
 3702 			NCURSES_CONFIG_PKG=none
 3703 		else
 3704 			AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 3705 			NCURSES_CONFIG_PKG=$cf_ncuconfig_root
 3706 			CF_TERM_HEADER
 3707 		fi
 3708 
 3709 	else
 3710 		AC_MSG_RESULT(no)
 3711 		NCURSES_CONFIG_PKG=none
 3712 	fi
 3713 else
 3714 	NCURSES_CONFIG_PKG=none
 3715 fi
 3716 
 3717 if test "x$cf_have_ncuconfig" = "xno"; then
 3718 	cf_ncurses_config="${cf_ncuconfig_root}${NCURSES_CONFIG_SUFFIX}-config"; echo "Looking for ${cf_ncurses_config}"
 3719 
 3720 	CF_ACVERSION_CHECK(2.52,
 3721 		[AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)],
 3722 		[AC_PATH_PROGS(NCURSES_CONFIG,  ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)])
 3723 
 3724 	if test "$NCURSES_CONFIG" != none ; then
 3725 
 3726 		CF_ADD_CFLAGS(`$NCURSES_CONFIG --cflags`)
 3727 		CF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
 3728 
 3729 		# even with config script, some packages use no-override for curses.h
 3730 		CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
 3731 
 3732 		dnl like CF_NCURSES_CPPFLAGS
 3733 		AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 3734 
 3735 		dnl like CF_NCURSES_LIBS
 3736 		CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
 3737 		AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
 3738 
 3739 		dnl like CF_NCURSES_VERSION
 3740 		cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
 3741 
 3742 	else
 3743 
 3744 		CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
 3745 		CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
 3746 
 3747 	fi
 3748 else
 3749 	NCURSES_CONFIG=none
 3750 fi
 3751 ])dnl
 3752 dnl ---------------------------------------------------------------------------
 3753 dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51
 3754 dnl -------------------
 3755 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
 3756 dnl the CPPFLAGS variable so we can include its header.
 3757 dnl
 3758 dnl The header files may be installed as either curses.h, or ncurses.h (would
 3759 dnl be obsolete, except that some packagers prefer this name to distinguish it
 3760 dnl from a "native" curses implementation).  If not installed for overwrite,
 3761 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
 3762 dnl /usr/include/ncurses), but someone may have installed overwriting the
 3763 dnl vendor's curses.  Only very old versions (pre-1.9.2d, the first autoconf'd
 3764 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
 3765 dnl the header.
 3766 dnl
 3767 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
 3768 dnl is already in the include-path, don't even bother with this, since we cannot
 3769 dnl easily determine which file it is.  In this case, it has to be <curses.h>.
 3770 dnl
 3771 dnl The optional parameter gives the root name of the library, in case it is
 3772 dnl not installed as the default curses library.  That is how the
 3773 dnl wide-character version of ncurses is installed.
 3774 AC_DEFUN([CF_NCURSES_CPPFLAGS],
 3775 [AC_REQUIRE([CF_WITH_CURSES_DIR])
 3776 
 3777 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
 3778 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
 3779 
 3780 test -n "$cf_cv_curses_dir" && \
 3781 test "$cf_cv_curses_dir" != "no" && { \
 3782   CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root)
 3783 }
 3784 
 3785 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
 3786 	cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
 3787 	( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
 3788 	for cf_header in $cf_header_list
 3789 	do
 3790 		CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
 3791 		test "$cf_cv_ncurses_h" != no && break
 3792 	done
 3793 ])
 3794 
 3795 CF_NCURSES_HEADER
 3796 CF_TERM_HEADER
 3797 
 3798 # some applications need this, but should check for NCURSES_VERSION
 3799 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 3800 
 3801 CF_NCURSES_VERSION
 3802 ])dnl
 3803 dnl ---------------------------------------------------------------------------
 3804 dnl CF_NCURSES_HEADER version: 4 updated: 2015/04/15 19:08:48
 3805 dnl -----------------
 3806 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
 3807 dnl variations of ncurses' installs.
 3808 dnl
 3809 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
 3810 AC_DEFUN([CF_NCURSES_HEADER],[
 3811 
 3812 if test "$cf_cv_ncurses_h" != no ; then
 3813 	cf_cv_ncurses_header=$cf_cv_ncurses_h
 3814 else
 3815 
 3816 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
 3817 	test -n "$verbose" && echo
 3818 	CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
 3819 	test -n "$verbose" && echo search path $cf_search
 3820 	cf_save2_CPPFLAGS="$CPPFLAGS"
 3821 	for cf_incdir in $cf_search
 3822 	do
 3823 		CF_ADD_INCDIR($cf_incdir)
 3824 		for cf_header in \
 3825 			ncurses.h \
 3826 			curses.h
 3827 		do
 3828 			CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
 3829 			if test "$cf_cv_ncurses_h2" != no ; then
 3830 				cf_cv_ncurses_h2=$cf_incdir/$cf_header
 3831 				test -n "$verbose" && echo $ac_n "	... found $ac_c" 1>&AC_FD_MSG
 3832 				break
 3833 			fi
 3834 			test -n "$verbose" && echo "	... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
 3835 		done
 3836 		CPPFLAGS="$cf_save2_CPPFLAGS"
 3837 		test "$cf_cv_ncurses_h2" != no && break
 3838 	done
 3839 	test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
 3840 	])
 3841 
 3842 	CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
 3843 	cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
 3844 	if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
 3845 		cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
 3846 	fi
 3847 	CF_ADD_INCDIR($cf_1st_incdir)
 3848 
 3849 fi
 3850 
 3851 # Set definitions to allow ifdef'ing for ncurses.h
 3852 
 3853 case $cf_cv_ncurses_header in
 3854 (*ncurses.h)
 3855 	AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h])
 3856 	;;
 3857 esac
 3858 
 3859 case $cf_cv_ncurses_header in
 3860 (ncurses/curses.h|ncurses/ncurses.h)
 3861 	AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h])
 3862 	;;
 3863 (ncursesw/curses.h|ncursesw/ncurses.h)
 3864 	AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h])
 3865 	;;
 3866 esac
 3867 
 3868 ])dnl
 3869 dnl ---------------------------------------------------------------------------
 3870 dnl CF_NCURSES_LIBS version: 17 updated: 2015/04/15 19:08:48
 3871 dnl ---------------
 3872 dnl Look for the ncurses library.  This is a little complicated on Linux,
 3873 dnl because it may be linked with the gpm (general purpose mouse) library.
 3874 dnl Some distributions have gpm linked with (bsd) curses, which makes it
 3875 dnl unusable with ncurses.  However, we don't want to link with gpm unless
 3876 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
 3877 dnl and the linker will record a dependency.
 3878 dnl
 3879 dnl The optional parameter gives the root name of the library, in case it is
 3880 dnl not installed as the default curses library.  That is how the
 3881 dnl wide-character version of ncurses is installed.
 3882 AC_DEFUN([CF_NCURSES_LIBS],
 3883 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
 3884 
 3885 cf_nculib_root=ifelse($1,,ncurses,$1)
 3886 	# This works, except for the special case where we find gpm, but
 3887 	# ncurses is in a nonstandard location via $LIBS, and we really want
 3888 	# to link gpm.
 3889 cf_ncurses_LIBS=""
 3890 cf_ncurses_SAVE="$LIBS"
 3891 AC_CHECK_LIB(gpm,Gpm_Open,
 3892 	[AC_CHECK_LIB(gpm,initscr,
 3893 		[LIBS="$cf_ncurses_SAVE"],
 3894 		[cf_ncurses_LIBS="-lgpm"])])
 3895 
 3896 case $host_os in
 3897 (freebsd*)
 3898 	# This is only necessary if you are linking against an obsolete
 3899 	# version of ncurses (but it should do no harm, since it's static).
 3900 	if test "$cf_nculib_root" = ncurses ; then
 3901 		AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
 3902 	fi
 3903 	;;
 3904 esac
 3905 
 3906 CF_ADD_LIBS($cf_ncurses_LIBS)
 3907 
 3908 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
 3909 then
 3910 	CF_ADD_LIBS(-l$cf_nculib_root)
 3911 else
 3912 	CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
 3913 		[#include <${cf_cv_ncurses_header:-curses.h}>],
 3914 		[initscr()],
 3915 		initscr)
 3916 fi
 3917 
 3918 if test -n "$cf_ncurses_LIBS" ; then
 3919 	AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
 3920 	cf_ncurses_SAVE="$LIBS"
 3921 	for p in $cf_ncurses_LIBS ; do
 3922 		q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
 3923 		if test "$q" != "$LIBS" ; then
 3924 			LIBS="$q"
 3925 		fi
 3926 	done
 3927 	AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 3928 		[initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
 3929 		[AC_MSG_RESULT(yes)],
 3930 		[AC_MSG_RESULT(no)
 3931 		 LIBS="$cf_ncurses_SAVE"])
 3932 fi
 3933 
 3934 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
 3935 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
 3936 ])dnl
 3937 dnl ---------------------------------------------------------------------------
 3938 dnl CF_NCURSES_VERSION version: 15 updated: 2017/05/09 19:26:10
 3939 dnl ------------------
 3940 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
 3941 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS.  We don't use
 3942 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
 3943 AC_DEFUN([CF_NCURSES_VERSION],
 3944 [
 3945 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
 3946 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
 3947 	cf_cv_ncurses_version=no
 3948 	cf_tempfile=out$$
 3949 	rm -f $cf_tempfile
 3950 	AC_TRY_RUN([
 3951 #include <${cf_cv_ncurses_header:-curses.h}>
 3952 #include <stdio.h>
 3953 int main(void)
 3954 {
 3955 	FILE *fp = fopen("$cf_tempfile", "w");
 3956 #ifdef NCURSES_VERSION
 3957 # ifdef NCURSES_VERSION_PATCH
 3958 	fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
 3959 # else
 3960 	fprintf(fp, "%s\n", NCURSES_VERSION);
 3961 # endif
 3962 #else
 3963 # ifdef __NCURSES_H
 3964 	fprintf(fp, "old\n");
 3965 # else
 3966 	make an error
 3967 # endif
 3968 #endif
 3969 	${cf_cv_main_return:-return}(0);
 3970 }],[
 3971 	cf_cv_ncurses_version=`cat $cf_tempfile`],,[
 3972 
 3973 	# This will not work if the preprocessor splits the line after the
 3974 	# Autoconf token.  The 'unproto' program does that.
 3975 	cat > conftest.$ac_ext <<EOF
 3976 #include <${cf_cv_ncurses_header:-curses.h}>
 3977 #undef Autoconf
 3978 #ifdef NCURSES_VERSION
 3979 Autoconf NCURSES_VERSION
 3980 #else
 3981 #ifdef __NCURSES_H
 3982 Autoconf "old"
 3983 #endif
 3984 ;
 3985 #endif
 3986 EOF
 3987 	cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
 3988 	AC_TRY_EVAL(cf_try)
 3989 	if test -f conftest.out ; then
 3990 		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
 3991 		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
 3992 		rm -f conftest.out
 3993 	fi
 3994 ])
 3995 	rm -f $cf_tempfile
 3996 ])
 3997 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 3998 ])dnl
 3999 dnl ---------------------------------------------------------------------------
 4000 dnl CF_NETLIBS version: 11 updated: 2015/04/15 19:08:48
 4001 dnl ----------
 4002 dnl After checking for functions in the default $LIBS, make a further check
 4003 dnl for the functions that are netlib-related (these aren't always in the
 4004 dnl libc, etc., and have to be handled specially because there are conflicting
 4005 dnl and broken implementations.
 4006 dnl Common library requirements (in order):
 4007 dnl	-lresolv -lsocket -lnsl
 4008 dnl	-lnsl -lsocket
 4009 dnl	-lsocket
 4010 dnl	-lbsd
 4011 dnl	-lnetwork
 4012 AC_DEFUN([CF_NETLIBS],[
 4013 cf_test_netlibs=no
 4014 
 4015 AC_MSG_CHECKING(for network libraries)
 4016 
 4017 AC_CACHE_VAL(cf_cv_netlibs,[
 4018 AC_MSG_RESULT(working...)
 4019 
 4020 cf_cv_netlibs=""
 4021 cf_test_netlibs=yes
 4022 
 4023 case $host_os in
 4024 (mingw*)
 4025 	AC_CHECK_HEADERS( windows.h winsock.h winsock2.h )
 4026 
 4027 	if test "$ac_cv_header_winsock2_h" = "yes" ; then
 4028 		cf_winsock_lib="-lws2_32"
 4029 	elif test "$ac_cv_header_winsock_h" = "yes" ; then
 4030 		cf_winsock_lib="-lwsock32"
 4031 	fi
 4032 
 4033 	cf_save_LIBS="$LIBS"
 4034 	CF_ADD_LIBS($cf_winsock_lib)
 4035 
 4036 	AC_TRY_LINK([
 4037 #ifdef HAVE_WINDOWS_H
 4038 #undef WIN32_LEAN_AND_MEAN
 4039 #define WIN32_LEAN_AND_MEAN
 4040 #include <windows.h>
 4041 #ifdef HAVE_WINSOCK2_H
 4042 #include <winsock2.h>
 4043 #else
 4044 #ifdef HAVE_WINSOCK_H
 4045 #include <winsock.h>
 4046 #endif
 4047 #endif
 4048 #endif
 4049 ],[
 4050 	char buffer[1024];
 4051 	gethostname(buffer, sizeof(buffer));],
 4052 	[cf_cv_netlibs="$cf_winsock_lib $cf_cv_netlibs"],
 4053 	[AC_MSG_ERROR(Cannot link against winsock library)])
 4054 
 4055 	LIBS="$cf_save_LIBS"
 4056 	;;
 4057 (*)
 4058 	AC_CHECK_FUNCS(gethostname,,[
 4059 		CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
 4060 			CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
 4061 
 4062 	AC_CHECK_LIB(inet, main, cf_cv_netlibs="-linet $cf_cv_netlibs")
 4063 
 4064 	if test "$ac_cv_func_lsocket" != no ; then
 4065 	AC_CHECK_FUNCS(socket,,[
 4066 		CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
 4067 			CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
 4068 	fi
 4069 
 4070 	AC_CHECK_FUNCS(gethostbyname,,[
 4071 		CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
 4072 
 4073 	AC_CHECK_FUNCS(inet_ntoa,,[
 4074 		CF_RECHECK_FUNC(inet_ntoa,nsl,cf_cv_netlibs)])
 4075 
 4076 	AC_CHECK_FUNCS(gethostbyname,,[
 4077 		CF_RECHECK_FUNC(gethostbyname,network,cf_cv_netlibs)])
 4078 
 4079 	AC_CHECK_FUNCS(strcasecmp,,[
 4080 		CF_RECHECK_FUNC(strcasecmp,resolv,cf_cv_netlibs)])
 4081 	;;
 4082 esac
 4083 ])
 4084 
 4085 case $cf_cv_netlibs in
 4086 (*ws2_32*)
 4087 	AC_DEFINE(USE_WINSOCK2_H,1,[Define to 1 if we should include winsock2.h])
 4088 	;;
 4089 esac
 4090 
 4091 CF_ADD_LIBS($cf_cv_netlibs)
 4092 test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG
 4093 ])dnl
 4094 dnl ---------------------------------------------------------------------------
 4095 dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00
 4096 dnl ------------------
 4097 dnl see CF_WITH_NO_LEAKS
 4098 AC_DEFUN([CF_NO_LEAKS_OPTION],[
 4099 AC_MSG_CHECKING(if you want to use $1 for testing)
 4100 AC_ARG_WITH($1,
 4101 	[$2],
 4102 	[AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
 4103 	 $4
 4104 ])
 4105 	: ${with_cflags:=-g}
 4106 	: ${with_no_leaks:=yes}
 4107 	 with_$1=yes],
 4108 	[with_$1=])
 4109 AC_MSG_RESULT(${with_$1:-no})
 4110 
 4111 case .$with_cflags in
 4112 (.*-g*)
 4113 	case .$CFLAGS in
 4114 	(.*-g*)
 4115 		;;
 4116 	(*)
 4117 		CF_ADD_CFLAGS([-g])
 4118 		;;
 4119 	esac
 4120 	;;
 4121 esac
 4122 ])dnl
 4123 dnl ---------------------------------------------------------------------------
 4124 dnl CF_OUR_MESSAGES version: 7 updated: 2004/09/12 19:45:55
 4125 dnl ---------------
 4126 dnl Check if we use the messages included with this program
 4127 dnl
 4128 dnl $1 specifies either Makefile or makefile, defaulting to the former.
 4129 dnl
 4130 dnl Sets variables which can be used to substitute in makefiles:
 4131 dnl	MSG_DIR_MAKE - to make ./po directory
 4132 dnl	SUB_MAKEFILE - makefile in ./po directory (see CF_BUNDLED_INTL)
 4133 dnl
 4134 AC_DEFUN([CF_OUR_MESSAGES],
 4135 [
 4136 cf_makefile=ifelse($1,,Makefile,$1)
 4137 
 4138 use_our_messages=no
 4139 if test "$USE_NLS" = yes ; then
 4140 if test -d $srcdir/po ; then
 4141 AC_MSG_CHECKING(if we should use included message-library)
 4142 	AC_ARG_ENABLE(included-msgs,
 4143 	[  --disable-included-msgs use included messages, for i18n support],
 4144 	[use_our_messages=$enableval],
 4145 	[use_our_messages=yes])
 4146 fi
 4147 AC_MSG_RESULT($use_our_messages)
 4148 fi
 4149 
 4150 MSG_DIR_MAKE="#"
 4151 if test "$use_our_messages" = yes
 4152 then
 4153 	SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn"
 4154 	MSG_DIR_MAKE=
 4155 fi
 4156 
 4157 AC_SUBST(MSG_DIR_MAKE)
 4158 AC_SUBST(SUB_MAKEFILE)
 4159 ])dnl
 4160 dnl ---------------------------------------------------------------------------
 4161 dnl CF_PATHSEP version: 7 updated: 2015/04/12 15:39:00
 4162 dnl ----------
 4163 dnl Provide a value for the $PATH and similar separator (or amend the value
 4164 dnl as provided in autoconf 2.5x).
 4165 AC_DEFUN([CF_PATHSEP],
 4166 [
 4167 	AC_MSG_CHECKING(for PATH separator)
 4168 	case $cf_cv_system_name in
 4169 	(os2*)	PATH_SEPARATOR=';'  ;;
 4170 	(*)	${PATH_SEPARATOR:=':'}  ;;
 4171 	esac
 4172 ifelse([$1],,,[$1=$PATH_SEPARATOR])
 4173 	AC_SUBST(PATH_SEPARATOR)
 4174 	AC_MSG_RESULT($PATH_SEPARATOR)
 4175 ])dnl
 4176 dnl ---------------------------------------------------------------------------
 4177 dnl CF_PATH_EDITOR version: 5 updated: 2000/07/20 00:41:18
 4178 dnl --------------
 4179 dnl Look for the default editor (vi)
 4180 AC_DEFUN([CF_PATH_EDITOR],
 4181 [
 4182 AC_MSG_CHECKING(for default editor)
 4183 CF_ARG_WITH(editor,
 4184     [  --with-editor=PROG      specify editor],
 4185     [DEFAULT_EDITOR],,vi)
 4186 if test -z "$DEFAULT_EDITOR" ; then
 4187     if test -n "$EDITOR" ; then
 4188     	DEFAULT_EDITOR="$EDITOR"
 4189     elif test -n "$VISUAL" ; then
 4190     	DEFAULT_EDITOR="$VISUAL"
 4191     else
 4192 	AC_PATH_PROG(DEFAULT_EDITOR,vi,vi,$PATH:/usr/bin:/usr/ucb)
 4193     fi
 4194 fi
 4195 AC_MSG_RESULT($DEFAULT_EDITOR)
 4196 AC_DEFINE_UNQUOTED(DEFAULT_EDITOR,"$DEFAULT_EDITOR")
 4197 ])dnl
 4198 dnl ---------------------------------------------------------------------------
 4199 dnl CF_PATH_MAILBOX version: 4 updated: 1998/04/01 11:39:13
 4200 dnl ---------------
 4201 dnl Look for the directory that contains incoming mail.  I would check for an
 4202 dnl actual mail-file, to verify this, but that is not always easy to arrange.
 4203 AC_DEFUN([CF_PATH_MAILBOX],
 4204 [
 4205 AC_MSG_CHECKING(for incoming-mail directory)
 4206 CF_ARG_WITH(mailbox,
 4207     [  --with-mailbox=DIR      directory for incoming mailboxes],
 4208     [DEFAULT_MAILBOX])
 4209 if test -z "$DEFAULT_MAILBOX" ; then
 4210 for cf_dir in \
 4211 	/var/spool/mail \
 4212 	/usr/spool/mail \
 4213 	/var/mail \
 4214 	/usr/mail \
 4215 	/mail
 4216     do
 4217     	if test -d $cf_dir ; then
 4218 	    DEFAULT_MAILBOX=$cf_dir
 4219 	    break
 4220 	fi
 4221     done
 4222 fi
 4223 if test -n "$DEFAULT_MAILBOX" ; then
 4224 	AC_DEFINE_UNQUOTED(DEFAULT_MAILBOX,"$DEFAULT_MAILBOX")
 4225 else
 4226 	DEFAULT_MAILBOX=none
 4227 fi
 4228 AC_MSG_RESULT($DEFAULT_MAILBOX)
 4229 ])dnl
 4230 dnl ---------------------------------------------------------------------------
 4231 dnl CF_PATH_MAILER version: 6 updated: 2001/05/27 21:36:02
 4232 dnl --------------
 4233 dnl Look for the program that sends outgoing mail.
 4234 AC_DEFUN([CF_PATH_MAILER],
 4235 [
 4236 AC_PATH_PROG(DEFAULT_MAILER,sendmail,,$PATH:/usr/sbin:/usr/lib)
 4237 CF_ARG_WITH(mailer,
 4238      [  --with-mailer=PROG      specify default mailer-program],
 4239      [DEFAULT_MAILER],,mailx)
 4240 if test -z "$DEFAULT_MAILER" ; then
 4241 AC_PATH_PROG(DEFAULT_MAILER,mailx,,$PATH:/usr/bin)
 4242 fi
 4243 if test -z "$DEFAULT_MAILER" ; then
 4244 AC_PATH_PROG(DEFAULT_MAILER,mail,,$PATH:/usr/bin)
 4245 fi
 4246 AC_MSG_CHECKING(for default mailer)
 4247 if test -n "$DEFAULT_MAILER" ; then
 4248 	CF_FIX_SLASHES(ac_cv_path_DEFAULT_MAILER)
 4249 	CF_FIX_SLASHES(DEFAULT_MAILER)
 4250 	AC_DEFINE_UNQUOTED(DEFAULT_MAILER,"$DEFAULT_MAILER")
 4251 else
 4252 	DEFAULT_MAILER=none
 4253 fi
 4254 AC_MSG_RESULT($DEFAULT_MAILER)
 4255 ])dnl
 4256 dnl ---------------------------------------------------------------------------
 4257 dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57
 4258 dnl --------------
 4259 dnl Check the argument to see that it looks like a pathname.  Rewrite it if it
 4260 dnl begins with one of the prefix/exec_prefix variables, and then again if the
 4261 dnl result begins with 'NONE'.  This is necessary to work around autoconf's
 4262 dnl delayed evaluation of those symbols.
 4263 AC_DEFUN([CF_PATH_SYNTAX],[
 4264 if test "x$prefix" != xNONE; then
 4265 	cf_path_syntax="$prefix"
 4266 else
 4267 	cf_path_syntax="$ac_default_prefix"
 4268 fi
 4269 
 4270 case ".[$]$1" in
 4271 (.\[$]\(*\)*|.\'*\'*)
 4272 	;;
 4273 (..|./*|.\\*)
 4274 	;;
 4275 (.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX
 4276 	;;
 4277 (.\[$]{*prefix}*|.\[$]{*dir}*)
 4278 	eval $1="[$]$1"
 4279 	case ".[$]$1" in
 4280 	(.NONE/*)
 4281 		$1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
 4282 		;;
 4283 	esac
 4284 	;;
 4285 (.no|.NONE/*)
 4286 	$1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
 4287 	;;
 4288 (*)
 4289 	ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
 4290 	;;
 4291 esac
 4292 ])dnl
 4293 dnl ---------------------------------------------------------------------------
 4294 dnl CF_PDCURSES_X11 version: 14 updated: 2018/06/20 20:23:13
 4295 dnl ---------------
 4296 dnl Configure for PDCurses' X11 library
 4297 AC_DEFUN([CF_PDCURSES_X11],[
 4298 AC_REQUIRE([CF_X_ATHENA])
 4299 
 4300 CF_ACVERSION_CHECK(2.52,
 4301 	[AC_CHECK_TOOLS(XCURSES_CONFIG, xcurses-config, none)],
 4302 	[AC_PATH_PROGS(XCURSES_CONFIG, xcurses-config, none)])
 4303 
 4304 if test "$XCURSES_CONFIG" != none ; then
 4305 
 4306 CF_ADD_CFLAGS(`$XCURSES_CONFIG --cflags`)
 4307 CF_ADD_LIBS(`$XCURSES_CONFIG --libs`)
 4308 
 4309 cf_cv_lib_XCurses=yes
 4310 
 4311 else
 4312 
 4313 LDFLAGS="$LDFLAGS $X_LIBS"
 4314 CF_CHECK_CFLAGS($X_CFLAGS)
 4315 AC_CHECK_LIB(X11,XOpenDisplay,
 4316 	[CF_ADD_LIBS(-lX11)],,
 4317 	[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
 4318 AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
 4319 CF_ADD_LIBS(-lXCurses)
 4320 AC_TRY_LINK([
 4321 #include <xcurses.h>
 4322 char *XCursesProgramName = "test";
 4323 ],[XCursesExit();],
 4324 [cf_cv_lib_XCurses=yes],
 4325 [cf_cv_lib_XCurses=no])
 4326 ])
 4327 
 4328 fi
 4329 
 4330 if test $cf_cv_lib_XCurses = yes ; then
 4331 	AC_DEFINE(UNIX,1,[Define to 1 if using PDCurses on Unix])
 4332 	AC_DEFINE(XCURSES,1,[Define to 1 if using PDCurses on Unix])
 4333 	AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES,1,[Define to 1 if using PDCurses on Unix]))
 4334 else
 4335 	AC_MSG_ERROR(Cannot link with XCurses)
 4336 fi
 4337 ])dnl
 4338 dnl ---------------------------------------------------------------------------
 4339 dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58
 4340 dnl -------------
 4341 dnl Check for the package-config program, unless disabled by command-line.
 4342 AC_DEFUN([CF_PKG_CONFIG],
 4343 [
 4344 AC_MSG_CHECKING(if you want to use pkg-config)
 4345 AC_ARG_WITH(pkg-config,
 4346 	[  --with-pkg-config{=path} enable/disable use of pkg-config],
 4347 	[cf_pkg_config=$withval],
 4348 	[cf_pkg_config=yes])
 4349 AC_MSG_RESULT($cf_pkg_config)
 4350 
 4351 case $cf_pkg_config in
 4352 (no)
 4353 	PKG_CONFIG=none
 4354 	;;
 4355 (yes)
 4356 	CF_ACVERSION_CHECK(2.52,
 4357 		[AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
 4358 		[AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
 4359 	;;
 4360 (*)
 4361 	PKG_CONFIG=$withval
 4362 	;;
 4363 esac
 4364 
 4365 test -z "$PKG_CONFIG" && PKG_CONFIG=none
 4366 if test "$PKG_CONFIG" != none ; then
 4367 	CF_PATH_SYNTAX(PKG_CONFIG)
 4368 elif test "x$cf_pkg_config" != xno ; then
 4369 	AC_MSG_WARN(pkg-config is not installed)
 4370 fi
 4371 
 4372 AC_SUBST(PKG_CONFIG)
 4373 ])dnl
 4374 dnl ---------------------------------------------------------------------------
 4375 dnl CF_POSIX_C_SOURCE version: 10 updated: 2018/06/20 20:23:13
 4376 dnl -----------------
 4377 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
 4378 dnl
 4379 dnl	POSIX.1-1990				_POSIX_SOURCE
 4380 dnl	POSIX.1-1990 and			_POSIX_SOURCE and
 4381 dnl		POSIX.2-1992 C-Language			_POSIX_C_SOURCE=2
 4382 dnl		Bindings Option
 4383 dnl	POSIX.1b-1993				_POSIX_C_SOURCE=199309L
 4384 dnl	POSIX.1c-1996				_POSIX_C_SOURCE=199506L
 4385 dnl	X/Open 2000				_POSIX_C_SOURCE=200112L
 4386 dnl
 4387 dnl Parameters:
 4388 dnl	$1 is the nominal value for _POSIX_C_SOURCE
 4389 AC_DEFUN([CF_POSIX_C_SOURCE],
 4390 [
 4391 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
 4392 
 4393 cf_save_CFLAGS="$CFLAGS"
 4394 cf_save_CPPFLAGS="$CPPFLAGS"
 4395 
 4396 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
 4397 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
 4398 
 4399 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
 4400 	CF_MSG_LOG(if the symbol is already defined go no further)
 4401 	AC_TRY_COMPILE([#include <sys/types.h>],[
 4402 #ifndef _POSIX_C_SOURCE
 4403 make an error
 4404 #endif],
 4405 	[cf_cv_posix_c_source=no],
 4406 	[cf_want_posix_source=no
 4407 	 case .$cf_POSIX_C_SOURCE in
 4408 	 (.[[12]]??*)
 4409 		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
 4410 		;;
 4411 	 (.2)
 4412 		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
 4413 		cf_want_posix_source=yes
 4414 		;;
 4415 	 (.*)
 4416 		cf_want_posix_source=yes
 4417 		;;
 4418 	 esac
 4419 	 if test "$cf_want_posix_source" = yes ; then
 4420 		AC_TRY_COMPILE([#include <sys/types.h>],[
 4421 #ifdef _POSIX_SOURCE
 4422 make an error
 4423 #endif],[],
 4424 		cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
 4425 	 fi
 4426 	 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
 4427 	 CFLAGS="$cf_trim_CFLAGS"
 4428 	 CPPFLAGS="$cf_trim_CPPFLAGS"
 4429 	 CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source)
 4430 	 CF_MSG_LOG(if the second compile does not leave our definition intact error)
 4431 	 AC_TRY_COMPILE([#include <sys/types.h>],[
 4432 #ifndef _POSIX_C_SOURCE
 4433 make an error
 4434 #endif],,
 4435 	 [cf_cv_posix_c_source=no])
 4436 	 CFLAGS="$cf_save_CFLAGS"
 4437 	 CPPFLAGS="$cf_save_CPPFLAGS"
 4438 	])
 4439 ])
 4440 
 4441 if test "$cf_cv_posix_c_source" != no ; then
 4442 	CFLAGS="$cf_trim_CFLAGS"
 4443 	CPPFLAGS="$cf_trim_CPPFLAGS"
 4444 	CF_ADD_CFLAGS($cf_cv_posix_c_source)
 4445 fi
 4446 
 4447 ])dnl
 4448 dnl ---------------------------------------------------------------------------
 4449 dnl CF_POSIX_JC version: 3 updated: 2001/05/27 21:36:02
 4450 dnl -----------
 4451 dnl Check if we have POSIX-style job control (i.e., sigaction), or if we must
 4452 dnl use the signal functions.  Use AC_CHECK_FUNCS(sigaction) first.
 4453 AC_DEFUN([CF_POSIX_JC],[
 4454 
 4455 AC_REQUIRE([AC_TYPE_SIGNAL])
 4456 AC_REQUIRE([CF_SIG_ARGS])
 4457 
 4458 if test "$ac_cv_func_sigaction" = yes; then
 4459 
 4460 AC_CACHE_CHECK(whether sigaction needs _POSIX_SOURCE,cf_cv_sigact_bad,[
 4461 AC_TRY_COMPILE([
 4462 #include <sys/types.h>
 4463 #include <signal.h>],[struct sigaction act],
 4464   [cf_cv_sigact_bad=no],[cf_cv_sigact_bad=yes])
 4465 ])
 4466 
 4467 test "$cf_cv_sigact_bad" = yes && AC_DEFINE(SVR4_ACTION)
 4468 
 4469 AC_CACHE_CHECK(if we have sigaction/related functions,cf_cv_sigaction_funcs,[
 4470 AC_TRY_LINK([
 4471 #ifdef SVR4_ACTION
 4472 #define _POSIX_SOURCE
 4473 #endif
 4474 #include <sys/types.h>
 4475 #include <signal.h>],[
 4476     RETSIGTYPE (*func)(SIG_ARGS) = SIG_IGN;
 4477     struct sigaction sa, osa;
 4478     sa.sa_handler = func;
 4479     sa.sa_flags = 0;
 4480     sigemptyset (&sa.sa_mask);
 4481     sigaction (SIGBUS,&sa,&osa);],
 4482     [cf_cv_sigaction_funcs=yes],
 4483     [cf_cv_sigaction_funcs=no])])
 4484 
 4485 test "$cf_cv_sigaction_funcs" = yes && AC_DEFINE(HAVE_POSIX_JC)
 4486 
 4487 fi
 4488 ])dnl
 4489 dnl ---------------------------------------------------------------------------
 4490 dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22
 4491 dnl ----------
 4492 dnl Check for archiver "ar".
 4493 AC_DEFUN([CF_PROG_AR],[
 4494 AC_CHECK_TOOL(AR, ar, ar)
 4495 ])
 4496 dnl ---------------------------------------------------------------------------
 4497 dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58
 4498 dnl ----------
 4499 dnl standard check for CC, plus followup sanity checks
 4500 dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
 4501 AC_DEFUN([CF_PROG_CC],[
 4502 ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
 4503 CF_GCC_VERSION
 4504 CF_ACVERSION_CHECK(2.52,
 4505 	[AC_PROG_CC_STDC],
 4506 	[CF_ANSI_CC_REQD])
 4507 CF_CC_ENV_FLAGS
 4508 ])dnl
 4509 dnl ---------------------------------------------------------------------------
 4510 dnl CF_PROG_EXT version: 14 updated: 2018/06/20 20:23:13
 4511 dnl -----------
 4512 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
 4513 AC_DEFUN([CF_PROG_EXT],
 4514 [
 4515 AC_REQUIRE([CF_CHECK_CACHE])
 4516 case $cf_cv_system_name in
 4517 (os2*)
 4518 	CFLAGS="$CFLAGS -Zmt"
 4519 	CF_APPEND_TEXT(CPPFLAGS,-D__ST_MT_ERRNO__)
 4520 	CXXFLAGS="$CXXFLAGS -Zmt"
 4521 	# autoconf's macro sets -Zexe and suffix both, which conflict:w
 4522 	LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
 4523 	ac_cv_exeext=.exe
 4524 	;;
 4525 esac
 4526 
 4527 AC_EXEEXT
 4528 AC_OBJEXT
 4529 
 4530 PROG_EXT="$EXEEXT"
 4531 AC_SUBST(PROG_EXT)
 4532 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
 4533 ])dnl
 4534 dnl ---------------------------------------------------------------------------
 4535 dnl CF_PROG_SUM_R version: 2 updated: 1997/08/28 23:57:55
 4536 dnl -------------
 4537 dnl See if sum can take -r
 4538 AC_DEFUN([CF_PROG_SUM_R],
 4539 [
 4540 if test $ac_cv_path_PATH_SUM
 4541 then
 4542 AC_MSG_CHECKING([if $ac_cv_path_PATH_SUM takes -r])
 4543 AC_CACHE_VAL(ac_cv_prog_sum_r,[
 4544 if AC_TRY_COMMAND($ac_cv_path_PATH_SUM -r config.log 1>&AC_FD_CC)
 4545 then
 4546 	ac_cv_prog_sum_r=yes
 4547 else
 4548 	ac_cv_prog_sum_r=no
 4549 fi
 4550 ])
 4551 if test $ac_cv_prog_sum_r = yes; then
 4552 	AC_DEFINE(SUM_TAKES_DASH_R)
 4553 	AC_DEFINE_UNQUOTED(PATH_SUM_R, "$ac_cv_path_PATH_SUM -r")
 4554 else
 4555 	AC_DEFINE_UNQUOTED(PATH_SUM_R, "$ac_cv_path_PATH_SUM")
 4556 fi
 4557 AC_MSG_RESULT($ac_cv_prog_sum_r)
 4558 fi
 4559 ])dnl
 4560 dnl ---------------------------------------------------------------------------
 4561 dnl CF_PROG_YACC version: 2 updated: 1997/12/16 11:20:41
 4562 dnl ------------
 4563 dnl A better version of AC_PROC_YACC, verifies that we'll only choose bison if
 4564 dnl we'll be able to compile with it.  Bison uses alloca, which isn't all that
 4565 dnl portable.
 4566 AC_DEFUN([CF_PROG_YACC],
 4567 [
 4568 AC_REQUIRE([AC_PROG_CC])
 4569 AC_CACHE_VAL(cf_cv_prog_YACC,[
 4570 if test -n "$YACC" ; then
 4571   cf_cv_prog_YACC="$YACC" # Let the user override the test.
 4572 else
 4573 cat >conftest.y <<EOF
 4574 %{
 4575 void yyerror(s) char *s; { }
 4576 %}
 4577 %token	NUMBER
 4578 %%
 4579 time	: NUMBER ':' NUMBER
 4580 	;
 4581 %%
 4582 int yylex() { return NUMBER; }
 4583 int main() { return yyparse(); }
 4584 EOF
 4585   for cf_prog in 'bison -y' byacc yacc
 4586   do
 4587     rm -f y.tab.[ch]
 4588     AC_MSG_CHECKING(for $cf_prog)
 4589     cf_command="$cf_prog conftest.y"
 4590     cf_result=no
 4591     if AC_TRY_EVAL(cf_command) && test -s y.tab.c ; then
 4592       mv y.tab.c conftest.c
 4593       rm -f y.tab.h
 4594       if test "$cf_prog" = 'bison -y' ; then
 4595         if AC_TRY_EVAL(ac_link) && test -s conftest ; then
 4596           cf_result=yes
 4597         fi
 4598       else
 4599         cf_result=yes
 4600       fi
 4601     fi
 4602     AC_MSG_RESULT($cf_result)
 4603     if test $cf_result = yes ; then
 4604       cf_cv_prog_YACC="$cf_prog"
 4605       break
 4606     fi
 4607   done
 4608 fi
 4609 ])
 4610 YACC="$cf_cv_prog_YACC"
 4611 AC_SUBST(YACC)dnl
 4612 ])dnl
 4613 dnl ---------------------------------------------------------------------------
 4614 dnl CF_PW_GECOS version: 2 updated: 2000/04/13 10:13:00
 4615 dnl -----------
 4616 dnl Check if the passwd-struct defines the '.pw_gecos' member (useful
 4617 dnl in decoding user names).
 4618 AC_DEFUN([CF_PW_GECOS],
 4619 [
 4620 AC_CACHE_CHECK([for passwd.pw_gecos], cf_cv_pw_gecos,[
 4621 	AC_TRY_COMPILE([
 4622 #include <pwd.h>
 4623 ],[
 4624 	struct passwd foo;
 4625 	char bar = foo.pw_gecos],
 4626 	[cf_cv_pw_gecos=yes],
 4627 	[cf_cv_pw_gecos=no])])
 4628 test $cf_cv_pw_gecos = no && AC_DEFINE(DONT_HAVE_PW_GECOS)
 4629 ])dnl
 4630 dnl ---------------------------------------------------------------------------
 4631 dnl CF_RECHECK_FUNC version: 3 updated: 2000/10/18 19:29:13
 4632 dnl ---------------
 4633 dnl Re-check on a function to see if we can pick it up by adding a library.
 4634 dnl	$1 = function to check
 4635 dnl	$2 = library to check in
 4636 dnl	$3 = environment to update (e.g., $LIBS)
 4637 dnl	$4 = what to do if this fails
 4638 dnl
 4639 dnl This uses 'unset' if the shell happens to support it, but leaves the
 4640 dnl configuration variable set to 'unknown' if not.  This is a little better
 4641 dnl than the normal autoconf test, which gives misleading results if a test
 4642 dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is
 4643 dnl used (autoconf does not distinguish between a null token and one that is
 4644 dnl set to 'no').
 4645 AC_DEFUN([CF_RECHECK_FUNC],[
 4646 AC_CHECK_LIB($2,$1,[
 4647 	CF_UPPER(cf_tr_func,$1)
 4648 	AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func)
 4649 	ac_cv_func_$1=yes
 4650 	if test "$cf_used_lib_$2" != yes ; then cf_used_lib_$2=yes; $3="-l$2 [$]$3"; fi],[
 4651 	ac_cv_func_$1=unknown
 4652 	unset ac_cv_func_$1 2>/dev/null
 4653 	$4],
 4654 	[[$]$3])
 4655 ])dnl
 4656 dnl ---------------------------------------------------------------------------
 4657 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
 4658 dnl ----------------
 4659 dnl Remove all -U and -D options that refer to the given symbol from a list
 4660 dnl of C compiler options.  This works around the problem that not all
 4661 dnl compilers process -U and -D options from left-to-right, so a -U option
 4662 dnl cannot be used to cancel the effect of a preceding -D option.
 4663 dnl
 4664 dnl $1 = target (which could be the same as the source variable)
 4665 dnl $2 = source (including '$')
 4666 dnl $3 = symbol to remove
 4667 define([CF_REMOVE_DEFINE],
 4668 [
 4669 $1=`echo "$2" | \
 4670 	sed	-e 's/-[[UD]]'"$3"'\(=[[^ 	]]*\)\?[[ 	]]/ /g' \
 4671 		-e 's/-[[UD]]'"$3"'\(=[[^ 	]]*\)\?[$]//g'`
 4672 ])dnl
 4673 dnl ---------------------------------------------------------------------------
 4674 dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09
 4675 dnl -----------
 4676 dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
 4677 dnl programs need this test).
 4678 dnl
 4679 dnl This is really a MacOS X 10.4.3 workaround.  Defining _POSIX_C_SOURCE
 4680 dnl forces SIGWINCH to be undefined (breaks xterm, ncurses).  Oddly, the struct
 4681 dnl winsize declaration is left alone - we may revisit this if Apple choose to
 4682 dnl break that part of the interface as well.
 4683 AC_DEFUN([CF_SIGWINCH],
 4684 [
 4685 AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
 4686 	AC_TRY_COMPILE([
 4687 #include <sys/types.h>
 4688 #include <sys/signal.h>
 4689 ],[int x = SIGWINCH],
 4690 	[cf_cv_define_sigwinch=yes],
 4691 	[AC_TRY_COMPILE([
 4692 #undef _XOPEN_SOURCE
 4693 #undef _POSIX_SOURCE
 4694 #undef _POSIX_C_SOURCE
 4695 #include <sys/types.h>
 4696 #include <sys/signal.h>
 4697 ],[int x = SIGWINCH],
 4698 	[cf_cv_define_sigwinch=maybe],
 4699 	[cf_cv_define_sigwinch=no])
 4700 ])
 4701 ])
 4702 
 4703 if test "$cf_cv_define_sigwinch" = maybe ; then
 4704 AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
 4705 cf_cv_fixup_sigwinch=unknown
 4706 cf_sigwinch=32
 4707 while test $cf_sigwinch != 1
 4708 do
 4709 	AC_TRY_COMPILE([
 4710 #undef _XOPEN_SOURCE
 4711 #undef _POSIX_SOURCE
 4712 #undef _POSIX_C_SOURCE
 4713 #include <sys/types.h>
 4714 #include <sys/signal.h>
 4715 ],[
 4716 #if SIGWINCH != $cf_sigwinch
 4717 make an error
 4718 #endif
 4719 int x = SIGWINCH],
 4720 	[cf_cv_fixup_sigwinch=$cf_sigwinch
 4721 	 break])
 4722 
 4723 cf_sigwinch=`expr $cf_sigwinch - 1`
 4724 done
 4725 ])
 4726 
 4727 	if test "$cf_cv_fixup_sigwinch" != unknown ; then
 4728 		CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
 4729 	fi
 4730 fi
 4731 ])dnl
 4732 dnl ---------------------------------------------------------------------------
 4733 dnl CF_SIG_ARGS version: 2 updated: 1997/08/28 23:57:55
 4734 dnl -----------
 4735 dnl Check for systems that have signal-handlers prototyped with one argument
 4736 dnl versus those with more than one argument, define the symbol SIG_ARGS to
 4737 dnl match.  (If it's empty, that's ok too).
 4738 AC_DEFUN([CF_SIG_ARGS],
 4739 [
 4740 AC_MSG_CHECKING([declaration of signal arguments])
 4741 AC_CACHE_VAL(cf_cv_sig_args,[
 4742 cf_cv_sig_args=
 4743 for cf_test in "int sig" "int sig, ..."
 4744 do
 4745 	AC_TRY_COMPILE([
 4746 #include <signal.h>],
 4747 	[extern RETSIGTYPE catch($cf_test); signal(SIGINT, catch)],
 4748 	[cf_cv_sig_args="$cf_test";break])
 4749 done
 4750 ])
 4751 AC_MSG_RESULT($cf_cv_sig_args)
 4752 AC_DEFINE_UNQUOTED(SIG_ARGS,$cf_cv_sig_args)
 4753 ])dnl
 4754 dnl ---------------------------------------------------------------------------
 4755 dnl CF_SIG_CONST version: 4 updated: 2010/10/23 15:52:32
 4756 dnl ------------
 4757 dnl Check for systems where the special signal constants aren't prototyped
 4758 dnl (there's a lot of them, and the compiler can generate a lot of warning
 4759 dnl messages that make it hard to pick out genuine errors).
 4760 AC_DEFUN([CF_SIG_CONST],
 4761 [
 4762 AC_REQUIRE([CF_SIG_ARGS])
 4763 AC_MSG_CHECKING([for redefinable signal constants])
 4764 AC_CACHE_VAL(cf_cv_sig_const,[
 4765 cf_cv_sig_const=no
 4766 if test -n "$cf_cv_sig_args"; then
 4767 	cf_test=`echo $cf_cv_sig_args|sed -e s/sig//`
 4768 	AC_TRY_RUN([
 4769 #define NEW_DFL	((RETSIGTYPE (*)($cf_test))0)
 4770 #define NEW_IGN	((RETSIGTYPE (*)($cf_test))1)
 4771 #define NEW_ERR	((RETSIGTYPE (*)($cf_test))-1)
 4772 
 4773 #include <signal.h>
 4774 
 4775 int main()
 4776 {
 4777 	if (NEW_DFL != SIG_DFL
 4778 	 || NEW_IGN != SIG_IGN
 4779 	 || NEW_ERR != SIG_ERR
 4780 	 /* at least one system won't let me redefine these! */
 4781 #undef SIG_DFL
 4782 #undef SIG_IGN
 4783 #undef SIG_ERR
 4784 #define SIG_DFL NEW_DFL
 4785 #define SIG_IGN NEW_IGN
 4786 #define SIG_ERR NEW_ERR
 4787 	 || NEW_DFL != SIG_DFL)
 4788 	 	${cf_cv_main_return:-return}(1);
 4789 	signal(SIGINT, SIG_DFL);
 4790 	${cf_cv_main_return:-return}(0);
 4791 }],
 4792 	[cf_cv_sig_const=yes],
 4793 	[cf_cv_sig_const=no],
 4794 	[cf_cv_sig_const=unknown])
 4795 fi
 4796 ])
 4797 AC_MSG_RESULT($cf_cv_sig_const)
 4798 test "$cf_cv_sig_const" = yes && AC_DEFINE(DECL_SIG_CONST)
 4799 ])dnl
 4800 dnl ---------------------------------------------------------------------------
 4801 dnl CF_SIZECHANGE version: 14 updated: 2018/06/20 20:23:13
 4802 dnl -------------
 4803 dnl Check for definitions & structures needed for window size-changing
 4804 dnl
 4805 dnl https://stackoverflow.com/questions/18878141/difference-between-structures-ttysize-and-winsize/50769952#50769952
 4806 AC_DEFUN([CF_SIZECHANGE],
 4807 [
 4808 AC_REQUIRE([CF_STRUCT_TERMIOS])
 4809 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
 4810 	cf_cv_sizechange=unknown
 4811 	cf_save_CPPFLAGS="$CPPFLAGS"
 4812 
 4813 for cf_opts in "" "NEED_PTEM_H"
 4814 do
 4815 
 4816 	CPPFLAGS="$cf_save_CPPFLAGS"
 4817 	if test -n "$cf_opts"
 4818 	then
 4819 		CF_APPEND_TEXT(CPPFLAGS,-D$cf_opts)
 4820 	fi
 4821 	AC_TRY_COMPILE([#include <sys/types.h>
 4822 #ifdef HAVE_TERMIOS_H
 4823 #include <termios.h>
 4824 #else
 4825 #ifdef HAVE_TERMIO_H
 4826 #include <termio.h>
 4827 #endif
 4828 #endif
 4829 
 4830 #ifdef NEED_PTEM_H
 4831 /* This is a workaround for SCO:  they neglected to define struct winsize in
 4832  * termios.h -- it's only in termio.h and ptem.h
 4833  */
 4834 #include <sys/stream.h>
 4835 #include <sys/ptem.h>
 4836 #endif
 4837 
 4838 #ifdef HAVE_SYS_IOCTL_H
 4839 #include <sys/ioctl.h>
 4840 #endif
 4841 ],[
 4842 #ifdef TIOCGSIZE
 4843 	struct ttysize win;	/* SunOS 3.0... */
 4844 	int y = win.ts_lines;
 4845 	int x = win.ts_cols;
 4846 #else
 4847 #ifdef TIOCGWINSZ
 4848 	struct winsize win;	/* everything else */
 4849 	int y = win.ws_row;
 4850 	int x = win.ws_col;
 4851 #else
 4852 	no TIOCGSIZE or TIOCGWINSZ
 4853 #endif /* TIOCGWINSZ */
 4854 #endif /* TIOCGSIZE */
 4855 	],
 4856 	[cf_cv_sizechange=yes],
 4857 	[cf_cv_sizechange=no])
 4858 
 4859 	CPPFLAGS="$cf_save_CPPFLAGS"
 4860 	if test "$cf_cv_sizechange" = yes ; then
 4861 		echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
 4862 		test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
 4863 		break
 4864 	fi
 4865 done
 4866 ])
 4867 if test "$cf_cv_sizechange" != no ; then
 4868 	AC_DEFINE(HAVE_SIZECHANGE,1,[Define to 1 if sizechange declarations are provided])
 4869 	case $cf_cv_sizechange in
 4870 	(NEED*)
 4871 		AC_DEFINE_UNQUOTED($cf_cv_sizechange )
 4872 		;;
 4873 	esac
 4874 fi
 4875 ])dnl
 4876 dnl ---------------------------------------------------------------------------
 4877 dnl CF_SOCKS version: 9 updated: 2012/11/08 20:57:52
 4878 dnl --------
 4879 dnl Check for socks library
 4880 dnl $1 = the [optional] directory in which the library may be found
 4881 AC_DEFUN([CF_SOCKS],[
 4882   CF_ADD_OPTIONAL_PATH($1, [socks library])
 4883   CF_FIND_LINKAGE([
 4884 #include <stdio.h>
 4885 ],[
 4886       Raccept((char *)0)
 4887 ],
 4888       socks)
 4889 
 4890   if test "x$cf_cv_find_linkage_socks" = "xyes" ; then
 4891     AC_DEFINE(SOCKS,1,[Define to 1 if we are using socks library])
 4892 
 4893     AC_DEFINE(accept,Raccept,[Define to override function name if using socks library])
 4894     AC_DEFINE(bind,Rbind,[Define to override function name if using socks library])
 4895     AC_DEFINE(connect,Rconnect,[Define to override function name if using socks library])
 4896     AC_DEFINE(getpeername,Rgetpeername,[Define to override function name if using socks library])
 4897     AC_DEFINE(getsockname,Rgetsockname,[Define to override function name if using socks library])
 4898     AC_DEFINE(listen,Rlisten,[Define to override function name if using socks library])
 4899     AC_DEFINE(recvfrom,Rrecvfrom,[Define to override function name if using socks library])
 4900     AC_DEFINE(select,Rselect,[Define to override function name if using socks library])
 4901   else
 4902     AC_MSG_ERROR(cannot link with socks library)
 4903   fi
 4904 ])dnl
 4905 dnl ---------------------------------------------------------------------------
 4906 dnl CF_SOCKS5 version: 12 updated: 2012/11/08 20:57:52
 4907 dnl ---------
 4908 dnl Check for socks5 configuration
 4909 dnl $1 = the [optional] directory in which the library may be found
 4910 AC_DEFUN([CF_SOCKS5],[
 4911   CF_ADD_OPTIONAL_PATH($1, [socks5 library])
 4912 
 4913 CF_ADD_LIBS(-lsocks5)
 4914 
 4915 AC_DEFINE(USE_SOCKS5,1,[Define to 1 if we are using socks5 library])
 4916 AC_DEFINE(SOCKS,1,[Define to 1 if we are using socks library])
 4917 
 4918 AC_MSG_CHECKING(if the socks library uses socks4 prefix)
 4919 cf_use_socks4=error
 4920 AC_TRY_LINK([
 4921 #include <socks.h>],[
 4922 	Rinit((char *)0)],
 4923 	[AC_DEFINE(USE_SOCKS4_PREFIX,1,[Define to 1 if socks library uses socks4 prefix])
 4924 	 cf_use_socks4=yes],
 4925 	[AC_TRY_LINK([#include <socks.h>],
 4926 		[SOCKSinit((char *)0)],
 4927 		[cf_use_socks4=no],
 4928 		[AC_MSG_ERROR(Cannot link with socks5 library)])])
 4929 AC_MSG_RESULT($cf_use_socks4)
 4930 
 4931 if test "$cf_use_socks4" = "yes" ; then
 4932 	AC_DEFINE(accept,Raccept)
 4933 	AC_DEFINE(bind,Rbind)
 4934 	AC_DEFINE(connect,Rconnect)
 4935 	AC_DEFINE(getpeername,Rgetpeername)
 4936 	AC_DEFINE(getsockname,Rgetsockname)
 4937 	AC_DEFINE(listen,Rlisten)
 4938 	AC_DEFINE(recvfrom,Rrecvfrom)
 4939 	AC_DEFINE(select,Rselect)
 4940 else
 4941 	AC_DEFINE(accept,SOCKSaccept)
 4942 	AC_DEFINE(getpeername,SOCKSgetpeername)
 4943 	AC_DEFINE(getsockname,SOCKSgetsockname)
 4944 	AC_DEFINE(recvfrom,SOCKSrecvfrom)
 4945 fi
 4946 
 4947 AC_MSG_CHECKING(if socks5p.h is available)
 4948 AC_TRY_COMPILE([
 4949 #define INCLUDE_PROTOTYPES
 4950 #include <socks.h>],[
 4951 	init((char *)0)],
 4952 	[cf_use_socks5p_h=yes],
 4953 	[cf_use_socks5p_h=no])
 4954 AC_MSG_RESULT($cf_use_socks5p_h)
 4955 
 4956 test "$cf_use_socks5p_h" = yes && AC_DEFINE(INCLUDE_PROTOTYPES,1,[Define to 1 if needed to declare prototypes in socks headers])
 4957 ])dnl
 4958 dnl ---------------------------------------------------------------------------
 4959 dnl CF_STRERROR version: 2 updated: 2001/07/11 09:34:49
 4960 dnl -----------
 4961 dnl Check for strerror(), or it is not found, for the related data.  POSIX
 4962 dnl requires strerror(), so only old systems such as SunOS lack it.
 4963 AC_DEFUN([CF_STRERROR],[
 4964 AC_CHECK_FUNCS(strerror, AC_DEFINE(HAVE_STRERROR),[CF_SYS_ERRLIST])
 4965 ])dnl
 4966 dnl ---------------------------------------------------------------------------
 4967 dnl CF_STRUCT_TERMIOS version: 9 updated: 2018/06/08 21:57:23
 4968 dnl -----------------
 4969 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
 4970 AC_DEFUN([CF_STRUCT_TERMIOS],[
 4971 AC_REQUIRE([CF_XOPEN_SOURCE])
 4972 
 4973 AC_CHECK_HEADERS( \
 4974 termio.h \
 4975 termios.h \
 4976 unistd.h \
 4977 sys/ioctl.h \
 4978 sys/termio.h \
 4979 )
 4980 
 4981 if test "$ac_cv_header_termios_h" = yes ; then
 4982 	case "$CFLAGS $CPPFLAGS" in
 4983 	(*-D_POSIX_SOURCE*)
 4984 		termios_bad=dunno ;;
 4985 	(*)	termios_bad=maybe ;;
 4986 	esac
 4987 	if test "$termios_bad" = maybe ; then
 4988 	AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
 4989 	AC_TRY_COMPILE([#include <termios.h>],
 4990 		[struct termios foo; int x = foo.c_iflag],
 4991 		termios_bad=no, [
 4992 		AC_TRY_COMPILE([
 4993 #define _POSIX_SOURCE
 4994 #include <termios.h>],
 4995 			[struct termios foo; int x = foo.c_iflag],
 4996 			termios_bad=unknown,
 4997 			termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE]))
 4998 			])
 4999 	AC_MSG_RESULT($termios_bad)
 5000 	fi
 5001 fi
 5002 ])dnl
 5003 dnl ---------------------------------------------------------------------------
 5004 dnl CF_SUBDIR_PATH version: 7 updated: 2014/12/04 04:33:06
 5005 dnl --------------
 5006 dnl Construct a search-list for a nonstandard header/lib-file
 5007 dnl	$1 = the variable to return as result
 5008 dnl	$2 = the package name
 5009 dnl	$3 = the subdirectory, e.g., bin, include or lib
 5010 AC_DEFUN([CF_SUBDIR_PATH],
 5011 [
 5012 $1=
 5013 
 5014 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
 5015 
 5016 for cf_subdir_prefix in \
 5017 	/usr \
 5018 	/usr/local \
 5019 	/usr/pkg \
 5020 	/opt \
 5021 	/opt/local \
 5022 	[$]HOME
 5023 do
 5024 	CF_ADD_SUBDIR_PATH($1,$2,$3,$cf_subdir_prefix,$prefix)
 5025 done
 5026 ])dnl
 5027 dnl ---------------------------------------------------------------------------
 5028 dnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23
 5029 dnl --------------
 5030 dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and
 5031 dnl errno.h.  Declaration of sys_errlist on BSD4.4 interferes with our
 5032 dnl declaration.  Reported by Keith Bostic.
 5033 AC_DEFUN([CF_SYS_ERRLIST],
 5034 [
 5035     CF_CHECK_ERRNO(sys_nerr)
 5036     CF_CHECK_ERRNO(sys_errlist)
 5037 ])dnl
 5038 dnl ---------------------------------------------------------------------------
 5039 dnl CF_SYS_SELECT_TIMEVAL version: 4 updated: 1997/12/16 11:22:31
 5040 dnl ---------------------
 5041 dnl Check if there is a conflict between <sys/select.h> and <sys/time.h>.
 5042 dnl This is known to be a problem with SCO.
 5043 AC_DEFUN([CF_SYS_SELECT_TIMEVAL],
 5044 [
 5045 AC_MSG_CHECKING(if sys/time.h conflicts with sys/select.h)
 5046 AC_CACHE_VAL(cf_cv_sys_select_timeval,[
 5047 for cf_opts in no yes
 5048 do
 5049 AC_TRY_COMPILE([
 5050 #define yes 1
 5051 #define no 0
 5052 #if $cf_opts
 5053 #define timeval fake_timeval
 5054 #endif
 5055 #include <sys/types.h>
 5056 #ifdef TIME_WITH_SYS_TIME
 5057 #	include <sys/time.h>
 5058 #	include <time.h>
 5059 #else
 5060 #	ifdef HAVE_SYS_TIME_H
 5061 #		include <sys/time.h>
 5062 #	else
 5063 #		include <time.h>
 5064 #	endif
 5065 #endif
 5066 #undef timeval
 5067 #ifdef HAVE_SYS_SELECT_H
 5068 #	include <sys/select.h>
 5069 #endif
 5070 ],[struct timeval foo],
 5071 	[cf_cv_sys_select_timeval=$cf_opts
 5072 	 break],
 5073 	[cf_cv_sys_select_timeval=no])
 5074 done
 5075 ])
 5076 AC_MSG_RESULT($cf_cv_sys_select_timeval)
 5077 test $cf_cv_sys_select_timeval = yes && AC_DEFINE(NEED_TIMEVAL_FIX)
 5078 ])
 5079 dnl ---------------------------------------------------------------------------
 5080 dnl CF_TERMCAP_LIBS version: 15 updated: 2015/04/15 19:08:48
 5081 dnl ---------------
 5082 dnl Look for termcap libraries, or the equivalent in terminfo.
 5083 dnl
 5084 dnl The optional parameter may be "ncurses", "ncursesw".
 5085 AC_DEFUN([CF_TERMCAP_LIBS],
 5086 [
 5087 AC_CACHE_VAL(cf_cv_termlib,[
 5088 cf_cv_termlib=none
 5089 AC_TRY_LINK([],[char *x=(char*)tgoto("",0,0)],
 5090 [AC_TRY_LINK([],[int x=tigetstr("")],
 5091 	[cf_cv_termlib=terminfo],
 5092 	[cf_cv_termlib=termcap])
 5093 	CF_VERBOSE(using functions in predefined $cf_cv_termlib LIBS)
 5094 ],[
 5095 ifelse([$1],,,[
 5096 case "$1" in
 5097 (ncurses*)
 5098 	CF_NCURSES_CONFIG($1)
 5099 	cf_cv_termlib=terminfo
 5100 	;;
 5101 esac
 5102 ])
 5103 if test "$cf_cv_termlib" = none; then
 5104 	# FreeBSD's linker gives bogus results for AC_CHECK_LIB, saying that
 5105 	# tgetstr lives in -lcurses when it is only an unsatisfied extern.
 5106 	cf_save_LIBS="$LIBS"
 5107 	for cf_lib in tinfo curses ncurses termlib termcap
 5108 	do
 5109 		LIBS="-l$cf_lib $cf_save_LIBS"
 5110 		for cf_func in tigetstr tgetstr
 5111 		do
 5112 			AC_MSG_CHECKING(for $cf_func in -l$cf_lib)
 5113 			AC_TRY_LINK([],[int x=$cf_func("")],[cf_result=yes],[cf_result=no])
 5114 			AC_MSG_RESULT($cf_result)
 5115 			if test "$cf_result" = yes ; then
 5116 				if test "$cf_func" = tigetstr ; then
 5117 					cf_cv_termlib=terminfo
 5118 				else
 5119 					cf_cv_termlib=termcap
 5120 				fi
 5121 				break
 5122 			fi
 5123 		done
 5124 		test "$cf_result" = yes && break
 5125 	done
 5126 	test "$cf_result" = no && LIBS="$cf_save_LIBS"
 5127 fi
 5128 if test "$cf_cv_termlib" = none; then
 5129 	# allow curses library for broken AIX system.
 5130 	AC_CHECK_LIB(curses, initscr, [CF_ADD_LIBS(-lcurses)])
 5131 	AC_CHECK_LIB(termcap, tgoto, [CF_ADD_LIBS(-ltermcap) cf_cv_termlib=termcap])
 5132 fi
 5133 ])
 5134 if test "$cf_cv_termlib" = none; then
 5135 	AC_MSG_WARN([Cannot find -ltermlib, -lcurses, or -ltermcap])
 5136 fi
 5137 ])])dnl
 5138 dnl ---------------------------------------------------------------------------
 5139 dnl CF_TERMIOS version: 2 updated: 1997/08/28 23:57:55
 5140 dnl ----------
 5141 dnl See if we can link with the termios functions tcsetattr/tcgetattr
 5142 AC_DEFUN([CF_TERMIOS],
 5143 [
 5144 AC_MSG_CHECKING([for nonconflicting termios.h])
 5145 AC_CACHE_VAL(cf_cv_use_termios_h,[
 5146 	AC_TRY_LINK([
 5147 #ifdef HAVE_IOCTL_H
 5148 #	include <ioctl.h>
 5149 #else
 5150 #	ifdef HAVE_SYS_IOCTL_H
 5151 #		include <sys/ioctl.h>
 5152 #	endif
 5153 #endif
 5154 
 5155 #if !defined(sun) || !defined(NL0)
 5156 #include <termios.h>
 5157 #endif
 5158 ],[
 5159 	struct termios save_tty;
 5160 	(void) tcsetattr (0, TCSANOW, &save_tty);
 5161 	(void) tcgetattr (0, &save_tty)],
 5162 	[cf_cv_use_termios_h=yes],
 5163 	[cf_cv_use_termios_h=no])
 5164 ])
 5165 AC_MSG_RESULT($cf_cv_use_termios_h)
 5166 if test $cf_cv_use_termios_h = yes; then
 5167 	AC_DEFINE(HAVE_TERMIOS_H)
 5168 	AC_DEFINE(HAVE_TCGETATTR)
 5169 	AC_DEFINE(HAVE_TCSETATTR)
 5170 fi
 5171 ])dnl
 5172 dnl ---------------------------------------------------------------------------
 5173 dnl CF_TERM_HEADER version: 4 updated: 2015/04/15 19:08:48
 5174 dnl --------------
 5175 dnl Look for term.h, which is part of X/Open curses.  It defines the interface
 5176 dnl to terminfo database.  Usually it is in the same include-path as curses.h,
 5177 dnl but some packagers change this, breaking various applications.
 5178 AC_DEFUN([CF_TERM_HEADER],[
 5179 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
 5180 case ${cf_cv_ncurses_header} in
 5181 (*/ncurses.h|*/ncursesw.h)
 5182 	cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
 5183 	;;
 5184 (*)
 5185 	cf_term_header=term.h
 5186 	;;
 5187 esac
 5188 
 5189 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
 5190 do
 5191 AC_TRY_COMPILE([#include <stdio.h>
 5192 #include <${cf_cv_ncurses_header:-curses.h}>
 5193 #include <$cf_test>
 5194 ],[int x = auto_left_margin],[
 5195 	cf_cv_term_header="$cf_test"],[
 5196 	cf_cv_term_header=unknown
 5197 	])
 5198 	test "$cf_cv_term_header" != unknown && break
 5199 done
 5200 ])
 5201 
 5202 # Set definitions to allow ifdef'ing to accommodate subdirectories
 5203 
 5204 case $cf_cv_term_header in
 5205 (*term.h)
 5206 	AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
 5207 	;;
 5208 esac
 5209 
 5210 case $cf_cv_term_header in
 5211 (ncurses/term.h)
 5212 	AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
 5213 	;;
 5214 (ncursesw/term.h)
 5215 	AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
 5216 	;;
 5217 esac
 5218 ])dnl
 5219 dnl ---------------------------------------------------------------------------
 5220 dnl CF_TIOCGWINSZ version: 5 updated: 2010/10/23 15:52:32
 5221 dnl -------------
 5222 dnl On some systems ioctl(fd, TIOCGWINSZ, &size) will always return {0,0} until
 5223 dnl ioctl(fd, TIOCSWINSZ, &size) is called to explicitly set the size of the
 5224 dnl screen.
 5225 dnl
 5226 dnl Attempt to determine if we're on such a system by running a test-program.
 5227 dnl This won't work, of course, if the configure script is run in batch mode,
 5228 dnl since we've got to have access to the terminal.
 5229 dnl
 5230 dnl CHECK_DECL_FLAG and CHECK_DECL_HDRS must be set in configure.in
 5231 AC_DEFUN([CF_TIOCGWINSZ],
 5232 [
 5233 AC_MSG_CHECKING([for working TIOCGWINSZ])
 5234 AC_CACHE_VAL(cf_cv_use_tiocgwinsz,[
 5235 	cf_save_CFLAGS="$CFLAGS"
 5236 	CFLAGS="$CFLAGS -D__CPROTO__ $CHECK_DECL_FLAG"
 5237 	AC_TRY_RUN([
 5238 $CHECK_DECL_HDRS
 5239 int main()
 5240 {
 5241 	int fd;
 5242 	for (fd = 0; fd <= 2; fd++) {	/* try in/out/err in case redirected */
 5243 #ifdef TIOCGSIZE
 5244 		struct ttysize size;
 5245 		if (ioctl (0, TIOCGSIZE, &size) == 0
 5246 		 && size.ts_lines > 0
 5247 		 && size.ts_cols > 0)
 5248 			${cf_cv_main_return:-return}(0);
 5249 #else
 5250 		struct winsize size;
 5251 		if (ioctl(0, TIOCGWINSZ, &size) == 0
 5252 		 && size.ws_row > 0
 5253 		 && size.ws_col > 0)
 5254 			${cf_cv_main_return:-return}(0);
 5255 #endif
 5256 	}
 5257 	${cf_cv_main_return:-return}(0);	/* we cannot guarantee this is run interactively */
 5258 }],
 5259 		[cf_cv_use_tiocgwinsz=yes],
 5260 		[cf_cv_use_tiocgwinsz=no],
 5261 		[cf_cv_use_tiocgwinsz=unknown])
 5262 		rm -f autoconf.h
 5263 		CFLAGS="$cf_save_CFLAGS"])
 5264 AC_MSG_RESULT($cf_cv_use_tiocgwinsz)
 5265 test $cf_cv_use_tiocgwinsz != yes && AC_DEFINE(DONT_HAVE_SIGWINCH)
 5266 ])dnl
 5267 dnl ---------------------------------------------------------------------------
 5268 dnl CF_TM_GMTOFF version: 3 updated: 2012/11/08 20:57:52
 5269 dnl ------------
 5270 dnl Check if the tm-struct defines the '.tm_gmtoff' member (useful in decoding
 5271 dnl dates).
 5272 AC_DEFUN([CF_TM_GMTOFF],
 5273 [
 5274 AC_MSG_CHECKING([for tm.tm_gmtoff])
 5275 AC_CACHE_VAL(cf_cv_tm_gmtoff,[
 5276 	AC_TRY_COMPILE([
 5277 #ifdef TIME_WITH_SYS_TIME
 5278 #	include <sys/time.h>
 5279 #	include <time.h>
 5280 #else
 5281 #	ifdef HAVE_SYS_TIME_H
 5282 #		include <sys/time.h>
 5283 #	else
 5284 #		include <time.h>
 5285 #	endif
 5286 #endif
 5287 ],[
 5288 	struct tm foo;
 5289 	long bar = foo.tm_gmtoff],
 5290 	[cf_cv_tm_gmtoff=yes],
 5291 	[cf_cv_tm_gmtoff=no])])
 5292 AC_MSG_RESULT($cf_cv_tm_gmtoff)
 5293 test $cf_cv_tm_gmtoff = no && AC_DEFINE(DONT_HAVE_TM_GMTOFF,1,[Define to 1 if the tm-struct defines .tm_gmtoff member])
 5294 ])dnl
 5295 dnl ---------------------------------------------------------------------------
 5296 dnl CF_TRIM_X_LIBS version: 3 updated: 2015/04/12 15:39:00
 5297 dnl --------------
 5298 dnl Trim extra base X libraries added as a workaround for inconsistent library
 5299 dnl dependencies returned by "new" pkg-config files.
 5300 AC_DEFUN([CF_TRIM_X_LIBS],[
 5301 	for cf_trim_lib in Xmu Xt X11
 5302 	do
 5303 		case "$LIBS" in
 5304 		(*-l$cf_trim_lib\ *-l$cf_trim_lib*)
 5305 			LIBS=`echo "$LIBS " | sed -e 's/  / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'`
 5306 			CF_VERBOSE(..trimmed $LIBS)
 5307 			;;
 5308 		esac
 5309 	done
 5310 ])
 5311 dnl ---------------------------------------------------------------------------
 5312 dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06
 5313 dnl -----------------
 5314 dnl This is a simple wrapper to use for pkg-config, for libraries which may be
 5315 dnl available in that form.
 5316 dnl
 5317 dnl $1 = package name
 5318 dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS
 5319 dnl $3 = logic to use if pkg-config does not have the package
 5320 AC_DEFUN([CF_TRY_PKG_CONFIG],[
 5321 AC_REQUIRE([CF_PKG_CONFIG])
 5322 
 5323 if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then
 5324 	CF_VERBOSE(found package $1)
 5325 	cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`"
 5326 	cf_pkgconfig_libs="`$PKG_CONFIG --libs   $1 2>/dev/null`"
 5327 	CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs)
 5328 	CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs)
 5329 	CF_ADD_CFLAGS($cf_pkgconfig_incs)
 5330 	CF_ADD_LIBS($cf_pkgconfig_libs)
 5331 	ifelse([$2],,:,[$2])
 5332 else
 5333 	cf_pkgconfig_incs=
 5334 	cf_pkgconfig_libs=
 5335 	ifelse([$3],,:,[$3])
 5336 fi
 5337 ])
 5338 dnl ---------------------------------------------------------------------------
 5339 dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13
 5340 dnl -------------------
 5341 dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
 5342 dnl can define it successfully.
 5343 AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
 5344 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
 5345 	AC_TRY_COMPILE([
 5346 #include <stdlib.h>
 5347 #include <string.h>
 5348 #include <sys/types.h>
 5349 ],[
 5350 #ifndef _XOPEN_SOURCE
 5351 make an error
 5352 #endif],
 5353 	[cf_cv_xopen_source=no],
 5354 	[cf_save="$CPPFLAGS"
 5355 	 CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE)
 5356 	 AC_TRY_COMPILE([
 5357 #include <stdlib.h>
 5358 #include <string.h>
 5359 #include <sys/types.h>
 5360 ],[
 5361 #ifdef _XOPEN_SOURCE
 5362 make an error
 5363 #endif],
 5364 	[cf_cv_xopen_source=no],
 5365 	[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
 5366 	CPPFLAGS="$cf_save"
 5367 	])
 5368 ])
 5369 
 5370 if test "$cf_cv_xopen_source" != no ; then
 5371 	CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
 5372 	CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
 5373 	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
 5374 	CF_ADD_CFLAGS($cf_temp_xopen_source)
 5375 fi
 5376 ])
 5377 dnl ---------------------------------------------------------------------------
 5378 dnl CF_TYPE_OUTCHAR version: 15 updated: 2015/05/15 19:42:24
 5379 dnl ---------------
 5380 dnl Check for return and param type of 3rd -- OutChar() -- param of tputs().
 5381 dnl
 5382 dnl For this check, and for CF_CURSES_TERMCAP, the $CHECK_DECL_HDRS variable
 5383 dnl must point to a header file containing this (or equivalent):
 5384 dnl
 5385 dnl	#ifdef NEED_CURSES_H
 5386 dnl	# ifdef HAVE_NCURSES_NCURSES_H
 5387 dnl	#  include <ncurses/ncurses.h>
 5388 dnl	# else
 5389 dnl	#  ifdef HAVE_NCURSES_H
 5390 dnl	#   include <ncurses.h>
 5391 dnl	#  else
 5392 dnl	#   include <curses.h>
 5393 dnl	#  endif
 5394 dnl	# endif
 5395 dnl	#endif
 5396 dnl
 5397 dnl	#ifdef HAVE_NCURSES_TERM_H
 5398 dnl	#  include <ncurses/term.h>
 5399 dnl	#else
 5400 dnl	# ifdef HAVE_TERM_H
 5401 dnl	#  include <term.h>
 5402 dnl	# endif
 5403 dnl	#endif
 5404 dnl
 5405 dnl	#if NEED_TERMCAP_H
 5406 dnl	# include <termcap.h>
 5407 dnl	#endif
 5408 dnl
 5409 AC_DEFUN([CF_TYPE_OUTCHAR],
 5410 [
 5411 AC_REQUIRE([CF_CURSES_TERMCAP])
 5412 
 5413 AC_CACHE_CHECK(declaration of tputs 3rd param, cf_cv_type_outchar,[
 5414 
 5415 cf_cv_type_outchar="int OutChar(int)"
 5416 cf_cv_found=no
 5417 cf_save_CPPFLAGS="$CPPFLAGS"
 5418 CPPFLAGS="$CPPFLAGS $CHECK_DECL_FLAG"
 5419 
 5420 for P in int void; do
 5421 for Q in int void; do
 5422 for R in int char; do
 5423 for S in "" const; do
 5424 	CF_MSG_LOG(loop variables [P:[$]P, Q:[$]Q, R:[$]R, S:[$]S])
 5425 	AC_TRY_COMPILE([$CHECK_DECL_HDRS],
 5426 	[extern $Q OutChar($R);
 5427 	extern $P tputs ($S char *string, int nlines, $Q (*_f)($R));
 5428 	tputs("", 1, OutChar)],
 5429 	[cf_cv_type_outchar="$Q OutChar($R)"
 5430 	 cf_cv_found=yes
 5431 	 break])
 5432 done
 5433 	test $cf_cv_found = yes && break
 5434 done
 5435 	test $cf_cv_found = yes && break
 5436 done
 5437 	test $cf_cv_found = yes && break
 5438 done
 5439 ])
 5440 
 5441 case $cf_cv_type_outchar in
 5442 (int*)
 5443 	AC_DEFINE(OUTC_RETURN,1,[Define to 1 if tputs outc function returns a value])
 5444 	;;
 5445 esac
 5446 case $cf_cv_type_outchar in
 5447 (*char*)
 5448 	AC_DEFINE(OUTC_ARGS,char c,[Define to actual type to override tputs outc parameter type])
 5449 	;;
 5450 esac
 5451 
 5452 CPPFLAGS="$cf_save_CPPFLAGS"
 5453 ])dnl
 5454 dnl ---------------------------------------------------------------------------
 5455 dnl CF_TYPE_SIGACTION version: 4 updated: 2012/10/06 17:56:13
 5456 dnl -----------------
 5457 dnl
 5458 AC_DEFUN([CF_TYPE_SIGACTION],
 5459 [
 5460 AC_MSG_CHECKING([for type sigaction_t])
 5461 AC_CACHE_VAL(cf_cv_type_sigaction,[
 5462 	AC_TRY_COMPILE([
 5463 #include <signal.h>],
 5464 		[sigaction_t x],
 5465 		[cf_cv_type_sigaction=yes],
 5466 		[cf_cv_type_sigaction=no])])
 5467 AC_MSG_RESULT($cf_cv_type_sigaction)
 5468 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION,1,[Define to 1 if we have the sigaction_t type])
 5469 ])dnl
 5470 dnl ---------------------------------------------------------------------------
 5471 dnl CF_UNION_WAIT version: 6 updated: 2012/10/06 08:57:51
 5472 dnl -------------
 5473 dnl Check to see if the BSD-style union wait is declared.  Some platforms may
 5474 dnl use this, though it is deprecated in favor of the 'int' type in Posix.
 5475 dnl Some vendors provide a bogus implementation that declares union wait, but
 5476 dnl uses the 'int' type instead; we try to spot these by checking for the
 5477 dnl associated macros.
 5478 dnl
 5479 dnl Ahem.  Some implementers cast the status value to an int*, as an attempt to
 5480 dnl use the macros for either union wait or int.  So we do a check compile to
 5481 dnl see if the macros are defined and apply to an int.
 5482 dnl
 5483 dnl Sets: $cf_cv_type_unionwait
 5484 dnl Defines: HAVE_TYPE_UNIONWAIT
 5485 AC_DEFUN([CF_UNION_WAIT],
 5486 [
 5487 AC_REQUIRE([CF_WAIT_HEADERS])
 5488 AC_MSG_CHECKING([for union wait])
 5489 AC_CACHE_VAL(cf_cv_type_unionwait,[
 5490 	AC_TRY_LINK($cf_wait_headers,
 5491 	[int x;
 5492 	 int y = WEXITSTATUS(x);
 5493 	 int z = WTERMSIG(x);
 5494 	 wait(&x);
 5495 	],
 5496 	[cf_cv_type_unionwait=no
 5497 	 echo compiles ok w/o union wait 1>&AC_FD_CC
 5498 	],[
 5499 	AC_TRY_LINK($cf_wait_headers,
 5500 	[union wait x;
 5501 #ifdef WEXITSTATUS
 5502 	 int y = WEXITSTATUS(x);
 5503 #endif
 5504 #ifdef WTERMSIG
 5505 	 int z = WTERMSIG(x);
 5506 #endif
 5507 	 wait(&x);
 5508 	],
 5509 	[cf_cv_type_unionwait=yes
 5510 	 echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC
 5511 	],
 5512 	[cf_cv_type_unionwait=no])])])
 5513 AC_MSG_RESULT($cf_cv_type_unionwait)
 5514 test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT,1,[Define to 1 if type unionwait is declared])
 5515 ])dnl
 5516 dnl ---------------------------------------------------------------------------
 5517 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
 5518 dnl --------
 5519 dnl Make an uppercase version of a variable
 5520 dnl $1=uppercase($2)
 5521 AC_DEFUN([CF_UPPER],
 5522 [
 5523 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 5524 ])dnl
 5525 dnl ---------------------------------------------------------------------------
 5526 dnl CF_VA_COPY version: 5 updated: 2018/12/03 20:07:13
 5527 dnl ----------
 5528 dnl check for va_copy, part of stdarg.h starting with ISO C 1999.
 5529 dnl Also, workaround for glibc's __va_copy, by checking for both.
 5530 dnl Finally, try to accommodate pre-ISO C 1999 headers.
 5531 AC_DEFUN([CF_VA_COPY],[
 5532 AC_CACHE_CHECK(for va_copy, cf_cv_have_va_copy,[
 5533 AC_TRY_LINK([
 5534 #include <stdarg.h>
 5535 ],[
 5536 	static va_list dst;
 5537 	static va_list src;
 5538 	va_copy(dst, src)],
 5539 	cf_cv_have_va_copy=yes,
 5540 	cf_cv_have_va_copy=no)])
 5541 
 5542 if test "$cf_cv_have_va_copy" = yes;
 5543 then
 5544 	AC_DEFINE(HAVE_VA_COPY,1,[Define to 1 if we have va_copy])
 5545 else # !cf_cv_have_va_copy
 5546 
 5547 AC_CACHE_CHECK(for __va_copy, cf_cv_have___va_copy,[
 5548 AC_TRY_LINK([
 5549 #include <stdarg.h>
 5550 ],[
 5551 	static va_list dst;
 5552 	static va_list src;
 5553 	__va_copy(dst, src)],
 5554 	cf_cv_have___va_copy=yes,
 5555 	cf_cv_have___va_copy=no)])
 5556 
 5557 if test "$cf_cv_have___va_copy" = yes
 5558 then
 5559 	AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if we have __va_copy])
 5560 else # !cf_cv_have___va_copy
 5561 
 5562 AC_CACHE_CHECK(for __builtin_va_copy, cf_cv_have___builtin_va_copy,[
 5563 AC_TRY_LINK([
 5564 #include <stdarg.h>
 5565 ],[
 5566 	static va_list dst;
 5567 	static va_list src;
 5568 	__builtin_va_copy(dst, src)],
 5569 	cf_cv_have___builtin_va_copy=yes,
 5570 	cf_cv_have___builtin_va_copy=no)])
 5571 
 5572 test "$cf_cv_have___builtin_va_copy" = yes &&
 5573 	AC_DEFINE(HAVE___BUILTIN_VA_COPY,1,[Define to 1 if we have __builtin_va_copy])
 5574 
 5575 fi # cf_cv_have___va_copy
 5576 
 5577 fi # cf_cv_have_va_copy
 5578 
 5579 case "${cf_cv_have_va_copy}${cf_cv_have___va_copy}${cf_cv_have___builtin_va_copy}" in
 5580 (*yes*)
 5581 	;;
 5582 
 5583 (*)
 5584 	AC_CACHE_CHECK(if we can simply copy va_list, cf_cv_pointer_va_list,[
 5585 AC_TRY_LINK([
 5586 #include <stdarg.h>
 5587 ],[
 5588 	va_list dst;
 5589 	va_list src;
 5590 	dst = src],
 5591 	cf_cv_pointer_va_list=yes,
 5592 	cf_cv_pointer_va_list=no)])
 5593 
 5594 	if test "$cf_cv_pointer_va_list" = no
 5595 	then
 5596 		AC_CACHE_CHECK(if we can copy va_list indirectly, cf_cv_array_va_list,[
 5597 AC_TRY_LINK([
 5598 #include <stdarg.h>
 5599 ],[
 5600 	va_list dst;
 5601 	va_list src;
 5602 	*dst = *src],
 5603 			cf_cv_array_va_list=yes,
 5604 			cf_cv_array_va_list=no)])
 5605 		test "$cf_cv_array_va_list" = yes && AC_DEFINE(ARRAY_VA_LIST,1,[Define to 1 if we can copy va_list indirectly])
 5606 	fi
 5607 	;;
 5608 esac
 5609 ])
 5610 dnl ---------------------------------------------------------------------------
 5611 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
 5612 dnl ----------
 5613 dnl Use AC_VERBOSE w/o the warnings
 5614 AC_DEFUN([CF_VERBOSE],
 5615 [test -n "$verbose" && echo "	$1" 1>&AC_FD_MSG
 5616 CF_MSG_LOG([$1])
 5617 ])dnl
 5618 dnl ---------------------------------------------------------------------------
 5619 dnl CF_WAIT_HEADERS version: 2 updated: 1997/10/21 19:45:33
 5620 dnl ---------------
 5621 dnl Build up an expression $cf_wait_headers with the header files needed to
 5622 dnl compile against the prototypes for 'wait()', 'waitpid()', etc.  Assume it's
 5623 dnl Posix, which uses <sys/types.h> and <sys/wait.h>, but allow SVr4 variation
 5624 dnl with <wait.h>.
 5625 AC_DEFUN([CF_WAIT_HEADERS],
 5626 [
 5627 AC_HAVE_HEADERS(sys/wait.h)
 5628 cf_wait_headers="#include <sys/types.h>
 5629 "
 5630 if test $ac_cv_header_sys_wait_h = yes; then
 5631 cf_wait_headers="$cf_wait_headers
 5632 #include <sys/wait.h>
 5633 "
 5634 else
 5635 AC_HAVE_HEADERS(wait.h)
 5636 AC_HAVE_HEADERS(waitstatus.h)
 5637 if test $ac_cv_header_wait_h = yes; then
 5638 cf_wait_headers="$cf_wait_headers
 5639 #include <wait.h>
 5640 "
 5641 fi
 5642 if test $ac_cv_header_waitstatus_h = yes; then
 5643 cf_wait_headers="$cf_wait_headers
 5644 #include <waitstatus.h>
 5645 "
 5646 fi
 5647 fi
 5648 ])dnl
 5649 dnl ---------------------------------------------------------------------------
 5650 dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38
 5651 dnl ------------------
 5652 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
 5653 dnl libraries.
 5654 AC_DEFUN([CF_WITH_CURSES_DIR],[
 5655 
 5656 AC_MSG_CHECKING(for specific curses-directory)
 5657 AC_ARG_WITH(curses-dir,
 5658 	[  --with-curses-dir=DIR   directory in which (n)curses is installed],
 5659 	[cf_cv_curses_dir=$withval],
 5660 	[cf_cv_curses_dir=no])
 5661 AC_MSG_RESULT($cf_cv_curses_dir)
 5662 
 5663 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
 5664 then
 5665 	CF_PATH_SYNTAX(withval)
 5666 	if test -d "$cf_cv_curses_dir"
 5667 	then
 5668 		CF_ADD_INCDIR($cf_cv_curses_dir/include)
 5669 		CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
 5670 	fi
 5671 fi
 5672 ])dnl
 5673 dnl ---------------------------------------------------------------------------
 5674 dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
 5675 dnl ----------------
 5676 dnl Configure-option for dbmalloc.  The optional parameter is used to override
 5677 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
 5678 AC_DEFUN([CF_WITH_DBMALLOC],[
 5679 CF_NO_LEAKS_OPTION(dbmalloc,
 5680 	[  --with-dbmalloc         test: use Conor Cahill's dbmalloc library],
 5681 	[USE_DBMALLOC])
 5682 
 5683 if test "$with_dbmalloc" = yes ; then
 5684 	AC_CHECK_HEADER(dbmalloc.h,
 5685 		[AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
 5686 fi
 5687 ])dnl
 5688 dnl ---------------------------------------------------------------------------
 5689 dnl CF_WITH_DFTENV version: 4 updated: 2008/03/23 14:48:54
 5690 dnl --------------
 5691 dnl Wrapper for AC_ARG_WITH to inherit/override an environment variable's
 5692 dnl "#define" in the compile.
 5693 dnl $1 = option name
 5694 dnl $2 = help-message
 5695 dnl $3 = name of variable to inherit/override
 5696 dnl $4 = default value of variable, if any
 5697 AC_DEFUN([CF_WITH_DFTENV],
 5698 [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
 5699 ifelse($4,,[withval="${$3}"],[withval="${$3-$4}"]))dnl
 5700 case "$withval" in #(vi
 5701 yes|no)
 5702   AC_MSG_ERROR(expected a value for --with-$1)
 5703   ;;
 5704 esac
 5705 $3="$withval"
 5706 AC_DEFINE_UNQUOTED($3,"[$]$3")dnl
 5707 ])dnl
 5708 dnl ---------------------------------------------------------------------------
 5709 dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
 5710 dnl ---------------
 5711 dnl Configure-option for dmalloc.  The optional parameter is used to override
 5712 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
 5713 AC_DEFUN([CF_WITH_DMALLOC],[
 5714 CF_NO_LEAKS_OPTION(dmalloc,
 5715 	[  --with-dmalloc          test: use Gray Watson's dmalloc library],
 5716 	[USE_DMALLOC])
 5717 
 5718 if test "$with_dmalloc" = yes ; then
 5719 	AC_CHECK_HEADER(dmalloc.h,
 5720 		[AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
 5721 fi
 5722 ])dnl
 5723 dnl ---------------------------------------------------------------------------
 5724 dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19
 5725 dnl ------------
 5726 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
 5727 dnl defaulting to yes/no.
 5728 dnl
 5729 dnl $1 = option name
 5730 dnl $2 = help-text
 5731 dnl $3 = environment variable to set
 5732 dnl $4 = default value, shown in the help-message, must be a constant
 5733 dnl $5 = default value, if it's an expression & cannot be in the help-message
 5734 dnl
 5735 AC_DEFUN([CF_WITH_PATH],
 5736 [AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),,
 5737 ifelse([$4],,[withval="${$3}"],[withval="${$3:-ifelse([$5],,[$4],[$5])}"]))dnl
 5738 if ifelse([$5],,true,[test -n "$5"]) ; then
 5739 CF_PATH_SYNTAX(withval)
 5740 fi
 5741 eval $3="$withval"
 5742 AC_SUBST($3)dnl
 5743 ])dnl
 5744 dnl ---------------------------------------------------------------------------
 5745 dnl CF_WITH_PROGRAM version: 6 updated: 2008/03/23 14:48:54
 5746 dnl ---------------
 5747 dnl Wrapper for AC_PATH_PROG, with command-line option.
 5748 dnl Params:
 5749 dnl $1 = program name
 5750 dnl $2 = help-string (I'd use format, but someone's disable it in autoconf)
 5751 dnl $3 = caller-supplied default if no --with option is given.  If this is
 5752 dnl      blank, the macro uses AC_PATH_PROG.
 5753 AC_DEFUN([CF_WITH_PROGRAM],
 5754 [dnl
 5755 define([cf_path_name], PATH_[]translit($1, [a-z], [A-Z]))dnl
 5756 define([cf_have_name], HAVE_[]translit($1, [a-z], [A-Z]))dnl
 5757 AC_ARG_WITH($1,[$2],ifelse($3,,
 5758 [case "$withval" in #(vi
 5759   yes[)]
 5760    AC_MSG_ERROR(expected a value for --with-$1)
 5761    ;; #(vi
 5762   no[)]
 5763    ;; #(vi
 5764   *[)]
 5765    # user supplied option-value for "--with-$1=path"
 5766    AC_MSG_CHECKING(for $1)
 5767    ac_cv_path_]cf_path_name[="$withval"
 5768    AC_DEFINE_UNQUOTED(cf_path_name,"$withval")dnl
 5769    AC_DEFINE(cf_have_name)dnl
 5770    AC_MSG_RESULT($withval)
 5771    ;;
 5772  esac],[$3]),[
 5773   # user did not specify "--with-$1"; do automatic check
 5774   AC_PATH_PROG(cf_path_name,$1)
 5775   if test -n "$cf_path_name"; then
 5776     AC_DEFINE_UNQUOTED(cf_path_name,"$cf_path_name")dnl
 5777     AC_DEFINE(cf_have_name)dnl
 5778   fi
 5779 ])dnl
 5780 undefine([cf_path_name])undefine([cf_have_name])])dnl
 5781 dnl ---------------------------------------------------------------------------
 5782 dnl CF_WITH_VALUE version: 3 updated: 1998/04/01 11:39:13
 5783 dnl -------------
 5784 dnl Wrapper for AC_ARG_WITH to ensure that if the user supplies a value, it is
 5785 dnl not simply defaulting to yes/no.  Empty strings are ok if the macro is
 5786 dnl invoked without a default value
 5787 dnl $1 = option name
 5788 dnl $2 = help-message
 5789 dnl $3 = variable to inherit/override
 5790 dnl $4 = default value, if any.
 5791 AC_DEFUN([CF_WITH_VALUE],
 5792 [CF_ARG_WITH($1,[$2],[$3],[$4])
 5793  AC_DEFINE_UNQUOTED($3,"$withval")dnl
 5794 ])dnl
 5795 dnl ---------------------------------------------------------------------------
 5796 dnl CF_XOPEN_CURSES version: 14 updated: 2018/06/20 20:23:13
 5797 dnl ---------------
 5798 dnl Test if we should define X/Open source for curses, needed on Digital Unix
 5799 dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
 5800 dnl
 5801 dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
 5802 dnl as getbegy().  The latter is better design, but the former is standard.
 5803 AC_DEFUN([CF_XOPEN_CURSES],
 5804 [
 5805 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
 5806 AC_CACHE_CHECK(definition to turn on extended curses functions,cf_cv_need_xopen_extension,[
 5807 cf_cv_need_xopen_extension=unknown
 5808 AC_TRY_LINK([
 5809 #include <stdlib.h>
 5810 #include <${cf_cv_ncurses_header:-curses.h}>],[
 5811 #if defined(NCURSES_VERSION_PATCH)
 5812 #if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
 5813 	make an error
 5814 #endif
 5815 #endif
 5816 #ifdef NCURSES_VERSION
 5817 	cchar_t check;
 5818 	int check2 = curs_set((int)sizeof(check));
 5819 #endif
 5820 	long x = winnstr(stdscr, "", 0);
 5821 	int x1, y1;
 5822 	getbegyx(stdscr, y1, x1)],
 5823 	[cf_cv_need_xopen_extension=none],
 5824 	[
 5825 	for cf_try_xopen_extension in _XOPEN_SOURCE_EXTENDED NCURSES_WIDECHAR
 5826 	do
 5827 		AC_TRY_LINK([
 5828 #define $cf_try_xopen_extension 1
 5829 #include <stdlib.h>
 5830 #include <${cf_cv_ncurses_header:-curses.h}>],[
 5831 #ifdef NCURSES_VERSION
 5832 		cchar_t check;
 5833 		int check2 = curs_set((int)sizeof(check));
 5834 #endif
 5835 		long x = winnstr(stdscr, "", 0);
 5836 		int x1, y1;
 5837 		getbegyx(stdscr, y1, x1)],
 5838 		[cf_cv_need_xopen_extension=$cf_try_xopen_extension; break])
 5839 	done
 5840 	])
 5841 ])
 5842 
 5843 case $cf_cv_need_xopen_extension in
 5844 (*_*)
 5845 	CF_APPEND_TEXT(CPPFLAGS,-D$cf_cv_need_xopen_extension)
 5846 	;;
 5847 esac
 5848 
 5849 ])dnl
 5850 dnl ---------------------------------------------------------------------------
 5851 dnl CF_XOPEN_SOURCE version: 54 updated: 2018/11/07 07:43:44
 5852 dnl ---------------
 5853 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
 5854 dnl or adapt to the vendor's definitions to get equivalent functionality,
 5855 dnl without losing the common non-POSIX features.
 5856 dnl
 5857 dnl Parameters:
 5858 dnl	$1 is the nominal value for _XOPEN_SOURCE
 5859 dnl	$2 is the nominal value for _POSIX_C_SOURCE
 5860 AC_DEFUN([CF_XOPEN_SOURCE],[
 5861 AC_REQUIRE([AC_CANONICAL_HOST])
 5862 
 5863 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
 5864 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
 5865 cf_xopen_source=
 5866 
 5867 case $host_os in
 5868 (aix[[4-7]]*)
 5869 	cf_xopen_source="-D_ALL_SOURCE"
 5870 	;;
 5871 (msys)
 5872 	cf_XOPEN_SOURCE=600
 5873 	;;
 5874 (darwin[[0-8]].*)
 5875 	cf_xopen_source="-D_APPLE_C_SOURCE"
 5876 	;;
 5877 (darwin*)
 5878 	cf_xopen_source="-D_DARWIN_C_SOURCE"
 5879 	cf_XOPEN_SOURCE=
 5880 	;;
 5881 (freebsd*|dragonfly*|midnightbsd*)
 5882 	# 5.x headers associate
 5883 	#	_XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
 5884 	#	_XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
 5885 	cf_POSIX_C_SOURCE=200112L
 5886 	cf_XOPEN_SOURCE=600
 5887 	cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
 5888 	;;
 5889 (hpux11*)
 5890 	cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
 5891 	;;
 5892 (hpux*)
 5893 	cf_xopen_source="-D_HPUX_SOURCE"
 5894 	;;
 5895 (irix[[56]].*)
 5896 	cf_xopen_source="-D_SGI_SOURCE"
 5897 	cf_XOPEN_SOURCE=
 5898 	;;
 5899 (linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
 5900 	CF_GNU_SOURCE($cf_XOPEN_SOURCE)
 5901 	;;
 5902 (minix*)
 5903 	cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this...
 5904 	;;
 5905 (mirbsd*)
 5906 	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
 5907 	cf_XOPEN_SOURCE=
 5908 	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
 5909 	;;
 5910 (netbsd*)
 5911 	cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
 5912 	;;
 5913 (openbsd[[4-9]]*)
 5914 	# setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
 5915 	cf_xopen_source="-D_BSD_SOURCE"
 5916 	cf_XOPEN_SOURCE=600
 5917 	;;
 5918 (openbsd*)
 5919 	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
 5920 	;;
 5921 (osf[[45]]*)
 5922 	cf_xopen_source="-D_OSF_SOURCE"
 5923 	;;
 5924 (nto-qnx*)
 5925 	cf_xopen_source="-D_QNX_SOURCE"
 5926 	;;
 5927 (sco*)
 5928 	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
 5929 	;;
 5930 (solaris2.*)
 5931 	cf_xopen_source="-D__EXTENSIONS__"
 5932 	cf_cv_xopen_source=broken
 5933 	;;
 5934 (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2)
 5935 	cf_XOPEN_SOURCE=
 5936 	cf_POSIX_C_SOURCE=
 5937 	;;
 5938 (*)
 5939 	CF_TRY_XOPEN_SOURCE
 5940 	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
 5941 	;;
 5942 esac
 5943 
 5944 if test -n "$cf_xopen_source" ; then
 5945 	CF_ADD_CFLAGS($cf_xopen_source,true)
 5946 fi
 5947 
 5948 dnl In anything but the default case, we may have system-specific setting
 5949 dnl which is still not guaranteed to provide all of the entrypoints that
 5950 dnl _XOPEN_SOURCE would yield.
 5951 if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
 5952 	AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
 5953 	AC_TRY_COMPILE([#include <stdlib.h>],[
 5954 #ifndef _XOPEN_SOURCE
 5955 make an error
 5956 #endif],
 5957 	[cf_XOPEN_SOURCE_set=yes],
 5958 	[cf_XOPEN_SOURCE_set=no])
 5959 	AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
 5960 	if test $cf_XOPEN_SOURCE_set = yes
 5961 	then
 5962 		AC_TRY_COMPILE([#include <stdlib.h>],[
 5963 #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
 5964 make an error
 5965 #endif],
 5966 		[cf_XOPEN_SOURCE_set_ok=yes],
 5967 		[cf_XOPEN_SOURCE_set_ok=no])
 5968 		if test $cf_XOPEN_SOURCE_set_ok = no
 5969 		then
 5970 			AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
 5971 		fi
 5972 	else
 5973 		CF_TRY_XOPEN_SOURCE
 5974 	fi
 5975 fi
 5976 ])
 5977 dnl ---------------------------------------------------------------------------
 5978 dnl CF_X_ATHENA version: 23 updated: 2015/04/12 15:39:00
 5979 dnl -----------
 5980 dnl Check for Xaw (Athena) libraries
 5981 dnl
 5982 dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
 5983 AC_DEFUN([CF_X_ATHENA],
 5984 [
 5985 cf_x_athena=${cf_x_athena:-Xaw}
 5986 
 5987 AC_MSG_CHECKING(if you want to link with Xaw 3d library)
 5988 withval=
 5989 AC_ARG_WITH(Xaw3d,
 5990 	[  --with-Xaw3d            link with Xaw 3d library])
 5991 if test "$withval" = yes ; then
 5992 	cf_x_athena=Xaw3d
 5993 	AC_MSG_RESULT(yes)
 5994 else
 5995 	AC_MSG_RESULT(no)
 5996 fi
 5997 
 5998 AC_MSG_CHECKING(if you want to link with Xaw 3d xft library)
 5999 withval=
 6000 AC_ARG_WITH(Xaw3dxft,
 6001 	[  --with-Xaw3dxft         link with Xaw 3d xft library])
 6002 if test "$withval" = yes ; then
 6003 	cf_x_athena=Xaw3dxft
 6004 	AC_MSG_RESULT(yes)
 6005 else
 6006 	AC_MSG_RESULT(no)
 6007 fi
 6008 
 6009 AC_MSG_CHECKING(if you want to link with neXT Athena library)
 6010 withval=
 6011 AC_ARG_WITH(neXtaw,
 6012 	[  --with-neXtaw           link with neXT Athena library])
 6013 if test "$withval" = yes ; then
 6014 	cf_x_athena=neXtaw
 6015 	AC_MSG_RESULT(yes)
 6016 else
 6017 	AC_MSG_RESULT(no)
 6018 fi
 6019 
 6020 AC_MSG_CHECKING(if you want to link with Athena-Plus library)
 6021 withval=
 6022 AC_ARG_WITH(XawPlus,
 6023 	[  --with-XawPlus          link with Athena-Plus library])
 6024 if test "$withval" = yes ; then
 6025 	cf_x_athena=XawPlus
 6026 	AC_MSG_RESULT(yes)
 6027 else
 6028 	AC_MSG_RESULT(no)
 6029 fi
 6030 
 6031 cf_x_athena_lib=""
 6032 
 6033 if test "$PKG_CONFIG" != none ; then
 6034 	cf_athena_list=
 6035 	test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6"
 6036 	for cf_athena_pkg in \
 6037 		$cf_athena_list \
 6038 		${cf_x_athena} \
 6039 		${cf_x_athena}-devel \
 6040 		lib${cf_x_athena} \
 6041 		lib${cf_x_athena}-devel
 6042 	do
 6043 		CF_TRY_PKG_CONFIG($cf_athena_pkg,[
 6044 			cf_x_athena_lib="$cf_pkgconfig_libs"
 6045 			CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
 6046 			AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
 6047 
 6048 			CF_TRIM_X_LIBS
 6049 
 6050 AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[
 6051 AC_TRY_LINK([
 6052 #include <X11/Xmu/CharSet.h>
 6053 ],[
 6054 int check = XmuCompareISOLatin1("big", "small")
 6055 ],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])])
 6056 
 6057 			if test "$cf_cv_xaw_compat" = no
 6058 			then
 6059 				# workaround for broken ".pc" files...
 6060 				case "$cf_x_athena_lib" in
 6061 				(*-lXmu*)
 6062 					;;
 6063 				(*)
 6064 					CF_VERBOSE(work around broken package)
 6065 					cf_save_xmu="$LIBS"
 6066 					cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'`
 6067 					CF_TRY_PKG_CONFIG(xmu,[
 6068 							LIBS="$cf_save_xmu"
 6069 							CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs)
 6070 						],[
 6071 							CF_ADD_LIB_AFTER($cf_first_lib,-lXmu)
 6072 						])
 6073 					CF_TRIM_X_LIBS
 6074 					;;
 6075 				esac
 6076 			fi
 6077 
 6078 			break])
 6079 	done
 6080 fi
 6081 
 6082 if test -z "$cf_x_athena_lib" ; then
 6083 	CF_X_EXT
 6084 	CF_X_TOOLKIT
 6085 	CF_X_ATHENA_CPPFLAGS($cf_x_athena)
 6086 	CF_X_ATHENA_LIBS($cf_x_athena)
 6087 fi
 6088 ])dnl
 6089 dnl ---------------------------------------------------------------------------
 6090 dnl CF_X_ATHENA_CPPFLAGS version: 6 updated: 2018/06/20 20:23:13
 6091 dnl --------------------
 6092 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
 6093 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
 6094 AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
 6095 [
 6096 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
 6097 cf_x_athena_inc=""
 6098 
 6099 for cf_path in default \
 6100 	/usr/contrib/X11R6 \
 6101 	/usr/contrib/X11R5 \
 6102 	/usr/lib/X11R5 \
 6103 	/usr/local
 6104 do
 6105 	if test -z "$cf_x_athena_inc" ; then
 6106 		cf_save="$CPPFLAGS"
 6107 		cf_test=X11/$cf_x_athena_root/SimpleMenu.h
 6108 		if test $cf_path != default ; then
 6109 			CPPFLAGS="$cf_save"
 6110 			CF_APPEND_TEXT(CPPFLAGS,-I$cf_path/include)
 6111 			AC_MSG_CHECKING(for $cf_test in $cf_path)
 6112 		else
 6113 			AC_MSG_CHECKING(for $cf_test)
 6114 		fi
 6115 		AC_TRY_COMPILE([
 6116 #include <X11/Intrinsic.h>
 6117 #include <$cf_test>],[],
 6118 			[cf_result=yes],
 6119 			[cf_result=no])
 6120 		AC_MSG_RESULT($cf_result)
 6121 		if test "$cf_result" = yes ; then
 6122 			cf_x_athena_inc=$cf_path
 6123 			break
 6124 		else
 6125 			CPPFLAGS="$cf_save"
 6126 		fi
 6127 	fi
 6128 done
 6129 
 6130 if test -z "$cf_x_athena_inc" ; then
 6131 	AC_MSG_WARN(
 6132 [Unable to successfully find Athena header files with test program])
 6133 elif test "$cf_x_athena_inc" != default ; then
 6134 	CF_APPEND_TEXT(CPPFLAGS,-I$cf_x_athena_inc)
 6135 fi
 6136 ])
 6137 dnl ---------------------------------------------------------------------------
 6138 dnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02
 6139 dnl ----------------
 6140 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
 6141 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
 6142 AC_DEFUN([CF_X_ATHENA_LIBS],
 6143 [AC_REQUIRE([CF_X_TOOLKIT])
 6144 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
 6145 cf_x_athena_lib=""
 6146 
 6147 for cf_path in default \
 6148 	/usr/contrib/X11R6 \
 6149 	/usr/contrib/X11R5 \
 6150 	/usr/lib/X11R5 \
 6151 	/usr/local
 6152 do
 6153 	for cf_lib in \
 6154 		${cf_x_athena_root} \
 6155 		${cf_x_athena_root}7 \
 6156 		${cf_x_athena_root}6
 6157 	do
 6158 	for cf_libs in \
 6159 		"-l$cf_lib -lXmu" \
 6160 		"-l$cf_lib -lXpm -lXmu" \
 6161 		"-l${cf_lib}_s -lXmu_s"
 6162 	do
 6163 		if test -z "$cf_x_athena_lib" ; then
 6164 			cf_save="$LIBS"
 6165 			cf_test=XawSimpleMenuAddGlobalActions
 6166 			if test $cf_path != default ; then
 6167 				CF_ADD_LIBS(-L$cf_path/lib $cf_libs)
 6168 				AC_MSG_CHECKING(for $cf_libs in $cf_path)
 6169 			else
 6170 				CF_ADD_LIBS($cf_libs)
 6171 				AC_MSG_CHECKING(for $cf_test in $cf_libs)
 6172 			fi
 6173 			AC_TRY_LINK([
 6174 #include <X11/Intrinsic.h>
 6175 #include <X11/$cf_x_athena_root/SimpleMenu.h>
 6176 ],[
 6177 $cf_test((XtAppContext) 0)],
 6178 				[cf_result=yes],
 6179 				[cf_result=no])
 6180 			AC_MSG_RESULT($cf_result)
 6181 			if test "$cf_result" = yes ; then
 6182 				cf_x_athena_lib="$cf_libs"
 6183 				break
 6184 			fi
 6185 			LIBS="$cf_save"
 6186 		fi
 6187 	done # cf_libs
 6188 		test -n "$cf_x_athena_lib" && break
 6189 	done # cf_lib
 6190 done
 6191 
 6192 if test -z "$cf_x_athena_lib" ; then
 6193 	AC_MSG_ERROR(
 6194 [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
 6195 fi
 6196 
 6197 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
 6198 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
 6199 ])
 6200 dnl ---------------------------------------------------------------------------
 6201 dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05
 6202 dnl --------
 6203 AC_DEFUN([CF_X_EXT],[
 6204 CF_TRY_PKG_CONFIG(Xext,,[
 6205 	AC_CHECK_LIB(Xext,XextCreateExtension,
 6206 		[CF_ADD_LIB(Xext)])])
 6207 ])dnl
 6208 dnl ---------------------------------------------------------------------------
 6209 dnl CF_X_TOOLKIT version: 23 updated: 2015/04/12 15:39:00
 6210 dnl ------------
 6211 dnl Check for X Toolkit libraries
 6212 AC_DEFUN([CF_X_TOOLKIT],
 6213 [
 6214 AC_REQUIRE([AC_PATH_XTRA])
 6215 AC_REQUIRE([CF_CHECK_CACHE])
 6216 
 6217 # OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new), and (and
 6218 # in some cases has installed dummy files in the former, other cases replaced
 6219 # it with a link to the new location).  This complicates the configure script.
 6220 # Check for that pitfall, and recover using pkg-config
 6221 #
 6222 # If none of these are set, the configuration is almost certainly broken.
 6223 if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}"
 6224 then
 6225 	CF_TRY_PKG_CONFIG(x11,,[AC_MSG_WARN(unable to find X11 library)])
 6226 	CF_TRY_PKG_CONFIG(ice,,[AC_MSG_WARN(unable to find ICE library)])
 6227 	CF_TRY_PKG_CONFIG(sm,,[AC_MSG_WARN(unable to find SM library)])
 6228 	CF_TRY_PKG_CONFIG(xt,,[AC_MSG_WARN(unable to find Xt library)])
 6229 fi
 6230 
 6231 cf_have_X_LIBS=no
 6232 
 6233 CF_TRY_PKG_CONFIG(xt,[
 6234 
 6235 	case "x$LIBS" in
 6236 	(*-lX11*)
 6237 		;;
 6238 	(*)
 6239 # we have an "xt" package, but it may omit Xt's dependency on X11
 6240 AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[
 6241 AC_TRY_LINK([
 6242 #include <X11/Xlib.h>
 6243 ],[
 6244 	int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0);
 6245 	int rc2 = XClearWindow((Display*) 0, (Window) 0);
 6246 	int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0);
 6247 	int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0);
 6248 ],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])])
 6249 		if test "$cf_cv_xt_x11_compat" = no
 6250 		then
 6251 			CF_VERBOSE(work around broken X11 dependency)
 6252 			# 2010/11/19 - good enough until a working Xt on Xcb is delivered.
 6253 			CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)])
 6254 		fi
 6255 		;;
 6256 	esac
 6257 
 6258 AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[
 6259 AC_TRY_LINK([
 6260 #include <X11/Shell.h>
 6261 ],[int num = IceConnectionNumber(0)
 6262 ],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])])
 6263 
 6264 	if test "$cf_cv_xt_ice_compat" = no
 6265 	then
 6266 		# workaround for broken ".pc" files used for X Toolkit.
 6267 		case "x$X_PRE_LIBS" in
 6268 		(*-lICE*)
 6269 			case "x$LIBS" in
 6270 			(*-lICE*)
 6271 				;;
 6272 			(*)
 6273 				CF_VERBOSE(work around broken ICE dependency)
 6274 				CF_TRY_PKG_CONFIG(ice,
 6275 					[CF_TRY_PKG_CONFIG(sm)],
 6276 					[CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)])
 6277 				;;
 6278 			esac
 6279 			;;
 6280 		esac
 6281 	fi
 6282 
 6283 	cf_have_X_LIBS=yes
 6284 ],[
 6285 
 6286 	LDFLAGS="$X_LIBS $LDFLAGS"
 6287 	CF_CHECK_CFLAGS($X_CFLAGS)
 6288 
 6289 	AC_CHECK_FUNC(XOpenDisplay,,[
 6290 	AC_CHECK_LIB(X11,XOpenDisplay,
 6291 		[CF_ADD_LIB(X11)],,
 6292 		[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
 6293 
 6294 	AC_CHECK_FUNC(XtAppInitialize,,[
 6295 	AC_CHECK_LIB(Xt, XtAppInitialize,
 6296 		[AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library])
 6297 		 cf_have_X_LIBS=Xt
 6298 		 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
 6299 		[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
 6300 ])
 6301 
 6302 if test $cf_have_X_LIBS = no ; then
 6303 	AC_MSG_WARN(
 6304 [Unable to successfully link X Toolkit library (-lXt) with
 6305 test program.  You will have to check and add the proper libraries by hand
 6306 to makefile.])
 6307 fi
 6308 ])dnl
 6309 dnl ---------------------------------------------------------------------------
 6310 dnl CF__ICONV_BODY version: 2 updated: 2007/07/26 17:35:47
 6311 dnl --------------
 6312 dnl Test-code needed for iconv compile-checks
 6313 define([CF__ICONV_BODY],[
 6314 	iconv_t cd = iconv_open("","");
 6315 	iconv(cd,NULL,NULL,NULL,NULL);
 6316 	iconv_close(cd);]
 6317 )dnl
 6318 dnl ---------------------------------------------------------------------------
 6319 dnl CF__ICONV_HEAD version: 1 updated: 2007/07/26 15:57:03
 6320 dnl --------------
 6321 dnl Header-files needed for iconv compile-checks
 6322 define([CF__ICONV_HEAD],[
 6323 #include <stdlib.h>
 6324 #include <iconv.h>]
 6325 )dnl
 6326 dnl ---------------------------------------------------------------------------
 6327 dnl CF__INTL_BODY version: 3 updated: 2017/07/10 20:13:33
 6328 dnl -------------
 6329 dnl Test-code needed for libintl compile-checks
 6330 dnl $1 = parameter 2 from AM_WITH_NLS
 6331 define([CF__INTL_BODY],[
 6332 	bindtextdomain ("", "");
 6333 	return (int) gettext ("")
 6334 			ifelse([$1], need-ngettext, [ + (int) ngettext ("", "", 0)], [])
 6335 #ifndef IGNORE_MSGFMT_HACK
 6336 			[ + _nl_msg_cat_cntr]
 6337 #endif
 6338 ])
 6339 dnl ---------------------------------------------------------------------------
 6340 dnl CF__INTL_HEAD version: 1 updated: 2007/07/26 17:35:47
 6341 dnl -------------
 6342 dnl Header-files needed for libintl compile-checks
 6343 define([CF__INTL_HEAD],[
 6344 #include <libintl.h>
 6345 extern int _nl_msg_cat_cntr;
 6346 ])dnl
 6347 dnl ---------------------------------------------------------------------------
 6348 dnl jm_GLIBC21 version: 4 updated: 2015/05/10 19:52:14
 6349 dnl ----------
 6350 dnl Inserted as requested by gettext 0.10.40
 6351 dnl File from /usr/share/aclocal
 6352 dnl glibc21.m4
 6353 dnl ====================
 6354 dnl serial 2
 6355 dnl
 6356 dnl Test for the GNU C Library, version 2.1 or newer.
 6357 dnl From Bruno Haible.
 6358 AC_DEFUN([jm_GLIBC21],
 6359 [
 6360 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
 6361 	ac_cv_gnu_library_2_1,
 6362 	[AC_EGREP_CPP([Lucky GNU user],
 6363 	[
 6364 #include <features.h>
 6365 #ifdef __GNU_LIBRARY__
 6366  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
 6367   Lucky GNU user
 6368  #endif
 6369 #endif
 6370 	],
 6371 	ac_cv_gnu_library_2_1=yes,
 6372 	ac_cv_gnu_library_2_1=no)])
 6373 	AC_SUBST(GLIBC21)
 6374 	GLIBC21="$ac_cv_gnu_library_2_1"
 6375 ])