]> ncurses.scripts.mit.edu Git - ncurses.git/blob - aclocal.m4
ncurses 6.1 - patch 20190907
[ncurses.git] / aclocal.m4
1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2018,2019 Free Software Foundation, Inc.              *
3 dnl                                                                          *
4 dnl Permission is hereby granted, free of charge, to any person obtaining a  *
5 dnl copy of this software and associated documentation files (the            *
6 dnl "Software"), to deal in the Software without restriction, including      *
7 dnl without limitation the rights to use, copy, modify, merge, publish,      *
8 dnl distribute, distribute with modifications, sublicense, and/or sell       *
9 dnl copies of the Software, and to permit persons to whom the Software is    *
10 dnl furnished to do so, subject to the following conditions:                 *
11 dnl                                                                          *
12 dnl The above copyright notice and this permission notice shall be included  *
13 dnl in all copies or substantial portions of the Software.                   *
14 dnl                                                                          *
15 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 dnl                                                                          *
23 dnl Except as contained in this notice, the name(s) of the above copyright   *
24 dnl holders shall not be used in advertising or otherwise to promote the     *
25 dnl sale, use or other dealings in this Software without prior written       *
26 dnl authorization.                                                           *
27 dnl***************************************************************************
28 dnl
29 dnl Author: Thomas E. Dickey 1995-on
30 dnl
31 dnl $Id: aclocal.m4,v 1.880 2019/09/07 23:00:39 tom Exp $
32 dnl Macros used in NCURSES auto-configuration script.
33 dnl
34 dnl These macros are maintained separately from NCURSES.  The copyright on
35 dnl this file applies to the aggregation of macros and does not affect use of
36 dnl these macros in other applications.
37 dnl
38 dnl See https://invisible-island.net/autoconf/ for additional information.
39 dnl
40 dnl ---------------------------------------------------------------------------
41 dnl ---------------------------------------------------------------------------
42 dnl AM_LANGINFO_CODESET version: 4 updated: 2015/04/18 08:56:57
43 dnl -------------------
44 dnl Inserted as requested by gettext 0.10.40
45 dnl File from /usr/share/aclocal
46 dnl codeset.m4
47 dnl ====================
48 dnl serial AM1
49 dnl
50 dnl From Bruno Haible.
51 AC_DEFUN([AM_LANGINFO_CODESET],
52 [
53 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
54         [AC_TRY_LINK([#include <langinfo.h>],
55         [char* cs = nl_langinfo(CODESET);],
56         am_cv_langinfo_codeset=yes,
57         am_cv_langinfo_codeset=no)
58         ])
59         if test $am_cv_langinfo_codeset = yes; then
60                 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
61                 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
62         fi
63 ])dnl
64 dnl ---------------------------------------------------------------------------
65 dnl CF_ABI_DEFAULTS version: 2 updated: 2015/06/06 13:49:58
66 dnl ---------------
67 dnl Provide configure-script defaults for different ncurses ABIs.
68 AC_DEFUN([CF_ABI_DEFAULTS],[
69 AC_REQUIRE([CF_NCURSES_WITH_ABI_VERSION])
70 case x$cf_cv_abi_version in
71 (x[[6789]])
72         cf_dft_ext_colors=yes
73         cf_dft_ext_const=yes
74         cf_dft_ext_mouse=yes
75         cf_dft_ext_putwin=yes
76         cf_dft_ext_spfuncs=yes
77         cf_dft_filter_syms=yes
78         cf_dft_chtype=uint32_t
79         cf_dft_mmask_t=uint32_t
80         cf_dft_interop=yes
81         cf_dft_tparm_arg=intptr_t
82         cf_dft_with_lp64=yes
83         ;;
84 (*)
85         cf_dft_ext_colors=no
86         cf_dft_ext_const=no
87         cf_dft_ext_mouse=no
88         cf_dft_ext_putwin=no
89         cf_dft_ext_spfuncs=no
90         cf_dft_filter_syms=no
91         cf_dft_chtype=auto
92         cf_dft_mmask_t=auto
93         cf_dft_interop=no
94         cf_dft_tparm_arg=long
95         cf_dft_with_lp64=no
96         ;;
97 esac
98 ])dnl
99 dnl ---------------------------------------------------------------------------
100 dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
101 dnl ------------------
102 dnl Conditionally generate script according to whether we're using a given autoconf.
103 dnl
104 dnl $1 = version to compare against
105 dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
106 dnl $3 = code to use if AC_ACVERSION is older than $1.
107 define([CF_ACVERSION_CHECK],
108 [
109 ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
110 ifdef([m4_version_compare],
111 [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
112 [CF_ACVERSION_COMPARE(
113 AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
114 AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
115 dnl ---------------------------------------------------------------------------
116 dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
117 dnl --------------------
118 dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
119 dnl                      MAJOR2, MINOR2, TERNARY2,
120 dnl                      PRINTABLE2, not FOUND, FOUND)
121 define([CF_ACVERSION_COMPARE],
122 [ifelse(builtin([eval], [$2 < $5]), 1,
123 [ifelse([$8], , ,[$8])],
124 [ifelse([$9], , ,[$9])])])dnl
125 dnl ---------------------------------------------------------------------------
126 dnl CF_ADA_INCLUDE_DIRS version: 8 updated: 2013/10/14 04:24:07
127 dnl -------------------
128 dnl Construct the list of include-options for the C programs in the Ada95
129 dnl binding.
130 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
131 [
132 ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS"
133 if test "$srcdir" != "."; then
134         ACPPFLAGS="-I\${srcdir}/../../include $ACPPFLAGS"
135 fi
136 if test "$GCC" != yes; then
137         ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
138 elif test "$includedir" != "/usr/include"; then
139         if test "$includedir" = '${prefix}/include' ; then
140                 if test x$prefix != x/usr ; then
141                         ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
142                 fi
143         else
144                 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
145         fi
146 fi
147 AC_SUBST(ACPPFLAGS)
148 ])dnl
149 dnl ---------------------------------------------------------------------------
150 dnl CF_ADD_ADAFLAGS version: 1 updated: 2010/06/19 15:22:18
151 dnl ---------------
152 dnl Add to $ADAFLAGS, which is substituted into makefile and scripts.
153 AC_DEFUN([CF_ADD_ADAFLAGS],[
154         ADAFLAGS="$ADAFLAGS $1"
155         AC_SUBST(ADAFLAGS)
156 ])dnl
157 dnl ---------------------------------------------------------------------------
158 dnl CF_ADD_CFLAGS version: 13 updated: 2017/02/25 18:57:40
159 dnl -------------
160 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
161 dnl The second parameter if given makes this macro verbose.
162 dnl
163 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
164 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
165 dnl confused by the quotes (which require backslashes to keep them usable).
166 AC_DEFUN([CF_ADD_CFLAGS],
167 [
168 cf_fix_cppflags=no
169 cf_new_cflags=
170 cf_new_cppflags=
171 cf_new_extra_cppflags=
172
173 for cf_add_cflags in $1
174 do
175 case $cf_fix_cppflags in
176 (no)
177         case $cf_add_cflags in
178         (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C)
179                 case $cf_add_cflags in
180                 (-D*)
181                         cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
182
183                         test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
184                                 && test -z "${cf_tst_cflags}" \
185                                 && cf_fix_cppflags=yes
186
187                         if test $cf_fix_cppflags = yes ; then
188                                 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
189                                 continue
190                         elif test "${cf_tst_cflags}" = "\"'" ; then
191                                 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
192                                 continue
193                         fi
194                         ;;
195                 esac
196                 case "$CPPFLAGS" in
197                 (*$cf_add_cflags)
198                         ;;
199                 (*)
200                         case $cf_add_cflags in
201                         (-D*)
202                                 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
203                                 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
204                                 ;;
205                         esac
206                         CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags)
207                         ;;
208                 esac
209                 ;;
210         (*)
211                 CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags)
212                 ;;
213         esac
214         ;;
215 (yes)
216         CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
217
218         cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
219
220         test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
221                 && test -z "${cf_tst_cflags}" \
222                 && cf_fix_cppflags=no
223         ;;
224 esac
225 done
226
227 if test -n "$cf_new_cflags" ; then
228         ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
229         CF_APPEND_TEXT(CFLAGS,$cf_new_cflags)
230 fi
231
232 if test -n "$cf_new_cppflags" ; then
233         ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
234         CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags)
235 fi
236
237 if test -n "$cf_new_extra_cppflags" ; then
238         ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
239         CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags)
240 fi
241
242 AC_SUBST(EXTRA_CPPFLAGS)
243
244 ])dnl
245 dnl ---------------------------------------------------------------------------
246 dnl CF_ADD_INCDIR version: 15 updated: 2018/06/20 20:23:13
247 dnl -------------
248 dnl Add an include-directory to $CPPFLAGS.  Don't add /usr/include, since it's
249 dnl redundant.  We don't normally need to add -I/usr/local/include for gcc,
250 dnl but old versions (and some misinstalled ones) need that.  To make things
251 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
252 dnl the include-path).
253 AC_DEFUN([CF_ADD_INCDIR],
254 [
255 if test -n "$1" ; then
256   for cf_add_incdir in $1
257   do
258         while test $cf_add_incdir != /usr/include
259         do
260           if test -d $cf_add_incdir
261           then
262                 cf_have_incdir=no
263                 if test -n "$CFLAGS$CPPFLAGS" ; then
264                   # a loop is needed to ensure we can add subdirs of existing dirs
265                   for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
266                         if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
267                           cf_have_incdir=yes; break
268                         fi
269                   done
270                 fi
271
272                 if test "$cf_have_incdir" = no ; then
273                   if test "$cf_add_incdir" = /usr/local/include ; then
274                         if test "$GCC" = yes
275                         then
276                           cf_save_CPPFLAGS=$CPPFLAGS
277                           CF_APPEND_TEXT(CPPFLAGS,-I$cf_add_incdir)
278                           AC_TRY_COMPILE([#include <stdio.h>],
279                                   [printf("Hello")],
280                                   [],
281                                   [cf_have_incdir=yes])
282                           CPPFLAGS=$cf_save_CPPFLAGS
283                         fi
284                   fi
285                 fi
286
287                 if test "$cf_have_incdir" = no ; then
288                   CF_VERBOSE(adding $cf_add_incdir to include-path)
289                   ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
290
291                   cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
292                   test "$cf_top_incdir" = "$cf_add_incdir" && break
293                   cf_add_incdir="$cf_top_incdir"
294                 else
295                   break
296                 fi
297           else
298                 break
299           fi
300         done
301   done
302 fi
303 ])dnl
304 dnl ---------------------------------------------------------------------------
305 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
306 dnl ----------
307 dnl Add a library, used to enforce consistency.
308 dnl
309 dnl $1 = library to add, without the "-l"
310 dnl $2 = variable to update (default $LIBS)
311 AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
312 dnl ---------------------------------------------------------------------------
313 dnl CF_ADD_LIBDIR version: 10 updated: 2015/04/18 08:56:57
314 dnl -------------
315 dnl     Adds to the library-path
316 dnl
317 dnl     Some machines have trouble with multiple -L options.
318 dnl
319 dnl $1 is the (list of) directory(s) to add
320 dnl $2 is the optional name of the variable to update (default LDFLAGS)
321 dnl
322 AC_DEFUN([CF_ADD_LIBDIR],
323 [
324 if test -n "$1" ; then
325         for cf_add_libdir in $1
326         do
327                 if test $cf_add_libdir = /usr/lib ; then
328                         :
329                 elif test -d $cf_add_libdir
330                 then
331                         cf_have_libdir=no
332                         if test -n "$LDFLAGS$LIBS" ; then
333                                 # a loop is needed to ensure we can add subdirs of existing dirs
334                                 for cf_test_libdir in $LDFLAGS $LIBS ; do
335                                         if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
336                                                 cf_have_libdir=yes; break
337                                         fi
338                                 done
339                         fi
340                         if test "$cf_have_libdir" = no ; then
341                                 CF_VERBOSE(adding $cf_add_libdir to library-path)
342                                 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
343                         fi
344                 fi
345         done
346 fi
347 ])dnl
348 dnl ---------------------------------------------------------------------------
349 dnl CF_ADD_LIBS version: 2 updated: 2014/07/13 14:33:27
350 dnl -----------
351 dnl Add one or more libraries, used to enforce consistency.  Libraries are
352 dnl prepended to an existing list, since their dependencies are assumed to
353 dnl already exist in the list.
354 dnl
355 dnl $1 = libraries to add, with the "-l", etc.
356 dnl $2 = variable to update (default $LIBS)
357 AC_DEFUN([CF_ADD_LIBS],[
358 cf_add_libs="$1"
359 # Filter out duplicates - this happens with badly-designed ".pc" files...
360 for cf_add_1lib in [$]ifelse($2,,LIBS,[$2])
361 do
362         for cf_add_2lib in $cf_add_libs
363         do
364                 if test "x$cf_add_1lib" = "x$cf_add_2lib"
365                 then
366                         cf_add_1lib=
367                         break
368                 fi
369         done
370         test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib"
371 done
372 ifelse($2,,LIBS,[$2])="$cf_add_libs"
373 ])dnl
374 dnl ---------------------------------------------------------------------------
375 dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05
376 dnl ------------------
377 dnl Append to a search-list for a nonstandard header/lib-file
378 dnl     $1 = the variable to return as result
379 dnl     $2 = the package name
380 dnl     $3 = the subdirectory, e.g., bin, include or lib
381 dnl $4 = the directory under which we will test for subdirectories
382 dnl $5 = a directory that we do not want $4 to match
383 AC_DEFUN([CF_ADD_SUBDIR_PATH],
384 [
385 test "x$4" != "x$5" && \
386 test -d "$4" && \
387 ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) {
388         test -n "$verbose" && echo "    ... testing for $3-directories under $4"
389         test -d $4/$3 &&          $1="[$]$1 $4/$3"
390         test -d $4/$3/$2 &&       $1="[$]$1 $4/$3/$2"
391         test -d $4/$3/$2/$3 &&    $1="[$]$1 $4/$3/$2/$3"
392         test -d $4/$2/$3 &&       $1="[$]$1 $4/$2/$3"
393         test -d $4/$2/$3/$2 &&    $1="[$]$1 $4/$2/$3/$2"
394 }
395 ])dnl
396 dnl ---------------------------------------------------------------------------
397 dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55
398 dnl --------------
399 dnl use this macro for appending text without introducing an extra blank at
400 dnl the beginning
401 define([CF_APPEND_TEXT],
402 [
403         test -n "[$]$1" && $1="[$]$1 "
404         $1="[$]{$1}$2"
405 ])dnl
406 dnl ---------------------------------------------------------------------------
407 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
408 dnl --------------
409 dnl Allow user to disable a normally-on option.
410 AC_DEFUN([CF_ARG_DISABLE],
411 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
412 dnl ---------------------------------------------------------------------------
413 dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
414 dnl -------------
415 dnl Allow user to enable a normally-off option.
416 AC_DEFUN([CF_ARG_ENABLE],
417 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
418 dnl ---------------------------------------------------------------------------
419 dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14
420 dnl -------------
421 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
422 dnl values.
423 dnl
424 dnl Parameters:
425 dnl $1 = option name
426 dnl $2 = help-string
427 dnl $3 = action to perform if option is not default
428 dnl $4 = action if perform if option is default
429 dnl $5 = default option value (either 'yes' or 'no')
430 AC_DEFUN([CF_ARG_OPTION],
431 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
432         if test "$enableval" != "$5" ; then
433 ifelse([$3],,[    :]dnl
434 ,[    $3]) ifelse([$4],,,[
435         else
436                 $4])
437         fi],[enableval=$5 ifelse([$4],,,[
438         $4
439 ])dnl
440 ])])dnl
441 dnl ---------------------------------------------------------------------------
442 dnl CF_AR_FLAGS version: 6 updated: 2015/10/10 15:25:05
443 dnl -----------
444 dnl Check for suitable "ar" (archiver) options for updating an archive.
445 dnl
446 dnl In particular, handle some obsolete cases where the "-" might be omitted,
447 dnl as well as a workaround for breakage of make's archive rules by the GNU
448 dnl binutils "ar" program.
449 AC_DEFUN([CF_AR_FLAGS],[
450 AC_REQUIRE([CF_PROG_AR])
451
452 AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[
453         cf_cv_ar_flags=unknown
454         for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv
455         do
456
457                 # check if $ARFLAGS already contains this choice
458                 if test "x$ARFLAGS" != "x" ; then
459                         cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"`
460                         if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then
461                                 cf_cv_ar_flags=
462                                 break
463                         fi
464                 fi
465
466                 rm -f conftest.$ac_cv_objext
467                 rm -f conftest.a
468
469                 cat >conftest.$ac_ext <<EOF
470 #line __oline__ "configure"
471 int     testdata[[3]] = { 123, 456, 789 };
472 EOF
473                 if AC_TRY_EVAL(ac_compile) ; then
474                         echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC
475                         $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null
476                         if test -f conftest.a ; then
477                                 cf_cv_ar_flags=$cf_ar_flags
478                                 break
479                         fi
480                 else
481                         CF_VERBOSE(cannot compile test-program)
482                         break
483                 fi
484         done
485         rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext
486 ])
487
488 if test -n "$ARFLAGS" ; then
489         if test -n "$cf_cv_ar_flags" ; then
490                 ARFLAGS="$ARFLAGS $cf_cv_ar_flags"
491         fi
492 else
493         ARFLAGS=$cf_cv_ar_flags
494 fi
495
496 AC_SUBST(ARFLAGS)
497 ])
498 dnl ---------------------------------------------------------------------------
499 dnl CF_AWK_BIG_PRINTF version: 5 updated: 2015/04/17 21:13:04
500 dnl -----------------
501 dnl Check if awk can handle big strings using printf.  Some older versions of
502 dnl awk choke on large strings passed via "%s".
503 dnl
504 dnl $1 = desired string size
505 dnl $2 = variable to set with result
506 AC_DEFUN([CF_AWK_BIG_PRINTF],
507 [
508         case x$AWK in
509         (x)
510                 eval $2=no
511                 ;;
512         (*)
513                 if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' 2>/dev/null \
514                         | $AWK '{ printf "%d\n", length([$]0); }' 2>/dev/null | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
515                         eval $2=yes
516                 else
517                         eval $2=no
518                 fi
519                 ;;
520         esac
521 ])dnl
522 dnl ---------------------------------------------------------------------------
523 dnl CF_BOOL_DECL version: 8 updated: 2004/01/30 15:51:18
524 dnl ------------
525 dnl Test if 'bool' is a builtin type in the configured C++ compiler.  Some
526 dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
527 dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
528 dnl
529 dnl Treat the configuration-variable specially here, since we're directly
530 dnl substituting its value (i.e., 1/0).
531 dnl
532 dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool
533 AC_DEFUN([CF_BOOL_DECL],
534 [
535 AC_MSG_CHECKING(if we should include stdbool.h)
536
537 AC_CACHE_VAL(cf_cv_header_stdbool_h,[
538         AC_TRY_COMPILE([],[bool foo = false],
539                 [cf_cv_header_stdbool_h=0],
540                 [AC_TRY_COMPILE([
541 #ifndef __BEOS__
542 #include <stdbool.h>
543 #endif
544 ],[bool foo = false],
545                         [cf_cv_header_stdbool_h=1],
546                         [cf_cv_header_stdbool_h=0])])])
547
548 if test "$cf_cv_header_stdbool_h" = 1
549 then    AC_MSG_RESULT(yes)
550 else    AC_MSG_RESULT(no)
551 fi
552
553 AC_MSG_CHECKING([for builtin bool type])
554
555 AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
556         AC_TRY_COMPILE([
557 #include <stdio.h>
558 #include <sys/types.h>
559 ],[bool x = false],
560                 [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
561                 [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
562         ])
563
564 if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
565 then    AC_MSG_RESULT(yes)
566 else    AC_MSG_RESULT(no)
567 fi
568 ])dnl
569 dnl ---------------------------------------------------------------------------
570 dnl CF_BOOL_SIZE version: 15 updated: 2017/01/21 11:06:25
571 dnl ------------
572 dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
573 dnl Don't bother looking for bool.h, since it's been deprecated.
574 dnl
575 dnl If the current compiler is C rather than C++, we get the bool definition
576 dnl from <stdbool.h>.
577 AC_DEFUN([CF_BOOL_SIZE],
578 [
579 AC_MSG_CHECKING([for size of bool])
580 AC_CACHE_VAL(cf_cv_type_of_bool,[
581         rm -f cf_test.out
582         AC_TRY_RUN([
583 #include <stdlib.h>
584 #include <stdio.h>
585
586 #if defined(__cplusplus)
587
588 #ifdef HAVE_GXX_BUILTIN_H
589 #include <g++/builtin.h>
590 #elif HAVE_GPP_BUILTIN_H
591 #include <gpp/builtin.h>
592 #elif HAVE_BUILTIN_H
593 #include <builtin.h>
594 #endif
595
596 #else
597
598 #if $cf_cv_header_stdbool_h
599 #include <stdbool.h>
600 #endif
601
602 #endif
603
604 int main(void)
605 {
606         FILE *fp = fopen("cf_test.out", "w");
607         if (fp != 0) {
608                 bool x = true;
609                 if ((bool)(-x) >= 0)
610                         fputs("unsigned ", fp);
611                 if (sizeof(x) == sizeof(int))       fputs("int",  fp);
612                 else if (sizeof(x) == sizeof(char)) fputs("char", fp);
613                 else if (sizeof(x) == sizeof(short))fputs("short",fp);
614                 else if (sizeof(x) == sizeof(long)) fputs("long", fp);
615                 fclose(fp);
616         }
617         ${cf_cv_main_return:-return}(0);
618 }
619                 ],
620                 [cf_cv_type_of_bool=`cat cf_test.out`
621                  if test -z "$cf_cv_type_of_bool"; then
622                    cf_cv_type_of_bool=unknown
623                  fi],
624                 [cf_cv_type_of_bool=unknown],
625                 [cf_cv_type_of_bool=unknown])
626         ])
627         rm -f cf_test.out
628 AC_MSG_RESULT($cf_cv_type_of_bool)
629 if test "$cf_cv_type_of_bool" = unknown ; then
630         case .$NCURSES_BOOL in
631         (.auto|.) NCURSES_BOOL=unsigned;;
632         esac
633         AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool)
634         cf_cv_type_of_bool=$NCURSES_BOOL
635 fi
636 ])dnl
637 dnl ---------------------------------------------------------------------------
638 dnl CF_BUILD_CC version: 8 updated: 2018/01/04 20:31:04
639 dnl -----------
640 dnl If we're cross-compiling, allow the user to override the tools and their
641 dnl options.  The configure script is oriented toward identifying the host
642 dnl compiler, etc., but we need a build compiler to generate parts of the
643 dnl source.
644 dnl
645 dnl $1 = default for $CPPFLAGS
646 dnl $2 = default for $LIBS
647 AC_DEFUN([CF_BUILD_CC],[
648 CF_ACVERSION_CHECK(2.52,,
649         [AC_REQUIRE([CF_PROG_EXT])])
650 if test "$cross_compiling" = yes ; then
651
652         # defaults that we might want to override
653         : ${BUILD_CFLAGS:=''}
654         : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
655         : ${BUILD_LDFLAGS:=''}
656         : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
657         : ${BUILD_EXEEXT:='$x'}
658         : ${BUILD_OBJEXT:='o'}
659
660         AC_ARG_WITH(build-cc,
661                 [  --with-build-cc=XXX     the build C compiler ($BUILD_CC)],
662                 [BUILD_CC="$withval"],
663                 [AC_CHECK_PROGS(BUILD_CC, [gcc clang c99 c89 cc cl],none)])
664         AC_MSG_CHECKING(for native build C compiler)
665         AC_MSG_RESULT($BUILD_CC)
666
667         AC_MSG_CHECKING(for native build C preprocessor)
668         AC_ARG_WITH(build-cpp,
669                 [  --with-build-cpp=XXX    the build C preprocessor ($BUILD_CPP)],
670                 [BUILD_CPP="$withval"],
671                 [BUILD_CPP='${BUILD_CC} -E'])
672         AC_MSG_RESULT($BUILD_CPP)
673
674         AC_MSG_CHECKING(for native build C flags)
675         AC_ARG_WITH(build-cflags,
676                 [  --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
677                 [BUILD_CFLAGS="$withval"])
678         AC_MSG_RESULT($BUILD_CFLAGS)
679
680         AC_MSG_CHECKING(for native build C preprocessor-flags)
681         AC_ARG_WITH(build-cppflags,
682                 [  --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
683                 [BUILD_CPPFLAGS="$withval"])
684         AC_MSG_RESULT($BUILD_CPPFLAGS)
685
686         AC_MSG_CHECKING(for native build linker-flags)
687         AC_ARG_WITH(build-ldflags,
688                 [  --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
689                 [BUILD_LDFLAGS="$withval"])
690         AC_MSG_RESULT($BUILD_LDFLAGS)
691
692         AC_MSG_CHECKING(for native build linker-libraries)
693         AC_ARG_WITH(build-libs,
694                 [  --with-build-libs=XXX   the build libraries (${BUILD_LIBS})],
695                 [BUILD_LIBS="$withval"])
696         AC_MSG_RESULT($BUILD_LIBS)
697
698         # this assumes we're on Unix.
699         BUILD_EXEEXT=
700         BUILD_OBJEXT=o
701
702         : ${BUILD_CC:='${CC}'}
703
704         if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
705                 AC_MSG_ERROR([Cross-build requires two compilers.
706 Use --with-build-cc to specify the native compiler.])
707         fi
708
709 else
710         : ${BUILD_CC:='${CC}'}
711         : ${BUILD_CPP:='${CPP}'}
712         : ${BUILD_CFLAGS:='${CFLAGS}'}
713         : ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
714         : ${BUILD_LDFLAGS:='${LDFLAGS}'}
715         : ${BUILD_LIBS:='${LIBS}'}
716         : ${BUILD_EXEEXT:='$x'}
717         : ${BUILD_OBJEXT:='o'}
718 fi
719
720 AC_SUBST(BUILD_CC)
721 AC_SUBST(BUILD_CPP)
722 AC_SUBST(BUILD_CFLAGS)
723 AC_SUBST(BUILD_CPPFLAGS)
724 AC_SUBST(BUILD_LDFLAGS)
725 AC_SUBST(BUILD_LIBS)
726 AC_SUBST(BUILD_EXEEXT)
727 AC_SUBST(BUILD_OBJEXT)
728 ])dnl
729 dnl ---------------------------------------------------------------------------
730 dnl CF_CC_ENV_FLAGS version: 9 updated: 2018/07/29 18:03:26
731 dnl ---------------
732 dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
733 dnl into CC.  This will not help with broken scripts that wrap the compiler
734 dnl with options, but eliminates a more common category of user confusion.
735 dnl
736 dnl In particular, it addresses the problem of being able to run the C
737 dnl preprocessor in a consistent manner.
738 dnl
739 dnl Caveat: this also disallows blanks in the pathname for the compiler, but
740 dnl the nuisance of having inconsistent settings for compiler and preprocessor
741 dnl outweighs that limitation.
742 AC_DEFUN([CF_CC_ENV_FLAGS],
743 [
744 # This should have been defined by AC_PROG_CC
745 : ${CC:=cc}
746
747 AC_MSG_CHECKING(\$CFLAGS variable)
748 case "x$CFLAGS" in
749 (*-[[IUD]]*)
750         AC_MSG_RESULT(broken)
751         AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options)
752         cf_flags="$CFLAGS"
753         CFLAGS=
754         for cf_arg in $cf_flags
755         do
756                 CF_ADD_CFLAGS($cf_arg)
757         done
758         ;;
759 (*)
760         AC_MSG_RESULT(ok)
761         ;;
762 esac
763
764 AC_MSG_CHECKING(\$CC variable)
765 case "$CC" in
766 (*[[\ \ ]]-*)
767         AC_MSG_RESULT(broken)
768         AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options)
769         # humor him...
770         cf_prog=`echo "$CC" | sed -e 's/        / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'`
771         cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'`
772         CC="$cf_prog"
773         for cf_arg in $cf_flags
774         do
775                 case "x$cf_arg" in
776                 (x-[[IUDfgOW]]*)
777                         CF_ADD_CFLAGS($cf_arg)
778                         ;;
779                 (*)
780                         CC="$CC $cf_arg"
781                         ;;
782                 esac
783         done
784         CF_VERBOSE(resulting CC: '$CC')
785         CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
786         CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
787         ;;
788 (*)
789         AC_MSG_RESULT(ok)
790         ;;
791 esac
792 ])dnl
793 dnl ---------------------------------------------------------------------------
794 dnl CF_CFG_DEFAULTS version: 11 updated: 2015/04/17 21:13:04
795 dnl ---------------
796 dnl Determine the default configuration into which we'll install ncurses.  This
797 dnl can be overridden by the user's command-line options.  There's two items to
798 dnl look for:
799 dnl     1. the prefix (e.g., /usr)
800 dnl     2. the header files (e.g., /usr/include/ncurses)
801 dnl We'll look for a previous installation of ncurses and use the same defaults.
802 dnl
803 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
804 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
805 dnl programs from a vendor's.
806 AC_DEFUN([CF_CFG_DEFAULTS],
807 [
808 AC_MSG_CHECKING(for prefix)
809 if test "x$prefix" = "xNONE" ; then
810         case "$cf_cv_system_name" in
811                 # non-vendor systems don't have a conflict
812         (openbsd*|freebsd*|mirbsd*|linux*|cygwin*|msys*|k*bsd*-gnu|mingw*)
813                 prefix=/usr
814                 ;;
815         (*)     prefix=$ac_default_prefix
816                 ;;
817         esac
818 fi
819 AC_MSG_RESULT($prefix)
820
821 if test "x$prefix" = "xNONE" ; then
822 AC_MSG_CHECKING(for default include-directory)
823 test -n "$verbose" && echo 1>&AC_FD_MSG
824 for cf_symbol in \
825         $includedir \
826         $includedir/ncurses \
827         $prefix/include \
828         $prefix/include/ncurses \
829         /usr/local/include \
830         /usr/local/include/ncurses \
831         /usr/include \
832         /usr/include/ncurses
833 do
834         cf_dir=`eval echo $cf_symbol`
835         if test -f $cf_dir/curses.h ; then
836         if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
837                 includedir="$cf_symbol"
838                 test -n "$verbose"  && echo $ac_n "     found " 1>&AC_FD_MSG
839                 break
840         fi
841         fi
842         test -n "$verbose"  && echo "   tested $cf_dir" 1>&AC_FD_MSG
843 done
844 AC_MSG_RESULT($includedir)
845 fi
846 ])dnl
847 dnl ---------------------------------------------------------------------------
848 dnl CF_CGETENT version: 6 updated: 2017/01/21 11:06:25
849 dnl ----------
850 dnl Check if the terminal-capability database functions are available.  If not,
851 dnl ncurses has a much-reduced version.
852 AC_DEFUN([CF_CGETENT],[
853 AC_CACHE_CHECK(for terminal-capability database functions,cf_cv_cgetent,[
854 AC_TRY_LINK([
855 #include <stdlib.h>],[
856         char temp[128];
857         char *buf = temp;
858         char *db_array = temp;
859         cgetent(&buf, &db_array, "vt100");
860         cgetcap(buf, "tc", '=');
861         cgetmatch(buf, "tc");
862         ],
863         [cf_cv_cgetent=yes],
864         [cf_cv_cgetent=no])
865 ])
866
867 if test "$cf_cv_cgetent" = yes
868 then
869         AC_DEFINE(HAVE_BSD_CGETENT,1,[Define to 1 if we have BSD cgetent])
870 AC_CACHE_CHECK(if cgetent uses const parameter,cf_cv_cgetent_const,[
871 AC_TRY_LINK([
872 #pragma GCC diagnostic error "-Wincompatible-pointer-types-discards-qualifiers"
873 #include <stdlib.h>],[
874         char temp[128];
875         char *buf = temp;
876 #ifndef _NETBSD_SOURCE                  /* given, since April 2004 in stdlib.h */
877         const char *db_array = temp;
878         cgetent(&buf, &db_array, "vt100");
879 #endif
880         cgetcap(buf, "tc", '=');
881         cgetmatch(buf, "tc");
882         ],
883         [cf_cv_cgetent_const=yes],
884         [cf_cv_cgetent_const=no])
885 ])
886         if test "$cf_cv_cgetent_const" = yes
887         then
888                 AC_DEFINE_UNQUOTED(CGETENT_CONST,const,[Define to const if needed for some BSD cgetent variations])
889         fi
890 fi
891 ])dnl
892 dnl ---------------------------------------------------------------------------
893 dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
894 dnl --------------
895 dnl Check if we're accidentally using a cache from a different machine.
896 dnl Derive the system name, as a check for reusing the autoconf cache.
897 dnl
898 dnl If we've packaged config.guess and config.sub, run that (since it does a
899 dnl better job than uname).  Normally we'll use AC_CANONICAL_HOST, but allow
900 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
901 dnl which is useful in cross-compiles.
902 dnl
903 dnl Note: we would use $ac_config_sub, but that is one of the places where
904 dnl autoconf 2.5x broke compatibility with autoconf 2.13
905 AC_DEFUN([CF_CHECK_CACHE],
906 [
907 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
908         ifelse([$1],,[AC_CANONICAL_HOST],[$1])
909         system_name="$host_os"
910 else
911         system_name="`(uname -s -r) 2>/dev/null`"
912         if test -z "$system_name" ; then
913                 system_name="`(hostname) 2>/dev/null`"
914         fi
915 fi
916 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
917 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
918
919 test -z "$system_name" && system_name="$cf_cv_system_name"
920 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
921
922 if test ".$system_name" != ".$cf_cv_system_name" ; then
923         AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
924         AC_MSG_ERROR("Please remove config.cache and try again.")
925 fi
926 ])dnl
927 dnl ---------------------------------------------------------------------------
928 dnl CF_CHECK_ENVIRON version: 3 updated: 2010/05/26 16:44:57
929 dnl ----------------
930 dnl Check for data that is usually declared in <unistd.h>, e.g., the 'environ'
931 dnl variable.  Define a DECL_xxx symbol if we must declare it ourselves.
932 dnl
933 dnl $1 = the name to check
934 dnl $2 = the assumed type
935 AC_DEFUN([CF_CHECK_ENVIRON],
936 [
937 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
938     AC_TRY_COMPILE([
939 #ifdef HAVE_STDLIB_H
940 #include <stdlib.h>
941 #endif
942 #include <unistd.h> ],
943     ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1,
944     [cf_cv_dcl_$1=yes],
945     [cf_cv_dcl_$1=no])
946 ])
947
948 if test "$cf_cv_dcl_$1" = no ; then
949     CF_UPPER(cf_result,decl_$1)
950     AC_DEFINE_UNQUOTED($cf_result)
951 fi
952
953 # It's possible (for near-UNIX clones) that the data doesn't exist
954 CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
955 ])dnl
956 dnl ---------------------------------------------------------------------------
957 dnl CF_CHECK_ERRNO version: 12 updated: 2015/04/18 08:56:57
958 dnl --------------
959 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
960 dnl the 'errno' variable.  Define a DECL_xxx symbol if we must declare it
961 dnl ourselves.
962 dnl
963 dnl $1 = the name to check
964 dnl $2 = the assumed type
965 AC_DEFUN([CF_CHECK_ERRNO],
966 [
967 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
968         AC_TRY_COMPILE([
969 #ifdef HAVE_STDLIB_H
970 #include <stdlib.h>
971 #endif
972 #include <stdio.h>
973 #include <sys/types.h>
974 #include <errno.h> ],
975         ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1,
976         [cf_cv_dcl_$1=yes],
977         [cf_cv_dcl_$1=no])
978 ])
979
980 if test "$cf_cv_dcl_$1" = no ; then
981         CF_UPPER(cf_result,decl_$1)
982         AC_DEFINE_UNQUOTED($cf_result)
983 fi
984
985 # It's possible (for near-UNIX clones) that the data doesn't exist
986 CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
987 ])dnl
988 dnl ---------------------------------------------------------------------------
989 dnl CF_CHECK_EXTERN_DATA version: 4 updated: 2015/04/18 08:56:57
990 dnl --------------------
991 dnl Check for existence of external data in the current set of libraries.  If
992 dnl we can modify it, it's real enough.
993 dnl $1 = the name to check
994 dnl $2 = its type
995 AC_DEFUN([CF_CHECK_EXTERN_DATA],
996 [
997 AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
998         AC_TRY_LINK([
999 #undef $1
1000 extern $2 $1;
1001 ],
1002         [$1 = 2],
1003         [cf_cv_have_$1=yes],
1004         [cf_cv_have_$1=no])
1005 ])
1006
1007 if test "$cf_cv_have_$1" = yes ; then
1008         CF_UPPER(cf_result,have_$1)
1009         AC_DEFINE_UNQUOTED($cf_result)
1010 fi
1011
1012 ])dnl
1013 dnl ---------------------------------------------------------------------------
1014 dnl CF_CHECK_GETENV version: 1 updated: 2019/06/23 15:28:15
1015 dnl ---------------
1016 dnl Check if repeated getenv calls return the same pointer, e.g., it does not
1017 dnl discard the previous pointer when returning a new one.
1018 AC_DEFUN([CF_CHECK_GETENV],
1019 [
1020 AC_REQUIRE([CF_CHECK_ENVIRON])
1021 AC_CHECK_FUNC( getenv, ,, AC_MSG_ERROR(getenv not found) )
1022 AC_CHECK_FUNCS( putenv setenv strdup )
1023 AC_CACHE_CHECK(if getenv returns consistent values,cf_cv_consistent_getenv,[
1024 AC_TRY_RUN([
1025 #include <stdlib.h>
1026 #include <unistd.h>
1027 #include <stdio.h>
1028 #include <string.h>
1029 #include <sys/types.h>
1030
1031 #if defined(HAVE_ENVIRON) && defined(DECL_ENVIRON) && !defined(environ)
1032 extern char **environ;  /* POSIX, but some systems are not... */
1033 #endif
1034
1035 #if defined(HAVE_STRDUP)
1036 #define str_alloc(s) strdup(s)
1037 #else
1038 #define str_alloc(s) strcpy(malloc(strlen(s) + 1, s))
1039 #endif
1040
1041 static void set_value(const char *name, const char *value)
1042 {
1043 #if defined(HAVE_SETENV)
1044         setenv(name, value, 1);
1045 #elif defined(HAVE_PUTENV)
1046         char buffer[1024];
1047         sprintf(buffer, "%s=%s", name, value);
1048         putenv(str_alloc(buffer));
1049 #else
1050 #error neither putenv/setenv found
1051 #endif
1052 }
1053 int main(void)
1054 {
1055         int pass;
1056         size_t numenv, limit, j;
1057         char **mynames;
1058         char **myvalues;
1059         char **mypointer;
1060         char *equals;
1061         for (numenv = 0; environ[numenv]; ++numenv) ;
1062         limit = numenv + 10;
1063         mynames = (char **) calloc(limit + 1, sizeof(char *));
1064         myvalues = (char **) calloc(limit + 1, sizeof(char *));
1065         mypointer = (char **) calloc(limit + 1, sizeof(char *));
1066 #if defined(HAVE_ENVIRON)
1067         for (j = 0; environ[j]; ++j) {
1068                 mynames[j] = str_alloc(environ[j]);
1069                 equals = strchr(mynames[j], '=');
1070                 if (equals != 0) {
1071                         *equals++ = '\0';
1072                         myvalues[j] = str_alloc(equals);
1073                 } else {
1074                         myvalues[j] = str_alloc("");
1075                 }
1076         }
1077 #endif
1078         for (j = numenv; j < limit; ++j) {
1079                 char name[80];
1080                 char value[80];
1081                 size_t found;
1082                 size_t k = 0;
1083                 do {
1084                         size_t jk;
1085                         found = 0;
1086                         sprintf(name, "TERM%lu", (unsigned long) k);
1087                         for (jk = 0; jk < j; ++jk) {
1088                                 if (!strcmp(name, mynames[jk])) {
1089                                         found = 1;
1090                                         ++k;
1091                                         break;
1092                                 }
1093                         }
1094                 } while (found);
1095                 sprintf(value, "%lu:%p", (unsigned long) k, &mynames[j]);
1096                 set_value(name, value);
1097                 mynames[j] = str_alloc(name);
1098                 myvalues[j] = str_alloc(value);
1099         }
1100         for (pass = 0; pass < 3; ++pass) {
1101                 for (j = 0; j < limit; ++j) {
1102                         char *value = getenv(mynames[j]);
1103                         if (pass) {
1104                                 if (value == 0) {
1105                                         fprintf(stderr, "getenv returned null for %s\n", mynames[j]);
1106                                         ${cf_cv_main_return:-return}(1);
1107                                 } else if (value != mypointer[j]) {
1108                                         fprintf(stderr, "getenv returned different pointer for %s\n", mynames[j]);
1109                                         ${cf_cv_main_return:-return}(1);
1110                                 } else if (strcmp(value, myvalues[j])) {
1111                                         fprintf(stderr, "getenv returned different value for %s\n", mynames[j]);
1112                                         ${cf_cv_main_return:-return}(1);
1113                                 }
1114                         } else {
1115                                 size_t k;
1116                                 mypointer[j] = value;
1117                                 for (k = 0; k < j; ++k) {
1118                                         if (mypointer[j] == mypointer[k]) {
1119                                                 fprintf(stderr, "getenv returned same pointer for %s and %s\n", mynames[j], mynames[k]);
1120                                                 ${cf_cv_main_return:-return}(1);
1121                                         }
1122                                 }
1123                         }
1124                 }
1125         }
1126         ${cf_cv_main_return:-return}(0);
1127 }
1128 ],
1129 [cf_cv_consistent_getenv=yes],
1130 [cf_cv_consistent_getenv=no],
1131 [cf_cv_consistent_getenv=unknown])
1132 ])
1133
1134 if test "x$cf_cv_consistent_getenv" = xno
1135 then
1136         AC_DEFINE(HAVE_CONSISTENT_GETENV,1,[Define to 1 if getenv repeatably returns the same value for a given name])
1137 fi
1138 ])dnl
1139 dnl ---------------------------------------------------------------------------
1140 dnl CF_CHECK_GPM_WGETCH version: 3 updated: 2017/01/21 11:06:25
1141 dnl -------------------
1142 dnl Check if GPM is already linked with curses.  If so - and if the linkage
1143 dnl is not "weak" - warn about this because it can create problems linking
1144 dnl applications with ncurses.
1145 AC_DEFUN([CF_CHECK_GPM_WGETCH],[
1146 AC_CHECK_LIB(gpm,Gpm_Wgetch,[
1147
1148 AC_CACHE_CHECK(if GPM is weakly bound to curses library, cf_cv_check_gpm_wgetch,[
1149 cf_cv_check_gpm_wgetch=unknown
1150 if test "$cross_compiling" != yes ; then
1151
1152 cat >conftest.$ac_ext <<CF_EOF
1153 #include <gpm.h>
1154 int main(void)
1155 {
1156         Gpm_Wgetch();
1157         ${cf_cv_main_return:-return}(0);
1158 }
1159 CF_EOF
1160
1161         cf_save_LIBS="$LIBS"
1162         # This only works if we can look at the symbol table.  If a shared
1163         # library is stripped for install, we cannot use that.  So we're forced
1164         # to rely on the static library, noting that some packagers may not
1165         # include it.
1166         LIBS="-static -lgpm -dynamic $LIBS"
1167         if AC_TRY_EVAL(ac_compile) ; then
1168                 if AC_TRY_EVAL(ac_link) ; then
1169                         cf_cv_check_gpm_wgetch=`nm conftest$ac_exeext | egrep '\<wgetch\>' | egrep '\<[[vVwW]]\>'`
1170                         test -n "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=yes
1171                         test -z "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=no
1172                 fi
1173         fi
1174         rm -rf conftest*
1175         LIBS="$cf_save_LIBS"
1176 fi
1177 ])
1178
1179 if test "$cf_cv_check_gpm_wgetch" != yes ; then
1180         AC_MSG_WARN(GPM library is already linked with curses - read the FAQ)
1181 fi
1182 ])])dnl
1183 dnl ---------------------------------------------------------------------------
1184 dnl CF_CHECK_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
1185 dnl ------------------------
1186 dnl Show the version of libtool
1187 dnl
1188 dnl Save the version in a cache variable - this is not entirely a good thing,
1189 dnl but the version string from libtool is very ugly, and for bug reports it
1190 dnl might be useful to have the original string.
1191 AC_DEFUN([CF_CHECK_LIBTOOL_VERSION],[
1192 if test -n "$LIBTOOL" && test "$LIBTOOL" != none
1193 then
1194         AC_MSG_CHECKING(version of $LIBTOOL)
1195         CF_LIBTOOL_VERSION
1196         AC_MSG_RESULT($cf_cv_libtool_version)
1197         if test -z "$cf_cv_libtool_version" ; then
1198                 AC_MSG_ERROR(This is not GNU libtool)
1199         fi
1200 else
1201         AC_MSG_ERROR(GNU libtool has not been found)
1202 fi
1203 ])dnl
1204 dnl ---------------------------------------------------------------------------
1205 dnl CF_CHECK_WCHAR_H version: 2 updated: 2017/01/21 11:06:25
1206 dnl ----------------
1207 dnl Check if wchar.h can be used, i.e., without defining _XOPEN_SOURCE_EXTENDED
1208 AC_DEFUN([CF_CHECK_WCHAR_H],[
1209 AC_CHECK_HEADERS( \
1210 wchar.h \
1211 wctype.h \
1212 )
1213 AC_CACHE_CHECK(if wchar.h can be used as is,cf_cv_wchar_h_okay,[
1214 AC_TRY_COMPILE(
1215 [
1216 #include <stdlib.h>
1217 #ifdef HAVE_WCHAR_H
1218 #include <wchar.h>
1219 #endif
1220 #ifdef HAVE_WCTYPE_H
1221 #include <wctype.h>
1222 #endif
1223 ],[
1224         wint_t foo = 0;
1225         int bar = iswpunct(foo)],
1226         [cf_cv_wchar_h_okay=yes],
1227         [cf_cv_wchar_h_okay=no])])
1228
1229 if test $cf_cv_wchar_h_okay = no
1230 then
1231         CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED)
1232 fi
1233 ])dnl
1234 dnl ---------------------------------------------------------------------------
1235 dnl CF_CHECK_WCWIDTH_GRAPHICS version: 1 updated: 2015/12/19 17:47:56
1236 dnl -------------------------
1237 dnl Most "modern" terminal emulators are based to some degree on VT100, and
1238 dnl should support line-drawing.  Even with Unicode.  There is a problem.
1239 dnl
1240 dnl While most of the VT100 graphics characters were incorporated into Unicode,
1241 dnl all of those were combined into a page of useful graphics characters.
1242 dnl
1243 dnl So far, so good.
1244 dnl
1245 dnl However, while they are useful, there are other considerations.  CJK
1246 dnl is (because of poor device resolution) often rendered as double-width
1247 dnl characters.  So... for these generally-useful characters, what should
1248 dnl be the width (to make them consistent with adjacent characters)?
1249 dnl
1250 dnl The obvious choice would have been to make this locale-dependent, and use
1251 dnl wcwidth() to tell applications what the actual width is.  That was too
1252 dnl obvious.  Instead, we have a slew of "ambiguous-width" characters.
1253 dnl See for example
1254 dnl             http://www.unicode.org/reports/tr11/tr11-29.html
1255 dnl             http://www.cl.cam.ac.uk/~mgk25/ucs/scw-proposal.html
1256 dnl
1257 dnl The EastAsianWidth-6.2.0.txt file from the Unicode organization lists
1258 dnl more than 22,000 characters, with 1281 of those as ambiguous-width.  For
1259 dnl instance, it lists half (44/96) of the Latin-1 characters as
1260 dnl ambiguous-width.  Also, all of the box-characters at 0x2500 are ambiguous.
1261 dnl
1262 dnl What this means for the implementor is that on some systems wcwidth() can
1263 dnl give bad advice.  On Solaris, some of the ambiguous widths are returned as
1264 dnl 1 (the Latin-1 characters), while others are returned as 2 (line-drawing
1265 dnl characters).  These do not necessarily match the behavior of the terminal
1266 dnl emulator.  xterm, for instance, does an optional startup check to find if
1267 dnl this problem (or similar) exists with the system's locale tables, rejecting
1268 dnl them if they are too unreliable.
1269 AC_DEFUN([CF_CHECK_WCWIDTH_GRAPHICS],[
1270 AC_CACHE_CHECK(if wcwidth agrees graphics are single-width, cf_cv_wcwidth_graphics,[
1271 cat >conftest.in <<CF_EOF
1272 -       VT100 symbols
1273 0x250c  upper left corner
1274 0x2514  lower left corner
1275 0x2510  upper right corner
1276 0x2518  lower right corner
1277 0x251c  tee pointing left
1278 0x2524  tee pointing right
1279 0x2534  tee pointing up
1280 0x252c  tee pointing down
1281 0x2500  horizontal line
1282 0x2502  vertical line
1283 0x253c  large plus or crossover
1284 0x23ba  scan line 1
1285 0x23bd  scan line 9
1286 0x25c6  diamond
1287 0x2592  checker board (stipple)
1288 0x00b0  degree symbol
1289 0x00b1  plus/minus
1290 0x00b7  bullet
1291 -       Teletype 5410v1 symbols
1292 0x2190  arrow pointing left
1293 0x2192  arrow pointing right
1294 0x2193  arrow pointing down
1295 0x2191  arrow pointing up
1296 0x2592  board of squares
1297 0x2603  lantern symbol
1298 0x25ae  solid square block
1299 -       these defaults were invented for ncurses
1300 0x23bb  scan line 3
1301 0x23bc  scan line 7
1302 0x2264  less-than-or-equal-to
1303 0x2265  greater-than-or-equal-to
1304 0x03c0  greek pi
1305 0x2260  not-equal
1306 0x00a3  pound-sterling symbol
1307 -       thick-line-drawing
1308 0x250f  upper left corner
1309 0x2517  lower left corner
1310 0x2513  upper right corner
1311 0x251b  lower right corner
1312 0x2523  tee pointing left
1313 0x252b  tee pointing right
1314 0x253b  tee pointing up
1315 0x2533  tee pointing down
1316 0x2501  horizontal line
1317 0x2503  vertical line
1318 0x254b  large plus or crossover
1319 -       double-line-drawing
1320 0x2554  upper left corner
1321 0x255a  lower left corner
1322 0x2557  upper right corner
1323 0x255d  lower right corner
1324 0x2563  tee pointing left
1325 0x2560  tee pointing right
1326 0x2569  tee pointing up
1327 0x2566  tee pointing down
1328 0x2550  horizontal line
1329 0x2551  vertical line
1330 0x256c  large plus or crossover
1331 CF_EOF
1332 AC_TRY_RUN([
1333 #include <locale.h>
1334 #include <stdio.h>
1335 #include <wchar.h>
1336
1337 #define MY_LEN 80
1338
1339 int
1340 main(void)
1341 {
1342         FILE *fp;
1343         int value;
1344         char buffer[MY_LEN + 1];
1345         char notes[MY_LEN + 1];
1346         int totals = 0;
1347         int passed = 0;
1348
1349         if (setlocale(LC_ALL, "en_US.UTF8") ||
1350                 setlocale(LC_ALL, "en_US.UTF-8") ||
1351                 setlocale(LC_ALL, "en_US.utf8") ||
1352                 setlocale(LC_ALL, "en_US.utf-8")) {
1353                 if ((fp = fopen("conftest.in", "r")) != 0) {
1354                         while (fgets(buffer, MY_LEN, fp) != 0) {
1355                                 if (*buffer == '-') {
1356                                         fprintf(stderr, "\t%s", buffer);
1357                                 } else if (sscanf(buffer, "%x %s", &value, notes) == 2) {
1358                                         ++totals;
1359                                         if (wcwidth(value) == 1)
1360                                                 ++passed;
1361                                         fprintf(stderr, "%d\t%s", wcwidth(value), buffer);
1362                                 } else {
1363                                         fprintf(stderr, "?\t%s", buffer);
1364                                 }
1365                         }
1366                 }
1367         }
1368         fprintf(stderr, "%d/%d passed wcwidth/graphics check\n", passed, totals);
1369         return (totals == passed) ? 0 : 1;
1370 }
1371 ],
1372 [cf_cv_wcwidth_graphics=yes],
1373 [cf_cv_wcwidth_graphics=no],
1374 [cf_cv_wcwidth_graphics=unknown])
1375 ])
1376 ])dnl
1377 dnl ---------------------------------------------------------------------------
1378 dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35
1379 dnl -----------------
1380 dnl Check if the given compiler is really clang.  clang's C driver defines
1381 dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
1382 dnl not ignore some gcc options.
1383 dnl
1384 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1385 dnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
1386 dnl the wrappers for gcc and g++ warnings.
1387 dnl
1388 dnl $1 = GCC (default) or GXX
1389 dnl $2 = CLANG_COMPILER (default)
1390 dnl $3 = CFLAGS (default) or CXXFLAGS
1391 AC_DEFUN([CF_CLANG_COMPILER],[
1392 ifelse([$2],,CLANG_COMPILER,[$2])=no
1393
1394 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
1395         AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
1396         cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1397         ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
1398         AC_TRY_COMPILE([],[
1399 #ifdef __clang__
1400 #else
1401 make an error
1402 #endif
1403 ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
1404 cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
1405 ],[])
1406         ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1407         AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
1408 fi
1409 ])
1410 dnl ---------------------------------------------------------------------------
1411 dnl CF_CONST_X_STRING version: 1 updated: 2019/04/08 17:50:29
1412 dnl -----------------
1413 dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most
1414 dnl character-strings.
1415 dnl
1416 dnl It is ambiguous because the specification accommodated the pre-ANSI
1417 dnl compilers bundled by more than one vendor in lieu of providing a standard C
1418 dnl compiler other than by costly add-ons.  Because of this, the specification
1419 dnl did not take into account the use of const for telling the compiler that
1420 dnl string literals would be in readonly memory.
1421 dnl
1422 dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to
1423 dnl let the compiler decide how to represent Xt's strings which were #define'd. 
1424 dnl That does not solve the problem of using the block of Xt's strings which
1425 dnl are compiled into the library (and is less efficient than one might want).
1426 dnl
1427 dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both
1428 dnl when compiling the library and compiling using the library, to tell the
1429 dnl compiler that String is const.
1430 AC_DEFUN([CF_CONST_X_STRING],
1431 [
1432 AC_TRY_COMPILE(
1433 [
1434 #include <stdlib.h>
1435 #include <X11/Intrinsic.h>
1436 ],
1437 [String foo = malloc(1)],[
1438
1439 AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[
1440         AC_TRY_COMPILE(
1441                 [
1442 #define _CONST_X_STRING /* X11R7.8 (perhaps) */
1443 #undef  XTSTRINGDEFINES /* X11R5 and later */
1444 #include <stdlib.h>
1445 #include <X11/Intrinsic.h>
1446                 ],[String foo = malloc(1); *foo = 0],[
1447                         cf_cv_const_x_string=no
1448                 ],[
1449                         cf_cv_const_x_string=yes
1450                 ])
1451 ])
1452
1453 case $cf_cv_const_x_string in
1454 (no)
1455         CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES)
1456         ;;
1457 (*)
1458         CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING)
1459         ;;
1460 esac
1461
1462 ])
1463 ])dnl
1464 dnl ---------------------------------------------------------------------------
1465 dnl CF_CPP_PARAM_INIT version: 7 updated: 2017/01/21 11:06:25
1466 dnl -----------------
1467 dnl Check if the C++ compiler accepts duplicate parameter initialization.  This
1468 dnl is a late feature for the standard and is not in some recent compilers
1469 dnl (1999/9/11).
1470 AC_DEFUN([CF_CPP_PARAM_INIT],
1471 [
1472 if test -n "$CXX"; then
1473 AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[
1474         AC_LANG_SAVE
1475         AC_LANG_CPLUSPLUS
1476         AC_TRY_RUN([
1477 class TEST {
1478 private:
1479         int value;
1480 public:
1481         TEST(int x = 1);
1482         ~TEST();
1483 };
1484
1485 TEST::TEST(int x = 1)   // some compilers do not like second initializer
1486 {
1487         value = x;
1488 }
1489 int main(void) { }
1490 ],
1491         [cf_cv_cpp_param_init=yes],
1492         [cf_cv_cpp_param_init=no],
1493         [cf_cv_cpp_param_init=unknown])
1494         AC_LANG_RESTORE
1495 ])
1496 fi
1497 test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT,1,[Define to 1 if C++ has parameter initialization])
1498 ])dnl
1499 dnl ---------------------------------------------------------------------------
1500 dnl CF_CPP_STATIC_CAST version: 3 updated: 2013/04/13 18:03:21
1501 dnl ------------------
1502 dnl Check if the C++ compiler accepts static_cast in generics.  This appears to
1503 dnl not be supported in g++ before 3.0
1504 AC_DEFUN([CF_CPP_STATIC_CAST],
1505 [
1506 if test -n "$CXX"; then
1507
1508 AC_CACHE_CHECK(if $CXX accepts static_cast,cf_cv_cpp_static_cast,[
1509         AC_LANG_SAVE
1510         AC_LANG_CPLUSPLUS
1511
1512         AC_TRY_COMPILE([
1513 class NCursesPanel
1514 {
1515 public:
1516   NCursesPanel(int nlines,
1517                int ncols,
1518                int begin_y = 0,
1519                int begin_x = 0)
1520   {
1521   }
1522   NCursesPanel();
1523   ~NCursesPanel();
1524 };
1525
1526 template<class T> class NCursesUserPanel : public NCursesPanel
1527 {
1528 public:
1529   NCursesUserPanel (int nlines,
1530                     int ncols,
1531                     int begin_y = 0,
1532                     int begin_x = 0,
1533                     const T* p_UserData = static_cast<T*>(0))
1534     : NCursesPanel (nlines, ncols, begin_y, begin_x)
1535   {
1536   };
1537   NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel()
1538   {
1539   };
1540
1541   virtual ~NCursesUserPanel() {};
1542 };
1543 ],[
1544         const char* p_UserData = static_cast<char*>(0)],
1545         [cf_cv_cpp_static_cast=yes],
1546         [cf_cv_cpp_static_cast=no])
1547
1548         AC_LANG_RESTORE
1549 ])
1550
1551 fi
1552
1553 test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST,1,[Define to 1 if C++ has static_cast])
1554 ])dnl
1555 dnl ---------------------------------------------------------------------------
1556 dnl CF_CXX_AR_FLAGS version: 2 updated: 2015/04/17 21:13:04
1557 dnl ---------------
1558 dnl Setup special archiver flags for given compilers.
1559 AC_DEFUN([CF_CXX_AR_FLAGS],[
1560         CXX_AR='$(AR)'
1561         CXX_ARFLAGS='$(ARFLAGS)'
1562         case $cf_cv_system_name in
1563         (irix*)
1564             if test "$GXX" != yes ; then
1565                 CXX_AR='$(CXX)'
1566                 CXX_ARFLAGS='-ar -o'
1567             fi
1568             ;;
1569         (sco3.2v5*)
1570             CXXLDFLAGS="-u main"
1571             ;;
1572         (solaris2*)
1573             if test "$GXX" != yes ; then
1574                 CXX_AR='$(CXX)'
1575                 CXX_ARFLAGS='-xar -o'
1576             fi
1577             ;;
1578         esac
1579         AC_SUBST(CXXLDFLAGS)
1580         AC_SUBST(CXX_AR)
1581         AC_SUBST(CXX_ARFLAGS)
1582 ])dnl
1583 dnl ---------------------------------------------------------------------------
1584 dnl CF_CXX_IOSTREAM_NAMESPACE version: 2 updated: 2012/10/06 17:56:13
1585 dnl -------------------------
1586 dnl For c++, check if iostream uses "std::" namespace.
1587 AC_DEFUN([CF_CXX_IOSTREAM_NAMESPACE],[
1588 AC_CHECK_HEADERS(iostream)
1589 if test x"$ac_cv_header_iostream" = xyes ; then
1590         AC_MSG_CHECKING(if iostream uses std-namespace)
1591         AC_TRY_COMPILE([
1592 #include <iostream>
1593 using std::endl;
1594 using std::cerr;],[
1595 cerr << "testing" << endl;
1596 ],[cf_iostream_namespace=yes],[cf_iostream_namespace=no])
1597         AC_MSG_RESULT($cf_iostream_namespace)
1598         if test "$cf_iostream_namespace" = yes ; then
1599                 AC_DEFINE(IOSTREAM_NAMESPACE,1,[Define to 1 if C++ has namespace iostream])
1600         fi
1601 fi
1602 ])dnl
1603 dnl ---------------------------------------------------------------------------
1604 dnl CF_C_INLINE version: 6 updated: 2019/09/07 13:38:36
1605 dnl -----------
1606 dnl Check if the C compiler supports "inline".
1607 dnl $1 is the name of a shell variable to set if inline is supported
1608 dnl $2 is the threshold for gcc 4.x's option controlling maximum inline size
1609 AC_DEFUN([CF_C_INLINE],[
1610 AC_REQUIRE([CF_GCC_VERSION])
1611 AC_C_INLINE
1612 $1=
1613 if test "$ac_cv_c_inline" != no ; then
1614         $1=inline
1615         if test "$INTEL_COMPILER" = yes
1616         then
1617                 :
1618         elif test "$CLANG_COMPILER" = yes
1619         then
1620                 :
1621         elif test "$GCC" = yes
1622         then
1623                 AC_CACHE_CHECK(if $CC supports options to tune inlining,cf_cv_gcc_inline,[
1624                 cf_save_CFLAGS=$CFLAGS
1625                 CFLAGS="$CFLAGS --param max-inline-insns-single=$2"
1626                 AC_TRY_COMPILE([inline int foo(void) { return 1; }],
1627                 [${cf_cv_main_return:-return} foo()],
1628                 [cf_cv_gcc_inline=yes],
1629                 [cf_cv_gcc_inline=no])
1630                 CFLAGS=$cf_save_CFLAGS
1631                 ])
1632                 if test "$cf_cv_gcc_inline" = yes ; then
1633                         CF_ADD_CFLAGS([--param max-inline-insns-single=$2])
1634                 fi
1635         fi
1636 fi
1637 AC_SUBST($1)
1638 ])dnl
1639 dnl ---------------------------------------------------------------------------
1640 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
1641 dnl ----------
1642 dnl "dirname" is not portable, so we fake it with a shell script.
1643 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
1644 dnl ---------------------------------------------------------------------------
1645 dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31
1646 dnl ---------------
1647 AC_DEFUN([CF_DIRS_TO_MAKE],
1648 [
1649 DIRS_TO_MAKE="lib"
1650 for cf_item in $cf_list_models
1651 do
1652         CF_OBJ_SUBDIR($cf_item,cf_subdir)
1653         for cf_item2 in $DIRS_TO_MAKE
1654         do
1655                 test $cf_item2 = $cf_subdir && break
1656         done
1657         test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
1658 done
1659 for cf_dir in $DIRS_TO_MAKE
1660 do
1661         test ! -d $cf_dir && mkdir $cf_dir
1662 done
1663 AC_SUBST(DIRS_TO_MAKE)
1664 ])dnl
1665 dnl ---------------------------------------------------------------------------
1666 dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57
1667 dnl ---------------
1668 dnl You can always use "make -n" to see the actual options, but it's hard to
1669 dnl pick out/analyze warning messages when the compile-line is long.
1670 dnl
1671 dnl Sets:
1672 dnl     ECHO_LT - symbol to control if libtool is verbose
1673 dnl     ECHO_LD - symbol to prefix "cc -o" lines
1674 dnl     RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
1675 dnl     SHOW_CC - symbol to put before explicit "cc -c" lines
1676 dnl     ECHO_CC - symbol to put before any "cc" line
1677 dnl
1678 AC_DEFUN([CF_DISABLE_ECHO],[
1679 AC_MSG_CHECKING(if you want to see long compiling messages)
1680 CF_ARG_DISABLE(echo,
1681         [  --disable-echo          do not display "compiling" commands],
1682         [
1683         ECHO_LT='--silent'
1684         ECHO_LD='@echo linking [$]@;'
1685         RULE_CC='@echo compiling [$]<'
1686         SHOW_CC='@echo compiling [$]@'
1687         ECHO_CC='@'
1688 ],[
1689         ECHO_LT=''
1690         ECHO_LD=''
1691         RULE_CC=''
1692         SHOW_CC=''
1693         ECHO_CC=''
1694 ])
1695 AC_MSG_RESULT($enableval)
1696 AC_SUBST(ECHO_LT)
1697 AC_SUBST(ECHO_LD)
1698 AC_SUBST(RULE_CC)
1699 AC_SUBST(SHOW_CC)
1700 AC_SUBST(ECHO_CC)
1701 ])dnl
1702 dnl ---------------------------------------------------------------------------
1703 dnl CF_DISABLE_GNAT_PROJECTS version: 1 updated: 2014/06/01 11:34:00
1704 dnl ------------------------
1705 AC_DEFUN([CF_DISABLE_GNAT_PROJECTS],[
1706 AC_MSG_CHECKING(if we want to use GNAT projects)
1707 CF_ARG_DISABLE(gnat-projects,
1708         [  --disable-gnat-projects test: disable GNAT projects even if usable],
1709         [enable_gnat_projects=no],
1710         [enable_gnat_projects=yes])
1711 AC_MSG_RESULT($enable_gnat_projects)
1712 ])dnl
1713 dnl ---------------------------------------------------------------------------
1714 dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03
1715 dnl ----------------
1716 dnl Combine no-leak checks with the libraries or tools that are used for the
1717 dnl checks.
1718 AC_DEFUN([CF_DISABLE_LEAKS],[
1719
1720 AC_REQUIRE([CF_WITH_DMALLOC])
1721 AC_REQUIRE([CF_WITH_DBMALLOC])
1722 AC_REQUIRE([CF_WITH_VALGRIND])
1723
1724 AC_MSG_CHECKING(if you want to perform memory-leak testing)
1725 AC_ARG_ENABLE(leaks,
1726         [  --disable-leaks         test: free permanent memory, analyze leaks],
1727         [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi],
1728         : ${with_no_leaks:=no})
1729 AC_MSG_RESULT($with_no_leaks)
1730
1731 if test "$with_no_leaks" = yes ; then
1732         AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
1733         AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
1734 fi
1735 ])dnl
1736 dnl ---------------------------------------------------------------------------
1737 dnl CF_DISABLE_LIBTOOL_VERSION version: 3 updated: 2015/04/17 21:13:04
1738 dnl --------------------------
1739 dnl Check if we should use the libtool 1.5 feature "-version-number" instead of
1740 dnl the older "-version-info" feature.  The newer feature allows us to use
1741 dnl version numbering on shared libraries which make them compatible with
1742 dnl various systems.
1743 AC_DEFUN([CF_DISABLE_LIBTOOL_VERSION],
1744 [
1745 AC_MSG_CHECKING(if libtool -version-number should be used)
1746 CF_ARG_DISABLE(libtool-version,
1747         [  --disable-libtool-version  enable to use libtool's incompatible naming scheme],
1748         [cf_libtool_version=no],
1749         [cf_libtool_version=yes])
1750 AC_MSG_RESULT($cf_libtool_version)
1751
1752 if test "$cf_libtool_version" = yes ; then
1753         LIBTOOL_VERSION="-version-number"
1754 else
1755         LIBTOOL_VERSION="-version-info"
1756         case "x$VERSION" in
1757         (x)
1758                 AC_MSG_WARN(VERSION was not set)
1759                 ;;
1760         (x*.*.*)
1761                 ABI_VERSION="$VERSION"
1762                 CF_VERBOSE(ABI_VERSION: $ABI_VERSION)
1763                 ;;
1764         (x*:*:*)
1765                 ABI_VERSION=`echo "$VERSION" | sed -e 's/:/./g'`
1766                 CF_VERBOSE(ABI_VERSION: $ABI_VERSION)
1767                 ;;
1768         (*)
1769                 AC_MSG_WARN(unexpected VERSION value: $VERSION)
1770                 ;;
1771         esac
1772 fi
1773
1774 AC_SUBST(ABI_VERSION)
1775 AC_SUBST(LIBTOOL_VERSION)
1776 ])dnl
1777 dnl ---------------------------------------------------------------------------
1778 dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33
1779 dnl ---------------------
1780 dnl The rpath-hack makes it simpler to build programs, particularly with the
1781 dnl *BSD ports which may have essential libraries in unusual places.  But it
1782 dnl can interfere with building an executable for the base system.  Use this
1783 dnl option in that case.
1784 AC_DEFUN([CF_DISABLE_RPATH_HACK],
1785 [
1786 AC_MSG_CHECKING(if rpath-hack should be disabled)
1787 CF_ARG_DISABLE(rpath-hack,
1788         [  --disable-rpath-hack    don't add rpath options for additional libraries],
1789         [cf_disable_rpath_hack=yes],
1790         [cf_disable_rpath_hack=no])
1791 AC_MSG_RESULT($cf_disable_rpath_hack)
1792 if test "$cf_disable_rpath_hack" = no ; then
1793         CF_RPATH_HACK
1794 fi
1795 ])
1796 dnl ---------------------------------------------------------------------------
1797 dnl CF_ENABLE_PC_FILES version: 13 updated: 2015/11/01 05:27:39
1798 dnl ------------------
1799 dnl This is the "--enable-pc-files" option, which is available if there is a
1800 dnl pkg-config configuration on the local machine.
1801 AC_DEFUN([CF_ENABLE_PC_FILES],[
1802 AC_REQUIRE([CF_PKG_CONFIG])
1803 AC_REQUIRE([CF_WITH_PKG_CONFIG_LIBDIR])
1804
1805 if test "x$PKG_CONFIG" != xnone
1806 then
1807         AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG)
1808 else
1809         AC_MSG_CHECKING(if we should install .pc files)
1810 fi
1811
1812 AC_ARG_ENABLE(pc-files,
1813         [  --enable-pc-files       generate and install .pc files for pkg-config],
1814         [enable_pc_files=$enableval],
1815         [enable_pc_files=no])
1816 AC_MSG_RESULT($enable_pc_files)
1817
1818 if test "x$enable_pc_files" != xno
1819 then
1820         MAKE_PC_FILES=
1821         case "x$PKG_CONFIG_LIBDIR" in
1822         (xno|xyes)
1823                 AC_MSG_WARN(no PKG_CONFIG_LIBDIR was found)
1824                 ;;
1825         (*)
1826                 CF_PATH_SYNTAX(PKG_CONFIG_LIBDIR)
1827                 ;;
1828         esac
1829 else
1830         MAKE_PC_FILES="#"
1831 fi
1832 AC_SUBST(MAKE_PC_FILES)
1833 ])dnl
1834 dnl ---------------------------------------------------------------------------
1835 dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42
1836 dnl ---------------
1837 dnl Check if the rpath option should be used, setting cache variable
1838 dnl cf_cv_enable_rpath if so.
1839 AC_DEFUN([CF_ENABLE_RPATH],
1840 [
1841 AC_MSG_CHECKING(if rpath option should be used)
1842 AC_ARG_ENABLE(rpath,
1843 [  --enable-rpath          use rpath option when generating shared libraries],
1844 [cf_cv_enable_rpath=$enableval],
1845 [cf_cv_enable_rpath=no])
1846 AC_MSG_RESULT($cf_cv_enable_rpath)
1847 ])dnl
1848 dnl ---------------------------------------------------------------------------
1849 dnl CF_ENABLE_STRING_HACKS version: 5 updated: 2016/10/08 17:34:11
1850 dnl ----------------------
1851 dnl On a few platforms, the compiler and/or loader nags with untruthful
1852 dnl comments stating that "most" uses of strcat/strcpy/sprintf are incorrect,
1853 dnl and implying that most uses of the recommended alternatives are correct.
1854 dnl
1855 dnl Factually speaking, no one has actually counted the number of uses of these
1856 dnl functions versus the total of incorrect uses.  Samples of a few thousand
1857 dnl instances are meaningless compared to the hundreds of millions of lines of
1858 dnl existing C code.
1859 dnl
1860 dnl strlcat/strlcpy are (as of 2012) non-standard, and are available on some
1861 dnl platforms, in implementations of varying quality.  Likewise, snprintf is
1862 dnl standard - but evolved through phases, and older implementations are likely
1863 dnl to yield surprising results, as documented in manpages on various systems.
1864 AC_DEFUN([CF_ENABLE_STRING_HACKS],
1865 [
1866 AC_MSG_CHECKING(if you want to work around bogus compiler/loader warnings)
1867 AC_ARG_ENABLE(string-hacks,
1868         [  --enable-string-hacks   work around bogus compiler/loader warnings],
1869         [with_string_hacks=$enableval],
1870         [with_string_hacks=no])
1871 AC_MSG_RESULT($with_string_hacks)
1872
1873 if test "x$with_string_hacks" = "xyes"; then
1874         AC_DEFINE(USE_STRING_HACKS,1,[Define to 1 to work around bogus compiler/loader warnings])
1875         AC_MSG_WARN(enabling string-hacks to work around bogus compiler/loader warnings)
1876         AC_CHECK_FUNC(strlcat,[
1877                 AC_DEFINE(HAVE_STRLCAT,1,[Define to 1 if we have strlcat function])
1878                 ],[
1879                 AC_CHECK_LIB(bsd,strlcat,[
1880                         CF_ADD_LIB(bsd)
1881                         AC_CHECK_HEADERS(bsd/string.h)
1882                         AC_DEFINE(HAVE_STRLCAT,1,[Define to 1 if we have strlcat function])
1883                         ])
1884                 ])
1885         AC_CHECK_FUNCS( strlcpy snprintf )
1886 fi
1887 ])dnl
1888 dnl ---------------------------------------------------------------------------
1889 dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
1890 dnl --------
1891 dnl Check if 'errno' is declared in <errno.h>
1892 AC_DEFUN([CF_ERRNO],
1893 [
1894 CF_CHECK_ERRNO(errno)
1895 ])dnl
1896 dnl ---------------------------------------------------------------------------
1897 dnl CF_ETIP_DEFINES version: 5 updated: 2012/02/18 17:51:07
1898 dnl ---------------
1899 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
1900 dnl math.h and builtin.h, only for ncurses
1901 AC_DEFUN([CF_ETIP_DEFINES],
1902 [
1903 AC_MSG_CHECKING(for special defines needed for etip.h)
1904 cf_save_CXXFLAGS="$CXXFLAGS"
1905 cf_result="none"
1906
1907 # etip.h includes ncurses.h which includes ncurses_dll.h
1908 # But ncurses_dll.h is generated - fix here.
1909 test -d include || mkdir include
1910 test -f include/ncurses_dll.h || sed -e 's/@NCURSES_WRAP_PREFIX@/'$NCURSES_WRAP_PREFIX'/g' ${srcdir}/include/ncurses_dll.h.in >include/ncurses_dll.h
1911
1912 for cf_math in "" MATH_H
1913 do
1914 for cf_excp in "" MATH_EXCEPTION
1915 do
1916         CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -Iinclude -I${srcdir}/include"
1917         test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
1918         test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
1919 AC_TRY_COMPILE([
1920 #include <etip.h.in>
1921 ],[],[
1922         test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
1923         test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
1924         cf_result="$cf_math $cf_excp"
1925         break 2
1926 ],[])
1927 done
1928 done
1929 AC_MSG_RESULT($cf_result)
1930 CXXFLAGS="$cf_save_CXXFLAGS"
1931 ])
1932 dnl ---------------------------------------------------------------------------
1933 dnl CF_FIND_LINKAGE version: 21 updated: 2018/06/20 20:23:13
1934 dnl ---------------
1935 dnl Find a library (specifically the linkage used in the code fragment),
1936 dnl searching for it if it is not already in the library path.
1937 dnl See also CF_ADD_SEARCHPATH.
1938 dnl
1939 dnl Parameters (4-on are optional):
1940 dnl     $1 = headers for library entrypoint
1941 dnl     $2 = code fragment for library entrypoint
1942 dnl     $3 = the library name without the "-l" option or ".so" suffix.
1943 dnl     $4 = action to perform if successful (default: update CPPFLAGS, etc)
1944 dnl     $5 = action to perform if not successful
1945 dnl     $6 = module name, if not the same as the library name
1946 dnl     $7 = extra libraries
1947 dnl
1948 dnl Sets these variables:
1949 dnl     $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
1950 dnl     $cf_cv_header_path_$3 - include-directory if needed
1951 dnl     $cf_cv_library_path_$3 - library-directory if needed
1952 dnl     $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
1953 AC_DEFUN([CF_FIND_LINKAGE],[
1954
1955 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
1956 # will be set on completion of the AC_TRY_LINK below.
1957 cf_cv_header_path_$3=
1958 cf_cv_library_path_$3=
1959
1960 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
1961
1962 cf_save_LIBS="$LIBS"
1963
1964 AC_TRY_LINK([$1],[$2],[
1965         cf_cv_find_linkage_$3=yes
1966         cf_cv_header_path_$3=/usr/include
1967         cf_cv_library_path_$3=/usr/lib
1968 ],[
1969
1970 LIBS="-l$3 $7 $cf_save_LIBS"
1971
1972 AC_TRY_LINK([$1],[$2],[
1973         cf_cv_find_linkage_$3=yes
1974         cf_cv_header_path_$3=/usr/include
1975         cf_cv_library_path_$3=/usr/lib
1976         cf_cv_library_file_$3="-l$3"
1977 ],[
1978         cf_cv_find_linkage_$3=no
1979         LIBS="$cf_save_LIBS"
1980
1981         CF_VERBOSE(find linkage for $3 library)
1982         CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
1983
1984         cf_save_CPPFLAGS="$CPPFLAGS"
1985         cf_test_CPPFLAGS="$CPPFLAGS"
1986
1987         CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
1988         for cf_cv_header_path_$3 in $cf_search
1989         do
1990                 if test -d $cf_cv_header_path_$3 ; then
1991                         CF_VERBOSE(... testing $cf_cv_header_path_$3)
1992                         CPPFLAGS="$cf_save_CPPFLAGS"
1993                         CF_APPEND_TEXT(CPPFLAGS,-I$cf_cv_header_path_$3)
1994                         AC_TRY_COMPILE([$1],[$2],[
1995                                 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
1996                                 cf_cv_find_linkage_$3=maybe
1997                                 cf_test_CPPFLAGS="$CPPFLAGS"
1998                                 break],[
1999                                 CPPFLAGS="$cf_save_CPPFLAGS"
2000                                 ])
2001                 fi
2002         done
2003
2004         if test "$cf_cv_find_linkage_$3" = maybe ; then
2005
2006                 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
2007
2008                 cf_save_LIBS="$LIBS"
2009                 cf_save_LDFLAGS="$LDFLAGS"
2010
2011                 ifelse([$6],,,[
2012                 CPPFLAGS="$cf_test_CPPFLAGS"
2013                 LIBS="-l$3 $7 $cf_save_LIBS"
2014                 AC_TRY_LINK([$1],[$2],[
2015                         CF_VERBOSE(... found $3 library in system)
2016                         cf_cv_find_linkage_$3=yes])
2017                         CPPFLAGS="$cf_save_CPPFLAGS"
2018                         LIBS="$cf_save_LIBS"
2019                         ])
2020
2021                 if test "$cf_cv_find_linkage_$3" != yes ; then
2022                         CF_LIBRARY_PATH(cf_search,$3)
2023                         for cf_cv_library_path_$3 in $cf_search
2024                         do
2025                                 if test -d $cf_cv_library_path_$3 ; then
2026                                         CF_VERBOSE(... testing $cf_cv_library_path_$3)
2027                                         CPPFLAGS="$cf_test_CPPFLAGS"
2028                                         LIBS="-l$3 $7 $cf_save_LIBS"
2029                                         LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
2030                                         AC_TRY_LINK([$1],[$2],[
2031                                         CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
2032                                         cf_cv_find_linkage_$3=yes
2033                                         cf_cv_library_file_$3="-l$3"
2034                                         break],[
2035                                         CPPFLAGS="$cf_save_CPPFLAGS"
2036                                         LIBS="$cf_save_LIBS"
2037                                         LDFLAGS="$cf_save_LDFLAGS"
2038                                         ])
2039                                 fi
2040                         done
2041                         CPPFLAGS="$cf_save_CPPFLAGS"
2042                         LDFLAGS="$cf_save_LDFLAGS"
2043                 fi
2044
2045         else
2046                 cf_cv_find_linkage_$3=no
2047         fi
2048         ],$7)
2049 ])
2050
2051 LIBS="$cf_save_LIBS"
2052
2053 if test "$cf_cv_find_linkage_$3" = yes ; then
2054 ifelse([$4],,[
2055         CF_ADD_INCDIR($cf_cv_header_path_$3)
2056         CF_ADD_LIBDIR($cf_cv_library_path_$3)
2057         CF_ADD_LIB($3)
2058 ],[$4])
2059 else
2060 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
2061 fi
2062 ])dnl
2063 dnl ---------------------------------------------------------------------------
2064 dnl CF_FIND_SUB_INCDIR version: 2 updated: 2015/04/17 21:13:04
2065 dnl ------------------
2066 dnl Find an include-directory with the given leaf-name.  This is useful for
2067 dnl example with FreeBSD ports, which use this convention to distinguish
2068 dnl different versions of the same port.
2069 AC_DEFUN([CF_FIND_SUB_INCDIR],[
2070         CF_SUBDIR_PATH(cf_search,$1,include)
2071         for cf_item in $cf_search
2072         do
2073                 case $cf_item in
2074                 (*/$1)
2075                         CF_ADD_INCDIR($cf_item)
2076                         ;;
2077                 esac
2078         done
2079 ])dnl
2080 dnl ---------------------------------------------------------------------------
2081 dnl CF_FIND_SUB_LIBDIR version: 2 updated: 2015/04/17 21:13:04
2082 dnl ------------------
2083 dnl Find a library-directory with the given leaf-name.  This is useful for
2084 dnl example with FreeBSD ports, which use this convention to distinguish
2085 dnl different versions of the same port.
2086 AC_DEFUN([CF_FIND_SUB_LIBDIR],[
2087         CF_SUBDIR_PATH(cf_search,$1,lib)
2088         for cf_item in $cf_search
2089         do
2090                 case $cf_item in
2091                 (*/$1)
2092                         CF_ADD_LIBDIR($cf_item)
2093                         ;;
2094                 esac
2095         done
2096 ])dnl
2097 dnl ---------------------------------------------------------------------------
2098 dnl CF_FIXUP_ADAFLAGS version: 2 updated: 2015/04/17 21:13:04
2099 dnl -----------------
2100 dnl make ADAFLAGS consistent with CFLAGS
2101 AC_DEFUN([CF_FIXUP_ADAFLAGS],[
2102         AC_MSG_CHECKING(optimization options for ADAFLAGS)
2103         case "$CFLAGS" in
2104         (*-g*)
2105                 CF_ADD_ADAFLAGS(-g)
2106                 ;;
2107         esac
2108         case "$CFLAGS" in
2109         (*-O*)
2110                 cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[[        ]].*//'`
2111                 CF_ADD_ADAFLAGS($cf_O_flag)
2112                 ;;
2113         esac
2114         AC_MSG_RESULT($ADAFLAGS)
2115 ])dnl
2116 dnl ---------------------------------------------------------------------------
2117 dnl CF_FOPEN_BIN_R version: 1 updated: 2019/03/30 17:52:21
2118 dnl --------------
2119 dnl Check if fopen works when the "b" (binary) flag is added to the mode
2120 dnl parameter.  POSIX ignores the "b", which c89 specified.  Some very old
2121 dnl systems do not accept it.
2122 AC_DEFUN([CF_FOPEN_BIN_R],[
2123 AC_CACHE_CHECK(if fopen accepts explicit binary mode,cf_cv_fopen_bin_r,[
2124         AC_TRY_RUN([
2125 #include <stdio.h>
2126 int main(void) {
2127         FILE *fp = fopen("conftest.tmp", "wb");
2128         int rc = 0;
2129         if (fp != 0) {
2130                 int p, q;
2131                 for (p = 0; p < 256; ++p) {
2132                         fputc(p, fp);
2133                 }
2134                 fclose(fp);
2135                 fp = fopen("conftest.tmp", "rb");
2136                 if (fp != 0) {
2137                         for (p = 0; p < 256; ++p) {
2138                                 q = fgetc(fp);
2139                                 if (q != p) {
2140                                         rc = 1;
2141                                         break;
2142                                 }
2143                         }
2144                 } else {
2145                         rc = 1;
2146                 }
2147         } else {
2148                 rc = 1;
2149         }
2150         ${cf_cv_main_return:-return} (rc);
2151 }
2152 ],
2153                 [cf_cv_fopen_bin_r=yes],
2154                 [cf_cv_fopen_bin_r=no],
2155                 [cf_cv_fopen_bin_r=unknown])
2156 ])
2157 test "x$cf_cv_fopen_bin_r" != xno && AC_DEFINE(USE_FOPEN_BIN_R)
2158 ])dnl
2159 dnl ---------------------------------------------------------------------------
2160 dnl CF_FORGET_TOOL version: 1 updated: 2013/04/06 18:03:09
2161 dnl --------------
2162 dnl Forget that we saw the given tool.
2163 AC_DEFUN([CF_FORGET_TOOL],[
2164 unset ac_cv_prog_ac_ct_$1
2165 unset ac_ct_$1
2166 unset $1
2167 ])dnl
2168 dnl ---------------------------------------------------------------------------
2169 dnl CF_FUNC_DLSYM version: 4 updated: 2015/09/12 14:46:44
2170 dnl -------------
2171 dnl Test for dlsym() and related functions, as well as libdl.
2172 dnl
2173 dnl Sets
2174 dnl     $cf_have_dlsym
2175 dnl     $cf_have_libdl
2176 AC_DEFUN([CF_FUNC_DLSYM],[
2177 cf_have_dlsym=no
2178 AC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[
2179
2180 cf_have_libdl=no
2181 AC_CHECK_LIB(dl,dlsym,[
2182         cf_have_dlsym=yes
2183         cf_have_libdl=yes])])
2184
2185 if test "$cf_have_dlsym" = yes ; then
2186         test "$cf_have_libdl" = yes && { CF_ADD_LIB(dl) }
2187
2188         AC_MSG_CHECKING(whether able to link to dl*() functions)
2189         AC_TRY_LINK([#include <dlfcn.h>],[
2190                 void *obj;
2191                 if ((obj = dlopen("filename", 0)) != 0) {
2192                         if (dlsym(obj, "symbolname") == 0) {
2193                         dlclose(obj);
2194                         }
2195                 }],[
2196                 AC_DEFINE(HAVE_LIBDL,1,[Define to 1 if we have dl library])],[
2197                 AC_MSG_ERROR(Cannot link test program for libdl)])
2198         AC_MSG_RESULT(ok)
2199 else
2200         AC_MSG_ERROR(Cannot find dlsym function)
2201 fi
2202 ])
2203 dnl ---------------------------------------------------------------------------
2204 dnl CF_FUNC_MEMMOVE version: 9 updated: 2017/01/21 11:06:25
2205 dnl ---------------
2206 dnl Check for memmove, or a bcopy that can handle overlapping copy.  If neither
2207 dnl is found, add our own version of memmove to the list of objects.
2208 AC_DEFUN([CF_FUNC_MEMMOVE],
2209 [
2210 AC_CHECK_FUNC(memmove,,[
2211 AC_CHECK_FUNC(bcopy,[
2212         AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
2213                 AC_TRY_RUN([
2214 int main(void) {
2215         static char data[] = "abcdefghijklmnopqrstuwwxyz";
2216         char temp[40];
2217         bcopy(data, temp, sizeof(data));
2218         bcopy(temp+10, temp, 15);
2219         bcopy(temp+5, temp+15, 10);
2220         ${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
2221 }
2222                 ],
2223                 [cf_cv_good_bcopy=yes],
2224                 [cf_cv_good_bcopy=no],
2225                 [cf_cv_good_bcopy=unknown])
2226                 ])
2227         ],[cf_cv_good_bcopy=no])
2228         if test "$cf_cv_good_bcopy" = yes ; then
2229                 AC_DEFINE(USE_OK_BCOPY,1,[Define to 1 to use bcopy when memmove is unavailable])
2230         else
2231                 AC_DEFINE(USE_MY_MEMMOVE,1,[Define to 1 to use replacement function when memmove is unavailable])
2232         fi
2233 ])])dnl
2234 dnl ---------------------------------------------------------------------------
2235 dnl CF_FUNC_NANOSLEEP version: 5 updated: 2017/01/21 11:06:25
2236 dnl -----------------
2237 dnl Check for existence of workable nanosleep() function.  Some systems, e.g.,
2238 dnl AIX 4.x, provide a non-working version.
2239 AC_DEFUN([CF_FUNC_NANOSLEEP],[
2240 AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[
2241 AC_TRY_RUN([
2242 #include <stdio.h>
2243 #include <errno.h>
2244 #include <time.h>
2245
2246 #ifdef HAVE_SYS_TIME_H
2247 #include <sys/time.h>
2248 #endif
2249
2250 int main(void) {
2251         struct timespec ts1, ts2;
2252         int code;
2253         ts1.tv_sec  = 0;
2254         ts1.tv_nsec = 750000000;
2255         ts2.tv_sec  = 0;
2256         ts2.tv_nsec = 0;
2257         errno = 0;
2258         code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */
2259         ${cf_cv_main_return:-return}(code != 0);
2260 }
2261 ],
2262         [cf_cv_func_nanosleep=yes],
2263         [cf_cv_func_nanosleep=no],
2264         [cf_cv_func_nanosleep=unknown])])
2265
2266 test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP,1,[Define to 1 if we have nanosleep()])
2267 ])
2268 dnl ---------------------------------------------------------------------------
2269 dnl CF_FUNC_OPENPTY version: 5 updated: 2015/09/12 14:46:50
2270 dnl ---------------
2271 dnl Check for openpty() function, along with <pty.h> header.  It may need the
2272 dnl "util" library as well.
2273 AC_DEFUN([CF_FUNC_OPENPTY],
2274 [
2275 AC_CHECK_LIB(util,openpty,cf_cv_lib_util=yes,cf_cv_lib_util=no)
2276 AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[
2277         cf_save_LIBS="$LIBS"
2278         test $cf_cv_lib_util = yes && { CF_ADD_LIB(util) }
2279         for cf_header in pty.h libutil.h util.h
2280         do
2281         AC_TRY_LINK([
2282 #include <$cf_header>
2283 ],[
2284         int x = openpty((int *)0, (int *)0, (char *)0,
2285                                    (struct termios *)0, (struct winsize *)0);
2286 ],[
2287                 cf_cv_func_openpty=$cf_header
2288                 break
2289 ],[
2290                 cf_cv_func_openpty=no
2291 ])
2292         done
2293         LIBS="$cf_save_LIBS"
2294 ])
2295 ])dnl
2296 dnl ---------------------------------------------------------------------------
2297 dnl CF_FUNC_POLL version: 9 updated: 2015/10/10 13:27:32
2298 dnl ------------
2299 dnl See if the poll function really works.  Some platforms have poll(), but
2300 dnl it does not work for terminals or files.
2301 AC_DEFUN([CF_FUNC_POLL],[
2302 tty 2>&1 >/dev/null || { AC_CHECK_FUNCS(posix_openpt) }
2303 AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
2304 AC_TRY_RUN([
2305 #include <stdlib.h>
2306 #include <stdio.h>
2307 #include <unistd.h>
2308 #include <fcntl.h>
2309 #ifdef HAVE_POLL_H
2310 #include <poll.h>
2311 #else
2312 #include <sys/poll.h>
2313 #endif
2314 int main(void) {
2315         struct pollfd myfds;
2316         int ret;
2317
2318         /* check for Darwin bug with respect to "devices" */
2319         myfds.fd = open("/dev/null", 1);        /* O_WRONLY */
2320         if (myfds.fd < 0)
2321                 myfds.fd = 0;
2322         myfds.events = POLLIN;
2323         myfds.revents = 0;
2324
2325         ret = poll(&myfds, 1, 100);
2326
2327         if (ret < 0 || (myfds.revents & POLLNVAL)) {
2328                 ret = -1;
2329         } else {
2330                 int fd = 0;
2331                 if (!isatty(fd)) {
2332                         fd = open("/dev/tty", 2);       /* O_RDWR */
2333                 }
2334 #ifdef HAVE_POSIX_OPENPT
2335                 if (fd < 0) {
2336                         fd = posix_openpt(O_RDWR);
2337                 }
2338 #endif
2339
2340                 if (fd >= 0) {
2341                         /* also check with standard input */
2342                         myfds.fd = fd;
2343                         myfds.events = POLLIN;
2344                         myfds.revents = 0;
2345                         ret = poll(&myfds, 1, 100);
2346                 } else {
2347                         ret = -1;
2348                 }
2349         }
2350         ${cf_cv_main_return:-return}(ret < 0);
2351 }],
2352         [cf_cv_working_poll=yes],
2353         [cf_cv_working_poll=no],
2354         [cf_cv_working_poll=unknown])])
2355 test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL,1,[Define to 1 if the poll function seems to work])
2356 ])dnl
2357 dnl ---------------------------------------------------------------------------
2358 dnl CF_FUNC_TERMIOS version: 3 updated: 2012/10/06 17:56:13
2359 dnl ---------------
2360 dnl Some old/broken variations define tcgetattr() only as a macro in
2361 dnl termio(s).h
2362 AC_DEFUN([CF_FUNC_TERMIOS],[
2363 AC_REQUIRE([CF_STRUCT_TERMIOS])
2364 AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
2365 AC_TRY_LINK([
2366 #include <sys/types.h>
2367 #ifdef HAVE_UNISTD_H
2368 #include <unistd.h>
2369 #endif
2370 #ifdef HAVE_TERMIOS_H
2371 #include <termios.h>
2372 #define TTY struct termios
2373 #else
2374 #ifdef HAVE_TERMIO_H
2375 #include <termio.h>
2376 #define TTY struct termio
2377 #endif
2378 #endif
2379 ],[
2380 TTY foo;
2381 tcgetattr(1, &foo);],
2382 [cf_cv_have_tcgetattr=yes],
2383 [cf_cv_have_tcgetattr=no])])
2384 test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR,1,[Define to 1 if we have tcgetattr])
2385 ])dnl
2386 dnl ---------------------------------------------------------------------------
2387 dnl CF_FUNC_VSSCANF version: 6 updated: 2015/04/18 08:56:57
2388 dnl ---------------
2389 dnl Check for vsscanf() function, which is in c9x but generally not in earlier
2390 dnl versions of C.  It is in the GNU C library, and can often be simulated by
2391 dnl other functions.
2392 AC_DEFUN([CF_FUNC_VSSCANF],
2393 [
2394 AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
2395 AC_TRY_LINK([
2396 #include <stdarg.h>
2397 #include <stdio.h>],[
2398         va_list ap;
2399         vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
2400 AC_TRY_LINK([
2401 #include <stdarg.h>
2402 #include <stdio.h>],[
2403         FILE strbuf;
2404         char *str = "from";
2405
2406         strbuf._flag = _IOREAD;
2407         strbuf._ptr = strbuf._base = (unsigned char *) str;
2408         strbuf._cnt = strlen(str);
2409         strbuf._file = _NFILE;
2410         return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
2411 AC_TRY_LINK([
2412 #include <stdarg.h>
2413 #include <stdio.h>],[
2414         FILE strbuf;
2415         char *str = "from";
2416
2417         strbuf._flag = _IOREAD;
2418         strbuf._ptr = strbuf._base = (unsigned char *) str;
2419         strbuf._cnt = strlen(str);
2420         strbuf._file = _NFILE;
2421         return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
2422 cf_cv_func_vsscanf=no])])])])
2423
2424 case $cf_cv_func_vsscanf in
2425 (vsscanf) AC_DEFINE(HAVE_VSSCANF,1,[Define to 1 if we have vsscanf]);;
2426 (vfscanf) AC_DEFINE(HAVE_VFSCANF,1,[Define to 1 if we have vfscanf]);;
2427 (_doscan) AC_DEFINE(HAVE__DOSCAN,1,[Define to 1 if we have _doscan]);;
2428 esac
2429
2430 ])dnl
2431 dnl ---------------------------------------------------------------------------
2432 dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39:00
2433 dnl -----------------
2434 dnl Test for availability of useful gcc __attribute__ directives to quiet
2435 dnl compiler warnings.  Though useful, not all are supported -- and contrary
2436 dnl to documentation, unrecognized directives cause older compilers to barf.
2437 AC_DEFUN([CF_GCC_ATTRIBUTES],
2438 [
2439 if test "$GCC" = yes
2440 then
2441 cat > conftest.i <<EOF
2442 #ifndef GCC_PRINTF
2443 #define GCC_PRINTF 0
2444 #endif
2445 #ifndef GCC_SCANF
2446 #define GCC_SCANF 0
2447 #endif
2448 #ifndef GCC_NORETURN
2449 #define GCC_NORETURN /* nothing */
2450 #endif
2451 #ifndef GCC_UNUSED
2452 #define GCC_UNUSED /* nothing */
2453 #endif
2454 EOF
2455 if test "$GCC" = yes
2456 then
2457         AC_CHECKING([for $CC __attribute__ directives])
2458 cat > conftest.$ac_ext <<EOF
2459 #line __oline__ "${as_me:-configure}"
2460 #include "confdefs.h"
2461 #include "conftest.h"
2462 #include "conftest.i"
2463 #if     GCC_PRINTF
2464 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
2465 #else
2466 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
2467 #endif
2468 #if     GCC_SCANF
2469 #define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
2470 #else
2471 #define GCC_SCANFLIKE(fmt,var)  /*nothing*/
2472 #endif
2473 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
2474 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
2475 extern void foo(void) GCC_NORETURN;
2476 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
2477 EOF
2478         cf_printf_attribute=no
2479         cf_scanf_attribute=no
2480         for cf_attribute in scanf printf unused noreturn
2481         do
2482                 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
2483                 cf_directive="__attribute__(($cf_attribute))"
2484                 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
2485
2486                 case $cf_attribute in
2487                 (printf)
2488                         cf_printf_attribute=yes
2489                         cat >conftest.h <<EOF
2490 #define GCC_$cf_ATTRIBUTE 1
2491 EOF
2492                         ;;
2493                 (scanf)
2494                         cf_scanf_attribute=yes
2495                         cat >conftest.h <<EOF
2496 #define GCC_$cf_ATTRIBUTE 1
2497 EOF
2498                         ;;
2499                 (*)
2500                         cat >conftest.h <<EOF
2501 #define GCC_$cf_ATTRIBUTE $cf_directive
2502 EOF
2503                         ;;
2504                 esac
2505
2506                 if AC_TRY_EVAL(ac_compile); then
2507                         test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
2508                         cat conftest.h >>confdefs.h
2509                         case $cf_attribute in
2510                         (noreturn)
2511                                 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
2512                                 ;;
2513                         (printf)
2514                                 cf_value='/* nothing */'
2515                                 if test "$cf_printf_attribute" != no ; then
2516                                         cf_value='__attribute__((format(printf,fmt,var)))'
2517                                         AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
2518                                 fi
2519                                 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
2520                                 ;;
2521                         (scanf)
2522                                 cf_value='/* nothing */'
2523                                 if test "$cf_scanf_attribute" != no ; then
2524                                         cf_value='__attribute__((format(scanf,fmt,var)))'
2525                                         AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
2526                                 fi
2527                                 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
2528                                 ;;
2529                         (unused)
2530                                 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
2531                                 ;;
2532                         esac
2533                 fi
2534         done
2535 else
2536         fgrep define conftest.i >>confdefs.h
2537 fi
2538 rm -rf conftest*
2539 fi
2540 ])dnl
2541 dnl ---------------------------------------------------------------------------
2542 dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36
2543 dnl --------------
2544 dnl Find version of gcc, and (because icc/clang pretend to be gcc without being
2545 dnl compatible), attempt to determine if icc/clang is actually used.
2546 AC_DEFUN([CF_GCC_VERSION],[
2547 AC_REQUIRE([AC_PROG_CC])
2548 GCC_VERSION=none
2549 if test "$GCC" = yes ; then
2550         AC_MSG_CHECKING(version of $CC)
2551         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.]].*//'`"
2552         test -z "$GCC_VERSION" && GCC_VERSION=unknown
2553         AC_MSG_RESULT($GCC_VERSION)
2554 fi
2555 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
2556 CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
2557 ])dnl
2558 dnl ---------------------------------------------------------------------------
2559 dnl CF_GCC_WARNINGS version: 36 updated: 2019/09/07 13:38:36
2560 dnl ---------------
2561 dnl Check if the compiler supports useful warning options.  There's a few that
2562 dnl we don't use, simply because they're too noisy:
2563 dnl
2564 dnl     -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
2565 dnl     -Wredundant-decls (system headers make this too noisy)
2566 dnl     -Wtraditional (combines too many unrelated messages, only a few useful)
2567 dnl     -Wwrite-strings (too noisy, but should review occasionally).  This
2568 dnl             is enabled for ncurses using "--enable-const".
2569 dnl     -pedantic
2570 dnl
2571 dnl Parameter:
2572 dnl     $1 is an optional list of gcc warning flags that a particular
2573 dnl             application might want to use, e.g., "no-unused" for
2574 dnl             -Wno-unused
2575 dnl Special:
2576 dnl     If $with_ext_const is "yes", add a check for -Wwrite-strings
2577 dnl
2578 AC_DEFUN([CF_GCC_WARNINGS],
2579 [
2580 AC_REQUIRE([CF_GCC_VERSION])
2581 if test "x$have_x" = xyes; then CF_CONST_X_STRING fi
2582 cat > conftest.$ac_ext <<EOF
2583 #line __oline__ "${as_me:-configure}"
2584 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
2585 EOF
2586 if test "$INTEL_COMPILER" = yes
2587 then
2588 # The "-wdXXX" options suppress warnings:
2589 # remark #1419: external declaration in primary source file
2590 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
2591 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
2592 # remark #193: zero used for undefined preprocessing identifier
2593 # remark #593: variable "curs_sb_left_arrow" was set but never used
2594 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
2595 # remark #869: parameter "tw" was never referenced
2596 # remark #981: operands are evaluated in unspecified order
2597 # warning #279: controlling expression is constant
2598
2599         AC_CHECKING([for $CC warning options])
2600         cf_save_CFLAGS="$CFLAGS"
2601         EXTRA_CFLAGS="-Wall"
2602         for cf_opt in \
2603                 wd1419 \
2604                 wd1683 \
2605                 wd1684 \
2606                 wd193 \
2607                 wd593 \
2608                 wd279 \
2609                 wd810 \
2610                 wd869 \
2611                 wd981
2612         do
2613                 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2614                 if AC_TRY_EVAL(ac_compile); then
2615                         test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2616                         EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2617                 fi
2618         done
2619         CFLAGS="$cf_save_CFLAGS"
2620 elif test "$GCC" = yes
2621 then
2622         AC_CHECKING([for $CC warning options])
2623         cf_save_CFLAGS="$CFLAGS"
2624         EXTRA_CFLAGS=
2625         cf_warn_CONST=""
2626         test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
2627         cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs"
2628         test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings=
2629         for cf_opt in W Wall \
2630                 Wbad-function-cast \
2631                 Wcast-align \
2632                 Wcast-qual \
2633                 Wdeclaration-after-statement \
2634                 Wextra \
2635                 Winline \
2636                 Wmissing-declarations \
2637                 Wmissing-prototypes \
2638                 Wnested-externs \
2639                 Wpointer-arith \
2640                 Wshadow \
2641                 Wstrict-prototypes \
2642                 Wundef $cf_gcc_warnings $cf_warn_CONST $1
2643         do
2644                 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2645                 if AC_TRY_EVAL(ac_compile); then
2646                         test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2647                         case $cf_opt in
2648                         (Winline)
2649                                 case $GCC_VERSION in
2650                                 ([[34]].*)
2651                                         CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2652                                         continue;;
2653                                 esac
2654                                 ;;
2655                         (Wpointer-arith)
2656                                 case $GCC_VERSION in
2657                                 ([[12]].*)
2658                                         CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2659                                         continue;;
2660                                 esac
2661                                 ;;
2662                         esac
2663                         EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2664                 fi
2665         done
2666         CFLAGS="$cf_save_CFLAGS"
2667 fi
2668 rm -rf conftest*
2669
2670 AC_SUBST(EXTRA_CFLAGS)
2671 ])dnl
2672 dnl ---------------------------------------------------------------------------
2673 dnl CF_GETOPT_HEADER version: 6 updated: 2014/07/22 14:45:54
2674 dnl ----------------
2675 dnl Check for getopt's variables which are commonly defined in stdlib.h,
2676 dnl unistd.h or (nonstandard) in getopt.h
2677 AC_DEFUN([CF_GETOPT_HEADER],
2678 [
2679 AC_HAVE_HEADERS(unistd.h getopt.h)
2680 AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
2681 cf_cv_getopt_header=none
2682 for cf_header in stdio.h stdlib.h unistd.h getopt.h
2683 do
2684 AC_TRY_COMPILE([
2685 #include <$cf_header>],
2686 [int x = optind; char *y = optarg],
2687 [cf_cv_getopt_header=$cf_header
2688  break])
2689 done
2690 ])
2691 if test $cf_cv_getopt_header != none ; then
2692         AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if getopt variables are declared in header])
2693 fi
2694 if test $cf_cv_getopt_header = getopt.h ; then
2695         AC_DEFINE(NEED_GETOPT_H,1,[Define to 1 if we must include getopt.h])
2696 fi
2697 ])dnl
2698 dnl ---------------------------------------------------------------------------
2699 dnl CF_GNATPREP_OPT_T version: 1 updated: 2014/08/02 18:37:25
2700 dnl -----------------
2701 AC_DEFUN([CF_GNATPREP_OPT_T],[
2702 AC_CACHE_CHECK(if GNATPREP supports -T option,cf_cv_gnatprep_opt_t,[
2703 cf_cv_gnatprep_opt_t=no
2704 gnatprep -T 2>/dev/null >/dev/null && cf_cv_gnatprep_opt_t=yes
2705 ])
2706 test "$cf_cv_gnatprep_opt_t" = yes && GNATPREP_OPTS="-T $GNATPREP_OPTS"
2707 AC_SUBST(GNATPREP_OPTS)
2708 ])dnl
2709 dnl ---------------------------------------------------------------------------
2710 dnl CF_GNAT_GENERICS version: 3 updated: 2015/04/17 21:13:04
2711 dnl ----------------
2712 AC_DEFUN([CF_GNAT_GENERICS],
2713 [
2714 AC_REQUIRE([CF_GNAT_VERSION])
2715
2716 AC_MSG_CHECKING(if GNAT supports generics)
2717 case $cf_gnat_version in
2718 (3.[[1-9]]*|[[4-9]].*)
2719         cf_gnat_generics=yes
2720         ;;
2721 (*)
2722         cf_gnat_generics=no
2723         ;;
2724 esac
2725 AC_MSG_RESULT($cf_gnat_generics)
2726
2727 if test "$cf_gnat_generics" = yes
2728 then
2729         cf_compile_generics=generics
2730         cf_generic_objects="\${GENOBJS}"
2731 else
2732         cf_compile_generics=
2733         cf_generic_objects=
2734 fi
2735
2736 AC_SUBST(cf_compile_generics)
2737 AC_SUBST(cf_generic_objects)
2738 ])dnl
2739 dnl ---------------------------------------------------------------------------
2740 dnl CF_GNAT_PROJECTS version: 9 updated: 2018/01/14 15:46:09
2741 dnl ----------------
2742 dnl GNAT projects are configured with ".gpr" project files.
2743 dnl GNAT libraries are a further development, using the project feature.
2744 AC_DEFUN([CF_GNAT_PROJECTS],
2745 [
2746 AC_REQUIRE([CF_GNAT_VERSION])
2747 AC_REQUIRE([CF_DISABLE_GNAT_PROJECTS])
2748
2749 cf_gnat_libraries=no
2750 cf_gnat_projects=no
2751
2752 if test "$enable_gnat_projects" != no ; then
2753 AC_MSG_CHECKING(if GNAT supports project files)
2754 case $cf_gnat_version in
2755 (3.[[0-9]]*)
2756         ;;
2757 (*)
2758         case $cf_cv_system_name in
2759         (cygwin*|msys*)
2760                 ;;
2761         (*)
2762                 rm -rf conftest* *~conftest*
2763                 if mkdir conftest.src conftest.bin conftest.lib
2764                 then
2765                         cd conftest.src
2766                         rm -rf conftest* *~conftest*
2767                         cat >>library.gpr <<CF_EOF
2768 project Library is
2769   Kind := External ("LIB_KIND");
2770   for Library_Name use "ConfTest";
2771   for Object_Dir use ".";
2772   for Library_ALI_Dir use External("LIBRARY_DIR");
2773   for Library_Version use External ("SONAME");
2774   for Library_Kind use Kind;
2775   for Library_Dir use External("BUILD_DIR");
2776   Source_Dir := External ("SOURCE_DIR");
2777   for Source_Dirs use (Source_Dir);
2778 end Library;
2779 CF_EOF
2780                         cat >>confpackage.ads <<CF_EOF
2781 package ConfPackage is
2782    procedure conftest;
2783 end ConfPackage;
2784 CF_EOF
2785                         cat >>confpackage.adb <<CF_EOF
2786 with Text_IO;
2787 package body ConfPackage is
2788    procedure conftest is
2789    begin
2790       Text_IO.Put ("Hello World");
2791       Text_IO.New_Line;
2792    end conftest;
2793 end ConfPackage;
2794 CF_EOF
2795                         if ( $cf_ada_make $ADAFLAGS \
2796                                         -Plibrary.gpr \
2797                                         -XBUILD_DIR=`cd ../conftest.bin;pwd` \
2798                                         -XLIBRARY_DIR=`cd ../conftest.lib;pwd` \
2799                                         -XSOURCE_DIR=`pwd` \
2800                                         -XSONAME=libConfTest.so.1 \
2801                                         -XLIB_KIND=static 1>&AC_FD_CC 2>&1 ) ; then
2802                                 cf_gnat_projects=yes
2803                         fi
2804                         cd ..
2805                 fi
2806                 if test -f conftest.lib/confpackage.ali
2807                 then
2808                         cf_gnat_libraries=yes
2809                 fi
2810                 rm -rf conftest* *~conftest*
2811                 ;;
2812         esac
2813         ;;
2814 esac
2815 AC_MSG_RESULT($cf_gnat_projects)
2816 fi # enable_gnat_projects
2817
2818 if test $cf_gnat_projects = yes
2819 then
2820         AC_MSG_CHECKING(if GNAT supports libraries)
2821         AC_MSG_RESULT($cf_gnat_libraries)
2822 fi
2823
2824 if test "$cf_gnat_projects" = yes
2825 then
2826         USE_OLD_MAKERULES="#"
2827         USE_GNAT_PROJECTS=""
2828 else
2829         USE_OLD_MAKERULES=""
2830         USE_GNAT_PROJECTS="#"
2831 fi
2832
2833 if test "$cf_gnat_libraries" = yes
2834 then
2835         USE_GNAT_LIBRARIES=""
2836 else
2837         USE_GNAT_LIBRARIES="#"
2838 fi
2839
2840 AC_SUBST(USE_OLD_MAKERULES)
2841 AC_SUBST(USE_GNAT_PROJECTS)
2842 AC_SUBST(USE_GNAT_LIBRARIES)
2843 ])dnl
2844 dnl ---------------------------------------------------------------------------
2845 dnl CF_GNAT_SIGINT version: 1 updated: 2011/03/27 20:07:59
2846 dnl --------------
2847 dnl Check if gnat supports SIGINT, and presumably tasking.  For the latter, it
2848 dnl is noted that gnat may compile a tasking unit even for configurations which
2849 dnl fail at runtime.
2850 AC_DEFUN([CF_GNAT_SIGINT],[
2851 AC_CACHE_CHECK(if GNAT supports SIGINT,cf_cv_gnat_sigint,[
2852 CF_GNAT_TRY_LINK([with Ada.Interrupts.Names;
2853
2854 package ConfTest is
2855
2856    pragma Warnings (Off);  --  the next pragma exists since 3.11p
2857    pragma Unreserve_All_Interrupts;
2858    pragma Warnings (On);
2859
2860    protected Process is
2861       procedure Stop;
2862       function Continue return Boolean;
2863       pragma Attach_Handler (Stop, Ada.Interrupts.Names.SIGINT);
2864    private
2865       Done : Boolean := False;
2866    end Process;
2867
2868 end ConfTest;],
2869 [package body ConfTest is
2870    protected body Process is
2871       procedure Stop is
2872       begin
2873          Done := True;
2874       end Stop;
2875       function Continue return Boolean is
2876       begin
2877          return not Done;
2878       end Continue;
2879    end Process;
2880 end ConfTest;],
2881         [cf_cv_gnat_sigint=yes],
2882         [cf_cv_gnat_sigint=no])])
2883
2884 if test $cf_cv_gnat_sigint = yes ; then
2885         USE_GNAT_SIGINT=""
2886 else
2887         USE_GNAT_SIGINT="#"
2888 fi
2889 AC_SUBST(USE_GNAT_SIGINT)
2890 ])dnl
2891 dnl ---------------------------------------------------------------------------
2892 dnl CF_GNAT_TRY_LINK version: 3 updated: 2011/03/19 14:47:45
2893 dnl ----------------
2894 dnl Verify that a test program compiles/links with GNAT.
2895 dnl $cf_ada_make is set to the program that compiles/links
2896 dnl $ADAFLAGS may be set to the GNAT flags.
2897 dnl
2898 dnl $1 is the text of the spec
2899 dnl $2 is the text of the body
2900 dnl $3 is the shell command to execute if successful
2901 dnl $4 is the shell command to execute if not successful
2902 AC_DEFUN([CF_GNAT_TRY_LINK],
2903 [
2904 rm -rf conftest* *~conftest*
2905 cat >>conftest.ads <<CF_EOF
2906 $1
2907 CF_EOF
2908 cat >>conftest.adb <<CF_EOF
2909 $2
2910 CF_EOF
2911 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
2912 ifelse($3,,      :,[      $3])
2913 ifelse($4,,,[else
2914    $4])
2915 fi
2916 rm -rf conftest* *~conftest*
2917 ])dnl
2918 dnl ---------------------------------------------------------------------------
2919 dnl CF_GNAT_TRY_RUN version: 5 updated: 2011/03/19 14:47:45
2920 dnl ---------------
2921 dnl Verify that a test program compiles and runs with GNAT
2922 dnl $cf_ada_make is set to the program that compiles/links
2923 dnl $ADAFLAGS may be set to the GNAT flags.
2924 dnl
2925 dnl $1 is the text of the spec
2926 dnl $2 is the text of the body
2927 dnl $3 is the shell command to execute if successful
2928 dnl $4 is the shell command to execute if not successful
2929 AC_DEFUN([CF_GNAT_TRY_RUN],
2930 [
2931 rm -rf conftest* *~conftest*
2932 cat >>conftest.ads <<CF_EOF
2933 $1
2934 CF_EOF
2935 cat >>conftest.adb <<CF_EOF
2936 $2
2937 CF_EOF
2938 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
2939    if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
2940 ifelse($3,,      :,[      $3])
2941 ifelse($4,,,[   else
2942       $4])
2943    fi
2944 ifelse($4,,,[else
2945    $4])
2946 fi
2947 rm -rf conftest* *~conftest*
2948 ])dnl
2949 dnl ---------------------------------------------------------------------------
2950 dnl CF_GNAT_VERSION version: 20 updated: 2015/04/18 08:56:57
2951 dnl ---------------
2952 dnl Verify version of GNAT.
2953 AC_DEFUN([CF_GNAT_VERSION],
2954 [
2955 AC_MSG_CHECKING(for gnat version)
2956 cf_gnat_version=`${cf_ada_make:-gnatmake} -v 2>&1 | \
2957         grep '[[0-9]].[[0-9]][[0-9]]*' |\
2958         sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
2959 AC_MSG_RESULT($cf_gnat_version)
2960
2961 case $cf_gnat_version in
2962 (3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|20[[0-9]][[0-9]])
2963         cf_cv_prog_gnat_correct=yes
2964         ;;
2965 (*)
2966         AC_MSG_WARN(Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding.)
2967         cf_cv_prog_gnat_correct=no
2968         ;;
2969 esac
2970 ])
2971 dnl ---------------------------------------------------------------------------
2972 dnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41
2973 dnl -------------
2974 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
2975 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend.  This is a defect
2976 dnl (or misfeature) of glibc2, which breaks portability of many applications,
2977 dnl since it is interwoven with GNU extensions.
2978 dnl
2979 dnl Well, yes we could work around it...
2980 dnl
2981 dnl Parameters:
2982 dnl     $1 is the nominal value for _XOPEN_SOURCE
2983 AC_DEFUN([CF_GNU_SOURCE],
2984 [
2985 cf_gnu_xopen_source=ifelse($1,,500,$1)
2986
2987 AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[
2988 AC_TRY_COMPILE([#include <sys/types.h>],[
2989         #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0
2990                 return 0;
2991         #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0
2992                 return 0;
2993         #else
2994         #       error not GNU C library
2995         #endif],
2996         [cf_cv_gnu_library=yes],
2997         [cf_cv_gnu_library=no])
2998 ])
2999
3000 if test x$cf_cv_gnu_library = xyes; then
3001
3002         # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE
3003         # was changed to help a little.  newlib incorporated the change about 4
3004         # years later.
3005         AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[
3006                 cf_save="$CPPFLAGS"
3007                 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
3008                 AC_TRY_COMPILE([#include <sys/types.h>],[
3009                         #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2)
3010                                 return 0;
3011                         #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3)
3012                                 return 0;
3013                         #else
3014                         #       error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old
3015                         #endif],
3016                         [cf_cv_gnu_library_219=yes],
3017                         [cf_cv_gnu_library_219=no])
3018                 CPPFLAGS="$cf_save"
3019         ])
3020
3021         if test "x$cf_cv_gnu_library_219" = xyes; then
3022                 cf_save="$CPPFLAGS"
3023                 AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[
3024                         CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source)
3025                         AC_TRY_COMPILE([
3026                                 #include <limits.h>
3027                                 #include <sys/types.h>
3028                                 ],[
3029                                 #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1)
3030                                         return 0;
3031                                 #else
3032                                 #       error GNU C library is too old
3033                                 #endif],
3034                                 [cf_cv_gnu_dftsrc_219=yes],
3035                                 [cf_cv_gnu_dftsrc_219=no])
3036                         ])
3037                 test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save"
3038         else
3039                 cf_cv_gnu_dftsrc_219=maybe
3040         fi
3041
3042         if test "x$cf_cv_gnu_dftsrc_219" != xyes; then
3043
3044                 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
3045                 AC_TRY_COMPILE([#include <sys/types.h>],[
3046                         #ifndef _XOPEN_SOURCE
3047                         #error  expected _XOPEN_SOURCE to be defined
3048                         #endif],
3049                         [cf_cv_gnu_source=no],
3050                         [cf_save="$CPPFLAGS"
3051                          CF_ADD_CFLAGS(-D_GNU_SOURCE)
3052                          AC_TRY_COMPILE([#include <sys/types.h>],[
3053                                 #ifdef _XOPEN_SOURCE
3054                                 #error  expected _XOPEN_SOURCE to be undefined
3055                                 #endif],
3056                                 [cf_cv_gnu_source=no],
3057                                 [cf_cv_gnu_source=yes])
3058                         CPPFLAGS="$cf_save"
3059                         ])
3060                 ])
3061
3062                 if test "$cf_cv_gnu_source" = yes
3063                 then
3064                 AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[
3065                         CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE)
3066                         AC_TRY_COMPILE([#include <sys/types.h>],[
3067                                 #ifdef _DEFAULT_SOURCE
3068                                 #error  expected _DEFAULT_SOURCE to be undefined
3069                                 #endif],
3070                                 [cf_cv_default_source=no],
3071                                 [cf_cv_default_source=yes])
3072                         ])
3073                         if test "$cf_cv_default_source" = yes
3074                         then
3075                                 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
3076                         fi
3077                 fi
3078         fi
3079
3080 fi
3081 ])dnl
3082 dnl ---------------------------------------------------------------------------
3083 dnl CF_GPP_LIBRARY version: 12 updated: 2015/04/17 21:13:04
3084 dnl --------------
3085 dnl If we're trying to use g++, test if libg++ is installed (a rather common
3086 dnl problem :-).  If we have the compiler but no library, we'll be able to
3087 dnl configure, but won't be able to build the c++ demo program.
3088 AC_DEFUN([CF_GPP_LIBRARY],
3089 [
3090 cf_cxx_library=unknown
3091 case $cf_cv_system_name in
3092 (os2*)
3093         cf_gpp_libname=gpp
3094         ;;
3095 (*)
3096         cf_gpp_libname=g++
3097         ;;
3098 esac
3099 if test "$GXX" = yes; then
3100         AC_MSG_CHECKING([for lib$cf_gpp_libname])
3101         cf_save="$LIBS"
3102         CF_ADD_LIB($cf_gpp_libname)
3103         AC_TRY_LINK([
3104 #include <$cf_gpp_libname/builtin.h>
3105         ],
3106         [two_arg_error_handler_t foo2 = lib_error_handler],
3107         [cf_cxx_library=yes
3108          CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
3109          if test "$cf_gpp_libname" = cpp ; then
3110             AC_DEFINE(HAVE_GPP_BUILTIN_H,1,[Define to 1 if we have gpp builtin.h])
3111          else
3112             AC_DEFINE(HAVE_GXX_BUILTIN_H,1,[Define to 1 if we have g++ builtin.h])
3113          fi],
3114         [AC_TRY_LINK([
3115 #include <builtin.h>
3116         ],
3117         [two_arg_error_handler_t foo2 = lib_error_handler],
3118         [cf_cxx_library=yes
3119          CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
3120          AC_DEFINE(HAVE_BUILTIN_H,1,[Define to 1 if we have builtin.h])],
3121         [cf_cxx_library=no])])
3122         LIBS="$cf_save"
3123         AC_MSG_RESULT($cf_cxx_library)
3124 fi
3125 ])dnl
3126 dnl ---------------------------------------------------------------------------
3127 dnl CF_GXX_VERSION version: 8 updated: 2017/02/11 14:48:57
3128 dnl --------------
3129 dnl Check for version of g++
3130 AC_DEFUN([CF_GXX_VERSION],[
3131 AC_REQUIRE([AC_PROG_CPP])
3132 GXX_VERSION=none
3133 if test "$GXX" = yes; then
3134         AC_MSG_CHECKING(version of ${CXX:-g++})
3135         GXX_VERSION="`${CXX:-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
3136         if test -z "$GXX_VERSION"
3137         then
3138                 GXX_VERSION=unknown
3139                 GXX=no
3140         fi
3141         AC_MSG_RESULT($GXX_VERSION)
3142 fi
3143 ])dnl
3144 dnl ---------------------------------------------------------------------------
3145 dnl CF_GXX_WARNINGS version: 9 updated: 2015/04/17 21:13:04
3146 dnl ---------------
3147 dnl Check if the compiler supports useful warning options.
3148 dnl
3149 dnl Most of gcc's options apply to g++, except:
3150 dnl     -Wbad-function-cast
3151 dnl     -Wmissing-declarations
3152 dnl     -Wnested-externs
3153 dnl
3154 dnl Omit a few (for now):
3155 dnl     -Winline
3156 dnl
3157 dnl Parameter:
3158 dnl     $1 is an optional list of g++ warning flags that a particular
3159 dnl             application might want to use, e.g., "no-unused" for
3160 dnl             -Wno-unused
3161 dnl Special:
3162 dnl     If $with_ext_const is "yes", add a check for -Wwrite-strings
3163 dnl
3164 AC_DEFUN([CF_GXX_WARNINGS],
3165 [
3166
3167 CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS)
3168 CF_CLANG_COMPILER(GXX,CLANG_CPLUSPLUS,CXXFLAGS)
3169
3170 AC_REQUIRE([CF_GXX_VERSION])
3171
3172 AC_LANG_SAVE
3173 AC_LANG_CPLUSPLUS
3174
3175 cat > conftest.$ac_ext <<EOF
3176 #line __oline__ "configure"
3177 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
3178 EOF
3179
3180 if test "$INTEL_CPLUSPLUS" = yes
3181 then
3182 # The "-wdXXX" options suppress warnings:
3183 # remark #1419: external declaration in primary source file
3184 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
3185 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
3186 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
3187 # remark #193: zero used for undefined preprocessing identifier
3188 # remark #593: variable "curs_sb_left_arrow" was set but never used
3189 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
3190 # remark #869: parameter "tw" was never referenced
3191 # remark #981: operands are evaluated in unspecified order
3192 # warning #269: invalid format string conversion
3193
3194         AC_CHECKING([for $CC warning options])
3195         cf_save_CXXFLAGS="$CXXFLAGS"
3196         EXTRA_CXXFLAGS="-Wall"
3197         for cf_opt in \
3198                 wd1419 \
3199                 wd1682 \
3200                 wd1683 \
3201                 wd1684 \
3202                 wd193 \
3203                 wd279 \
3204                 wd593 \
3205                 wd810 \
3206                 wd869 \
3207                 wd981
3208         do
3209                 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt"
3210                 if AC_TRY_EVAL(ac_compile); then
3211                         test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
3212                         EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
3213                 fi
3214         done
3215         CXXFLAGS="$cf_save_CXXFLAGS"
3216
3217 elif test "$GXX" = yes
3218 then
3219         AC_CHECKING([for $CXX warning options])
3220         cf_save_CXXFLAGS="$CXXFLAGS"
3221         EXTRA_CXXFLAGS="-W -Wall"
3222         cf_gxx_extra_warnings=""
3223         test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings"
3224         case "$GCC_VERSION" in
3225         ([[1-2]].*)
3226                 ;;
3227         (*)
3228                 cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++"
3229                 ;;
3230         esac
3231         for cf_opt in \
3232                 Wabi \
3233                 fabi-version=0 \
3234                 Wextra \
3235                 Wignored-qualifiers \
3236                 Wlogical-op \
3237                 Woverloaded-virtual \
3238                 Wsign-promo \
3239                 Wsynth \
3240                 Wold-style-cast \
3241                 Wcast-align \
3242                 Wcast-qual \
3243                 Wpointer-arith \
3244                 Wshadow \
3245                 Wundef $cf_gxx_extra_warnings $1
3246         do
3247                 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt"
3248                 if AC_TRY_EVAL(ac_compile); then
3249                         test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
3250                         EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
3251                 else
3252                         test -n "$verbose" && AC_MSG_RESULT(... no -$cf_opt)
3253                 fi
3254         done
3255         CXXFLAGS="$cf_save_CXXFLAGS"
3256 fi
3257
3258 rm -rf conftest*
3259 AC_LANG_RESTORE
3260 AC_SUBST(EXTRA_CXXFLAGS)
3261 ])dnl
3262 dnl ---------------------------------------------------------------------------
3263 dnl CF_HASHED_DB version: 7 updated: 2015/04/18 08:56:57
3264 dnl ------------
3265 dnl Look for an instance of the Berkeley hashed database.
3266 dnl
3267 dnl $1 = optional parameter, to specify install-prefix for the database.
3268 AC_DEFUN([CF_HASHED_DB],
3269 [
3270 ifelse([$1],,,[
3271 case $1 in
3272 (yes|*able*)
3273         ;;
3274 (*)
3275         if test -d "$1" ; then
3276                 CF_ADD_INCDIR($1/include)
3277                 CF_ADD_LIBDIR($1/lib)
3278         else
3279                 case "$1" in
3280                 (./*|../*|/*)
3281                         AC_MSG_WARN(no such directory $1)
3282                         ;;
3283                 (*)
3284                         CF_FIND_SUB_INCDIR($1)
3285                         CF_FIND_SUB_LIBDIR($1)
3286                         ;;
3287                 esac
3288         fi
3289 esac
3290 ])
3291 AC_CHECK_HEADER(db.h,[
3292 CF_HASHED_DB_VERSION
3293 if test "$cf_cv_hashed_db_version" = unknown ; then
3294         AC_MSG_ERROR(Cannot determine version of db)
3295 else
3296         CF_HASHED_DB_LIBS
3297         if test "$cf_cv_hashed_db_libs" = unknown ; then
3298                 AC_MSG_ERROR(Cannot determine library for db)
3299         elif test "$cf_cv_hashed_db_libs" != default ; then
3300                 CF_ADD_LIB($cf_cv_hashed_db_libs)
3301         fi
3302 fi
3303 ],[
3304         AC_MSG_ERROR(Cannot find db.h)
3305 ])
3306 ])dnl
3307 dnl ---------------------------------------------------------------------------
3308 dnl CF_HASHED_DB_LIBS version: 9 updated: 2010/05/29 16:31:02
3309 dnl -----------------
3310 dnl Given that we have the header and version for hashed database, find the
3311 dnl library information.
3312 AC_DEFUN([CF_HASHED_DB_LIBS],
3313 [
3314 AC_CACHE_CHECK(for db libraries, cf_cv_hashed_db_libs,[
3315 cf_cv_hashed_db_libs=unknown
3316 for cf_db_libs in "" db$cf_cv_hashed_db_version db-$cf_cv_hashed_db_version db ''
3317 do
3318         cf_save_libs="$LIBS"
3319         if test -n "$cf_db_libs"; then
3320                 CF_ADD_LIB($cf_db_libs)
3321         fi
3322         CF_MSG_LOG(checking for library "$cf_db_libs")
3323         AC_TRY_LINK([
3324 $ac_includes_default
3325 #include <db.h>
3326 ],[
3327         char *path = "/tmp/foo";
3328 #ifdef DB_VERSION_MAJOR
3329 #if DB_VERSION_MAJOR >= 4
3330         DB *result = 0;
3331         db_create(&result, NULL, 0);
3332         result->open(result,
3333                 NULL,
3334                 path,
3335                 path,
3336                 DB_HASH,
3337                 DB_CREATE,
3338                 0644);
3339 #elif DB_VERSION_MAJOR >= 3
3340         DB *result = 0;
3341         db_create(&result, NULL, 0);
3342         result->open(result,
3343                 path,
3344                 path,
3345                 DB_HASH,
3346                 DB_CREATE,
3347                 0644);
3348 #elif DB_VERSION_MAJOR >= 2
3349         DB *result = 0;
3350         db_open(path,
3351                 DB_HASH,
3352                 DB_CREATE,
3353                 0644,
3354                 (DB_ENV *) 0,
3355                 (DB_INFO *) 0,
3356                 &result);
3357 #endif /* DB_VERSION_MAJOR */
3358 #else
3359         DB *result = dbopen(path,
3360                      2,
3361                      0644,
3362                      DB_HASH,
3363                      0);
3364 #endif
3365         ${cf_cv_main_return:-return}(result != 0)
3366 ],[
3367         if test -n "$cf_db_libs" ; then
3368                 cf_cv_hashed_db_libs=$cf_db_libs
3369         else
3370                 cf_cv_hashed_db_libs=default
3371         fi
3372         LIBS="$cf_save_libs"
3373         break
3374 ])
3375         LIBS="$cf_save_libs"
3376 done
3377 ])
3378 ])dnl
3379 dnl ---------------------------------------------------------------------------
3380 dnl CF_HASHED_DB_VERSION version: 4 updated: 2014/04/12 16:47:01
3381 dnl --------------------
3382 dnl Given that we have the header file for hashed database, find the version
3383 dnl information.
3384 AC_DEFUN([CF_HASHED_DB_VERSION],
3385 [
3386 AC_CACHE_CHECK(for version of db, cf_cv_hashed_db_version,[
3387 cf_cv_hashed_db_version=unknown
3388
3389 for cf_db_version in 1 2 3 4 5 6
3390 do
3391         CF_MSG_LOG(checking for db version $cf_db_version)
3392         AC_TRY_COMPILE([
3393 $ac_includes_default
3394 #include <db.h>
3395
3396 #ifdef DB_VERSION_MAJOR
3397         /* db2 (DB_VERSION_MAJOR=2) has also DB_VERSION_MINOR, tested with 7 */
3398 #if $cf_db_version == DB_VERSION_MAJOR
3399         /* ok */
3400 #else
3401         make an error
3402 #endif
3403 #else
3404 #if $cf_db_version == 1
3405         /* ok: assuming this is DB 1.8.5 */
3406 #else
3407         make an error
3408 #endif
3409 #endif
3410 ],[DBT *foo = 0],[
3411         cf_cv_hashed_db_version=$cf_db_version
3412         break
3413         ])
3414 done
3415 ])
3416 ])dnl
3417 dnl ---------------------------------------------------------------------------
3418 dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48
3419 dnl --------------
3420 dnl Construct a search-list of directories for a nonstandard header-file
3421 dnl
3422 dnl Parameters
3423 dnl     $1 = the variable to return as result
3424 dnl     $2 = the package name
3425 AC_DEFUN([CF_HEADER_PATH],
3426 [
3427 $1=
3428
3429 # collect the current set of include-directories from compiler flags
3430 cf_header_path_list=""
3431 if test -n "${CFLAGS}${CPPFLAGS}" ; then
3432         for cf_header_path in $CPPFLAGS $CFLAGS
3433         do
3434                 case $cf_header_path in
3435                 (-I*)
3436                         cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
3437                         CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
3438                         cf_header_path_list="$cf_header_path_list [$]$1"
3439                         ;;
3440                 esac
3441         done
3442 fi
3443
3444 # add the variations for the package we are looking for
3445 CF_SUBDIR_PATH($1,$2,include)
3446
3447 test "$includedir" != NONE && \
3448 test "$includedir" != "/usr/include" && \
3449 test -d "$includedir" && {
3450         test -d $includedir &&    $1="[$]$1 $includedir"
3451         test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
3452 }
3453
3454 test "$oldincludedir" != NONE && \
3455 test "$oldincludedir" != "/usr/include" && \
3456 test -d "$oldincludedir" && {
3457         test -d $oldincludedir    && $1="[$]$1 $oldincludedir"
3458         test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
3459 }
3460
3461 $1="[$]$1 $cf_header_path_list"
3462 ])dnl
3463 dnl ---------------------------------------------------------------------------
3464 dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
3465 dnl ---------------
3466 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
3467 AC_DEFUN([CF_HELP_MESSAGE],
3468 [AC_DIVERT_HELP([$1])dnl
3469 ])dnl
3470 dnl ---------------------------------------------------------------------------
3471 dnl CF_INCLUDE_DIRS version: 10 updated: 2014/09/19 20:58:42
3472 dnl ---------------
3473 dnl Construct the list of include-options according to whether we're building
3474 dnl in the source directory or using '--srcdir=DIR' option.
3475 AC_DEFUN([CF_INCLUDE_DIRS],
3476 [
3477 if test "$srcdir" != "."; then
3478         CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS"
3479 fi
3480 CPPFLAGS="-I../include $CPPFLAGS"
3481 if test "$srcdir" != "."; then
3482         CPPFLAGS="-I\${srcdir} $CPPFLAGS"
3483 fi
3484 CPPFLAGS="-I. $CPPFLAGS"
3485 AC_SUBST(CPPFLAGS)
3486 ])dnl
3487 dnl ---------------------------------------------------------------------------
3488 dnl CF_INSTALL_OPTS version: 2 updated: 2018/08/18 12:19:21
3489 dnl ---------------
3490 dnl prompt for/fill-in useful install-program options
3491 AC_DEFUN([CF_INSTALL_OPTS],
3492 [
3493 CF_INSTALL_OPT_S
3494 CF_INSTALL_OPT_P
3495 CF_INSTALL_OPT_O
3496 ])dnl
3497 dnl ---------------------------------------------------------------------------
3498 dnl CF_INSTALL_OPT_O version: 2 updated: 2015/05/15 19:45:35
3499 dnl ----------------
3500 dnl Almost all "install" programs default to the current user's ownership.
3501 dnl Almost - MINIX is an exception.
3502 AC_DEFUN([CF_INSTALL_OPT_O],
3503 [
3504 AC_MSG_CHECKING(if install needs to be told about ownership)
3505 case `$ac_config_guess` in
3506 (*minix)
3507         with_install_o=yes
3508         ;;
3509 (*)
3510         with_install_o=no
3511         ;;
3512 esac
3513
3514 AC_MSG_RESULT($with_install_o)
3515 if test "x$with_install_o" = xyes
3516 then
3517         INSTALL_OPT_O=`id root|sed -e 's/uid=[[0-9]]*(/ -o /' -e 's/gid=[[0-9]]*(/ -g /' -e 's/ [[^=[:space:]]][[^=[:space:]]]*=.*/ /' -e 's/)//g'`
3518 else
3519         INSTALL_OPT_O=
3520 fi
3521
3522 AC_SUBST(INSTALL_OPT_O)
3523 ])dnl
3524 dnl ---------------------------------------------------------------------------
3525 dnl CF_INSTALL_OPT_P version: 1 updated: 2018/08/18 12:19:21
3526 dnl ----------------
3527 dnl Some install-programs accept a "-p" option to preserve file modification
3528 dnl timestamps.  That can be useful as an install option, as well as a way to
3529 dnl avoid the need for ranlib after copying a static archive.
3530 AC_DEFUN([CF_INSTALL_OPT_P],
3531 [
3532 : ${INSTALL:=install}
3533 AC_CACHE_CHECK(if install accepts -p option, cf_cv_install_p,[
3534         rm -rf conftest*
3535         date >conftest.in
3536         mkdir conftest.out
3537         sleep 3
3538         if $INSTALL -p conftest.in conftest.out 2>/dev/null
3539         then
3540                 if test -f conftest.out/conftest.in
3541                 then
3542                         test conftest.in -nt conftest.out/conftest.in 2>conftest.err && \
3543                         test conftest.out/conftest.in -nt conftest.in 2>conftest.err
3544                         if test -s conftest.err
3545                         then
3546                                 cf_cv_install_p=no
3547                         else
3548                                 cf_cv_install_p=yes
3549                         fi
3550                 else
3551                         cf_cv_install_p=no
3552                 fi
3553         else
3554                 cf_cv_install_p=no
3555         fi
3556         rm -rf conftest*
3557 ])
3558 ])dnl
3559 dnl ---------------------------------------------------------------------------
3560 dnl CF_INSTALL_OPT_S version: 2 updated: 2018/08/18 12:19:21
3561 dnl ----------------
3562 dnl By default, we should strip executables which are installed, but leave the
3563 dnl ability to suppress that for unit-testing.
3564 AC_DEFUN([CF_INSTALL_OPT_S],
3565 [
3566 AC_MSG_CHECKING(if you want to install stripped executables)
3567 CF_ARG_DISABLE(stripping,
3568         [  --disable-stripping     do not strip (debug info) installed executables],
3569         [with_stripping=no],
3570         [with_stripping=yes])
3571 AC_MSG_RESULT($with_stripping)
3572
3573 if test "$with_stripping" = yes
3574 then
3575         INSTALL_OPT_S="-s"
3576 else
3577         INSTALL_OPT_S=
3578 fi
3579 AC_SUBST(INSTALL_OPT_S)
3580 ])dnl
3581 dnl ---------------------------------------------------------------------------
3582 dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00
3583 dnl -----------------
3584 dnl Check if the given compiler is really the Intel compiler for Linux.  It
3585 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
3586 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
3587 dnl
3588 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
3589 dnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
3590 dnl the wrappers for gcc and g++ warnings.
3591 dnl
3592 dnl $1 = GCC (default) or GXX
3593 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
3594 dnl $3 = CFLAGS (default) or CXXFLAGS
3595 AC_DEFUN([CF_INTEL_COMPILER],[
3596 AC_REQUIRE([AC_CANONICAL_HOST])
3597 ifelse([$2],,INTEL_COMPILER,[$2])=no
3598
3599 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
3600         case $host_os in
3601         (linux*|gnu*)
3602                 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
3603                 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
3604                 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
3605                 AC_TRY_COMPILE([],[
3606 #ifdef __INTEL_COMPILER
3607 #else
3608 make an error
3609 #endif
3610 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
3611 cf_save_CFLAGS="$cf_save_CFLAGS -we147"
3612 ],[])
3613                 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
3614                 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
3615                 ;;
3616         esac
3617 fi
3618 ])dnl
3619 dnl ---------------------------------------------------------------------------
3620 dnl CF_ISASCII version: 4 updated: 2012/10/06 17:56:13
3621 dnl ----------
3622 dnl Check if we have either a function or macro for 'isascii()'.
3623 AC_DEFUN([CF_ISASCII],
3624 [
3625 AC_MSG_CHECKING(for isascii)
3626 AC_CACHE_VAL(cf_cv_have_isascii,[
3627         AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
3628         [cf_cv_have_isascii=yes],
3629         [cf_cv_have_isascii=no])
3630 ])dnl
3631 AC_MSG_RESULT($cf_cv_have_isascii)
3632 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII,1,[Define to 1 if we have isascii()])
3633 ])dnl
3634 dnl ---------------------------------------------------------------------------
3635 dnl CF_LARGEFILE version: 11 updated: 2018/06/20 20:23:13
3636 dnl ------------
3637 dnl Add checks for large file support.
3638 AC_DEFUN([CF_LARGEFILE],[
3639 ifdef([AC_FUNC_FSEEKO],[
3640         AC_SYS_LARGEFILE
3641         if test "$enable_largefile" != no ; then
3642         AC_FUNC_FSEEKO
3643
3644         # Normally we would collect these definitions in the config.h,
3645         # but (like _XOPEN_SOURCE), some environments rely on having these
3646         # defined before any of the system headers are included.  Another
3647         # case comes up with C++, e.g., on AIX the compiler compiles the
3648         # header files by themselves before looking at the body files it is
3649         # told to compile.  For ncurses, those header files do not include
3650         # the config.h
3651         if test "$ac_cv_sys_large_files" != no
3652         then
3653                 CF_APPEND_TEXT(CPPFLAGS,-D_LARGE_FILES)
3654         fi
3655         if test "$ac_cv_sys_largefile_source" != no
3656         then
3657                 CF_APPEND_TEXT(CPPFLAGS,-D_LARGEFILE_SOURCE)
3658         fi
3659         if test "$ac_cv_sys_file_offset_bits" != no
3660         then
3661                 CF_APPEND_TEXT(CPPFLAGS,-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits)
3662         fi
3663
3664         AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
3665                 AC_TRY_COMPILE([
3666 #pragma GCC diagnostic error "-Wincompatible-pointer-types"
3667 #include <sys/types.h>
3668 #include <dirent.h>
3669                 ],[
3670                 /* if transitional largefile support is setup, this is true */
3671                 extern struct dirent64 * readdir(DIR *);
3672                 struct dirent64 *x = readdir((DIR *)0);
3673                 struct dirent *y = readdir((DIR *)0);
3674                 int z = x - y;
3675                 ],
3676                 [cf_cv_struct_dirent64=yes],
3677                 [cf_cv_struct_dirent64=no])
3678         ])
3679         test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
3680         fi
3681 ])
3682 ])
3683 dnl ---------------------------------------------------------------------------
3684 dnl CF_LDFLAGS_STATIC version: 12 updated: 2015/04/18 08:56:57
3685 dnl -----------------
3686 dnl Check for compiler/linker flags used to temporarily force usage of static
3687 dnl libraries.  This depends on the compiler and platform.  Use this to help
3688 dnl ensure that the linker picks up a given library based on its position in
3689 dnl the list of linker options and libraries.
3690 AC_DEFUN([CF_LDFLAGS_STATIC],[
3691
3692 if test "$GCC" = yes ; then
3693         case $cf_cv_system_name in
3694         (OS/2*|os2*|aix[[4]]*|solaris2.1[[0-9]]|darwin*)
3695                 LDFLAGS_STATIC=
3696                 LDFLAGS_SHARED=
3697                 ;;
3698         (*)     # normally, except when broken
3699                 LDFLAGS_STATIC=-static
3700                 LDFLAGS_SHARED=-dynamic
3701                 ;;
3702         esac
3703 else
3704         case $cf_cv_system_name in
3705         (aix[[4-7]]*)   # from ld manpage
3706                 LDFLAGS_STATIC=-bstatic
3707                 LDFLAGS_SHARED=-bdynamic
3708                 ;;
3709         (hpux*)         # from ld manpage for hpux10.20, hpux11.11
3710                 # We could also use just "archive" and "shared".
3711                 LDFLAGS_STATIC=-Wl,-a,archive_shared
3712                 LDFLAGS_SHARED=-Wl,-a,shared_archive
3713                 ;;
3714         (irix*)         # from ld manpage IRIX64
3715                 LDFLAGS_STATIC=-Bstatic
3716                 LDFLAGS_SHARED=-Bdynamic
3717                 ;;
3718         (osf[[45]]*)    # from ld manpage osf4.0d, osf5.1
3719                 # alternative "-oldstyle_liblookup" (not in cc manpage)
3720                 LDFLAGS_STATIC=-noso
3721                 LDFLAGS_SHARED=-so_archive
3722                 ;;
3723         (solaris2*)
3724                 LDFLAGS_STATIC=-Bstatic
3725                 LDFLAGS_SHARED=-Bdynamic
3726                 ;;
3727         esac
3728 fi
3729
3730 if test -n "$LDFLAGS_STATIC" && test -n "$LDFLAGS_SHARED"
3731 then
3732         AC_MSG_CHECKING(if linker supports switching between static/dynamic)
3733
3734         rm -f libconftest.a
3735         cat >conftest.$ac_ext <<EOF
3736 #line __oline__ "configure"
3737 #include <stdio.h>
3738 int cf_ldflags_static(FILE *fp) { return fflush(fp); }
3739 EOF
3740         if AC_TRY_EVAL(ac_compile) ; then
3741                 ( $AR $ARFLAGS libconftest.a conftest.o ) 2>&AC_FD_CC 1>/dev/null
3742                 ( eval $RANLIB libconftest.a ) 2>&AC_FD_CC >/dev/null
3743         fi
3744         rm -f conftest.*
3745
3746         cf_save_LIBS="$LIBS"
3747
3748         LIBS="$LDFLAGS_STATIC -L`pwd` -lconftest $LDFLAGS_DYNAMIC $LIBS"
3749         AC_TRY_LINK([
3750 #line __oline__ "configure"
3751 #include <stdio.h>
3752 int cf_ldflags_static(FILE *fp);
3753 ],[
3754         return cf_ldflags_static(stdin);
3755 ],[
3756         # some linkers simply ignore the -dynamic
3757         case x`file conftest$ac_exeext 2>/dev/null` in
3758         (*static*)
3759                 cf_ldflags_static=no
3760                 ;;
3761         (*)
3762                 cf_ldflags_static=yes
3763                 ;;
3764         esac
3765 ],[cf_ldflags_static=no])
3766
3767         rm -f libconftest.*
3768         LIBS="$cf_save_LIBS"
3769
3770         AC_MSG_RESULT($cf_ldflags_static)
3771
3772         if test $cf_ldflags_static != yes
3773         then
3774                 LDFLAGS_STATIC=
3775                 LDFLAGS_SHARED=
3776         fi
3777 else
3778         LDFLAGS_STATIC=
3779         LDFLAGS_SHARED=
3780 fi
3781
3782 AC_SUBST(LDFLAGS_STATIC)
3783 AC_SUBST(LDFLAGS_SHARED)
3784 ])
3785 dnl ---------------------------------------------------------------------------
3786 dnl CF_LD_RPATH_OPT version: 8 updated: 2018/08/18 16:36:35
3787 dnl ---------------
3788 dnl For the given system and compiler, find the compiler flags to pass to the
3789 dnl loader to use the "rpath" feature.
3790 AC_DEFUN([CF_LD_RPATH_OPT],
3791 [
3792 AC_REQUIRE([CF_CHECK_CACHE])
3793
3794 LD_RPATH_OPT=
3795 if test "x$cf_cv_enable_rpath" != xno
3796 then
3797         AC_MSG_CHECKING(for an rpath option)
3798         case $cf_cv_system_name in
3799         (irix*)
3800                 if test "$GCC" = yes; then
3801                         LD_RPATH_OPT="-Wl,-rpath,"
3802                 else
3803                         LD_RPATH_OPT="-rpath "
3804                 fi
3805                 ;;
3806         (linux*|gnu*|k*bsd*-gnu|freebsd*)
3807                 LD_RPATH_OPT="-Wl,-rpath,"
3808                 ;;
3809         (openbsd[[2-9]].*|mirbsd*)
3810                 LD_RPATH_OPT="-Wl,-rpath,"
3811                 ;;
3812         (dragonfly*)
3813                 LD_RPATH_OPT="-rpath "
3814                 ;;
3815         (netbsd*)
3816                 LD_RPATH_OPT="-Wl,-rpath,"
3817                 ;;
3818         (osf*|mls+*)
3819                 LD_RPATH_OPT="-rpath "
3820                 ;;
3821         (solaris2*)
3822                 LD_RPATH_OPT="-R"
3823                 ;;
3824         (*)
3825                 ;;
3826         esac
3827         AC_MSG_RESULT($LD_RPATH_OPT)
3828
3829         case "x$LD_RPATH_OPT" in
3830         (x-R*)
3831                 AC_MSG_CHECKING(if we need a space after rpath option)
3832                 cf_save_LIBS="$LIBS"
3833                 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
3834                 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
3835                 LIBS="$cf_save_LIBS"
3836                 AC_MSG_RESULT($cf_rpath_space)
3837                 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
3838                 ;;
3839         esac
3840 fi
3841 ])dnl
3842 dnl ---------------------------------------------------------------------------
3843 dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48
3844 dnl ---------------
3845 dnl Construct a search-list of directories for a nonstandard library-file
3846 dnl
3847 dnl Parameters
3848 dnl     $1 = the variable to return as result
3849 dnl     $2 = the package name
3850 AC_DEFUN([CF_LIBRARY_PATH],
3851 [
3852 $1=
3853 cf_library_path_list=""
3854 if test -n "${LDFLAGS}${LIBS}" ; then
3855         for cf_library_path in $LDFLAGS $LIBS
3856         do
3857                 case $cf_library_path in
3858                 (-L*)
3859                         cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
3860                         CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
3861                         cf_library_path_list="$cf_library_path_list [$]$1"
3862                         ;;
3863                 esac
3864         done
3865 fi
3866
3867 CF_SUBDIR_PATH($1,$2,lib)
3868
3869 $1="$cf_library_path_list [$]$1"
3870 ])dnl
3871 dnl ---------------------------------------------------------------------------
3872 dnl CF_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
3873 dnl ------------------
3874 AC_DEFUN([CF_LIBTOOL_VERSION],[
3875 if test -n "$LIBTOOL" && test "$LIBTOOL" != none
3876 then
3877         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.]].*//'`
3878 else
3879         cf_cv_libtool_version=
3880 fi
3881 test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version
3882 ])dnl
3883 dnl ---------------------------------------------------------------------------
3884 dnl CF_LIB_PREFIX version: 12 updated: 2015/10/17 19:03:33
3885 dnl -------------
3886 dnl Compute the library-prefix for the given host system
3887 dnl $1 = variable to set
3888 define([CF_LIB_PREFIX],
3889 [
3890         case $cf_cv_system_name in
3891         (OS/2*|os2*)
3892                 if test "$DFT_LWR_MODEL" = libtool; then
3893                         LIB_PREFIX='lib'
3894                 else
3895                         LIB_PREFIX=''
3896                 fi
3897                 ;;
3898         (*)     LIB_PREFIX='lib'
3899                 ;;
3900         esac
3901 ifelse($1,,,[$1=$LIB_PREFIX])
3902         AC_SUBST(LIB_PREFIX)
3903 ])dnl
3904 dnl ---------------------------------------------------------------------------
3905 dnl CF_LIB_RULES version: 88 updated: 2018/08/18 12:19:21
3906 dnl ------------
3907 dnl Append definitions and rules for the given models to the subdirectory
3908 dnl Makefiles, and the recursion rule for the top-level Makefile.  If the
3909 dnl subdirectory is a library-source directory, modify the Libs_To_Make list in
3910 dnl the corresponding makefile to list the models that we'll generate.
3911 dnl
3912 dnl For shared libraries, make a list of symbolic links to construct when
3913 dnl generating each library.  The convention used for Linux is the simplest
3914 dnl one:
3915 dnl     lib<name>.so    ->
3916 dnl     lib<name>.so.<major>    ->
3917 dnl     lib<name>.so.<maj>.<minor>
3918 dnl
3919 dnl Note: Libs_To_Make is mixed case, since it is not a pure autoconf variable.
3920 AC_DEFUN([CF_LIB_RULES],
3921 [
3922 cf_prefix=$LIB_PREFIX
3923 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
3924
3925 case $cf_cv_shlib_version in
3926 (cygdll|msysdll|mingw)
3927         TINFO_NAME=$TINFO_ARG_SUFFIX
3928         TINFO_SUFFIX=.dll
3929         ;;
3930 esac
3931
3932 if test -n "$TINFO_SUFFIX" ; then
3933         case $TINFO_SUFFIX in
3934         (tw*)
3935                 TINFO_NAME="${TINFO_NAME}tw${EXTRA_SUFFIX}"
3936                 TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^tw'$EXTRA_SUFFIX'//'`
3937                 ;;
3938         (t*)
3939                 TINFO_NAME="${TINFO_NAME}t${EXTRA_SUFFIX}"
3940                 TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^t'$EXTRA_SUFFIX'//'`
3941                 ;;
3942         (w*)
3943                 TINFO_NAME="${TINFO_NAME}w${EXTRA_SUFFIX}"
3944                 TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^w'$EXTRA_SUFFIX'//'`
3945                 ;;
3946         esac
3947 fi
3948
3949 for cf_dir in $SRC_SUBDIRS
3950 do
3951         if test ! -d $srcdir/$cf_dir ; then
3952                 continue
3953         elif test -f $srcdir/$cf_dir/modules; then
3954
3955                 SHARED_LIB=
3956                 Libs_To_Make=
3957                 cf_awk_program=
3958                 if test -n "${cf_cv_abi_version}" && test "x${cf_cv_abi_version}" != "x5"
3959                 then
3960                         cf_awk_program="$cf_awk_program\
3961 /deprecated in ABI${cf_cv_abi_version}/ { next; }\
3962 { sub(\"NCURSES([[WT]]+)?\", \"&${cf_cv_abi_version}\"); }\
3963 "
3964                 fi
3965
3966                 if test "x$WILDCARD_SYMS" = xno
3967                 then
3968                         cf_awk_program="$cf_awk_program\
3969 /[[     ]]_\\*;/ { skip=1; next; }\
3970 "
3971                 fi
3972
3973                 if test "x$cf_awk_program" != "x"
3974                 then
3975                         cat >>$cf_dir/Makefile <<CF_EOF
3976
3977 # Generated by CF_LIB_RULES
3978 resulting.map: $UNALTERED_SYMS
3979         $AWK 'BEGIN { skip = 1; last=""; } \
3980 $cf_awk_program \
3981 { if ( last != "" && ( skip == 0 || \[$]\[$]0 !~ /}/ ) ) { print last; }\
3982  skip = 0; last = \[$]\[$]0; } \
3983 END { print last; }' < $UNALTERED_SYMS >\[$]@
3984
3985 distclean::
3986         rm -f resulting.map
3987 CF_EOF
3988                 fi
3989
3990                 for cf_item in $cf_LIST_MODELS
3991                 do
3992                         CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
3993                         cf_libname=$cf_dir
3994                         test "$cf_dir" = c++ && cf_libname=ncurses++
3995                         if test $cf_item = shared ; then
3996                                 if test -n "${LIB_SUFFIX}"
3997                                 then
3998                                         cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${USE_LIB_SUFFIX}"'//'`
3999                                 else
4000                                         cf_shared_suffix="$cf_suffix"
4001                                 fi
4002                                 if test "$cf_cv_do_symlinks" = yes ; then
4003                                         cf_version_name=
4004
4005                                         case "$cf_cv_shlib_version" in
4006                                         (rel)
4007                                                 cf_version_name=REL_VERSION
4008                                                 ;;
4009                                         (abi)
4010                                                 cf_version_name=ABI_VERSION
4011                                                 ;;
4012                                         esac
4013
4014                                         if test -n "$cf_version_name"
4015                                         then
4016                                                 case "$cf_cv_system_name" in
4017                                                 (darwin*)
4018                                                         # "w", etc?
4019                                                         cf_suffix="${USE_LIB_SUFFIX}"'.${'$cf_version_name'}'"$cf_shared_suffix"
4020                                                         ;;
4021                                                 (*)
4022                                                         cf_suffix="$cf_suffix"'.${'$cf_version_name'}'
4023                                                         ;;
4024                                                 esac
4025                                         fi
4026                                         if test -n "${USE_LIB_SUFFIX}"
4027                                         then
4028                                                 cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${USE_LIB_SUFFIX}"'//'`
4029                                         else
4030                                                 cf_shared_suffix="$cf_suffix"
4031                                         fi
4032                                 fi
4033                                 # cygwin needs import library, and has unique naming convention
4034                                 # use autodetected ${cf_prefix} for import lib and static lib, but
4035                                 # use 'cyg' prefix for shared lib.
4036                                 case $cf_cv_shlib_version in
4037                                 (cygdll)
4038                                         cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
4039                                         cf_add_lib="../lib/cyg${cf_libname}${cf_cygsuf}"
4040                                         ;;
4041                                 (msysdll)
4042                                         cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
4043                                         cf_add_lib="../lib/msys-${cf_libname}${cf_cygsuf}"
4044                                         ;;
4045                                 (mingw)
4046                                         cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
4047                                         cf_add_lib="../lib/lib${cf_libname}${cf_cygsuf}"
4048                                         ;;
4049                                 (*)
4050                                         cf_add_lib=
4051                                         ;;
4052                                 esac
4053                                 if test -n "$cf_add_lib"
4054                                 then
4055                                         Libs_To_Make="$Libs_To_Make $cf_add_lib"
4056                                         continue
4057                                 fi
4058                         fi
4059                         cf_add_lib="../lib/${cf_prefix}${cf_libname}${cf_suffix}"
4060                         Libs_To_Make="$Libs_To_Make $cf_add_lib"
4061                 done
4062
4063                 if test $cf_dir = ncurses ; then
4064                         cf_subsets="$LIB_SUBSETS"
4065                         cf_r_parts="$cf_subsets"
4066                         cf_liblist="$Libs_To_Make"
4067
4068                         while test -n "$cf_r_parts"
4069                         do
4070                                 cf_l_parts=`echo "$cf_r_parts" |sed -e 's/ .*$//'`
4071                                 cf_r_parts=`echo "$cf_r_parts" |sed -e 's/^[[^ ]]* //'`
4072                                 if test "$cf_l_parts" != "$cf_r_parts" ; then
4073                                         cf_add_lib=
4074                                         case $cf_l_parts in
4075                                         (*termlib*)
4076                                                 cf_add_lib=`echo $cf_liblist |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g`
4077                                                 ;;
4078                                         (*ticlib*)
4079                                                 cf_add_lib=`echo $cf_liblist |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TICS_LIB_SUFFIX}%g`
4080                                                 ;;
4081                                         (*)
4082                                                 break
4083                                                 ;;
4084                                         esac
4085                                         if test -n "$cf_add_lib"; then
4086                                                 Libs_To_Make="$cf_add_lib $Libs_To_Make"
4087                                         fi
4088                                 else
4089                                         break
4090                                 fi
4091                         done
4092                 else
4093                         cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
4094                 fi
4095
4096                 if test $cf_dir = c++; then
4097                         if test "x$with_shared_cxx" != xyes && test -n "$cf_shared_suffix"; then
4098                                 cf_list=
4099                                 for cf_item in $Libs_To_Make
4100                                 do
4101                                         case $cf_item in
4102                                         (*.a)
4103                                                 ;;
4104                                         (*)
4105                                                 cf_item=`echo "$cf_item" | sed -e "s,"$cf_shared_suffix",.a,"`
4106                                                 ;;
4107                                         esac
4108                                         for cf_test in $cf_list
4109                                         do
4110                                                 if test "$cf_test" = "$cf_item"
4111                                                 then
4112                                                         cf_LIST_MODELS=`echo "$cf_LIST_MODELS" | sed -e 's/normal//'`
4113                                                         cf_item=
4114                                                         break
4115                                                 fi
4116                                         done
4117                                         test -n "$cf_item" && cf_list="$cf_list $cf_item"
4118                                 done
4119                                 Libs_To_Make="$cf_list"
4120                         fi
4121                 fi
4122
4123                 sed -e "s%@Libs_To_Make@%$Libs_To_Make%" \
4124                     -e "s%@SHARED_LIB@%$SHARED_LIB%" \
4125                         $cf_dir/Makefile >$cf_dir/Makefile.out
4126                 mv $cf_dir/Makefile.out $cf_dir/Makefile
4127
4128                 $AWK -f $srcdir/mk-0th.awk \
4129                         libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" ticlib="$TICS_LIB_SUFFIX" termlib="$TINFO_LIB_SUFFIX" \
4130                         $srcdir/$cf_dir/modules >>$cf_dir/Makefile
4131
4132                 for cf_subset in $cf_subsets
4133                 do
4134                         cf_subdirs=
4135                         for cf_item in $cf_LIST_MODELS
4136                         do
4137
4138                         echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
4139                         CF_UPPER(cf_ITEM,$cf_item)
4140
4141                         CXX_MODEL=$cf_ITEM
4142                         if test "$CXX_MODEL" = SHARED; then
4143                                 case $cf_cv_shlib_version in
4144                                 (cygdll|msysdll|mingw)
4145                                         test "x$with_shared_cxx" = xno && CF_VERBOSE(overriding CXX_MODEL to SHARED)
4146                                         with_shared_cxx=yes
4147                                         ;;
4148                                 (*)
4149                                         test "x$with_shared_cxx" = xno && CXX_MODEL=NORMAL
4150                                         ;;
4151                                 esac
4152                         fi
4153
4154                         CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
4155                         CF_OBJ_SUBDIR($cf_item,cf_subdir)
4156
4157                         # Test for case where we build libtinfo with a different name.
4158                         cf_libname=$cf_dir
4159                         if test $cf_dir = ncurses ; then
4160                                 case $cf_subset in
4161                                 (*base*)
4162                                         cf_libname=${cf_libname}$USE_LIB_SUFFIX
4163                                         ;;
4164                                 (*termlib*)
4165                                         cf_libname=$TINFO_LIB_SUFFIX
4166                                         ;;
4167                                 (ticlib*)
4168                                         cf_libname=$TICS_LIB_SUFFIX
4169                                         ;;
4170                                 esac
4171                         elif test $cf_dir = c++ ; then
4172                                 cf_libname=ncurses++$USE_LIB_SUFFIX
4173                         else
4174                                 cf_libname=${cf_libname}$USE_LIB_SUFFIX
4175                         fi
4176                         if test -n "${USE_ARG_SUFFIX}" ; then
4177                                 # undo $USE_LIB_SUFFIX add-on in CF_LIB_SUFFIX
4178                                 cf_suffix=`echo $cf_suffix |sed -e "s%^${USE_LIB_SUFFIX}%%"`
4179                         fi
4180
4181                         # These dependencies really are for development, not
4182                         # builds, but they are useful in porting, too.
4183                         cf_depend="../include/ncurses_cfg.h"
4184                         if test "$srcdir" = "."; then
4185                                 cf_reldir="."
4186                         else
4187                                 cf_reldir="\${srcdir}"
4188                         fi
4189
4190                         if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
4191                                 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
4192                         elif test -f $srcdir/$cf_dir/curses.priv.h; then
4193                                 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
4194                         fi
4195
4196                         cf_dir_suffix=
4197                         old_cf_suffix="$cf_suffix"
4198                         if test "$cf_cv_shlib_version_infix" = yes ; then
4199                         if test -n "$USE_LIB_SUFFIX" ; then
4200                                 case $USE_LIB_SUFFIX in
4201                                 (tw*)
4202                                         cf_libname=`echo $cf_libname | sed 's/tw'$EXTRA_SUFFIX'$//'`
4203                                         cf_suffix=`echo $cf_suffix | sed 's/^tw'$EXTRA_SUFFIX'//'`
4204                                         cf_dir_suffix=tw$EXTRA_SUFFIX
4205                                         ;;
4206                                 (t*)
4207                                         cf_libname=`echo $cf_libname | sed 's/t'$EXTRA_SUFFIX'$//'`
4208                                         cf_suffix=`echo $cf_suffix | sed 's/^t'$EXTRA_SUFFIX'//'`
4209                                         cf_dir_suffix=t$EXTRA_SUFFIX
4210                                         ;;
4211                                 (w*)
4212                                         cf_libname=`echo $cf_libname | sed 's/w'$EXTRA_SUFFIX'$//'`
4213                                         cf_suffix=`echo $cf_suffix | sed 's/^w'$EXTRA_SUFFIX'//'`
4214                                         cf_dir_suffix=w$EXTRA_SUFFIX
4215                                         ;;
4216                                 (*)
4217                                         cf_libname=`echo $cf_libname | sed 's/'$EXTRA_SUFFIX'$//'`
4218                                         cf_suffix=`echo $cf_suffix | sed 's/^'$EXTRA_SUFFIX'//'`
4219                                         cf_dir_suffix=$EXTRA_SUFFIX
4220                                         ;;
4221                                 esac
4222                         fi
4223                         fi
4224
4225                         $AWK -f $srcdir/mk-1st.awk \
4226                                 name=${cf_libname}${cf_dir_suffix} \
4227                                 traces=$LIB_TRACING \
4228                                 MODEL=$cf_ITEM \
4229                                 CXX_MODEL=$CXX_MODEL \
4230                                 model=$cf_subdir \
4231                                 prefix=$cf_prefix \
4232                                 suffix=$cf_suffix \
4233                                 subset=$cf_subset \
4234                                 driver=$cf_cv_term_driver \
4235                                 SymLink="$LN_S" \
4236                                 TermlibRoot=$TINFO_NAME \
4237                                 TermlibSuffix=$TINFO_SUFFIX \
4238                                 ShlibVer=$cf_cv_shlib_version \
4239                                 ShlibVerInfix=$cf_cv_shlib_version_infix \
4240                                 ReLink=${cf_cv_do_relink:-no} \
4241                                 ReRanlib=${cf_cv_do_reranlib:-yes} \
4242                                 DoLinks=$cf_cv_do_symlinks \
4243                                 rmSoLocs=$cf_cv_rm_so_locs \
4244                                 ldconfig="$LDCONFIG" \
4245                                 overwrite=$WITH_OVERWRITE \
4246                                 depend="$cf_depend" \
4247                                 host="$host" \
4248                                 libtool_version="$LIBTOOL_VERSION" \
4249                                 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
4250
4251                         cf_suffix="$old_cf_suffix"
4252
4253                         for cf_subdir2 in $cf_subdirs lib
4254                         do
4255                                 test $cf_subdir = $cf_subdir2 && break
4256                         done
4257                         test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
4258                         $AWK -f $srcdir/mk-2nd.awk \
4259                                 name=$cf_dir \
4260                                 traces=$LIB_TRACING \
4261                                 MODEL=$cf_ITEM \
4262                                 model=$cf_subdir \
4263                                 subset=$cf_subset \
4264                                 srcdir=$srcdir \
4265                                 echo=$WITH_ECHO \
4266                                 crenames=$cf_cv_prog_CC_c_o \
4267                                 cxxrenames=$cf_cv_prog_CXX_c_o \
4268                                 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
4269                         cf_subdirs="$cf_subdirs $cf_subdir"
4270                         done
4271                 done
4272         fi
4273
4274         echo '  cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >>Makefile
4275 done
4276
4277 for cf_dir in $SRC_SUBDIRS
4278 do
4279         if test ! -d $srcdir/$cf_dir ; then
4280                 continue
4281         fi
4282
4283         if test -f $cf_dir/Makefile ; then
4284                 case "$cf_dir" in
4285                 (Ada95)
4286                         echo 'libs \' >> Makefile
4287                         echo 'install.libs \' >> Makefile
4288                         echo 'uninstall.libs ::' >> Makefile
4289                         echo '  cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >> Makefile
4290                         ;;
4291                 esac
4292         fi
4293
4294         if test -f $srcdir/$cf_dir/modules; then
4295                 echo >> Makefile
4296                 if test -f $srcdir/$cf_dir/headers; then
4297 cat >> Makefile <<CF_EOF
4298 install.includes \\
4299 uninstall.includes \\
4300 CF_EOF
4301                 fi
4302 if test "$cf_dir" != "c++" ; then
4303 echo 'lint \' >> Makefile
4304 fi
4305 cat >> Makefile <<CF_EOF
4306 libs \\
4307 lintlib \\
4308 install.libs \\
4309 uninstall.libs \\
4310 install.$cf_dir \\
4311 uninstall.$cf_dir ::
4312         cd $cf_dir && \${MAKE} \${TOP_MFLAGS} \[$]@
4313 CF_EOF
4314         elif test -f $srcdir/$cf_dir/headers; then
4315 cat >> Makefile <<CF_EOF
4316
4317 libs \\
4318 install.libs \\
4319 uninstall.libs \\
4320 install.includes \\
4321 uninstall.includes ::
4322         cd $cf_dir && \${MAKE} \${TOP_MFLAGS} \[$]@
4323 CF_EOF
4324 fi
4325 done
4326
4327 if test "x$cf_with_db_install" = xyes; then
4328 cat >> Makefile <<CF_EOF
4329
4330 install.libs uninstall.libs \\
4331 install.data uninstall.data ::
4332 $MAKE_TERMINFO  cd misc && \${MAKE} \${TOP_MFLAGS} \[$]@
4333 CF_EOF
4334 else
4335 cat >> Makefile <<CF_EOF
4336
4337 install.libs uninstall.libs ::
4338         cd misc && \${MAKE} \${TOP_MFLAGS} \[$]@
4339 CF_EOF
4340 fi
4341
4342 if test "x$cf_with_manpages" = xyes; then
4343 cat >> Makefile <<CF_EOF
4344
4345 install.man \\
4346 uninstall.man ::
4347         cd man && \${MAKE} \${TOP_MFLAGS} \[$]@
4348 CF_EOF
4349 fi
4350
4351 cat >> Makefile <<CF_EOF
4352
4353 distclean ::
4354         rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
4355         rm -f headers.sh headers.sed mk_shared_lib.sh
4356         rm -f edit_man.* man_alias.*
4357         rm -rf \${DIRS_TO_MAKE}
4358 CF_EOF
4359
4360 # Special case: tack's manpage lives in its own directory.
4361 if test "x$cf_with_manpages" = xyes; then
4362 if test "x$cf_with_tack" = "xyes"; then
4363 cat >> Makefile <<CF_EOF
4364
4365 install.man \\
4366 uninstall.man ::
4367         cd tack && \${MAKE} \${TOP_MFLAGS} \[$]@
4368 CF_EOF
4369 fi
4370 fi
4371
4372 dnl If we're installing into a subdirectory of /usr/include, etc., we should
4373 dnl prepend the subdirectory's name to the "#include" paths.  It won't hurt
4374 dnl anything, and will make it more standardized.  It's awkward to decide this
4375 dnl at configuration because of quoting, so we'll simply make all headers
4376 dnl installed via a script that can do the right thing.
4377
4378 rm -f headers.sed headers.sh
4379
4380 dnl ( generating this script makes the makefiles a little tidier :-)
4381 echo creating headers.sh
4382 cat >headers.sh <<CF_EOF
4383 #! $SHELL
4384 # This shell script is generated by the 'configure' script.  It is invoked in a
4385 # subdirectory of the build tree.  It generates a sed-script in the parent
4386 # directory that is used to adjust includes for header files that reside in a
4387 # subdirectory of /usr/include, etc.
4388 PRG=""
4389 while test \[$]# != 3
4390 do
4391 PRG="\$PRG \[$]1"; shift
4392 done
4393 DST=\[$]1
4394 REF=\[$]2
4395 SRC=\[$]3
4396 TMPSRC=\${TMPDIR:-/tmp}/\`basename \$SRC\`\$\$
4397 TMPSED=\${TMPDIR:-/tmp}/headers.sed\$\$
4398 echo installing \$SRC in \$DST
4399 CF_EOF
4400
4401 if test $WITH_CURSES_H = yes; then
4402         cat >>headers.sh <<CF_EOF
4403 case \$DST in
4404 (/*/include/*)
4405         END=\`basename \$DST\`
4406         for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
4407         do
4408                 NAME=\`basename \$i\`
4409                 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
4410         done
4411         ;;
4412 (*)
4413         echo "" >> \$TMPSED
4414         ;;
4415 esac
4416 CF_EOF
4417
4418 else
4419         cat >>headers.sh <<CF_EOF
4420 case \$DST in
4421 (/*/include/*)
4422         END=\`basename \$DST\`
4423         for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
4424         do
4425                 NAME=\`basename \$i\`
4426                 if test "\$NAME" = "curses.h"
4427                 then
4428                         echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
4429                         NAME=ncurses.h
4430                 fi
4431                 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
4432         done
4433         ;;
4434 (*)
4435         echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
4436         ;;
4437 esac
4438 CF_EOF
4439 fi
4440 cat >>headers.sh <<CF_EOF
4441 rm -f \$TMPSRC
4442 sed -f \$TMPSED \$SRC > \$TMPSRC
4443 NAME=\`basename \$SRC\`
4444 CF_EOF
4445 if test $WITH_CURSES_H != yes; then
4446         cat >>headers.sh <<CF_EOF
4447 test "\$NAME" = "curses.h" && NAME=ncurses.h
4448 CF_EOF
4449 fi
4450 cat >>headers.sh <<CF_EOF
4451 # Just in case someone gzip'd manpages, remove the conflicting copy.
4452 test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
4453
4454 eval \$PRG \$TMPSRC \$DST/\$NAME
4455 rm -f \$TMPSRC \$TMPSED
4456 CF_EOF
4457
4458 chmod 0755 headers.sh
4459
4460 for cf_dir in $SRC_SUBDIRS
4461 do
4462         if test ! -d $srcdir/$cf_dir ; then
4463                 continue
4464         fi
4465
4466         if test -f $srcdir/$cf_dir/headers; then
4467                 $AWK -f $srcdir/mk-hdr.awk \
4468                         subset="$LIB_SUBSETS" \
4469                         compat="$WITH_CURSES_H" \
4470                         $srcdir/$cf_dir/headers >>$cf_dir/Makefile
4471         fi
4472
4473         if test -f $srcdir/$cf_dir/modules; then
4474                 if test "$cf_dir" != "c++" ; then
4475                         cat >>$cf_dir/Makefile <<"CF_EOF"
4476 depend : ${AUTO_SRC}
4477         makedepend -- ${CPPFLAGS} -- ${C_SRC}
4478
4479 # DO NOT DELETE THIS LINE -- make depend depends on it.
4480 CF_EOF
4481                 fi
4482         fi
4483 done
4484 AC_SUBST(Libs_To_Make)
4485 ])dnl
4486 dnl ---------------------------------------------------------------------------
4487 dnl CF_LIB_SONAME version: 6 updated: 2017/01/21 11:06:25
4488 dnl -------------
4489 dnl Find the and soname for the given shared library.  Set the cache variable
4490 dnl cf_cv_$3_soname to this, unless it is not found.  Then set the cache
4491 dnl variable to "unknown".
4492 dnl
4493 dnl $1 = headers
4494 dnl $2 = code
4495 dnl $3 = library name
4496 AC_DEFUN([CF_LIB_SONAME],
4497 [
4498 AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[
4499
4500 cf_cv_$3_soname=unknown
4501 if test "$cross_compiling" != yes ; then
4502 cat >conftest.$ac_ext <<CF_EOF
4503 $1
4504 int main(void)
4505 {
4506 $2
4507         ${cf_cv_main_return:-return}(0);
4508 }
4509 CF_EOF
4510 cf_save_LIBS="$LIBS"
4511         CF_ADD_LIB($3)
4512         if AC_TRY_EVAL(ac_compile) ; then
4513                 if AC_TRY_EVAL(ac_link) ; then
4514                         cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.`
4515                         test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown
4516                 fi
4517         fi
4518 rm -rf conftest*
4519 LIBS="$cf_save_LIBS"
4520 fi
4521 ])
4522 ])
4523 dnl ---------------------------------------------------------------------------
4524 dnl CF_LIB_SUFFIX version: 25 updated: 2015/04/17 21:13:04
4525 dnl -------------
4526 dnl Compute the library file-suffix from the given model name
4527 dnl $1 = model name
4528 dnl $2 = variable to set (the nominal library suffix)
4529 dnl $3 = dependency variable to set (actual filename)
4530 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
4531 AC_DEFUN([CF_LIB_SUFFIX],
4532 [
4533         case X$1 in
4534         (Xlibtool)
4535                 $2='.la'
4536                 $3=[$]$2
4537                 ;;
4538         (Xdebug)
4539                 $2='_g.a'
4540                 $3=[$]$2
4541                 ;;
4542         (Xprofile)
4543                 $2='_p.a'
4544                 $3=[$]$2
4545                 ;;
4546         (Xshared)
4547                 case $cf_cv_system_name in
4548                 (aix[[5-7]]*)
4549                         $2='.so'
4550                         $3=[$]$2
4551                         ;;
4552                 (cygwin*|msys*|mingw*)
4553                         $2='.dll'
4554                         $3='.dll.a'
4555                         ;;
4556                 (darwin*)
4557                         $2='.dylib'
4558                         $3=[$]$2
4559                         ;;
4560                 (hpux*)
4561                         case $target in
4562                         (ia64*)
4563                                 $2='.so'
4564                                 $3=[$]$2
4565                                 ;;
4566                         (*)
4567                                 $2='.sl'
4568                                 $3=[$]$2
4569                                 ;;
4570                         esac
4571                         ;;
4572                 (*)
4573                         $2='.so'
4574                         $3=[$]$2
4575                         ;;
4576                 esac
4577                 ;;
4578         (*)
4579                 $2='.a'
4580                 $3=[$]$2
4581                 ;;
4582         esac
4583         if test -n "${LIB_SUFFIX}${EXTRA_SUFFIX}"
4584         then
4585                 $2="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$2}"
4586                 $3="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$3}"
4587         fi
4588 ])dnl
4589 dnl ---------------------------------------------------------------------------
4590 dnl CF_LIB_TYPE version: 5 updated: 2015/04/17 21:13:04
4591 dnl -----------
4592 dnl Compute the string to append to -library from the given model name
4593 dnl $1 = model name
4594 dnl $2 = variable to set
4595 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
4596 AC_DEFUN([CF_LIB_TYPE],
4597 [
4598         case $1 in
4599         (libtool) $2=''   ;;
4600         (normal)  $2=''   ;;
4601         (debug)   $2='_g' ;;
4602         (profile) $2='_p' ;;
4603         (shared)  $2=''   ;;
4604         esac
4605         test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
4606 ])dnl
4607 dnl ---------------------------------------------------------------------------
4608 dnl CF_LINK_DATAONLY version: 12 updated: 2017/07/23 17:46:07
4609 dnl ----------------
4610 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
4611 dnl only data (i.e., no functions), for example NeXT.  On those systems we'll
4612 dnl have to provide wrappers for global tables to ensure they're linked
4613 dnl properly.
4614 AC_DEFUN([CF_LINK_DATAONLY],
4615 [
4616 AC_MSG_CHECKING([if data-only library module links])
4617 AC_CACHE_VAL(cf_cv_link_dataonly,[
4618         rm -f conftest.a
4619         cat >conftest.$ac_ext <<EOF
4620 #line __oline__ "configure"
4621 int     testdata[[3]] = { 123, 456, 789 };
4622 EOF
4623         if AC_TRY_EVAL(ac_compile) ; then
4624                 mv conftest.o data.o && \
4625                 ( $AR $ARFLAGS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null
4626         fi
4627         rm -f conftest.$ac_ext data.o
4628         cat >conftest.$ac_ext <<EOF
4629 #line __oline__ "configure"
4630 int     testfunc(void)
4631 {
4632 #if defined(NeXT)
4633         ${cf_cv_main_return:-return}(1);        /* I'm told this linker is broken */
4634 #else
4635         extern int testdata[[3]];
4636         return testdata[[0]] == 123
4637            &&  testdata[[1]] == 456
4638            &&  testdata[[2]] == 789;
4639 #endif
4640 }
4641 EOF
4642         if AC_TRY_EVAL(ac_compile); then
4643                 mv conftest.o func.o && \
4644                 ( $AR $ARFLAGS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null
4645         fi
4646         rm -f conftest.$ac_ext func.o
4647         ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null
4648         cf_saveLIBS="$LIBS"
4649         LIBS="conftest.a $LIBS"
4650         AC_TRY_RUN([
4651         int main(void)
4652         {
4653                 extern int testfunc();
4654                 ${cf_cv_main_return:-return} (!testfunc());
4655         }
4656         ],
4657         [cf_cv_link_dataonly=yes],
4658         [cf_cv_link_dataonly=no],
4659         [cf_cv_link_dataonly=unknown])
4660         LIBS="$cf_saveLIBS"
4661         ])
4662 AC_MSG_RESULT($cf_cv_link_dataonly)
4663
4664 if test "$cf_cv_link_dataonly" = no ; then
4665         AC_DEFINE(BROKEN_LINKER,1,[if data-only library module does not link])
4666         BROKEN_LINKER=1
4667 fi
4668
4669 ])dnl
4670 dnl ---------------------------------------------------------------------------
4671 dnl CF_LINK_FUNCS version: 9 updated: 2017/01/21 11:11:02
4672 dnl -------------
4673 dnl Most Unix systems have both link and symlink, a few don't have symlink.
4674 dnl A few non-Unix systems implement symlink, but not link.
4675 dnl A few non-systems implement neither (or have nonfunctional versions).
4676 AC_DEFUN([CF_LINK_FUNCS],
4677 [
4678 AC_CHECK_HEADERS( \
4679 unistd.h \
4680 )
4681 AC_CHECK_FUNCS( \
4682         remove \
4683         unlink )
4684
4685 if test "$cross_compiling" = yes ; then
4686         AC_CHECK_FUNCS( \
4687                 link \
4688                 symlink )
4689 else
4690         AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
4691                 cf_cv_link_funcs=
4692                 for cf_func in link symlink ; do
4693                         AC_TRY_RUN([
4694 #include <sys/types.h>
4695 #include <sys/stat.h>
4696 #ifdef HAVE_UNISTD_H
4697 #include <unistd.h>
4698 #endif
4699 int main(void)
4700 {
4701         int fail = 0;
4702         char *src = "config.log";
4703         char *dst = "conftest.chk";
4704         struct stat src_sb;
4705         struct stat dst_sb;
4706
4707         stat(src, &src_sb);
4708         fail = ($cf_func("config.log", "conftest.chk") < 0)
4709             || (stat(dst, &dst_sb) < 0)
4710             || (dst_sb.st_mtime != src_sb.st_mtime);
4711 #ifdef HAVE_UNLINK
4712         unlink(dst);
4713 #else
4714         remove(dst);
4715 #endif
4716         ${cf_cv_main_return:-return} (fail);
4717 }
4718                         ],[
4719                         cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
4720                         eval 'ac_cv_func_'$cf_func'=yes'],[
4721                         eval 'ac_cv_func_'$cf_func'=no'],[
4722                         eval 'ac_cv_func_'$cf_func'=error'])
4723                 done
4724                 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
4725         ])
4726         test "$ac_cv_func_link"    = yes && AC_DEFINE(HAVE_LINK,1,[Define to 1 if we have link() function])
4727         test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK,1,[Define to 1 if we have symlink() function])
4728 fi
4729 ])dnl
4730 dnl ---------------------------------------------------------------------------
4731 dnl CF_MAKEFLAGS version: 18 updated: 2018/02/21 21:26:03
4732 dnl ------------
4733 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
4734 dnl options to lower-levels.  It's very useful for "make -n" -- if we have it.
4735 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
4736 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
4737 AC_DEFUN([CF_MAKEFLAGS],
4738 [
4739 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
4740         cf_cv_makeflags=''
4741         for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
4742         do
4743                 cat >cf_makeflags.tmp <<CF_EOF
4744 SHELL = $SHELL
4745 all :
4746         @ echo '.$cf_option'
4747 CF_EOF
4748                 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[   ]]*$,,'`
4749                 case "$cf_result" in
4750                 (.*k|.*kw)
4751                         cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
4752                         case "$cf_result" in
4753                         (.*CC=*)        cf_cv_makeflags=
4754                                 ;;
4755                         (*)     cf_cv_makeflags=$cf_option
4756                                 ;;
4757                         esac
4758                         break
4759                         ;;
4760                 (.-)
4761                         ;;
4762                 (*)
4763                         CF_MSG_LOG(given option \"$cf_option\", no match \"$cf_result\")
4764                         ;;
4765                 esac
4766         done
4767         rm -f cf_makeflags.tmp
4768 ])
4769
4770 AC_SUBST(cf_cv_makeflags)
4771 ])dnl
4772 dnl ---------------------------------------------------------------------------
4773 dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
4774 dnl ------------
4775 dnl Generate tags/TAGS targets for makefiles.  Do not generate TAGS if we have
4776 dnl a monocase filesystem.
4777 AC_DEFUN([CF_MAKE_TAGS],[
4778 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
4779
4780 AC_CHECK_PROGS(CTAGS, exctags ctags)
4781 AC_CHECK_PROGS(ETAGS, exetags etags)
4782
4783 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
4784
4785 if test "$cf_cv_mixedcase" = yes ; then
4786         AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
4787 else
4788         MAKE_UPPER_TAGS=no
4789 fi
4790
4791 if test "$MAKE_UPPER_TAGS" = yes ; then
4792         MAKE_UPPER_TAGS=
4793 else
4794         MAKE_UPPER_TAGS="#"
4795 fi
4796
4797 if test "$MAKE_LOWER_TAGS" = yes ; then
4798         MAKE_LOWER_TAGS=
4799 else
4800         MAKE_LOWER_TAGS="#"
4801 fi
4802
4803 AC_SUBST(CTAGS)
4804 AC_SUBST(ETAGS)
4805
4806 AC_SUBST(MAKE_UPPER_TAGS)
4807 AC_SUBST(MAKE_LOWER_TAGS)
4808 ])dnl
4809 dnl ---------------------------------------------------------------------------
4810 dnl CF_MANPAGE_FORMAT version: 11 updated: 2015/04/18 08:56:57
4811 dnl -----------------
4812 dnl Option to allow user to override automatic configuration of manpage format.
4813 dnl There are several special cases:
4814 dnl
4815 dnl     gzip - man checks for, can display gzip'd files
4816 dnl     compress - man checks for, can display compressed files
4817 dnl     BSDI - files in the cat-directories are suffixed ".0"
4818 dnl     formatted - installer should format (put files in cat-directory)
4819 dnl     catonly - installer should only format, e.g., for a turnkey system.
4820 dnl
4821 dnl There are other configurations which this macro does not test, e.g., HPUX's
4822 dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming
4823 dnl convention would not match our use).
4824 AC_DEFUN([CF_MANPAGE_FORMAT],
4825 [
4826 AC_REQUIRE([CF_PATHSEP])
4827 AC_MSG_CHECKING(format of man-pages)
4828
4829 AC_ARG_WITH(manpage-format,
4830         [  --with-manpage-format   specify manpage-format: gzip/compress/BSDI/normal and
4831                           optionally formatted/catonly, e.g., gzip,formatted],
4832         [MANPAGE_FORMAT=$withval],
4833         [MANPAGE_FORMAT=unknown])
4834
4835 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown
4836 MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'`
4837
4838 cf_unknown=
4839
4840 case $MANPAGE_FORMAT in
4841 (unknown)
4842         if test -z "$MANPATH" ; then
4843                 MANPATH="/usr/man:/usr/share/man"
4844         fi
4845
4846         # look for the 'date' man-page (it's most likely to be installed!)
4847         MANPAGE_FORMAT=
4848         cf_preform=no
4849         cf_catonly=yes
4850         cf_example=date
4851
4852         IFS="${IFS:-    }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
4853         for cf_dir in $MANPATH; do
4854                 test -z "$cf_dir" && cf_dir=/usr/man
4855                 for cf_name in $cf_dir/man*/$cf_example.[[01]]* $cf_dir/cat*/$cf_example.[[01]]* $cf_dir/man*/$cf_example $cf_dir/cat*/$cf_example
4856                 do
4857                         cf_test=`echo $cf_name | sed -e 's/*//'`
4858                         if test "x$cf_test" = "x$cf_name" ; then
4859
4860                                 case "$cf_name" in
4861                                 (*.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";;
4862                                 (*.Z)  MANPAGE_FORMAT="$MANPAGE_FORMAT compress";;
4863                                 (*.0)  MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";;
4864                                 (*)    MANPAGE_FORMAT="$MANPAGE_FORMAT normal";;
4865                                 esac
4866
4867                                 case "$cf_name" in
4868                                 ($cf_dir/man*)
4869                                         cf_catonly=no
4870                                         ;;
4871                                 ($cf_dir/cat*)
4872                                         cf_preform=yes
4873                                         ;;
4874                                 esac
4875                                 break
4876                         fi
4877
4878                         # if we found a match in either man* or cat*, stop looking
4879                         if test -n "$MANPAGE_FORMAT" ; then
4880                                 cf_found=no
4881                                 test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted"
4882                                 test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly"
4883                                 case "$cf_name" in
4884                                 ($cf_dir/cat*)
4885                                         cf_found=yes
4886                                         ;;
4887                                 esac
4888                                 test $cf_found=yes && break
4889                         fi
4890                 done
4891                 # only check the first directory in $MANPATH where we find manpages
4892                 if test -n "$MANPAGE_FORMAT" ; then
4893                         break
4894                 fi
4895         done
4896         # if we did not find the example, just assume it is normal
4897         test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal
4898         IFS="$ac_save_ifs"
4899         ;;
4900 (*)
4901         for cf_option in $MANPAGE_FORMAT; do
4902         case $cf_option in
4903         (gzip|compress|BSDI|normal|formatted|catonly)
4904                 ;;
4905         (*)
4906                 cf_unknown="$cf_unknown $cf_option"
4907                 ;;
4908         esac
4909         done
4910         ;;
4911 esac
4912
4913 AC_MSG_RESULT($MANPAGE_FORMAT)
4914 if test -n "$cf_unknown" ; then
4915         AC_MSG_WARN(Unexpected manpage-format $cf_unknown)
4916 fi
4917 ])dnl
4918 dnl ---------------------------------------------------------------------------
4919 dnl CF_MANPAGE_RENAMES version: 10 updated: 2015/08/05 20:44:28
4920 dnl ------------------
4921 dnl The Debian people have their own naming convention for manpages.  This
4922 dnl option lets us override the name of the file containing renaming, or
4923 dnl disable it altogether.
4924 AC_DEFUN([CF_MANPAGE_RENAMES],
4925 [
4926 AC_MSG_CHECKING(for manpage renaming)
4927
4928 AC_ARG_WITH(manpage-renames,
4929         [  --with-manpage-renames  specify manpage-renaming],
4930         [MANPAGE_RENAMES=$withval],
4931         [MANPAGE_RENAMES=yes])
4932
4933 case ".$MANPAGE_RENAMES" in
4934 (.no)
4935         ;;
4936 (.|.yes)
4937         # Debian 'man' program?
4938         if test -f /etc/debian_version ; then
4939                 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
4940         else
4941                 MANPAGE_RENAMES=no
4942         fi
4943         ;;
4944 esac
4945
4946 if test "$MANPAGE_RENAMES" != no ; then
4947         if test -f $srcdir/man/$MANPAGE_RENAMES ; then
4948                 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
4949         elif test ! -f $MANPAGE_RENAMES ; then
4950                 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
4951         fi
4952
4953         test ! -d man && mkdir man
4954
4955         # Construct a sed-script to perform renaming within man-pages
4956         if test -n "$MANPAGE_RENAMES" ; then
4957                 test ! -d man && mkdir man
4958                 $SHELL $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed
4959         fi
4960 fi
4961
4962 AC_MSG_RESULT($MANPAGE_RENAMES)
4963 AC_SUBST(MANPAGE_RENAMES)
4964 ])dnl
4965 dnl ---------------------------------------------------------------------------
4966 dnl CF_MANPAGE_SYMLINKS version: 6 updated: 2015/04/17 21:13:04
4967 dnl -------------------
4968 dnl Some people expect each tool to make all aliases for manpages in the
4969 dnl man-directory.  This accommodates the older, less-capable implementations
4970 dnl of 'man', and is optional.
4971 AC_DEFUN([CF_MANPAGE_SYMLINKS],
4972 [
4973 AC_MSG_CHECKING(if manpage aliases will be installed)
4974
4975 AC_ARG_WITH(manpage-aliases,
4976         [  --with-manpage-aliases  specify manpage-aliases using .so],
4977         [MANPAGE_ALIASES=$withval],
4978         [MANPAGE_ALIASES=yes])
4979
4980 AC_MSG_RESULT($MANPAGE_ALIASES)
4981
4982 case "x$LN_S" in
4983 (xln*)
4984         cf_use_symlinks=yes
4985         ;;
4986 (*)
4987         cf_use_symlinks=no
4988         ;;
4989 esac
4990
4991 MANPAGE_SYMLINKS=no
4992 if test "$MANPAGE_ALIASES" = yes ; then
4993 AC_MSG_CHECKING(if manpage symlinks should be used)
4994
4995 AC_ARG_WITH(manpage-symlinks,
4996         [  --with-manpage-symlinks specify manpage-aliases using symlinks],
4997         [MANPAGE_SYMLINKS=$withval],
4998         [MANPAGE_SYMLINKS=$cf_use_symlinks])
4999
5000 if test "$$cf_use_symlinks" = no; then
5001 if test "$MANPAGE_SYMLINKS" = yes ; then
5002         AC_MSG_WARN(cannot make symlinks, will use .so files)
5003         MANPAGE_SYMLINKS=no
5004 fi
5005 fi
5006
5007 AC_MSG_RESULT($MANPAGE_SYMLINKS)
5008 fi
5009
5010 ])dnl
5011 dnl ---------------------------------------------------------------------------
5012 dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32
5013 dnl --------------
5014 dnl This option causes manpages to be run through tbl(1) to generate tables
5015 dnl correctly.
5016 AC_DEFUN([CF_MANPAGE_TBL],
5017 [
5018 AC_MSG_CHECKING(for manpage tbl)
5019
5020 AC_ARG_WITH(manpage-tbl,
5021         [  --with-manpage-tbl      specify manpage processing with tbl],
5022         [MANPAGE_TBL=$withval],
5023         [MANPAGE_TBL=no])
5024
5025 AC_MSG_RESULT($MANPAGE_TBL)
5026 ])dnl
5027 dnl ---------------------------------------------------------------------------
5028 dnl CF_MAN_PAGES version: 47 updated: 2017/08/12 07:58:51
5029 dnl ------------
5030 dnl Try to determine if the man-pages on the system are compressed, and if
5031 dnl so, what format is used.  Use this information to construct a script that
5032 dnl will install man-pages.
5033 AC_DEFUN([CF_MAN_PAGES],
5034 [
5035 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
5036 CF_MANPAGE_FORMAT
5037 CF_MANPAGE_RENAMES
5038 CF_MANPAGE_SYMLINKS
5039 CF_MANPAGE_TBL
5040
5041 if test "$prefix" = "NONE" ; then
5042         cf_prefix="$ac_default_prefix"
5043 else
5044         cf_prefix="$prefix"
5045 fi
5046
5047 case "$MANPAGE_FORMAT" in
5048 (*catonly*)
5049         cf_format=yes
5050         cf_inboth=no
5051         ;;
5052 (*formatted*)
5053         cf_format=yes
5054         cf_inboth=yes
5055         ;;
5056 (*)
5057         cf_format=no
5058         cf_inboth=no
5059         ;;
5060 esac
5061
5062 test ! -d man && mkdir man
5063
5064 cf_so_strip=
5065 cf_compress=
5066 case "$MANPAGE_FORMAT" in
5067 (*compress*)
5068         cf_so_strip="Z"
5069         cf_compress=compress
5070         ;;
5071 (*gzip*)
5072         cf_so_strip="gz"
5073         cf_compress=gzip
5074         ;;
5075 esac
5076
5077 cf_edit_man=./edit_man.sh
5078 cf_man_alias=`pwd`/man_alias.sed
5079
5080 cat >$cf_edit_man <<CF_EOF
5081 #! $SHELL
5082 # this script is generated by the configure-script CF_MAN_PAGES macro.
5083
5084 prefix="$cf_prefix"
5085 datarootdir="$datarootdir"
5086 datadir="$datadir"
5087
5088 NCURSES_MAJOR="$NCURSES_MAJOR"
5089 NCURSES_MINOR="$NCURSES_MINOR"
5090 NCURSES_PATCH="$NCURSES_PATCH"
5091
5092 NCURSES_OSPEED="$NCURSES_OSPEED"
5093 TERMINFO="$TERMINFO"
5094
5095 INSTALL="$INSTALL"
5096 INSTALL_DATA="$INSTALL_DATA"
5097
5098 transform="$program_transform_name"
5099
5100 TMP=\${TMPDIR:=/tmp}/man\$\$
5101 trap "rm -f \$TMP" 0 1 2 3 15
5102
5103 form=\[$]1
5104 shift || exit 1
5105
5106 verb=\[$]1
5107 shift || exit 1
5108
5109 mandir=\[$]1
5110 shift || exit 1
5111
5112 srcdir=\[$]1
5113 top_srcdir=\[$]srcdir/..
5114 shift || exit 1
5115
5116 if test "\$form" = normal ; then
5117         if test "$cf_format" = yes ; then
5118         if test "$cf_inboth" = no ; then
5119                 $SHELL \[$]0 format \$verb \$mandir \$srcdir \[$]*
5120                 exit $?
5121         fi
5122         fi
5123         cf_subdir=\$mandir/man
5124         cf_tables=$MANPAGE_TBL
5125 else
5126         cf_subdir=\$mandir/cat
5127         cf_tables=yes
5128 fi
5129
5130 # process the list of source-files
5131 for i in \[$]* ; do
5132 case \$i in
5133 (*.orig|*.rej) ;;
5134 (*.[[0-9]]*)
5135         section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
5136         if test \$verb = installing ; then
5137         if test ! -d \$cf_subdir\${section} ; then
5138                 mkdir -p \$cf_subdir\$section
5139         fi
5140         fi
5141
5142         # replace variables in man page
5143         if test ! -f $cf_man_alias ; then
5144 cat >>$cf_man_alias <<-CF_EOF2
5145                 s,@DATADIR@,\$datadir,g
5146                 s,@TERMINFO@,\${TERMINFO:="no default value"},g
5147                 s,@TERMINFO_DIRS@,\${TERMINFO_DIRS:="no default value"},g
5148                 s,@NCURSES_MAJOR@,\${NCURSES_MAJOR:="no default value"},g
5149                 s,@NCURSES_MINOR@,\${NCURSES_MINOR:="no default value"},g
5150                 s,@NCURSES_PATCH@,\${NCURSES_PATCH:="no default value"},g
5151                 s,@NCURSES_OSPEED@,\${NCURSES_OSPEED:="no default value"},g
5152 CF_EOF
5153         ifelse($1,,,[
5154         for cf_name in $1
5155         do
5156                 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
5157                 cf_name=`echo $cf_name|sed "$program_transform_name"`
5158 cat >>$cf_edit_man <<-CF_EOF
5159                 s,@$cf_NAME@,$cf_name,g
5160 CF_EOF
5161         done
5162         ])
5163 cat >>$cf_edit_man <<CF_EOF
5164 CF_EOF2
5165                 echo "...made $cf_man_alias"
5166         fi
5167
5168         aliases=
5169         cf_source=\`basename \$i\`
5170         inalias=\$cf_source
5171         test ! -f \$inalias && inalias="\$srcdir/\$inalias"
5172         if test ! -f \$inalias ; then
5173                 echo .. skipped \$cf_source
5174                 continue
5175         fi
5176 CF_EOF
5177
5178 if test "$MANPAGE_ALIASES" != no ; then
5179 cat >>$cf_edit_man <<CF_EOF
5180         nCurses=ignore.3x
5181         test $with_curses_h = yes && nCurses=ncurses.3x
5182         aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u; test \$inalias = \$nCurses && echo curses\`
5183 CF_EOF
5184 fi
5185
5186 if test "$MANPAGE_RENAMES" = no ; then
5187 cat >>$cf_edit_man <<CF_EOF
5188         # perform program transformations for section 1 man pages
5189         if test \$section = 1 ; then
5190                 cf_target=\$cf_subdir\${section}/\`echo \$cf_source|sed "\${transform}"\`
5191         else
5192                 cf_target=\$cf_subdir\${section}/\$cf_source
5193         fi
5194 CF_EOF
5195 else
5196 cat >>$cf_edit_man <<CF_EOF
5197         cf_target=\`grep "^\$cf_source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
5198         if test -z "\$cf_target" ; then
5199                 echo '? missing rename for '\$cf_source
5200                 cf_target="\$cf_source"
5201         fi
5202         cf_target="\$cf_subdir\${section}/\${cf_target}"
5203
5204 CF_EOF
5205 fi
5206
5207 cat >>$cf_edit_man <<CF_EOF
5208         sed     -f $cf_man_alias \\
5209 CF_EOF
5210
5211 if test -f $MANPAGE_RENAMES ; then
5212 cat >>$cf_edit_man <<CF_EOF
5213                 < \$i | sed -f `pwd`/edit_man.sed >\$TMP
5214 CF_EOF
5215 else
5216 cat >>$cf_edit_man <<CF_EOF
5217                 < \$i >\$TMP
5218 CF_EOF
5219 fi
5220
5221 cat >>$cf_edit_man <<CF_EOF
5222 if test \$cf_tables = yes ; then
5223         tbl \$TMP >\$TMP.out
5224         mv \$TMP.out \$TMP
5225 fi
5226 CF_EOF
5227
5228 if test $with_overwrite != yes ; then
5229 cat >>$cf_edit_man <<CF_EOF
5230         sed -e "/\#[    ]*include/s,<curses.h,<ncurses$LIB_SUFFIX/curses.h," < \$TMP >\$TMP.out
5231         mv \$TMP.out \$TMP
5232 CF_EOF
5233 fi
5234
5235 if test $with_curses_h != yes ; then
5236 cat >>$cf_edit_man <<CF_EOF
5237         sed -e "/\#[    ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
5238         mv \$TMP.out \$TMP
5239 CF_EOF
5240 fi
5241
5242 cat >>$cf_edit_man <<CF_EOF
5243         if test \$form = format ; then
5244                 nroff -man \$TMP >\$TMP.out
5245                 mv \$TMP.out \$TMP
5246         fi
5247 CF_EOF
5248
5249 if test -n "$cf_compress" ; then
5250 cat >>$cf_edit_man <<CF_EOF
5251         if test \$verb = installing ; then
5252         if ( $cf_compress -f \$TMP )
5253         then
5254                 mv \$TMP.$cf_so_strip \$TMP
5255         fi
5256         fi
5257         cf_target="\$cf_target.$cf_so_strip"
5258 CF_EOF
5259 fi
5260
5261 case "$MANPAGE_FORMAT" in
5262 (*BSDI*)
5263 cat >>$cf_edit_man <<CF_EOF
5264         if test \$form = format ; then
5265                 # BSDI installs only .0 suffixes in the cat directories
5266                 cf_target="\`echo \$cf_target|sed -e 's/\.[[1-9]]\+[[a-z]]*/.0/'\`"
5267         fi
5268 CF_EOF
5269   ;;
5270 esac
5271
5272 cat >>$cf_edit_man <<CF_EOF
5273         suffix=\`basename \$cf_target | sed -e 's%^[[^.]]*%%'\`
5274         if test \$verb = installing ; then
5275                 echo \$verb \$cf_target
5276                 \$INSTALL_DATA \$TMP \$cf_target
5277                 test -d \$cf_subdir\${section} &&
5278                 test -n "\$aliases" && (
5279                         cd \$cf_subdir\${section} && (
5280                                 cf_source=\`echo \$cf_target |sed -e 's%^.*/\([[^/]][[^/]]*/[[^/]][[^/]]*$\)%\1%'\`
5281                                 test -n "$cf_so_strip" && cf_source=\`echo \$cf_source |sed -e 's%\.$cf_so_strip\$%%'\`
5282                                 cf_target=\`basename \$cf_target\`
5283                                 for cf_alias in \$aliases
5284                                 do
5285                                         if test \$section = 1 ; then
5286                                                 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
5287                                         fi
5288
5289                                         if test "$MANPAGE_SYMLINKS" = yes ; then
5290                                                 if test -f \$cf_alias\${suffix} ; then
5291                                                         if ( cmp -s \$cf_target \$cf_alias\${suffix} )
5292                                                         then
5293                                                                 continue
5294                                                         fi
5295                                                 fi
5296                                                 echo .. \$verb alias \$cf_alias\${suffix}
5297 CF_EOF
5298 case "x$LN_S" in
5299 (*-f)
5300 cat >>$cf_edit_man <<CF_EOF
5301                                                 $LN_S \$cf_target \$cf_alias\${suffix}
5302 CF_EOF
5303         ;;
5304 (*)
5305 cat >>$cf_edit_man <<CF_EOF
5306                                                 rm -f \$cf_alias\${suffix}
5307                                                 $LN_S \$cf_target \$cf_alias\${suffix}
5308 CF_EOF
5309         ;;
5310 esac
5311 cat >>$cf_edit_man <<CF_EOF
5312                                         elif test "\$cf_target" != "\$cf_alias\${suffix}" ; then
5313                                                 echo ".so \$cf_source" >\$TMP
5314 CF_EOF
5315 if test -n "$cf_compress" ; then
5316 cat >>$cf_edit_man <<CF_EOF
5317                                                 if test -n "$cf_so_strip" ; then
5318                                                         $cf_compress -f \$TMP
5319                                                         mv \$TMP.$cf_so_strip \$TMP
5320                                                 fi
5321 CF_EOF
5322 fi
5323 cat >>$cf_edit_man <<CF_EOF
5324                                                 echo .. \$verb alias \$cf_alias\${suffix}
5325                                                 rm -f \$cf_alias\${suffix}
5326                                                 \$INSTALL_DATA \$TMP \$cf_alias\${suffix}
5327                                         fi
5328                                 done
5329                         )
5330                 )
5331         elif test \$verb = removing ; then
5332                 test -f \$cf_target && (
5333                         echo \$verb \$cf_target
5334                         rm -f \$cf_target
5335                 )
5336                 test -d \$cf_subdir\${section} &&
5337                 test -n "\$aliases" && (
5338                         cd \$cf_subdir\${section} && (
5339                                 for cf_alias in \$aliases
5340                                 do
5341                                         if test \$section = 1 ; then
5342                                                 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
5343                                         fi
5344
5345                                         echo .. \$verb alias \$cf_alias\${suffix}
5346                                         rm -f \$cf_alias\${suffix}
5347                                 done
5348                         )
5349                 )
5350         else
5351 #               echo ".hy 0"
5352                 cat \$TMP
5353         fi
5354         ;;
5355 esac
5356 done
5357
5358 if test $cf_inboth = yes ; then
5359 if test \$form != format ; then
5360         $SHELL \[$]0 format \$verb \$mandir \$srcdir \[$]*
5361 fi
5362 fi
5363
5364 exit 0
5365 CF_EOF
5366 chmod 755 $cf_edit_man
5367
5368 ])dnl
5369 dnl ---------------------------------------------------------------------------
5370 dnl CF_MATH_LIB version: 9 updated: 2017/01/21 11:06:25
5371 dnl -----------
5372 dnl Checks for libraries.  At least one UNIX system, Apple Macintosh
5373 dnl Rhapsody 5.5, does not have -lm.  We cannot use the simpler
5374 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
5375 AC_DEFUN([CF_MATH_LIB],
5376 [
5377 AC_CACHE_CHECK(if -lm needed for math functions,
5378         cf_cv_need_libm,[
5379         AC_TRY_LINK([
5380         #include <stdio.h>
5381         #include <stdlib.h>
5382         #include <math.h>
5383         ],
5384         [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)],
5385         [cf_cv_need_libm=no],
5386         [cf_cv_need_libm=yes])])
5387 if test "$cf_cv_need_libm" = yes
5388 then
5389 ifelse($1,,[
5390         CF_ADD_LIB(m)
5391 ],[$1=-lm])
5392 fi
5393 ])
5394 dnl ---------------------------------------------------------------------------
5395 dnl CF_MIXEDCASE_FILENAMES version: 7 updated: 2015/04/12 15:39:00
5396 dnl ----------------------
5397 dnl Check if the file-system supports mixed-case filenames.  If we're able to
5398 dnl create a lowercase name and see it as uppercase, it doesn't support that.
5399 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
5400 [
5401 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
5402 if test "$cross_compiling" = yes ; then
5403         case $target_alias in
5404         (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*)
5405                 cf_cv_mixedcase=no
5406                 ;;
5407         (*)
5408                 cf_cv_mixedcase=yes
5409                 ;;
5410         esac
5411 else
5412         rm -f conftest CONFTEST
5413         echo test >conftest
5414         if test -f CONFTEST ; then
5415                 cf_cv_mixedcase=no
5416         else
5417                 cf_cv_mixedcase=yes
5418         fi
5419         rm -f conftest CONFTEST
5420 fi
5421 ])
5422 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
5423 ])dnl
5424 dnl ---------------------------------------------------------------------------
5425 dnl CF_MKSTEMP version: 10 updated: 2017/01/21 11:12:16
5426 dnl ----------
5427 dnl Check for a working mkstemp.  This creates two files, checks that they are
5428 dnl successfully created and distinct (AmigaOS apparently fails on the last).
5429 AC_DEFUN([CF_MKSTEMP],[
5430 AC_CHECK_HEADERS( \
5431 unistd.h \
5432 )
5433 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
5434 rm -rf conftest*
5435 AC_TRY_RUN([
5436 #include <sys/types.h>
5437 #ifdef HAVE_UNISTD_H
5438 #include <unistd.h>
5439 #endif
5440 #include <stdlib.h>
5441 #include <stdio.h>
5442 #include <string.h>
5443 #include <sys/stat.h>
5444 int main(void)
5445 {
5446         char *tmpl = "conftestXXXXXX";
5447         char name[2][80];
5448         int n;
5449         int result = 0;
5450         int fd;
5451         struct stat sb;
5452
5453         umask(077);
5454         for (n = 0; n < 2; ++n) {
5455                 strcpy(name[n], tmpl);
5456                 if ((fd = mkstemp(name[n])) >= 0) {
5457                         if (!strcmp(name[n], tmpl)
5458                          || stat(name[n], &sb) != 0
5459                          || (sb.st_mode & S_IFMT) != S_IFREG
5460                          || (sb.st_mode & 077) != 0) {
5461                                 result = 1;
5462                         }
5463                         close(fd);
5464                 }
5465         }
5466         if (result == 0
5467          && !strcmp(name[0], name[1]))
5468                 result = 1;
5469         ${cf_cv_main_return:-return}(result);
5470 }
5471 ],[cf_cv_func_mkstemp=yes
5472 ],[cf_cv_func_mkstemp=no
5473 ],[cf_cv_func_mkstemp=maybe])
5474 ])
5475 if test "x$cf_cv_func_mkstemp" = xmaybe ; then
5476         AC_CHECK_FUNC(mkstemp)
5477 fi
5478 if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
5479         AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.])
5480 fi
5481 ])dnl
5482 dnl ---------------------------------------------------------------------------
5483 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
5484 dnl ----------
5485 dnl Write a debug message to config.log, along with the line number in the
5486 dnl configure script.
5487 AC_DEFUN([CF_MSG_LOG],[
5488 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
5489 ])dnl
5490 dnl ---------------------------------------------------------------------------
5491 dnl CF_NCURSES_ABI_6 version: 3 updated: 2015/06/06 16:10:11
5492 dnl ----------------
5493 dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and
5494 dnl warn about this.
5495 AC_DEFUN([CF_NCURSES_ABI_6],[
5496 if test "${with_abi_version+set}" != set; then
5497         case $cf_cv_rel_version in
5498         (5.*)
5499                 cf_cv_rel_version=6.0
5500                 cf_cv_abi_version=6
5501                 AC_MSG_WARN(overriding ABI version to $cf_cv_abi_version)
5502                 ;;
5503         esac
5504 fi
5505 ])dnl
5506 dnl ---------------------------------------------------------------------------
5507 dnl CF_NCURSES_WITH_ABI_VERSION version: 2 updated: 2015/12/19 17:51:52
5508 dnl ---------------------------
5509 dnl Allow ncurses's ABI to be overridden.  Generally this happens when a
5510 dnl packager has incremented the ABI past that used in the original package,
5511 dnl and wishes to keep doing this.
5512 dnl
5513 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
5514 dnl symbol.
5515 AC_DEFUN([CF_NCURSES_WITH_ABI_VERSION],[
5516 CF_WITH_ABI_VERSION($1)
5517 if test "x$cf_cv_abi_version" != "x$with_abi_version"
5518 then
5519         case $cf_cv_rel_version in
5520         (5.*)
5521                 cf_cv_rel_version=$with_abi_version.0
5522                 ;;
5523         esac
5524 fi
5525 ])dnl
5526 dnl ---------------------------------------------------------------------------
5527 dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00
5528 dnl ------------------
5529 dnl see CF_WITH_NO_LEAKS
5530 AC_DEFUN([CF_NO_LEAKS_OPTION],[
5531 AC_MSG_CHECKING(if you want to use $1 for testing)
5532 AC_ARG_WITH($1,
5533         [$2],
5534         [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
5535          $4
5536 ])
5537         : ${with_cflags:=-g}
5538         : ${with_no_leaks:=yes}
5539          with_$1=yes],
5540         [with_$1=])
5541 AC_MSG_RESULT(${with_$1:-no})
5542
5543 case .$with_cflags in
5544 (.*-g*)
5545         case .$CFLAGS in
5546         (.*-g*)
5547                 ;;
5548         (*)
5549                 CF_ADD_CFLAGS([-g])
5550                 ;;
5551         esac
5552         ;;
5553 esac
5554 ])dnl
5555 dnl ---------------------------------------------------------------------------
5556 dnl CF_NUMBER_SYNTAX version: 2 updated: 2015/04/17 21:13:04
5557 dnl ----------------
5558 dnl Check if the given variable is a number.  If not, report an error.
5559 dnl $1 is the variable
5560 dnl $2 is the message
5561 AC_DEFUN([CF_NUMBER_SYNTAX],[
5562 if test -n "$1" ; then
5563   case $1 in
5564   ([[0-9]]*)
5565         ;;
5566   (*)
5567         AC_MSG_ERROR($2 is not a number: $1)
5568         ;;
5569   esac
5570 else
5571   AC_MSG_ERROR($2 value is empty)
5572 fi
5573 ])dnl
5574 dnl ---------------------------------------------------------------------------
5575 dnl CF_OBJ_SUBDIR version: 7 updated: 2015/04/17 21:13:04
5576 dnl -------------
5577 dnl Compute the object-directory name from the given model name
5578 AC_DEFUN([CF_OBJ_SUBDIR],
5579 [
5580         case $1 in
5581         (libtool) $2='obj_lo'  ;;
5582         (normal)  $2='objects' ;;
5583         (debug)   $2='obj_g' ;;
5584         (profile) $2='obj_p' ;;
5585         (shared)
5586                 case $cf_cv_system_name in
5587                 (cygwin|msys)
5588                         $2='objects' ;;
5589                 (*)
5590                         $2='obj_s' ;;
5591                 esac
5592         esac
5593 ])dnl
5594 dnl ---------------------------------------------------------------------------
5595 dnl CF_PATHSEP version: 7 updated: 2015/04/12 15:39:00
5596 dnl ----------
5597 dnl Provide a value for the $PATH and similar separator (or amend the value
5598 dnl as provided in autoconf 2.5x).
5599 AC_DEFUN([CF_PATHSEP],
5600 [
5601         AC_MSG_CHECKING(for PATH separator)
5602         case $cf_cv_system_name in
5603         (os2*)  PATH_SEPARATOR=';'  ;;
5604         (*)     ${PATH_SEPARATOR:=':'}  ;;
5605         esac
5606 ifelse([$1],,,[$1=$PATH_SEPARATOR])
5607         AC_SUBST(PATH_SEPARATOR)
5608         AC_MSG_RESULT($PATH_SEPARATOR)
5609 ])dnl
5610 dnl ---------------------------------------------------------------------------
5611 dnl CF_PATH_PROG version: 10 updated: 2019/06/30 19:44:43
5612 dnl ------------
5613 dnl Check for a given program, defining corresponding symbol.
5614 dnl     $1 = environment variable, which is suffixed by "_PATH" in the #define.
5615 dnl     $2 = program name to find.
5616 dnl     $3 = optional list of additional program names to test.
5617 dnl $4 = $PATH
5618 dnl
5619 dnl If there is more than one token in the result, #define the remaining tokens
5620 dnl to $1_ARGS.  We need this for 'install' in particular.
5621 dnl
5622 dnl FIXME: we should allow this to be overridden by environment variables
5623 dnl
5624 AC_DEFUN([CF_PATH_PROG],[
5625 AC_REQUIRE([CF_PATHSEP])
5626 test -z "[$]$1" && $1=$2
5627 AC_PATH_PROGS($1,[$]$1 $2 ifelse($3,,,$3),[$]$1, ifelse($4,,,$4))
5628
5629 cf_path_prog=""
5630 cf_path_args=""
5631 IFS="${IFS:-    }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR"
5632 for cf_temp in $ac_cv_path_$1
5633 do
5634         if test -z "$cf_path_prog" ; then
5635                 if test "$with_full_paths" = yes ; then
5636                         CF_PATH_SYNTAX(cf_temp,break)
5637                         cf_path_prog="$cf_temp"
5638                 else
5639                         cf_path_prog="`basename $cf_temp`"
5640                 fi
5641         elif test -z "$cf_path_args" ; then
5642                 cf_path_args="$cf_temp"
5643         else
5644                 cf_path_args="$cf_path_args $cf_temp"
5645         fi
5646 done
5647 IFS="$cf_save_ifs"
5648
5649 if test -n "$cf_path_prog" ; then
5650         CF_MSG_LOG(defining path for ${cf_path_prog})
5651         AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog",Define to pathname $1)
5652         test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args",Define to provide args for $1)
5653 fi
5654 ])dnl
5655 dnl ---------------------------------------------------------------------------
5656 dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57
5657 dnl --------------
5658 dnl Check the argument to see that it looks like a pathname.  Rewrite it if it
5659 dnl begins with one of the prefix/exec_prefix variables, and then again if the
5660 dnl result begins with 'NONE'.  This is necessary to work around autoconf's
5661 dnl delayed evaluation of those symbols.
5662 AC_DEFUN([CF_PATH_SYNTAX],[
5663 if test "x$prefix" != xNONE; then
5664         cf_path_syntax="$prefix"
5665 else
5666         cf_path_syntax="$ac_default_prefix"
5667 fi
5668
5669 case ".[$]$1" in
5670 (.\[$]\(*\)*|.\'*\'*)
5671         ;;
5672 (..|./*|.\\*)
5673         ;;
5674 (.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX
5675         ;;
5676 (.\[$]{*prefix}*|.\[$]{*dir}*)
5677         eval $1="[$]$1"
5678         case ".[$]$1" in
5679         (.NONE/*)
5680                 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
5681                 ;;
5682         esac
5683         ;;
5684 (.no|.NONE/*)
5685         $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
5686         ;;
5687 (*)
5688         ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
5689         ;;
5690 esac
5691 ])dnl
5692 dnl ---------------------------------------------------------------------------
5693 dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58
5694 dnl -------------
5695 dnl Check for the package-config program, unless disabled by command-line.
5696 AC_DEFUN([CF_PKG_CONFIG],
5697 [
5698 AC_MSG_CHECKING(if you want to use pkg-config)
5699 AC_ARG_WITH(pkg-config,
5700         [  --with-pkg-config{=path} enable/disable use of pkg-config],
5701         [cf_pkg_config=$withval],
5702         [cf_pkg_config=yes])
5703 AC_MSG_RESULT($cf_pkg_config)
5704
5705 case $cf_pkg_config in
5706 (no)
5707         PKG_CONFIG=none
5708         ;;
5709 (yes)
5710         CF_ACVERSION_CHECK(2.52,
5711                 [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
5712                 [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
5713         ;;
5714 (*)
5715         PKG_CONFIG=$withval
5716         ;;
5717 esac
5718
5719 test -z "$PKG_CONFIG" && PKG_CONFIG=none
5720 if test "$PKG_CONFIG" != none ; then
5721         CF_PATH_SYNTAX(PKG_CONFIG)
5722 elif test "x$cf_pkg_config" != xno ; then
5723         AC_MSG_WARN(pkg-config is not installed)
5724 fi
5725
5726 AC_SUBST(PKG_CONFIG)
5727 ])dnl
5728 dnl ---------------------------------------------------------------------------
5729 dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17
5730 dnl -----------------
5731 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
5732 dnl
5733 dnl     POSIX.1-1990                            _POSIX_SOURCE
5734 dnl     POSIX.1-1990 and                        _POSIX_SOURCE and
5735 dnl             POSIX.2-1992 C-Language                 _POSIX_C_SOURCE=2
5736 dnl             Bindings Option
5737 dnl     POSIX.1b-1993                           _POSIX_C_SOURCE=199309L
5738 dnl     POSIX.1c-1996                           _POSIX_C_SOURCE=199506L
5739 dnl     X/Open 2000                             _POSIX_C_SOURCE=200112L
5740 dnl
5741 dnl Parameters:
5742 dnl     $1 is the nominal value for _POSIX_C_SOURCE
5743 AC_DEFUN([CF_POSIX_C_SOURCE],
5744 [AC_REQUIRE([CF_POSIX_VISIBLE])dnl
5745
5746 if test "$cf_cv_posix_visible" = no; then
5747
5748 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
5749
5750 cf_save_CFLAGS="$CFLAGS"
5751 cf_save_CPPFLAGS="$CPPFLAGS"
5752
5753 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
5754 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
5755
5756 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
5757         CF_MSG_LOG(if the symbol is already defined go no further)
5758         AC_TRY_COMPILE([#include <sys/types.h>],[
5759 #ifndef _POSIX_C_SOURCE
5760 make an error
5761 #endif],
5762         [cf_cv_posix_c_source=no],
5763         [cf_want_posix_source=no
5764          case .$cf_POSIX_C_SOURCE in
5765          (.[[12]]??*)
5766                 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
5767                 ;;
5768          (.2)
5769                 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
5770                 cf_want_posix_source=yes
5771                 ;;
5772          (.*)
5773                 cf_want_posix_source=yes
5774                 ;;
5775          esac
5776          if test "$cf_want_posix_source" = yes ; then
5777                 AC_TRY_COMPILE([#include <sys/types.h>],[
5778 #ifdef _POSIX_SOURCE
5779 make an error
5780 #endif],[],
5781                 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
5782          fi
5783          CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
5784          CFLAGS="$cf_trim_CFLAGS"
5785          CPPFLAGS="$cf_trim_CPPFLAGS"
5786          CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source)
5787          CF_MSG_LOG(if the second compile does not leave our definition intact error)
5788          AC_TRY_COMPILE([#include <sys/types.h>],[
5789 #ifndef _POSIX_C_SOURCE
5790 make an error
5791 #endif],,
5792          [cf_cv_posix_c_source=no])
5793          CFLAGS="$cf_save_CFLAGS"
5794          CPPFLAGS="$cf_save_CPPFLAGS"
5795         ])
5796 ])
5797
5798 if test "$cf_cv_posix_c_source" != no ; then
5799         CFLAGS="$cf_trim_CFLAGS"
5800         CPPFLAGS="$cf_trim_CPPFLAGS"
5801         CF_ADD_CFLAGS($cf_cv_posix_c_source)
5802 fi
5803
5804 fi # cf_cv_posix_visible
5805
5806 ])dnl
5807 dnl ---------------------------------------------------------------------------
5808 dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17
5809 dnl ----------------
5810 dnl POSIX documents test-macros which an application may set before any system
5811 dnl headers are included to make features available.
5812 dnl
5813 dnl Some BSD platforms (originally FreeBSD, but copied by a few others)
5814 dnl diverged from POSIX in 2002 by setting symbols which make all of the most
5815 dnl recent features visible in the system header files unless the application
5816 dnl overrides the corresponding test-macros.  Doing that introduces portability
5817 dnl problems.
5818 dnl
5819 dnl This macro makes a special check for the symbols used for this, to avoid a
5820 dnl conflicting definition.
5821 AC_DEFUN([CF_POSIX_VISIBLE],
5822 [
5823 AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[
5824 AC_TRY_COMPILE([#include <stdio.h>],[
5825 #if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \
5826         && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \
5827         && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \
5828         && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0)
5829 #error conflicting symbols found
5830 #endif
5831 ],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes])
5832 ])
5833 ])dnl
5834 dnl ---------------------------------------------------------------------------
5835 dnl CF_PREDEFINE version: 2 updated: 2010/05/26 16:44:57
5836 dnl ------------
5837 dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles.
5838 dnl
5839 dnl $1 = symbol to test
5840 dnl $2 = value (if any) to use for a predefinition
5841 AC_DEFUN([CF_PREDEFINE],
5842 [
5843 AC_MSG_CHECKING(if we must define $1)
5844 AC_TRY_COMPILE([#include <sys/types.h>
5845 ],[
5846 #ifndef $1
5847 make an error
5848 #endif],[cf_result=no],[cf_result=yes])
5849 AC_MSG_RESULT($cf_result)
5850
5851 if test "$cf_result" = yes ; then
5852         CPPFLAGS="$CPPFLAGS ifelse([$2],,-D$1,[-D$1=$2])"
5853 elif test "x$2" != "x" ; then
5854         AC_MSG_CHECKING(checking for compatible value versus $2)
5855         AC_TRY_COMPILE([#include <sys/types.h>
5856 ],[
5857 #if $1-$2 < 0
5858 make an error
5859 #endif],[cf_result=yes],[cf_result=no])
5860         AC_MSG_RESULT($cf_result)
5861         if test "$cf_result" = no ; then
5862                 # perhaps we can override it - try...
5863                 CPPFLAGS="$CPPFLAGS -D$1=$2"
5864         fi
5865 fi
5866 ])dnl
5867 dnl ---------------------------------------------------------------------------
5868 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
5869 dnl ------------
5870 dnl Append definitions and rules for the given programs to the subdirectory
5871 dnl Makefiles, and the recursion rule for the top-level Makefile.
5872 dnl
5873 dnl parameters
5874 dnl     $1 = script to run
5875 dnl     $2 = list of subdirectories
5876 dnl
5877 dnl variables
5878 dnl     $AWK
5879 AC_DEFUN([CF_PRG_RULES],
5880 [
5881 for cf_dir in $2
5882 do
5883         if test ! -d $srcdir/$cf_dir; then
5884                 continue
5885         elif test -f $srcdir/$cf_dir/programs; then
5886                 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
5887         fi
5888 done
5889
5890 ])dnl
5891 dnl ---------------------------------------------------------------------------
5892 dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22
5893 dnl ----------
5894 dnl Check for archiver "ar".
5895 AC_DEFUN([CF_PROG_AR],[
5896 AC_CHECK_TOOL(AR, ar, ar)
5897 ])
5898 dnl ---------------------------------------------------------------------------
5899 dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59
5900 dnl -----------
5901 dnl Check for awk, ensure that the check found something.
5902 AC_DEFUN([CF_PROG_AWK],
5903 [
5904 AC_PROG_AWK
5905 test -z "$AWK" && AC_MSG_ERROR(No awk program found)
5906 ])dnl
5907 dnl ---------------------------------------------------------------------------
5908 dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58
5909 dnl ----------
5910 dnl standard check for CC, plus followup sanity checks
5911 dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
5912 AC_DEFUN([CF_PROG_CC],[
5913 ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
5914 CF_GCC_VERSION
5915 CF_ACVERSION_CHECK(2.52,
5916         [AC_PROG_CC_STDC],
5917         [CF_ANSI_CC_REQD])
5918 CF_CC_ENV_FLAGS
5919 ])dnl
5920 dnl ---------------------------------------------------------------------------
5921 dnl CF_PROG_CC_C_O version: 5 updated: 2017/01/21 11:06:25
5922 dnl --------------
5923 dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
5924 dnl the output file can be renamed, and allows for a shell variable that can
5925 dnl be used later.  The parameter is either CC or CXX.  The result is the
5926 dnl cache variable:
5927 dnl     $cf_cv_prog_CC_c_o
5928 dnl     $cf_cv_prog_CXX_c_o
5929 dnl
5930 dnl $1 = compiler
5931 dnl $2 = compiler options, if any
5932 AC_DEFUN([CF_PROG_CC_C_O],
5933 [AC_REQUIRE([AC_PROG_CC])dnl
5934 AC_MSG_CHECKING([whether [$]$1 understands -c and -o together])
5935 AC_CACHE_VAL(cf_cv_prog_$1_c_o,
5936 [
5937 cat > conftest.$ac_ext <<CF_EOF
5938 int main(void)
5939 {
5940         ${cf_cv_main_return:-return}(0);
5941 }
5942 CF_EOF
5943 # We do the test twice because some compilers refuse to overwrite an
5944 # existing .o file with -o, though they will create one.
5945 ac_try='[$]$1 $2 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC'
5946 if AC_TRY_EVAL(ac_try) &&
5947   test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
5948 then
5949   eval cf_cv_prog_$1_c_o=yes
5950 else
5951   eval cf_cv_prog_$1_c_o=no
5952 fi
5953 rm -rf conftest*
5954 ])dnl
5955 if test $cf_cv_prog_$1_c_o = yes; then
5956   AC_MSG_RESULT([yes])
5957 else
5958   AC_MSG_RESULT([no])
5959 fi
5960 ])dnl
5961 dnl ---------------------------------------------------------------------------
5962 dnl CF_PROG_EGREP version: 2 updated: 2015/04/18 08:56:57
5963 dnl -------------
5964 dnl AC_PROG_EGREP was introduced in autoconf 2.53.
5965 dnl This macro adds a check to ensure the script found something.
5966 AC_DEFUN([CF_PROG_EGREP],
5967 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
5968         [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
5969                 then ac_cv_prog_egrep='grep -E'
5970                 else ac_cv_prog_egrep='egrep'
5971         fi])
5972         EGREP=$ac_cv_prog_egrep
5973         AC_SUBST([EGREP])
5974         test -z "$EGREP" && AC_MSG_ERROR(No egrep program found)
5975 ])dnl
5976 dnl ---------------------------------------------------------------------------
5977 dnl CF_PROG_GNAT version: 8 updated: 2018/11/10 19:47:04
5978 dnl ------------
5979 dnl Check for gnatmake, ensure that it is complete.
5980 AC_DEFUN([CF_PROG_GNAT],[
5981 cf_ada_make=gnatmake
5982 cf_ada_config="#"
5983 AC_CHECK_PROG(gnatmake_exists, $cf_ada_make, yes, no)
5984 if test "$ac_cv_prog_gnatmake_exists" = no; then
5985         cf_ada_make=
5986         cf_cv_prog_gnat_correct=no
5987 else
5988         AC_CHECK_PROG(gprconfig_exists, gprconfig, yes, no)
5989         if test "$ac_cv_prog_gprconfig_exists" = yes
5990         then
5991                 rm -rf conftest* *~conftest*
5992                 if mkdir conftest.src
5993                 then
5994                         cf_ada_config=""
5995                         cd conftest.src
5996                         for cf_gprconfig in Ada C
5997                         do
5998                                 AC_MSG_CHECKING(for gprconfig name for $cf_gprconfig)
5999                                 if test $cf_gprconfig = C
6000                                 then
6001                                         for cf_gprconfig_param in \
6002                                                 $cf_gprconfig,,,,GNATGCC \
6003                                                 $cf_gprconfig,,,,GCC \
6004                                                 $cf_gprconfig
6005                                         do
6006                                                 cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1`
6007                                                 test -n "$cf_gprconfig_value" && break
6008                                         done
6009                                 else
6010                                         cf_gprconfig_param=$cf_gprconfig
6011                                         cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1`
6012                                 fi
6013                                 if test -n "$cf_gprconfig_value"
6014                                 then
6015                                         eval cf_ada_config_[$]cf_gprconfig=[$]cf_gprconfig_value
6016                                         AC_MSG_RESULT($cf_gprconfig_value)
6017                                 else
6018                                         AC_MSG_RESULT(missing)
6019                                         cf_ada_config="#"
6020                                         break
6021                                 fi
6022                         done
6023                         cd ..
6024                         rm -rf conftest* *~conftest*
6025                 fi
6026         else
6027                 # gprconfig is newer than gnatmake; we can continue...
6028                 cf_ada_config="##"
6029         fi
6030         if test "x$cf_ada_config" != "x#"
6031         then
6032                 CF_GNAT_VERSION
6033                 AC_CHECK_PROG(M4_exists, m4, yes, no)
6034                 if test "$ac_cv_prog_M4_exists" = no; then
6035                         cf_cv_prog_gnat_correct=no
6036                         echo Ada95 binding required program m4 not found. Ada95 binding disabled.
6037                 fi
6038                 if test "$cf_cv_prog_gnat_correct" = yes; then
6039                         AC_MSG_CHECKING(if GNAT works)
6040                         CF_GNAT_TRY_RUN([procedure conftest;],
6041 [with Text_IO;
6042 with GNAT.OS_Lib;
6043 procedure conftest is
6044 begin
6045    Text_IO.Put ("Hello World");
6046    Text_IO.New_Line;
6047    GNAT.OS_Lib.OS_Exit (0);
6048 end conftest;],[cf_cv_prog_gnat_correct=yes],[cf_cv_prog_gnat_correct=no])
6049                         AC_MSG_RESULT($cf_cv_prog_gnat_correct)
6050                 fi
6051         else
6052                 cf_cv_prog_gnat_correct=no
6053         fi
6054 fi
6055
6056 AC_SUBST(cf_ada_make)
6057 AC_SUBST(cf_ada_config)
6058 AC_SUBST(cf_ada_config_Ada)
6059 AC_SUBST(cf_ada_config_C)
6060 ])dnl
6061 dnl ---------------------------------------------------------------------------
6062 dnl CF_PROG_INSTALL version: 7 updated: 2015/04/18 08:56:57
6063 dnl ---------------
6064 dnl Force $INSTALL to be an absolute-path.  Otherwise, edit_man.sh and the
6065 dnl misc/tabset install won't work properly.  Usually this happens only when
6066 dnl using the fallback mkinstalldirs script
6067 AC_DEFUN([CF_PROG_INSTALL],
6068 [AC_PROG_INSTALL
6069 case $INSTALL in
6070 (/*)
6071         ;;
6072 (*)
6073         CF_DIRNAME(cf_dir,$INSTALL)
6074         test -z "$cf_dir" && cf_dir=.
6075         INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
6076         ;;
6077 esac
6078 ])dnl
6079 dnl ---------------------------------------------------------------------------
6080 dnl CF_PROG_LDCONFIG version: 5 updated: 2015/04/18 08:56:57
6081 dnl ----------------
6082 dnl Check for ldconfig, needed to fixup shared libraries that would be built
6083 dnl and then used in the install.
6084 AC_DEFUN([CF_PROG_LDCONFIG],[
6085 if test "$cross_compiling" = yes ; then
6086         LDCONFIG=:
6087 else
6088         case "$cf_cv_system_name" in
6089         (dragonfly*|mirbsd*|freebsd*)
6090                 test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
6091                 ;;
6092         (*) LDPATH=$PATH:/sbin:/usr/sbin
6093                 AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
6094                 ;;
6095         esac
6096 fi
6097 AC_SUBST(LDCONFIG)
6098 ])dnl
6099 dnl ---------------------------------------------------------------------------
6100 dnl CF_PROG_LINT version: 3 updated: 2016/05/22 15:25:54
6101 dnl ------------
6102 AC_DEFUN([CF_PROG_LINT],
6103 [
6104 AC_CHECK_PROGS(LINT, lint cppcheck splint)
6105 AC_SUBST(LINT_OPTS)
6106 ])dnl
6107 dnl ---------------------------------------------------------------------------
6108 dnl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37
6109 dnl ------------
6110 dnl Combine checks for "ln -s" and "ln -sf", updating $LN_S to include "-f"
6111 dnl option if it is supported.
6112 AC_DEFUN([CF_PROG_LN_S],[
6113 AC_PROG_LN_S
6114 AC_MSG_CHECKING(if $LN_S -f options work)
6115
6116 rm -f conf$$.src conf$$dst
6117 echo >conf$$.dst
6118 echo first >conf$$.src
6119 if $LN_S -f conf$$.src conf$$.dst 2>/dev/null; then
6120         cf_prog_ln_sf=yes
6121 else
6122         cf_prog_ln_sf=no
6123 fi
6124 rm -f conf$$.dst conf$$src
6125 AC_MSG_RESULT($cf_prog_ln_sf)
6126
6127 test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
6128 ])dnl
6129 dnl ---------------------------------------------------------------------------
6130 dnl CF_REGEX version: 12 updated: 2015/04/18 08:56:57
6131 dnl --------
6132 dnl Attempt to determine if we've got one of the flavors of regular-expression
6133 dnl code that we can support.
6134 AC_DEFUN([CF_REGEX],
6135 [
6136
6137 cf_regex_func=no
6138
6139 cf_regex_libs="regex re"
6140 case $host_os in
6141 (mingw*)
6142         cf_regex_libs="gnurx $cf_regex_libs"
6143         ;;
6144 esac
6145
6146 AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[
6147         for cf_regex_lib in $cf_regex_libs
6148         do
6149                 AC_CHECK_LIB($cf_regex_lib,regcomp,[
6150                                 CF_ADD_LIB($cf_regex_lib)
6151                                 cf_regex_func=regcomp
6152                                 break])
6153         done
6154 ])
6155
6156 if test "$cf_regex_func" = no ; then
6157         AC_CHECK_FUNC(compile,[cf_regex_func=compile],[
6158                 AC_CHECK_LIB(gen,compile,[
6159                                 CF_ADD_LIB(gen)
6160                                 cf_regex_func=compile])])
6161 fi
6162
6163 if test "$cf_regex_func" = no ; then
6164         AC_MSG_WARN(cannot find regular expression library)
6165 fi
6166
6167 AC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[
6168
6169 cf_cv_regex_hdrs=no
6170 case $cf_regex_func in
6171 (compile)
6172         for cf_regex_hdr in regexp.h regexpr.h
6173         do
6174                 AC_TRY_LINK([#include <$cf_regex_hdr>],[
6175                         char *p = compile("", "", "", 0);
6176                         int x = step("", "");
6177                 ],[
6178                         cf_cv_regex_hdrs=$cf_regex_hdr
6179                         break
6180                 ])
6181         done
6182         ;;
6183 (*)
6184         for cf_regex_hdr in regex.h
6185         do
6186                 AC_TRY_LINK([#include <sys/types.h>
6187 #include <$cf_regex_hdr>],[
6188                         regex_t *p;
6189                         int x = regcomp(p, "", 0);
6190                         int y = regexec(p, "", 0, 0, 0);
6191                         regfree(p);
6192                 ],[
6193                         cf_cv_regex_hdrs=$cf_regex_hdr
6194                         break
6195                 ])
6196         done
6197         ;;
6198 esac
6199
6200 ])
6201
6202 case $cf_cv_regex_hdrs in
6203         (no)            AC_MSG_WARN(no regular expression header found) ;;
6204         (regex.h)       AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;;
6205         (regexp.h)      AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;;
6206         (regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;;
6207 esac
6208 ])dnl
6209 dnl ---------------------------------------------------------------------------
6210 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
6211 dnl ----------------
6212 dnl Remove all -U and -D options that refer to the given symbol from a list
6213 dnl of C compiler options.  This works around the problem that not all
6214 dnl compilers process -U and -D options from left-to-right, so a -U option
6215 dnl cannot be used to cancel the effect of a preceding -D option.
6216 dnl
6217 dnl $1 = target (which could be the same as the source variable)
6218 dnl $2 = source (including '$')
6219 dnl $3 = symbol to remove
6220 define([CF_REMOVE_DEFINE],
6221 [
6222 $1=`echo "$2" | \
6223         sed     -e 's/-[[UD]]'"$3"'\(=[[^       ]]*\)\?[[       ]]/ /g' \
6224                 -e 's/-[[UD]]'"$3"'\(=[[^       ]]*\)\?[$]//g'`
6225 ])dnl
6226 dnl ---------------------------------------------------------------------------
6227 dnl CF_REMOVE_LIB version: 1 updated: 2007/02/17 14:11:52
6228 dnl -------------
6229 dnl Remove the given library from the symbol
6230 dnl
6231 dnl $1 = target (which could be the same as the source variable)
6232 dnl $2 = source (including '$')
6233 dnl $3 = library to remove
6234 define([CF_REMOVE_LIB],
6235 [
6236 # remove $3 library from $2
6237 $1=`echo "$2" | sed -e 's/-l$3[[        ]]//g' -e 's/-l$3[$]//'`
6238 ])dnl
6239 dnl ---------------------------------------------------------------------------
6240 dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00
6241 dnl -------------
6242 AC_DEFUN([CF_RPATH_HACK],
6243 [
6244 AC_REQUIRE([CF_LD_RPATH_OPT])
6245 AC_MSG_CHECKING(for updated LDFLAGS)
6246 if test -n "$LD_RPATH_OPT" ; then
6247         AC_MSG_RESULT(maybe)
6248
6249         AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
6250         cf_rpath_list="/usr/lib /lib"
6251         if test "$cf_ldd_prog" != no
6252         then
6253                 cf_rpath_oops=
6254
6255 AC_TRY_LINK([#include <stdio.h>],
6256                 [printf("Hello");],
6257                 [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq`
6258                  cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[     ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`])
6259
6260                 # If we passed the link-test, but get a "not found" on a given library,
6261                 # this could be due to inept reconfiguration of gcc to make it only
6262                 # partly honor /usr/local/lib (or whatever).  Sometimes this behavior
6263                 # is intentional, e.g., installing gcc in /usr/bin and suppressing the
6264                 # /usr/local libraries.
6265                 if test -n "$cf_rpath_oops"
6266                 then
6267                         for cf_rpath_src in $cf_rpath_oops
6268                         do
6269                                 for cf_rpath_dir in \
6270                                         /usr/local \
6271                                         /usr/pkg \
6272                                         /opt/sfw
6273                                 do
6274                                         if test -f $cf_rpath_dir/lib/$cf_rpath_src
6275                                         then
6276                                                 CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
6277                                                 LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
6278                                                 break
6279                                         fi
6280                                 done
6281                         done
6282                 fi
6283         fi
6284
6285         CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
6286
6287         CF_RPATH_HACK_2(LDFLAGS)
6288         CF_RPATH_HACK_2(LIBS)
6289
6290         CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
6291 else
6292         AC_MSG_RESULT(no)
6293 fi
6294 AC_SUBST(EXTRA_LDFLAGS)
6295 ])dnl
6296 dnl ---------------------------------------------------------------------------
6297 dnl CF_RPATH_HACK_2 version: 7 updated: 2015/04/12 15:39:00
6298 dnl ---------------
6299 dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
6300 dnl EXTRA_LDFLAGS for each -L option found.
6301 dnl
6302 dnl $cf_rpath_list contains a list of directories to ignore.
6303 dnl
6304 dnl $1 = variable name to update.  The LDFLAGS variable should be the only one,
6305 dnl      but LIBS often has misplaced -L options.
6306 AC_DEFUN([CF_RPATH_HACK_2],
6307 [
6308 CF_VERBOSE(...checking $1 [$]$1)
6309
6310 cf_rpath_dst=
6311 for cf_rpath_src in [$]$1
6312 do
6313         case $cf_rpath_src in
6314         (-L*)
6315
6316                 # check if this refers to a directory which we will ignore
6317                 cf_rpath_skip=no
6318                 if test -n "$cf_rpath_list"
6319                 then
6320                         for cf_rpath_item in $cf_rpath_list
6321                         do
6322                                 if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
6323                                 then
6324                                         cf_rpath_skip=yes
6325                                         break
6326                                 fi
6327                         done
6328                 fi
6329
6330                 if test "$cf_rpath_skip" = no
6331                 then
6332                         # transform the option
6333                         if test "$LD_RPATH_OPT" = "-R " ; then
6334                                 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
6335                         else
6336                                 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
6337                         fi
6338
6339                         # if we have not already added this, add it now
6340                         cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
6341                         if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
6342                         then
6343                                 CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
6344                                 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
6345                         fi
6346                 fi
6347                 ;;
6348         esac
6349         cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
6350 done
6351 $1=$cf_rpath_dst
6352
6353 CF_VERBOSE(...checked $1 [$]$1)
6354 AC_SUBST(EXTRA_LDFLAGS)
6355 ])dnl
6356 dnl ---------------------------------------------------------------------------
6357 dnl CF_SHARED_OPTS version: 93 updated: 2018/08/18 16:36:35
6358 dnl --------------
6359 dnl --------------
6360 dnl Attempt to determine the appropriate CC/LD options for creating a shared
6361 dnl library.
6362 dnl
6363 dnl Notes:
6364 dnl a) ${LOCAL_LDFLAGS} is used to link executables that will run within
6365 dnl the build-tree, i.e., by making use of the libraries that are compiled in
6366 dnl $rel_builddir/lib We avoid compiling-in a $rel_builddir/lib path for the
6367 dnl shared library since that can lead to unexpected results at runtime.
6368 dnl b) ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared
6369 dnl libraries are compiled in ../../lib
6370 dnl
6371 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
6372 dnl to install symbolic links to the rel/abi versions of shared libraries.
6373 dnl
6374 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
6375 dnl version when making symbolic links.
6376 dnl
6377 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
6378 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
6379 dnl (ex: libncurses.so.<ver>).
6380 dnl
6381 dnl Some loaders leave 'so_locations' lying around.  It's nice to clean up.
6382 AC_DEFUN([CF_SHARED_OPTS],
6383 [
6384         AC_REQUIRE([CF_LD_RPATH_OPT])
6385
6386         RM_SHARED_OPTS=
6387         LOCAL_LDFLAGS=
6388         LOCAL_LDFLAGS2=
6389         LD_SHARED_OPTS=
6390         INSTALL_LIB="-m 644"
6391         : ${rel_builddir:=.}
6392
6393         shlibdir=$libdir
6394         AC_SUBST(shlibdir)
6395
6396         MAKE_DLLS="#"
6397         AC_SUBST(MAKE_DLLS)
6398
6399         cf_cv_do_symlinks=no
6400         cf_ld_rpath_opt=
6401         test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT"
6402
6403         AC_MSG_CHECKING(if release/abi version should be used for shared libs)
6404         AC_ARG_WITH(shlib-version,
6405         [  --with-shlib-version=X  Specify rel or abi version for shared libs],
6406         [test -z "$withval" && withval=auto
6407         case $withval in
6408         (yes)
6409                 cf_cv_shlib_version=auto
6410                 ;;
6411         (rel|abi|auto)
6412                 cf_cv_shlib_version=$withval
6413                 ;;
6414         (*)
6415                 AC_MSG_RESULT($withval)
6416                 AC_MSG_ERROR([option value must be one of: rel, abi, or auto])
6417                 ;;
6418         esac
6419         ],[cf_cv_shlib_version=auto])
6420         AC_MSG_RESULT($cf_cv_shlib_version)
6421
6422         cf_cv_rm_so_locs=no
6423         cf_try_cflags=
6424
6425         # Some less-capable ports of gcc support only -fpic
6426         CC_SHARED_OPTS=
6427
6428         cf_try_fPIC=no
6429         if test "$GCC" = yes
6430         then
6431                 cf_try_fPIC=yes
6432         else
6433                 case $cf_cv_system_name in
6434                 (*linux*)       # e.g., PGI compiler
6435                         cf_try_fPIC=yes
6436                         ;;
6437                 esac
6438         fi
6439
6440         if test "$cf_try_fPIC" = yes
6441         then
6442                 AC_MSG_CHECKING(which $CC option to use)
6443                 cf_save_CFLAGS="$CFLAGS"
6444                 for CC_SHARED_OPTS in -fPIC -fpic ''
6445                 do
6446                         CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
6447                         AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
6448                 done
6449                 AC_MSG_RESULT($CC_SHARED_OPTS)
6450                 CFLAGS="$cf_save_CFLAGS"
6451         fi
6452
6453         cf_cv_shlib_version_infix=no
6454
6455         case $cf_cv_system_name in
6456         (aix4.[3-9]*|aix[[5-7]]*)
6457                 if test "$GCC" = yes; then
6458                         CC_SHARED_OPTS='-Wl,-brtl'
6459                         MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
6460                 else
6461                         CC_SHARED_OPTS='-brtl'
6462                         # as well as '-qpic=large -G' or perhaps "-bM:SRE -bnoentry -bexpall"
6463                         MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
6464                 fi
6465                 ;;
6466         (beos*)
6467                 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
6468                 ;;
6469         (cygwin*)
6470                 CC_SHARED_OPTS=
6471                 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
6472                 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
6473                 cf_cv_shlib_version=cygdll
6474                 cf_cv_shlib_version_infix=cygdll
6475                 shlibdir=$bindir
6476                 MAKE_DLLS=
6477                 cat >mk_shared_lib.sh <<-CF_EOF
6478                 #!$SHELL
6479                 SHARED_LIB=\[$]1
6480                 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
6481                 shift
6482                 cat <<-EOF
6483                 Linking shared library
6484                 ** SHARED_LIB \[$]SHARED_LIB
6485                 ** IMPORT_LIB \[$]IMPORT_LIB
6486 EOF
6487                 exec \[$]* ${LDFLAGS} -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
6488 CF_EOF
6489                 chmod +x mk_shared_lib.sh
6490                 ;;
6491         (msys*)
6492                 CC_SHARED_OPTS=
6493                 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
6494                 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
6495                 cf_cv_shlib_version=msysdll
6496                 cf_cv_shlib_version_infix=msysdll
6497                 shlibdir=$bindir
6498                 MAKE_DLLS=
6499                 cat >mk_shared_lib.sh <<-CF_EOF
6500                 #!$SHELL
6501                 SHARED_LIB=\[$]1
6502                 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
6503                 shift
6504                 cat <<-EOF
6505                 Linking shared library
6506                 ** SHARED_LIB \[$]SHARED_LIB
6507                 ** IMPORT_LIB \[$]IMPORT_LIB
6508 EOF
6509                 exec \[$]* ${LDFLAGS} -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
6510 CF_EOF
6511                 chmod +x mk_shared_lib.sh
6512                 ;;
6513         (darwin*)
6514                 cf_try_cflags="no-cpp-precomp"
6515                 CC_SHARED_OPTS="-dynamic"
6516                 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
6517                 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
6518                 cf_cv_shlib_version_infix=yes
6519                 AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [
6520                         cf_save_LDFLAGS=$LDFLAGS
6521                         LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
6522                         AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no)
6523                                 LDFLAGS=$cf_save_LDFLAGS])
6524                 if test $cf_cv_ldflags_search_paths_first = yes; then
6525                         LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
6526                 fi
6527                 ;;
6528         (hpux[[7-8]]*)
6529                 # HP-UX 8.07 ld lacks "+b" option used for libdir search-list
6530                 if test "$GCC" != yes; then
6531                         CC_SHARED_OPTS='+Z'
6532                 fi
6533                 MK_SHARED_LIB='${LD} ${LDFLAGS} -b -o $[@]'
6534                 INSTALL_LIB="-m 555"
6535                 ;;
6536         (hpux*)
6537                 # (tested with gcc 2.7.2 -- I don't have c89)
6538                 if test "$GCC" = yes; then
6539                         LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}'
6540                 else
6541                         CC_SHARED_OPTS='+Z'
6542                         LD_SHARED_OPTS='-Wl,+b,${libdir}'
6543                 fi
6544                 MK_SHARED_LIB='${LD} ${LDFLAGS} +b ${libdir} -b -o $[@]'
6545                 # HP-UX shared libraries must be executable, and should be
6546                 # readonly to exploit a quirk in the memory manager.
6547                 INSTALL_LIB="-m 555"
6548                 ;;
6549         (interix*)
6550                 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
6551                 if test "$cf_cv_shlib_version" = rel; then
6552                         cf_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
6553                 else
6554                         cf_shared_soname='`basename $[@]`'
6555                 fi
6556                 CC_SHARED_OPTS=
6557                 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $[@]'
6558                 ;;
6559         (irix*)
6560                 if test "$cf_cv_enable_rpath" = yes ; then
6561                         EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
6562                 fi
6563                 # tested with IRIX 5.2 and 'cc'.
6564                 if test "$GCC" != yes; then
6565                         CC_SHARED_OPTS='-KPIC'
6566                         MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -rdata_shared -soname `basename $[@]` -o $[@]'
6567                 else
6568                         MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,`basename $[@]` -o $[@]'
6569                 fi
6570                 cf_cv_rm_so_locs=yes
6571                 ;;
6572         (linux*|gnu*|k*bsd*-gnu)
6573                 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
6574                         LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
6575                         LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6576                 fi
6577                 if test "$cf_cv_enable_rpath" = yes ; then
6578                         EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
6579                 fi
6580                 CF_SHARED_SONAME
6581                 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
6582                 ;;
6583         (mingw*)
6584                 cf_cv_shlib_version=mingw
6585                 cf_cv_shlib_version_infix=mingw
6586                 shlibdir=$bindir
6587                 MAKE_DLLS=
6588                 if test "$DFT_LWR_MODEL" = "shared" ; then
6589                         LOCAL_LDFLAGS="-Wl,--enable-auto-import"
6590                         LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6591                         EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS"
6592                 fi
6593                 CC_SHARED_OPTS=
6594                 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
6595                 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
6596                 cat >mk_shared_lib.sh <<-CF_EOF
6597                 #!$SHELL
6598                 SHARED_LIB=\[$]1
6599                 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
6600                 shift
6601                 cat <<-EOF
6602                 Linking shared library
6603                 ** SHARED_LIB \[$]SHARED_LIB
6604                 ** IMPORT_LIB \[$]IMPORT_LIB
6605 EOF
6606                 exec \[$]* ${LDFLAGS} -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
6607 CF_EOF
6608                 chmod +x mk_shared_lib.sh
6609                 ;;
6610         (openbsd[[2-9]].*|mirbsd*)
6611                 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
6612                         LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
6613                         LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6614                 fi
6615                 if test "$cf_cv_enable_rpath" = yes ; then
6616                         EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
6617                 fi
6618                 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
6619                 CF_SHARED_SONAME
6620                 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
6621                 ;;
6622         (nto-qnx*|openbsd*|freebsd[[12]].*)
6623                 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
6624                 MK_SHARED_LIB='${LD} ${LDFLAGS} -Bshareable -o $[@]'
6625                 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
6626                 ;;
6627         (dragonfly*|freebsd*)
6628                 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
6629                 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
6630                         LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
6631                         LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
6632                         EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
6633                 fi
6634                 CF_SHARED_SONAME
6635                 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
6636                 ;;
6637         (netbsd*)
6638                 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
6639                 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
6640                         LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
6641                         LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6642                         EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
6643                         if test "$cf_cv_shlib_version" = auto; then
6644                         if test -f /usr/libexec/ld.elf_so; then
6645                                 cf_cv_shlib_version=abi
6646                         else
6647                                 cf_cv_shlib_version=rel
6648                         fi
6649                         fi
6650                         CF_SHARED_SONAME
6651                         MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]'
6652                 else
6653                         MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -Wl,-shared -Wl,-Bshareable -o $[@]'
6654                 fi
6655                 ;;
6656         (osf*|mls+*)
6657                 # tested with OSF/1 V3.2 and 'cc'
6658                 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
6659                 # link with shared libs).
6660                 MK_SHARED_LIB='${LD} ${LDFLAGS} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`'
6661                 case $host_os in
6662                 (osf4*)
6663                         MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
6664                         ;;
6665                 esac
6666                 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
6667                 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
6668                         LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
6669                         LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6670                 fi
6671                 cf_cv_rm_so_locs=yes
6672                 ;;
6673         (sco3.2v5*)  # also uw2* and UW7: hops 13-Apr-98
6674                 # tested with osr5.0.5
6675                 if test "$GCC" != yes; then
6676                         CC_SHARED_OPTS='-belf -KPIC'
6677                 fi
6678                 MK_SHARED_LIB='${LD} ${LDFLAGS} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@'
6679                 if test "$cf_cv_enable_rpath" = yes ; then
6680                         # only way is to set LD_RUN_PATH but no switch for it
6681                         RUN_PATH=$libdir
6682                 fi
6683                 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
6684                 LINK_PROGS='LD_RUN_PATH=${libdir}'
6685                 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
6686                 ;;
6687         (sunos4*)
6688                 # tested with SunOS 4.1.1 and gcc 2.7.0
6689                 if test "$GCC" != yes; then
6690                         CC_SHARED_OPTS='-KPIC'
6691                 fi
6692                 MK_SHARED_LIB='${LD} ${LDFLAGS} -assert pure-text -o $[@]'
6693                 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
6694                 ;;
6695         (solaris2*)
6696                 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
6697                 # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3
6698                 if test "$DFT_LWR_MODEL" = "shared" ; then
6699                         LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}"
6700                         LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6701                 fi
6702                 if test "$cf_cv_enable_rpath" = yes ; then
6703                         EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS"
6704                 fi
6705                 CF_SHARED_SONAME
6706                 if test "$GCC" != yes; then
6707                         cf_save_CFLAGS="$CFLAGS"
6708                         for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O
6709                         do
6710                                 CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
6711                                 AC_TRY_COMPILE([#include <stdio.h>],[printf("Hello\n");],[break])
6712                         done
6713                         CFLAGS="$cf_save_CFLAGS"
6714                         CC_SHARED_OPTS=$cf_shared_opts
6715                         MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -dy -G -h '$cf_cv_shared_soname' -o $[@]'
6716                 else
6717                         MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]'
6718                 fi
6719                 ;;
6720         (sysv5uw7*|unix_sv*)
6721                 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
6722                 if test "$GCC" != yes; then
6723                         CC_SHARED_OPTS='-KPIC'
6724                 fi
6725                 MK_SHARED_LIB='${LD} ${LDFLAGS} -d y -G -o [$]@'
6726                 ;;
6727         (*)
6728                 CC_SHARED_OPTS='unknown'
6729                 MK_SHARED_LIB='echo unknown'
6730                 ;;
6731         esac
6732
6733         # This works if the last tokens in $MK_SHARED_LIB are the -o target.
6734         case "$cf_cv_shlib_version" in
6735         (rel|abi)
6736                 case "$MK_SHARED_LIB" in
6737                 (*'-o $[@]')
6738                         test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
6739                         ;;
6740                 (*)
6741                         AC_MSG_WARN(ignored --with-shlib-version)
6742                         ;;
6743                 esac
6744                 ;;
6745         esac
6746
6747         if test -n "$cf_try_cflags"
6748         then
6749 cat > conftest.$ac_ext <<EOF
6750 #line __oline__ "${as_me:-configure}"
6751 #include <stdio.h>
6752 int main(int argc, char *argv[[]])
6753 {
6754         printf("hello\n");
6755         return (argv[[argc-1]] == 0) ;
6756 }
6757 EOF
6758                 cf_save_CFLAGS="$CFLAGS"
6759                 for cf_opt in $cf_try_cflags
6760                 do
6761                         CFLAGS="$cf_save_CFLAGS -$cf_opt"
6762                         AC_MSG_CHECKING(if CFLAGS option -$cf_opt works)
6763                         if AC_TRY_EVAL(ac_compile); then
6764                                 AC_MSG_RESULT(yes)
6765                                 cf_save_CFLAGS="$CFLAGS"
6766                         else
6767                                 AC_MSG_RESULT(no)
6768                         fi
6769                 done
6770                 CFLAGS="$cf_save_CFLAGS"
6771         fi
6772
6773
6774         # RPATH_LIST is a colon-separated list of directories
6775         test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
6776         test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
6777
6778         test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations"
6779
6780         CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS)
6781         CF_VERBOSE(MK_SHARED_LIB:  $MK_SHARED_LIB)
6782
6783         AC_SUBST(CC_SHARED_OPTS)
6784         AC_SUBST(LD_RPATH_OPT)
6785         AC_SUBST(LD_SHARED_OPTS)
6786         AC_SUBST(MK_SHARED_LIB)
6787         AC_SUBST(RM_SHARED_OPTS)
6788
6789         AC_SUBST(LINK_PROGS)
6790         AC_SUBST(LINK_TESTS)
6791
6792         AC_SUBST(EXTRA_LDFLAGS)
6793         AC_SUBST(LOCAL_LDFLAGS)
6794         AC_SUBST(LOCAL_LDFLAGS2)
6795
6796         AC_SUBST(INSTALL_LIB)
6797         AC_SUBST(RPATH_LIST)
6798 ])dnl
6799 dnl ---------------------------------------------------------------------------
6800 dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
6801 dnl ----------------
6802 dnl utility macro for CF_SHARED_OPTS, constructs "$cf_cv_shared_soname" for
6803 dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar)
6804 dnl option.
6805 dnl
6806 dnl $1 is the default that should be used for "$cf_cv_shlib_version".
6807 dnl If missing, use "rel".
6808 define([CF_SHARED_SONAME],
6809 [
6810         test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1)
6811         if test "$cf_cv_shlib_version" = rel; then
6812                 cf_cv_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
6813         else
6814                 cf_cv_shared_soname='`basename $[@]`'
6815         fi
6816 ])
6817 dnl ---------------------------------------------------------------------------
6818 dnl CF_SIGWINCH version: 2 updated: 2019/03/23 19:54:44
6819 dnl -----------
6820 dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
6821 dnl programs need this test).
6822 dnl
6823 dnl This is really a Mac OS X 10.4.3 workaround.  Defining _POSIX_C_SOURCE
6824 dnl forces SIGWINCH to be undefined (breaks xterm, ncurses).  Oddly, the struct
6825 dnl winsize declaration is left alone - we may revisit this if Apple choose to
6826 dnl break that part of the interface as well.
6827 AC_DEFUN([CF_SIGWINCH],
6828 [
6829 AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
6830         AC_TRY_COMPILE([
6831 #include <sys/types.h>
6832 #include <sys/signal.h>
6833 ],[int x = SIGWINCH],
6834         [cf_cv_define_sigwinch=yes],
6835         [AC_TRY_COMPILE([
6836 #undef _XOPEN_SOURCE
6837 #undef _POSIX_SOURCE
6838 #undef _POSIX_C_SOURCE
6839 #include <sys/types.h>
6840 #include <sys/signal.h>
6841 ],[int x = SIGWINCH],
6842         [cf_cv_define_sigwinch=maybe],
6843         [cf_cv_define_sigwinch=no])
6844 ])
6845 ])
6846
6847 if test "$cf_cv_define_sigwinch" = maybe ; then
6848 AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
6849 cf_cv_fixup_sigwinch=unknown
6850 cf_sigwinch=32
6851 while test $cf_sigwinch != 1
6852 do
6853         AC_TRY_COMPILE([
6854 #undef _XOPEN_SOURCE
6855 #undef _POSIX_SOURCE
6856 #undef _POSIX_C_SOURCE
6857 #include <sys/types.h>
6858 #include <sys/signal.h>
6859 ],[
6860 #if SIGWINCH != $cf_sigwinch
6861 make an error
6862 #endif
6863 int x = SIGWINCH],
6864         [cf_cv_fixup_sigwinch=$cf_sigwinch
6865          break])
6866
6867 cf_sigwinch=`expr $cf_sigwinch - 1`
6868 done
6869 ])
6870
6871         if test "$cf_cv_fixup_sigwinch" != unknown ; then
6872                 CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
6873         fi
6874 fi
6875 ])dnl
6876 dnl ---------------------------------------------------------------------------
6877 dnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20
6878 dnl ---------------
6879 dnl signal handler, but there are some gcc depedencies in that recommendation.
6880 dnl Try anyway.
6881 AC_DEFUN([CF_SIG_ATOMIC_T],
6882 [
6883 AC_MSG_CHECKING(for signal global datatype)
6884 AC_CACHE_VAL(cf_cv_sig_atomic_t,[
6885         for cf_type in \
6886                 "volatile sig_atomic_t" \
6887                 "sig_atomic_t" \
6888                 "int"
6889         do
6890         AC_TRY_COMPILE([
6891 #include <sys/types.h>
6892 #include <signal.h>
6893 #include <stdio.h>
6894
6895 extern $cf_type x;
6896 $cf_type x;
6897 static void handler(int sig)
6898 {
6899         x = 5;
6900 }],
6901                 [signal(SIGINT, handler);
6902                  x = 1],
6903                 [cf_cv_sig_atomic_t=$cf_type],
6904                 [cf_cv_sig_atomic_t=no])
6905                 test "$cf_cv_sig_atomic_t" != no && break
6906         done
6907         ])
6908 AC_MSG_RESULT($cf_cv_sig_atomic_t)
6909 test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype])
6910 ])dnl
6911 dnl ---------------------------------------------------------------------------
6912 dnl CF_SIZECHANGE version: 14 updated: 2018/06/20 20:23:13
6913 dnl -------------
6914 dnl Check for definitions & structures needed for window size-changing
6915 dnl
6916 dnl https://stackoverflow.com/questions/18878141/difference-between-structures-ttysize-and-winsize/50769952#50769952
6917 AC_DEFUN([CF_SIZECHANGE],
6918 [
6919 AC_REQUIRE([CF_STRUCT_TERMIOS])
6920 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
6921         cf_cv_sizechange=unknown
6922         cf_save_CPPFLAGS="$CPPFLAGS"
6923
6924 for cf_opts in "" "NEED_PTEM_H"
6925 do
6926
6927         CPPFLAGS="$cf_save_CPPFLAGS"
6928         if test -n "$cf_opts"
6929         then
6930                 CF_APPEND_TEXT(CPPFLAGS,-D$cf_opts)
6931         fi
6932         AC_TRY_COMPILE([#include <sys/types.h>
6933 #ifdef HAVE_TERMIOS_H
6934 #include <termios.h>
6935 #else
6936 #ifdef HAVE_TERMIO_H
6937 #include <termio.h>
6938 #endif
6939 #endif
6940
6941 #ifdef NEED_PTEM_H
6942 /* This is a workaround for SCO:  they neglected to define struct winsize in
6943  * termios.h -- it's only in termio.h and ptem.h
6944  */
6945 #include <sys/stream.h>
6946 #include <sys/ptem.h>
6947 #endif
6948
6949 #ifdef HAVE_SYS_IOCTL_H
6950 #include <sys/ioctl.h>
6951 #endif
6952 ],[
6953 #ifdef TIOCGSIZE
6954         struct ttysize win;     /* SunOS 3.0... */
6955         int y = win.ts_lines;
6956         int x = win.ts_cols;
6957 #else
6958 #ifdef TIOCGWINSZ
6959         struct winsize win;     /* everything else */
6960         int y = win.ws_row;
6961         int x = win.ws_col;
6962 #else
6963         no TIOCGSIZE or TIOCGWINSZ
6964 #endif /* TIOCGWINSZ */
6965 #endif /* TIOCGSIZE */
6966         ],
6967         [cf_cv_sizechange=yes],
6968         [cf_cv_sizechange=no])
6969
6970         CPPFLAGS="$cf_save_CPPFLAGS"
6971         if test "$cf_cv_sizechange" = yes ; then
6972                 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
6973                 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
6974                 break
6975         fi
6976 done
6977 ])
6978 if test "$cf_cv_sizechange" != no ; then
6979         AC_DEFINE(HAVE_SIZECHANGE,1,[Define to 1 if sizechange declarations are provided])
6980         case $cf_cv_sizechange in
6981         (NEED*)
6982                 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
6983                 ;;
6984         esac
6985 fi
6986 ])dnl
6987 dnl ---------------------------------------------------------------------------
6988 dnl CF_SRC_MODULES version: 30 updated: 2017/07/26 17:08:35
6989 dnl --------------
6990 dnl For each parameter, test if the source-directory exists, and if it contains
6991 dnl a 'modules' file.  If so, add to the list $cf_cv_src_modules which we'll
6992 dnl use in CF_LIB_RULES.
6993 dnl
6994 dnl This uses the configured value to make the lists SRC_SUBDIRS and
6995 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
6996 AC_DEFUN([CF_SRC_MODULES],
6997 [
6998 AC_MSG_CHECKING(for src modules)
6999
7000 # dependencies and linker-arguments for test-programs
7001 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
7002 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2"
7003 if test "$DFT_LWR_MODEL" = "libtool"; then
7004         TEST_ARGS="${TEST_DEPS}"
7005         TEST_ARG2="${TEST_DEP2}"
7006 else
7007         TEST_ARGS="-l${LIB_NAME}${USE_ARG_SUFFIX} $TEST_ARGS"
7008         TEST_ARG2="-l${LIB_NAME}${USE_ARG_SUFFIX} $TEST_ARG2"
7009 fi
7010
7011 PC_MODULES_TO_MAKE="ncurses${USE_ARG_SUFFIX}"
7012 cf_cv_src_modules=
7013 for cf_dir in $1
7014 do
7015         if test -f $srcdir/$cf_dir/modules; then
7016
7017                 # We may/may not have tack in the distribution, though the
7018                 # makefile is.
7019                 if test $cf_dir = tack ; then
7020                         if test "x$cf_with_tack" != "xyes"; then
7021                                 continue
7022                         fi
7023                 fi
7024
7025                 if test -z "$cf_cv_src_modules"; then
7026                         cf_cv_src_modules=$cf_dir
7027                 else
7028                         cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
7029                 fi
7030
7031                 # Make the ncurses_cfg.h file record the library interface files as
7032                 # well.  These are header files that are the same name as their
7033                 # directory.  Ncurses is the only library that does not follow
7034                 # that pattern.
7035                 if test $cf_dir = tack ; then
7036                         continue
7037                 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
7038                         CF_UPPER(cf_have_include,$cf_dir)
7039                         AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
7040                         AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
7041                         TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
7042                         TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2"
7043                         if test "$DFT_LWR_MODEL" = "libtool"; then
7044                                 TEST_ARGS="${TEST_DEPS}"
7045                                 TEST_ARG2="${TEST_DEP2}"
7046                         else
7047                                 TEST_ARGS="-l${cf_dir}${USE_ARG_SUFFIX} $TEST_ARGS"
7048                                 TEST_ARG2="-l${cf_dir}${USE_ARG_SUFFIX} $TEST_ARG2"
7049                         fi
7050                         PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ${cf_dir}${USE_ARG_SUFFIX}"
7051                 fi
7052         fi
7053 done
7054 AC_MSG_RESULT($cf_cv_src_modules)
7055
7056 TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
7057 TEST_ARG2="-L${LIB_2ND} $TEST_ARG2"
7058
7059 AC_SUBST(TEST_ARGS)
7060 AC_SUBST(TEST_DEPS)
7061
7062 AC_SUBST(TEST_ARG2)
7063 AC_SUBST(TEST_DEP2)
7064
7065 SRC_SUBDIRS=
7066 if test "x$cf_with_manpages" != xno ; then
7067         SRC_SUBDIRS="$SRC_SUBDIRS man"
7068 fi
7069 SRC_SUBDIRS="$SRC_SUBDIRS include"
7070 for cf_dir in $cf_cv_src_modules
7071 do
7072         SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
7073 done
7074 if test "x$cf_with_tests" != "xno" ; then
7075         SRC_SUBDIRS="$SRC_SUBDIRS test"
7076 fi
7077 # always make this, to install the ncurses-config script
7078 SRC_SUBDIRS="$SRC_SUBDIRS misc"
7079 if test "$cf_with_cxx_binding" != no; then
7080         PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ncurses++${USE_ARG_SUFFIX}"
7081         SRC_SUBDIRS="$SRC_SUBDIRS c++"
7082 fi
7083
7084 test "x$with_termlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TINFO_ARG_SUFFIX"
7085 test "x$with_ticlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TICS_ARG_SUFFIX"
7086
7087 AC_SUBST(PC_MODULES_TO_MAKE)
7088
7089 ADA_SUBDIRS=
7090 if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = xyes && test -f $srcdir/Ada95/Makefile.in; then
7091         SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
7092         ADA_SUBDIRS="gen src"
7093         if test "x$cf_with_tests" != "xno" ; then
7094                 ADA_SUBDIRS="$ADA_SUBDIRS samples"
7095         fi
7096 fi
7097
7098 SUB_MAKEFILES=
7099 for cf_dir in $SRC_SUBDIRS
7100 do
7101         SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
7102 done
7103
7104 if test -n "$ADA_SUBDIRS"; then
7105         for cf_dir in $ADA_SUBDIRS
7106         do
7107                 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
7108         done
7109         AC_SUBST(ADA_SUBDIRS)
7110 fi
7111 ])dnl
7112 dnl ---------------------------------------------------------------------------
7113 dnl CF_STDCPP_LIBRARY version: 11 updated: 2015/10/17 19:03:33
7114 dnl -----------------
7115 dnl Check for -lstdc++, which is GNU's standard C++ library.
7116 dnl If $CXXLIBS is set, add that to the libraries used for test-linking.
7117 dnl If -lstdc++ was not already added to $LIBS or $CXXLIBS, and is needed,
7118 dnl add it to $CXXLIBS.
7119 AC_DEFUN([CF_STDCPP_LIBRARY],
7120 [
7121 if test -n "$GXX" ; then
7122
7123         cf_save="$LIBS"
7124         LIBS="$LIBS $CXXLIBS"
7125         AC_MSG_CHECKING(if we already have C++ library)
7126         AC_TRY_LINK([
7127                         #include <iostream>],[
7128                         std::cout << "Hello World!" << std::endl;],
7129                 [cf_have_libstdcpp=yes],
7130                 [cf_have_libstdcpp=no])
7131         AC_MSG_RESULT($cf_have_libstdcpp)
7132         LIBS="$cf_save"
7133
7134         if test $cf_have_libstdcpp != yes
7135         then
7136                 case $cf_cv_system_name in
7137                 (os2*)
7138                         if test -z "`g++ -dM -E - < /dev/null | grep __KLIBC__`"; then
7139                                 cf_stdcpp_libname=stdcpp
7140                         else
7141                                 cf_stdcpp_libname=stdc++
7142                         fi
7143                         ;;
7144                 (*)
7145                         cf_stdcpp_libname=stdc++
7146                         ;;
7147                 esac
7148
7149                 AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
7150                         cf_save="$LIBS"
7151                         LIBS="$LIBS $CXXLIBS"
7152                         CF_ADD_LIB($cf_stdcpp_libname)
7153                 AC_TRY_LINK([
7154                                 #include <iostream>],[
7155                                 std::cout << "Hello World!" << std::endl;],
7156                         [cf_cv_libstdcpp=yes],
7157                         [cf_cv_libstdcpp=no])
7158                         LIBS="$cf_save"
7159                 ])
7160                 test "$cf_cv_libstdcpp" = yes && { CF_ADD_LIB($cf_stdcpp_libname,CXXLIBS) }
7161         fi
7162 fi
7163 ])dnl
7164 dnl ---------------------------------------------------------------------------
7165 dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
7166 dnl --------------
7167 dnl     Remove "-g" option from the compiler options
7168 AC_DEFUN([CF_STRIP_G_OPT],
7169 [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
7170 dnl ---------------------------------------------------------------------------
7171 dnl CF_STRUCT_SIGACTION version: 5 updated: 2012/10/06 17:56:13
7172 dnl -------------------
7173 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction.  We'll only
7174 dnl do this if we've found the sigaction function.
7175 AC_DEFUN([CF_STRUCT_SIGACTION],[
7176 AC_REQUIRE([CF_XOPEN_SOURCE])
7177
7178 if test "$ac_cv_func_sigaction" = yes; then
7179 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
7180 AC_TRY_COMPILE([
7181 #include <sys/types.h>
7182 #include <signal.h>],
7183         [struct sigaction act],
7184         [sigact_bad=no],
7185         [
7186 AC_TRY_COMPILE([
7187 #define _POSIX_SOURCE
7188 #include <sys/types.h>
7189 #include <signal.h>],
7190         [struct sigaction act],
7191         [sigact_bad=yes
7192          AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE])],
7193          [sigact_bad=unknown])])
7194 AC_MSG_RESULT($sigact_bad)
7195 fi
7196 ])dnl
7197 dnl ---------------------------------------------------------------------------
7198 dnl CF_STRUCT_TERMIOS version: 9 updated: 2018/06/08 21:57:23
7199 dnl -----------------
7200 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
7201 AC_DEFUN([CF_STRUCT_TERMIOS],[
7202 AC_REQUIRE([CF_XOPEN_SOURCE])
7203
7204 AC_CHECK_HEADERS( \
7205 termio.h \
7206 termios.h \
7207 unistd.h \
7208 sys/ioctl.h \
7209 sys/termio.h \
7210 )
7211
7212 if test "$ac_cv_header_termios_h" = yes ; then
7213         case "$CFLAGS $CPPFLAGS" in
7214         (*-D_POSIX_SOURCE*)
7215                 termios_bad=dunno ;;
7216         (*)     termios_bad=maybe ;;
7217         esac
7218         if test "$termios_bad" = maybe ; then
7219         AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
7220         AC_TRY_COMPILE([#include <termios.h>],
7221                 [struct termios foo; int x = foo.c_iflag],
7222                 termios_bad=no, [
7223                 AC_TRY_COMPILE([
7224 #define _POSIX_SOURCE
7225 #include <termios.h>],
7226                         [struct termios foo; int x = foo.c_iflag],
7227                         termios_bad=unknown,
7228                         termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE]))
7229                         ])
7230         AC_MSG_RESULT($termios_bad)
7231         fi
7232 fi
7233 ])dnl
7234 dnl ---------------------------------------------------------------------------
7235 dnl CF_SUBDIR_PATH version: 7 updated: 2014/12/04 04:33:06
7236 dnl --------------
7237 dnl Construct a search-list for a nonstandard header/lib-file
7238 dnl     $1 = the variable to return as result
7239 dnl     $2 = the package name
7240 dnl     $3 = the subdirectory, e.g., bin, include or lib
7241 AC_DEFUN([CF_SUBDIR_PATH],
7242 [
7243 $1=
7244
7245 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
7246
7247 for cf_subdir_prefix in \
7248         /usr \
7249         /usr/local \
7250         /usr/pkg \
7251         /opt \
7252         /opt/local \
7253         [$]HOME
7254 do
7255         CF_ADD_SUBDIR_PATH($1,$2,$3,$cf_subdir_prefix,$prefix)
7256 done
7257 ])dnl
7258 dnl ---------------------------------------------------------------------------
7259 dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03
7260 dnl -----------
7261 dnl     Shorthand macro for substituting things that the user may override
7262 dnl     with an environment variable.
7263 dnl
7264 dnl     $1 = condition to pass to "test"
7265 dnl     $2 = environment variable
7266 dnl     $3 = value if the test succeeds
7267 dnl     $4 = value if the test fails
7268 AC_DEFUN([CF_SUBST_IF],
7269 [
7270 if test $1 ; then
7271         $2=$3
7272 ifelse($4,,,[else
7273         $2=$4])
7274 fi
7275 AC_SUBST($2)
7276 ])dnl
7277 dnl ---------------------------------------------------------------------------
7278 dnl CF_SUBST_NCURSES_VERSION version: 8 updated: 2006/09/16 11:40:59
7279 dnl ------------------------
7280 dnl Get the version-number for use in shared-library naming, etc.
7281 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
7282 [
7283 AC_REQUIRE([CF_PROG_EGREP])
7284 NCURSES_MAJOR="`$ac_cv_prog_egrep '^NCURSES_MAJOR[[     ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
7285 NCURSES_MINOR="`$ac_cv_prog_egrep '^NCURSES_MINOR[[     ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
7286 NCURSES_PATCH="`$ac_cv_prog_egrep '^NCURSES_PATCH[[     ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
7287 cf_cv_abi_version=${NCURSES_MAJOR}
7288 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
7289 dnl Show the computed version, for logging
7290 cf_cv_timestamp=`date`
7291 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
7292 dnl We need these values in the generated headers
7293 AC_SUBST(NCURSES_MAJOR)
7294 AC_SUBST(NCURSES_MINOR)
7295 AC_SUBST(NCURSES_PATCH)
7296 dnl We need these values in the generated makefiles
7297 AC_SUBST(cf_cv_rel_version)
7298 AC_SUBST(cf_cv_abi_version)
7299 AC_SUBST(cf_cv_builtin_bool)
7300 AC_SUBST(cf_cv_header_stdbool_h)
7301 AC_SUBST(cf_cv_type_of_bool)dnl
7302 ])dnl
7303 dnl ---------------------------------------------------------------------------
7304 dnl CF_SYS_TIME_SELECT version: 6 updated: 2015/04/18 08:56:57
7305 dnl ------------------
7306 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
7307 dnl older SCO configurations.
7308 AC_DEFUN([CF_SYS_TIME_SELECT],
7309 [
7310 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
7311 AC_CACHE_VAL(cf_cv_sys_time_select,[
7312 AC_TRY_COMPILE([
7313 #include <sys/types.h>
7314 #ifdef HAVE_SYS_TIME_H
7315 #include <sys/time.h>
7316 #endif
7317 #ifdef HAVE_SYS_SELECT_H
7318 #include <sys/select.h>
7319 #endif
7320 ],[],[cf_cv_sys_time_select=yes],
7321          [cf_cv_sys_time_select=no])
7322          ])
7323 AC_MSG_RESULT($cf_cv_sys_time_select)
7324 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT,1,[Define to 1 if we can include <sys/time.h> with <sys/select.h>])
7325 ])dnl
7326 dnl ---------------------------------------------------------------------------
7327 dnl CF_TOP_BUILDDIR version: 2 updated: 2013/07/27 17:38:32
7328 dnl ---------------
7329 dnl Define a top_builddir symbol, for applications that need an absolute path.
7330 AC_DEFUN([CF_TOP_BUILDDIR],
7331 [
7332 top_builddir=ifelse($1,,`pwd`,$1)
7333 AC_SUBST(top_builddir)
7334 ])dnl
7335 dnl ---------------------------------------------------------------------------
7336 dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06
7337 dnl -----------------
7338 dnl This is a simple wrapper to use for pkg-config, for libraries which may be
7339 dnl available in that form.
7340 dnl
7341 dnl $1 = package name
7342 dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS
7343 dnl $3 = logic to use if pkg-config does not have the package
7344 AC_DEFUN([CF_TRY_PKG_CONFIG],[
7345 AC_REQUIRE([CF_PKG_CONFIG])
7346
7347 if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then
7348         CF_VERBOSE(found package $1)
7349         cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`"
7350         cf_pkgconfig_libs="`$PKG_CONFIG --libs   $1 2>/dev/null`"
7351         CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs)
7352         CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs)
7353         CF_ADD_CFLAGS($cf_pkgconfig_incs)
7354         CF_ADD_LIBS($cf_pkgconfig_libs)
7355         ifelse([$2],,:,[$2])
7356 else
7357         cf_pkgconfig_incs=
7358         cf_pkgconfig_libs=
7359         ifelse([$3],,:,[$3])
7360 fi
7361 ])
7362 dnl ---------------------------------------------------------------------------
7363 dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13
7364 dnl -------------------
7365 dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
7366 dnl can define it successfully.
7367 AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
7368 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
7369         AC_TRY_COMPILE([
7370 #include <stdlib.h>
7371 #include <string.h>
7372 #include <sys/types.h>
7373 ],[
7374 #ifndef _XOPEN_SOURCE
7375 make an error
7376 #endif],
7377         [cf_cv_xopen_source=no],
7378         [cf_save="$CPPFLAGS"
7379          CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE)
7380          AC_TRY_COMPILE([
7381 #include <stdlib.h>
7382 #include <string.h>
7383 #include <sys/types.h>
7384 ],[
7385 #ifdef _XOPEN_SOURCE
7386 make an error
7387 #endif],
7388         [cf_cv_xopen_source=no],
7389         [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
7390         CPPFLAGS="$cf_save"
7391         ])
7392 ])
7393
7394 if test "$cf_cv_xopen_source" != no ; then
7395         CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
7396         CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
7397         cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
7398         CF_ADD_CFLAGS($cf_temp_xopen_source)
7399 fi
7400 ])
7401 dnl ---------------------------------------------------------------------------
7402 dnl CF_TYPEOF_CHTYPE version: 10 updated: 2017/01/21 11:06:25
7403 dnl ----------------
7404 dnl Determine the type we should use for chtype (and attr_t, which is treated
7405 dnl as the same thing).  We want around 32 bits, so on most machines want a
7406 dnl long, but on newer 64-bit machines, probably want an int.  If we're using
7407 dnl wide characters, we have to have a type compatible with that, as well.
7408 AC_DEFUN([CF_TYPEOF_CHTYPE],
7409 [
7410 AC_MSG_CHECKING([for type of chtype])
7411 AC_CACHE_VAL(cf_cv_typeof_chtype,[
7412                 AC_TRY_RUN([
7413 #define WANT_BITS 31
7414 #include <stdio.h>
7415 int main(void)
7416 {
7417         FILE *fp = fopen("cf_test.out", "w");
7418         if (fp != 0) {
7419                 char *result = "long";
7420                 if (sizeof(unsigned long) > sizeof(unsigned int)) {
7421                         int n;
7422                         unsigned int x, y;
7423                         for (n = 0; n < WANT_BITS; n++) {
7424                                 x = (1 << n);
7425                                 y = (x >> n);
7426                                 if (y != 1 || x == 0) {
7427                                         x = 0;
7428                                         break;
7429                                 }
7430                         }
7431                         /*
7432                          * If x is nonzero, an int is big enough for the bits
7433                          * that we want.
7434                          */
7435                         result = (x != 0) ? "int" : "long";
7436                 }
7437                 fputs(result, fp);
7438                 fclose(fp);
7439         }
7440         ${cf_cv_main_return:-return}(0);
7441 }
7442                 ],
7443                 [cf_cv_typeof_chtype=`cat cf_test.out`],
7444                 [cf_cv_typeof_chtype=long],
7445                 [cf_cv_typeof_chtype=long])
7446                 rm -f cf_test.out
7447         ])
7448 AC_MSG_RESULT($cf_cv_typeof_chtype)
7449
7450 AC_SUBST(cf_cv_typeof_chtype)
7451 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype,[Define to actual type if needed for chtype])
7452 ])dnl
7453 dnl ---------------------------------------------------------------------------
7454 dnl CF_TYPE_SIGACTION version: 4 updated: 2012/10/06 17:56:13
7455 dnl -----------------
7456 dnl
7457 AC_DEFUN([CF_TYPE_SIGACTION],
7458 [
7459 AC_MSG_CHECKING([for type sigaction_t])
7460 AC_CACHE_VAL(cf_cv_type_sigaction,[
7461         AC_TRY_COMPILE([
7462 #include <signal.h>],
7463                 [sigaction_t x],
7464                 [cf_cv_type_sigaction=yes],
7465                 [cf_cv_type_sigaction=no])])
7466 AC_MSG_RESULT($cf_cv_type_sigaction)
7467 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION,1,[Define to 1 if we have the sigaction_t type])
7468 ])dnl
7469 dnl ---------------------------------------------------------------------------
7470 dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
7471 dnl --------------------
7472 dnl Test if the compiler supports 'U' and 'L' suffixes.  Only old compilers
7473 dnl won't, but they're still there.
7474 AC_DEFUN([CF_UNSIGNED_LITERALS],
7475 [
7476 AC_MSG_CHECKING([if unsigned literals are legal])
7477 AC_CACHE_VAL(cf_cv_unsigned_literals,[
7478         AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
7479                 [cf_cv_unsigned_literals=yes],
7480                 [cf_cv_unsigned_literals=no])
7481         ])
7482 AC_MSG_RESULT($cf_cv_unsigned_literals)
7483 ])dnl
7484 dnl ---------------------------------------------------------------------------
7485 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
7486 dnl --------
7487 dnl Make an uppercase version of a variable
7488 dnl $1=uppercase($2)
7489 AC_DEFUN([CF_UPPER],
7490 [
7491 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
7492 ])dnl
7493 dnl ---------------------------------------------------------------------------
7494 dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
7495 dnl -----------
7496 dnl Check for multibyte support, and if not found, utf8 compatibility library
7497 AC_DEFUN([CF_UTF8_LIB],
7498 [
7499 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
7500         cf_save_LIBS="$LIBS"
7501         AC_TRY_LINK([
7502 #include <stdlib.h>],[putwc(0,0);],
7503         [cf_cv_utf8_lib=yes],
7504         [CF_FIND_LINKAGE([
7505 #include <libutf8.h>],[putwc(0,0);],utf8,
7506                 [cf_cv_utf8_lib=add-on],
7507                 [cf_cv_utf8_lib=no])
7508 ])])
7509
7510 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
7511 # ncurses/ncursesw:
7512 if test "$cf_cv_utf8_lib" = "add-on" ; then
7513         AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
7514         CF_ADD_INCDIR($cf_cv_header_path_utf8)
7515         CF_ADD_LIBDIR($cf_cv_library_path_utf8)
7516         CF_ADD_LIBS($cf_cv_library_file_utf8)
7517 fi
7518 ])dnl
7519 dnl ---------------------------------------------------------------------------
7520 dnl CF_VA_COPY version: 6 updated: 2018/12/04 18:14:25
7521 dnl ----------
7522 dnl check for va_copy, part of stdarg.h starting with ISO C 1999.
7523 dnl Also, workaround for glibc's __va_copy, by checking for both.
7524 dnl Finally, try to accommodate pre-ISO C 1999 headers.
7525 AC_DEFUN([CF_VA_COPY],[
7526 AC_CACHE_CHECK(for va_copy, cf_cv_have_va_copy,[
7527 AC_TRY_LINK([
7528 #include <stdarg.h>
7529 ],[
7530         static va_list dst;
7531         static va_list src;
7532         va_copy(dst, src)],
7533         cf_cv_have_va_copy=yes,
7534         cf_cv_have_va_copy=no)])
7535
7536 if test "$cf_cv_have_va_copy" = yes;
7537 then
7538         AC_DEFINE(HAVE_VA_COPY,1,[Define to 1 if we have va_copy])
7539 else # !cf_cv_have_va_copy
7540
7541 AC_CACHE_CHECK(for __va_copy, cf_cv_have___va_copy,[
7542 AC_TRY_LINK([
7543 #include <stdarg.h>
7544 ],[
7545         static va_list dst;
7546         static va_list src;
7547         __va_copy(dst, src)],
7548         cf_cv_have___va_copy=yes,
7549         cf_cv_have___va_copy=no)])
7550
7551 if test "$cf_cv_have___va_copy" = yes
7552 then
7553         AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if we have __va_copy])
7554 else # !cf_cv_have___va_copy
7555
7556 AC_CACHE_CHECK(for __builtin_va_copy, cf_cv_have___builtin_va_copy,[
7557 AC_TRY_LINK([
7558 #include <stdarg.h>
7559 ],[
7560         static va_list dst;
7561         static va_list src;
7562         __builtin_va_copy(dst, src)],
7563         cf_cv_have___builtin_va_copy=yes,
7564         cf_cv_have___builtin_va_copy=no)])
7565
7566 test "$cf_cv_have___builtin_va_copy" = yes &&
7567         AC_DEFINE(HAVE___BUILTIN_VA_COPY,1,[Define to 1 if we have __builtin_va_copy])
7568
7569 fi # cf_cv_have___va_copy
7570
7571 fi # cf_cv_have_va_copy
7572
7573 case "${cf_cv_have_va_copy}${cf_cv_have___va_copy}${cf_cv_have___builtin_va_copy}" in
7574 (*yes*)
7575         ;;
7576
7577 (*)
7578         AC_CACHE_CHECK(if we can simply copy va_list, cf_cv_pointer_va_list,[
7579 AC_TRY_LINK([
7580 #include <stdarg.h>
7581 ],[
7582         va_list dst;
7583         va_list src;
7584         dst = src],
7585         cf_cv_pointer_va_list=yes,
7586         cf_cv_pointer_va_list=no)])
7587
7588         if test "$cf_cv_pointer_va_list" = no
7589         then
7590                 AC_CACHE_CHECK(if we can copy va_list indirectly, cf_cv_array_va_list,[
7591 AC_TRY_LINK([
7592 #include <stdarg.h>
7593 ],[
7594         va_list dst;
7595         va_list src;
7596         *dst = *src],
7597                         cf_cv_array_va_list=yes,
7598                         cf_cv_array_va_list=no)])
7599                 test "$cf_cv_array_va_list" = yes && AC_DEFINE(ARRAY_VA_LIST,1,[Define to 1 if we can copy va_list indirectly])
7600         fi
7601         ;;
7602 esac
7603 ])
7604 dnl ---------------------------------------------------------------------------
7605 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
7606 dnl ----------
7607 dnl Use AC_VERBOSE w/o the warnings
7608 AC_DEFUN([CF_VERBOSE],
7609 [test -n "$verbose" && echo "   $1" 1>&AC_FD_MSG
7610 CF_MSG_LOG([$1])
7611 ])dnl
7612 dnl ---------------------------------------------------------------------------
7613 dnl CF_VERSION_INFO version: 7 updated: 2015/04/17 21:13:04
7614 dnl ---------------
7615 dnl Define several useful symbols derived from the VERSION file.  A separate
7616 dnl file is preferred to embedding the version numbers in various scripts.
7617 dnl (automake is a textbook-example of why the latter is a bad idea, but there
7618 dnl are others).
7619 dnl
7620 dnl The file contents are:
7621 dnl     libtool-version release-version patch-version
7622 dnl or
7623 dnl     release-version
7624 dnl where
7625 dnl     libtool-version (see ?) consists of 3 integers separated by '.'
7626 dnl     release-version consists of a major version and minor version
7627 dnl             separated by '.', optionally followed by a patch-version
7628 dnl             separated by '-'.  The minor version need not be an
7629 dnl             integer (but it is preferred).
7630 dnl     patch-version is an integer in the form yyyymmdd, so ifdef's and
7631 dnl             scripts can easily compare versions.
7632 dnl
7633 dnl If libtool is used, the first form is required, since CF_WITH_LIBTOOL
7634 dnl simply extracts the first field using 'cut -f1'.
7635 dnl
7636 dnl Optional parameters:
7637 dnl $1 = internal name for package
7638 dnl $2 = external name for package
7639 AC_DEFUN([CF_VERSION_INFO],
7640 [
7641 if test -f $srcdir/VERSION ; then
7642         AC_MSG_CHECKING(for package version)
7643
7644         # if there are not enough fields, cut returns the last one...
7645         cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
7646         cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2`
7647         cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3`
7648
7649         # this is how CF_BUNDLED_INTL uses $VERSION:
7650         VERSION="$cf_field1"
7651
7652         VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'`
7653         test -z "$VERSION_MAJOR" && AC_MSG_ERROR(missing major-version)
7654
7655         VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[[^.]]*\.//' -e 's/-.*//'`
7656         test -z "$VERSION_MINOR" && AC_MSG_ERROR(missing minor-version)
7657
7658         AC_MSG_RESULT(${VERSION_MAJOR}.${VERSION_MINOR})
7659
7660         AC_MSG_CHECKING(for package patch date)
7661         VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[[^-]]*-//'`
7662         case .$VERSION_PATCH in
7663         (.)
7664                 AC_MSG_ERROR(missing patch-date $VERSION_PATCH)
7665                 ;;
7666         (.[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]])
7667                 ;;
7668         (*)
7669                 AC_MSG_ERROR(illegal patch-date $VERSION_PATCH)
7670                 ;;
7671         esac
7672         AC_MSG_RESULT($VERSION_PATCH)
7673 else
7674         AC_MSG_ERROR(did not find $srcdir/VERSION)
7675 fi
7676
7677 # show the actual data that we have for versions:
7678 CF_VERBOSE(ABI VERSION $VERSION)
7679 CF_VERBOSE(VERSION_MAJOR $VERSION_MAJOR)
7680 CF_VERBOSE(VERSION_MINOR $VERSION_MINOR)
7681 CF_VERBOSE(VERSION_PATCH $VERSION_PATCH)
7682
7683 AC_SUBST(VERSION)
7684 AC_SUBST(VERSION_MAJOR)
7685 AC_SUBST(VERSION_MINOR)
7686 AC_SUBST(VERSION_PATCH)
7687
7688 dnl if a package name is given, define its corresponding version info.  We
7689 dnl need the package name to ensure that the defined symbols are unique.
7690 ifelse($1,,,[
7691         cf_PACKAGE=$1
7692         PACKAGE=ifelse($2,,$1,$2)
7693         AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",[Define to the package-name])
7694         AC_SUBST(PACKAGE)
7695         CF_UPPER(cf_PACKAGE,$cf_PACKAGE)
7696         AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}")
7697         AC_DEFINE_UNQUOTED(${cf_PACKAGE}_PATCHDATE,${VERSION_PATCH})
7698 ])
7699 ])dnl
7700 dnl ---------------------------------------------------------------------------
7701 dnl CF_WCHAR_TYPE version: 4 updated: 2012/10/06 16:39:58
7702 dnl -------------
7703 dnl Check if type wide-character type $1 is declared, and if so, which header
7704 dnl file is needed.  The second parameter is used to set a shell variable when
7705 dnl the type is not found.  The first parameter sets a shell variable for the
7706 dnl opposite sense.
7707 AC_DEFUN([CF_WCHAR_TYPE],
7708 [
7709 # This is needed on Tru64 5.0 to declare $1
7710 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
7711 AC_TRY_COMPILE([
7712 #include <stdlib.h>
7713 #include <stdarg.h>
7714 #include <stdio.h>
7715 #ifdef HAVE_LIBUTF8_H
7716 #include <libutf8.h>
7717 #endif],
7718         [$1 state],
7719         [cf_cv_$1=no],
7720         [AC_TRY_COMPILE([
7721 #include <stdlib.h>
7722 #include <stdarg.h>
7723 #include <stdio.h>
7724 #include <wchar.h>
7725 #ifdef HAVE_LIBUTF8_H
7726 #include <libutf8.h>
7727 #endif],
7728         [$1 value],
7729         [cf_cv_$1=yes],
7730         [cf_cv_$1=unknown])])])
7731
7732 if test "$cf_cv_$1" = yes ; then
7733         AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
7734         NEED_WCHAR_H=1
7735 fi
7736
7737 ifelse([$2],,,[
7738 # if we do not find $1 in either place, use substitution to provide a fallback.
7739 if test "$cf_cv_$1" = unknown ; then
7740         $2=1
7741 fi
7742 ])
7743 ifelse($3,,,[
7744 # if we find $1 in either place, use substitution to provide a fallback.
7745 if test "$cf_cv_$1" != unknown ; then
7746         $3=1
7747 fi
7748 ])
7749 ])dnl
7750 dnl ---------------------------------------------------------------------------
7751 dnl CF_WEAK_SYMBOLS version: 1 updated: 2008/08/16 19:18:06
7752 dnl ---------------
7753 dnl Check for compiler-support for weak symbols.
7754 dnl This works with "recent" gcc.
7755 AC_DEFUN([CF_WEAK_SYMBOLS],[
7756 AC_CACHE_CHECK(if $CC supports weak symbols,cf_cv_weak_symbols,[
7757
7758 AC_TRY_COMPILE([
7759 #include <stdio.h>],
7760 [
7761 #if defined(__GNUC__)
7762 #  if defined __USE_ISOC99
7763 #    define _cat_pragma(exp)    _Pragma(#exp)
7764 #    define _weak_pragma(exp)   _cat_pragma(weak name)
7765 #  else
7766 #    define _weak_pragma(exp)
7767 #  endif
7768 #  define _declare(name)        __extension__ extern __typeof__(name) name
7769 #  define weak_symbol(name)     _weak_pragma(name) _declare(name) __attribute__((weak))
7770 #endif
7771
7772 weak_symbol(fopen);
7773 ],[cf_cv_weak_symbols=yes],[cf_cv_weak_symbols=no])
7774 ])
7775 ])dnl
7776 dnl ---------------------------------------------------------------------------
7777 dnl CF_WITH_ABI_VERSION version: 3 updated: 2015/06/06 16:10:11
7778 dnl -------------------
7779 dnl Allow library's ABI to be overridden.  Generally this happens when a
7780 dnl packager has incremented the ABI past that used in the original package,
7781 dnl and wishes to keep doing this.
7782 dnl
7783 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
7784 dnl symbol.
7785 AC_DEFUN([CF_WITH_ABI_VERSION],[
7786 test -z "$cf_cv_abi_version" && cf_cv_abi_version=0
7787 AC_ARG_WITH(abi-version,
7788 [  --with-abi-version=XXX  override derived ABI version],[
7789         if test "x$cf_cv_abi_version" != "x$withval"
7790         then
7791                 AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval)
7792                 case $cf_cv_rel_version in
7793                 (5.*)
7794                         cf_cv_rel_version=$withval.0
7795                         ;;
7796                 (6.*)
7797                         cf_cv_rel_version=$withval.9    # FIXME: should be 10 as of 6.0 release
7798                         ;;
7799                 esac
7800         fi
7801         cf_cv_abi_version=$withval])
7802         CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version)
7803 ifelse($1,,,[
7804 $1_ABI=$cf_cv_abi_version
7805 ])
7806 ])dnl
7807 dnl ---------------------------------------------------------------------------
7808 dnl CF_WITH_ADA_COMPILER version: 2 updated: 2010/06/26 17:35:58
7809 dnl --------------------
7810 dnl Command-line option to specify the Ada95 compiler.
7811 AC_DEFUN([CF_WITH_ADA_COMPILER],[
7812 AC_MSG_CHECKING(for ada-compiler)
7813 AC_ARG_WITH(ada-compiler,
7814         [  --with-ada-compiler=CMD specify Ada95 compiler command (default gnatmake)],
7815         [cf_ada_compiler=$withval],
7816         [cf_ada_compiler=gnatmake])
7817 AC_SUBST(cf_ada_compiler)
7818 AC_MSG_RESULT($cf_ada_compiler)
7819 ])dnl
7820 dnl ---------------------------------------------------------------------------
7821 dnl CF_WITH_ADA_INCLUDE version: 2 updated: 2010/06/26 17:35:58
7822 dnl -------------------
7823 dnl Command-line option to specify where Ada includes will install.
7824 AC_DEFUN([CF_WITH_ADA_INCLUDE],[
7825 AC_MSG_CHECKING(for ada-include)
7826 CF_WITH_PATH(ada-include,
7827    [  --with-ada-include=DIR  Ada includes are in DIR],
7828    ADA_INCLUDE,
7829    PREFIX/share/ada/adainclude,
7830    [$]prefix/share/ada/adainclude)
7831 AC_SUBST(ADA_INCLUDE)
7832 AC_MSG_RESULT($ADA_INCLUDE)
7833 ])dnl
7834 dnl ---------------------------------------------------------------------------
7835 dnl CF_WITH_ADA_LIBNAME version: 1 updated: 2019/09/07 18:59:41
7836 dnl -------------------
7837 dnl CF_WITH_ADA_LIBNAME
7838 dnl -------------------
7839 dnl Command-line option to specify how to name the resulting Ada library.
7840 dnl $1 = default value
7841 AC_DEFUN([CF_WITH_ADA_LIBNAME],[
7842 AC_MSG_CHECKING(for ada-libname)
7843 AC_ARG_WITH(ada-libname,
7844    [  --with-ada-libname=XXX  override default Ada library-name],
7845    ADA_LIBNAME=[$]withval,
7846    ADA_LIBNAME=$1)
7847 case "x$ADA_LIBNAME" in
7848 (x|xyes|xno)
7849         ADA_LIBNAME=$1
7850         ;;
7851 esac
7852 AC_SUBST(ADA_LIBNAME)
7853 AC_MSG_RESULT($ADA_LIBNAME)
7854 ])dnl
7855 dnl ---------------------------------------------------------------------------
7856 dnl CF_WITH_ADA_OBJECTS version: 2 updated: 2010/06/26 17:35:58
7857 dnl -------------------
7858 dnl Command-line option to specify where Ada objects will install.
7859 AC_DEFUN([CF_WITH_ADA_OBJECTS],[
7860 AC_MSG_CHECKING(for ada-objects)
7861 CF_WITH_PATH(ada-objects,
7862    [  --with-ada-objects=DIR  Ada objects are in DIR],
7863    ADA_OBJECTS,
7864    PREFIX/lib/ada/adalib,
7865    [$]prefix/lib/ada/adalib)
7866 AC_SUBST(ADA_OBJECTS)
7867 AC_MSG_RESULT($ADA_OBJECTS)
7868 ])dnl
7869 dnl ---------------------------------------------------------------------------
7870 dnl CF_WITH_ADA_SHAREDLIB version: 5 updated: 2018/07/21 19:10:35
7871 dnl ---------------------
7872 dnl Command-line option to specify if an Ada95 shared-library should be built,
7873 dnl and optionally what its soname should be.
7874 AC_DEFUN([CF_WITH_ADA_SHAREDLIB],[
7875 AC_REQUIRE([CF_GNAT_PROJECTS])
7876 AC_MSG_CHECKING(if an Ada95 shared-library should be built)
7877 AC_ARG_WITH(ada-sharedlib,
7878         [  --with-ada-sharedlib=soname build shared-library (requires GNAT projects)],
7879         [with_ada_sharedlib=$withval],
7880         [with_ada_sharedlib=no])
7881 AC_MSG_RESULT($with_ada_sharedlib)
7882
7883 if test "x$with_ada_sharedlib" != xno
7884 then
7885         if test "x$cf_gnat_projects" != xyes
7886         then
7887                 AC_MSG_WARN(disabling shared-library since GNAT projects are not supported)
7888                 with_ada_sharedlib=no
7889         fi
7890 fi
7891
7892 ADA_SHAREDLIB='lib$(LIB_NAME).so.1'
7893 MAKE_ADA_SHAREDLIB="#"
7894
7895 if test "x$with_ada_sharedlib" != xno
7896 then
7897         MAKE_ADA_SHAREDLIB=
7898         if test "x$with_ada_sharedlib" != xyes
7899         then
7900                 ADA_SHAREDLIB="$with_ada_sharedlib"
7901         fi
7902 fi
7903
7904 AC_SUBST(ADA_SHAREDLIB)
7905 AC_SUBST(MAKE_ADA_SHAREDLIB)
7906 ])dnl
7907 dnl ---------------------------------------------------------------------------
7908 dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
7909 dnl ----------------
7910 dnl Configure-option for dbmalloc.  The optional parameter is used to override
7911 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
7912 AC_DEFUN([CF_WITH_DBMALLOC],[
7913 CF_NO_LEAKS_OPTION(dbmalloc,
7914         [  --with-dbmalloc         test: use Conor Cahill's dbmalloc library],
7915         [USE_DBMALLOC])
7916
7917 if test "$with_dbmalloc" = yes ; then
7918         AC_CHECK_HEADER(dbmalloc.h,
7919                 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
7920 fi
7921 ])dnl
7922 dnl ---------------------------------------------------------------------------
7923 dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
7924 dnl ---------------
7925 dnl Configure-option for dmalloc.  The optional parameter is used to override
7926 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
7927 AC_DEFUN([CF_WITH_DMALLOC],[
7928 CF_NO_LEAKS_OPTION(dmalloc,
7929         [  --with-dmalloc          test: use Gray Watson's dmalloc library],
7930         [USE_DMALLOC])
7931
7932 if test "$with_dmalloc" = yes ; then
7933         AC_CHECK_HEADER(dmalloc.h,
7934                 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
7935 fi
7936 ])dnl
7937 dnl ---------------------------------------------------------------------------
7938 dnl CF_WITH_EXPORT_SYMS version: 3 updated: 2014/12/20 19:16:08
7939 dnl -------------------
7940 dnl Use this with libtool to specify the list of symbols that may be exported.
7941 dnl The input file contains one symbol per line; comments work with "#".
7942 dnl
7943 dnl $1 = basename of the ".sym" file (default $PACKAGE)
7944 AC_DEFUN([CF_WITH_EXPORT_SYMS],
7945 [
7946 AC_MSG_CHECKING(if exported-symbols file should be used)
7947 AC_ARG_WITH(export-syms,
7948         [  --with-export-syms=XXX  limit exported symbols using libtool],
7949         [with_export_syms=$withval],
7950         [with_export_syms=no])
7951 if test "x$with_export_syms" = xyes
7952 then
7953         with_export_syms='${top_srcdir}/package/ifelse($1,,${PACKAGE},[$1]).sym'
7954         AC_SUBST(PACKAGE)
7955 fi
7956 AC_MSG_RESULT($with_export_syms)
7957 if test "x$with_export_syms" != xno
7958 then
7959         EXPORT_SYMS="-export-symbols $with_export_syms"
7960         AC_SUBST(EXPORT_SYMS)
7961 fi
7962 ])dnl
7963 dnl ---------------------------------------------------------------------------
7964 dnl CF_WITH_GPM version: 10 updated: 2017/04/29 18:32:18
7965 dnl -----------
7966 dnl
7967 dnl The option parameter (if neither yes/no) is assumed to be the name of
7968 dnl the gpm library, e.g., for dynamic loading.
7969 AC_DEFUN([CF_WITH_GPM],
7970 [
7971 AC_MSG_CHECKING(if you want to link with the GPM mouse library)
7972 AC_ARG_WITH(gpm,
7973         [  --with-gpm              use Alessandro Rubini's GPM library],
7974         [with_gpm=$withval],
7975         [with_gpm=maybe])
7976 AC_MSG_RESULT($with_gpm)
7977
7978 if test "$with_gpm" != no ; then
7979         AC_CHECK_HEADER(gpm.h,[
7980                 AC_DEFINE(HAVE_GPM_H,1,[Define to 1 if we have gpm.h header])
7981                 if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then
7982                         CF_VERBOSE(assuming we really have GPM library)
7983                         AC_DEFINE(HAVE_LIBGPM,1,[Define to 1 if we have the gpm library])
7984                         with_gpm=yes
7985                 else
7986                         AC_CHECK_LIB(gpm,Gpm_Open,[with_gpm=yes],[
7987                                 if test "$with_gpm" = maybe; then
7988                                         AC_MSG_WARN(Cannot link with GPM library)
7989                                         with_gpm=no
7990                                 else
7991                                         AC_MSG_ERROR(Cannot link with GPM library)
7992                                 fi
7993                         ])
7994                 fi
7995         ],[
7996                 test "$with_gpm" != maybe && AC_MSG_WARN(Cannot find GPM header)
7997                 with_gpm=no
7998         ])
7999 fi
8000 ])
8001 dnl ---------------------------------------------------------------------------
8002 dnl CF_WITH_LIBTOOL version: 35 updated: 2017/08/12 07:58:51
8003 dnl ---------------
8004 dnl Provide a configure option to incorporate libtool.  Define several useful
8005 dnl symbols for the makefile rules.
8006 dnl
8007 dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
8008 dnl macros from libtool.m4 which is in the aclocal directory of automake.
8009 dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
8010 dnl But that still does not work properly since the macro is expanded outside
8011 dnl the CF_WITH_LIBTOOL macro:
8012 dnl
8013 dnl     #!/bin/sh
8014 dnl     ACLOCAL=`aclocal --print-ac-dir`
8015 dnl     if test -z "$ACLOCAL" ; then
8016 dnl             echo cannot find aclocal directory
8017 dnl             exit 1
8018 dnl     elif test ! -f $ACLOCAL/libtool.m4 ; then
8019 dnl             echo cannot find libtool.m4 file
8020 dnl             exit 1
8021 dnl     fi
8022 dnl
8023 dnl     LOCAL=aclocal.m4
8024 dnl     ORIG=aclocal.m4.orig
8025 dnl
8026 dnl     trap "mv $ORIG $LOCAL" 0 1 2 3 15
8027 dnl     rm -f $ORIG
8028 dnl     mv $LOCAL $ORIG
8029 dnl
8030 dnl     # sed the LIBTOOL= assignment to omit the current directory?
8031 dnl     sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL:-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
8032 dnl     cat $ORIG >>$LOCAL
8033 dnl
8034 dnl     autoconf-257 $*
8035 dnl
8036 AC_DEFUN([CF_WITH_LIBTOOL],
8037 [
8038 AC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION])
8039 ifdef([AC_PROG_LIBTOOL],,[
8040 LIBTOOL=
8041 ])
8042 # common library maintenance symbols that are convenient for libtool scripts:
8043 LIB_CREATE='${AR} -cr'
8044 LIB_OBJECT='${OBJECTS}'
8045 LIB_SUFFIX=.a
8046 LIB_PREP="$RANLIB"
8047
8048 # symbols used to prop libtool up to enable it to determine what it should be
8049 # doing:
8050 LIB_CLEAN=
8051 LIB_COMPILE=
8052 LIB_LINK='${CC}'
8053 LIB_INSTALL=
8054 LIB_UNINSTALL=
8055
8056 AC_MSG_CHECKING(if you want to build libraries with libtool)
8057 AC_ARG_WITH(libtool,
8058         [  --with-libtool          generate libraries with libtool],
8059         [with_libtool=$withval],
8060         [with_libtool=no])
8061 AC_MSG_RESULT($with_libtool)
8062 if test "$with_libtool" != "no"; then
8063 ifdef([AC_PROG_LIBTOOL],[
8064         # missing_content_AC_PROG_LIBTOOL{{
8065         AC_PROG_LIBTOOL
8066         # missing_content_AC_PROG_LIBTOOL}}
8067 ],[
8068         if test "$with_libtool" != "yes" ; then
8069                 CF_PATH_SYNTAX(with_libtool)
8070                 LIBTOOL=$with_libtool
8071         else
8072                 AC_CHECK_TOOLS(LIBTOOL,[libtool glibtool],none)
8073                 CF_LIBTOOL_VERSION
8074                 if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool
8075                 then
8076                         CF_FORGET_TOOL(LIBTOOL)
8077                         AC_CHECK_TOOLS(LIBTOOL,[glibtool],none)
8078                         CF_LIBTOOL_VERSION
8079                 fi
8080         fi
8081         if test -z "$LIBTOOL" ; then
8082                 AC_MSG_ERROR(Cannot find libtool)
8083         fi
8084 ])dnl
8085         LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${libdir} ${LIBTOOL_VERSION} `cut -f1 ${top_srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o'
8086         LIB_OBJECT='${OBJECTS:.o=.lo}'
8087         LIB_SUFFIX=.la
8088         LIB_CLEAN='${LIBTOOL} --mode=clean'
8089         LIB_COMPILE='${LIBTOOL} --mode=compile'
8090         LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}'
8091         LIB_INSTALL='${LIBTOOL} --mode=install'
8092         LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
8093         LIB_PREP=:
8094
8095         CF_CHECK_LIBTOOL_VERSION
8096
8097         # special hack to add -no-undefined (which libtool should do for itself)
8098         LT_UNDEF=
8099         case "$cf_cv_system_name" in
8100         (cygwin*|msys*|mingw32*|os2*|uwin*|aix[[4-7]])
8101                 LT_UNDEF=-no-undefined
8102                 ;;
8103         esac
8104         AC_SUBST([LT_UNDEF])
8105
8106         # special hack to add --tag option for C++ compiler
8107         case $cf_cv_libtool_version in
8108         (1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*)
8109                 LIBTOOL_CXX="$LIBTOOL --tag=CXX"
8110                 LIBTOOL="$LIBTOOL --tag=CC"
8111                 ;;
8112         (*)
8113                 LIBTOOL_CXX="$LIBTOOL"
8114                 ;;
8115         esac
8116 else
8117         LIBTOOL=""
8118         LIBTOOL_CXX=""
8119 fi
8120
8121 test -z "$LIBTOOL" && ECHO_LT=
8122
8123 AC_SUBST(LIBTOOL)
8124 AC_SUBST(LIBTOOL_CXX)
8125 AC_SUBST(LIBTOOL_OPTS)
8126
8127 AC_SUBST(LIB_CREATE)
8128 AC_SUBST(LIB_OBJECT)
8129 AC_SUBST(LIB_SUFFIX)
8130 AC_SUBST(LIB_PREP)
8131
8132 AC_SUBST(LIB_CLEAN)
8133 AC_SUBST(LIB_COMPILE)
8134 AC_SUBST(LIB_LINK)
8135 AC_SUBST(LIB_INSTALL)
8136 AC_SUBST(LIB_UNINSTALL)
8137
8138 ])dnl
8139 dnl ---------------------------------------------------------------------------
8140 dnl CF_WITH_LIBTOOL_OPTS version: 4 updated: 2015/04/17 21:13:04
8141 dnl --------------------
8142 dnl Allow user to pass additional libtool options into the library creation
8143 dnl and link steps.  The main use for this is to do something like
8144 dnl     ./configure --with-libtool-opts=-static
8145 dnl to get the same behavior as automake-flavored
8146 dnl     ./configure --enable-static
8147 AC_DEFUN([CF_WITH_LIBTOOL_OPTS],[
8148 AC_MSG_CHECKING(for additional libtool options)
8149 AC_ARG_WITH(libtool-opts,
8150         [  --with-libtool-opts=XXX specify additional libtool options],
8151         [with_libtool_opts=$withval],
8152         [with_libtool_opts=no])
8153 AC_MSG_RESULT($with_libtool_opts)
8154
8155 case .$with_libtool_opts in
8156 (.yes|.no|.)
8157         ;;
8158 (*)
8159         LIBTOOL_OPTS="$LIBTOOL_OPTS $with_libtool_opts"
8160         ;;
8161 esac
8162
8163 AC_SUBST(LIBTOOL_OPTS)
8164 ])dnl
8165 dnl ---------------------------------------------------------------------------
8166 dnl CF_WITH_LIB_PREFIX version: 1 updated: 2012/01/21 19:28:10
8167 dnl ------------------
8168 dnl Allow the library-prefix to be overridden.  OS/2 EMX originally had no
8169 dnl "lib" prefix, e.g., because it used the dll naming convention.
8170 dnl
8171 dnl $1 = variable to set
8172 AC_DEFUN([CF_WITH_LIB_PREFIX],
8173 [
8174 AC_MSG_CHECKING(if you want to have a library-prefix)
8175 AC_ARG_WITH(lib-prefix,
8176         [  --with-lib-prefix       override library-prefix],
8177         [with_lib_prefix=$withval],
8178         [with_lib_prefix=auto])
8179 AC_MSG_RESULT($with_lib_prefix)
8180
8181 if test $with_lib_prefix = auto
8182 then
8183         CF_LIB_PREFIX($1)
8184 elif test $with_lib_prefix = no
8185 then
8186         LIB_PREFIX=
8187 else
8188         LIB_PREFIX=$with_lib_prefix
8189 fi
8190 ])dnl
8191 dnl ---------------------------------------------------------------------------
8192 dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19
8193 dnl ------------
8194 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
8195 dnl defaulting to yes/no.
8196 dnl
8197 dnl $1 = option name
8198 dnl $2 = help-text
8199 dnl $3 = environment variable to set
8200 dnl $4 = default value, shown in the help-message, must be a constant
8201 dnl $5 = default value, if it's an expression & cannot be in the help-message
8202 dnl
8203 AC_DEFUN([CF_WITH_PATH],
8204 [AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),,
8205 ifelse([$4],,[withval="${$3}"],[withval="${$3:-ifelse([$5],,[$4],[$5])}"]))dnl
8206 if ifelse([$5],,true,[test -n "$5"]) ; then
8207 CF_PATH_SYNTAX(withval)
8208 fi
8209 eval $3="$withval"
8210 AC_SUBST($3)dnl
8211 ])dnl
8212 dnl ---------------------------------------------------------------------------
8213 dnl CF_WITH_PATHLIST version: 10 updated: 2015/04/17 21:13:04
8214 dnl ----------------
8215 dnl Process an option specifying a list of colon-separated paths.
8216 dnl
8217 dnl $1 = option name
8218 dnl $2 = help-text
8219 dnl $3 = environment variable to set
8220 dnl $4 = default value, shown in the help-message, must be a constant
8221 dnl $5 = default value, if it's an expression & cannot be in the help-message
8222 dnl $6 = flag to tell if we want to define or substitute
8223 dnl
8224 AC_DEFUN([CF_WITH_PATHLIST],[
8225 AC_REQUIRE([CF_PATHSEP])
8226 AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
8227 ifelse($4,,[withval=${$3}],[withval=${$3:-ifelse($5,,$4,$5)}]))dnl
8228
8229 IFS="${IFS:-    }"; ac_save_ifs="$IFS"; IFS="${PATH_SEPARATOR}"
8230 cf_dst_path=
8231 for cf_src_path in $withval
8232 do
8233   CF_PATH_SYNTAX(cf_src_path)
8234   test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}$PATH_SEPARATOR"
8235   cf_dst_path="${cf_dst_path}${cf_src_path}"
8236 done
8237 IFS="$ac_save_ifs"
8238
8239 ifelse($6,define,[
8240 # Strip single quotes from the value, e.g., when it was supplied as a literal
8241 # for $4 or $5.
8242 case $cf_dst_path in
8243 (\'*)
8244   cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//`
8245   ;;
8246 esac
8247 cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
8248 ])
8249
8250 # This may use the prefix/exec_prefix symbols which will only yield "NONE"
8251 # so we have to check/work around.  We do prefer the result of "eval"...
8252 eval cf_dst_eval="$cf_dst_path"
8253 case "x$cf_dst_eval" in
8254 (xNONE*)
8255         $3=$cf_dst_path
8256         ;;
8257 (*)
8258         $3="$cf_dst_eval"
8259         ;;
8260 esac
8261 AC_SUBST($3)dnl
8262
8263 ])dnl
8264 dnl ---------------------------------------------------------------------------
8265 dnl CF_WITH_PCRE2 version: 2 updated: 2018/07/14 16:47:56
8266 dnl -------------
8267 dnl Add PCRE2 (Perl-compatible regular expressions v2) to the build if it is
8268 dnl available and the user requests it.  Assume the application will otherwise
8269 dnl use the POSIX interface.
8270 dnl
8271 dnl TODO allow $withval to specify package location
8272 AC_DEFUN([CF_WITH_PCRE2],
8273 [
8274 AC_REQUIRE([CF_PKG_CONFIG])
8275
8276 AC_MSG_CHECKING(if you want to use PCRE2 for regular-expressions)
8277 AC_ARG_WITH(pcre2,
8278         [  --with-pcre2            use PCRE2 for regular-expressions])
8279 test -z "$with_pcre2" && with_pcre2=no
8280 AC_MSG_RESULT($with_pcre2)
8281
8282 if test "x$with_pcre2" != xno ; then
8283         CF_TRY_PKG_CONFIG(libpcre2,,[
8284         CF_TRY_PKG_CONFIG(libpcre,,[
8285                         AC_MSG_ERROR(Cannot find PCRE2 library)])])
8286
8287         AC_DEFINE(HAVE_LIB_PCRE2,1,[Define to 1 if we can/should compile with the PCRE2 library])
8288
8289         # if pkgconfig gave no results, look for the libraries directly
8290         case $LIBS in
8291         (*pcre2-posix*|*pcreposix*)
8292                 ;;
8293         (*)
8294                 AC_CHECK_LIB(pcre2-posix,regcomp,[
8295                         CF_ADD_LIB(pcre2-posix)],
8296                         [AC_CHECK_LIB(pcreposix,regcomp,[
8297                          CF_ADD_LIB(pcreposix)
8298                         ],[AC_MSG_ERROR(Cannot find PCRE2 POSIX library)])])
8299                 ;;
8300         esac
8301
8302         # either way, check for the library header files
8303         AC_CHECK_HEADERS(pcre2-posix.h pcreposix.h)
8304 fi
8305 ])dnl
8306 dnl ---------------------------------------------------------------------------
8307 dnl CF_WITH_PKG_CONFIG_LIBDIR version: 10 updated: 2015/08/22 17:10:56
8308 dnl -------------------------
8309 dnl Allow the choice of the pkg-config library directory to be overridden.
8310 AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[
8311
8312 case $PKG_CONFIG in
8313 (no|none|yes)
8314         AC_MSG_CHECKING(for pkg-config library directory)
8315         ;;
8316 (*)
8317         AC_MSG_CHECKING(for $PKG_CONFIG library directory)
8318         ;;
8319 esac
8320
8321 PKG_CONFIG_LIBDIR=no
8322 AC_ARG_WITH(pkg-config-libdir,
8323         [  --with-pkg-config-libdir=XXX use given directory for installing pc-files],
8324         [PKG_CONFIG_LIBDIR=$withval],
8325         [test "x$PKG_CONFIG" != xnone && PKG_CONFIG_LIBDIR=yes])
8326
8327 case x$PKG_CONFIG_LIBDIR in
8328 (x/*)
8329         ;;
8330 (xyes)
8331         # Look for the library directory using the same prefix as the executable
8332         if test "x$PKG_CONFIG" = xnone
8333         then
8334                 cf_path=$prefix
8335         else
8336                 cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`
8337         fi
8338
8339         # If you don't like using the default architecture, you have to specify the
8340         # intended library directory and corresponding compiler/linker options.
8341         #
8342         # This case allows for Debian's 2014-flavor of multiarch, along with the
8343         # most common variations before that point.  Some other variants spell the
8344         # directory differently, e.g., "pkg-config", and put it in unusual places.
8345         # pkg-config has always been poorly standardized, which is ironic...
8346         case x`(arch) 2>/dev/null` in
8347         (*64)
8348                 cf_search_path="\
8349                         $cf_path/lib/*64-linux-gnu \
8350                         $cf_path/share \
8351                         $cf_path/lib64 \
8352                         $cf_path/lib32 \
8353                         $cf_path/lib"
8354                 ;;
8355         (*)
8356                 cf_search_path="\
8357                         $cf_path/lib/*-linux-gnu \
8358                         $cf_path/share \
8359                         $cf_path/lib32 \
8360                         $cf_path/lib \
8361                         $cf_path/libdata"
8362                 ;;
8363         esac
8364
8365         CF_VERBOSE(list...)
8366         for cf_config in $cf_search_path
8367         do
8368                 CF_VERBOSE(checking $cf_config/pkgconfig)
8369                 if test -d $cf_config/pkgconfig
8370                 then
8371                         PKG_CONFIG_LIBDIR=$cf_config/pkgconfig
8372                         AC_MSG_CHECKING(done)
8373                         break
8374                 fi
8375         done
8376         ;;
8377 (*)
8378         ;;
8379 esac
8380
8381 if test "x$PKG_CONFIG_LIBDIR" != xno ; then
8382         AC_MSG_RESULT($PKG_CONFIG_LIBDIR)
8383 fi
8384
8385 AC_SUBST(PKG_CONFIG_LIBDIR)
8386 ])dnl
8387 dnl ---------------------------------------------------------------------------
8388 dnl CF_WITH_PATH_PROG version: 1 updated: 2019/06/30 19:44:43
8389 dnl -----------------
8390 dnl Check for a given program, like CF_PATH_PROG, but allow override using a
8391 dnl "--with-xxx" option.
8392 dnl
8393 dnl Parameters:
8394 dnl             $1 = environment variable to set/update
8395 dnl             $2 = program name
8396 dnl             $3 = help-text
8397 dnl             $4 = $PATH
8398 AC_DEFUN([CF_WITH_PATH_PROG],[
8399 AC_ARG_WITH($2-path,
8400         [  --with-$2-path=XXX     specify path of $2 ifelse($3,,,$3)],
8401         [AC_MSG_CHECKING(for $2 program ifelse($3,,,$3))
8402                 $1=$withval
8403                 AC_MSG_RESULT([$]$1)
8404                 CF_PATH_SYNTAX($1)
8405         ],
8406         [CF_PATH_PROG($1,$2,,ifelse($4,,,$4))
8407                 if test -z "[$]$1"
8408                 then
8409                         AC_MSG_WARN(no $2 program found ifelse($3,,,$3))
8410                 fi
8411         ])
8412 ])
8413 dnl ---------------------------------------------------------------------------
8414 dnl CF_WITH_PTHREAD version: 7 updated: 2015/04/18 08:56:57
8415 dnl ---------------
8416 dnl Check for POSIX thread library.
8417 AC_DEFUN([CF_WITH_PTHREAD],
8418 [
8419 AC_MSG_CHECKING(if you want to link with the pthread library)
8420 AC_ARG_WITH(pthread,
8421         [  --with-pthread          use POSIX thread library],
8422         [with_pthread=$withval],
8423         [with_pthread=no])
8424 AC_MSG_RESULT($with_pthread)
8425
8426 if test "$with_pthread" != no ; then
8427         AC_CHECK_HEADER(pthread.h,[
8428         AC_DEFINE(HAVE_PTHREADS_H,1,[Define to 1 if we have pthreads.h header])
8429
8430         for cf_lib_pthread in pthread c_r
8431         do
8432             AC_MSG_CHECKING(if we can link with the $cf_lib_pthread library)
8433             cf_save_LIBS="$LIBS"
8434             CF_ADD_LIB($cf_lib_pthread)
8435             AC_TRY_LINK([
8436 #include <pthread.h>
8437 ],[
8438                 int rc = pthread_create(0,0,0,0);
8439                 int r2 = pthread_mutexattr_settype(0, 0);
8440 ],[with_pthread=yes],[with_pthread=no])
8441             LIBS="$cf_save_LIBS"
8442             AC_MSG_RESULT($with_pthread)
8443             test "$with_pthread" = yes && break
8444         done
8445
8446         if test "$with_pthread" = yes ; then
8447             CF_ADD_LIB($cf_lib_pthread)
8448             AC_DEFINE(HAVE_LIBPTHREADS,1,[Define to 1 if we have pthreads library])
8449         else
8450             AC_MSG_ERROR(Cannot link with pthread library)
8451         fi
8452         ])
8453 fi
8454 ])
8455 dnl ---------------------------------------------------------------------------
8456 dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
8457 dnl -------------------
8458 dnl Allow library's release-version to be overridden.  Generally this happens when a
8459 dnl packager has incremented the release-version past that used in the original package,
8460 dnl and wishes to keep doing this.
8461 dnl
8462 dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR
8463 dnl and {package}_MINOR symbols
8464 dnl symbol.
8465 AC_DEFUN([CF_WITH_REL_VERSION],[
8466 test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
8467 AC_ARG_WITH(rel-version,
8468 [  --with-rel-version=XXX  override derived release version],
8469 [AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval)
8470  cf_cv_rel_version=$withval])
8471 ifelse($1,,[
8472  CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
8473 ],[
8474  $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'`
8475  $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'`
8476  CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version)
8477  CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version)
8478 ])
8479 ])dnl
8480 dnl ---------------------------------------------------------------------------
8481 dnl CF_WITH_SYSMOUSE version: 3 updated: 2012/10/06 17:56:13
8482 dnl ----------------
8483 dnl If we can compile with sysmouse, make it available unless it is not wanted.
8484 AC_DEFUN([CF_WITH_SYSMOUSE],[
8485 # not everyone has "test -c"
8486 if test -c /dev/sysmouse 2>/dev/null ; then
8487 AC_MSG_CHECKING(if you want to use sysmouse)
8488 AC_ARG_WITH(sysmouse,
8489         [  --with-sysmouse         use sysmouse (FreeBSD console)],
8490         [cf_with_sysmouse=$withval],
8491         [cf_with_sysmouse=maybe])
8492         if test "$cf_with_sysmouse" != no ; then
8493         AC_TRY_COMPILE([
8494 #include <osreldate.h>
8495 #if (__FreeBSD_version >= 400017)
8496 #include <sys/consio.h>
8497 #include <sys/fbio.h>
8498 #else
8499 #include <machine/console.h>
8500 #endif
8501 ],[
8502         struct mouse_info the_mouse;
8503         ioctl(0, CONS_MOUSECTL, &the_mouse);
8504 ],[cf_with_sysmouse=yes],[cf_with_sysmouse=no])
8505         fi
8506 AC_MSG_RESULT($cf_with_sysmouse)
8507 test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE,1,[Define to 1 if we can/should use the sysmouse interface])
8508 fi
8509 ])dnl
8510 dnl ---------------------------------------------------------------------------
8511 dnl CF_WITH_SYSTYPE version: 1 updated: 2013/01/26 16:26:12
8512 dnl ---------------
8513 dnl For testing, override the derived host system-type which is used to decide
8514 dnl things such as the linker commands used to build shared libraries.  This is
8515 dnl normally chosen automatically based on the type of system which you are
8516 dnl building on.  We use it for testing the configure script.
8517 dnl
8518 dnl This is different from the --host option: it is used only for testing parts
8519 dnl of the configure script which would not be reachable with --host since that
8520 dnl relies on the build environment being real, rather than mocked up.
8521 AC_DEFUN([CF_WITH_SYSTYPE],[
8522 CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
8523 AC_ARG_WITH(system-type,
8524         [  --with-system-type=XXX  test: override derived host system-type],
8525 [AC_MSG_WARN(overriding system type to $withval)
8526         cf_cv_system_name=$withval
8527         host_os=$withval
8528 ])
8529 ])dnl
8530 dnl ---------------------------------------------------------------------------
8531 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
8532 dnl ----------------
8533 AC_DEFUN([CF_WITH_VALGRIND],[
8534 CF_NO_LEAKS_OPTION(valgrind,
8535         [  --with-valgrind         test: use valgrind],
8536         [USE_VALGRIND])
8537 ])dnl
8538 dnl ---------------------------------------------------------------------------
8539 dnl CF_WITH_VERSIONED_SYMS version: 8 updated: 2018/10/20 20:24:34
8540 dnl ----------------------
8541 dnl Use this when building shared library with ELF, to markup symbols with the
8542 dnl version identifier from the given input file.  Generally that identifier is
8543 dnl the same as the SONAME at which the symbol was first introduced.
8544 dnl
8545 dnl $1 = basename of the ".map" file (default $PACKAGE)
8546 AC_DEFUN([CF_WITH_VERSIONED_SYMS],
8547 [
8548 AC_MSG_CHECKING(if versioned-symbols file should be used)
8549 AC_ARG_WITH(versioned-syms,
8550         [  --with-versioned-syms=X markup versioned symbols using ld],
8551         [with_versioned_syms=$withval],
8552         [with_versioned_syms=no])
8553 case "x$with_versioned_syms" in
8554 (xyes)
8555         with_versioned_syms='${top_srcdir}/package/ifelse($1,,${PACKAGE},[$1]).map'
8556         AC_SUBST(PACKAGE)
8557         ;;
8558 (xno)
8559         ;;
8560 (x/*)
8561         test -f "$with_versioned_syms" || AC_MSG_ERROR(expected a filename: $with_versioned_syms)
8562         ;;
8563 (*)
8564         test -f "$with_versioned_syms" || AC_MSG_ERROR(expected a filename: $with_versioned_syms)
8565         with_versioned_syms=`pwd`/"$with_versioned_syms"
8566         ;;
8567 esac
8568 AC_MSG_RESULT($with_versioned_syms)
8569
8570 RESULTING_SYMS=
8571 VERSIONED_SYMS=
8572 WILDCARD_SYMS=
8573
8574 if test "x$with_versioned_syms" != xno
8575 then
8576         RESULTING_SYMS=$with_versioned_syms
8577         case "x$MK_SHARED_LIB" in
8578         (*-Wl,*)
8579                 VERSIONED_SYMS="-Wl,--version-script,\${RESULTING_SYMS}"
8580                 MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-Wl,%\\[$]{VERSIONED_SYMS} -Wl,%"`
8581                 CF_VERBOSE(MK_SHARED_LIB:  $MK_SHARED_LIB)
8582                 ;;
8583         (*-dy\ *)
8584                 VERSIONED_SYMS="-Wl,-M,\${RESULTING_SYMS}"
8585                 MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-dy%\\[$]{VERSIONED_SYMS} -dy%"`
8586                 CF_VERBOSE(MK_SHARED_LIB:  $MK_SHARED_LIB)
8587                 ;;
8588         (*)
8589                 AC_MSG_WARN(this system does not support versioned-symbols)
8590                 ;;
8591         esac
8592
8593         # Linux ld can selectively override scope, e.g., of symbols beginning with
8594         # "_" by first declaring some as global, and then using a wildcard to
8595         # declare the others as local.  Some other loaders cannot do this.  Check
8596         # by constructing a (very) simple shared library and inspecting its
8597         # symbols.
8598         if test "x$VERSIONED_SYMS" != "x"
8599         then
8600                 AC_MSG_CHECKING(if wildcards can be used to selectively omit symbols)
8601                 WILDCARD_SYMS=no
8602
8603                 # make sources
8604                 rm -f conftest.*
8605
8606                 cat >conftest.ver <<EOF
8607 module_1.0 {
8608 global:
8609         globalf1;
8610 local:
8611         localf1;
8612 };
8613 module_2.0 {
8614 global:
8615         globalf2;
8616 local:
8617         localf2;
8618         _*;
8619 } module_1.0;
8620 submodule_1.0 {
8621 global:
8622         subglobalf1;
8623         _ismissing;
8624 local:
8625         sublocalf1;
8626 };
8627 submodule_2.0 {
8628 global:
8629         subglobalf2;
8630 local:
8631         sublocalf2;
8632         _*;
8633 } submodule_1.0;
8634 EOF
8635                 cat >conftest.$ac_ext <<EOF
8636 #line __oline__ "configure"
8637 int     _ismissing(void) { return 1; }
8638 int     _localf1(void) { return 1; }
8639 int     _localf2(void) { return 2; }
8640 int     globalf1(void) { return 1; }
8641 int     globalf2(void) { return 2; }
8642 int     _sublocalf1(void) { return 1; }
8643 int     _sublocalf2(void) { return 2; }
8644 int     subglobalf1(void) { return 1; }
8645 int     subglobalf2(void) { return 2; }
8646 EOF
8647                 cat >conftest.mk <<EOF
8648 CC=${CC}
8649 CFLAGS=${CFLAGS}
8650 CPPFLAGS=${CPPFLAGS}
8651 LDFLAGS=${LDFLAGS}
8652 LIBS=${LIBS}
8653 VERSIONED_SYMS=${VERSIONED_SYMS}
8654 RESULTING_SYMS=conftest.ver
8655 MK_SHARED_LIB=${MK_SHARED_LIB}
8656 conftest.so: conftest.$ac_cv_objext
8657                 \$(MK_SHARED_LIB) conftest.$ac_cv_objext
8658 EOF
8659
8660                 # compile source, make library
8661                 if make -f conftest.mk 2>&AC_FD_CC >/dev/null
8662                 then
8663                         # test for missing symbol in either Data or Text section
8664                         cf_missing=`nm -P conftest.so 2>&AC_FD_CC |fgrep _ismissing | egrep '[[         ]][[DT]][[      ]]'`
8665                         test -n "$cf_missing" && WILDCARD_SYMS=yes
8666                 fi
8667                 AC_MSG_RESULT($WILDCARD_SYMS)
8668                 rm -f conftest.*
8669         fi
8670 fi
8671 AC_SUBST(RESULTING_SYMS)
8672 AC_SUBST(VERSIONED_SYMS)
8673 AC_SUBST(WILDCARD_SYMS)
8674 ])dnl
8675 dnl ---------------------------------------------------------------------------
8676 dnl CF_WITH_X11_RGB version: 1 updated: 2017/11/25 17:32:16
8677 dnl ---------------
8678 dnl Handle configure option "--with-x11-rgb", setting these shell
8679 dnl variables:
8680 dnl
8681 dnl $RGB_PATH is the option value, used for finding the X11 rgb file.
8682 dnl $no_x11_rgb is a "#" (comment) if "--without-x11-rgb" is given.
8683 dnl
8684 dnl Most Linux's use this:
8685 dnl     /usr/share/X11/rgb.txt
8686 dnl Debian uses this:
8687 dnl     /etc/X11/rgb.txt
8688 dnl DragonFlyBSD ports uses this:
8689 dnl     /usr/pkg/lib/X11/rgb.txt
8690 dnl FreeBSD ports use these:
8691 dnl     /usr/local/lib/X11/rgb.txt
8692 dnl     /usr/local/share/X11/rgb.txt
8693 dnl Mandriva has these:
8694 dnl     /usr/lib/X11/rgb.txt
8695 dnl     /usr/lib64/X11/rgb.txt
8696 dnl NetBSD has these
8697 dnl     /usr/X11R7/lib/X11/rgb.txt
8698 dnl OpenSolaris uses
8699 dnl     32-bit:
8700 dnl     /usr/X11/etc/X11/rgb.txt
8701 dnl     /usr/X11/share/X11/rgb.txt
8702 dnl     /usr/X11/lib/X11/rgb.txt
8703 dnl OSX uses
8704 dnl             /opt/local/share/X11/rgb.txt (MacPorts)
8705 dnl             /opt/X11/share/X11/rgb.txt (non-ports)
8706 dnl     64-bit:
8707 dnl     /usr/X11/etc/X11/rgb.txt
8708 dnl     /usr/X11/share/X11/rgb.txt (perhaps)
8709 dnl     /usr/X11/lib/amd64/X11/rgb.txt
8710 dnl Solaris10 uses (in this order):
8711 dnl     /usr/openwin/lib/X11/rgb.txt
8712 dnl     /usr/X11/lib/X11/rgb.txt
8713 AC_DEFUN([CF_WITH_X11_RGB],[
8714 AC_MSG_CHECKING(for X11 rgb file)
8715 AC_ARG_WITH(x11-rgb,
8716         [  --with-x11-rgb=FILE   file containing X11 rgb information (EPREFIX/lib/X11/rgb.txt)],
8717         [RGB_PATH=$withval],
8718         [RGB_PATH=auto])
8719
8720 if test "x[$]RGB_PATH" = xauto
8721 then
8722         RGB_PATH='${exec_prefix}/lib/X11/rgb.txt'
8723         for cf_path in \
8724                 /opt/local/share/X11/rgb.txt \
8725                 /opt/X11/share/X11/rgb.txt \
8726                 /usr/share/X11/rgb.txt \
8727                 /usr/X11/share/X11/rgb.txt \
8728                 /usr/X11/lib/X11/rgb.txt \
8729                 /usr/lib/X11/rgb.txt \
8730                 /etc/X11/rgb.txt \
8731                 /usr/pkg/lib/X11/rgb.txt \
8732                 /usr/X11R7/lib/X11/rgb.txt \
8733                 /usr/X11R6/lib/X11/rgb.txt \
8734                 /usr/X11R5/lib/X11/rgb.txt \
8735                 /usr/X11R4/lib/X11/rgb.txt \
8736                 /usr/local/lib/X11/rgb.txt \
8737                 /usr/local/share/X11/rgb.txt \
8738                 /usr/lib64/X11/rgb.txt
8739         do
8740                 if test -f "$cf_path" ; then
8741                         RGB_PATH="$cf_path"
8742                         break
8743                 fi
8744         done
8745 else
8746         cf_path=$RGB_PATH
8747         CF_PATH_SYNTAX(cf_path)
8748 fi
8749
8750 AC_MSG_RESULT($RGB_PATH)
8751 AC_SUBST(RGB_PATH)
8752 AC_DEFINE_UNQUOTED(RGB_PATH,"$cf_path")
8753
8754 no_x11_rgb=
8755 if test "$RGB_PATH" = no
8756 then
8757         no_x11_rgb="#"
8758 fi
8759 AC_SUBST(no_x11_rgb)
8760 ])dnl
8761 dnl ---------------------------------------------------------------------------
8762 dnl CF_XOPEN_SOURCE version: 55 updated: 2018/12/31 20:46:17
8763 dnl ---------------
8764 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
8765 dnl or adapt to the vendor's definitions to get equivalent functionality,
8766 dnl without losing the common non-POSIX features.
8767 dnl
8768 dnl Parameters:
8769 dnl     $1 is the nominal value for _XOPEN_SOURCE
8770 dnl     $2 is the nominal value for _POSIX_C_SOURCE
8771 AC_DEFUN([CF_XOPEN_SOURCE],[
8772 AC_REQUIRE([AC_CANONICAL_HOST])
8773 AC_REQUIRE([CF_POSIX_VISIBLE])
8774
8775 if test "$cf_cv_posix_visible" = no; then
8776
8777 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
8778 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
8779 cf_xopen_source=
8780
8781 case $host_os in
8782 (aix[[4-7]]*)
8783         cf_xopen_source="-D_ALL_SOURCE"
8784         ;;
8785 (msys)
8786         cf_XOPEN_SOURCE=600
8787         ;;
8788 (darwin[[0-8]].*)
8789         cf_xopen_source="-D_APPLE_C_SOURCE"
8790         ;;
8791 (darwin*)
8792         cf_xopen_source="-D_DARWIN_C_SOURCE"
8793         cf_XOPEN_SOURCE=
8794         ;;
8795 (freebsd*|dragonfly*|midnightbsd*)
8796         # 5.x headers associate
8797         #       _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
8798         #       _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
8799         cf_POSIX_C_SOURCE=200112L
8800         cf_XOPEN_SOURCE=600
8801         cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
8802         ;;
8803 (hpux11*)
8804         cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
8805         ;;
8806 (hpux*)
8807         cf_xopen_source="-D_HPUX_SOURCE"
8808         ;;
8809 (irix[[56]].*)
8810         cf_xopen_source="-D_SGI_SOURCE"
8811         cf_XOPEN_SOURCE=
8812         ;;
8813 (linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
8814         CF_GNU_SOURCE($cf_XOPEN_SOURCE)
8815         ;;
8816 (minix*)
8817         cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this...
8818         ;;
8819 (mirbsd*)
8820         # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
8821         cf_XOPEN_SOURCE=
8822         CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
8823         ;;
8824 (netbsd*)
8825         cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
8826         ;;
8827 (openbsd[[4-9]]*)
8828         # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
8829         cf_xopen_source="-D_BSD_SOURCE"
8830         cf_XOPEN_SOURCE=600
8831         ;;
8832 (openbsd*)
8833         # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
8834         ;;
8835 (osf[[45]]*)
8836         cf_xopen_source="-D_OSF_SOURCE"
8837         ;;
8838 (nto-qnx*)
8839         cf_xopen_source="-D_QNX_SOURCE"
8840         ;;
8841 (sco*)
8842         # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
8843         ;;
8844 (solaris2.*)
8845         cf_xopen_source="-D__EXTENSIONS__"
8846         cf_cv_xopen_source=broken
8847         ;;
8848 (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2)
8849         cf_XOPEN_SOURCE=
8850         cf_POSIX_C_SOURCE=
8851         ;;
8852 (*)
8853         CF_TRY_XOPEN_SOURCE
8854         CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
8855         ;;
8856 esac
8857
8858 if test -n "$cf_xopen_source" ; then
8859         CF_ADD_CFLAGS($cf_xopen_source,true)
8860 fi
8861
8862 dnl In anything but the default case, we may have system-specific setting
8863 dnl which is still not guaranteed to provide all of the entrypoints that
8864 dnl _XOPEN_SOURCE would yield.
8865 if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
8866         AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
8867         AC_TRY_COMPILE([#include <stdlib.h>],[
8868 #ifndef _XOPEN_SOURCE
8869 make an error
8870 #endif],
8871         [cf_XOPEN_SOURCE_set=yes],
8872         [cf_XOPEN_SOURCE_set=no])
8873         AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
8874         if test $cf_XOPEN_SOURCE_set = yes
8875         then
8876                 AC_TRY_COMPILE([#include <stdlib.h>],[
8877 #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
8878 make an error
8879 #endif],
8880                 [cf_XOPEN_SOURCE_set_ok=yes],
8881                 [cf_XOPEN_SOURCE_set_ok=no])
8882                 if test $cf_XOPEN_SOURCE_set_ok = no
8883                 then
8884                         AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
8885                 fi
8886         else
8887                 CF_TRY_XOPEN_SOURCE
8888         fi
8889 fi
8890 fi # cf_cv_posix_visible
8891 ])