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