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