"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.1/aclocal.m4" (12 Oct 2016, 188348 Bytes) of package /linux/misc/tin-2.4.1.tar.gz:


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.0_vs_2.4.1.

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