"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.2/aclocal.m4" (8 Dec 2017, 189691 Bytes) of package /linux/misc/tin-2.4.2.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.1_vs_2.4.2.

    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   : 2017-09-23
    6 dnl Notes     :
    7 dnl
    8 dnl Copyright (c) 1995-2018 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: 27 updated: 2017/07/10 20:13:33
  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       else
  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: 14 updated: 2015/05/25 20:53:04
  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 			  CPPFLAGS="$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: 7 updated: 2012/10/06 15:31:55
 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 cc cl)])
 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: 18 updated: 2015/05/10 19:52:14
 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 	CPPFLAGS="$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: 8 updated: 2017/09/23 08:50:24
 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(\$CC variable)
 1562 case "$CC" in
 1563 (*[[\ \	]]-*)
 1564 	AC_MSG_RESULT(broken)
 1565 	AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
 1566 	# humor him...
 1567 	cf_prog=`echo "$CC" | sed -e 's/	/ /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'`
 1568 	cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'`
 1569 	CC="$cf_prog"
 1570 	for cf_arg in $cf_flags
 1571 	do
 1572 		case "x$cf_arg" in
 1573 		(x-[[IUDfgOW]]*)
 1574 			CF_ADD_CFLAGS($cf_arg)
 1575 			;;
 1576 		(*)
 1577 			CC="$CC $cf_arg"
 1578 			;;
 1579 		esac
 1580 	done
 1581 	CF_VERBOSE(resulting CC: '$CC')
 1582 	CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
 1583 	CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
 1584 	;;
 1585 (*)
 1586 	AC_MSG_RESULT(ok)
 1587 	;;
 1588 esac
 1589 ])dnl
 1590 dnl ---------------------------------------------------------------------------
 1591 dnl CF_CHECK_1_DECL version: 5 updated: 2001/07/22 21:09:16
 1592 dnl ---------------
 1593 dnl Check for missing declarations in the system headers (adapted from vile).
 1594 dnl
 1595 dnl CHECK_DECL_FLAG and CHECK_DECL_HDRS must be set in configure.in
 1596 AC_DEFUN([CF_CHECK_1_DECL],
 1597 [
 1598 AC_MSG_CHECKING([for missing "$1" extern])
 1599 AC_CACHE_VAL([cf_cv_func_$1],[
 1600 CF_MSG_LOG([for missing "$1" external])
 1601 cf_save_CFLAGS="$CFLAGS"
 1602 CFLAGS="$CFLAGS $CHECK_DECL_FLAG"
 1603 AC_TRY_LINK([
 1604 $CHECK_DECL_HDRS
 1605 
 1606 #undef $1
 1607 struct zowie { int a; double b; struct zowie *c; char d; };
 1608 extern struct zowie *$1();
 1609 ],
 1610 [
 1611 ],
 1612 [if test -n "$CHECK_DECL_HDRS" ; then
 1613 # try to work around system headers which are infested with non-standard syntax
 1614 CF_UPPER(cf_1_up,$1)
 1615 AC_TRY_COMPILE([
 1616 #define DECL_${cf_1_up}
 1617 $CHECK_DECL_HDRS
 1618 ],[long x = 0],
 1619 [eval 'cf_cv_func_'$1'=yes'],
 1620 [eval 'cf_cv_func_'$1'=no'])
 1621 else
 1622 eval 'cf_cv_func_'$1'=yes'
 1623 fi
 1624 ],
 1625 [eval 'cf_cv_func_'$1'=no'])
 1626 CFLAGS="$cf_save_CFLAGS"
 1627 ])
 1628 eval 'cf_result=$cf_cv_func_'$1
 1629 AC_MSG_RESULT($cf_result)
 1630 test $cf_result = yes && AC_DEFINE_UNQUOTED(DECL_$2)
 1631 ])dnl
 1632 dnl ---------------------------------------------------------------------------
 1633 dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
 1634 dnl --------------
 1635 dnl Check if we're accidentally using a cache from a different machine.
 1636 dnl Derive the system name, as a check for reusing the autoconf cache.
 1637 dnl
 1638 dnl If we've packaged config.guess and config.sub, run that (since it does a
 1639 dnl better job than uname).  Normally we'll use AC_CANONICAL_HOST, but allow
 1640 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
 1641 dnl which is useful in cross-compiles.
 1642 dnl
 1643 dnl Note: we would use $ac_config_sub, but that is one of the places where
 1644 dnl autoconf 2.5x broke compatibility with autoconf 2.13
 1645 AC_DEFUN([CF_CHECK_CACHE],
 1646 [
 1647 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
 1648 	ifelse([$1],,[AC_CANONICAL_HOST],[$1])
 1649 	system_name="$host_os"
 1650 else
 1651 	system_name="`(uname -s -r) 2>/dev/null`"
 1652 	if test -z "$system_name" ; then
 1653 		system_name="`(hostname) 2>/dev/null`"
 1654 	fi
 1655 fi
 1656 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
 1657 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
 1658 
 1659 test -z "$system_name" && system_name="$cf_cv_system_name"
 1660 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
 1661 
 1662 if test ".$system_name" != ".$cf_cv_system_name" ; then
 1663 	AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
 1664 	AC_MSG_ERROR("Please remove config.cache and try again.")
 1665 fi
 1666 ])dnl
 1667 dnl ---------------------------------------------------------------------------
 1668 dnl CF_CHECK_CFLAGS version: 3 updated: 2014/07/22 05:32:57
 1669 dnl ---------------
 1670 dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
 1671 dnl a build-configuration such as imake.  These have the pitfall that they
 1672 dnl often contain compiler-specific options which we cannot use, mixed with
 1673 dnl preprocessor options that we usually can.
 1674 AC_DEFUN([CF_CHECK_CFLAGS],
 1675 [
 1676 CF_VERBOSE(checking additions to CFLAGS)
 1677 cf_check_cflags="$CFLAGS"
 1678 cf_check_cppflags="$CPPFLAGS"
 1679 CF_ADD_CFLAGS($1,yes)
 1680 if test "x$cf_check_cflags" != "x$CFLAGS" ; then
 1681 AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
 1682 	[CF_VERBOSE(test-compile failed.  Undoing change to \$CFLAGS)
 1683 	 if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then
 1684 		 CF_VERBOSE(but keeping change to \$CPPFLAGS)
 1685 	 fi
 1686 	 CFLAGS="$cf_check_flags"])
 1687 fi
 1688 ])dnl
 1689 dnl ---------------------------------------------------------------------------
 1690 dnl CF_CHECK_DECL version: 2 updated: 1997/08/28 23:57:55
 1691 dnl -------------
 1692 AC_DEFUN([CF_CHECK_DECL],
 1693 [for ac_func in $1
 1694 do
 1695 CF_UPPER(ac_tr_func,$ac_func)
 1696 CF_CHECK_1_DECL(${ac_func}, ${ac_tr_func})dnl
 1697 done
 1698 ])dnl
 1699 dnl ---------------------------------------------------------------------------
 1700 dnl CF_CHECK_ERRNO version: 12 updated: 2015/04/18 08:56:57
 1701 dnl --------------
 1702 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
 1703 dnl the 'errno' variable.  Define a DECL_xxx symbol if we must declare it
 1704 dnl ourselves.
 1705 dnl
 1706 dnl $1 = the name to check
 1707 dnl $2 = the assumed type
 1708 AC_DEFUN([CF_CHECK_ERRNO],
 1709 [
 1710 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
 1711 	AC_TRY_COMPILE([
 1712 #ifdef HAVE_STDLIB_H
 1713 #include <stdlib.h>
 1714 #endif
 1715 #include <stdio.h>
 1716 #include <sys/types.h>
 1717 #include <errno.h> ],
 1718 	ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1,
 1719 	[cf_cv_dcl_$1=yes],
 1720 	[cf_cv_dcl_$1=no])
 1721 ])
 1722 
 1723 if test "$cf_cv_dcl_$1" = no ; then
 1724 	CF_UPPER(cf_result,decl_$1)
 1725 	AC_DEFINE_UNQUOTED($cf_result)
 1726 fi
 1727 
 1728 # It's possible (for near-UNIX clones) that the data doesn't exist
 1729 CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
 1730 ])dnl
 1731 dnl ---------------------------------------------------------------------------
 1732 dnl CF_CHECK_EXTERN_DATA version: 4 updated: 2015/04/18 08:56:57
 1733 dnl --------------------
 1734 dnl Check for existence of external data in the current set of libraries.  If
 1735 dnl we can modify it, it's real enough.
 1736 dnl $1 = the name to check
 1737 dnl $2 = its type
 1738 AC_DEFUN([CF_CHECK_EXTERN_DATA],
 1739 [
 1740 AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
 1741 	AC_TRY_LINK([
 1742 #undef $1
 1743 extern $2 $1;
 1744 ],
 1745 	[$1 = 2],
 1746 	[cf_cv_have_$1=yes],
 1747 	[cf_cv_have_$1=no])
 1748 ])
 1749 
 1750 if test "$cf_cv_have_$1" = yes ; then
 1751 	CF_UPPER(cf_result,have_$1)
 1752 	AC_DEFINE_UNQUOTED($cf_result)
 1753 fi
 1754 
 1755 ])dnl
 1756 dnl ---------------------------------------------------------------------------
 1757 dnl CF_CHECK_HEADERS version: 3 updated: 2000/11/03 11:14:19
 1758 dnl ----------------
 1759 dnl AC_CHECK_HEADERS(sys/socket.h) fails on OS/2 EMX because it demands that
 1760 dnl <sys/types.h> be included first.
 1761 dnl
 1762 dnl Also <sys/dir.h> and <sys/dirent.h> and <sys/stat.h>, but we normally do
 1763 dnl not do our own tests via AC_CHECK_HEADERS for those.
 1764 AC_DEFUN([CF_CHECK_HEADERS],[
 1765 for cf_hdr in $1
 1766 do
 1767 	AC_MSG_CHECKING(for $cf_hdr)
 1768 	AC_TRY_CPP([
 1769 #include <sys/types.h>
 1770 #include <$cf_hdr>
 1771 ],[cf_found=yes],[cf_found=no])
 1772 AC_MSG_RESULT($cf_found)
 1773 if test $cf_found = yes ; then
 1774 	CF_UPPER(cf_tr_hdr,$cf_hdr)
 1775 	AC_DEFINE_UNQUOTED(HAVE_${cf_tr_hdr})
 1776 fi
 1777 done
 1778 ])dnl
 1779 dnl ---------------------------------------------------------------------------
 1780 dnl CF_CHECK_IPV6 version: 3 updated: 2004/01/22 17:38:22
 1781 dnl -------------
 1782 dnl Check for IPV6 configuration.
 1783 AC_DEFUN([CF_CHECK_IPV6],[
 1784 CF_FIND_IPV6_TYPE
 1785 CF_FIND_IPV6_LIBS
 1786 
 1787 CF_FUNC_GETADDRINFO
 1788 
 1789 if test "$cf_cv_getaddrinfo" != "yes"; then
 1790 	if test "$cf_cv_ipv6type" != "linux"; then
 1791 		AC_MSG_WARN(
 1792 [You must get working getaddrinfo() function,
 1793 or you can specify "--disable-ipv6"])
 1794 	else
 1795 		AC_MSG_WARN(
 1796 [The getaddrinfo() implementation on your system seems be buggy.
 1797 You should upgrade your system library to the newest version
 1798 of GNU C library (aka glibc).])
 1799 	fi
 1800 fi
 1801 
 1802 ])dnl
 1803 dnl ---------------------------------------------------------------------------
 1804 dnl CF_CHECK_NESTED_PARAMS version: 2 updated: 1997/08/28 23:57:55
 1805 dnl ----------------------
 1806 dnl Check if the compiler allows nested parameter lists (some don't)
 1807 AC_DEFUN([CF_CHECK_NESTED_PARAMS],
 1808 [
 1809 AC_MSG_CHECKING([if nested parameters work])
 1810 AC_CACHE_VAL(cf_cv_nested_params,[
 1811 	AC_TRY_COMPILE([],
 1812 	[extern void (*sigdisp(int sig, void (*func)(int sig)))(int sig)],
 1813 	[cf_cv_nested_params=yes],
 1814 	[cf_cv_nested_params=no])
 1815 ])
 1816 AC_MSG_RESULT($cf_cv_nested_params)
 1817 test $cf_cv_nested_params = yes && AC_DEFINE(HAVE_NESTED_PARAMS)
 1818 ])dnl
 1819 dnl ---------------------------------------------------------------------------
 1820 dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35
 1821 dnl -----------------
 1822 dnl Check if the given compiler is really clang.  clang's C driver defines
 1823 dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
 1824 dnl not ignore some gcc options.
 1825 dnl
 1826 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
 1827 dnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
 1828 dnl the wrappers for gcc and g++ warnings.
 1829 dnl
 1830 dnl $1 = GCC (default) or GXX
 1831 dnl $2 = CLANG_COMPILER (default)
 1832 dnl $3 = CFLAGS (default) or CXXFLAGS
 1833 AC_DEFUN([CF_CLANG_COMPILER],[
 1834 ifelse([$2],,CLANG_COMPILER,[$2])=no
 1835 
 1836 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
 1837 	AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
 1838 	cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
 1839 	ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
 1840 	AC_TRY_COMPILE([],[
 1841 #ifdef __clang__
 1842 #else
 1843 make an error
 1844 #endif
 1845 ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
 1846 cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
 1847 ],[])
 1848 	ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
 1849 	AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
 1850 fi
 1851 ])
 1852 dnl ---------------------------------------------------------------------------
 1853 dnl CF_COLOR_CURSES version: 8 updated: 2012/11/08 20:57:52
 1854 dnl ---------------
 1855 dnl Check if curses supports color.  (Note that while SVr3 curses supports
 1856 dnl color, it does this differently from SVr4 curses; more work would be needed
 1857 dnl to accommodate SVr3).
 1858 dnl
 1859 AC_DEFUN([CF_COLOR_CURSES],
 1860 [
 1861 AC_MSG_CHECKING(if curses supports color attributes)
 1862 AC_CACHE_VAL(cf_cv_color_curses,[
 1863 	AC_TRY_LINK([
 1864 #include <${cf_cv_ncurses_header:-curses.h}>
 1865 ],
 1866 	[chtype x = COLOR_BLUE;
 1867 	 has_colors();
 1868 	 start_color();
 1869 #ifndef NCURSES_BROKEN
 1870 	 wbkgd(curscr, getbkgd(stdscr)); /* X/Open XPG4 aka SVr4 Curses */
 1871 #endif
 1872 	],
 1873 	[cf_cv_color_curses=yes],
 1874 	[cf_cv_color_curses=no])
 1875 	])
 1876 AC_MSG_RESULT($cf_cv_color_curses)
 1877 if test $cf_cv_color_curses = yes ; then
 1878 	AC_DEFINE(COLOR_CURSES,1,[Define to 1 if if curses supports color attributes])
 1879 	test ".$cf_cv_ncurses_broken" != .yes && AC_DEFINE(HAVE_GETBKGD,1,[Define to 1 if curses has getbkgd function])
 1880 fi
 1881 ])dnl
 1882 dnl ---------------------------------------------------------------------------
 1883 dnl CF_COMPTYPE version: 2 updated: 1997/08/28 23:57:55
 1884 dnl -----------
 1885 dnl Check if the compiler uses 'void *' for qsort's compare function parameters
 1886 dnl (i.e., it's an ANSI prototype).
 1887 AC_DEFUN([CF_COMPTYPE],
 1888 [
 1889 AC_MSG_CHECKING([for ANSI qsort])
 1890 AC_CACHE_VAL(cf_cv_comptype,[
 1891 	AC_TRY_COMPILE([
 1892 #ifdef HAVE_STDLIB_H
 1893 #include <stdlib.h>
 1894 #endif],
 1895 	[extern int compare(const void *, const void *);
 1896 	 char *foo = "string";
 1897 	 qsort(foo, sizeof(foo)/sizeof(*foo), sizeof(*foo), compare)],
 1898 	[cf_cv_comptype=yes],
 1899 	[cf_cv_comptype=no])
 1900 ])
 1901 AC_MSG_RESULT($cf_cv_comptype)
 1902 if test $cf_cv_comptype = yes; then
 1903 	AC_DEFINE(HAVE_COMPTYPE_VOID)
 1904 else
 1905 	AC_DEFINE(HAVE_COMPTYPE_CHAR)
 1906 fi
 1907 ])dnl
 1908 dnl ---------------------------------------------------------------------------
 1909 dnl CF_COREFILE version: 4 updated: 2010/10/23 15:52:32
 1910 dnl -----------
 1911 dnl Check if the application can dump core (for debugging).
 1912 AC_DEFUN([CF_COREFILE],
 1913 [
 1914 AC_MSG_CHECKING([if application can dump core])
 1915 AC_CACHE_VAL(cf_cv_corefile,[
 1916 	AC_TRY_RUN([
 1917 #include <signal.h>
 1918 #include <sys/types.h>
 1919 #include <sys/stat.h>
 1920 int found()
 1921 {
 1922 	struct stat sb;
 1923 	return ((stat("core", &sb) == 0			/* UNIX */
 1924 	   ||    stat("conftest.core", &sb) == 0	/* FreeBSD */
 1925 		)
 1926 		&& ((sb.st_mode & S_IFMT) == S_IFREG));
 1927 }
 1928 int main()
 1929 {
 1930 #ifdef __amiga__
 1931 /* Nicholas d'Alterio (nagd@ic.ac.uk) reports that the check for ability to
 1932  * core dump causes the machine to crash - reason unknown (gcc 2.7.2)
 1933  */
 1934 	${cf_cv_main_return:-return}(1);
 1935 #else
 1936 	int	pid, status;
 1937 	if (found())
 1938 		unlink("core");
 1939 	if (found())
 1940 		${cf_cv_main_return:-return}(1);
 1941 	if ((pid = fork()) != 0) {
 1942 		while (wait(&status) <= 0)
 1943 			;
 1944 	} else {
 1945 		abort();	/* this will dump core, if anything will */
 1946 	}
 1947 	if (found()) {
 1948 		unlink("core");
 1949 		${cf_cv_main_return:-return}(0);
 1950 	}
 1951 	${cf_cv_main_return:-return}(1);
 1952 #endif
 1953 }],
 1954 	[cf_cv_corefile=yes],
 1955 	[cf_cv_corefile=no],
 1956 	[cf_cv_corefile=unknown])])
 1957 AC_MSG_RESULT($cf_cv_corefile)
 1958 test $cf_cv_corefile = yes && AC_DEFINE(HAVE_COREFILE)
 1959 ])dnl
 1960 dnl ---------------------------------------------------------------------------
 1961 dnl CF_CPP_CONCATS version: 2 updated: 1997/08/28 23:57:55
 1962 dnl --------------
 1963 dnl Test for ANSI token expansion (used in 'assert').
 1964 AC_DEFUN([CF_CPP_CONCATS],
 1965 [
 1966 AC_MSG_CHECKING([for ansi token concatenation])
 1967 AC_CACHE_VAL(cf_cv_cpp_concats,[
 1968 	AC_TRY_COMPILE([
 1969 #define concat(a,b) a ## b],
 1970 	[char *firstlast = "y", *s = concat(first,last)],
 1971 	[cf_cv_cpp_concats=yes],
 1972 	[cf_cv_cpp_concats=no])
 1973 ])
 1974 AC_MSG_RESULT($cf_cv_cpp_concats)
 1975 test $cf_cv_cpp_concats = yes && AC_DEFINE(CPP_DOES_CONCAT)
 1976 ])dnl
 1977 dnl ---------------------------------------------------------------------------
 1978 dnl CF_CPP_EXPANDS 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_EXPANDS],
 1982 [
 1983 AC_MSG_CHECKING([for ansi token expansion/substitution])
 1984 AC_CACHE_VAL(cf_cv_cpp_expands,[
 1985 	AC_TRY_COMPILE([
 1986 #define string(n) #n],
 1987 	[char *s = string(token)],
 1988 	[cf_cv_cpp_expands=yes],
 1989 	[cf_cv_cpp_expands=no])
 1990 ])
 1991 AC_MSG_RESULT($cf_cv_cpp_expands)
 1992 test $cf_cv_cpp_expands = yes && AC_DEFINE(CPP_DOES_EXPAND)
 1993 ])dnl
 1994 dnl ---------------------------------------------------------------------------
 1995 dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
 1996 dnl ----------------
 1997 dnl Tie together the configure-script macros for curses.  It may be ncurses,
 1998 dnl but unless asked, we do not make a special search for ncurses.  However,
 1999 dnl still check for the ncurses version number, for use in other macros.
 2000 AC_DEFUN([CF_CURSES_CONFIG],
 2001 [
 2002 CF_CURSES_CPPFLAGS
 2003 CF_NCURSES_VERSION
 2004 CF_CURSES_LIBS
 2005 ])dnl
 2006 dnl ---------------------------------------------------------------------------
 2007 dnl CF_CURSES_CPPFLAGS version: 12 updated: 2015/04/15 19:08:48
 2008 dnl ------------------
 2009 dnl Look for the curses headers.
 2010 AC_DEFUN([CF_CURSES_CPPFLAGS],[
 2011 
 2012 AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
 2013 cf_cv_curses_incdir=no
 2014 case $host_os in
 2015 (hpux10.*)
 2016 	if test "x$cf_cv_screen" = "xcurses_colr"
 2017 	then
 2018 		test -d /usr/include/curses_colr && \
 2019 		cf_cv_curses_incdir="-I/usr/include/curses_colr"
 2020 	fi
 2021 	;;
 2022 (sunos3*|sunos4*)
 2023 	if test "x$cf_cv_screen" = "xcurses_5lib"
 2024 	then
 2025 		test -d /usr/5lib && \
 2026 		test -d /usr/5include && \
 2027 		cf_cv_curses_incdir="-I/usr/5include"
 2028 	fi
 2029 	;;
 2030 esac
 2031 ])
 2032 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
 2033 
 2034 CF_CURSES_HEADER
 2035 CF_TERM_HEADER
 2036 ])dnl
 2037 dnl ---------------------------------------------------------------------------
 2038 dnl CF_CURSES_HEADER version: 5 updated: 2015/04/23 20:35:30
 2039 dnl ----------------
 2040 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
 2041 dnl variations of ncurses' installs.
 2042 dnl
 2043 dnl $1 = ncurses when looking for ncurses, or is empty
 2044 AC_DEFUN([CF_CURSES_HEADER],[
 2045 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
 2046 cf_cv_ncurses_header=none
 2047 for cf_header in \
 2048 	ncurses.h ifelse($1,,,[$1/ncurses.h]) \
 2049 	curses.h ifelse($1,,,[$1/curses.h]) ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
 2050 do
 2051 AC_TRY_COMPILE([#include <${cf_header}>],
 2052 	[initscr(); tgoto("?", 0,0)],
 2053 	[cf_cv_ncurses_header=$cf_header; break],[])
 2054 done
 2055 ])
 2056 
 2057 if test "$cf_cv_ncurses_header" = none ; then
 2058 	AC_MSG_ERROR(No curses header-files found)
 2059 fi
 2060 
 2061 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
 2062 AC_CHECK_HEADERS($cf_cv_ncurses_header)
 2063 ])dnl
 2064 dnl ---------------------------------------------------------------------------
 2065 dnl CF_CURSES_LIBS version: 40 updated: 2017/09/07 17:06:24
 2066 dnl --------------
 2067 dnl Look for the curses libraries.  Older curses implementations may require
 2068 dnl termcap/termlib to be linked as well.  Call CF_CURSES_CPPFLAGS first.
 2069 AC_DEFUN([CF_CURSES_LIBS],[
 2070 
 2071 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
 2072 AC_MSG_CHECKING(if we have identified curses libraries)
 2073 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 2074 	[initscr(); tgoto("?", 0,0)],
 2075 	cf_result=yes,
 2076 	cf_result=no)
 2077 AC_MSG_RESULT($cf_result)
 2078 
 2079 if test "$cf_result" = no ; then
 2080 case $host_os in
 2081 (freebsd*)
 2082 	AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
 2083 	;;
 2084 (hpux10.*)
 2085 	# Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr
 2086 	# next (1998), and xcurses "newer" (2000).  There is no header file for
 2087 	# Hcurses; the subdirectory curses_colr has the headers (curses.h and
 2088 	# term.h) for cur_colr
 2089 	if test "x$cf_cv_screen" = "xcurses_colr"
 2090 	then
 2091 		AC_CHECK_LIB(cur_colr,initscr,[
 2092 			CF_ADD_LIBS(-lcur_colr)
 2093 			ac_cv_func_initscr=yes
 2094 			],[
 2095 		AC_CHECK_LIB(Hcurses,initscr,[
 2096 			# HP's header uses __HP_CURSES, but user claims _HP_CURSES.
 2097 			CF_ADD_LIBS(-lHcurses)
 2098 			CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
 2099 			ac_cv_func_initscr=yes
 2100 			])])
 2101 	fi
 2102 	;;
 2103 (linux*)
 2104 	case `arch 2>/dev/null` in
 2105 	(x86_64)
 2106 		if test -d /lib64
 2107 		then
 2108 			CF_ADD_LIBDIR(/lib64)
 2109 		else
 2110 			CF_ADD_LIBDIR(/lib)
 2111 		fi
 2112 		;;
 2113 	(*)
 2114 		CF_ADD_LIBDIR(/lib)
 2115 		;;
 2116 	esac
 2117 	;;
 2118 (sunos3*|sunos4*)
 2119 	if test "x$cf_cv_screen" = "xcurses_5lib"
 2120 	then
 2121 		if test -d /usr/5lib ; then
 2122 			CF_ADD_LIBDIR(/usr/5lib)
 2123 			CF_ADD_LIBS(-lcurses -ltermcap)
 2124 		fi
 2125 	fi
 2126 	ac_cv_func_initscr=yes
 2127 	;;
 2128 esac
 2129 
 2130 if test ".$ac_cv_func_initscr" != .yes ; then
 2131 	cf_save_LIBS="$LIBS"
 2132 
 2133 	if test ".${cf_cv_ncurses_version:-no}" != .no
 2134 	then
 2135 		cf_check_list="ncurses curses cursesX"
 2136 	else
 2137 		cf_check_list="cursesX curses ncurses"
 2138 	fi
 2139 
 2140 	# Check for library containing tgoto.  Do this before curses library
 2141 	# because it may be needed to link the test-case for initscr.
 2142 	if test "x$cf_term_lib" = x
 2143 	then
 2144 		AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
 2145 			for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown
 2146 			do
 2147 				AC_CHECK_LIB($cf_term_lib,tgoto,[break])
 2148 			done
 2149 		])
 2150 	fi
 2151 
 2152 	# Check for library containing initscr
 2153 	test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
 2154 	if test "x$cf_curs_lib" = x
 2155 	then
 2156 		for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
 2157 		do
 2158 			LIBS="-l$cf_curs_lib $cf_save_LIBS"
 2159 			if test "$cf_term_lib" = unknown || test "$cf_term_lib" = "$cf_curs_lib" ; then
 2160 				AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
 2161 				AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 2162 					[initscr()],
 2163 					[cf_result=yes],
 2164 					[cf_result=no])
 2165 				AC_MSG_RESULT($cf_result)
 2166 				test $cf_result = yes && break
 2167 			elif test "$cf_curs_lib" = "$cf_term_lib" ; then
 2168 				cf_result=no
 2169 			elif test "$cf_term_lib" != predefined ; then
 2170 				AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
 2171 				AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 2172 					[initscr(); tgoto((char *)0, 0, 0);],
 2173 					[cf_result=no],
 2174 					[
 2175 					LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
 2176 					AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 2177 						[initscr()],
 2178 						[cf_result=yes],
 2179 						[cf_result=error])
 2180 					])
 2181 				AC_MSG_RESULT($cf_result)
 2182 				test $cf_result != error && break
 2183 			fi
 2184 		done
 2185 	fi
 2186 	test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
 2187 fi
 2188 fi
 2189 
 2190 ])dnl
 2191 dnl ---------------------------------------------------------------------------
 2192 dnl CF_CURSES_TERMCAP version: 12 updated: 2015/05/15 19:42:24
 2193 dnl -----------------
 2194 dnl Check if we should include <curses.h> to pick up prototypes for termcap
 2195 dnl functions.  On terminfo systems, these are normally declared in <curses.h>,
 2196 dnl but may be in <term.h>.  We check for termcap.h as an alternate, but it
 2197 dnl isn't standard (usually associated with GNU termcap).
 2198 dnl
 2199 dnl The 'tgoto()' function is declared in both terminfo and termcap.
 2200 dnl
 2201 dnl See CF_TYPE_OUTCHAR for more details.
 2202 AC_DEFUN([CF_CURSES_TERMCAP],
 2203 [
 2204 AC_REQUIRE([CF_CURSES_TERM_H])
 2205 AC_CACHE_CHECK(if we should include curses.h or termcap.h, cf_cv_need_curses_h,[
 2206 cf_save_CPPFLAGS="$CPPFLAGS"
 2207 cf_cv_need_curses_h=no
 2208 
 2209 for cf_t_opts in "" "NEED_TERMCAP_H"
 2210 do
 2211 for cf_c_opts in "" "NEED_CURSES_H"
 2212 do
 2213 
 2214     CPPFLAGS="$cf_save_CPPFLAGS $CHECK_DECL_FLAG"
 2215     test -n "$cf_c_opts" && CPPFLAGS="$CPPFLAGS -D$cf_c_opts"
 2216     test -n "$cf_t_opts" && CPPFLAGS="$CPPFLAGS -D$cf_t_opts"
 2217 
 2218     AC_TRY_LINK([/* $cf_c_opts $cf_t_opts */
 2219 $CHECK_DECL_HDRS],
 2220 	[char *x = (char *)tgoto("")],
 2221 	[test "$cf_cv_need_curses_h" = no && {
 2222 	     cf_cv_need_curses_h=maybe
 2223 	     cf_ok_c_opts=$cf_c_opts
 2224 	     cf_ok_t_opts=$cf_t_opts
 2225 	}],
 2226 	[echo "Recompiling with corrected call (C:$cf_c_opts, T:$cf_t_opts)" >&AC_FD_CC
 2227 	AC_TRY_LINK([
 2228 $CHECK_DECL_HDRS],
 2229 	[char *x = (char *)tgoto("",0,0)],
 2230 	[cf_cv_need_curses_h=yes
 2231 	 cf_ok_c_opts=$cf_c_opts
 2232 	 cf_ok_t_opts=$cf_t_opts])])
 2233 
 2234 	CPPFLAGS="$cf_save_CPPFLAGS"
 2235 	test "$cf_cv_need_curses_h" = yes && break
 2236 done
 2237 	test "$cf_cv_need_curses_h" = yes && break
 2238 done
 2239 
 2240 if test "$cf_cv_need_curses_h" != no ; then
 2241 	echo "Curses/termcap test = $cf_cv_need_curses_h (C:$cf_ok_c_opts, T:$cf_ok_t_opts)" >&AC_FD_CC
 2242 	if test -n "$cf_ok_c_opts" ; then
 2243 		if test -n "$cf_ok_t_opts" ; then
 2244 			cf_cv_need_curses_h=both
 2245 		else
 2246 			cf_cv_need_curses_h=curses.h
 2247 		fi
 2248 	elif test -n "$cf_ok_t_opts" ; then
 2249 		cf_cv_need_curses_h=termcap.h
 2250 	elif test "$cf_cv_term_header" != no ; then
 2251 		cf_cv_need_curses_h=term.h
 2252 	else
 2253 		cf_cv_need_curses_h=no
 2254 	fi
 2255 fi
 2256 ])
 2257 
 2258 case $cf_cv_need_curses_h in
 2259 (both)
 2260 	AC_DEFINE_UNQUOTED(NEED_CURSES_H,1,[Define to 1 if we must include curses.h])
 2261 	AC_DEFINE_UNQUOTED(NEED_TERMCAP_H,1,[Define to 1 if we must include termcap.h])
 2262 	;;
 2263 (curses.h)
 2264 	AC_DEFINE_UNQUOTED(NEED_CURSES_H,1,[Define to 1 if we must include curses.h])
 2265 	;;
 2266 (term.h)
 2267 	AC_DEFINE_UNQUOTED(NEED_TERM_H,1,[Define to 1 if we must include term.h])
 2268 	;;
 2269 (termcap.h)
 2270 	AC_DEFINE_UNQUOTED(NEED_TERMCAP_H,1,[Define to 1 if we must include termcap.h])
 2271 	;;
 2272 esac
 2273 
 2274 ])dnl
 2275 dnl ---------------------------------------------------------------------------
 2276 dnl CF_CURSES_TERM_H version: 11 updated: 2015/04/15 19:08:48
 2277 dnl ----------------
 2278 dnl SVr4 curses should have term.h as well (where it puts the definitions of
 2279 dnl the low-level interface).  This may not be true in old/broken implementations,
 2280 dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
 2281 dnl running with Solaris 2.5.1).
 2282 AC_DEFUN([CF_CURSES_TERM_H],
 2283 [
 2284 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
 2285 
 2286 AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
 2287 
 2288 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
 2289 # for <term.h> if we do not find the variant.
 2290 
 2291 cf_header_list="term.h ncurses/term.h ncursesw/term.h"
 2292 
 2293 case ${cf_cv_ncurses_header:-curses.h} in
 2294 (*/*)
 2295 	cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
 2296 	cf_header_list="$cf_header_item $cf_header_list"
 2297 	;;
 2298 esac
 2299 
 2300 for cf_header in $cf_header_list
 2301 do
 2302 	AC_TRY_COMPILE([
 2303 #include <${cf_cv_ncurses_header:-curses.h}>
 2304 #include <${cf_header}>],
 2305 	[WINDOW *x],
 2306 	[cf_cv_term_header=$cf_header
 2307 	 break],
 2308 	[cf_cv_term_header=no])
 2309 done
 2310 
 2311 case $cf_cv_term_header in
 2312 (no)
 2313 	# If curses is ncurses, some packagers still mess it up by trying to make
 2314 	# us use GNU termcap.  This handles the most common case.
 2315 	for cf_header in ncurses/term.h ncursesw/term.h
 2316 	do
 2317 		AC_TRY_COMPILE([
 2318 #include <${cf_cv_ncurses_header:-curses.h}>
 2319 #ifdef NCURSES_VERSION
 2320 #include <${cf_header}>
 2321 #else
 2322 make an error
 2323 #endif],
 2324 			[WINDOW *x],
 2325 			[cf_cv_term_header=$cf_header
 2326 			 break],
 2327 			[cf_cv_term_header=no])
 2328 	done
 2329 	;;
 2330 esac
 2331 ])
 2332 
 2333 case $cf_cv_term_header in
 2334 (term.h)
 2335 	AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
 2336 	;;
 2337 (ncurses/term.h)
 2338 	AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
 2339 	;;
 2340 (ncursesw/term.h)
 2341 	AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
 2342 	;;
 2343 esac
 2344 ])dnl
 2345 dnl ---------------------------------------------------------------------------
 2346 dnl CF_DEFAULT_SHELL version: 6 updated: 2005/09/29 07:32:03
 2347 dnl ----------------
 2348 dnl Look for a Bourne-shell compatible program from a list that we know about:
 2349 dnl	ash	Almquist Shell (sh based)
 2350 dnl	bash	Bourne Again Shell (sh, ksh based)
 2351 dnl	dash	Debian Almquist Shell (sh based)
 2352 dnl	jsh	Job Control Bourne Shell (sh based)
 2353 dnl	keysh	Key Shell (ksh based)
 2354 dnl	ksh	Korn Shell (sh based)
 2355 dnl	mksh	MirBSD Korn shell (pdksh based)
 2356 dnl	pdksh	Public-domain ksh
 2357 dnl	sh	Bourne Shell or POSIX Shell
 2358 dnl	zsh	Z Shell (sh, ksh based)
 2359 dnl On BSD systems look for a C Shell compatible program:
 2360 dnl	csh	C Shell
 2361 dnl	tcsh	TENEX C Shell (csh based)
 2362 AC_DEFUN([CF_DEFAULT_SHELL],
 2363 [
 2364 AC_MSG_CHECKING(for the default shell program)
 2365 cf_shell_progs="ifelse($1,,sh,[$1])"
 2366 if test -z "$cf_shell_progs" ; then
 2367 	cf_shell_progs="sh ksh bash zsh pdksh mksh jsh keysh ash dash"
 2368 	# TIN preferred default shell for BSD systems is csh. Others are sh.
 2369 	AC_TRY_COMPILE([
 2370 #include <sys/params.h>],[
 2371 #if (defined(BSD) && (BSD >= 199103))
 2372 #else
 2373 make an error
 2374 #endif
 2375 ],[$cf_shell_progs="csh tcsh $cf_shell_progs"])
 2376 fi
 2377 CF_MSG_LOG(paths of shell programs: $cf_shell_progs)
 2378 if test -s /etc/shells && test `egrep -c -v '^(#| |    |$)' /etc/shells` -gt 0; then
 2379 	CF_MSG_LOG(/etc/shells)
 2380 	for cf_prog in $cf_shell_progs
 2381 	do
 2382 		case $cf_prog in
 2383 			/*)
 2384 				cf_pattern="^"$cf_prog"$"
 2385 				;;
 2386 			*/*)
 2387 				AC_MSG_ERROR(Program name must be absolute or filename: $cf_prog)
 2388 				;;
 2389 			*)
 2390 				cf_pattern="/"$cf_prog"$"
 2391 				;;
 2392 		esac
 2393 		cf_path=`egrep $cf_pattern /etc/shells 2>/dev/null`
 2394 		if test -n "$cf_path"
 2395 		then
 2396 			for cf_shell in $cf_path
 2397 			do
 2398 				if test -f "$cf_shell"
 2399 				then
 2400 					DEFAULT_SHELL="$cf_shell"
 2401 					break
 2402 				fi
 2403 			done
 2404 		fi
 2405 		if test -n "$DEFAULT_SHELL"
 2406 		then
 2407 			break
 2408 		fi
 2409 	done
 2410 	AC_MSG_RESULT($DEFAULT_SHELL)
 2411 else
 2412 	CF_MSG_LOG($PATH)
 2413 AC_PATH_PROGS(DEFAULT_SHELL,
 2414 	$cf_shell_progs,,
 2415 	$PATH:/bin:/usr/bin:/usr/xpg4/bin:/bin/posix:/usr/bin/posix:/usr/old/bin:/usr/local/bin)
 2416 fi
 2417 if test -z "$DEFAULT_SHELL" ; then
 2418 	AC_MSG_WARN(
 2419 Cannot find the default shell you specified: $cf_shell_progs)
 2420 	if test -f /bin/false ; then
 2421 		AC_MSG_WARN(Using /bin/false instead)
 2422 		DEFAULT_SHELL=/bin/false
 2423 	else
 2424 		AC_MSG_ERROR(Cannot use /bin/false because it does not exist)
 2425 	fi
 2426 fi
 2427 AC_DEFINE_UNQUOTED(DEFAULT_SHELL,"$DEFAULT_SHELL")
 2428 ])dnl
 2429 dnl ---------------------------------------------------------------------------
 2430 dnl CF_DEFINE_STRING version: 2 updated: 2001/07/22 21:09:16
 2431 dnl ----------------
 2432 dnl Define a string which may contain escaped quotes or backslashes
 2433 dnl $1 = symbol to define
 2434 dnl $2 = the information we want to quote
 2435 AC_DEFUN([CF_DEFINE_STRING],
 2436 [
 2437 cf_define=`echo $2|sed -e 's/\\\\/\\\\134/g' -e 's/^[[ 	]]\\+//' -e 's/[[ 	]]\\+$//' -e 's/"/\\\\042/g'`
 2438 AC_DEFINE_UNQUOTED($1, "$cf_define")
 2439 ])dnl
 2440 dnl ---------------------------------------------------------------------------
 2441 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
 2442 dnl ----------
 2443 dnl "dirname" is not portable, so we fake it with a shell script.
 2444 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
 2445 dnl ---------------------------------------------------------------------------
 2446 dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57
 2447 dnl ---------------
 2448 dnl You can always use "make -n" to see the actual options, but it's hard to
 2449 dnl pick out/analyze warning messages when the compile-line is long.
 2450 dnl
 2451 dnl Sets:
 2452 dnl	ECHO_LT - symbol to control if libtool is verbose
 2453 dnl	ECHO_LD - symbol to prefix "cc -o" lines
 2454 dnl	RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
 2455 dnl	SHOW_CC - symbol to put before explicit "cc -c" lines
 2456 dnl	ECHO_CC - symbol to put before any "cc" line
 2457 dnl
 2458 AC_DEFUN([CF_DISABLE_ECHO],[
 2459 AC_MSG_CHECKING(if you want to see long compiling messages)
 2460 CF_ARG_DISABLE(echo,
 2461 	[  --disable-echo          do not display "compiling" commands],
 2462 	[
 2463 	ECHO_LT='--silent'
 2464 	ECHO_LD='@echo linking [$]@;'
 2465 	RULE_CC='@echo compiling [$]<'
 2466 	SHOW_CC='@echo compiling [$]@'
 2467 	ECHO_CC='@'
 2468 ],[
 2469 	ECHO_LT=''
 2470 	ECHO_LD=''
 2471 	RULE_CC=''
 2472 	SHOW_CC=''
 2473 	ECHO_CC=''
 2474 ])
 2475 AC_MSG_RESULT($enableval)
 2476 AC_SUBST(ECHO_LT)
 2477 AC_SUBST(ECHO_LD)
 2478 AC_SUBST(RULE_CC)
 2479 AC_SUBST(SHOW_CC)
 2480 AC_SUBST(ECHO_CC)
 2481 ])dnl
 2482 dnl ---------------------------------------------------------------------------
 2483 dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
 2484 dnl --------
 2485 dnl Check if 'errno' is declared in <errno.h>
 2486 AC_DEFUN([CF_ERRNO],
 2487 [
 2488 CF_CHECK_ERRNO(errno)
 2489 ])dnl
 2490 dnl ---------------------------------------------------------------------------
 2491 dnl CF_FIND_IPV6_LIBS version: 8 updated: 2015/04/15 19:08:48
 2492 dnl -----------------
 2493 dnl Based on the IPV6 stack type, look for the corresponding library.
 2494 AC_DEFUN([CF_FIND_IPV6_LIBS],[
 2495 AC_REQUIRE([CF_FIND_IPV6_TYPE])
 2496 
 2497 cf_ipv6lib=none
 2498 cf_ipv6dir=none
 2499 
 2500 AC_MSG_CHECKING(for IPv6 library if required)
 2501 case $cf_cv_ipv6type in
 2502 (solaris)
 2503 	;;
 2504 (inria)
 2505 	;;
 2506 (kame)
 2507 	dnl http://www.kame.net/
 2508 	cf_ipv6lib=inet6
 2509 	cf_ipv6dir=v6
 2510 	;;
 2511 (linux-glibc)
 2512 	;;
 2513 (linux-libinet6)
 2514 	dnl http://www.v6.linux.or.jp/
 2515 	cf_ipv6lib=inet6
 2516 	cf_ipv6dir=inet6
 2517 	;;
 2518 (toshiba)
 2519 	cf_ipv6lib=inet6
 2520 	cf_ipv6dir=v6
 2521 	;;
 2522 (v6d)
 2523 	cf_ipv6lib=v6
 2524 	cf_ipv6dir=v6
 2525 	;;
 2526 (zeta)
 2527 	cf_ipv6lib=inet6
 2528 	cf_ipv6dir=v6
 2529 	;;
 2530 esac
 2531 AC_MSG_RESULT($cf_ipv6lib)
 2532 
 2533 if test "$cf_ipv6lib" != "none"; then
 2534 
 2535 	AC_TRY_LINK([
 2536 #include <sys/types.h>
 2537 #include <netdb.h>
 2538 #include <netinet/in.h>
 2539 #include <netinet/ip6.h>],
 2540 	[getaddrinfo(0, 0, 0, 0)],,[
 2541 	CF_HEADER_PATH(cf_search,$cf_ipv6dir)
 2542 	for cf_incdir in $cf_search
 2543 	do
 2544 		cf_header=$cf_incdir/netinet/ip6.h
 2545 		if test -f $cf_header
 2546 		then
 2547 			CF_ADD_INCDIR($cf_incdir)
 2548 			test -n "$verbose" && echo "	... found $cf_header" 1>&AC_FD_MSG
 2549 			break
 2550 		fi
 2551 		test -n "$verbose" && echo "	... tested $cf_header" 1>&AC_FD_MSG
 2552 	done
 2553 	])
 2554 
 2555 	CF_FIND_LIBRARY([$cf_ipv6lib],[$cf_ipv6dir],[
 2556 #include <sys/types.h>
 2557 #include <netdb.h>
 2558 #include <netinet/in.h>
 2559 #include <netinet/ip6.h>],
 2560 	[getaddrinfo(0, 0, 0, 0)],
 2561 	[getaddrinfo],
 2562 	noexit)
 2563 	if test $cf_found_library = no ; then
 2564 		AC_MSG_ERROR(
 2565 [No $cf_ipv6lib library found, cannot continue.  You must fetch lib$cf_ipv6lib.a
 2566 from an appropriate IPv6 kit and compile beforehand.])
 2567 	fi
 2568 fi
 2569 
 2570 ])dnl
 2571 dnl ---------------------------------------------------------------------------
 2572 dnl CF_FIND_IPV6_TYPE version: 6 updated: 2015/04/15 19:08:48
 2573 dnl -----------------
 2574 AC_DEFUN([CF_FIND_IPV6_TYPE],[
 2575 AC_CACHE_CHECK(ipv6 stack type, cf_cv_ipv6type, [
 2576 cf_cv_ipv6type=unknown
 2577 for i in solaris inria kame linux-glibc linux-libinet6 toshiba v6d zeta
 2578 do
 2579 	case $i in
 2580 	(solaris)
 2581 		if test "SunOS" = "`uname -s`"
 2582 		then
 2583 		  if test -f /usr/include/netinet/ip6.h
 2584 		  then
 2585 			cf_cv_ipv6type=$i
 2586 		  fi
 2587 		fi
 2588 		;;
 2589 	(inria)
 2590 		dnl http://www.kame.net/
 2591 		AC_EGREP_CPP(yes, [
 2592 #include <netinet/in.h>
 2593 #ifdef IPV6_INRIA_VERSION
 2594 yes
 2595 #endif],	[cf_cv_ipv6type=$i])
 2596 		;;
 2597 	(kame)
 2598 		dnl http://www.kame.net/
 2599 		AC_EGREP_CPP(yes, [
 2600 #include <netinet/in.h>
 2601 #ifdef __KAME__
 2602 yes
 2603 #endif],	[cf_cv_ipv6type=$i])
 2604 		;;
 2605 	(linux-glibc)
 2606 		dnl http://www.v6.linux.or.jp/
 2607 		AC_EGREP_CPP(yes, [
 2608 #include <features.h>
 2609 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
 2610 yes
 2611 #endif],	[cf_cv_ipv6type=$i])
 2612 		;;
 2613 	(linux-libinet6)
 2614 		dnl http://www.v6.linux.or.jp/
 2615 		if test -d /usr/inet6
 2616 		then
 2617 			cf_cv_ipv6type=$i
 2618 		elif test -f /usr/include/netinet/ip6.h
 2619 		then
 2620 			cf_cv_ipv6type=$i
 2621 		fi
 2622 		;;
 2623 	(toshiba)
 2624 		AC_EGREP_CPP(yes, [
 2625 #include <sys/param.h>
 2626 #ifdef _TOSHIBA_INET6
 2627 yes
 2628 #endif],	[cf_cv_ipv6type=$i])
 2629 		;;
 2630 	(v6d)
 2631 		AC_EGREP_CPP(yes, [
 2632 #include </usr/local/v6/include/sys/v6config.h>
 2633 #ifdef __V6D__
 2634 yes
 2635 #endif],	[cf_cv_ipv6type=$i])
 2636 		;;
 2637 	(zeta)
 2638 		AC_EGREP_CPP(yes, [
 2639 #include <sys/param.h>
 2640 #ifdef _ZETA_MINAMI_INET6
 2641 yes
 2642 #endif],	[cf_cv_ipv6type=$i])
 2643 		;;
 2644 	esac
 2645 	if test "$cf_cv_ipv6type" != "unknown"; then
 2646 		break
 2647 	fi
 2648 done
 2649 ])
 2650 ])dnl
 2651 dnl ---------------------------------------------------------------------------
 2652 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
 2653 dnl ---------------
 2654 dnl Look for a non-standard library, given parameters for AC_TRY_LINK.  We
 2655 dnl prefer a standard location, and use -L options only if we do not find the
 2656 dnl library in the standard library location(s).
 2657 dnl	$1 = library name
 2658 dnl	$2 = library class, usually the same as library name
 2659 dnl	$3 = includes
 2660 dnl	$4 = code fragment to compile/link
 2661 dnl	$5 = corresponding function-name
 2662 dnl	$6 = flag, nonnull if failure should not cause an error-exit
 2663 dnl
 2664 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
 2665 dnl to use a -L option.
 2666 AC_DEFUN([CF_FIND_LIBRARY],
 2667 [
 2668 	eval 'cf_cv_have_lib_'$1'=no'
 2669 	cf_libdir=""
 2670 	AC_CHECK_FUNC($5,
 2671 		eval 'cf_cv_have_lib_'$1'=yes',[
 2672 		cf_save_LIBS="$LIBS"
 2673 		AC_MSG_CHECKING(for $5 in -l$1)
 2674 		LIBS="-l$1 $LIBS"
 2675 		AC_TRY_LINK([$3],[$4],
 2676 			[AC_MSG_RESULT(yes)
 2677 			 eval 'cf_cv_have_lib_'$1'=yes'
 2678 			],
 2679 			[AC_MSG_RESULT(no)
 2680 			CF_LIBRARY_PATH(cf_search,$2)
 2681 			for cf_libdir in $cf_search
 2682 			do
 2683 				AC_MSG_CHECKING(for -l$1 in $cf_libdir)
 2684 				LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
 2685 				AC_TRY_LINK([$3],[$4],
 2686 					[AC_MSG_RESULT(yes)
 2687 			 		 eval 'cf_cv_have_lib_'$1'=yes'
 2688 					 break],
 2689 					[AC_MSG_RESULT(no)
 2690 					 LIBS="$cf_save_LIBS"])
 2691 			done
 2692 			])
 2693 		])
 2694 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
 2695 ifelse($6,,[
 2696 if test $cf_found_library = no ; then
 2697 	AC_MSG_ERROR(Cannot link $1 library)
 2698 fi
 2699 ])
 2700 ])dnl
 2701 dnl ---------------------------------------------------------------------------
 2702 dnl CF_FIND_LINKAGE version: 20 updated: 2015/04/18 08:56:57
 2703 dnl ---------------
 2704 dnl Find a library (specifically the linkage used in the code fragment),
 2705 dnl searching for it if it is not already in the library path.
 2706 dnl See also CF_ADD_SEARCHPATH.
 2707 dnl
 2708 dnl Parameters (4-on are optional):
 2709 dnl     $1 = headers for library entrypoint
 2710 dnl     $2 = code fragment for library entrypoint
 2711 dnl     $3 = the library name without the "-l" option or ".so" suffix.
 2712 dnl     $4 = action to perform if successful (default: update CPPFLAGS, etc)
 2713 dnl     $5 = action to perform if not successful
 2714 dnl     $6 = module name, if not the same as the library name
 2715 dnl     $7 = extra libraries
 2716 dnl
 2717 dnl Sets these variables:
 2718 dnl     $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
 2719 dnl     $cf_cv_header_path_$3 - include-directory if needed
 2720 dnl     $cf_cv_library_path_$3 - library-directory if needed
 2721 dnl     $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
 2722 AC_DEFUN([CF_FIND_LINKAGE],[
 2723 
 2724 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
 2725 # will be set on completion of the AC_TRY_LINK below.
 2726 cf_cv_header_path_$3=
 2727 cf_cv_library_path_$3=
 2728 
 2729 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
 2730 
 2731 cf_save_LIBS="$LIBS"
 2732 
 2733 AC_TRY_LINK([$1],[$2],[
 2734 	cf_cv_find_linkage_$3=yes
 2735 	cf_cv_header_path_$3=/usr/include
 2736 	cf_cv_library_path_$3=/usr/lib
 2737 ],[
 2738 
 2739 LIBS="-l$3 $7 $cf_save_LIBS"
 2740 
 2741 AC_TRY_LINK([$1],[$2],[
 2742 	cf_cv_find_linkage_$3=yes
 2743 	cf_cv_header_path_$3=/usr/include
 2744 	cf_cv_library_path_$3=/usr/lib
 2745 	cf_cv_library_file_$3="-l$3"
 2746 ],[
 2747 	cf_cv_find_linkage_$3=no
 2748 	LIBS="$cf_save_LIBS"
 2749 
 2750 	CF_VERBOSE(find linkage for $3 library)
 2751 	CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
 2752 
 2753 	cf_save_CPPFLAGS="$CPPFLAGS"
 2754 	cf_test_CPPFLAGS="$CPPFLAGS"
 2755 
 2756 	CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
 2757 	for cf_cv_header_path_$3 in $cf_search
 2758 	do
 2759 		if test -d $cf_cv_header_path_$3 ; then
 2760 			CF_VERBOSE(... testing $cf_cv_header_path_$3)
 2761 			CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
 2762 			AC_TRY_COMPILE([$1],[$2],[
 2763 				CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
 2764 				cf_cv_find_linkage_$3=maybe
 2765 				cf_test_CPPFLAGS="$CPPFLAGS"
 2766 				break],[
 2767 				CPPFLAGS="$cf_save_CPPFLAGS"
 2768 				])
 2769 		fi
 2770 	done
 2771 
 2772 	if test "$cf_cv_find_linkage_$3" = maybe ; then
 2773 
 2774 		CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
 2775 
 2776 		cf_save_LIBS="$LIBS"
 2777 		cf_save_LDFLAGS="$LDFLAGS"
 2778 
 2779 		ifelse([$6],,,[
 2780 		CPPFLAGS="$cf_test_CPPFLAGS"
 2781 		LIBS="-l$3 $7 $cf_save_LIBS"
 2782 		AC_TRY_LINK([$1],[$2],[
 2783 			CF_VERBOSE(... found $3 library in system)
 2784 			cf_cv_find_linkage_$3=yes])
 2785 			CPPFLAGS="$cf_save_CPPFLAGS"
 2786 			LIBS="$cf_save_LIBS"
 2787 			])
 2788 
 2789 		if test "$cf_cv_find_linkage_$3" != yes ; then
 2790 			CF_LIBRARY_PATH(cf_search,$3)
 2791 			for cf_cv_library_path_$3 in $cf_search
 2792 			do
 2793 				if test -d $cf_cv_library_path_$3 ; then
 2794 					CF_VERBOSE(... testing $cf_cv_library_path_$3)
 2795 					CPPFLAGS="$cf_test_CPPFLAGS"
 2796 					LIBS="-l$3 $7 $cf_save_LIBS"
 2797 					LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
 2798 					AC_TRY_LINK([$1],[$2],[
 2799 					CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
 2800 					cf_cv_find_linkage_$3=yes
 2801 					cf_cv_library_file_$3="-l$3"
 2802 					break],[
 2803 					CPPFLAGS="$cf_save_CPPFLAGS"
 2804 					LIBS="$cf_save_LIBS"
 2805 					LDFLAGS="$cf_save_LDFLAGS"
 2806 					])
 2807 				fi
 2808 			done
 2809 			CPPFLAGS="$cf_save_CPPFLAGS"
 2810 			LDFLAGS="$cf_save_LDFLAGS"
 2811 		fi
 2812 
 2813 	else
 2814 		cf_cv_find_linkage_$3=no
 2815 	fi
 2816 	],$7)
 2817 ])
 2818 
 2819 LIBS="$cf_save_LIBS"
 2820 
 2821 if test "$cf_cv_find_linkage_$3" = yes ; then
 2822 ifelse([$4],,[
 2823 	CF_ADD_INCDIR($cf_cv_header_path_$3)
 2824 	CF_ADD_LIBDIR($cf_cv_library_path_$3)
 2825 	CF_ADD_LIB($3)
 2826 ],[$4])
 2827 else
 2828 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
 2829 fi
 2830 ])dnl
 2831 dnl ---------------------------------------------------------------------------
 2832 dnl CF_FIX_SLASHES version: 2 updated: 2001/05/27 21:36:02
 2833 dnl --------------
 2834 dnl OS/2 and Cygwin ports may pick up backslashes in pathnames, which are not
 2835 dnl usable in quoted strings.  Fix them.
 2836 dnl	$1=fixed($2)
 2837 AC_DEFUN([CF_FIX_SLASHES],
 2838 [
 2839 case $cf_cv_system_name in #(vi
 2840 os2*|cygwin*)
 2841 	$1=`echo "[$]$1" | sed -e 's%\\\\%/%g'`
 2842 	;;
 2843 esac
 2844 ])dnl
 2845 dnl ---------------------------------------------------------------------------
 2846 dnl CF_FUNC_ALLOCA version: 2 updated: 2009/01/06 19:35:17
 2847 dnl --------------
 2848 dnl workaround for bison 1.875c (compound breakage in Linux stdlib.h and
 2849 dnl bison's output make bison try to use alloca()).
 2850 AC_DEFUN([CF_FUNC_ALLOCA],
 2851 [
 2852 AC_FUNC_ALLOCA
 2853 
 2854 case $host_os in
 2855 linux*|gnu*)
 2856 	# workaround for bison 1.875c (compound breakage in Linux stdlib.h
 2857 	# and bison's output make bison try to use alloca()).
 2858 	if test -z "$GCC" ; then
 2859 		CPPFLAGS="$CPPFLAGS -DYYSTACK_USE_ALLOCA=0"
 2860 		ALLOCA=""
 2861 	elif test "$INTEL_COMPILER" = yes ; then
 2862 		CPPFLAGS="$CPPFLAGS -DYYSTACK_USE_ALLOCA=0"
 2863 		ALLOCA=""
 2864 	fi
 2865 	;;
 2866 esac
 2867 ])dnl
 2868 dnl ---------------------------------------------------------------------------
 2869 dnl CF_FUNC_FORK version: 4 updated: 2010/10/23 15:52:32
 2870 dnl ------------
 2871 dnl Check if 'fork()' is available, and working.  Amiga (and possibly other
 2872 dnl machines) have a non-working 'fork()' entrypoint.
 2873 AC_DEFUN([CF_FUNC_FORK],
 2874 [AC_MSG_CHECKING([for fork])
 2875 AC_CACHE_VAL(cf_cv_func_fork,[
 2876 AC_TRY_RUN([
 2877 int main()
 2878 {
 2879 	if (fork() < 0)
 2880 		${cf_cv_main_return:-return}(1);
 2881 	${cf_cv_main_return:-return}(0);
 2882 }],	[cf_cv_func_fork=yes],
 2883 	[cf_cv_func_fork=no],
 2884 	[cf_cv_func_fork=unknown])
 2885 ])dnl
 2886 AC_MSG_RESULT($cf_cv_func_fork)
 2887 test $cf_cv_func_fork = yes && AC_DEFINE(HAVE_FORK)
 2888 ])dnl
 2889 dnl ---------------------------------------------------------------------------
 2890 dnl CF_FUNC_GETADDRINFO version: 9 updated: 2017/05/10 18:31:29
 2891 dnl -------------------
 2892 dnl Look for a working version of getaddrinfo(), for IPV6 support.
 2893 AC_DEFUN([CF_FUNC_GETADDRINFO],[
 2894 AC_CACHE_CHECK(working getaddrinfo, cf_cv_getaddrinfo,[
 2895 AC_TRY_RUN([
 2896 #include <sys/types.h>
 2897 #include <netdb.h>
 2898 #include <string.h>
 2899 #include <sys/socket.h>
 2900 #include <netinet/in.h>
 2901 
 2902 #define expect(a,b) if (strcmp(a,b) != 0) goto bad
 2903 
 2904 int main(void)
 2905 {
 2906    int passive, gaierr, inet4 = 0, inet6 = 0;
 2907    struct addrinfo hints, *ai, *aitop;
 2908    char straddr[INET6_ADDRSTRLEN], strport[16];
 2909 
 2910    for (passive = 0; passive <= 1; passive++) {
 2911      memset(&hints, 0, sizeof(hints));
 2912      hints.ai_family = AF_UNSPEC;
 2913      hints.ai_flags = passive ? AI_PASSIVE : 0;
 2914      hints.ai_socktype = SOCK_STREAM;
 2915      if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
 2916        (void)gai_strerror(gaierr);
 2917        goto bad;
 2918      }
 2919      for (ai = aitop; ai; ai = ai->ai_next) {
 2920        if (ai->ai_addr == NULL ||
 2921            ai->ai_addrlen == 0 ||
 2922            getnameinfo(ai->ai_addr, ai->ai_addrlen,
 2923                        straddr, sizeof(straddr), strport, sizeof(strport),
 2924                        NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
 2925          goto bad;
 2926        }
 2927        switch (ai->ai_family) {
 2928        case AF_INET:
 2929          expect(strport, "54321");
 2930          if (passive) {
 2931            expect(straddr, "0.0.0.0");
 2932          } else {
 2933            expect(straddr, "127.0.0.1");
 2934          }
 2935          inet4++;
 2936          break;
 2937        case AF_INET6:
 2938          expect(strport, "54321");
 2939          if (passive) {
 2940            expect(straddr, "::");
 2941          } else {
 2942            expect(straddr, "::1");
 2943          }
 2944          inet6++;
 2945          break;
 2946        case AF_UNSPEC:
 2947          goto bad;
 2948          break;
 2949        default:
 2950          /* another family support? */
 2951          break;
 2952        }
 2953      }
 2954    }
 2955 
 2956    if (!(inet4 == 0 || inet4 == 2))
 2957      goto bad;
 2958    if (!(inet6 == 0 || inet6 == 2))
 2959      goto bad;
 2960 
 2961    if (aitop)
 2962      freeaddrinfo(aitop);
 2963    ${cf_cv_main_return:-return}(0);
 2964 
 2965   bad:
 2966    if (aitop)
 2967      freeaddrinfo(aitop);
 2968    ${cf_cv_main_return:-return}(1);
 2969 }
 2970 ],
 2971 [cf_cv_getaddrinfo=yes],
 2972 [cf_cv_getaddrinfo=no],
 2973 [cf_cv_getaddrinfo=unknown])
 2974 ])
 2975 if test "$cf_cv_getaddrinfo" = yes ; then
 2976 	AC_DEFINE(HAVE_GAI_STRERROR,1,[Define to 1 if we have gai_strerror function])
 2977 	AC_DEFINE(HAVE_GETADDRINFO,1,[Define to 1 if we have getaddrinfo function])
 2978 fi
 2979 ])dnl
 2980 dnl ---------------------------------------------------------------------------
 2981 dnl CF_FUNC_MEMMOVE version: 9 updated: 2017/01/21 11:06:25
 2982 dnl ---------------
 2983 dnl Check for memmove, or a bcopy that can handle overlapping copy.  If neither
 2984 dnl is found, add our own version of memmove to the list of objects.
 2985 AC_DEFUN([CF_FUNC_MEMMOVE],
 2986 [
 2987 AC_CHECK_FUNC(memmove,,[
 2988 AC_CHECK_FUNC(bcopy,[
 2989 	AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
 2990 		AC_TRY_RUN([
 2991 int main(void) {
 2992 	static char data[] = "abcdefghijklmnopqrstuwwxyz";
 2993 	char temp[40];
 2994 	bcopy(data, temp, sizeof(data));
 2995 	bcopy(temp+10, temp, 15);
 2996 	bcopy(temp+5, temp+15, 10);
 2997 	${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
 2998 }
 2999 		],
 3000 		[cf_cv_good_bcopy=yes],
 3001 		[cf_cv_good_bcopy=no],
 3002 		[cf_cv_good_bcopy=unknown])
 3003 		])
 3004 	],[cf_cv_good_bcopy=no])
 3005 	if test "$cf_cv_good_bcopy" = yes ; then
 3006 		AC_DEFINE(USE_OK_BCOPY,1,[Define to 1 to use bcopy when memmove is unavailable])
 3007 	else
 3008 		AC_DEFINE(USE_MY_MEMMOVE,1,[Define to 1 to use replacement function when memmove is unavailable])
 3009 	fi
 3010 ])])dnl
 3011 dnl ---------------------------------------------------------------------------
 3012 dnl CF_FUNC_SYSTEM version: 5 updated: 2010/10/23 15:52:32
 3013 dnl --------------
 3014 dnl Check if the 'system()' function returns a usable status, or if not, try
 3015 dnl to use the status returned by a SIGCHLD.
 3016 AC_DEFUN([CF_FUNC_SYSTEM],
 3017 [
 3018 AC_REQUIRE([CF_UNION_WAIT])
 3019 AC_MSG_CHECKING(if the system function returns usable child-status)
 3020 AC_CACHE_VAL(cf_cv_system_status,[
 3021 	AC_TRY_RUN([
 3022 #include <stdio.h>
 3023 #include <signal.h>
 3024 #if HAVE_SYS_WAIT_H
 3025 #include <sys/wait.h>
 3026 #endif
 3027 
 3028 RETSIGTYPE signal_handler (int sig)
 3029 {
 3030 #if HAVE_TYPE_UNIONWAIT
 3031 	union wait wait_status;
 3032 #else
 3033 	int wait_status = 1;
 3034 #endif
 3035 	int system_status;
 3036 	wait (&wait_status);
 3037 	system_status = WEXITSTATUS(wait_status); /* should be nonzero */
 3038 	${cf_cv_main_return:-return}(system_status != 23);
 3039 }
 3040 
 3041 int main()
 3042 {
 3043 	/* this looks weird, but apparently the SIGCHLD gets there first on
 3044 	 * machines where 'system()' doesn't return a usable code, so ...
 3045 	 */
 3046 	signal (SIGCHLD, signal_handler);
 3047 	system("exit 23");
 3048 	${cf_cv_main_return:-return}(1);
 3049 }
 3050 ],
 3051 	[cf_cv_system_status=no],
 3052 	[AC_TRY_RUN(
 3053 	[int main() { ${cf_cv_main_return:-return}(system("exit 23") != (23 << 8)); }],
 3054 	[cf_cv_system_status=yes],
 3055 	[cf_cv_system_status=unknown],
 3056 	[cf_cv_system_status=unknown])],
 3057 	[cf_cv_system_status=unknown])
 3058 ])
 3059 AC_MSG_RESULT($cf_cv_system_status)
 3060 test $cf_cv_system_status = no && AC_DEFINE(USE_SYSTEM_STATUS)
 3061 ])dnl
 3062 dnl ---------------------------------------------------------------------------
 3063 dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
 3064 dnl --------------
 3065 dnl Find version of gcc
 3066 AC_DEFUN([CF_GCC_VERSION],[
 3067 AC_REQUIRE([AC_PROG_CC])
 3068 GCC_VERSION=none
 3069 if test "$GCC" = yes ; then
 3070 	AC_MSG_CHECKING(version of $CC)
 3071 	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.]].*//'`"
 3072 	test -z "$GCC_VERSION" && GCC_VERSION=unknown
 3073 	AC_MSG_RESULT($GCC_VERSION)
 3074 fi
 3075 ])dnl
 3076 dnl ---------------------------------------------------------------------------
 3077 dnl CF_GCC_WARNINGS version: 32 updated: 2015/04/12 15:39:00
 3078 dnl ---------------
 3079 dnl Check if the compiler supports useful warning options.  There's a few that
 3080 dnl we don't use, simply because they're too noisy:
 3081 dnl
 3082 dnl	-Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
 3083 dnl	-Wredundant-decls (system headers make this too noisy)
 3084 dnl	-Wtraditional (combines too many unrelated messages, only a few useful)
 3085 dnl	-Wwrite-strings (too noisy, but should review occasionally).  This
 3086 dnl		is enabled for ncurses using "--enable-const".
 3087 dnl	-pedantic
 3088 dnl
 3089 dnl Parameter:
 3090 dnl	$1 is an optional list of gcc warning flags that a particular
 3091 dnl		application might want to use, e.g., "no-unused" for
 3092 dnl		-Wno-unused
 3093 dnl Special:
 3094 dnl	If $with_ext_const is "yes", add a check for -Wwrite-strings
 3095 dnl
 3096 AC_DEFUN([CF_GCC_WARNINGS],
 3097 [
 3098 AC_REQUIRE([CF_GCC_VERSION])
 3099 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
 3100 CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
 3101 
 3102 cat > conftest.$ac_ext <<EOF
 3103 #line __oline__ "${as_me:-configure}"
 3104 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
 3105 EOF
 3106 
 3107 if test "$INTEL_COMPILER" = yes
 3108 then
 3109 # The "-wdXXX" options suppress warnings:
 3110 # remark #1419: external declaration in primary source file
 3111 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
 3112 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
 3113 # remark #193: zero used for undefined preprocessing identifier
 3114 # remark #593: variable "curs_sb_left_arrow" was set but never used
 3115 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
 3116 # remark #869: parameter "tw" was never referenced
 3117 # remark #981: operands are evaluated in unspecified order
 3118 # warning #279: controlling expression is constant
 3119 
 3120 	AC_CHECKING([for $CC warning options])
 3121 	cf_save_CFLAGS="$CFLAGS"
 3122 	EXTRA_CFLAGS="-Wall"
 3123 	for cf_opt in \
 3124 		wd1419 \
 3125 		wd1683 \
 3126 		wd1684 \
 3127 		wd193 \
 3128 		wd593 \
 3129 		wd279 \
 3130 		wd810 \
 3131 		wd869 \
 3132 		wd981
 3133 	do
 3134 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
 3135 		if AC_TRY_EVAL(ac_compile); then
 3136 			test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
 3137 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 3138 		fi
 3139 	done
 3140 	CFLAGS="$cf_save_CFLAGS"
 3141 
 3142 elif test "$GCC" = yes
 3143 then
 3144 	AC_CHECKING([for $CC warning options])
 3145 	cf_save_CFLAGS="$CFLAGS"
 3146 	EXTRA_CFLAGS=
 3147 	cf_warn_CONST=""
 3148 	test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
 3149 	cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs"
 3150 	test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings=
 3151 	for cf_opt in W Wall \
 3152 		Wbad-function-cast \
 3153 		Wcast-align \
 3154 		Wcast-qual \
 3155 		Wdeclaration-after-statement \
 3156 		Wextra \
 3157 		Winline \
 3158 		Wmissing-declarations \
 3159 		Wmissing-prototypes \
 3160 		Wnested-externs \
 3161 		Wpointer-arith \
 3162 		Wshadow \
 3163 		Wstrict-prototypes \
 3164 		Wundef $cf_gcc_warnings $cf_warn_CONST $1
 3165 	do
 3166 		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
 3167 		if AC_TRY_EVAL(ac_compile); then
 3168 			test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
 3169 			case $cf_opt in
 3170 			(Wcast-qual)
 3171 				CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
 3172 				;;
 3173 			(Winline)
 3174 				case $GCC_VERSION in
 3175 				([[34]].*)
 3176 					CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
 3177 					continue;;
 3178 				esac
 3179 				;;
 3180 			(Wpointer-arith)
 3181 				case $GCC_VERSION in
 3182 				([[12]].*)
 3183 					CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
 3184 					continue;;
 3185 				esac
 3186 				;;
 3187 			esac
 3188 			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
 3189 		fi
 3190 	done
 3191 	CFLAGS="$cf_save_CFLAGS"
 3192 fi
 3193 rm -rf conftest*
 3194 
 3195 AC_SUBST(EXTRA_CFLAGS)
 3196 ])dnl
 3197 dnl ---------------------------------------------------------------------------
 3198 dnl CF_GNU_SOURCE version: 7 updated: 2016/08/05 05:15:37
 3199 dnl -------------
 3200 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
 3201 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend.  This is a defect
 3202 dnl (or misfeature) of glibc2, which breaks portability of many applications,
 3203 dnl since it is interwoven with GNU extensions.
 3204 dnl
 3205 dnl Well, yes we could work around it...
 3206 AC_DEFUN([CF_GNU_SOURCE],
 3207 [
 3208 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
 3209 AC_TRY_COMPILE([#include <sys/types.h>],[
 3210 #ifndef _XOPEN_SOURCE
 3211 make an error
 3212 #endif],
 3213 	[cf_cv_gnu_source=no],
 3214 	[cf_save="$CPPFLAGS"
 3215 	 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
 3216 	 AC_TRY_COMPILE([#include <sys/types.h>],[
 3217 #ifdef _XOPEN_SOURCE
 3218 make an error
 3219 #endif],
 3220 	[cf_cv_gnu_source=no],
 3221 	[cf_cv_gnu_source=yes])
 3222 	CPPFLAGS="$cf_save"
 3223 	])
 3224 ])
 3225 
 3226 if test "$cf_cv_gnu_source" = yes
 3227 then
 3228 AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[
 3229 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
 3230 	AC_TRY_COMPILE([#include <sys/types.h>],[
 3231 #ifdef _DEFAULT_SOURCE
 3232 make an error
 3233 #endif],
 3234 		[cf_cv_default_source=no],
 3235 		[cf_cv_default_source=yes])
 3236 	])
 3237 test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE"
 3238 fi
 3239 ])dnl
 3240 dnl ---------------------------------------------------------------------------
 3241 dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48
 3242 dnl --------------
 3243 dnl Construct a search-list of directories for a nonstandard header-file
 3244 dnl
 3245 dnl Parameters
 3246 dnl	$1 = the variable to return as result
 3247 dnl	$2 = the package name
 3248 AC_DEFUN([CF_HEADER_PATH],
 3249 [
 3250 $1=
 3251 
 3252 # collect the current set of include-directories from compiler flags
 3253 cf_header_path_list=""
 3254 if test -n "${CFLAGS}${CPPFLAGS}" ; then
 3255 	for cf_header_path in $CPPFLAGS $CFLAGS
 3256 	do
 3257 		case $cf_header_path in
 3258 		(-I*)
 3259 			cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
 3260 			CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
 3261 			cf_header_path_list="$cf_header_path_list [$]$1"
 3262 			;;
 3263 		esac
 3264 	done
 3265 fi
 3266 
 3267 # add the variations for the package we are looking for
 3268 CF_SUBDIR_PATH($1,$2,include)
 3269 
 3270 test "$includedir" != NONE && \
 3271 test "$includedir" != "/usr/include" && \
 3272 test -d "$includedir" && {
 3273 	test -d $includedir &&    $1="[$]$1 $includedir"
 3274 	test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
 3275 }
 3276 
 3277 test "$oldincludedir" != NONE && \
 3278 test "$oldincludedir" != "/usr/include" && \
 3279 test -d "$oldincludedir" && {
 3280 	test -d $oldincludedir    && $1="[$]$1 $oldincludedir"
 3281 	test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
 3282 }
 3283 
 3284 $1="[$]$1 $cf_header_path_list"
 3285 ])dnl
 3286 dnl ---------------------------------------------------------------------------
 3287 dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00
 3288 dnl -----------------
 3289 dnl Check if the given compiler is really the Intel compiler for Linux.  It
 3290 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
 3291 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
 3292 dnl
 3293 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
 3294 dnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
 3295 dnl the wrappers for gcc and g++ warnings.
 3296 dnl
 3297 dnl $1 = GCC (default) or GXX
 3298 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
 3299 dnl $3 = CFLAGS (default) or CXXFLAGS
 3300 AC_DEFUN([CF_INTEL_COMPILER],[
 3301 AC_REQUIRE([AC_CANONICAL_HOST])
 3302 ifelse([$2],,INTEL_COMPILER,[$2])=no
 3303 
 3304 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
 3305 	case $host_os in
 3306 	(linux*|gnu*)
 3307 		AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
 3308 		cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
 3309 		ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
 3310 		AC_TRY_COMPILE([],[
 3311 #ifdef __INTEL_COMPILER
 3312 #else
 3313 make an error
 3314 #endif
 3315 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
 3316 cf_save_CFLAGS="$cf_save_CFLAGS -we147"
 3317 ],[])
 3318 		ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
 3319 		AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
 3320 		;;
 3321 	esac
 3322 fi
 3323 ])dnl
 3324 dnl ---------------------------------------------------------------------------
 3325 dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48
 3326 dnl ---------------
 3327 dnl Construct a search-list of directories for a nonstandard library-file
 3328 dnl
 3329 dnl Parameters
 3330 dnl	$1 = the variable to return as result
 3331 dnl	$2 = the package name
 3332 AC_DEFUN([CF_LIBRARY_PATH],
 3333 [
 3334 $1=
 3335 cf_library_path_list=""
 3336 if test -n "${LDFLAGS}${LIBS}" ; then
 3337 	for cf_library_path in $LDFLAGS $LIBS
 3338 	do
 3339 		case $cf_library_path in
 3340 		(-L*)
 3341 			cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
 3342 			CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
 3343 			cf_library_path_list="$cf_library_path_list [$]$1"
 3344 			;;
 3345 		esac
 3346 	done
 3347 fi
 3348 
 3349 CF_SUBDIR_PATH($1,$2,lib)
 3350 
 3351 $1="$cf_library_path_list [$]$1"
 3352 ])dnl
 3353 dnl ---------------------------------------------------------------------------
 3354 dnl CF_LIB_PREFIX version: 12 updated: 2015/10/17 19:03:33
 3355 dnl -------------
 3356 dnl Compute the library-prefix for the given host system
 3357 dnl $1 = variable to set
 3358 define([CF_LIB_PREFIX],
 3359 [
 3360 	case $cf_cv_system_name in
 3361 	(OS/2*|os2*)
 3362 		if test "$DFT_LWR_MODEL" = libtool; then
 3363 			LIB_PREFIX='lib'
 3364 		else
 3365 			LIB_PREFIX=''
 3366 		fi
 3367 		;;
 3368 	(*)	LIB_PREFIX='lib'
 3369 		;;
 3370 	esac
 3371 ifelse($1,,,[$1=$LIB_PREFIX])
 3372 	AC_SUBST(LIB_PREFIX)
 3373 ])dnl
 3374 dnl ---------------------------------------------------------------------------
 3375 dnl CF_LOCKFILE version: 2 updated: 2001/05/26 12:41:02
 3376 dnl -----------
 3377 dnl Check for functions that we can use for file-locking.  Simply checking for
 3378 dnl existence is not sufficient, since fcntl, for example, uses definitions
 3379 dnl that are not in every version of the header.
 3380 AC_DEFUN([CF_LOCKFILE],
 3381 [
 3382 AC_CHECK_HEADERS(unistd.h fcntl.h sys/file.h)
 3383 AC_CHECK_FUNC(fcntl)
 3384 AC_CHECK_FUNC(lockf)
 3385 AC_CHECK_FUNC(flock,,,[
 3386 	CF_RECHECK_FUNC(flock,bsd,cf_cv_lockfile,[AC_MSG_WARN(no lock function found)])])
 3387 
 3388 AC_CACHE_CHECK(for file-locking functions,cf_cv_lockfile,[
 3389 cf_cv_lockfile=
 3390 for cf_lock in fcntl lockf flock
 3391 do
 3392 if eval 'test ${ac_cv_func_'$cf_lock'+set} = set'; then
 3393 	case $cf_lock in #(vi
 3394 	fcntl) #(vi
 3395 		AC_TRY_COMPILE([
 3396 #include <stdio.h>
 3397 #ifdef HAVE_UNISTD_H
 3398 #include <unistd.h>
 3399 #endif
 3400 #ifdef HAVE_FCNTL_H
 3401 #include <fcntl.h>
 3402 #endif
 3403 ],[
 3404 	struct flock flk;
 3405 	int block = 1;
 3406 	int fd = 0;
 3407 	int rc;
 3408 
 3409 	flk.l_type = F_WRLCK;
 3410 	flk.l_whence = SEEK_SET;
 3411 	flk.l_start = 0;
 3412 	flk.l_len = 0;
 3413 	rc = fcntl(fd, block ? F_SETLKW : F_SETLK, &flk)
 3414 	&& fcntl(fd, F_GETLK, &flk)
 3415 	&& fcntl(fd, F_SETLK, &flk);
 3416 	],,continue)
 3417 		;;
 3418 	lockf) #(vi
 3419 		AC_TRY_COMPILE([
 3420 #include <stdio.h>
 3421 #ifdef HAVE_UNISTD_H
 3422 #include <unistd.h>
 3423 #endif
 3424 #ifdef HAVE_FCNTL_H
 3425 #include <fcntl.h>
 3426 #endif
 3427 ],[
 3428 	int block = 1, fd = 0;
 3429 	int ret = lockf(fd, block ? F_LOCK : F_TLOCK, 0L)
 3430 	 && lockf(fd, F_TEST, 0L)
 3431 	 && lockf(fd, F_ULOCK, 0L);
 3432 	],,[continue])
 3433 		;;
 3434 	flock)
 3435 		AC_TRY_COMPILE([
 3436 #include <stdio.h>
 3437 #ifdef HAVE_UNISTD_H
 3438 #include <unistd.h>
 3439 #endif
 3440 #ifdef HAVE_FCNTL_H
 3441 #include <fcntl.h>
 3442 #endif
 3443 #ifdef HAVE_SYS_FILE_H
 3444 #include <sys/file.h>
 3445 #endif
 3446 ],[
 3447 	int block = 1, fd = 0;
 3448 	int ret = flock(fd, (LOCK_EX|LOCK_NB))
 3449 	 && flock(fd, LOCK_UN)
 3450 	 && flock(fd, block ? LOCK_EX : (LOCK_EX | LOCK_NB));
 3451 	],,[continue])
 3452 		;;
 3453 	esac
 3454 	cf_cv_lockfile="$cf_cv_lockfile $cf_lock"
 3455 fi
 3456 done
 3457 ])
 3458 ])dnl
 3459 dnl ---------------------------------------------------------------------------
 3460 dnl CF_MAKEFLAGS version: 17 updated: 2015/08/05 20:44:28
 3461 dnl ------------
 3462 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
 3463 dnl options to lower-levels.  It's very useful for "make -n" -- if we have it.
 3464 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
 3465 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
 3466 AC_DEFUN([CF_MAKEFLAGS],
 3467 [
 3468 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
 3469 	cf_cv_makeflags=''
 3470 	for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
 3471 	do
 3472 		cat >cf_makeflags.tmp <<CF_EOF
 3473 SHELL = $SHELL
 3474 all :
 3475 	@ echo '.$cf_option'
 3476 CF_EOF
 3477 		cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ 	]]*$,,'`
 3478 		case "$cf_result" in
 3479 		(.*k|.*kw)
 3480 			cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
 3481 			case "$cf_result" in
 3482 			(.*CC=*)	cf_cv_makeflags=
 3483 				;;
 3484 			(*)	cf_cv_makeflags=$cf_option
 3485 				;;
 3486 			esac
 3487 			break
 3488 			;;
 3489 		(.-)	;;
 3490 		(*)	echo "given option \"$cf_option\", no match \"$cf_result\""
 3491 			;;
 3492 		esac
 3493 	done
 3494 	rm -f cf_makeflags.tmp
 3495 ])
 3496 
 3497 AC_SUBST(cf_cv_makeflags)
 3498 ])dnl
 3499 dnl ---------------------------------------------------------------------------
 3500 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
 3501 dnl ----------
 3502 dnl Write a debug message to config.log, along with the line number in the
 3503 dnl configure script.
 3504 AC_DEFUN([CF_MSG_LOG],[
 3505 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
 3506 ])dnl
 3507 dnl ---------------------------------------------------------------------------
 3508 dnl CF_NCURSES_BROKEN version: 8 updated: 2012/11/08 20:57:52
 3509 dnl -----------------
 3510 dnl Check for pre-1.9.9g ncurses (among other problems, the most obvious is
 3511 dnl that color combinations don't work).
 3512 AC_DEFUN([CF_NCURSES_BROKEN],
 3513 [
 3514 AC_REQUIRE([CF_NCURSES_VERSION])
 3515 if test "$cf_cv_ncurses_version" != no ; then
 3516 AC_MSG_CHECKING(for obsolete/broken version of ncurses)
 3517 AC_CACHE_VAL(cf_cv_ncurses_broken,[
 3518 AC_TRY_COMPILE([
 3519 #include <${cf_cv_ncurses_header:-curses.h}>],[
 3520 #if defined(NCURSES_VERSION) && defined(wgetbkgd)
 3521 	make an error
 3522 #else
 3523 	int x = 1
 3524 #endif
 3525 ],
 3526 	[cf_cv_ncurses_broken=no],
 3527 	[cf_cv_ncurses_broken=yes])
 3528 ])
 3529 AC_MSG_RESULT($cf_cv_ncurses_broken)
 3530 if test "$cf_cv_ncurses_broken" = yes ; then
 3531 	AC_MSG_WARN(hmm... you should get an up-to-date version of ncurses)
 3532 	AC_DEFINE(NCURSES_BROKEN,1,[Define to 1 if you have an obsolete version of ncurses])
 3533 fi
 3534 fi
 3535 ])dnl
 3536 dnl ---------------------------------------------------------------------------
 3537 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
 3538 dnl -------------------
 3539 dnl Check if we can compile with ncurses' header file
 3540 dnl $1 is the cache variable to set
 3541 dnl $2 is the header-file to include
 3542 dnl $3 is the root name (ncurses or ncursesw)
 3543 AC_DEFUN([CF_NCURSES_CC_CHECK],[
 3544 	AC_TRY_COMPILE([
 3545 ]ifelse($3,ncursesw,[
 3546 #define _XOPEN_SOURCE_EXTENDED
 3547 #undef  HAVE_LIBUTF8_H	/* in case we used CF_UTF8_LIB */
 3548 #define HAVE_LIBUTF8_H	/* to force ncurses' header file to use cchar_t */
 3549 ])[
 3550 #include <$2>],[
 3551 #ifdef NCURSES_VERSION
 3552 ]ifelse($3,ncursesw,[
 3553 #ifndef WACS_BSSB
 3554 	make an error
 3555 #endif
 3556 ])[
 3557 printf("%s\n", NCURSES_VERSION);
 3558 #else
 3559 #ifdef __NCURSES_H
 3560 printf("old\n");
 3561 #else
 3562 	make an error
 3563 #endif
 3564 #endif
 3565 	]
 3566 	,[$1=$2]
 3567 	,[$1=no])
 3568 ])dnl
 3569 dnl ---------------------------------------------------------------------------
 3570 dnl CF_NCURSES_CONFIG version: 18 updated: 2017/07/23 18:30:00
 3571 dnl -----------------
 3572 dnl Tie together the configure-script macros for ncurses, preferring these in
 3573 dnl order:
 3574 dnl a) ".pc" files for pkg-config, using $NCURSES_CONFIG_PKG
 3575 dnl b) the "-config" script from ncurses, using $NCURSES_CONFIG
 3576 dnl c) just plain libraries
 3577 dnl
 3578 dnl $1 is the root library name (default: "ncurses")
 3579 AC_DEFUN([CF_NCURSES_CONFIG],[
 3580 AC_REQUIRE([CF_PKG_CONFIG])
 3581 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
 3582 cf_have_ncuconfig=no
 3583 
 3584 if test "x${PKG_CONFIG:=none}" != xnone; then
 3585 	AC_MSG_CHECKING(pkg-config for $cf_ncuconfig_root)
 3586 	if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then
 3587 		AC_MSG_RESULT(yes)
 3588 
 3589 		AC_MSG_CHECKING(if the $cf_ncuconfig_root package files work)
 3590 		cf_have_ncuconfig=unknown
 3591 
 3592 		cf_save_CPPFLAGS="$CPPFLAGS"
 3593 		cf_save_LIBS="$LIBS"
 3594 
 3595 		CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags $cf_ncuconfig_root`"
 3596 		CF_ADD_LIBS(`$PKG_CONFIG --libs $cf_ncuconfig_root`)
 3597 
 3598 		AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 3599 			[initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
 3600 			[AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}>
 3601 				int main(void)
 3602 				{ char *xx = curses_version(); return (xx == 0); }],
 3603 				[cf_have_ncuconfig=yes],
 3604 				[cf_have_ncuconfig=no],
 3605 				[cf_have_ncuconfig=maybe])],
 3606 			[cf_have_ncuconfig=no])
 3607 		AC_MSG_RESULT($cf_have_ncuconfig)
 3608 		test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes
 3609 		if test "$cf_have_ncuconfig" != "yes"
 3610 		then
 3611 			CPPFLAGS="$cf_save_CPPFLAGS"
 3612 			LIBS="$cf_save_LIBS"
 3613 			NCURSES_CONFIG_PKG=none
 3614 		else
 3615 			AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 3616 			NCURSES_CONFIG_PKG=$cf_ncuconfig_root
 3617 		fi
 3618 		CF_TERM_HEADER
 3619 
 3620 	else
 3621 		AC_MSG_RESULT(no)
 3622 		NCURSES_CONFIG_PKG=none
 3623 	fi
 3624 else
 3625 	NCURSES_CONFIG_PKG=none
 3626 fi
 3627 
 3628 if test "x$cf_have_ncuconfig" = "xno"; then
 3629 	echo "Looking for ${cf_ncuconfig_root}-config"
 3630 
 3631 	CF_ACVERSION_CHECK(2.52,
 3632 		[AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)],
 3633 		[AC_PATH_PROGS(NCURSES_CONFIG,  ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)])
 3634 
 3635 	if test "$NCURSES_CONFIG" != none ; then
 3636 
 3637 		CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
 3638 		CF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
 3639 
 3640 		# even with config script, some packages use no-override for curses.h
 3641 		CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
 3642 
 3643 		dnl like CF_NCURSES_CPPFLAGS
 3644 		AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 3645 
 3646 		dnl like CF_NCURSES_LIBS
 3647 		CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
 3648 		AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
 3649 
 3650 		dnl like CF_NCURSES_VERSION
 3651 		cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
 3652 
 3653 	else
 3654 
 3655 		CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
 3656 		CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
 3657 
 3658 	fi
 3659 else
 3660 	NCURSES_CONFIG=none
 3661 fi
 3662 ])dnl
 3663 dnl ---------------------------------------------------------------------------
 3664 dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51
 3665 dnl -------------------
 3666 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
 3667 dnl the CPPFLAGS variable so we can include its header.
 3668 dnl
 3669 dnl The header files may be installed as either curses.h, or ncurses.h (would
 3670 dnl be obsolete, except that some packagers prefer this name to distinguish it
 3671 dnl from a "native" curses implementation).  If not installed for overwrite,
 3672 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
 3673 dnl /usr/include/ncurses), but someone may have installed overwriting the
 3674 dnl vendor's curses.  Only very old versions (pre-1.9.2d, the first autoconf'd
 3675 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
 3676 dnl the header.
 3677 dnl
 3678 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
 3679 dnl is already in the include-path, don't even bother with this, since we cannot
 3680 dnl easily determine which file it is.  In this case, it has to be <curses.h>.
 3681 dnl
 3682 dnl The optional parameter gives the root name of the library, in case it is
 3683 dnl not installed as the default curses library.  That is how the
 3684 dnl wide-character version of ncurses is installed.
 3685 AC_DEFUN([CF_NCURSES_CPPFLAGS],
 3686 [AC_REQUIRE([CF_WITH_CURSES_DIR])
 3687 
 3688 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
 3689 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
 3690 
 3691 test -n "$cf_cv_curses_dir" && \
 3692 test "$cf_cv_curses_dir" != "no" && { \
 3693   CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root)
 3694 }
 3695 
 3696 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
 3697 	cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
 3698 	( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
 3699 	for cf_header in $cf_header_list
 3700 	do
 3701 		CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
 3702 		test "$cf_cv_ncurses_h" != no && break
 3703 	done
 3704 ])
 3705 
 3706 CF_NCURSES_HEADER
 3707 CF_TERM_HEADER
 3708 
 3709 # some applications need this, but should check for NCURSES_VERSION
 3710 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 3711 
 3712 CF_NCURSES_VERSION
 3713 ])dnl
 3714 dnl ---------------------------------------------------------------------------
 3715 dnl CF_NCURSES_HEADER version: 4 updated: 2015/04/15 19:08:48
 3716 dnl -----------------
 3717 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
 3718 dnl variations of ncurses' installs.
 3719 dnl
 3720 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
 3721 AC_DEFUN([CF_NCURSES_HEADER],[
 3722 
 3723 if test "$cf_cv_ncurses_h" != no ; then
 3724 	cf_cv_ncurses_header=$cf_cv_ncurses_h
 3725 else
 3726 
 3727 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
 3728 	test -n "$verbose" && echo
 3729 	CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
 3730 	test -n "$verbose" && echo search path $cf_search
 3731 	cf_save2_CPPFLAGS="$CPPFLAGS"
 3732 	for cf_incdir in $cf_search
 3733 	do
 3734 		CF_ADD_INCDIR($cf_incdir)
 3735 		for cf_header in \
 3736 			ncurses.h \
 3737 			curses.h
 3738 		do
 3739 			CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
 3740 			if test "$cf_cv_ncurses_h2" != no ; then
 3741 				cf_cv_ncurses_h2=$cf_incdir/$cf_header
 3742 				test -n "$verbose" && echo $ac_n "	... found $ac_c" 1>&AC_FD_MSG
 3743 				break
 3744 			fi
 3745 			test -n "$verbose" && echo "	... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
 3746 		done
 3747 		CPPFLAGS="$cf_save2_CPPFLAGS"
 3748 		test "$cf_cv_ncurses_h2" != no && break
 3749 	done
 3750 	test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
 3751 	])
 3752 
 3753 	CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
 3754 	cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
 3755 	if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
 3756 		cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
 3757 	fi
 3758 	CF_ADD_INCDIR($cf_1st_incdir)
 3759 
 3760 fi
 3761 
 3762 # Set definitions to allow ifdef'ing for ncurses.h
 3763 
 3764 case $cf_cv_ncurses_header in
 3765 (*ncurses.h)
 3766 	AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h])
 3767 	;;
 3768 esac
 3769 
 3770 case $cf_cv_ncurses_header in
 3771 (ncurses/curses.h|ncurses/ncurses.h)
 3772 	AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h])
 3773 	;;
 3774 (ncursesw/curses.h|ncursesw/ncurses.h)
 3775 	AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h])
 3776 	;;
 3777 esac
 3778 
 3779 ])dnl
 3780 dnl ---------------------------------------------------------------------------
 3781 dnl CF_NCURSES_LIBS version: 17 updated: 2015/04/15 19:08:48
 3782 dnl ---------------
 3783 dnl Look for the ncurses library.  This is a little complicated on Linux,
 3784 dnl because it may be linked with the gpm (general purpose mouse) library.
 3785 dnl Some distributions have gpm linked with (bsd) curses, which makes it
 3786 dnl unusable with ncurses.  However, we don't want to link with gpm unless
 3787 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
 3788 dnl and the linker will record a dependency.
 3789 dnl
 3790 dnl The optional parameter gives the root name of the library, in case it is
 3791 dnl not installed as the default curses library.  That is how the
 3792 dnl wide-character version of ncurses is installed.
 3793 AC_DEFUN([CF_NCURSES_LIBS],
 3794 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
 3795 
 3796 cf_nculib_root=ifelse($1,,ncurses,$1)
 3797 	# This works, except for the special case where we find gpm, but
 3798 	# ncurses is in a nonstandard location via $LIBS, and we really want
 3799 	# to link gpm.
 3800 cf_ncurses_LIBS=""
 3801 cf_ncurses_SAVE="$LIBS"
 3802 AC_CHECK_LIB(gpm,Gpm_Open,
 3803 	[AC_CHECK_LIB(gpm,initscr,
 3804 		[LIBS="$cf_ncurses_SAVE"],
 3805 		[cf_ncurses_LIBS="-lgpm"])])
 3806 
 3807 case $host_os in
 3808 (freebsd*)
 3809 	# This is only necessary if you are linking against an obsolete
 3810 	# version of ncurses (but it should do no harm, since it's static).
 3811 	if test "$cf_nculib_root" = ncurses ; then
 3812 		AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
 3813 	fi
 3814 	;;
 3815 esac
 3816 
 3817 CF_ADD_LIBS($cf_ncurses_LIBS)
 3818 
 3819 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
 3820 then
 3821 	CF_ADD_LIBS(-l$cf_nculib_root)
 3822 else
 3823 	CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
 3824 		[#include <${cf_cv_ncurses_header:-curses.h}>],
 3825 		[initscr()],
 3826 		initscr)
 3827 fi
 3828 
 3829 if test -n "$cf_ncurses_LIBS" ; then
 3830 	AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
 3831 	cf_ncurses_SAVE="$LIBS"
 3832 	for p in $cf_ncurses_LIBS ; do
 3833 		q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
 3834 		if test "$q" != "$LIBS" ; then
 3835 			LIBS="$q"
 3836 		fi
 3837 	done
 3838 	AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
 3839 		[initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
 3840 		[AC_MSG_RESULT(yes)],
 3841 		[AC_MSG_RESULT(no)
 3842 		 LIBS="$cf_ncurses_SAVE"])
 3843 fi
 3844 
 3845 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
 3846 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
 3847 ])dnl
 3848 dnl ---------------------------------------------------------------------------
 3849 dnl CF_NCURSES_VERSION version: 15 updated: 2017/05/09 19:26:10
 3850 dnl ------------------
 3851 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
 3852 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS.  We don't use
 3853 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
 3854 AC_DEFUN([CF_NCURSES_VERSION],
 3855 [
 3856 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
 3857 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
 3858 	cf_cv_ncurses_version=no
 3859 	cf_tempfile=out$$
 3860 	rm -f $cf_tempfile
 3861 	AC_TRY_RUN([
 3862 #include <${cf_cv_ncurses_header:-curses.h}>
 3863 #include <stdio.h>
 3864 int main(void)
 3865 {
 3866 	FILE *fp = fopen("$cf_tempfile", "w");
 3867 #ifdef NCURSES_VERSION
 3868 # ifdef NCURSES_VERSION_PATCH
 3869 	fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
 3870 # else
 3871 	fprintf(fp, "%s\n", NCURSES_VERSION);
 3872 # endif
 3873 #else
 3874 # ifdef __NCURSES_H
 3875 	fprintf(fp, "old\n");
 3876 # else
 3877 	make an error
 3878 # endif
 3879 #endif
 3880 	${cf_cv_main_return:-return}(0);
 3881 }],[
 3882 	cf_cv_ncurses_version=`cat $cf_tempfile`],,[
 3883 
 3884 	# This will not work if the preprocessor splits the line after the
 3885 	# Autoconf token.  The 'unproto' program does that.
 3886 	cat > conftest.$ac_ext <<EOF
 3887 #include <${cf_cv_ncurses_header:-curses.h}>
 3888 #undef Autoconf
 3889 #ifdef NCURSES_VERSION
 3890 Autoconf NCURSES_VERSION
 3891 #else
 3892 #ifdef __NCURSES_H
 3893 Autoconf "old"
 3894 #endif
 3895 ;
 3896 #endif
 3897 EOF
 3898 	cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
 3899 	AC_TRY_EVAL(cf_try)
 3900 	if test -f conftest.out ; then
 3901 		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
 3902 		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
 3903 		rm -f conftest.out
 3904 	fi
 3905 ])
 3906 	rm -f $cf_tempfile
 3907 ])
 3908 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 3909 ])dnl
 3910 dnl ---------------------------------------------------------------------------
 3911 dnl CF_NETLIBS version: 11 updated: 2015/04/15 19:08:48
 3912 dnl ----------
 3913 dnl After checking for functions in the default $LIBS, make a further check
 3914 dnl for the functions that are netlib-related (these aren't always in the
 3915 dnl libc, etc., and have to be handled specially because there are conflicting
 3916 dnl and broken implementations.
 3917 dnl Common library requirements (in order):
 3918 dnl	-lresolv -lsocket -lnsl
 3919 dnl	-lnsl -lsocket
 3920 dnl	-lsocket
 3921 dnl	-lbsd
 3922 dnl	-lnetwork
 3923 AC_DEFUN([CF_NETLIBS],[
 3924 cf_test_netlibs=no
 3925 
 3926 AC_MSG_CHECKING(for network libraries)
 3927 
 3928 AC_CACHE_VAL(cf_cv_netlibs,[
 3929 AC_MSG_RESULT(working...)
 3930 
 3931 cf_cv_netlibs=""
 3932 cf_test_netlibs=yes
 3933 
 3934 case $host_os in
 3935 (mingw*)
 3936 	AC_CHECK_HEADERS( windows.h winsock.h winsock2.h )
 3937 
 3938 	if test "$ac_cv_header_winsock2_h" = "yes" ; then
 3939 		cf_winsock_lib="-lws2_32"
 3940 	elif test "$ac_cv_header_winsock_h" = "yes" ; then
 3941 		cf_winsock_lib="-lwsock32"
 3942 	fi
 3943 
 3944 	cf_save_LIBS="$LIBS"
 3945 	CF_ADD_LIBS($cf_winsock_lib)
 3946 
 3947 	AC_TRY_LINK([
 3948 #ifdef HAVE_WINDOWS_H
 3949 #undef WIN32_LEAN_AND_MEAN
 3950 #define WIN32_LEAN_AND_MEAN
 3951 #include <windows.h>
 3952 #ifdef HAVE_WINSOCK2_H
 3953 #include <winsock2.h>
 3954 #else
 3955 #ifdef HAVE_WINSOCK_H
 3956 #include <winsock.h>
 3957 #endif
 3958 #endif
 3959 #endif
 3960 ],[
 3961 	char buffer[1024];
 3962 	gethostname(buffer, sizeof(buffer));],
 3963 	[cf_cv_netlibs="$cf_winsock_lib $cf_cv_netlibs"],
 3964 	[AC_MSG_ERROR(Cannot link against winsock library)])
 3965 
 3966 	LIBS="$cf_save_LIBS"
 3967 	;;
 3968 (*)
 3969 	AC_CHECK_FUNCS(gethostname,,[
 3970 		CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
 3971 			CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
 3972 
 3973 	AC_CHECK_LIB(inet, main, cf_cv_netlibs="-linet $cf_cv_netlibs")
 3974 
 3975 	if test "$ac_cv_func_lsocket" != no ; then
 3976 	AC_CHECK_FUNCS(socket,,[
 3977 		CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
 3978 			CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
 3979 	fi
 3980 
 3981 	AC_CHECK_FUNCS(gethostbyname,,[
 3982 		CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
 3983 
 3984 	AC_CHECK_FUNCS(inet_ntoa,,[
 3985 		CF_RECHECK_FUNC(inet_ntoa,nsl,cf_cv_netlibs)])
 3986 
 3987 	AC_CHECK_FUNCS(gethostbyname,,[
 3988 		CF_RECHECK_FUNC(gethostbyname,network,cf_cv_netlibs)])
 3989 
 3990 	AC_CHECK_FUNCS(strcasecmp,,[
 3991 		CF_RECHECK_FUNC(strcasecmp,resolv,cf_cv_netlibs)])
 3992 	;;
 3993 esac
 3994 ])
 3995 
 3996 case $cf_cv_netlibs in
 3997 (*ws2_32*)
 3998 	AC_DEFINE(USE_WINSOCK2_H,1,[Define to 1 if we should include winsock2.h])
 3999 	;;
 4000 esac
 4001 
 4002 CF_ADD_LIBS($cf_cv_netlibs)
 4003 test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG
 4004 ])dnl
 4005 dnl ---------------------------------------------------------------------------
 4006 dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00
 4007 dnl ------------------
 4008 dnl see CF_WITH_NO_LEAKS
 4009 AC_DEFUN([CF_NO_LEAKS_OPTION],[
 4010 AC_MSG_CHECKING(if you want to use $1 for testing)
 4011 AC_ARG_WITH($1,
 4012 	[$2],
 4013 	[AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
 4014 	 $4
 4015 ])
 4016 	: ${with_cflags:=-g}
 4017 	: ${with_no_leaks:=yes}
 4018 	 with_$1=yes],
 4019 	[with_$1=])
 4020 AC_MSG_RESULT(${with_$1:-no})
 4021 
 4022 case .$with_cflags in
 4023 (.*-g*)
 4024 	case .$CFLAGS in
 4025 	(.*-g*)
 4026 		;;
 4027 	(*)
 4028 		CF_ADD_CFLAGS([-g])
 4029 		;;
 4030 	esac
 4031 	;;
 4032 esac
 4033 ])dnl
 4034 dnl ---------------------------------------------------------------------------
 4035 dnl CF_OUR_MESSAGES version: 7 updated: 2004/09/12 19:45:55
 4036 dnl ---------------
 4037 dnl Check if we use the messages included with this program
 4038 dnl
 4039 dnl $1 specifies either Makefile or makefile, defaulting to the former.
 4040 dnl
 4041 dnl Sets variables which can be used to substitute in makefiles:
 4042 dnl	MSG_DIR_MAKE - to make ./po directory
 4043 dnl	SUB_MAKEFILE - makefile in ./po directory (see CF_BUNDLED_INTL)
 4044 dnl
 4045 AC_DEFUN([CF_OUR_MESSAGES],
 4046 [
 4047 cf_makefile=ifelse($1,,Makefile,$1)
 4048 
 4049 use_our_messages=no
 4050 if test "$USE_NLS" = yes ; then
 4051 if test -d $srcdir/po ; then
 4052 AC_MSG_CHECKING(if we should use included message-library)
 4053 	AC_ARG_ENABLE(included-msgs,
 4054 	[  --disable-included-msgs use included messages, for i18n support],
 4055 	[use_our_messages=$enableval],
 4056 	[use_our_messages=yes])
 4057 fi
 4058 AC_MSG_RESULT($use_our_messages)
 4059 fi
 4060 
 4061 MSG_DIR_MAKE="#"
 4062 if test "$use_our_messages" = yes
 4063 then
 4064 	SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn"
 4065 	MSG_DIR_MAKE=
 4066 fi
 4067 
 4068 AC_SUBST(MSG_DIR_MAKE)
 4069 AC_SUBST(SUB_MAKEFILE)
 4070 ])dnl
 4071 dnl ---------------------------------------------------------------------------
 4072 dnl CF_PATHSEP version: 7 updated: 2015/04/12 15:39:00
 4073 dnl ----------
 4074 dnl Provide a value for the $PATH and similar separator (or amend the value
 4075 dnl as provided in autoconf 2.5x).
 4076 AC_DEFUN([CF_PATHSEP],
 4077 [
 4078 	AC_MSG_CHECKING(for PATH separator)
 4079 	case $cf_cv_system_name in
 4080 	(os2*)	PATH_SEPARATOR=';'  ;;
 4081 	(*)	${PATH_SEPARATOR:=':'}  ;;
 4082 	esac
 4083 ifelse([$1],,,[$1=$PATH_SEPARATOR])
 4084 	AC_SUBST(PATH_SEPARATOR)
 4085 	AC_MSG_RESULT($PATH_SEPARATOR)
 4086 ])dnl
 4087 dnl ---------------------------------------------------------------------------
 4088 dnl CF_PATH_EDITOR version: 5 updated: 2000/07/20 00:41:18
 4089 dnl --------------
 4090 dnl Look for the default editor (vi)
 4091 AC_DEFUN([CF_PATH_EDITOR],
 4092 [
 4093 AC_MSG_CHECKING(for default editor)
 4094 CF_ARG_WITH(editor,
 4095     [  --with-editor=PROG      specify editor],
 4096     [DEFAULT_EDITOR],,vi)
 4097 if test -z "$DEFAULT_EDITOR" ; then
 4098     if test -n "$EDITOR" ; then
 4099     	DEFAULT_EDITOR="$EDITOR"
 4100     elif test -n "$VISUAL" ; then
 4101     	DEFAULT_EDITOR="$VISUAL"
 4102     else
 4103 	AC_PATH_PROG(DEFAULT_EDITOR,vi,vi,$PATH:/usr/bin:/usr/ucb)
 4104     fi
 4105 fi
 4106 AC_MSG_RESULT($DEFAULT_EDITOR)
 4107 AC_DEFINE_UNQUOTED(DEFAULT_EDITOR,"$DEFAULT_EDITOR")
 4108 ])dnl
 4109 dnl ---------------------------------------------------------------------------
 4110 dnl CF_PATH_MAILBOX version: 4 updated: 1998/04/01 11:39:13
 4111 dnl ---------------
 4112 dnl Look for the directory that contains incoming mail.  I would check for an
 4113 dnl actual mail-file, to verify this, but that is not always easy to arrange.
 4114 AC_DEFUN([CF_PATH_MAILBOX],
 4115 [
 4116 AC_MSG_CHECKING(for incoming-mail directory)
 4117 CF_ARG_WITH(mailbox,
 4118     [  --with-mailbox=DIR      directory for incoming mailboxes],
 4119     [DEFAULT_MAILBOX])
 4120 if test -z "$DEFAULT_MAILBOX" ; then
 4121 for cf_dir in \
 4122 	/var/spool/mail \
 4123 	/usr/spool/mail \
 4124 	/var/mail \
 4125 	/usr/mail \
 4126 	/mail
 4127     do
 4128     	if test -d $cf_dir ; then
 4129 	    DEFAULT_MAILBOX=$cf_dir
 4130 	    break
 4131 	fi
 4132     done
 4133 fi
 4134 if test -n "$DEFAULT_MAILBOX" ; then
 4135 	AC_DEFINE_UNQUOTED(DEFAULT_MAILBOX,"$DEFAULT_MAILBOX")
 4136 else
 4137 	DEFAULT_MAILBOX=none
 4138 fi
 4139 AC_MSG_RESULT($DEFAULT_MAILBOX)
 4140 ])dnl
 4141 dnl ---------------------------------------------------------------------------
 4142 dnl CF_PATH_MAILER version: 6 updated: 2001/05/27 21:36:02
 4143 dnl --------------
 4144 dnl Look for the program that sends outgoing mail.
 4145 AC_DEFUN([CF_PATH_MAILER],
 4146 [
 4147 AC_PATH_PROG(DEFAULT_MAILER,sendmail,,$PATH:/usr/sbin:/usr/lib)
 4148 CF_ARG_WITH(mailer,
 4149      [  --with-mailer=PROG      specify default mailer-program],
 4150      [DEFAULT_MAILER],,mailx)
 4151 if test -z "$DEFAULT_MAILER" ; then
 4152 AC_PATH_PROG(DEFAULT_MAILER,mailx,,$PATH:/usr/bin)
 4153 fi
 4154 if test -z "$DEFAULT_MAILER" ; then
 4155 AC_PATH_PROG(DEFAULT_MAILER,mail,,$PATH:/usr/bin)
 4156 fi
 4157 AC_MSG_CHECKING(for default mailer)
 4158 if test -n "$DEFAULT_MAILER" ; then
 4159 	CF_FIX_SLASHES(ac_cv_path_DEFAULT_MAILER)
 4160 	CF_FIX_SLASHES(DEFAULT_MAILER)
 4161 	AC_DEFINE_UNQUOTED(DEFAULT_MAILER,"$DEFAULT_MAILER")
 4162 else
 4163 	DEFAULT_MAILER=none
 4164 fi
 4165 AC_MSG_RESULT($DEFAULT_MAILER)
 4166 ])dnl
 4167 dnl ---------------------------------------------------------------------------
 4168 dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57
 4169 dnl --------------
 4170 dnl Check the argument to see that it looks like a pathname.  Rewrite it if it
 4171 dnl begins with one of the prefix/exec_prefix variables, and then again if the
 4172 dnl result begins with 'NONE'.  This is necessary to work around autoconf's
 4173 dnl delayed evaluation of those symbols.
 4174 AC_DEFUN([CF_PATH_SYNTAX],[
 4175 if test "x$prefix" != xNONE; then
 4176 	cf_path_syntax="$prefix"
 4177 else
 4178 	cf_path_syntax="$ac_default_prefix"
 4179 fi
 4180 
 4181 case ".[$]$1" in
 4182 (.\[$]\(*\)*|.\'*\'*)
 4183 	;;
 4184 (..|./*|.\\*)
 4185 	;;
 4186 (.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX
 4187 	;;
 4188 (.\[$]{*prefix}*|.\[$]{*dir}*)
 4189 	eval $1="[$]$1"
 4190 	case ".[$]$1" in
 4191 	(.NONE/*)
 4192 		$1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
 4193 		;;
 4194 	esac
 4195 	;;
 4196 (.no|.NONE/*)
 4197 	$1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
 4198 	;;
 4199 (*)
 4200 	ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
 4201 	;;
 4202 esac
 4203 ])dnl
 4204 dnl ---------------------------------------------------------------------------
 4205 dnl CF_PDCURSES_X11 version: 13 updated: 2012/10/06 16:39:58
 4206 dnl ---------------
 4207 dnl Configure for PDCurses' X11 library
 4208 AC_DEFUN([CF_PDCURSES_X11],[
 4209 AC_REQUIRE([CF_X_ATHENA])
 4210 
 4211 CF_ACVERSION_CHECK(2.52,
 4212 	[AC_CHECK_TOOLS(XCURSES_CONFIG, xcurses-config, none)],
 4213 	[AC_PATH_PROGS(XCURSES_CONFIG, xcurses-config, none)])
 4214 
 4215 if test "$XCURSES_CONFIG" != none ; then
 4216 
 4217 CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`"
 4218 CF_ADD_LIBS(`$XCURSES_CONFIG --libs`)
 4219 
 4220 cf_cv_lib_XCurses=yes
 4221 
 4222 else
 4223 
 4224 LDFLAGS="$LDFLAGS $X_LIBS"
 4225 CF_CHECK_CFLAGS($X_CFLAGS)
 4226 AC_CHECK_LIB(X11,XOpenDisplay,
 4227 	[CF_ADD_LIBS(-lX11)],,
 4228 	[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
 4229 AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
 4230 CF_ADD_LIBS(-lXCurses)
 4231 AC_TRY_LINK([
 4232 #include <xcurses.h>
 4233 char *XCursesProgramName = "test";
 4234 ],[XCursesExit();],
 4235 [cf_cv_lib_XCurses=yes],
 4236 [cf_cv_lib_XCurses=no])
 4237 ])
 4238 
 4239 fi
 4240 
 4241 if test $cf_cv_lib_XCurses = yes ; then
 4242 	AC_DEFINE(UNIX,1,[Define to 1 if using PDCurses on Unix])
 4243 	AC_DEFINE(XCURSES,1,[Define to 1 if using PDCurses on Unix])
 4244 	AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES,1,[Define to 1 if using PDCurses on Unix]))
 4245 else
 4246 	AC_MSG_ERROR(Cannot link with XCurses)
 4247 fi
 4248 ])dnl
 4249 dnl ---------------------------------------------------------------------------
 4250 dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58
 4251 dnl -------------
 4252 dnl Check for the package-config program, unless disabled by command-line.
 4253 AC_DEFUN([CF_PKG_CONFIG],
 4254 [
 4255 AC_MSG_CHECKING(if you want to use pkg-config)
 4256 AC_ARG_WITH(pkg-config,
 4257 	[  --with-pkg-config{=path} enable/disable use of pkg-config],
 4258 	[cf_pkg_config=$withval],
 4259 	[cf_pkg_config=yes])
 4260 AC_MSG_RESULT($cf_pkg_config)
 4261 
 4262 case $cf_pkg_config in
 4263 (no)
 4264 	PKG_CONFIG=none
 4265 	;;
 4266 (yes)
 4267 	CF_ACVERSION_CHECK(2.52,
 4268 		[AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
 4269 		[AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
 4270 	;;
 4271 (*)
 4272 	PKG_CONFIG=$withval
 4273 	;;
 4274 esac
 4275 
 4276 test -z "$PKG_CONFIG" && PKG_CONFIG=none
 4277 if test "$PKG_CONFIG" != none ; then
 4278 	CF_PATH_SYNTAX(PKG_CONFIG)
 4279 elif test "x$cf_pkg_config" != xno ; then
 4280 	AC_MSG_WARN(pkg-config is not installed)
 4281 fi
 4282 
 4283 AC_SUBST(PKG_CONFIG)
 4284 ])dnl
 4285 dnl ---------------------------------------------------------------------------
 4286 dnl CF_POSIX_C_SOURCE version: 9 updated: 2015/04/12 15:39:00
 4287 dnl -----------------
 4288 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
 4289 dnl
 4290 dnl	POSIX.1-1990				_POSIX_SOURCE
 4291 dnl	POSIX.1-1990 and			_POSIX_SOURCE and
 4292 dnl		POSIX.2-1992 C-Language			_POSIX_C_SOURCE=2
 4293 dnl		Bindings Option
 4294 dnl	POSIX.1b-1993				_POSIX_C_SOURCE=199309L
 4295 dnl	POSIX.1c-1996				_POSIX_C_SOURCE=199506L
 4296 dnl	X/Open 2000				_POSIX_C_SOURCE=200112L
 4297 dnl
 4298 dnl Parameters:
 4299 dnl	$1 is the nominal value for _POSIX_C_SOURCE
 4300 AC_DEFUN([CF_POSIX_C_SOURCE],
 4301 [
 4302 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
 4303 
 4304 cf_save_CFLAGS="$CFLAGS"
 4305 cf_save_CPPFLAGS="$CPPFLAGS"
 4306 
 4307 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
 4308 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
 4309 
 4310 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
 4311 	CF_MSG_LOG(if the symbol is already defined go no further)
 4312 	AC_TRY_COMPILE([#include <sys/types.h>],[
 4313 #ifndef _POSIX_C_SOURCE
 4314 make an error
 4315 #endif],
 4316 	[cf_cv_posix_c_source=no],
 4317 	[cf_want_posix_source=no
 4318 	 case .$cf_POSIX_C_SOURCE in
 4319 	 (.[[12]]??*)
 4320 		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
 4321 		;;
 4322 	 (.2)
 4323 		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
 4324 		cf_want_posix_source=yes
 4325 		;;
 4326 	 (.*)
 4327 		cf_want_posix_source=yes
 4328 		;;
 4329 	 esac
 4330 	 if test "$cf_want_posix_source" = yes ; then
 4331 		AC_TRY_COMPILE([#include <sys/types.h>],[
 4332 #ifdef _POSIX_SOURCE
 4333 make an error
 4334 #endif],[],
 4335 		cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
 4336 	 fi
 4337 	 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
 4338 	 CFLAGS="$cf_trim_CFLAGS"
 4339 	 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
 4340 	 CF_MSG_LOG(if the second compile does not leave our definition intact error)
 4341 	 AC_TRY_COMPILE([#include <sys/types.h>],[
 4342 #ifndef _POSIX_C_SOURCE
 4343 make an error
 4344 #endif],,
 4345 	 [cf_cv_posix_c_source=no])
 4346 	 CFLAGS="$cf_save_CFLAGS"
 4347 	 CPPFLAGS="$cf_save_CPPFLAGS"
 4348 	])
 4349 ])
 4350 
 4351 if test "$cf_cv_posix_c_source" != no ; then
 4352 	CFLAGS="$cf_trim_CFLAGS"
 4353 	CPPFLAGS="$cf_trim_CPPFLAGS"
 4354 	CF_ADD_CFLAGS($cf_cv_posix_c_source)
 4355 fi
 4356 
 4357 ])dnl
 4358 dnl ---------------------------------------------------------------------------
 4359 dnl CF_POSIX_JC version: 3 updated: 2001/05/27 21:36:02
 4360 dnl -----------
 4361 dnl Check if we have POSIX-style job control (i.e., sigaction), or if we must
 4362 dnl use the signal functions.  Use AC_CHECK_FUNCS(sigaction) first.
 4363 AC_DEFUN([CF_POSIX_JC],[
 4364 
 4365 AC_REQUIRE([AC_TYPE_SIGNAL])
 4366 AC_REQUIRE([CF_SIG_ARGS])
 4367 
 4368 if test "$ac_cv_func_sigaction" = yes; then
 4369 
 4370 AC_CACHE_CHECK(whether sigaction needs _POSIX_SOURCE,cf_cv_sigact_bad,[
 4371 AC_TRY_COMPILE([
 4372 #include <sys/types.h>
 4373 #include <signal.h>],[struct sigaction act],
 4374   [cf_cv_sigact_bad=no],[cf_cv_sigact_bad=yes])
 4375 ])
 4376 
 4377 test "$cf_cv_sigact_bad" = yes && AC_DEFINE(SVR4_ACTION)
 4378 
 4379 AC_CACHE_CHECK(if we have sigaction/related functions,cf_cv_sigaction_funcs,[
 4380 AC_TRY_LINK([
 4381 #ifdef SVR4_ACTION
 4382 #define _POSIX_SOURCE
 4383 #endif
 4384 #include <sys/types.h>
 4385 #include <signal.h>],[
 4386     RETSIGTYPE (*func)(SIG_ARGS) = SIG_IGN;
 4387     struct sigaction sa, osa;
 4388     sa.sa_handler = func;
 4389     sa.sa_flags = 0;
 4390     sigemptyset (&sa.sa_mask);
 4391     sigaction (SIGBUS,&sa,&osa);],
 4392     [cf_cv_sigaction_funcs=yes],
 4393     [cf_cv_sigaction_funcs=no])])
 4394 
 4395 test "$cf_cv_sigaction_funcs" = yes && AC_DEFINE(HAVE_POSIX_JC)
 4396 
 4397 fi
 4398 ])dnl
 4399 dnl ---------------------------------------------------------------------------
 4400 dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22
 4401 dnl ----------
 4402 dnl Check for archiver "ar".
 4403 AC_DEFUN([CF_PROG_AR],[
 4404 AC_CHECK_TOOL(AR, ar, ar)
 4405 ])
 4406 dnl ---------------------------------------------------------------------------
 4407 dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58
 4408 dnl ----------
 4409 dnl standard check for CC, plus followup sanity checks
 4410 dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
 4411 AC_DEFUN([CF_PROG_CC],[
 4412 ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
 4413 CF_GCC_VERSION
 4414 CF_ACVERSION_CHECK(2.52,
 4415 	[AC_PROG_CC_STDC],
 4416 	[CF_ANSI_CC_REQD])
 4417 CF_CC_ENV_FLAGS
 4418 ])dnl
 4419 dnl ---------------------------------------------------------------------------
 4420 dnl CF_PROG_EXT version: 13 updated: 2015/04/18 09:03:58
 4421 dnl -----------
 4422 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
 4423 AC_DEFUN([CF_PROG_EXT],
 4424 [
 4425 AC_REQUIRE([CF_CHECK_CACHE])
 4426 case $cf_cv_system_name in
 4427 (os2*)
 4428 	CFLAGS="$CFLAGS -Zmt"
 4429 	CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
 4430 	CXXFLAGS="$CXXFLAGS -Zmt"
 4431 	# autoconf's macro sets -Zexe and suffix both, which conflict:w
 4432 	LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
 4433 	ac_cv_exeext=.exe
 4434 	;;
 4435 esac
 4436 
 4437 AC_EXEEXT
 4438 AC_OBJEXT
 4439 
 4440 PROG_EXT="$EXEEXT"
 4441 AC_SUBST(PROG_EXT)
 4442 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
 4443 ])dnl
 4444 dnl ---------------------------------------------------------------------------
 4445 dnl CF_PROG_SUM_R version: 2 updated: 1997/08/28 23:57:55
 4446 dnl -------------
 4447 dnl See if sum can take -r
 4448 AC_DEFUN([CF_PROG_SUM_R],
 4449 [
 4450 if test $ac_cv_path_PATH_SUM
 4451 then
 4452 AC_MSG_CHECKING([if $ac_cv_path_PATH_SUM takes -r])
 4453 AC_CACHE_VAL(ac_cv_prog_sum_r,[
 4454 if AC_TRY_COMMAND($ac_cv_path_PATH_SUM -r config.log 1>&AC_FD_CC)
 4455 then
 4456 	ac_cv_prog_sum_r=yes
 4457 else
 4458 	ac_cv_prog_sum_r=no
 4459 fi
 4460 ])
 4461 if test $ac_cv_prog_sum_r = yes; then
 4462 	AC_DEFINE(SUM_TAKES_DASH_R)
 4463 	AC_DEFINE_UNQUOTED(PATH_SUM_R, "$ac_cv_path_PATH_SUM -r")
 4464 else
 4465 	AC_DEFINE_UNQUOTED(PATH_SUM_R, "$ac_cv_path_PATH_SUM")
 4466 fi
 4467 AC_MSG_RESULT($ac_cv_prog_sum_r)
 4468 fi
 4469 ])dnl
 4470 dnl ---------------------------------------------------------------------------
 4471 dnl CF_PROG_YACC version: 2 updated: 1997/12/16 11:20:41
 4472 dnl ------------
 4473 dnl A better version of AC_PROC_YACC, verifies that we'll only choose bison if
 4474 dnl we'll be able to compile with it.  Bison uses alloca, which isn't all that
 4475 dnl portable.
 4476 AC_DEFUN([CF_PROG_YACC],
 4477 [
 4478 AC_REQUIRE([AC_PROG_CC])
 4479 AC_CACHE_VAL(cf_cv_prog_YACC,[
 4480 if test -n "$YACC" ; then
 4481   cf_cv_prog_YACC="$YACC" # Let the user override the test.
 4482 else
 4483 cat >conftest.y <<EOF
 4484 %{
 4485 void yyerror(s) char *s; { }
 4486 %}
 4487 %token	NUMBER
 4488 %%
 4489 time	: NUMBER ':' NUMBER
 4490 	;
 4491 %%
 4492 int yylex() { return NUMBER; }
 4493 int main() { return yyparse(); }
 4494 EOF
 4495   for cf_prog in 'bison -y' byacc yacc
 4496   do
 4497     rm -f y.tab.[ch]
 4498     AC_MSG_CHECKING(for $cf_prog)
 4499     cf_command="$cf_prog conftest.y"
 4500     cf_result=no
 4501     if AC_TRY_EVAL(cf_command) && test -s y.tab.c ; then
 4502       mv y.tab.c conftest.c
 4503       rm -f y.tab.h
 4504       if test "$cf_prog" = 'bison -y' ; then
 4505         if AC_TRY_EVAL(ac_link) && test -s conftest ; then
 4506           cf_result=yes
 4507         fi
 4508       else
 4509         cf_result=yes
 4510       fi
 4511     fi
 4512     AC_MSG_RESULT($cf_result)
 4513     if test $cf_result = yes ; then
 4514       cf_cv_prog_YACC="$cf_prog"
 4515       break
 4516     fi
 4517   done
 4518 fi
 4519 ])
 4520 YACC="$cf_cv_prog_YACC"
 4521 AC_SUBST(YACC)dnl
 4522 ])dnl
 4523 dnl ---------------------------------------------------------------------------
 4524 dnl CF_PW_GECOS version: 2 updated: 2000/04/13 10:13:00
 4525 dnl -----------
 4526 dnl Check if the passwd-struct defines the '.pw_gecos' member (useful
 4527 dnl in decoding user names).
 4528 AC_DEFUN([CF_PW_GECOS],
 4529 [
 4530 AC_CACHE_CHECK([for passwd.pw_gecos], cf_cv_pw_gecos,[
 4531 	AC_TRY_COMPILE([
 4532 #include <pwd.h>
 4533 ],[
 4534 	struct passwd foo;
 4535 	char bar = foo.pw_gecos],
 4536 	[cf_cv_pw_gecos=yes],
 4537 	[cf_cv_pw_gecos=no])])
 4538 test $cf_cv_pw_gecos = no && AC_DEFINE(DONT_HAVE_PW_GECOS)
 4539 ])dnl
 4540 dnl ---------------------------------------------------------------------------
 4541 dnl CF_RECHECK_FUNC version: 3 updated: 2000/10/18 19:29:13
 4542 dnl ---------------
 4543 dnl Re-check on a function to see if we can pick it up by adding a library.
 4544 dnl	$1 = function to check
 4545 dnl	$2 = library to check in
 4546 dnl	$3 = environment to update (e.g., $LIBS)
 4547 dnl	$4 = what to do if this fails
 4548 dnl
 4549 dnl This uses 'unset' if the shell happens to support it, but leaves the
 4550 dnl configuration variable set to 'unknown' if not.  This is a little better
 4551 dnl than the normal autoconf test, which gives misleading results if a test
 4552 dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is
 4553 dnl used (autoconf does not distinguish between a null token and one that is
 4554 dnl set to 'no').
 4555 AC_DEFUN([CF_RECHECK_FUNC],[
 4556 AC_CHECK_LIB($2,$1,[
 4557 	CF_UPPER(cf_tr_func,$1)
 4558 	AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func)
 4559 	ac_cv_func_$1=yes
 4560 	if test "$cf_used_lib_$2" != yes ; then cf_used_lib_$2=yes; $3="-l$2 [$]$3"; fi],[
 4561 	ac_cv_func_$1=unknown
 4562 	unset ac_cv_func_$1 2>/dev/null
 4563 	$4],
 4564 	[[$]$3])
 4565 ])dnl
 4566 dnl ---------------------------------------------------------------------------
 4567 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
 4568 dnl ----------------
 4569 dnl Remove all -U and -D options that refer to the given symbol from a list
 4570 dnl of C compiler options.  This works around the problem that not all
 4571 dnl compilers process -U and -D options from left-to-right, so a -U option
 4572 dnl cannot be used to cancel the effect of a preceding -D option.
 4573 dnl
 4574 dnl $1 = target (which could be the same as the source variable)
 4575 dnl $2 = source (including '$')
 4576 dnl $3 = symbol to remove
 4577 define([CF_REMOVE_DEFINE],
 4578 [
 4579 $1=`echo "$2" | \
 4580 	sed	-e 's/-[[UD]]'"$3"'\(=[[^ 	]]*\)\?[[ 	]]/ /g' \
 4581 		-e 's/-[[UD]]'"$3"'\(=[[^ 	]]*\)\?[$]//g'`
 4582 ])dnl
 4583 dnl ---------------------------------------------------------------------------
 4584 dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09
 4585 dnl -----------
 4586 dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
 4587 dnl programs need this test).
 4588 dnl
 4589 dnl This is really a MacOS X 10.4.3 workaround.  Defining _POSIX_C_SOURCE
 4590 dnl forces SIGWINCH to be undefined (breaks xterm, ncurses).  Oddly, the struct
 4591 dnl winsize declaration is left alone - we may revisit this if Apple choose to
 4592 dnl break that part of the interface as well.
 4593 AC_DEFUN([CF_SIGWINCH],
 4594 [
 4595 AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
 4596 	AC_TRY_COMPILE([
 4597 #include <sys/types.h>
 4598 #include <sys/signal.h>
 4599 ],[int x = SIGWINCH],
 4600 	[cf_cv_define_sigwinch=yes],
 4601 	[AC_TRY_COMPILE([
 4602 #undef _XOPEN_SOURCE
 4603 #undef _POSIX_SOURCE
 4604 #undef _POSIX_C_SOURCE
 4605 #include <sys/types.h>
 4606 #include <sys/signal.h>
 4607 ],[int x = SIGWINCH],
 4608 	[cf_cv_define_sigwinch=maybe],
 4609 	[cf_cv_define_sigwinch=no])
 4610 ])
 4611 ])
 4612 
 4613 if test "$cf_cv_define_sigwinch" = maybe ; then
 4614 AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
 4615 cf_cv_fixup_sigwinch=unknown
 4616 cf_sigwinch=32
 4617 while test $cf_sigwinch != 1
 4618 do
 4619 	AC_TRY_COMPILE([
 4620 #undef _XOPEN_SOURCE
 4621 #undef _POSIX_SOURCE
 4622 #undef _POSIX_C_SOURCE
 4623 #include <sys/types.h>
 4624 #include <sys/signal.h>
 4625 ],[
 4626 #if SIGWINCH != $cf_sigwinch
 4627 make an error
 4628 #endif
 4629 int x = SIGWINCH],
 4630 	[cf_cv_fixup_sigwinch=$cf_sigwinch
 4631 	 break])
 4632 
 4633 cf_sigwinch=`expr $cf_sigwinch - 1`
 4634 done
 4635 ])
 4636 
 4637 	if test "$cf_cv_fixup_sigwinch" != unknown ; then
 4638 		CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
 4639 	fi
 4640 fi
 4641 ])dnl
 4642 dnl ---------------------------------------------------------------------------
 4643 dnl CF_SIG_ARGS version: 2 updated: 1997/08/28 23:57:55
 4644 dnl -----------
 4645 dnl Check for systems that have signal-handlers prototyped with one argument
 4646 dnl versus those with more than one argument, define the symbol SIG_ARGS to
 4647 dnl match.  (If it's empty, that's ok too).
 4648 AC_DEFUN([CF_SIG_ARGS],
 4649 [
 4650 AC_MSG_CHECKING([declaration of signal arguments])
 4651 AC_CACHE_VAL(cf_cv_sig_args,[
 4652 cf_cv_sig_args=
 4653 for cf_test in "int sig" "int sig, ..."
 4654 do
 4655 	AC_TRY_COMPILE([
 4656 #include <signal.h>],
 4657 	[extern RETSIGTYPE catch($cf_test); signal(SIGINT, catch)],
 4658 	[cf_cv_sig_args="$cf_test";break])
 4659 done
 4660 ])
 4661 AC_MSG_RESULT($cf_cv_sig_args)
 4662 AC_DEFINE_UNQUOTED(SIG_ARGS,$cf_cv_sig_args)
 4663 ])dnl
 4664 dnl ---------------------------------------------------------------------------
 4665 dnl CF_SIG_CONST version: 4 updated: 2010/10/23 15:52:32
 4666 dnl ------------
 4667 dnl Check for systems where the special signal constants aren't prototyped
 4668 dnl (there's a lot of them, and the compiler can generate a lot of warning
 4669 dnl messages that make it hard to pick out genuine errors).
 4670 AC_DEFUN([CF_SIG_CONST],
 4671 [
 4672 AC_REQUIRE([CF_SIG_ARGS])
 4673 AC_MSG_CHECKING([for redefinable signal constants])
 4674 AC_CACHE_VAL(cf_cv_sig_const,[
 4675 cf_cv_sig_const=no
 4676 if test -n "$cf_cv_sig_args"; then
 4677 	cf_test=`echo $cf_cv_sig_args|sed -e s/sig//`
 4678 	AC_TRY_RUN([
 4679 #define NEW_DFL	((RETSIGTYPE (*)($cf_test))0)
 4680 #define NEW_IGN	((RETSIGTYPE (*)($cf_test))1)
 4681 #define NEW_ERR	((RETSIGTYPE (*)($cf_test))-1)
 4682 
 4683 #include <signal.h>
 4684 
 4685 int main()
 4686 {
 4687 	if (NEW_DFL != SIG_DFL
 4688 	 || NEW_IGN != SIG_IGN
 4689 	 || NEW_ERR != SIG_ERR
 4690 	 /* at least one system won't let me redefine these! */
 4691 #undef SIG_DFL
 4692 #undef SIG_IGN
 4693 #undef SIG_ERR
 4694 #define SIG_DFL NEW_DFL
 4695 #define SIG_IGN NEW_IGN
 4696 #define SIG_ERR NEW_ERR
 4697 	 || NEW_DFL != SIG_DFL)
 4698 	 	${cf_cv_main_return:-return}(1);
 4699 	signal(SIGINT, SIG_DFL);
 4700 	${cf_cv_main_return:-return}(0);
 4701 }],
 4702 	[cf_cv_sig_const=yes],
 4703 	[cf_cv_sig_const=no],
 4704 	[cf_cv_sig_const=unknown])
 4705 fi
 4706 ])
 4707 AC_MSG_RESULT($cf_cv_sig_const)
 4708 test "$cf_cv_sig_const" = yes && AC_DEFINE(DECL_SIG_CONST)
 4709 ])dnl
 4710 dnl ---------------------------------------------------------------------------
 4711 dnl CF_SIZECHANGE version: 11 updated: 2015/04/18 08:56:57
 4712 dnl -------------
 4713 dnl Check for definitions & structures needed for window size-changing
 4714 dnl FIXME: check that this works with "snake" (HP-UX 10.x)
 4715 AC_DEFUN([CF_SIZECHANGE],
 4716 [
 4717 AC_REQUIRE([CF_STRUCT_TERMIOS])
 4718 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
 4719 	cf_cv_sizechange=unknown
 4720 	cf_save_CPPFLAGS="$CPPFLAGS"
 4721 
 4722 for cf_opts in "" "NEED_PTEM_H"
 4723 do
 4724 
 4725 	CPPFLAGS="$cf_save_CPPFLAGS"
 4726 	test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
 4727 	AC_TRY_COMPILE([#include <sys/types.h>
 4728 #ifdef HAVE_TERMIOS_H
 4729 #include <termios.h>
 4730 #else
 4731 #ifdef HAVE_TERMIO_H
 4732 #include <termio.h>
 4733 #endif
 4734 #endif
 4735 #ifdef NEED_PTEM_H
 4736 /* This is a workaround for SCO:  they neglected to define struct winsize in
 4737  * termios.h -- it's only in termio.h and ptem.h
 4738  */
 4739 #include        <sys/stream.h>
 4740 #include        <sys/ptem.h>
 4741 #endif
 4742 #if !defined(sun) || !defined(HAVE_TERMIOS_H)
 4743 #include <sys/ioctl.h>
 4744 #endif
 4745 ],[
 4746 #ifdef TIOCGSIZE
 4747 	struct ttysize win;	/* FIXME: what system is this? */
 4748 	int y = win.ts_lines;
 4749 	int x = win.ts_cols;
 4750 #else
 4751 #ifdef TIOCGWINSZ
 4752 	struct winsize win;
 4753 	int y = win.ws_row;
 4754 	int x = win.ws_col;
 4755 #else
 4756 	no TIOCGSIZE or TIOCGWINSZ
 4757 #endif /* TIOCGWINSZ */
 4758 #endif /* TIOCGSIZE */
 4759 	],
 4760 	[cf_cv_sizechange=yes],
 4761 	[cf_cv_sizechange=no])
 4762 
 4763 	CPPFLAGS="$cf_save_CPPFLAGS"
 4764 	if test "$cf_cv_sizechange" = yes ; then
 4765 		echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
 4766 		test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
 4767 		break
 4768 	fi
 4769 done
 4770 ])
 4771 if test "$cf_cv_sizechange" != no ; then
 4772 	AC_DEFINE(HAVE_SIZECHANGE,1,[Define to 1 if sizechar declarations are provided])
 4773 	case $cf_cv_sizechange in
 4774 	(NEED*)
 4775 		AC_DEFINE_UNQUOTED($cf_cv_sizechange )
 4776 		;;
 4777 	esac
 4778 fi
 4779 ])dnl
 4780 dnl ---------------------------------------------------------------------------
 4781 dnl CF_SOCKS version: 9 updated: 2012/11/08 20:57:52
 4782 dnl --------
 4783 dnl Check for socks library
 4784 dnl $1 = the [optional] directory in which the library may be found
 4785 AC_DEFUN([CF_SOCKS],[
 4786   CF_ADD_OPTIONAL_PATH($1, [socks library])
 4787   CF_FIND_LINKAGE([
 4788 #include <stdio.h>
 4789 ],[
 4790       Raccept((char *)0)
 4791 ],
 4792       socks)
 4793 
 4794   if test "x$cf_cv_find_linkage_socks" = "xyes" ; then
 4795     AC_DEFINE(SOCKS,1,[Define to 1 if we are using socks library])
 4796 
 4797     AC_DEFINE(accept,Raccept,[Define to override function name if using socks library])
 4798     AC_DEFINE(bind,Rbind,[Define to override function name if using socks library])
 4799     AC_DEFINE(connect,Rconnect,[Define to override function name if using socks library])
 4800     AC_DEFINE(getpeername,Rgetpeername,[Define to override function name if using socks library])
 4801     AC_DEFINE(getsockname,Rgetsockname,[Define to override function name if using socks library])
 4802     AC_DEFINE(listen,Rlisten,[Define to override function name if using socks library])
 4803     AC_DEFINE(recvfrom,Rrecvfrom,[Define to override function name if using socks library])
 4804     AC_DEFINE(select,Rselect,[Define to override function name if using socks library])
 4805   else
 4806     AC_MSG_ERROR(cannot link with socks library)
 4807   fi
 4808 ])dnl
 4809 dnl ---------------------------------------------------------------------------
 4810 dnl CF_SOCKS5 version: 12 updated: 2012/11/08 20:57:52
 4811 dnl ---------
 4812 dnl Check for socks5 configuration
 4813 dnl $1 = the [optional] directory in which the library may be found
 4814 AC_DEFUN([CF_SOCKS5],[
 4815   CF_ADD_OPTIONAL_PATH($1, [socks5 library])
 4816 
 4817 CF_ADD_LIBS(-lsocks5)
 4818 
 4819 AC_DEFINE(USE_SOCKS5,1,[Define to 1 if we are using socks5 library])
 4820 AC_DEFINE(SOCKS,1,[Define to 1 if we are using socks library])
 4821 
 4822 AC_MSG_CHECKING(if the socks library uses socks4 prefix)
 4823 cf_use_socks4=error
 4824 AC_TRY_LINK([
 4825 #include <socks.h>],[
 4826 	Rinit((char *)0)],
 4827 	[AC_DEFINE(USE_SOCKS4_PREFIX,1,[Define to 1 if socks library uses socks4 prefix])
 4828 	 cf_use_socks4=yes],
 4829 	[AC_TRY_LINK([#include <socks.h>],
 4830 		[SOCKSinit((char *)0)],
 4831 		[cf_use_socks4=no],
 4832 		[AC_MSG_ERROR(Cannot link with socks5 library)])])
 4833 AC_MSG_RESULT($cf_use_socks4)
 4834 
 4835 if test "$cf_use_socks4" = "yes" ; then
 4836 	AC_DEFINE(accept,Raccept)
 4837 	AC_DEFINE(bind,Rbind)
 4838 	AC_DEFINE(connect,Rconnect)
 4839 	AC_DEFINE(getpeername,Rgetpeername)
 4840 	AC_DEFINE(getsockname,Rgetsockname)
 4841 	AC_DEFINE(listen,Rlisten)
 4842 	AC_DEFINE(recvfrom,Rrecvfrom)
 4843 	AC_DEFINE(select,Rselect)
 4844 else
 4845 	AC_DEFINE(accept,SOCKSaccept)
 4846 	AC_DEFINE(getpeername,SOCKSgetpeername)
 4847 	AC_DEFINE(getsockname,SOCKSgetsockname)
 4848 	AC_DEFINE(recvfrom,SOCKSrecvfrom)
 4849 fi
 4850 
 4851 AC_MSG_CHECKING(if socks5p.h is available)
 4852 AC_TRY_COMPILE([
 4853 #define INCLUDE_PROTOTYPES
 4854 #include <socks.h>],[
 4855 	init((char *)0)],
 4856 	[cf_use_socks5p_h=yes],
 4857 	[cf_use_socks5p_h=no])
 4858 AC_MSG_RESULT($cf_use_socks5p_h)
 4859 
 4860 test "$cf_use_socks5p_h" = yes && AC_DEFINE(INCLUDE_PROTOTYPES,1,[Define to 1 if needed to declare prototypes in socks headers])
 4861 ])dnl
 4862 dnl ---------------------------------------------------------------------------
 4863 dnl CF_STRERROR version: 2 updated: 2001/07/11 09:34:49
 4864 dnl -----------
 4865 dnl Check for strerror(), or it is not found, for the related data.  POSIX
 4866 dnl requires strerror(), so only old systems such as SunOS lack it.
 4867 AC_DEFUN([CF_STRERROR],[
 4868 AC_CHECK_FUNCS(strerror, AC_DEFINE(HAVE_STRERROR),[CF_SYS_ERRLIST])
 4869 ])dnl
 4870 dnl ---------------------------------------------------------------------------
 4871 dnl CF_STRUCT_TERMIOS version: 8 updated: 2015/04/15 19:08:48
 4872 dnl -----------------
 4873 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
 4874 AC_DEFUN([CF_STRUCT_TERMIOS],[
 4875 AC_REQUIRE([CF_XOPEN_SOURCE])
 4876 
 4877 AC_CHECK_HEADERS( \
 4878 termio.h \
 4879 termios.h \
 4880 unistd.h \
 4881 )
 4882 
 4883 if test "$ISC" = yes ; then
 4884 	AC_CHECK_HEADERS( sys/termio.h )
 4885 fi
 4886 if test "$ac_cv_header_termios_h" = yes ; then
 4887 	case "$CFLAGS $CPPFLAGS" in
 4888 	(*-D_POSIX_SOURCE*)
 4889 		termios_bad=dunno ;;
 4890 	(*)	termios_bad=maybe ;;
 4891 	esac
 4892 	if test "$termios_bad" = maybe ; then
 4893 	AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
 4894 	AC_TRY_COMPILE([#include <termios.h>],
 4895 		[struct termios foo; int x = foo.c_iflag],
 4896 		termios_bad=no, [
 4897 		AC_TRY_COMPILE([
 4898 #define _POSIX_SOURCE
 4899 #include <termios.h>],
 4900 			[struct termios foo; int x = foo.c_iflag],
 4901 			termios_bad=unknown,
 4902 			termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE]))
 4903 			])
 4904 	AC_MSG_RESULT($termios_bad)
 4905 	fi
 4906 fi
 4907 ])dnl
 4908 dnl ---------------------------------------------------------------------------
 4909 dnl CF_SUBDIR_PATH version: 7 updated: 2014/12/04 04:33:06
 4910 dnl --------------
 4911 dnl Construct a search-list for a nonstandard header/lib-file
 4912 dnl	$1 = the variable to return as result
 4913 dnl	$2 = the package name
 4914 dnl	$3 = the subdirectory, e.g., bin, include or lib
 4915 AC_DEFUN([CF_SUBDIR_PATH],
 4916 [
 4917 $1=
 4918 
 4919 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
 4920 
 4921 for cf_subdir_prefix in \
 4922 	/usr \
 4923 	/usr/local \
 4924 	/usr/pkg \
 4925 	/opt \
 4926 	/opt/local \
 4927 	[$]HOME
 4928 do
 4929 	CF_ADD_SUBDIR_PATH($1,$2,$3,$cf_subdir_prefix,$prefix)
 4930 done
 4931 ])dnl
 4932 dnl ---------------------------------------------------------------------------
 4933 dnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23
 4934 dnl --------------
 4935 dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and
 4936 dnl errno.h.  Declaration of sys_errlist on BSD4.4 interferes with our
 4937 dnl declaration.  Reported by Keith Bostic.
 4938 AC_DEFUN([CF_SYS_ERRLIST],
 4939 [
 4940     CF_CHECK_ERRNO(sys_nerr)
 4941     CF_CHECK_ERRNO(sys_errlist)
 4942 ])dnl
 4943 dnl ---------------------------------------------------------------------------
 4944 dnl CF_SYS_SELECT_TIMEVAL version: 4 updated: 1997/12/16 11:22:31
 4945 dnl ---------------------
 4946 dnl Check if there is a conflict between <sys/select.h> and <sys/time.h>.
 4947 dnl This is known to be a problem with SCO.
 4948 AC_DEFUN([CF_SYS_SELECT_TIMEVAL],
 4949 [
 4950 AC_MSG_CHECKING(if sys/time.h conflicts with sys/select.h)
 4951 AC_CACHE_VAL(cf_cv_sys_select_timeval,[
 4952 for cf_opts in no yes
 4953 do
 4954 AC_TRY_COMPILE([
 4955 #define yes 1
 4956 #define no 0
 4957 #if $cf_opts
 4958 #define timeval fake_timeval
 4959 #endif
 4960 #include <sys/types.h>
 4961 #ifdef TIME_WITH_SYS_TIME
 4962 #	include <sys/time.h>
 4963 #	include <time.h>
 4964 #else
 4965 #	ifdef HAVE_SYS_TIME_H
 4966 #		include <sys/time.h>
 4967 #	else
 4968 #		include <time.h>
 4969 #	endif
 4970 #endif
 4971 #undef timeval
 4972 #ifdef HAVE_SYS_SELECT_H
 4973 #	include <sys/select.h>
 4974 #endif
 4975 ],[struct timeval foo],
 4976 	[cf_cv_sys_select_timeval=$cf_opts
 4977 	 break],
 4978 	[cf_cv_sys_select_timeval=no])
 4979 done
 4980 ])
 4981 AC_MSG_RESULT($cf_cv_sys_select_timeval)
 4982 test $cf_cv_sys_select_timeval = yes && AC_DEFINE(NEED_TIMEVAL_FIX)
 4983 ])
 4984 dnl ---------------------------------------------------------------------------
 4985 dnl CF_TERMCAP_LIBS version: 15 updated: 2015/04/15 19:08:48
 4986 dnl ---------------
 4987 dnl Look for termcap libraries, or the equivalent in terminfo.
 4988 dnl
 4989 dnl The optional parameter may be "ncurses", "ncursesw".
 4990 AC_DEFUN([CF_TERMCAP_LIBS],
 4991 [
 4992 AC_CACHE_VAL(cf_cv_termlib,[
 4993 cf_cv_termlib=none
 4994 AC_TRY_LINK([],[char *x=(char*)tgoto("",0,0)],
 4995 [AC_TRY_LINK([],[int x=tigetstr("")],
 4996 	[cf_cv_termlib=terminfo],
 4997 	[cf_cv_termlib=termcap])
 4998 	CF_VERBOSE(using functions in predefined $cf_cv_termlib LIBS)
 4999 ],[
 5000 ifelse([$1],,,[
 5001 case "$1" in
 5002 (ncurses*)
 5003 	CF_NCURSES_CONFIG($1)
 5004 	cf_cv_termlib=terminfo
 5005 	;;
 5006 esac
 5007 ])
 5008 if test "$cf_cv_termlib" = none; then
 5009 	# FreeBSD's linker gives bogus results for AC_CHECK_LIB, saying that
 5010 	# tgetstr lives in -lcurses when it is only an unsatisfied extern.
 5011 	cf_save_LIBS="$LIBS"
 5012 	for cf_lib in tinfo curses ncurses termlib termcap
 5013 	do
 5014 		LIBS="-l$cf_lib $cf_save_LIBS"
 5015 		for cf_func in tigetstr tgetstr
 5016 		do
 5017 			AC_MSG_CHECKING(for $cf_func in -l$cf_lib)
 5018 			AC_TRY_LINK([],[int x=$cf_func("")],[cf_result=yes],[cf_result=no])
 5019 			AC_MSG_RESULT($cf_result)
 5020 			if test "$cf_result" = yes ; then
 5021 				if test "$cf_func" = tigetstr ; then
 5022 					cf_cv_termlib=terminfo
 5023 				else
 5024 					cf_cv_termlib=termcap
 5025 				fi
 5026 				break
 5027 			fi
 5028 		done
 5029 		test "$cf_result" = yes && break
 5030 	done
 5031 	test "$cf_result" = no && LIBS="$cf_save_LIBS"
 5032 fi
 5033 if test "$cf_cv_termlib" = none; then
 5034 	# allow curses library for broken AIX system.
 5035 	AC_CHECK_LIB(curses, initscr, [CF_ADD_LIBS(-lcurses)])
 5036 	AC_CHECK_LIB(termcap, tgoto, [CF_ADD_LIBS(-ltermcap) cf_cv_termlib=termcap])
 5037 fi
 5038 ])
 5039 if test "$cf_cv_termlib" = none; then
 5040 	AC_MSG_WARN([Cannot find -ltermlib, -lcurses, or -ltermcap])
 5041 fi
 5042 ])])dnl
 5043 dnl ---------------------------------------------------------------------------
 5044 dnl CF_TERMIOS version: 2 updated: 1997/08/28 23:57:55
 5045 dnl ----------
 5046 dnl See if we can link with the termios functions tcsetattr/tcgetattr
 5047 AC_DEFUN([CF_TERMIOS],
 5048 [
 5049 AC_MSG_CHECKING([for nonconflicting termios.h])
 5050 AC_CACHE_VAL(cf_cv_use_termios_h,[
 5051 	AC_TRY_LINK([
 5052 #ifdef HAVE_IOCTL_H
 5053 #	include <ioctl.h>
 5054 #else
 5055 #	ifdef HAVE_SYS_IOCTL_H
 5056 #		include <sys/ioctl.h>
 5057 #	endif
 5058 #endif
 5059 
 5060 #if !defined(sun) || !defined(NL0)
 5061 #include <termios.h>
 5062 #endif
 5063 ],[
 5064 	struct termios save_tty;
 5065 	(void) tcsetattr (0, TCSANOW, &save_tty);
 5066 	(void) tcgetattr (0, &save_tty)],
 5067 	[cf_cv_use_termios_h=yes],
 5068 	[cf_cv_use_termios_h=no])
 5069 ])
 5070 AC_MSG_RESULT($cf_cv_use_termios_h)
 5071 if test $cf_cv_use_termios_h = yes; then
 5072 	AC_DEFINE(HAVE_TERMIOS_H)
 5073 	AC_DEFINE(HAVE_TCGETATTR)
 5074 	AC_DEFINE(HAVE_TCSETATTR)
 5075 fi
 5076 ])dnl
 5077 dnl ---------------------------------------------------------------------------
 5078 dnl CF_TERM_HEADER version: 4 updated: 2015/04/15 19:08:48
 5079 dnl --------------
 5080 dnl Look for term.h, which is part of X/Open curses.  It defines the interface
 5081 dnl to terminfo database.  Usually it is in the same include-path as curses.h,
 5082 dnl but some packagers change this, breaking various applications.
 5083 AC_DEFUN([CF_TERM_HEADER],[
 5084 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
 5085 case ${cf_cv_ncurses_header} in
 5086 (*/ncurses.h|*/ncursesw.h)
 5087 	cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
 5088 	;;
 5089 (*)
 5090 	cf_term_header=term.h
 5091 	;;
 5092 esac
 5093 
 5094 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
 5095 do
 5096 AC_TRY_COMPILE([#include <stdio.h>
 5097 #include <${cf_cv_ncurses_header:-curses.h}>
 5098 #include <$cf_test>
 5099 ],[int x = auto_left_margin],[
 5100 	cf_cv_term_header="$cf_test"],[
 5101 	cf_cv_term_header=unknown
 5102 	])
 5103 	test "$cf_cv_term_header" != unknown && break
 5104 done
 5105 ])
 5106 
 5107 # Set definitions to allow ifdef'ing to accommodate subdirectories
 5108 
 5109 case $cf_cv_term_header in
 5110 (*term.h)
 5111 	AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
 5112 	;;
 5113 esac
 5114 
 5115 case $cf_cv_term_header in
 5116 (ncurses/term.h)
 5117 	AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
 5118 	;;
 5119 (ncursesw/term.h)
 5120 	AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
 5121 	;;
 5122 esac
 5123 ])dnl
 5124 dnl ---------------------------------------------------------------------------
 5125 dnl CF_TIOCGWINSZ version: 5 updated: 2010/10/23 15:52:32
 5126 dnl -------------
 5127 dnl On some systems ioctl(fd, TIOCGWINSZ, &size) will always return {0,0} until
 5128 dnl ioctl(fd, TIOCSWINSZ, &size) is called to explicitly set the size of the
 5129 dnl screen.
 5130 dnl
 5131 dnl Attempt to determine if we're on such a system by running a test-program.
 5132 dnl This won't work, of course, if the configure script is run in batch mode,
 5133 dnl since we've got to have access to the terminal.
 5134 dnl
 5135 dnl CHECK_DECL_FLAG and CHECK_DECL_HDRS must be set in configure.in
 5136 AC_DEFUN([CF_TIOCGWINSZ],
 5137 [
 5138 AC_MSG_CHECKING([for working TIOCGWINSZ])
 5139 AC_CACHE_VAL(cf_cv_use_tiocgwinsz,[
 5140 	cf_save_CFLAGS="$CFLAGS"
 5141 	CFLAGS="$CFLAGS -D__CPROTO__ $CHECK_DECL_FLAG"
 5142 	AC_TRY_RUN([
 5143 $CHECK_DECL_HDRS
 5144 int main()
 5145 {
 5146 	int fd;
 5147 	for (fd = 0; fd <= 2; fd++) {	/* try in/out/err in case redirected */
 5148 #ifdef TIOCGSIZE
 5149 		struct ttysize size;
 5150 		if (ioctl (0, TIOCGSIZE, &size) == 0
 5151 		 && size.ts_lines > 0
 5152 		 && size.ts_cols > 0)
 5153 			${cf_cv_main_return:-return}(0);
 5154 #else
 5155 		struct winsize size;
 5156 		if (ioctl(0, TIOCGWINSZ, &size) == 0
 5157 		 && size.ws_row > 0
 5158 		 && size.ws_col > 0)
 5159 			${cf_cv_main_return:-return}(0);
 5160 #endif
 5161 	}
 5162 	${cf_cv_main_return:-return}(0);	/* we cannot guarantee this is run interactively */
 5163 }],
 5164 		[cf_cv_use_tiocgwinsz=yes],
 5165 		[cf_cv_use_tiocgwinsz=no],
 5166 		[cf_cv_use_tiocgwinsz=unknown])
 5167 		rm -f autoconf.h
 5168 		CFLAGS="$cf_save_CFLAGS"])
 5169 AC_MSG_RESULT($cf_cv_use_tiocgwinsz)
 5170 test $cf_cv_use_tiocgwinsz != yes && AC_DEFINE(DONT_HAVE_SIGWINCH)
 5171 ])dnl
 5172 dnl ---------------------------------------------------------------------------
 5173 dnl CF_TM_GMTOFF version: 3 updated: 2012/11/08 20:57:52
 5174 dnl ------------
 5175 dnl Check if the tm-struct defines the '.tm_gmtoff' member (useful in decoding
 5176 dnl dates).
 5177 AC_DEFUN([CF_TM_GMTOFF],
 5178 [
 5179 AC_MSG_CHECKING([for tm.tm_gmtoff])
 5180 AC_CACHE_VAL(cf_cv_tm_gmtoff,[
 5181 	AC_TRY_COMPILE([
 5182 #ifdef TIME_WITH_SYS_TIME
 5183 #	include <sys/time.h>
 5184 #	include <time.h>
 5185 #else
 5186 #	ifdef HAVE_SYS_TIME_H
 5187 #		include <sys/time.h>
 5188 #	else
 5189 #		include <time.h>
 5190 #	endif
 5191 #endif
 5192 ],[
 5193 	struct tm foo;
 5194 	long bar = foo.tm_gmtoff],
 5195 	[cf_cv_tm_gmtoff=yes],
 5196 	[cf_cv_tm_gmtoff=no])])
 5197 AC_MSG_RESULT($cf_cv_tm_gmtoff)
 5198 test $cf_cv_tm_gmtoff = no && AC_DEFINE(DONT_HAVE_TM_GMTOFF,1,[Define to 1 if the tm-struct defines .tm_gmtoff member])
 5199 ])dnl
 5200 dnl ---------------------------------------------------------------------------
 5201 dnl CF_TRIM_X_LIBS version: 3 updated: 2015/04/12 15:39:00
 5202 dnl --------------
 5203 dnl Trim extra base X libraries added as a workaround for inconsistent library
 5204 dnl dependencies returned by "new" pkg-config files.
 5205 AC_DEFUN([CF_TRIM_X_LIBS],[
 5206 	for cf_trim_lib in Xmu Xt X11
 5207 	do
 5208 		case "$LIBS" in
 5209 		(*-l$cf_trim_lib\ *-l$cf_trim_lib*)
 5210 			LIBS=`echo "$LIBS " | sed -e 's/  / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'`
 5211 			CF_VERBOSE(..trimmed $LIBS)
 5212 			;;
 5213 		esac
 5214 	done
 5215 ])
 5216 dnl ---------------------------------------------------------------------------
 5217 dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06
 5218 dnl -----------------
 5219 dnl This is a simple wrapper to use for pkg-config, for libraries which may be
 5220 dnl available in that form.
 5221 dnl
 5222 dnl $1 = package name
 5223 dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS
 5224 dnl $3 = logic to use if pkg-config does not have the package
 5225 AC_DEFUN([CF_TRY_PKG_CONFIG],[
 5226 AC_REQUIRE([CF_PKG_CONFIG])
 5227 
 5228 if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then
 5229 	CF_VERBOSE(found package $1)
 5230 	cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`"
 5231 	cf_pkgconfig_libs="`$PKG_CONFIG --libs   $1 2>/dev/null`"
 5232 	CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs)
 5233 	CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs)
 5234 	CF_ADD_CFLAGS($cf_pkgconfig_incs)
 5235 	CF_ADD_LIBS($cf_pkgconfig_libs)
 5236 	ifelse([$2],,:,[$2])
 5237 else
 5238 	cf_pkgconfig_incs=
 5239 	cf_pkgconfig_libs=
 5240 	ifelse([$3],,:,[$3])
 5241 fi
 5242 ])
 5243 dnl ---------------------------------------------------------------------------
 5244 dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
 5245 dnl -------------------
 5246 dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
 5247 dnl can define it successfully.
 5248 AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
 5249 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
 5250 	AC_TRY_COMPILE([
 5251 #include <stdlib.h>
 5252 #include <string.h>
 5253 #include <sys/types.h>
 5254 ],[
 5255 #ifndef _XOPEN_SOURCE
 5256 make an error
 5257 #endif],
 5258 	[cf_cv_xopen_source=no],
 5259 	[cf_save="$CPPFLAGS"
 5260 	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
 5261 	 AC_TRY_COMPILE([
 5262 #include <stdlib.h>
 5263 #include <string.h>
 5264 #include <sys/types.h>
 5265 ],[
 5266 #ifdef _XOPEN_SOURCE
 5267 make an error
 5268 #endif],
 5269 	[cf_cv_xopen_source=no],
 5270 	[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
 5271 	CPPFLAGS="$cf_save"
 5272 	])
 5273 ])
 5274 
 5275 if test "$cf_cv_xopen_source" != no ; then
 5276 	CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
 5277 	CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
 5278 	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
 5279 	CF_ADD_CFLAGS($cf_temp_xopen_source)
 5280 fi
 5281 ])
 5282 dnl ---------------------------------------------------------------------------
 5283 dnl CF_TYPE_OUTCHAR version: 15 updated: 2015/05/15 19:42:24
 5284 dnl ---------------
 5285 dnl Check for return and param type of 3rd -- OutChar() -- param of tputs().
 5286 dnl
 5287 dnl For this check, and for CF_CURSES_TERMCAP, the $CHECK_DECL_HDRS variable
 5288 dnl must point to a header file containing this (or equivalent):
 5289 dnl
 5290 dnl	#ifdef NEED_CURSES_H
 5291 dnl	# ifdef HAVE_NCURSES_NCURSES_H
 5292 dnl	#  include <ncurses/ncurses.h>
 5293 dnl	# else
 5294 dnl	#  ifdef HAVE_NCURSES_H
 5295 dnl	#   include <ncurses.h>
 5296 dnl	#  else
 5297 dnl	#   include <curses.h>
 5298 dnl	#  endif
 5299 dnl	# endif
 5300 dnl	#endif
 5301 dnl
 5302 dnl	#ifdef HAVE_NCURSES_TERM_H
 5303 dnl	#  include <ncurses/term.h>
 5304 dnl	#else
 5305 dnl	# ifdef HAVE_TERM_H
 5306 dnl	#  include <term.h>
 5307 dnl	# endif
 5308 dnl	#endif
 5309 dnl
 5310 dnl	#if NEED_TERMCAP_H
 5311 dnl	# include <termcap.h>
 5312 dnl	#endif
 5313 dnl
 5314 AC_DEFUN([CF_TYPE_OUTCHAR],
 5315 [
 5316 AC_REQUIRE([CF_CURSES_TERMCAP])
 5317 
 5318 AC_CACHE_CHECK(declaration of tputs 3rd param, cf_cv_type_outchar,[
 5319 
 5320 cf_cv_type_outchar="int OutChar(int)"
 5321 cf_cv_found=no
 5322 cf_save_CPPFLAGS="$CPPFLAGS"
 5323 CPPFLAGS="$CPPFLAGS $CHECK_DECL_FLAG"
 5324 
 5325 for P in int void; do
 5326 for Q in int void; do
 5327 for R in int char; do
 5328 for S in "" const; do
 5329 	CF_MSG_LOG(loop variables [P:[$]P, Q:[$]Q, R:[$]R, S:[$]S])
 5330 	AC_TRY_COMPILE([$CHECK_DECL_HDRS],
 5331 	[extern $Q OutChar($R);
 5332 	extern $P tputs ($S char *string, int nlines, $Q (*_f)($R));
 5333 	tputs("", 1, OutChar)],
 5334 	[cf_cv_type_outchar="$Q OutChar($R)"
 5335 	 cf_cv_found=yes
 5336 	 break])
 5337 done
 5338 	test $cf_cv_found = yes && break
 5339 done
 5340 	test $cf_cv_found = yes && break
 5341 done
 5342 	test $cf_cv_found = yes && break
 5343 done
 5344 ])
 5345 
 5346 case $cf_cv_type_outchar in
 5347 (int*)
 5348 	AC_DEFINE(OUTC_RETURN,1,[Define to 1 if tputs outc function returns a value])
 5349 	;;
 5350 esac
 5351 case $cf_cv_type_outchar in
 5352 (*char*)
 5353 	AC_DEFINE(OUTC_ARGS,char c,[Define to actual type to override tputs outc parameter type])
 5354 	;;
 5355 esac
 5356 
 5357 CPPFLAGS="$cf_save_CPPFLAGS"
 5358 ])dnl
 5359 dnl ---------------------------------------------------------------------------
 5360 dnl CF_TYPE_SIGACTION version: 4 updated: 2012/10/06 17:56:13
 5361 dnl -----------------
 5362 dnl
 5363 AC_DEFUN([CF_TYPE_SIGACTION],
 5364 [
 5365 AC_MSG_CHECKING([for type sigaction_t])
 5366 AC_CACHE_VAL(cf_cv_type_sigaction,[
 5367 	AC_TRY_COMPILE([
 5368 #include <signal.h>],
 5369 		[sigaction_t x],
 5370 		[cf_cv_type_sigaction=yes],
 5371 		[cf_cv_type_sigaction=no])])
 5372 AC_MSG_RESULT($cf_cv_type_sigaction)
 5373 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION,1,[Define to 1 if we have the sigaction_t type])
 5374 ])dnl
 5375 dnl ---------------------------------------------------------------------------
 5376 dnl CF_UNION_WAIT version: 6 updated: 2012/10/06 08:57:51
 5377 dnl -------------
 5378 dnl Check to see if the BSD-style union wait is declared.  Some platforms may
 5379 dnl use this, though it is deprecated in favor of the 'int' type in Posix.
 5380 dnl Some vendors provide a bogus implementation that declares union wait, but
 5381 dnl uses the 'int' type instead; we try to spot these by checking for the
 5382 dnl associated macros.
 5383 dnl
 5384 dnl Ahem.  Some implementers cast the status value to an int*, as an attempt to
 5385 dnl use the macros for either union wait or int.  So we do a check compile to
 5386 dnl see if the macros are defined and apply to an int.
 5387 dnl
 5388 dnl Sets: $cf_cv_type_unionwait
 5389 dnl Defines: HAVE_TYPE_UNIONWAIT
 5390 AC_DEFUN([CF_UNION_WAIT],
 5391 [
 5392 AC_REQUIRE([CF_WAIT_HEADERS])
 5393 AC_MSG_CHECKING([for union wait])
 5394 AC_CACHE_VAL(cf_cv_type_unionwait,[
 5395 	AC_TRY_LINK($cf_wait_headers,
 5396 	[int x;
 5397 	 int y = WEXITSTATUS(x);
 5398 	 int z = WTERMSIG(x);
 5399 	 wait(&x);
 5400 	],
 5401 	[cf_cv_type_unionwait=no
 5402 	 echo compiles ok w/o union wait 1>&AC_FD_CC
 5403 	],[
 5404 	AC_TRY_LINK($cf_wait_headers,
 5405 	[union wait x;
 5406 #ifdef WEXITSTATUS
 5407 	 int y = WEXITSTATUS(x);
 5408 #endif
 5409 #ifdef WTERMSIG
 5410 	 int z = WTERMSIG(x);
 5411 #endif
 5412 	 wait(&x);
 5413 	],
 5414 	[cf_cv_type_unionwait=yes
 5415 	 echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC
 5416 	],
 5417 	[cf_cv_type_unionwait=no])])])
 5418 AC_MSG_RESULT($cf_cv_type_unionwait)
 5419 test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT,1,[Define to 1 if type unionwait is declared])
 5420 ])dnl
 5421 dnl ---------------------------------------------------------------------------
 5422 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
 5423 dnl --------
 5424 dnl Make an uppercase version of a variable
 5425 dnl $1=uppercase($2)
 5426 AC_DEFUN([CF_UPPER],
 5427 [
 5428 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 5429 ])dnl
 5430 dnl ---------------------------------------------------------------------------
 5431 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
 5432 dnl ----------
 5433 dnl Use AC_VERBOSE w/o the warnings
 5434 AC_DEFUN([CF_VERBOSE],
 5435 [test -n "$verbose" && echo "	$1" 1>&AC_FD_MSG
 5436 CF_MSG_LOG([$1])
 5437 ])dnl
 5438 dnl ---------------------------------------------------------------------------
 5439 dnl CF_WAIT_HEADERS version: 2 updated: 1997/10/21 19:45:33
 5440 dnl ---------------
 5441 dnl Build up an expression $cf_wait_headers with the header files needed to
 5442 dnl compile against the prototypes for 'wait()', 'waitpid()', etc.  Assume it's
 5443 dnl Posix, which uses <sys/types.h> and <sys/wait.h>, but allow SVr4 variation
 5444 dnl with <wait.h>.
 5445 AC_DEFUN([CF_WAIT_HEADERS],
 5446 [
 5447 AC_HAVE_HEADERS(sys/wait.h)
 5448 cf_wait_headers="#include <sys/types.h>
 5449 "
 5450 if test $ac_cv_header_sys_wait_h = yes; then
 5451 cf_wait_headers="$cf_wait_headers
 5452 #include <sys/wait.h>
 5453 "
 5454 else
 5455 AC_HAVE_HEADERS(wait.h)
 5456 AC_HAVE_HEADERS(waitstatus.h)
 5457 if test $ac_cv_header_wait_h = yes; then
 5458 cf_wait_headers="$cf_wait_headers
 5459 #include <wait.h>
 5460 "
 5461 fi
 5462 if test $ac_cv_header_waitstatus_h = yes; then
 5463 cf_wait_headers="$cf_wait_headers
 5464 #include <waitstatus.h>
 5465 "
 5466 fi
 5467 fi
 5468 ])dnl
 5469 dnl ---------------------------------------------------------------------------
 5470 dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38
 5471 dnl ------------------
 5472 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
 5473 dnl libraries.
 5474 AC_DEFUN([CF_WITH_CURSES_DIR],[
 5475 
 5476 AC_MSG_CHECKING(for specific curses-directory)
 5477 AC_ARG_WITH(curses-dir,
 5478 	[  --with-curses-dir=DIR   directory in which (n)curses is installed],
 5479 	[cf_cv_curses_dir=$withval],
 5480 	[cf_cv_curses_dir=no])
 5481 AC_MSG_RESULT($cf_cv_curses_dir)
 5482 
 5483 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
 5484 then
 5485 	CF_PATH_SYNTAX(withval)
 5486 	if test -d "$cf_cv_curses_dir"
 5487 	then
 5488 		CF_ADD_INCDIR($cf_cv_curses_dir/include)
 5489 		CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
 5490 	fi
 5491 fi
 5492 ])dnl
 5493 dnl ---------------------------------------------------------------------------
 5494 dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
 5495 dnl ----------------
 5496 dnl Configure-option for dbmalloc.  The optional parameter is used to override
 5497 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
 5498 AC_DEFUN([CF_WITH_DBMALLOC],[
 5499 CF_NO_LEAKS_OPTION(dbmalloc,
 5500 	[  --with-dbmalloc         test: use Conor Cahill's dbmalloc library],
 5501 	[USE_DBMALLOC])
 5502 
 5503 if test "$with_dbmalloc" = yes ; then
 5504 	AC_CHECK_HEADER(dbmalloc.h,
 5505 		[AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
 5506 fi
 5507 ])dnl
 5508 dnl ---------------------------------------------------------------------------
 5509 dnl CF_WITH_DFTENV version: 4 updated: 2008/03/23 14:48:54
 5510 dnl --------------
 5511 dnl Wrapper for AC_ARG_WITH to inherit/override an environment variable's
 5512 dnl "#define" in the compile.
 5513 dnl $1 = option name
 5514 dnl $2 = help-message
 5515 dnl $3 = name of variable to inherit/override
 5516 dnl $4 = default value of variable, if any
 5517 AC_DEFUN([CF_WITH_DFTENV],
 5518 [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
 5519 ifelse($4,,[withval="${$3}"],[withval="${$3-$4}"]))dnl
 5520 case "$withval" in #(vi
 5521 yes|no)
 5522   AC_MSG_ERROR(expected a value for --with-$1)
 5523   ;;
 5524 esac
 5525 $3="$withval"
 5526 AC_DEFINE_UNQUOTED($3,"[$]$3")dnl
 5527 ])dnl
 5528 dnl ---------------------------------------------------------------------------
 5529 dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
 5530 dnl ---------------
 5531 dnl Configure-option for dmalloc.  The optional parameter is used to override
 5532 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
 5533 AC_DEFUN([CF_WITH_DMALLOC],[
 5534 CF_NO_LEAKS_OPTION(dmalloc,
 5535 	[  --with-dmalloc          test: use Gray Watson's dmalloc library],
 5536 	[USE_DMALLOC])
 5537 
 5538 if test "$with_dmalloc" = yes ; then
 5539 	AC_CHECK_HEADER(dmalloc.h,
 5540 		[AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
 5541 fi
 5542 ])dnl
 5543 dnl ---------------------------------------------------------------------------
 5544 dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19
 5545 dnl ------------
 5546 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
 5547 dnl defaulting to yes/no.
 5548 dnl
 5549 dnl $1 = option name
 5550 dnl $2 = help-text
 5551 dnl $3 = environment variable to set
 5552 dnl $4 = default value, shown in the help-message, must be a constant
 5553 dnl $5 = default value, if it's an expression & cannot be in the help-message
 5554 dnl
 5555 AC_DEFUN([CF_WITH_PATH],
 5556 [AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),,
 5557 ifelse([$4],,[withval="${$3}"],[withval="${$3:-ifelse([$5],,[$4],[$5])}"]))dnl
 5558 if ifelse([$5],,true,[test -n "$5"]) ; then
 5559 CF_PATH_SYNTAX(withval)
 5560 fi
 5561 eval $3="$withval"
 5562 AC_SUBST($3)dnl
 5563 ])dnl
 5564 dnl ---------------------------------------------------------------------------
 5565 dnl CF_WITH_PROGRAM version: 6 updated: 2008/03/23 14:48:54
 5566 dnl ---------------
 5567 dnl Wrapper for AC_PATH_PROG, with command-line option.
 5568 dnl Params:
 5569 dnl $1 = program name
 5570 dnl $2 = help-string (I'd use format, but someone's disable it in autoconf)
 5571 dnl $3 = caller-supplied default if no --with option is given.  If this is
 5572 dnl      blank, the macro uses AC_PATH_PROG.
 5573 AC_DEFUN([CF_WITH_PROGRAM],
 5574 [dnl
 5575 define([cf_path_name], PATH_[]translit($1, [a-z], [A-Z]))dnl
 5576 define([cf_have_name], HAVE_[]translit($1, [a-z], [A-Z]))dnl
 5577 AC_ARG_WITH($1,[$2],ifelse($3,,
 5578 [case "$withval" in #(vi
 5579   yes[)]
 5580    AC_MSG_ERROR(expected a value for --with-$1)
 5581    ;; #(vi
 5582   no[)]
 5583    ;; #(vi
 5584   *[)]
 5585    # user supplied option-value for "--with-$1=path"
 5586    AC_MSG_CHECKING(for $1)
 5587    ac_cv_path_]cf_path_name[="$withval"
 5588    AC_DEFINE_UNQUOTED(cf_path_name,"$withval")dnl
 5589    AC_DEFINE(cf_have_name)dnl
 5590    AC_MSG_RESULT($withval)
 5591    ;;
 5592  esac],[$3]),[
 5593   # user did not specify "--with-$1"; do automatic check
 5594   AC_PATH_PROG(cf_path_name,$1)
 5595   if test -n "$cf_path_name"; then
 5596     AC_DEFINE_UNQUOTED(cf_path_name,"$cf_path_name")dnl
 5597     AC_DEFINE(cf_have_name)dnl
 5598   fi
 5599 ])dnl
 5600 undefine([cf_path_name])undefine([cf_have_name])])dnl
 5601 dnl ---------------------------------------------------------------------------
 5602 dnl CF_WITH_VALUE version: 3 updated: 1998/04/01 11:39:13
 5603 dnl -------------
 5604 dnl Wrapper for AC_ARG_WITH to ensure that if the user supplies a value, it is
 5605 dnl not simply defaulting to yes/no.  Empty strings are ok if the macro is
 5606 dnl invoked without a default value
 5607 dnl $1 = option name
 5608 dnl $2 = help-message
 5609 dnl $3 = variable to inherit/override
 5610 dnl $4 = default value, if any.
 5611 AC_DEFUN([CF_WITH_VALUE],
 5612 [CF_ARG_WITH($1,[$2],[$3],[$4])
 5613  AC_DEFINE_UNQUOTED($3,"$withval")dnl
 5614 ])dnl
 5615 dnl ---------------------------------------------------------------------------
 5616 dnl CF_XOPEN_CURSES version: 13 updated: 2015/12/12 20:59:52
 5617 dnl ---------------
 5618 dnl Test if we should define X/Open source for curses, needed on Digital Unix
 5619 dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
 5620 dnl
 5621 dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
 5622 dnl as getbegy().  The latter is better design, but the former is standard.
 5623 AC_DEFUN([CF_XOPEN_CURSES],
 5624 [
 5625 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
 5626 AC_CACHE_CHECK(definition to turn on extended curses functions,cf_cv_need_xopen_extension,[
 5627 cf_cv_need_xopen_extension=unknown
 5628 AC_TRY_LINK([
 5629 #include <stdlib.h>
 5630 #include <${cf_cv_ncurses_header:-curses.h}>],[
 5631 #if defined(NCURSES_VERSION_PATCH)
 5632 #if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
 5633 	make an error
 5634 #endif
 5635 #endif
 5636 #ifdef NCURSES_VERSION
 5637 	cchar_t check;
 5638 	int check2 = curs_set((int)sizeof(check));
 5639 #endif
 5640 	long x = winnstr(stdscr, "", 0);
 5641 	int x1, y1;
 5642 	getbegyx(stdscr, y1, x1)],
 5643 	[cf_cv_need_xopen_extension=none],
 5644 	[
 5645 	for cf_try_xopen_extension in _XOPEN_SOURCE_EXTENDED NCURSES_WIDECHAR
 5646 	do
 5647 		AC_TRY_LINK([
 5648 #define $cf_try_xopen_extension 1
 5649 #include <stdlib.h>
 5650 #include <${cf_cv_ncurses_header:-curses.h}>],[
 5651 #ifdef NCURSES_VERSION
 5652 		cchar_t check;
 5653 		int check2 = curs_set((int)sizeof(check));
 5654 #endif
 5655 		long x = winnstr(stdscr, "", 0);
 5656 		int x1, y1;
 5657 		getbegyx(stdscr, y1, x1)],
 5658 		[cf_cv_need_xopen_extension=$cf_try_xopen_extension; break])
 5659 	done
 5660 	])
 5661 ])
 5662 
 5663 case $cf_cv_need_xopen_extension in
 5664 (*_*)
 5665 	CPPFLAGS="$CPPFLAGS -D$cf_cv_need_xopen_extension"
 5666 	;;
 5667 esac
 5668 
 5669 ])dnl
 5670 dnl ---------------------------------------------------------------------------
 5671 dnl CF_XOPEN_SOURCE version: 52 updated: 2016/08/27 12:21:42
 5672 dnl ---------------
 5673 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
 5674 dnl or adapt to the vendor's definitions to get equivalent functionality,
 5675 dnl without losing the common non-POSIX features.
 5676 dnl
 5677 dnl Parameters:
 5678 dnl	$1 is the nominal value for _XOPEN_SOURCE
 5679 dnl	$2 is the nominal value for _POSIX_C_SOURCE
 5680 AC_DEFUN([CF_XOPEN_SOURCE],[
 5681 AC_REQUIRE([AC_CANONICAL_HOST])
 5682 
 5683 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
 5684 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
 5685 cf_xopen_source=
 5686 
 5687 case $host_os in
 5688 (aix[[4-7]]*)
 5689 	cf_xopen_source="-D_ALL_SOURCE"
 5690 	;;
 5691 (msys)
 5692 	cf_XOPEN_SOURCE=600
 5693 	;;
 5694 (darwin[[0-8]].*)
 5695 	cf_xopen_source="-D_APPLE_C_SOURCE"
 5696 	;;
 5697 (darwin*)
 5698 	cf_xopen_source="-D_DARWIN_C_SOURCE"
 5699 	cf_XOPEN_SOURCE=
 5700 	;;
 5701 (freebsd*|dragonfly*)
 5702 	# 5.x headers associate
 5703 	#	_XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
 5704 	#	_XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
 5705 	cf_POSIX_C_SOURCE=200112L
 5706 	cf_XOPEN_SOURCE=600
 5707 	cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
 5708 	;;
 5709 (hpux11*)
 5710 	cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
 5711 	;;
 5712 (hpux*)
 5713 	cf_xopen_source="-D_HPUX_SOURCE"
 5714 	;;
 5715 (irix[[56]].*)
 5716 	cf_xopen_source="-D_SGI_SOURCE"
 5717 	cf_XOPEN_SOURCE=
 5718 	;;
 5719 (linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
 5720 	CF_GNU_SOURCE
 5721 	;;
 5722 (minix*)
 5723 	cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this...
 5724 	;;
 5725 (mirbsd*)
 5726 	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
 5727 	cf_XOPEN_SOURCE=
 5728 	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
 5729 	;;
 5730 (netbsd*)
 5731 	cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
 5732 	;;
 5733 (openbsd[[4-9]]*)
 5734 	# setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
 5735 	cf_xopen_source="-D_BSD_SOURCE"
 5736 	cf_XOPEN_SOURCE=600
 5737 	;;
 5738 (openbsd*)
 5739 	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
 5740 	;;
 5741 (osf[[45]]*)
 5742 	cf_xopen_source="-D_OSF_SOURCE"
 5743 	;;
 5744 (nto-qnx*)
 5745 	cf_xopen_source="-D_QNX_SOURCE"
 5746 	;;
 5747 (sco*)
 5748 	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
 5749 	;;
 5750 (solaris2.*)
 5751 	cf_xopen_source="-D__EXTENSIONS__"
 5752 	cf_cv_xopen_source=broken
 5753 	;;
 5754 (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2)
 5755 	cf_XOPEN_SOURCE=
 5756 	cf_POSIX_C_SOURCE=
 5757 	;;
 5758 (*)
 5759 	CF_TRY_XOPEN_SOURCE
 5760 	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
 5761 	;;
 5762 esac
 5763 
 5764 if test -n "$cf_xopen_source" ; then
 5765 	CF_ADD_CFLAGS($cf_xopen_source,true)
 5766 fi
 5767 
 5768 dnl In anything but the default case, we may have system-specific setting
 5769 dnl which is still not guaranteed to provide all of the entrypoints that
 5770 dnl _XOPEN_SOURCE would yield.
 5771 if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
 5772 	AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
 5773 	AC_TRY_COMPILE([#include <stdlib.h>],[
 5774 #ifndef _XOPEN_SOURCE
 5775 make an error
 5776 #endif],
 5777 	[cf_XOPEN_SOURCE_set=yes],
 5778 	[cf_XOPEN_SOURCE_set=no])
 5779 	AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
 5780 	if test $cf_XOPEN_SOURCE_set = yes
 5781 	then
 5782 		AC_TRY_COMPILE([#include <stdlib.h>],[
 5783 #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
 5784 make an error
 5785 #endif],
 5786 		[cf_XOPEN_SOURCE_set_ok=yes],
 5787 		[cf_XOPEN_SOURCE_set_ok=no])
 5788 		if test $cf_XOPEN_SOURCE_set_ok = no
 5789 		then
 5790 			AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
 5791 		fi
 5792 	else
 5793 		CF_TRY_XOPEN_SOURCE
 5794 	fi
 5795 fi
 5796 ])
 5797 dnl ---------------------------------------------------------------------------
 5798 dnl CF_X_ATHENA version: 23 updated: 2015/04/12 15:39:00
 5799 dnl -----------
 5800 dnl Check for Xaw (Athena) libraries
 5801 dnl
 5802 dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
 5803 AC_DEFUN([CF_X_ATHENA],
 5804 [
 5805 cf_x_athena=${cf_x_athena:-Xaw}
 5806 
 5807 AC_MSG_CHECKING(if you want to link with Xaw 3d library)
 5808 withval=
 5809 AC_ARG_WITH(Xaw3d,
 5810 	[  --with-Xaw3d            link with Xaw 3d library])
 5811 if test "$withval" = yes ; then
 5812 	cf_x_athena=Xaw3d
 5813 	AC_MSG_RESULT(yes)
 5814 else
 5815 	AC_MSG_RESULT(no)
 5816 fi
 5817 
 5818 AC_MSG_CHECKING(if you want to link with Xaw 3d xft library)
 5819 withval=
 5820 AC_ARG_WITH(Xaw3dxft,
 5821 	[  --with-Xaw3dxft         link with Xaw 3d xft library])
 5822 if test "$withval" = yes ; then
 5823 	cf_x_athena=Xaw3dxft
 5824 	AC_MSG_RESULT(yes)
 5825 else
 5826 	AC_MSG_RESULT(no)
 5827 fi
 5828 
 5829 AC_MSG_CHECKING(if you want to link with neXT Athena library)
 5830 withval=
 5831 AC_ARG_WITH(neXtaw,
 5832 	[  --with-neXtaw           link with neXT Athena library])
 5833 if test "$withval" = yes ; then
 5834 	cf_x_athena=neXtaw
 5835 	AC_MSG_RESULT(yes)
 5836 else
 5837 	AC_MSG_RESULT(no)
 5838 fi
 5839 
 5840 AC_MSG_CHECKING(if you want to link with Athena-Plus library)
 5841 withval=
 5842 AC_ARG_WITH(XawPlus,
 5843 	[  --with-XawPlus          link with Athena-Plus library])
 5844 if test "$withval" = yes ; then
 5845 	cf_x_athena=XawPlus
 5846 	AC_MSG_RESULT(yes)
 5847 else
 5848 	AC_MSG_RESULT(no)
 5849 fi
 5850 
 5851 cf_x_athena_lib=""
 5852 
 5853 if test "$PKG_CONFIG" != none ; then
 5854 	cf_athena_list=
 5855 	test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6"
 5856 	for cf_athena_pkg in \
 5857 		$cf_athena_list \
 5858 		${cf_x_athena} \
 5859 		${cf_x_athena}-devel \
 5860 		lib${cf_x_athena} \
 5861 		lib${cf_x_athena}-devel
 5862 	do
 5863 		CF_TRY_PKG_CONFIG($cf_athena_pkg,[
 5864 			cf_x_athena_lib="$cf_pkgconfig_libs"
 5865 			CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
 5866 			AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
 5867 
 5868 			CF_TRIM_X_LIBS
 5869 
 5870 AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[
 5871 AC_TRY_LINK([
 5872 #include <X11/Xmu/CharSet.h>
 5873 ],[
 5874 int check = XmuCompareISOLatin1("big", "small")
 5875 ],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])])
 5876 
 5877 			if test "$cf_cv_xaw_compat" = no
 5878 			then
 5879 				# workaround for broken ".pc" files...
 5880 				case "$cf_x_athena_lib" in
 5881 				(*-lXmu*)
 5882 					;;
 5883 				(*)
 5884 					CF_VERBOSE(work around broken package)
 5885 					cf_save_xmu="$LIBS"
 5886 					cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'`
 5887 					CF_TRY_PKG_CONFIG(xmu,[
 5888 							LIBS="$cf_save_xmu"
 5889 							CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs)
 5890 						],[
 5891 							CF_ADD_LIB_AFTER($cf_first_lib,-lXmu)
 5892 						])
 5893 					CF_TRIM_X_LIBS
 5894 					;;
 5895 				esac
 5896 			fi
 5897 
 5898 			break])
 5899 	done
 5900 fi
 5901 
 5902 if test -z "$cf_x_athena_lib" ; then
 5903 	CF_X_EXT
 5904 	CF_X_TOOLKIT
 5905 	CF_X_ATHENA_CPPFLAGS($cf_x_athena)
 5906 	CF_X_ATHENA_LIBS($cf_x_athena)
 5907 fi
 5908 ])dnl
 5909 dnl ---------------------------------------------------------------------------
 5910 dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30
 5911 dnl --------------------
 5912 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
 5913 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
 5914 AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
 5915 [
 5916 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
 5917 cf_x_athena_inc=""
 5918 
 5919 for cf_path in default \
 5920 	/usr/contrib/X11R6 \
 5921 	/usr/contrib/X11R5 \
 5922 	/usr/lib/X11R5 \
 5923 	/usr/local
 5924 do
 5925 	if test -z "$cf_x_athena_inc" ; then
 5926 		cf_save="$CPPFLAGS"
 5927 		cf_test=X11/$cf_x_athena_root/SimpleMenu.h
 5928 		if test $cf_path != default ; then
 5929 			CPPFLAGS="$cf_save -I$cf_path/include"
 5930 			AC_MSG_CHECKING(for $cf_test in $cf_path)
 5931 		else
 5932 			AC_MSG_CHECKING(for $cf_test)
 5933 		fi
 5934 		AC_TRY_COMPILE([
 5935 #include <X11/Intrinsic.h>
 5936 #include <$cf_test>],[],
 5937 			[cf_result=yes],
 5938 			[cf_result=no])
 5939 		AC_MSG_RESULT($cf_result)
 5940 		if test "$cf_result" = yes ; then
 5941 			cf_x_athena_inc=$cf_path
 5942 			break
 5943 		else
 5944 			CPPFLAGS="$cf_save"
 5945 		fi
 5946 	fi
 5947 done
 5948 
 5949 if test -z "$cf_x_athena_inc" ; then
 5950 	AC_MSG_WARN(
 5951 [Unable to successfully find Athena header files with test program])
 5952 elif test "$cf_x_athena_inc" != default ; then
 5953 	CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc"
 5954 fi
 5955 ])
 5956 dnl ---------------------------------------------------------------------------
 5957 dnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02
 5958 dnl ----------------
 5959 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
 5960 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
 5961 AC_DEFUN([CF_X_ATHENA_LIBS],
 5962 [AC_REQUIRE([CF_X_TOOLKIT])
 5963 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
 5964 cf_x_athena_lib=""
 5965 
 5966 for cf_path in default \
 5967 	/usr/contrib/X11R6 \
 5968 	/usr/contrib/X11R5 \
 5969 	/usr/lib/X11R5 \
 5970 	/usr/local
 5971 do
 5972 	for cf_lib in \
 5973 		${cf_x_athena_root} \
 5974 		${cf_x_athena_root}7 \
 5975 		${cf_x_athena_root}6
 5976 	do
 5977 	for cf_libs in \
 5978 		"-l$cf_lib -lXmu" \
 5979 		"-l$cf_lib -lXpm -lXmu" \
 5980 		"-l${cf_lib}_s -lXmu_s"
 5981 	do
 5982 		if test -z "$cf_x_athena_lib" ; then
 5983 			cf_save="$LIBS"
 5984 			cf_test=XawSimpleMenuAddGlobalActions
 5985 			if test $cf_path != default ; then
 5986 				CF_ADD_LIBS(-L$cf_path/lib $cf_libs)
 5987 				AC_MSG_CHECKING(for $cf_libs in $cf_path)
 5988 			else
 5989 				CF_ADD_LIBS($cf_libs)
 5990 				AC_MSG_CHECKING(for $cf_test in $cf_libs)
 5991 			fi
 5992 			AC_TRY_LINK([
 5993 #include <X11/Intrinsic.h>
 5994 #include <X11/$cf_x_athena_root/SimpleMenu.h>
 5995 ],[
 5996 $cf_test((XtAppContext) 0)],
 5997 				[cf_result=yes],
 5998 				[cf_result=no])
 5999 			AC_MSG_RESULT($cf_result)
 6000 			if test "$cf_result" = yes ; then
 6001 				cf_x_athena_lib="$cf_libs"
 6002 				break
 6003 			fi
 6004 			LIBS="$cf_save"
 6005 		fi
 6006 	done # cf_libs
 6007 		test -n "$cf_x_athena_lib" && break
 6008 	done # cf_lib
 6009 done
 6010 
 6011 if test -z "$cf_x_athena_lib" ; then
 6012 	AC_MSG_ERROR(
 6013 [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
 6014 fi
 6015 
 6016 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
 6017 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
 6018 ])
 6019 dnl ---------------------------------------------------------------------------
 6020 dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05
 6021 dnl --------
 6022 AC_DEFUN([CF_X_EXT],[
 6023 CF_TRY_PKG_CONFIG(Xext,,[
 6024 	AC_CHECK_LIB(Xext,XextCreateExtension,
 6025 		[CF_ADD_LIB(Xext)])])
 6026 ])dnl
 6027 dnl ---------------------------------------------------------------------------
 6028 dnl CF_X_TOOLKIT version: 23 updated: 2015/04/12 15:39:00
 6029 dnl ------------
 6030 dnl Check for X Toolkit libraries
 6031 AC_DEFUN([CF_X_TOOLKIT],
 6032 [
 6033 AC_REQUIRE([AC_PATH_XTRA])
 6034 AC_REQUIRE([CF_CHECK_CACHE])
 6035 
 6036 # OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new), and (and
 6037 # in some cases has installed dummy files in the former, other cases replaced
 6038 # it with a link to the new location).  This complicates the configure script.
 6039 # Check for that pitfall, and recover using pkg-config
 6040 #
 6041 # If none of these are set, the configuration is almost certainly broken.
 6042 if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}"
 6043 then
 6044 	CF_TRY_PKG_CONFIG(x11,,[AC_MSG_WARN(unable to find X11 library)])
 6045 	CF_TRY_PKG_CONFIG(ice,,[AC_MSG_WARN(unable to find ICE library)])
 6046 	CF_TRY_PKG_CONFIG(sm,,[AC_MSG_WARN(unable to find SM library)])
 6047 	CF_TRY_PKG_CONFIG(xt,,[AC_MSG_WARN(unable to find Xt library)])
 6048 fi
 6049 
 6050 cf_have_X_LIBS=no
 6051 
 6052 CF_TRY_PKG_CONFIG(xt,[
 6053 
 6054 	case "x$LIBS" in
 6055 	(*-lX11*)
 6056 		;;
 6057 	(*)
 6058 # we have an "xt" package, but it may omit Xt's dependency on X11
 6059 AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[
 6060 AC_TRY_LINK([
 6061 #include <X11/Xlib.h>
 6062 ],[
 6063 	int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0);
 6064 	int rc2 = XClearWindow((Display*) 0, (Window) 0);
 6065 	int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0);
 6066 	int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0);
 6067 ],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])])
 6068 		if test "$cf_cv_xt_x11_compat" = no
 6069 		then
 6070 			CF_VERBOSE(work around broken X11 dependency)
 6071 			# 2010/11/19 - good enough until a working Xt on Xcb is delivered.
 6072 			CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)])
 6073 		fi
 6074 		;;
 6075 	esac
 6076 
 6077 AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[
 6078 AC_TRY_LINK([
 6079 #include <X11/Shell.h>
 6080 ],[int num = IceConnectionNumber(0)
 6081 ],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])])
 6082 
 6083 	if test "$cf_cv_xt_ice_compat" = no
 6084 	then
 6085 		# workaround for broken ".pc" files used for X Toolkit.
 6086 		case "x$X_PRE_LIBS" in
 6087 		(*-lICE*)
 6088 			case "x$LIBS" in
 6089 			(*-lICE*)
 6090 				;;
 6091 			(*)
 6092 				CF_VERBOSE(work around broken ICE dependency)
 6093 				CF_TRY_PKG_CONFIG(ice,
 6094 					[CF_TRY_PKG_CONFIG(sm)],
 6095 					[CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)])
 6096 				;;
 6097 			esac
 6098 			;;
 6099 		esac
 6100 	fi
 6101 
 6102 	cf_have_X_LIBS=yes
 6103 ],[
 6104 
 6105 	LDFLAGS="$X_LIBS $LDFLAGS"
 6106 	CF_CHECK_CFLAGS($X_CFLAGS)
 6107 
 6108 	AC_CHECK_FUNC(XOpenDisplay,,[
 6109 	AC_CHECK_LIB(X11,XOpenDisplay,
 6110 		[CF_ADD_LIB(X11)],,
 6111 		[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
 6112 
 6113 	AC_CHECK_FUNC(XtAppInitialize,,[
 6114 	AC_CHECK_LIB(Xt, XtAppInitialize,
 6115 		[AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library])
 6116 		 cf_have_X_LIBS=Xt
 6117 		 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
 6118 		[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
 6119 ])
 6120 
 6121 if test $cf_have_X_LIBS = no ; then
 6122 	AC_MSG_WARN(
 6123 [Unable to successfully link X Toolkit library (-lXt) with
 6124 test program.  You will have to check and add the proper libraries by hand
 6125 to makefile.])
 6126 fi
 6127 ])dnl
 6128 dnl ---------------------------------------------------------------------------
 6129 dnl CF__ICONV_BODY version: 2 updated: 2007/07/26 17:35:47
 6130 dnl --------------
 6131 dnl Test-code needed for iconv compile-checks
 6132 define([CF__ICONV_BODY],[
 6133 	iconv_t cd = iconv_open("","");
 6134 	iconv(cd,NULL,NULL,NULL,NULL);
 6135 	iconv_close(cd);]
 6136 )dnl
 6137 dnl ---------------------------------------------------------------------------
 6138 dnl CF__ICONV_HEAD version: 1 updated: 2007/07/26 15:57:03
 6139 dnl --------------
 6140 dnl Header-files needed for iconv compile-checks
 6141 define([CF__ICONV_HEAD],[
 6142 #include <stdlib.h>
 6143 #include <iconv.h>]
 6144 )dnl
 6145 dnl ---------------------------------------------------------------------------
 6146 dnl CF__INTL_BODY version: 3 updated: 2017/07/10 20:13:33
 6147 dnl -------------
 6148 dnl Test-code needed for libintl compile-checks
 6149 dnl $1 = parameter 2 from AM_WITH_NLS
 6150 define([CF__INTL_BODY],[
 6151 	bindtextdomain ("", "");
 6152 	return (int) gettext ("")
 6153 			ifelse([$1], need-ngettext, [ + (int) ngettext ("", "", 0)], [])
 6154 #ifndef IGNORE_MSGFMT_HACK
 6155 			[ + _nl_msg_cat_cntr]
 6156 #endif
 6157 ])
 6158 dnl ---------------------------------------------------------------------------
 6159 dnl CF__INTL_HEAD version: 1 updated: 2007/07/26 17:35:47
 6160 dnl -------------
 6161 dnl Header-files needed for libintl compile-checks
 6162 define([CF__INTL_HEAD],[
 6163 #include <libintl.h>
 6164 extern int _nl_msg_cat_cntr;
 6165 ])dnl
 6166 dnl ---------------------------------------------------------------------------
 6167 dnl jm_GLIBC21 version: 4 updated: 2015/05/10 19:52:14
 6168 dnl ----------
 6169 dnl Inserted as requested by gettext 0.10.40
 6170 dnl File from /usr/share/aclocal
 6171 dnl glibc21.m4
 6172 dnl ====================
 6173 dnl serial 2
 6174 dnl
 6175 dnl Test for the GNU C Library, version 2.1 or newer.
 6176 dnl From Bruno Haible.
 6177 AC_DEFUN([jm_GLIBC21],
 6178 [
 6179 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
 6180 	ac_cv_gnu_library_2_1,
 6181 	[AC_EGREP_CPP([Lucky GNU user],
 6182 	[
 6183 #include <features.h>
 6184 #ifdef __GNU_LIBRARY__
 6185  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
 6186   Lucky GNU user
 6187  #endif
 6188 #endif
 6189 	],
 6190 	ac_cv_gnu_library_2_1=yes,
 6191 	ac_cv_gnu_library_2_1=no)])
 6192 	AC_SUBST(GLIBC21)
 6193 	GLIBC21="$ac_cv_gnu_library_2_1"
 6194 ])