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