"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.4/aclocal.m4" (20 Nov 2019, 197688 Bytes) of package /linux/misc/tin-2.4.4.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.3_vs_2.4.4.

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