"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.5/aclocal.m4" (1 Dec 2020, 209607 Bytes) of package /linux/misc/tin-2.4.5.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.4_vs_2.4.5.

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