1 dnl***************************************************************************
2 dnl Copyright 2018-2020,2021 Thomas E. Dickey *
3 dnl Copyright 1998-2017,2018 Free Software Foundation, Inc. *
5 dnl Permission is hereby granted, free of charge, to any person obtaining a *
6 dnl copy of this software and associated documentation files (the *
7 dnl "Software"), to deal in the Software without restriction, including *
8 dnl without limitation the rights to use, copy, modify, merge, publish, *
9 dnl distribute, distribute with modifications, sublicense, and/or sell *
10 dnl copies of the Software, and to permit persons to whom the Software is *
11 dnl furnished to do so, subject to the following conditions: *
13 dnl The above copyright notice and this permission notice shall be included *
14 dnl in all copies or substantial portions of the Software. *
16 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 dnl Except as contained in this notice, the name(s) of the above copyright *
25 dnl holders shall not be used in advertising or otherwise to promote the *
26 dnl sale, use or other dealings in this Software without prior written *
28 dnl***************************************************************************
30 dnl Author: Thomas E. Dickey 1995-on
32 dnl $Id: aclocal.m4,v 1.974 2021/08/28 20:24:23 tom Exp $
33 dnl Macros used in NCURSES auto-configuration script.
35 dnl These macros are maintained separately from NCURSES. The copyright on
36 dnl this file applies to the aggregation of macros and does not affect use of
37 dnl these macros in other applications.
39 dnl See these pages for additional information:
40 dnl https://invisible-island.net/autoconf/
41 dnl https://invisible-island.net/autoconf/my-autoconf.html
43 dnl ---------------------------------------------------------------------------
44 dnl ---------------------------------------------------------------------------
45 dnl AM_LANGINFO_CODESET version: 6 updated: 2021/01/01 16:53:59
46 dnl -------------------
47 dnl Inserted as requested by gettext 0.10.40
48 dnl File from /usr/share/aclocal
50 dnl ====================
53 dnl From Bruno Haible.
54 AC_DEFUN([AM_LANGINFO_CODESET],
56 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
57 [AC_TRY_LINK([#include <langinfo.h>],
58 [char* cs = nl_langinfo(CODESET); (void)cs],
59 am_cv_langinfo_codeset=yes,
60 am_cv_langinfo_codeset=no)
62 if test "$am_cv_langinfo_codeset" = yes; then
63 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
64 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
67 dnl ---------------------------------------------------------------------------
68 dnl CF_ABI_DEFAULTS version: 2 updated: 2015/06/06 13:49:58
70 dnl Provide configure-script defaults for different ncurses ABIs.
71 AC_DEFUN([CF_ABI_DEFAULTS],[
72 AC_REQUIRE([CF_NCURSES_WITH_ABI_VERSION])
73 case x$cf_cv_abi_version in
79 cf_dft_ext_spfuncs=yes
80 cf_dft_filter_syms=yes
81 cf_dft_chtype=uint32_t
82 cf_dft_mmask_t=uint32_t
84 cf_dft_tparm_arg=intptr_t
102 dnl ---------------------------------------------------------------------------
103 dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
104 dnl ------------------
105 dnl Conditionally generate script according to whether we're using a given autoconf.
107 dnl $1 = version to compare against
108 dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
109 dnl $3 = code to use if AC_ACVERSION is older than $1.
110 define([CF_ACVERSION_CHECK],
112 ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
113 ifdef([m4_version_compare],
114 [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
115 [CF_ACVERSION_COMPARE(
116 AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
117 AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
118 dnl ---------------------------------------------------------------------------
119 dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
120 dnl --------------------
121 dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
122 dnl MAJOR2, MINOR2, TERNARY2,
123 dnl PRINTABLE2, not FOUND, FOUND)
124 define([CF_ACVERSION_COMPARE],
125 [ifelse(builtin([eval], [$2 < $5]), 1,
126 [ifelse([$8], , ,[$8])],
127 [ifelse([$9], , ,[$9])])])dnl
128 dnl ---------------------------------------------------------------------------
129 dnl CF_ADA_INCLUDE_DIRS version: 8 updated: 2013/10/14 04:24:07
130 dnl -------------------
131 dnl Construct the list of include-options for the C programs in the Ada95
133 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
135 ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS"
136 if test "$srcdir" != "."; then
137 ACPPFLAGS="-I\${srcdir}/../../include $ACPPFLAGS"
139 if test "$GCC" != yes; then
140 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
141 elif test "$includedir" != "/usr/include"; then
142 if test "$includedir" = '${prefix}/include' ; then
143 if test x$prefix != x/usr ; then
144 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
147 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
152 dnl ---------------------------------------------------------------------------
153 dnl CF_ADD_ADAFLAGS version: 1 updated: 2010/06/19 15:22:18
155 dnl Add to $ADAFLAGS, which is substituted into makefile and scripts.
156 AC_DEFUN([CF_ADD_ADAFLAGS],[
157 ADAFLAGS="$ADAFLAGS $1"
160 dnl ---------------------------------------------------------------------------
161 dnl CF_ADD_CFLAGS version: 15 updated: 2020/12/31 10:54:15
163 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
164 dnl $1 = flags to add
165 dnl $2 = if given makes this macro verbose.
167 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
168 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
169 dnl confused by the quotes (which require backslashes to keep them usable).
170 AC_DEFUN([CF_ADD_CFLAGS],
175 cf_new_extra_cppflags=
177 for cf_add_cflags in $1
179 case "$cf_fix_cppflags" in
181 case "$cf_add_cflags" in
182 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C)
183 case "$cf_add_cflags" in
185 cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
187 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
188 && test -z "${cf_tst_cflags}" \
189 && cf_fix_cppflags=yes
191 if test "$cf_fix_cppflags" = yes ; then
192 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
194 elif test "${cf_tst_cflags}" = "\"'" ; then
195 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
204 case "$cf_add_cflags" in
206 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
207 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
210 CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags)
215 CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags)
220 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
222 cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[[^"]]*"'\''//'`
224 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
225 && test -z "${cf_tst_cflags}" \
226 && cf_fix_cppflags=no
231 if test -n "$cf_new_cflags" ; then
232 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
233 CF_APPEND_TEXT(CFLAGS,$cf_new_cflags)
236 if test -n "$cf_new_cppflags" ; then
237 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
238 CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags)
241 if test -n "$cf_new_extra_cppflags" ; then
242 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
243 CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags)
246 AC_SUBST(EXTRA_CPPFLAGS)
249 dnl ---------------------------------------------------------------------------
250 dnl CF_ADD_CXXFLAGS version: 1 updated: 2020/04/04 16:16:13
252 dnl Copy non-preprocessor flags to $CXXFLAGS, preprocessor flags to $CPPFLAGS
253 dnl The second parameter if given makes this macro verbose.
255 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
256 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
257 dnl confused by the quotes (which require backslashes to keep them usable).
258 AC_DEFUN([CF_ADD_CXXFLAGS],
260 cf_save_CXXFLAGS="$CFLAGS"
262 CF_ADD_CFLAGS($1 ifelse($2,,,[,$2]))
264 CFLAGS="$cf_save_CXXFLAGS"
266 dnl ---------------------------------------------------------------------------
267 dnl CF_ADD_INCDIR version: 16 updated: 2020/12/31 20:19:42
269 dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
270 dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
271 dnl but old versions (and some misinstalled ones) need that. To make things
272 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
273 dnl the include-path).
274 AC_DEFUN([CF_ADD_INCDIR],
276 if test -n "$1" ; then
277 for cf_add_incdir in $1
279 while test "$cf_add_incdir" != /usr/include
281 if test -d "$cf_add_incdir"
284 if test -n "$CFLAGS$CPPFLAGS" ; then
285 # a loop is needed to ensure we can add subdirs of existing dirs
286 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
287 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
288 cf_have_incdir=yes; break
293 if test "$cf_have_incdir" = no ; then
294 if test "$cf_add_incdir" = /usr/local/include ; then
297 cf_save_CPPFLAGS=$CPPFLAGS
298 CF_APPEND_TEXT(CPPFLAGS,-I$cf_add_incdir)
299 AC_TRY_COMPILE([#include <stdio.h>],
302 [cf_have_incdir=yes])
303 CPPFLAGS=$cf_save_CPPFLAGS
308 if test "$cf_have_incdir" = no ; then
309 CF_VERBOSE(adding $cf_add_incdir to include-path)
310 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
312 cf_top_incdir=`echo "$cf_add_incdir" | sed -e 's%/include/.*$%/include%'`
313 test "$cf_top_incdir" = "$cf_add_incdir" && break
314 cf_add_incdir="$cf_top_incdir"
325 dnl ---------------------------------------------------------------------------
326 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
328 dnl Add a library, used to enforce consistency.
330 dnl $1 = library to add, without the "-l"
331 dnl $2 = variable to update (default $LIBS)
332 AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
333 dnl ---------------------------------------------------------------------------
334 dnl CF_ADD_LIBDIR version: 11 updated: 2020/12/31 20:19:42
336 dnl Adds to the library-path
338 dnl Some machines have trouble with multiple -L options.
340 dnl $1 is the (list of) directory(s) to add
341 dnl $2 is the optional name of the variable to update (default LDFLAGS)
343 AC_DEFUN([CF_ADD_LIBDIR],
345 if test -n "$1" ; then
346 for cf_add_libdir in $1
348 if test "$cf_add_libdir" = /usr/lib ; then
350 elif test -d "$cf_add_libdir"
353 if test -n "$LDFLAGS$LIBS" ; then
354 # a loop is needed to ensure we can add subdirs of existing dirs
355 for cf_test_libdir in $LDFLAGS $LIBS ; do
356 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
357 cf_have_libdir=yes; break
361 if test "$cf_have_libdir" = no ; then
362 CF_VERBOSE(adding $cf_add_libdir to library-path)
363 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
369 dnl ---------------------------------------------------------------------------
370 dnl CF_ADD_LIBS version: 3 updated: 2019/11/02 16:47:33
372 dnl Add one or more libraries, used to enforce consistency. Libraries are
373 dnl prepended to an existing list, since their dependencies are assumed to
374 dnl already exist in the list.
376 dnl $1 = libraries to add, with the "-l", etc.
377 dnl $2 = variable to update (default $LIBS)
378 AC_DEFUN([CF_ADD_LIBS],[
379 cf_add_libs="[$]ifelse($2,,LIBS,[$2])"
382 for cf_add_1lib in $1; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done
384 for cf_add_1lib in $cf_add_0lib; do
385 for cf_add_2lib in $cf_add_libs; do
386 if test "x$cf_add_1lib" = "x$cf_add_2lib"; then
391 test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs"
393 ifelse($2,,LIBS,[$2])="$cf_add_libs"
395 dnl ---------------------------------------------------------------------------
396 dnl CF_ADD_SUBDIR_PATH version: 5 updated: 2020/12/31 20:19:42
397 dnl ------------------
398 dnl Append to a search-list for a nonstandard header/lib-file
399 dnl $1 = the variable to return as result
400 dnl $2 = the package name
401 dnl $3 = the subdirectory, e.g., bin, include or lib
402 dnl $4 = the directory under which we will test for subdirectories
403 dnl $5 = a directory that we do not want $4 to match
404 AC_DEFUN([CF_ADD_SUBDIR_PATH],
406 test "x$4" != "x$5" && \
408 ifelse([$5],NONE,,[{ test -z "$5" || test "x$5" = xNONE || test "x$4" != "x$5"; } &&]) {
409 test -n "$verbose" && echo " ... testing for $3-directories under $4"
410 test -d "$4/$3" && $1="[$]$1 $4/$3"
411 test -d "$4/$3/$2" && $1="[$]$1 $4/$3/$2"
412 test -d "$4/$3/$2/$3" && $1="[$]$1 $4/$3/$2/$3"
413 test -d "$4/$2/$3" && $1="[$]$1 $4/$2/$3"
414 test -d "$4/$2/$3/$2" && $1="[$]$1 $4/$2/$3/$2"
417 dnl ---------------------------------------------------------------------------
418 dnl CF_APPEND_CFLAGS version: 1 updated: 2021/08/28 15:20:37
420 dnl Use CF_ADD_CFLAGS after first checking for potential redefinitions.
421 dnl $1 = flags to add
422 dnl $2 = if given makes this macro verbose.
423 define([CF_APPEND_CFLAGS],
425 for cf_add_cflags in $1
427 CF_REMOVE_CFLAGS($cf_add_cflags,CFLAGS,[$2])
428 CF_REMOVE_CFLAGS($cf_add_cflags,CPPFLAGS,[$2])
430 CF_ADD_CFLAGS([$1],[$2])
432 dnl ---------------------------------------------------------------------------
433 dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55
435 dnl use this macro for appending text without introducing an extra blank at
437 define([CF_APPEND_TEXT],
439 test -n "[$]$1" && $1="[$]$1 "
442 dnl ---------------------------------------------------------------------------
443 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
445 dnl Allow user to disable a normally-on option.
446 AC_DEFUN([CF_ARG_DISABLE],
447 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
448 dnl ---------------------------------------------------------------------------
449 dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
451 dnl Allow user to enable a normally-off option.
452 AC_DEFUN([CF_ARG_ENABLE],
453 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
454 dnl ---------------------------------------------------------------------------
455 dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14
457 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
463 dnl $3 = action to perform if option is not default
464 dnl $4 = action if perform if option is default
465 dnl $5 = default option value (either 'yes' or 'no')
466 AC_DEFUN([CF_ARG_OPTION],
467 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
468 if test "$enableval" != "$5" ; then
470 ,[ $3]) ifelse([$4],,,[
473 fi],[enableval=$5 ifelse([$4],,,[
477 dnl ---------------------------------------------------------------------------
478 dnl CF_AR_FLAGS version: 9 updated: 2021/01/01 13:31:04
480 dnl Check for suitable "ar" (archiver) options for updating an archive.
482 dnl In particular, handle some obsolete cases where the "-" might be omitted,
483 dnl as well as a workaround for breakage of make's archive rules by the GNU
484 dnl binutils "ar" program.
485 AC_DEFUN([CF_AR_FLAGS],[
486 AC_REQUIRE([CF_PROG_AR])
488 AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[
489 case "$cf_cv_system_name" in
492 cat >mk_static_lib.sh <<-EOF
497 exec \[$]MSVC_BIN -out:"\[$]out" \[$]@
499 chmod +x mk_static_lib.sh
500 AR=`pwd`/mk_static_lib.sh
503 cf_cv_ar_flags=unknown
504 for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv
507 # check if $ARFLAGS already contains this choice
508 if test "x$ARFLAGS" != "x" ; then
509 cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"`
510 if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then
516 rm -f "conftest.$ac_cv_objext"
519 cat >"conftest.$ac_ext" <<EOF
520 #line __oline__ "configure"
521 int testdata[[3]] = { 123, 456, 789 };
523 if AC_TRY_EVAL(ac_compile) ; then
524 echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC
525 $AR $ARFLAGS "$cf_ar_flags" conftest.a "conftest.$ac_cv_objext" 2>&AC_FD_CC 1>/dev/null
526 if test -f conftest.a ; then
527 cf_cv_ar_flags="$cf_ar_flags"
531 CF_VERBOSE(cannot compile test-program)
535 rm -f conftest.a "conftest.$ac_ext" "conftest.$ac_cv_objext"
540 if test -n "$ARFLAGS" ; then
541 if test -n "$cf_cv_ar_flags" ; then
542 ARFLAGS="$ARFLAGS $cf_cv_ar_flags"
545 ARFLAGS=$cf_cv_ar_flags
550 dnl ---------------------------------------------------------------------------
551 dnl CF_AWK_BIG_PRINTF version: 5 updated: 2015/04/17 21:13:04
552 dnl -----------------
553 dnl Check if awk can handle big strings using printf. Some older versions of
554 dnl awk choke on large strings passed via "%s".
556 dnl $1 = desired string size
557 dnl $2 = variable to set with result
558 AC_DEFUN([CF_AWK_BIG_PRINTF],
565 if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' 2>/dev/null \
566 | $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
574 dnl ---------------------------------------------------------------------------
575 dnl CF_BOOL_DECL version: 8 updated: 2004/01/30 15:51:18
577 dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
578 dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
579 dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
581 dnl Treat the configuration-variable specially here, since we're directly
582 dnl substituting its value (i.e., 1/0).
584 dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool
585 AC_DEFUN([CF_BOOL_DECL],
587 AC_MSG_CHECKING(if we should include stdbool.h)
589 AC_CACHE_VAL(cf_cv_header_stdbool_h,[
590 AC_TRY_COMPILE([],[bool foo = false],
591 [cf_cv_header_stdbool_h=0],
596 ],[bool foo = false],
597 [cf_cv_header_stdbool_h=1],
598 [cf_cv_header_stdbool_h=0])])])
600 if test "$cf_cv_header_stdbool_h" = 1
601 then AC_MSG_RESULT(yes)
602 else AC_MSG_RESULT(no)
605 AC_MSG_CHECKING([for builtin bool type])
607 AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
610 #include <sys/types.h>
612 [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
613 [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
616 if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
617 then AC_MSG_RESULT(yes)
618 else AC_MSG_RESULT(no)
621 dnl ---------------------------------------------------------------------------
622 dnl CF_BOOL_SIZE version: 17 updated: 2020/10/24 19:48:55
624 dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
625 dnl Don't bother looking for bool.h, since it's been deprecated.
627 dnl If the current compiler is C rather than C++, we get the bool definition
628 dnl from <stdbool.h>.
629 AC_DEFUN([CF_BOOL_SIZE],
631 AC_CHECK_SIZEOF(bool,,[
635 #if defined(__cplusplus)
637 #ifdef HAVE_GXX_BUILTIN_H
638 #include <g++/builtin.h>
639 #elif HAVE_GPP_BUILTIN_H
640 #include <gpp/builtin.h>
647 #if $cf_cv_header_stdbool_h
654 AC_CACHE_CHECK(for type of bool, cf_cv_type_of_bool,[
660 #if defined(__cplusplus)
662 #ifdef HAVE_GXX_BUILTIN_H
663 #include <g++/builtin.h>
664 #elif HAVE_GPP_BUILTIN_H
665 #include <gpp/builtin.h>
672 #if $cf_cv_header_stdbool_h
680 FILE *fp = fopen("cf_test.out", "w");
684 fputs("unsigned ", fp);
685 if (sizeof(x) == sizeof(int)) fputs("int", fp);
686 else if (sizeof(x) == sizeof(char)) fputs("char", fp);
687 else if (sizeof(x) == sizeof(short))fputs("short",fp);
688 else if (sizeof(x) == sizeof(long)) fputs("long", fp);
691 ${cf_cv_main_return:-return}(0);
694 [cf_cv_type_of_bool=`cat cf_test.out`
695 if test -z "$cf_cv_type_of_bool"; then
696 cf_cv_type_of_bool=unknown
698 [cf_cv_type_of_bool=unknown],
700 case x$ac_cv_sizeof_bool in
701 (x1) cf_cv_type_of_bool="unsigned char";;
702 (x2) cf_cv_type_of_bool="unsigned short";;
703 (x4) cf_cv_type_of_bool="unsigned int";;
704 (x8) cf_cv_type_of_bool="unsigned long";;
705 (*) cf_cv_type_of_bool=unknown;;
711 if test "$cf_cv_type_of_bool" = unknown ; then
712 case .$NCURSES_BOOL in
713 (.auto|.) NCURSES_BOOL=unsigned;;
715 AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool)
716 cf_cv_type_of_bool=$NCURSES_BOOL
719 dnl ---------------------------------------------------------------------------
720 dnl CF_BUILD_CC version: 9 updated: 2021/01/02 09:31:20
722 dnl If we're cross-compiling, allow the user to override the tools and their
723 dnl options. The configure script is oriented toward identifying the host
724 dnl compiler, etc., but we need a build compiler to generate parts of the
727 dnl $1 = default for $CPPFLAGS
728 dnl $2 = default for $LIBS
729 AC_DEFUN([CF_BUILD_CC],[
730 CF_ACVERSION_CHECK(2.52,,
731 [AC_REQUIRE([CF_PROG_EXT])])
732 if test "$cross_compiling" = yes ; then
734 # defaults that we might want to override
735 : ${BUILD_CFLAGS:=''}
736 : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
737 : ${BUILD_LDFLAGS:=''}
738 : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
739 : ${BUILD_EXEEXT:='$x'}
740 : ${BUILD_OBJEXT:='o'}
742 AC_ARG_WITH(build-cc,
743 [ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
744 [BUILD_CC="$withval"],
745 [AC_CHECK_PROGS(BUILD_CC, [gcc clang c99 c89 cc cl],none)])
746 AC_MSG_CHECKING(for native build C compiler)
747 AC_MSG_RESULT($BUILD_CC)
749 AC_MSG_CHECKING(for native build C preprocessor)
750 AC_ARG_WITH(build-cpp,
751 [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
752 [BUILD_CPP="$withval"],
753 [BUILD_CPP='${BUILD_CC} -E'])
754 AC_MSG_RESULT($BUILD_CPP)
756 AC_MSG_CHECKING(for native build C flags)
757 AC_ARG_WITH(build-cflags,
758 [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
759 [BUILD_CFLAGS="$withval"])
760 AC_MSG_RESULT($BUILD_CFLAGS)
762 AC_MSG_CHECKING(for native build C preprocessor-flags)
763 AC_ARG_WITH(build-cppflags,
764 [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
765 [BUILD_CPPFLAGS="$withval"])
766 AC_MSG_RESULT($BUILD_CPPFLAGS)
768 AC_MSG_CHECKING(for native build linker-flags)
769 AC_ARG_WITH(build-ldflags,
770 [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
771 [BUILD_LDFLAGS="$withval"])
772 AC_MSG_RESULT($BUILD_LDFLAGS)
774 AC_MSG_CHECKING(for native build linker-libraries)
775 AC_ARG_WITH(build-libs,
776 [ --with-build-libs=XXX the build libraries (${BUILD_LIBS})],
777 [BUILD_LIBS="$withval"])
778 AC_MSG_RESULT($BUILD_LIBS)
780 # this assumes we're on Unix.
784 : ${BUILD_CC:='${CC}'}
786 if { test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}'; } ; then
787 AC_MSG_ERROR([Cross-build requires two compilers.
788 Use --with-build-cc to specify the native compiler.])
792 : ${BUILD_CC:='${CC}'}
793 : ${BUILD_CPP:='${CPP}'}
794 : ${BUILD_CFLAGS:='${CFLAGS}'}
795 : ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
796 : ${BUILD_LDFLAGS:='${LDFLAGS}'}
797 : ${BUILD_LIBS:='${LIBS}'}
798 : ${BUILD_EXEEXT:='$x'}
799 : ${BUILD_OBJEXT:='o'}
804 AC_SUBST(BUILD_CFLAGS)
805 AC_SUBST(BUILD_CPPFLAGS)
806 AC_SUBST(BUILD_LDFLAGS)
808 AC_SUBST(BUILD_EXEEXT)
809 AC_SUBST(BUILD_OBJEXT)
811 dnl ---------------------------------------------------------------------------
812 dnl CF_C11_NORETURN version: 3 updated: 2021/03/28 11:36:23
814 AC_DEFUN([CF_C11_NORETURN],
816 AC_MSG_CHECKING(if you want to use C11 _Noreturn feature)
817 CF_ARG_ENABLE(stdnoreturn,
818 [ --enable-stdnoreturn enable C11 _Noreturn feature for diagnostics],
819 [enable_stdnoreturn=yes],
820 [enable_stdnoreturn=no])
821 AC_MSG_RESULT($enable_stdnoreturn)
823 if test $enable_stdnoreturn = yes; then
824 AC_CACHE_CHECK([for C11 _Noreturn feature], cf_cv_c11_noreturn,
828 #include <stdnoreturn.h>
829 static _Noreturn void giveup(void) { exit(0); }
831 [if (feof(stdin)) giveup()],
832 cf_cv_c11_noreturn=yes,
833 cf_cv_c11_noreturn=no)
836 cf_cv_c11_noreturn=no,
839 if test "$cf_cv_c11_noreturn" = yes; then
840 AC_DEFINE(HAVE_STDNORETURN_H, 1,[Define if <stdnoreturn.h> header is available and working])
841 AC_DEFINE_UNQUOTED(STDC_NORETURN,_Noreturn,[Define if C11 _Noreturn keyword is supported])
847 AC_SUBST(HAVE_STDNORETURN_H)
848 AC_SUBST(STDC_NORETURN)
850 dnl ---------------------------------------------------------------------------
851 dnl CF_CC_ENV_FLAGS version: 10 updated: 2020/12/31 18:40:20
853 dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
854 dnl into CC. This will not help with broken scripts that wrap the compiler
855 dnl with options, but eliminates a more common category of user confusion.
857 dnl In particular, it addresses the problem of being able to run the C
858 dnl preprocessor in a consistent manner.
860 dnl Caveat: this also disallows blanks in the pathname for the compiler, but
861 dnl the nuisance of having inconsistent settings for compiler and preprocessor
862 dnl outweighs that limitation.
863 AC_DEFUN([CF_CC_ENV_FLAGS],
865 # This should have been defined by AC_PROG_CC
868 AC_MSG_CHECKING(\$CFLAGS variable)
871 AC_MSG_RESULT(broken)
872 AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options)
875 for cf_arg in $cf_flags
877 CF_ADD_CFLAGS($cf_arg)
885 AC_MSG_CHECKING(\$CC variable)
888 AC_MSG_RESULT(broken)
889 AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options)
891 cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'`
892 cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'`
894 for cf_arg in $cf_flags
898 CF_ADD_CFLAGS($cf_arg)
905 CF_VERBOSE(resulting CC: '$CC')
906 CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
907 CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
914 dnl ---------------------------------------------------------------------------
915 dnl CF_CFG_DEFAULTS version: 16 updated: 2021/01/04 19:33:05
917 dnl Determine the default configuration into which we'll install ncurses. This
918 dnl can be overridden by the user's command-line options. There's two items to
920 dnl 1. the prefix (e.g., /usr)
921 dnl 2. the header files (e.g., /usr/include/ncurses)
922 dnl We'll look for a previous installation of ncurses and use the same defaults.
924 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
925 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
926 dnl programs from a vendor's.
927 AC_DEFUN([CF_CFG_DEFAULTS],
928 [AC_REQUIRE([AC_PROG_FGREP])dnl
930 AC_MSG_CHECKING(for prefix)
931 if test "x$prefix" = "xNONE" ; then
932 case "$cf_cv_system_name" in
933 # non-vendor systems don't have a conflict
934 (openbsd*|freebsd*|mirbsd*|linux*|cygwin*|msys*|k*bsd*-gnu|mingw*)
937 (*) prefix=$ac_default_prefix
941 AC_MSG_RESULT($prefix)
943 if test "x$prefix" = "xNONE" ; then
944 AC_MSG_CHECKING(for default include-directory)
945 test -n "$verbose" && echo 1>&AC_FD_MSG
948 "$includedir/ncurses" \
950 "$prefix/include/ncurses" \
952 /usr/local/include/ncurses \
956 cf_dir=`eval echo "$cf_symbol"`
957 if test -f "$cf_dir/curses.h" ; then
958 if ( ${FGREP-fgrep} NCURSES_VERSION "$cf_dir/curses.h" >/dev/null 2>&1 ) ; then
959 includedir="$cf_symbol"
960 test -n "$verbose" && echo $ECHO_N " found " 1>&AC_FD_MSG
964 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
966 AC_MSG_RESULT($includedir)
969 dnl ---------------------------------------------------------------------------
970 dnl CF_CGETENT version: 6 updated: 2017/01/21 11:06:25
972 dnl Check if the terminal-capability database functions are available. If not,
973 dnl ncurses has a much-reduced version.
974 AC_DEFUN([CF_CGETENT],[
975 AC_CACHE_CHECK(for terminal-capability database functions,cf_cv_cgetent,[
977 #include <stdlib.h>],[
980 char *db_array = temp;
981 cgetent(&buf, &db_array, "vt100");
982 cgetcap(buf, "tc", '=');
983 cgetmatch(buf, "tc");
989 if test "$cf_cv_cgetent" = yes
991 AC_DEFINE(HAVE_BSD_CGETENT,1,[Define to 1 if we have BSD cgetent])
992 AC_CACHE_CHECK(if cgetent uses const parameter,cf_cv_cgetent_const,[
994 #pragma GCC diagnostic error "-Wincompatible-pointer-types-discards-qualifiers"
995 #include <stdlib.h>],[
998 #ifndef _NETBSD_SOURCE /* given, since April 2004 in stdlib.h */
999 const char *db_array = temp;
1000 cgetent(&buf, &db_array, "vt100");
1002 cgetcap(buf, "tc", '=');
1003 cgetmatch(buf, "tc");
1005 [cf_cv_cgetent_const=yes],
1006 [cf_cv_cgetent_const=no])
1008 if test "$cf_cv_cgetent_const" = yes
1010 AC_DEFINE_UNQUOTED(CGETENT_CONST,const,[Define to const if needed for some BSD cgetent variations])
1014 dnl ---------------------------------------------------------------------------
1015 dnl CF_CHECK_CACHE version: 13 updated: 2020/12/31 10:54:15
1017 dnl Check if we're accidentally using a cache from a different machine.
1018 dnl Derive the system name, as a check for reusing the autoconf cache.
1020 dnl If we've packaged config.guess and config.sub, run that (since it does a
1021 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
1022 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
1023 dnl which is useful in cross-compiles.
1025 dnl Note: we would use $ac_config_sub, but that is one of the places where
1026 dnl autoconf 2.5x broke compatibility with autoconf 2.13
1027 AC_DEFUN([CF_CHECK_CACHE],
1029 if test -f "$srcdir/config.guess" || test -f "$ac_aux_dir/config.guess" ; then
1030 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
1031 system_name="$host_os"
1033 system_name="`(uname -s -r) 2>/dev/null`"
1034 if test -z "$system_name" ; then
1035 system_name="`(hostname) 2>/dev/null`"
1038 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
1039 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
1041 test -z "$system_name" && system_name="$cf_cv_system_name"
1042 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
1044 if test ".$system_name" != ".$cf_cv_system_name" ; then
1045 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
1046 AC_MSG_ERROR("Please remove config.cache and try again.")
1049 dnl ---------------------------------------------------------------------------
1050 dnl CF_CHECK_ENVIRON version: 3 updated: 2010/05/26 16:44:57
1051 dnl ----------------
1052 dnl Check for data that is usually declared in <unistd.h>, e.g., the 'environ'
1053 dnl variable. Define a DECL_xxx symbol if we must declare it ourselves.
1055 dnl $1 = the name to check
1056 dnl $2 = the assumed type
1057 AC_DEFUN([CF_CHECK_ENVIRON],
1059 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
1061 #ifdef HAVE_STDLIB_H
1064 #include <unistd.h> ],
1065 ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1,
1070 if test "$cf_cv_dcl_$1" = no ; then
1071 CF_UPPER(cf_result,decl_$1)
1072 AC_DEFINE_UNQUOTED($cf_result)
1075 # It's possible (for near-UNIX clones) that the data doesn't exist
1076 CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
1078 dnl ---------------------------------------------------------------------------
1079 dnl CF_CHECK_ERRNO version: 13 updated: 2020/03/10 18:53:47
1081 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
1082 dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
1085 dnl $1 = the name to check
1086 dnl $2 = the assumed type
1087 AC_DEFUN([CF_CHECK_ERRNO],
1089 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
1091 #ifdef HAVE_STDLIB_H
1095 #include <sys/types.h>
1096 #include <errno.h> ],
1097 ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1; (void)x,
1102 if test "$cf_cv_dcl_$1" = no ; then
1103 CF_UPPER(cf_result,decl_$1)
1104 AC_DEFINE_UNQUOTED($cf_result)
1107 # It's possible (for near-UNIX clones) that the data doesn't exist
1108 CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
1110 dnl ---------------------------------------------------------------------------
1111 dnl CF_CHECK_EXTERN_DATA version: 4 updated: 2015/04/18 08:56:57
1112 dnl --------------------
1113 dnl Check for existence of external data in the current set of libraries. If
1114 dnl we can modify it, it's real enough.
1115 dnl $1 = the name to check
1117 AC_DEFUN([CF_CHECK_EXTERN_DATA],
1119 AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
1125 [cf_cv_have_$1=yes],
1129 if test "$cf_cv_have_$1" = yes ; then
1130 CF_UPPER(cf_result,have_$1)
1131 AC_DEFINE_UNQUOTED($cf_result)
1135 dnl ---------------------------------------------------------------------------
1136 dnl CF_CHECK_FVISIBILITY version: 2 updated: 2020/04/04 16:16:13
1137 dnl --------------------
1138 dnl Check whether the compiler understands -fvisibility=hidden
1141 dnl $2 = compiler-flags variable name
1142 dnl $3 = cache variable to set
1143 AC_DEFUN([CF_CHECK_FVISIBILITY],[
1144 AC_CACHE_CHECK(if $1 -fvisibility=hidden option works,$3,[
1145 cf_save_cflags="[$]$2"
1146 $2="[$]$2 -fvisibility=hidden"
1148 __attribute__ ((visibility("default"))) int somefunc() {return 42;}
1150 if (somefunc()) return 1;
1157 dnl ---------------------------------------------------------------------------
1158 dnl CF_CHECK_GETENV version: 2 updated: 2021/01/02 17:09:14
1160 dnl Check if repeated getenv calls return the same pointer, e.g., it does not
1161 dnl discard the previous pointer when returning a new one.
1162 AC_DEFUN([CF_CHECK_GETENV],
1164 AC_REQUIRE([CF_CHECK_ENVIRON])
1165 AC_CHECK_FUNC( getenv, ,, AC_MSG_ERROR(getenv not found) )
1166 AC_CHECK_FUNCS( putenv setenv strdup )
1167 AC_CACHE_CHECK(if getenv returns consistent values,cf_cv_consistent_getenv,[
1173 #include <sys/types.h>
1175 #if defined(HAVE_ENVIRON) && defined(DECL_ENVIRON) && !defined(environ)
1176 extern char **environ; /* POSIX, but some systems are not... */
1179 #if defined(HAVE_STRDUP)
1180 #define str_alloc(s) strdup(s)
1182 #define str_alloc(s) strcpy(malloc(strlen(s) + 1, s))
1185 static void set_value(const char *name, const char *value)
1187 #if defined(HAVE_SETENV)
1188 setenv(name, value, 1);
1189 #elif defined(HAVE_PUTENV)
1191 sprintf(buffer, "%s=%s", name, value);
1192 putenv(str_alloc(buffer));
1194 #error neither putenv/setenv found
1200 size_t numenv, limit, j;
1205 for (numenv = 0; environ[numenv]; ++numenv) ;
1206 limit = numenv + 10;
1207 mynames = (char **) calloc(limit + 1, sizeof(char *));
1208 myvalues = (char **) calloc(limit + 1, sizeof(char *));
1209 mypointer = (char **) calloc(limit + 1, sizeof(char *));
1210 #if defined(HAVE_ENVIRON)
1211 for (j = 0; environ[j]; ++j) {
1212 mynames[j] = str_alloc(environ[j]);
1213 equals = strchr(mynames[j], '=');
1216 myvalues[j] = str_alloc(equals);
1218 myvalues[j] = str_alloc("");
1222 for (j = numenv; j < limit; ++j) {
1230 sprintf(name, "TERM%lu", (unsigned long) k);
1231 for (jk = 0; jk < j; ++jk) {
1232 if (!strcmp(name, mynames[jk])) {
1239 sprintf(value, "%lu:%p", (unsigned long) k, &mynames[j]);
1240 set_value(name, value);
1241 mynames[j] = str_alloc(name);
1242 myvalues[j] = str_alloc(value);
1244 for (pass = 0; pass < 3; ++pass) {
1245 for (j = 0; j < limit; ++j) {
1246 char *value = getenv(mynames[j]);
1249 fprintf(stderr, "getenv returned null for %s\\n", mynames[j]);
1250 ${cf_cv_main_return:-return}(1);
1251 } else if (value != mypointer[j]) {
1252 fprintf(stderr, "getenv returned different pointer for %s\\n", mynames[j]);
1253 ${cf_cv_main_return:-return}(1);
1254 } else if (strcmp(value, myvalues[j])) {
1255 fprintf(stderr, "getenv returned different value for %s\\n", mynames[j]);
1256 ${cf_cv_main_return:-return}(1);
1260 mypointer[j] = value;
1261 for (k = 0; k < j; ++k) {
1262 if (mypointer[j] == mypointer[k]) {
1263 fprintf(stderr, "getenv returned same pointer for %s and %s\\n", mynames[j], mynames[k]);
1264 ${cf_cv_main_return:-return}(1);
1270 ${cf_cv_main_return:-return}(0);
1273 [cf_cv_consistent_getenv=yes],
1274 [cf_cv_consistent_getenv=no],
1275 [cf_cv_consistent_getenv=unknown])
1278 if test "x$cf_cv_consistent_getenv" = xno
1280 AC_DEFINE(HAVE_CONSISTENT_GETENV,1,[Define to 1 if getenv repeatably returns the same value for a given name])
1283 dnl ---------------------------------------------------------------------------
1284 dnl CF_CHECK_GNAT_VERSION version: 4 updated: 2021/01/01 13:31:04
1285 dnl ---------------------
1286 AC_DEFUN([CF_CHECK_GNAT_VERSION],
1288 AC_REQUIRE([CF_GNAT_VERSION])
1289 case "$cf_cv_gnat_version" in
1290 (3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|[[1-9]][[0-9]].[[0-9]]*|20[[0-9]][[0-9]])
1291 cf_cv_prog_gnat_correct=yes
1294 AC_MSG_WARN(Unsupported GNAT version $cf_cv_gnat_version. We require 3.11 or better. Disabling Ada95 binding.)
1295 cf_cv_prog_gnat_correct=no
1299 dnl ---------------------------------------------------------------------------
1300 dnl CF_CHECK_GPM_WGETCH version: 6 updated: 2021/01/04 18:48:01
1301 dnl -------------------
1302 dnl Check if GPM is already linked with curses. If so - and if the linkage
1303 dnl is not "weak" - warn about this because it can create problems linking
1304 dnl applications with ncurses.
1305 AC_DEFUN([CF_CHECK_GPM_WGETCH],[
1306 AC_REQUIRE([AC_PROG_EGREP])dnl
1308 AC_CHECK_LIB(gpm,Gpm_Wgetch,[
1310 AC_CACHE_CHECK(if GPM is weakly bound to curses library, cf_cv_check_gpm_wgetch,[
1311 cf_cv_check_gpm_wgetch=unknown
1312 if test "$cross_compiling" != yes ; then
1314 cat >conftest.$ac_ext <<CF_EOF
1319 ${cf_cv_main_return:-return}(0);
1323 cf_save_LIBS="$LIBS"
1324 # This only works if we can look at the symbol table. If a shared
1325 # library is stripped for install, we cannot use that. So we're forced
1326 # to rely on the static library, noting that some packagers may not
1328 LIBS="-static -lgpm -dynamic $LIBS"
1329 if AC_TRY_EVAL(ac_compile) ; then
1330 if AC_TRY_EVAL(ac_link) ; then
1331 cf_cv_check_gpm_wgetch="`nm \"conftest$ac_exeext\" | ${EGREP-egrep} '\<wgetch\>' | ${EGREP-egrep} '\<[[vVwW]]\>'`"
1332 test -n "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=yes
1333 test -z "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=no
1337 LIBS="$cf_save_LIBS"
1341 if test "$cf_cv_check_gpm_wgetch" != yes ; then
1342 AC_MSG_WARN(GPM library is already linked with curses - read the FAQ)
1345 dnl ---------------------------------------------------------------------------
1346 dnl CF_CHECK_LIBTOOL_VERSION version: 2 updated: 2021/05/01 16:24:34
1347 dnl ------------------------
1348 dnl Show the version of libtool
1350 dnl Save the version in a cache variable - this is not entirely a good thing,
1351 dnl but the version string from libtool is very ugly, and for bug reports it
1352 dnl might be useful to have the original string.
1354 dnl There is an imitation in OpenBSD, which has no apparent use other than to
1355 dnl deny that it is GNU libtool. Just ignore it.
1356 AC_DEFUN([CF_CHECK_LIBTOOL_VERSION],[
1357 if test -n "$LIBTOOL" && test "$LIBTOOL" != none
1359 AC_MSG_CHECKING(version of $LIBTOOL)
1361 AC_MSG_RESULT($cf_cv_libtool_version)
1362 if test -n "$cf_cv_libtool_version"
1364 cf_check_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' -e 's,[[()]],...,g' -e 's,[[ ]],-,g' -e '2,$d'`
1365 case "x$cf_check_libtool_version" in
1366 (*...GNU-libtool...*)
1369 AC_MSG_ERROR(This is not GNU libtool)
1373 AC_MSG_ERROR(No version found for $LIBTOOL)
1376 AC_MSG_ERROR(GNU libtool has not been found)
1379 dnl ---------------------------------------------------------------------------
1380 dnl CF_CHECK_WCHAR_H version: 3 updated: 2021/01/01 13:31:04
1381 dnl ----------------
1382 dnl Check if wchar.h can be used, i.e., without defining _XOPEN_SOURCE_EXTENDED
1383 AC_DEFUN([CF_CHECK_WCHAR_H],[
1388 AC_CACHE_CHECK(if wchar.h can be used as is,cf_cv_wchar_h_okay,[
1395 #ifdef HAVE_WCTYPE_H
1400 int bar = iswpunct(foo)],
1401 [cf_cv_wchar_h_okay=yes],
1402 [cf_cv_wchar_h_okay=no])])
1404 if test "$cf_cv_wchar_h_okay" = no
1406 CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED)
1409 dnl ---------------------------------------------------------------------------
1410 dnl CF_CHECK_WCWIDTH_GRAPHICS version: 2 updated: 2021/01/02 17:09:14
1411 dnl -------------------------
1412 dnl Most "modern" terminal emulators are based to some degree on VT100, and
1413 dnl should support line-drawing. Even with Unicode. There is a problem.
1415 dnl While most of the VT100 graphics characters were incorporated into Unicode,
1416 dnl all of those were combined into a page of useful graphics characters.
1418 dnl So far, so good.
1420 dnl However, while they are useful, there are other considerations. CJK
1421 dnl is (because of poor device resolution) often rendered as double-width
1422 dnl characters. So... for these generally-useful characters, what should
1423 dnl be the width (to make them consistent with adjacent characters)?
1425 dnl The obvious choice would have been to make this locale-dependent, and use
1426 dnl wcwidth() to tell applications what the actual width is. That was too
1427 dnl obvious. Instead, we have a slew of "ambiguous-width" characters.
1429 dnl http://www.unicode.org/reports/tr11/tr11-29.html
1430 dnl http://www.cl.cam.ac.uk/~mgk25/ucs/scw-proposal.html
1432 dnl The EastAsianWidth-6.2.0.txt file from the Unicode organization lists
1433 dnl more than 22,000 characters, with 1281 of those as ambiguous-width. For
1434 dnl instance, it lists half (44/96) of the Latin-1 characters as
1435 dnl ambiguous-width. Also, all of the box-characters at 0x2500 are ambiguous.
1437 dnl What this means for the implementor is that on some systems wcwidth() can
1438 dnl give bad advice. On Solaris, some of the ambiguous widths are returned as
1439 dnl 1 (the Latin-1 characters), while others are returned as 2 (line-drawing
1440 dnl characters). These do not necessarily match the behavior of the terminal
1441 dnl emulator. xterm, for instance, does an optional startup check to find if
1442 dnl this problem (or similar) exists with the system's locale tables, rejecting
1443 dnl them if they are too unreliable.
1444 AC_DEFUN([CF_CHECK_WCWIDTH_GRAPHICS],[
1445 AC_CACHE_CHECK(if wcwidth agrees graphics are single-width, cf_cv_wcwidth_graphics,[
1446 cat >conftest.in <<CF_EOF
1448 0x250c upper left corner
1449 0x2514 lower left corner
1450 0x2510 upper right corner
1451 0x2518 lower right corner
1452 0x251c tee pointing left
1453 0x2524 tee pointing right
1454 0x2534 tee pointing up
1455 0x252c tee pointing down
1456 0x2500 horizontal line
1457 0x2502 vertical line
1458 0x253c large plus or crossover
1462 0x2592 checker board (stipple)
1463 0x00b0 degree symbol
1466 - Teletype 5410v1 symbols
1467 0x2190 arrow pointing left
1468 0x2192 arrow pointing right
1469 0x2193 arrow pointing down
1470 0x2191 arrow pointing up
1471 0x2592 board of squares
1472 0x2603 lantern symbol
1473 0x25ae solid square block
1474 - these defaults were invented for ncurses
1477 0x2264 less-than-or-equal-to
1478 0x2265 greater-than-or-equal-to
1481 0x00a3 pound-sterling symbol
1482 - thick-line-drawing
1483 0x250f upper left corner
1484 0x2517 lower left corner
1485 0x2513 upper right corner
1486 0x251b lower right corner
1487 0x2523 tee pointing left
1488 0x252b tee pointing right
1489 0x253b tee pointing up
1490 0x2533 tee pointing down
1491 0x2501 horizontal line
1492 0x2503 vertical line
1493 0x254b large plus or crossover
1494 - double-line-drawing
1495 0x2554 upper left corner
1496 0x255a lower left corner
1497 0x2557 upper right corner
1498 0x255d lower right corner
1499 0x2563 tee pointing left
1500 0x2560 tee pointing right
1501 0x2569 tee pointing up
1502 0x2566 tee pointing down
1503 0x2550 horizontal line
1504 0x2551 vertical line
1505 0x256c large plus or crossover
1519 char buffer[MY_LEN + 1];
1520 char notes[MY_LEN + 1];
1524 if (setlocale(LC_ALL, "en_US.UTF8") ||
1525 setlocale(LC_ALL, "en_US.UTF-8") ||
1526 setlocale(LC_ALL, "en_US.utf8") ||
1527 setlocale(LC_ALL, "en_US.utf-8")) {
1528 if ((fp = fopen("conftest.in", "r")) != 0) {
1529 while (fgets(buffer, MY_LEN, fp) != 0) {
1530 if (*buffer == '-') {
1531 fprintf(stderr, "\\t%s", buffer);
1532 } else if (sscanf(buffer, "%x %s", &value, notes) == 2) {
1534 if (wcwidth(value) == 1)
1536 fprintf(stderr, "%d\\t%s", wcwidth(value), buffer);
1538 fprintf(stderr, "?\\t%s", buffer);
1543 fprintf(stderr, "%d/%d passed wcwidth/graphics check\\n", passed, totals);
1544 return (totals == passed) ? 0 : 1;
1547 [cf_cv_wcwidth_graphics=yes],
1548 [cf_cv_wcwidth_graphics=no],
1549 [cf_cv_wcwidth_graphics=unknown])
1552 dnl ---------------------------------------------------------------------------
1553 dnl CF_CLANG_COMPILER version: 8 updated: 2021/01/01 13:31:04
1554 dnl -----------------
1555 dnl Check if the given compiler is really clang. clang's C driver defines
1556 dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
1557 dnl not ignore some gcc options.
1559 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1560 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1561 dnl the wrappers for gcc and g++ warnings.
1563 dnl $1 = GCC (default) or GXX
1564 dnl $2 = CLANG_COMPILER (default)
1565 dnl $3 = CFLAGS (default) or CXXFLAGS
1566 AC_DEFUN([CF_CLANG_COMPILER],[
1567 ifelse([$2],,CLANG_COMPILER,[$2])=no
1569 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
1570 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
1571 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1577 ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
1579 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1580 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
1585 if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then
1587 (c[[1-9]][[0-9]]|*/c[[1-9]][[0-9]])
1588 AC_MSG_WARN(replacing broken compiler alias $CC)
1589 CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`"
1594 AC_MSG_CHECKING(version of $CC)
1595 CLANG_VERSION="`$CC --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(CLANG[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1596 test -z "$CLANG_VERSION" && CLANG_VERSION=unknown
1597 AC_MSG_RESULT($CLANG_VERSION)
1599 for cf_clang_opt in \
1600 -Qunused-arguments \
1601 -Wno-error=implicit-function-declaration
1603 AC_MSG_CHECKING(if option $cf_clang_opt works)
1604 cf_save_CFLAGS="$CFLAGS"
1605 CFLAGS="$CFLAGS $cf_clang_opt"
1607 #include <stdio.h>],[
1608 printf("hello!\\n");],[
1609 cf_clang_optok=yes],[
1611 AC_MSG_RESULT($cf_clang_optok)
1612 CFLAGS="$cf_save_CFLAGS"
1613 if test "$cf_clang_optok" = yes; then
1614 CF_VERBOSE(adding option $cf_clang_opt)
1615 CF_APPEND_TEXT(CFLAGS,$cf_clang_opt)
1620 dnl ---------------------------------------------------------------------------
1621 dnl CF_CONST_X_STRING version: 7 updated: 2021/06/07 17:39:17
1622 dnl -----------------
1623 dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most
1624 dnl character-strings.
1626 dnl It is ambiguous because the specification accommodated the pre-ANSI
1627 dnl compilers bundled by more than one vendor in lieu of providing a standard C
1628 dnl compiler other than by costly add-ons. Because of this, the specification
1629 dnl did not take into account the use of const for telling the compiler that
1630 dnl string literals would be in readonly memory.
1632 dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to
1633 dnl let the compiler decide how to represent Xt's strings which were #define'd.
1634 dnl That does not solve the problem of using the block of Xt's strings which
1635 dnl are compiled into the library (and is less efficient than one might want).
1637 dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both
1638 dnl when compiling the library and compiling using the library, to tell the
1639 dnl compiler that String is const.
1640 AC_DEFUN([CF_CONST_X_STRING],
1642 AC_REQUIRE([AC_PATH_XTRA])
1644 CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING])
1649 #include <X11/Intrinsic.h>
1651 [String foo = malloc(1); free((void*)foo)],[
1653 AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[
1656 #define _CONST_X_STRING /* X11R7.8 (perhaps) */
1657 #undef XTSTRINGDEFINES /* X11R5 and later */
1659 #include <X11/Intrinsic.h>
1660 ],[String foo = malloc(1); *foo = 0],[
1661 cf_cv_const_x_string=no
1663 cf_cv_const_x_string=yes
1667 CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING])
1669 case "$cf_cv_const_x_string" in
1671 CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES)
1674 CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING)
1680 dnl ---------------------------------------------------------------------------
1681 dnl CF_CPP_PARAM_INIT version: 7 updated: 2017/01/21 11:06:25
1682 dnl -----------------
1683 dnl Check if the C++ compiler accepts duplicate parameter initialization. This
1684 dnl is a late feature for the standard and is not in some recent compilers
1686 AC_DEFUN([CF_CPP_PARAM_INIT],
1688 if test -n "$CXX"; then
1689 AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[
1701 TEST::TEST(int x = 1) // some compilers do not like second initializer
1707 [cf_cv_cpp_param_init=yes],
1708 [cf_cv_cpp_param_init=no],
1709 [cf_cv_cpp_param_init=unknown])
1713 test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT,1,[Define to 1 if C++ has parameter initialization])
1715 dnl ---------------------------------------------------------------------------
1716 dnl CF_CPP_STATIC_CAST version: 3 updated: 2013/04/13 18:03:21
1717 dnl ------------------
1718 dnl Check if the C++ compiler accepts static_cast in generics. This appears to
1719 dnl not be supported in g++ before 3.0
1720 AC_DEFUN([CF_CPP_STATIC_CAST],
1722 if test -n "$CXX"; then
1724 AC_CACHE_CHECK(if $CXX accepts static_cast,cf_cv_cpp_static_cast,[
1732 NCursesPanel(int nlines,
1742 template<class T> class NCursesUserPanel : public NCursesPanel
1745 NCursesUserPanel (int nlines,
1749 const T* p_UserData = static_cast<T*>(0))
1750 : NCursesPanel (nlines, ncols, begin_y, begin_x)
1753 NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel()
1757 virtual ~NCursesUserPanel() {};
1760 const char* p_UserData = static_cast<char*>(0)],
1761 [cf_cv_cpp_static_cast=yes],
1762 [cf_cv_cpp_static_cast=no])
1769 test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST,1,[Define to 1 if C++ has static_cast])
1771 dnl ---------------------------------------------------------------------------
1772 dnl CF_CXX_AR_FLAGS version: 3 updated: 2021/01/01 13:31:04
1774 dnl Setup special archiver flags for given compilers.
1775 AC_DEFUN([CF_CXX_AR_FLAGS],[
1777 CXX_ARFLAGS='$(ARFLAGS)'
1778 case "$cf_cv_system_name" in
1780 if test "$GXX" != yes ; then
1782 CXX_ARFLAGS='-ar -o'
1786 CXXLDFLAGS="-u main"
1789 if test "$GXX" != yes ; then
1791 CXX_ARFLAGS='-xar -o'
1795 AC_SUBST(CXXLDFLAGS)
1797 AC_SUBST(CXX_ARFLAGS)
1799 dnl ---------------------------------------------------------------------------
1800 dnl CF_CXX_IOSTREAM_NAMESPACE version: 2 updated: 2012/10/06 17:56:13
1801 dnl -------------------------
1802 dnl For c++, check if iostream uses "std::" namespace.
1803 AC_DEFUN([CF_CXX_IOSTREAM_NAMESPACE],[
1804 AC_CHECK_HEADERS(iostream)
1805 if test x"$ac_cv_header_iostream" = xyes ; then
1806 AC_MSG_CHECKING(if iostream uses std-namespace)
1811 cerr << "testing" << endl;
1812 ],[cf_iostream_namespace=yes],[cf_iostream_namespace=no])
1813 AC_MSG_RESULT($cf_iostream_namespace)
1814 if test "$cf_iostream_namespace" = yes ; then
1815 AC_DEFINE(IOSTREAM_NAMESPACE,1,[Define to 1 if C++ has namespace iostream])
1819 dnl ---------------------------------------------------------------------------
1820 dnl CF_C_INLINE version: 6 updated: 2019/09/07 13:38:36
1822 dnl Check if the C compiler supports "inline".
1823 dnl $1 is the name of a shell variable to set if inline is supported
1824 dnl $2 is the threshold for gcc 4.x's option controlling maximum inline size
1825 AC_DEFUN([CF_C_INLINE],[
1826 AC_REQUIRE([CF_GCC_VERSION])
1829 if test "$ac_cv_c_inline" != no ; then
1831 if test "$INTEL_COMPILER" = yes
1834 elif test "$CLANG_COMPILER" = yes
1837 elif test "$GCC" = yes
1839 AC_CACHE_CHECK(if $CC supports options to tune inlining,cf_cv_gcc_inline,[
1840 cf_save_CFLAGS=$CFLAGS
1841 CFLAGS="$CFLAGS --param max-inline-insns-single=$2"
1842 AC_TRY_COMPILE([inline int foo(void) { return 1; }],
1843 [${cf_cv_main_return:-return} foo()],
1844 [cf_cv_gcc_inline=yes],
1845 [cf_cv_gcc_inline=no])
1846 CFLAGS=$cf_save_CFLAGS
1848 if test "$cf_cv_gcc_inline" = yes ; then
1849 CF_ADD_CFLAGS([--param max-inline-insns-single=$2])
1855 dnl ---------------------------------------------------------------------------
1856 dnl CF_DIRNAME version: 5 updated: 2020/12/31 20:19:42
1858 dnl "dirname" is not portable, so we fake it with a shell script.
1859 AC_DEFUN([CF_DIRNAME],[$1=`echo "$2" | sed -e 's%/[[^/]]*$%%'`])dnl
1860 dnl ---------------------------------------------------------------------------
1861 dnl CF_DIRS_TO_MAKE version: 4 updated: 2021/01/01 13:31:04
1863 AC_DEFUN([CF_DIRS_TO_MAKE],
1866 for cf_item in $cf_list_models
1868 CF_OBJ_SUBDIR($cf_item,cf_subdir)
1869 for cf_item2 in $DIRS_TO_MAKE
1871 test "$cf_item2" = "$cf_subdir" && break
1873 test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
1875 for cf_dir in $DIRS_TO_MAKE
1877 test ! -d "$cf_dir" && mkdir "$cf_dir"
1879 AC_SUBST(DIRS_TO_MAKE)
1881 dnl ---------------------------------------------------------------------------
1882 dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57
1884 dnl You can always use "make -n" to see the actual options, but it's hard to
1885 dnl pick out/analyze warning messages when the compile-line is long.
1888 dnl ECHO_LT - symbol to control if libtool is verbose
1889 dnl ECHO_LD - symbol to prefix "cc -o" lines
1890 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
1891 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
1892 dnl ECHO_CC - symbol to put before any "cc" line
1894 AC_DEFUN([CF_DISABLE_ECHO],[
1895 AC_MSG_CHECKING(if you want to see long compiling messages)
1896 CF_ARG_DISABLE(echo,
1897 [ --disable-echo do not display "compiling" commands],
1900 ECHO_LD='@echo linking [$]@;'
1901 RULE_CC='@echo compiling [$]<'
1902 SHOW_CC='@echo compiling [$]@'
1911 AC_MSG_RESULT($enableval)
1918 dnl ---------------------------------------------------------------------------
1919 dnl CF_DISABLE_GNAT_PROJECTS version: 1 updated: 2014/06/01 11:34:00
1920 dnl ------------------------
1921 AC_DEFUN([CF_DISABLE_GNAT_PROJECTS],[
1922 AC_MSG_CHECKING(if we want to use GNAT projects)
1923 CF_ARG_DISABLE(gnat-projects,
1924 [ --disable-gnat-projects test: disable GNAT projects even if usable],
1925 [enable_gnat_projects=no],
1926 [enable_gnat_projects=yes])
1927 AC_MSG_RESULT($enable_gnat_projects)
1929 dnl ---------------------------------------------------------------------------
1930 dnl CF_DISABLE_LEAKS version: 9 updated: 2021/04/03 16:41:50
1931 dnl ----------------
1932 dnl Combine no-leak checks with the libraries or tools that are used for the
1934 AC_DEFUN([CF_DISABLE_LEAKS],[
1936 AC_REQUIRE([CF_WITH_DMALLOC])
1937 AC_REQUIRE([CF_WITH_DBMALLOC])
1938 AC_REQUIRE([CF_WITH_VALGRIND])
1940 AC_MSG_CHECKING(if you want to perform memory-leak testing)
1941 AC_ARG_ENABLE(leaks,
1942 [ --disable-leaks test: free permanent memory, analyze leaks],
1943 [enable_leaks=$enableval],
1945 dnl with_no_leaks is more readable...
1946 if test "x$enable_leaks" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi
1947 AC_MSG_RESULT($with_no_leaks)
1949 if test "$enable_leaks" = no ; then
1950 AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
1951 AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
1954 dnl ---------------------------------------------------------------------------
1955 dnl CF_DISABLE_LIBTOOL_VERSION version: 3 updated: 2015/04/17 21:13:04
1956 dnl --------------------------
1957 dnl Check if we should use the libtool 1.5 feature "-version-number" instead of
1958 dnl the older "-version-info" feature. The newer feature allows us to use
1959 dnl version numbering on shared libraries which make them compatible with
1960 dnl various systems.
1961 AC_DEFUN([CF_DISABLE_LIBTOOL_VERSION],
1963 AC_MSG_CHECKING(if libtool -version-number should be used)
1964 CF_ARG_DISABLE(libtool-version,
1965 [ --disable-libtool-version enable to use libtool's incompatible naming scheme],
1966 [cf_libtool_version=no],
1967 [cf_libtool_version=yes])
1968 AC_MSG_RESULT($cf_libtool_version)
1970 if test "$cf_libtool_version" = yes ; then
1971 LIBTOOL_VERSION="-version-number"
1973 LIBTOOL_VERSION="-version-info"
1976 AC_MSG_WARN(VERSION was not set)
1979 ABI_VERSION="$VERSION"
1980 CF_VERBOSE(ABI_VERSION: $ABI_VERSION)
1983 ABI_VERSION=`echo "$VERSION" | sed -e 's/:/./g'`
1984 CF_VERBOSE(ABI_VERSION: $ABI_VERSION)
1987 AC_MSG_WARN(unexpected VERSION value: $VERSION)
1992 AC_SUBST(ABI_VERSION)
1993 AC_SUBST(LIBTOOL_VERSION)
1995 dnl ---------------------------------------------------------------------------
1996 dnl CF_DISABLE_RPATH_HACK version: 3 updated: 2021/01/05 20:14:44
1997 dnl ---------------------
1998 dnl The rpath-hack makes it simpler to build programs, particularly with the
1999 dnl *BSD ports which may have essential libraries in unusual places. But it
2000 dnl can interfere with building an executable for the base system. Use this
2001 dnl option in that case.
2002 AC_DEFUN([CF_DISABLE_RPATH_HACK],
2004 AC_MSG_CHECKING(if rpath-hack should be disabled)
2005 CF_ARG_DISABLE(rpath-hack,
2006 [ --disable-rpath-hack don't add rpath options for additional libraries],
2007 [enable_rpath_hack=no],
2008 [enable_rpath_hack=yes])
2009 dnl TODO - drop cf_disable_rpath_hack
2010 if test "x$enable_rpath_hack" = xno; then cf_disable_rpath_hack=yes; else cf_disable_rpath_hack=no; fi
2011 AC_MSG_RESULT($cf_disable_rpath_hack)
2013 if test "$enable_rpath_hack" = yes ; then
2017 dnl ---------------------------------------------------------------------------
2018 dnl CF_ENABLE_BROKEN_LINKER version: 2 updated: 2021/01/02 17:09:14
2019 dnl -----------------------
2020 dnl Some linkers cannot reference a data-only object. Cygwin used to be one.
2021 dnl This usually follows CF_LINK_DATAONLY, but is not required in case we need
2022 dnl an unconditional feature.
2023 AC_DEFUN([CF_ENABLE_BROKEN_LINKER],[
2025 AC_MSG_CHECKING(if you want broken-linker support code)
2026 AC_ARG_ENABLE(broken_linker,
2027 [ --enable-broken_linker compile with broken-linker support code],
2028 [with_broken_linker=$enableval],
2029 [with_broken_linker=no])
2030 AC_MSG_RESULT($with_broken_linker)
2032 : "${BROKEN_LINKER:=0}"
2033 if test "x$with_broken_linker" = xyes ; then
2034 AC_DEFINE(BROKEN_LINKER,1,[Define to 1 to work around linkers which cannot link data-only modules])
2037 AC_SUBST(BROKEN_LINKER)
2039 dnl ---------------------------------------------------------------------------
2040 dnl CF_ENABLE_PC_FILES version: 13 updated: 2015/11/01 05:27:39
2041 dnl ------------------
2042 dnl This is the "--enable-pc-files" option, which is available if there is a
2043 dnl pkg-config configuration on the local machine.
2044 AC_DEFUN([CF_ENABLE_PC_FILES],[
2045 AC_REQUIRE([CF_PKG_CONFIG])
2046 AC_REQUIRE([CF_WITH_PKG_CONFIG_LIBDIR])
2048 if test "x$PKG_CONFIG" != xnone
2050 AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG)
2052 AC_MSG_CHECKING(if we should install .pc files)
2055 AC_ARG_ENABLE(pc-files,
2056 [ --enable-pc-files generate and install .pc files for pkg-config],
2057 [enable_pc_files=$enableval],
2058 [enable_pc_files=no])
2059 AC_MSG_RESULT($enable_pc_files)
2061 if test "x$enable_pc_files" != xno
2064 case "x$PKG_CONFIG_LIBDIR" in
2066 AC_MSG_WARN(no PKG_CONFIG_LIBDIR was found)
2069 CF_PATH_SYNTAX(PKG_CONFIG_LIBDIR)
2075 AC_SUBST(MAKE_PC_FILES)
2077 dnl ---------------------------------------------------------------------------
2078 dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42
2080 dnl Check if the rpath option should be used, setting cache variable
2081 dnl cf_cv_enable_rpath if so.
2082 AC_DEFUN([CF_ENABLE_RPATH],
2084 AC_MSG_CHECKING(if rpath option should be used)
2085 AC_ARG_ENABLE(rpath,
2086 [ --enable-rpath use rpath option when generating shared libraries],
2087 [cf_cv_enable_rpath=$enableval],
2088 [cf_cv_enable_rpath=no])
2089 AC_MSG_RESULT($cf_cv_enable_rpath)
2091 dnl ---------------------------------------------------------------------------
2092 dnl CF_ENABLE_STRING_HACKS version: 6 updated: 2021/01/05 19:23:48
2093 dnl ----------------------
2094 dnl On a few platforms, the compiler and/or loader nags with untruthful
2095 dnl comments stating that "most" uses of strcat/strcpy/sprintf are incorrect,
2096 dnl and implying that most uses of the recommended alternatives are correct.
2098 dnl Factually speaking, no one has actually counted the number of uses of these
2099 dnl functions versus the total of incorrect uses. Samples of a few thousand
2100 dnl instances are meaningless compared to the hundreds of millions of lines of
2101 dnl existing C code.
2103 dnl strlcat/strlcpy are (as of 2012) non-standard, and are available on some
2104 dnl platforms, in implementations of varying quality. Likewise, snprintf is
2105 dnl standard - but evolved through phases, and older implementations are likely
2106 dnl to yield surprising results, as documented in manpages on various systems.
2107 AC_DEFUN([CF_ENABLE_STRING_HACKS],
2109 AC_MSG_CHECKING(if you want to work around bogus compiler/loader warnings)
2110 AC_ARG_ENABLE(string-hacks,
2111 [ --enable-string-hacks work around bogus compiler/loader warnings],
2112 [enable_string_hacks=$enableval],
2113 [enable_string_hacks=no])
2114 AC_MSG_RESULT($enable_string_hacks)
2116 if test "x$enable_string_hacks" = "xyes"; then
2117 AC_DEFINE(USE_STRING_HACKS,1,[Define to 1 to work around bogus compiler/loader warnings])
2118 AC_MSG_WARN(enabling string-hacks to work around bogus compiler/loader warnings)
2119 AC_CHECK_FUNC(strlcat,[
2120 AC_DEFINE(HAVE_STRLCAT,1,[Define to 1 if we have strlcat function])
2122 AC_CHECK_LIB(bsd,strlcat,[
2124 AC_CHECK_HEADERS(bsd/string.h)
2125 AC_DEFINE(HAVE_STRLCAT,1,[Define to 1 if we have strlcat function])
2128 AC_CHECK_FUNCS( strlcpy snprintf )
2131 dnl ---------------------------------------------------------------------------
2132 dnl CF_ENABLE_WARNINGS version: 9 updated: 2021/01/05 19:40:50
2133 dnl ------------------
2134 dnl Configure-option to enable gcc warnings
2136 dnl $1 = extra options to add, if supported
2137 dnl $2 = option for checking attributes. By default, this is done when
2138 dnl warnings are enabled. For other values:
2139 dnl yes: always do this, e.g., to use in generated library-headers
2140 dnl no: never do this
2141 AC_DEFUN([CF_ENABLE_WARNINGS],[
2142 if test "$GCC" = yes || test "$GXX" = yes
2144 CF_FIX_WARNINGS(CFLAGS)
2145 CF_FIX_WARNINGS(CPPFLAGS)
2146 CF_FIX_WARNINGS(LDFLAGS)
2147 AC_MSG_CHECKING(if you want to turn on gcc warnings)
2148 CF_ARG_ENABLE(warnings,
2149 [ --enable-warnings test: turn on gcc compiler warnings],
2150 [enable_warnings=yes],
2151 [enable_warnings=no])
2152 AC_MSG_RESULT($enable_warnings)
2153 if test "$enable_warnings" = "yes"
2155 ifelse($2,,[CF_GCC_ATTRIBUTES])
2158 ifelse($2,yes,[CF_GCC_ATTRIBUTES])
2161 dnl ---------------------------------------------------------------------------
2162 dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
2164 dnl Check if 'errno' is declared in <errno.h>
2165 AC_DEFUN([CF_ERRNO],
2167 CF_CHECK_ERRNO(errno)
2169 dnl ---------------------------------------------------------------------------
2170 dnl CF_ETIP_DEFINES version: 6 updated: 2021/01/02 17:09:14
2172 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
2173 dnl math.h and builtin.h, only for ncurses
2174 AC_DEFUN([CF_ETIP_DEFINES],
2176 AC_MSG_CHECKING(for special defines needed for etip.h)
2177 cf_save_CXXFLAGS="$CXXFLAGS"
2180 # etip.h includes ncurses.h which includes ncurses_dll.h
2181 # But ncurses_dll.h is generated - fix here.
2182 test -d include || mkdir include
2183 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
2185 for cf_math in "" MATH_H
2187 for cf_excp in "" MATH_EXCEPTION
2189 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -Iinclude -I${srcdir}/include"
2190 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
2191 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
2193 #include <etip.h.in>
2195 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
2196 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
2197 cf_result="$cf_math $cf_excp"
2202 AC_MSG_RESULT($cf_result)
2203 CXXFLAGS="$cf_save_CXXFLAGS"
2205 dnl ---------------------------------------------------------------------------
2206 dnl CF_FIND_LINKAGE version: 22 updated: 2020/12/31 20:19:42
2208 dnl Find a library (specifically the linkage used in the code fragment),
2209 dnl searching for it if it is not already in the library path.
2210 dnl See also CF_ADD_SEARCHPATH.
2212 dnl Parameters (4-on are optional):
2213 dnl $1 = headers for library entrypoint
2214 dnl $2 = code fragment for library entrypoint
2215 dnl $3 = the library name without the "-l" option or ".so" suffix.
2216 dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
2217 dnl $5 = action to perform if not successful
2218 dnl $6 = module name, if not the same as the library name
2219 dnl $7 = extra libraries
2221 dnl Sets these variables:
2222 dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
2223 dnl $cf_cv_header_path_$3 - include-directory if needed
2224 dnl $cf_cv_library_path_$3 - library-directory if needed
2225 dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
2226 AC_DEFUN([CF_FIND_LINKAGE],[
2228 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
2229 # will be set on completion of the AC_TRY_LINK below.
2230 cf_cv_header_path_$3=
2231 cf_cv_library_path_$3=
2233 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
2235 cf_save_LIBS="$LIBS"
2237 AC_TRY_LINK([$1],[$2],[
2238 cf_cv_find_linkage_$3=yes
2239 cf_cv_header_path_$3=/usr/include
2240 cf_cv_library_path_$3=/usr/lib
2243 LIBS="-l$3 $7 $cf_save_LIBS"
2245 AC_TRY_LINK([$1],[$2],[
2246 cf_cv_find_linkage_$3=yes
2247 cf_cv_header_path_$3=/usr/include
2248 cf_cv_library_path_$3=/usr/lib
2249 cf_cv_library_file_$3="-l$3"
2251 cf_cv_find_linkage_$3=no
2252 LIBS="$cf_save_LIBS"
2254 CF_VERBOSE(find linkage for $3 library)
2255 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
2257 cf_save_CPPFLAGS="$CPPFLAGS"
2258 cf_test_CPPFLAGS="$CPPFLAGS"
2260 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
2261 for cf_cv_header_path_$3 in $cf_search
2263 if test -d "$cf_cv_header_path_$3" ; then
2264 CF_VERBOSE(... testing $cf_cv_header_path_$3)
2265 CPPFLAGS="$cf_save_CPPFLAGS"
2266 CF_APPEND_TEXT(CPPFLAGS,-I$cf_cv_header_path_$3)
2267 AC_TRY_COMPILE([$1],[$2],[
2268 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
2269 cf_cv_find_linkage_$3=maybe
2270 cf_test_CPPFLAGS="$CPPFLAGS"
2272 CPPFLAGS="$cf_save_CPPFLAGS"
2277 if test "$cf_cv_find_linkage_$3" = maybe ; then
2279 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
2281 cf_save_LIBS="$LIBS"
2282 cf_save_LDFLAGS="$LDFLAGS"
2285 CPPFLAGS="$cf_test_CPPFLAGS"
2286 LIBS="-l$3 $7 $cf_save_LIBS"
2287 AC_TRY_LINK([$1],[$2],[
2288 CF_VERBOSE(... found $3 library in system)
2289 cf_cv_find_linkage_$3=yes])
2290 CPPFLAGS="$cf_save_CPPFLAGS"
2291 LIBS="$cf_save_LIBS"
2294 if test "$cf_cv_find_linkage_$3" != yes ; then
2295 CF_LIBRARY_PATH(cf_search,$3)
2296 for cf_cv_library_path_$3 in $cf_search
2298 if test -d "$cf_cv_library_path_$3" ; then
2299 CF_VERBOSE(... testing $cf_cv_library_path_$3)
2300 CPPFLAGS="$cf_test_CPPFLAGS"
2301 LIBS="-l$3 $7 $cf_save_LIBS"
2302 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
2303 AC_TRY_LINK([$1],[$2],[
2304 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
2305 cf_cv_find_linkage_$3=yes
2306 cf_cv_library_file_$3="-l$3"
2308 CPPFLAGS="$cf_save_CPPFLAGS"
2309 LIBS="$cf_save_LIBS"
2310 LDFLAGS="$cf_save_LDFLAGS"
2314 CPPFLAGS="$cf_save_CPPFLAGS"
2315 LDFLAGS="$cf_save_LDFLAGS"
2319 cf_cv_find_linkage_$3=no
2324 LIBS="$cf_save_LIBS"
2326 if test "$cf_cv_find_linkage_$3" = yes ; then
2328 CF_ADD_INCDIR($cf_cv_header_path_$3)
2329 CF_ADD_LIBDIR($cf_cv_library_path_$3)
2333 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
2336 dnl ---------------------------------------------------------------------------
2337 dnl CF_FIND_SUB_INCDIR version: 3 updated: 2021/01/01 13:31:04
2338 dnl ------------------
2339 dnl Find an include-directory with the given leaf-name. This is useful for
2340 dnl example with FreeBSD ports, which use this convention to distinguish
2341 dnl different versions of the same port.
2342 AC_DEFUN([CF_FIND_SUB_INCDIR],[
2343 CF_SUBDIR_PATH(cf_search,$1,include)
2344 for cf_item in $cf_search
2348 CF_ADD_INCDIR($cf_item)
2353 dnl ---------------------------------------------------------------------------
2354 dnl CF_FIND_SUB_LIBDIR version: 3 updated: 2021/01/01 13:31:04
2355 dnl ------------------
2356 dnl Find a library-directory with the given leaf-name. This is useful for
2357 dnl example with FreeBSD ports, which use this convention to distinguish
2358 dnl different versions of the same port.
2359 AC_DEFUN([CF_FIND_SUB_LIBDIR],[
2360 CF_SUBDIR_PATH(cf_search,$1,lib)
2361 for cf_item in $cf_search
2365 CF_ADD_LIBDIR($cf_item)
2370 dnl ---------------------------------------------------------------------------
2371 dnl CF_FIXUP_ADAFLAGS version: 2 updated: 2015/04/17 21:13:04
2372 dnl -----------------
2373 dnl make ADAFLAGS consistent with CFLAGS
2374 AC_DEFUN([CF_FIXUP_ADAFLAGS],[
2375 AC_MSG_CHECKING(optimization options for ADAFLAGS)
2383 cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[[ ]].*//'`
2384 CF_ADD_ADAFLAGS($cf_O_flag)
2387 AC_MSG_RESULT($ADAFLAGS)
2389 dnl ---------------------------------------------------------------------------
2390 dnl CF_FIX_WARNINGS version: 3 updated: 2020/12/31 18:40:20
2392 dnl Warning flags do not belong in CFLAGS, CPPFLAGS, etc. Any of gcc's
2393 dnl "-Werror" flags can interfere with configure-checks. Those go into
2396 dnl $1 = variable name to repair
2397 define([CF_FIX_WARNINGS],[
2398 if test "$GCC" = yes || test "$GXX" = yes
2402 CF_VERBOSE(repairing $1: [$]$1)
2404 for cf_temp_scan in [$]$1
2406 case "x$cf_temp_scan" in
2408 CF_APPEND_TEXT(EXTRA_CFLAGS,$cf_temp_scan)
2411 CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan)
2416 CF_VERBOSE(... fixed [$]$1)
2417 CF_VERBOSE(... extra $EXTRA_CFLAGS)
2421 AC_SUBST(EXTRA_CFLAGS)
2423 dnl ---------------------------------------------------------------------------
2424 dnl CF_FOPEN_BIN_R version: 2 updated: 2019/12/31 08:53:54
2426 dnl Check if fopen works when the "b" (binary) flag is added to the mode
2427 dnl parameter. POSIX ignores the "b", which c89 specified. Some very old
2428 dnl systems do not accept it.
2429 AC_DEFUN([CF_FOPEN_BIN_R],[
2430 AC_CACHE_CHECK(if fopen accepts explicit binary mode,cf_cv_fopen_bin_r,[
2434 FILE *fp = fopen("conftest.tmp", "wb");
2438 for (p = 0; p < 256; ++p) {
2442 fp = fopen("conftest.tmp", "rb");
2444 for (p = 0; p < 256; ++p) {
2457 ${cf_cv_main_return:-return} (rc);
2460 [cf_cv_fopen_bin_r=yes],
2461 [cf_cv_fopen_bin_r=no],
2462 [cf_cv_fopen_bin_r=unknown])
2464 test "x$cf_cv_fopen_bin_r" != xno && AC_DEFINE(USE_FOPEN_BIN_R,1,[Define to 1 if fopen accepts explicit binary mode])
2466 dnl ---------------------------------------------------------------------------
2467 dnl CF_FORGET_TOOL version: 1 updated: 2013/04/06 18:03:09
2469 dnl Forget that we saw the given tool.
2470 AC_DEFUN([CF_FORGET_TOOL],[
2471 unset ac_cv_prog_ac_ct_$1
2475 dnl ---------------------------------------------------------------------------
2476 dnl CF_FUNC_DLSYM version: 4 updated: 2015/09/12 14:46:44
2478 dnl Test for dlsym() and related functions, as well as libdl.
2483 AC_DEFUN([CF_FUNC_DLSYM],[
2485 AC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[
2488 AC_CHECK_LIB(dl,dlsym,[
2490 cf_have_libdl=yes])])
2492 if test "$cf_have_dlsym" = yes ; then
2493 test "$cf_have_libdl" = yes && { CF_ADD_LIB(dl) }
2495 AC_MSG_CHECKING(whether able to link to dl*() functions)
2496 AC_TRY_LINK([#include <dlfcn.h>],[
2498 if ((obj = dlopen("filename", 0)) != 0) {
2499 if (dlsym(obj, "symbolname") == 0) {
2503 AC_DEFINE(HAVE_LIBDL,1,[Define to 1 if we have dl library])],[
2504 AC_MSG_ERROR(Cannot link test program for libdl)])
2507 AC_MSG_ERROR(Cannot find dlsym function)
2510 dnl ---------------------------------------------------------------------------
2511 dnl CF_FUNC_MEMMOVE version: 9 updated: 2017/01/21 11:06:25
2513 dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
2514 dnl is found, add our own version of memmove to the list of objects.
2515 AC_DEFUN([CF_FUNC_MEMMOVE],
2517 AC_CHECK_FUNC(memmove,,[
2518 AC_CHECK_FUNC(bcopy,[
2519 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
2522 static char data[] = "abcdefghijklmnopqrstuwwxyz";
2524 bcopy(data, temp, sizeof(data));
2525 bcopy(temp+10, temp, 15);
2526 bcopy(temp+5, temp+15, 10);
2527 ${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
2530 [cf_cv_good_bcopy=yes],
2531 [cf_cv_good_bcopy=no],
2532 [cf_cv_good_bcopy=unknown])
2534 ],[cf_cv_good_bcopy=no])
2535 if test "$cf_cv_good_bcopy" = yes ; then
2536 AC_DEFINE(USE_OK_BCOPY,1,[Define to 1 to use bcopy when memmove is unavailable])
2538 AC_DEFINE(USE_MY_MEMMOVE,1,[Define to 1 to use replacement function when memmove is unavailable])
2541 dnl ---------------------------------------------------------------------------
2542 dnl CF_FUNC_NANOSLEEP version: 5 updated: 2017/01/21 11:06:25
2543 dnl -----------------
2544 dnl Check for existence of workable nanosleep() function. Some systems, e.g.,
2545 dnl AIX 4.x, provide a non-working version.
2546 AC_DEFUN([CF_FUNC_NANOSLEEP],[
2547 AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[
2553 #ifdef HAVE_SYS_TIME_H
2554 #include <sys/time.h>
2558 struct timespec ts1, ts2;
2561 ts1.tv_nsec = 750000000;
2565 code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */
2566 ${cf_cv_main_return:-return}(code != 0);
2569 [cf_cv_func_nanosleep=yes],
2570 [cf_cv_func_nanosleep=no],
2571 [cf_cv_func_nanosleep=unknown])])
2573 test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP,1,[Define to 1 if we have nanosleep()])
2575 dnl ---------------------------------------------------------------------------
2576 dnl CF_FUNC_OPENPTY version: 6 updated: 2021/01/01 13:31:04
2578 dnl Check for openpty() function, along with <pty.h> header. It may need the
2579 dnl "util" library as well.
2580 AC_DEFUN([CF_FUNC_OPENPTY],
2582 AC_CHECK_LIB(util,openpty,cf_cv_lib_util=yes,cf_cv_lib_util=no)
2583 AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[
2584 cf_save_LIBS="$LIBS"
2585 test "$cf_cv_lib_util" = yes && { CF_ADD_LIB(util) }
2586 for cf_header in pty.h libutil.h util.h
2589 #include <$cf_header>
2591 int x = openpty((int *)0, (int *)0, (char *)0,
2592 (struct termios *)0, (struct winsize *)0);
2594 cf_cv_func_openpty=$cf_header
2597 cf_cv_func_openpty=no
2600 LIBS="$cf_save_LIBS"
2603 dnl ---------------------------------------------------------------------------
2604 dnl CF_FUNC_POLL version: 10 updated: 2021/01/04 19:13:57
2606 dnl See if the poll function really works. Some platforms have poll(), but
2607 dnl it does not work for terminals or files.
2608 AC_DEFUN([CF_FUNC_POLL],[
2609 tty >/dev/null 2>&1 || { AC_CHECK_FUNCS(posix_openpt) }
2610 AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
2619 #include <sys/poll.h>
2622 struct pollfd myfds;
2625 /* check for Darwin bug with respect to "devices" */
2626 myfds.fd = open("/dev/null", 1); /* O_WRONLY */
2629 myfds.events = POLLIN;
2632 ret = poll(&myfds, 1, 100);
2634 if (ret < 0 || (myfds.revents & POLLNVAL)) {
2639 fd = open("/dev/tty", 2); /* O_RDWR */
2641 #ifdef HAVE_POSIX_OPENPT
2643 fd = posix_openpt(O_RDWR);
2648 /* also check with standard input */
2650 myfds.events = POLLIN;
2652 ret = poll(&myfds, 1, 100);
2657 ${cf_cv_main_return:-return}(ret < 0);
2659 [cf_cv_working_poll=yes],
2660 [cf_cv_working_poll=no],
2661 [cf_cv_working_poll=unknown])])
2662 test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL,1,[Define to 1 if the poll function seems to work])
2664 dnl ---------------------------------------------------------------------------
2665 dnl CF_FUNC_TERMIOS version: 3 updated: 2012/10/06 17:56:13
2667 dnl Some old/broken variations define tcgetattr() only as a macro in
2669 AC_DEFUN([CF_FUNC_TERMIOS],[
2670 AC_REQUIRE([CF_STRUCT_TERMIOS])
2671 AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
2673 #include <sys/types.h>
2674 #ifdef HAVE_UNISTD_H
2677 #ifdef HAVE_TERMIOS_H
2678 #include <termios.h>
2679 #define TTY struct termios
2681 #ifdef HAVE_TERMIO_H
2683 #define TTY struct termio
2688 tcgetattr(1, &foo);],
2689 [cf_cv_have_tcgetattr=yes],
2690 [cf_cv_have_tcgetattr=no])])
2691 test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR,1,[Define to 1 if we have tcgetattr])
2693 dnl ---------------------------------------------------------------------------
2694 dnl CF_FUNC_VSSCANF version: 7 updated: 2021/01/01 13:31:04
2696 dnl Check for vsscanf() function, which is in c9x but generally not in earlier
2697 dnl versions of C. It is in the GNU C library, and can often be simulated by
2698 dnl other functions.
2699 AC_DEFUN([CF_FUNC_VSSCANF],
2701 AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
2704 #include <stdio.h>],[
2706 vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
2709 #include <stdio.h>],[
2713 strbuf._flag = _IOREAD;
2714 strbuf._ptr = strbuf._base = (unsigned char *) str;
2715 strbuf._cnt = strlen(str);
2716 strbuf._file = _NFILE;
2717 return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
2720 #include <stdio.h>],[
2724 strbuf._flag = _IOREAD;
2725 strbuf._ptr = strbuf._base = (unsigned char *) str;
2726 strbuf._cnt = strlen(str);
2727 strbuf._file = _NFILE;
2728 return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
2729 cf_cv_func_vsscanf=no])])])])
2731 case "$cf_cv_func_vsscanf" in
2732 (vsscanf) AC_DEFINE(HAVE_VSSCANF,1,[Define to 1 if we have vsscanf]);;
2733 (vfscanf) AC_DEFINE(HAVE_VFSCANF,1,[Define to 1 if we have vfscanf]);;
2734 (_doscan) AC_DEFINE(HAVE__DOSCAN,1,[Define to 1 if we have _doscan]);;
2738 dnl ---------------------------------------------------------------------------
2739 dnl CF_GCC_ATTRIBUTES version: 24 updated: 2021/03/20 12:00:25
2740 dnl -----------------
2741 dnl Test for availability of useful gcc __attribute__ directives to quiet
2742 dnl compiler warnings. Though useful, not all are supported -- and contrary
2743 dnl to documentation, unrecognized directives cause older compilers to barf.
2744 AC_DEFUN([CF_GCC_ATTRIBUTES],
2745 [AC_REQUIRE([AC_PROG_FGREP])dnl
2746 AC_REQUIRE([CF_C11_NORETURN])dnl
2748 if test "$GCC" = yes || test "$GXX" = yes
2750 cat > conftest.i <<EOF
2752 #define GCC_PRINTF 0
2757 #ifndef GCC_NORETURN
2758 #define GCC_NORETURN /* nothing */
2761 #define GCC_UNUSED /* nothing */
2764 if test "$GCC" = yes
2766 AC_CHECKING([for $CC __attribute__ directives])
2767 cat > "conftest.$ac_ext" <<EOF
2768 #line __oline__ "${as_me:-configure}"
2769 #include "confdefs.h"
2770 #include "conftest.h"
2771 #include "conftest.i"
2773 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
2775 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
2778 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
2780 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
2782 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
2783 extern GCC_NORETURN void oops(char *,...) GCC_PRINTFLIKE(1,2);
2784 extern GCC_NORETURN void foo(void);
2785 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { (void)argc; (void)argv; return 0; }
2787 cf_printf_attribute=no
2788 cf_scanf_attribute=no
2789 for cf_attribute in scanf printf unused noreturn
2791 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
2792 cf_directive="__attribute__(($cf_attribute))"
2793 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
2795 case "$cf_attribute" in
2797 cf_printf_attribute=yes
2798 cat >conftest.h <<EOF
2799 #define GCC_$cf_ATTRIBUTE 1
2803 cf_scanf_attribute=yes
2804 cat >conftest.h <<EOF
2805 #define GCC_$cf_ATTRIBUTE 1
2809 cat >conftest.h <<EOF
2810 #define GCC_$cf_ATTRIBUTE $cf_directive
2815 if AC_TRY_EVAL(ac_compile); then
2816 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
2817 cat conftest.h >>confdefs.h
2818 case "$cf_attribute" in
2820 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
2823 cf_value='/* nothing */'
2824 if test "$cf_printf_attribute" != no ; then
2825 cf_value='__attribute__((format(printf,fmt,var)))'
2826 AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
2828 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
2831 cf_value='/* nothing */'
2832 if test "$cf_scanf_attribute" != no ; then
2833 cf_value='__attribute__((format(scanf,fmt,var)))'
2834 AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
2836 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
2839 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
2845 ${FGREP-fgrep} define conftest.i >>confdefs.h
2850 dnl ---------------------------------------------------------------------------
2851 dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36
2853 dnl Find version of gcc, and (because icc/clang pretend to be gcc without being
2854 dnl compatible), attempt to determine if icc/clang is actually used.
2855 AC_DEFUN([CF_GCC_VERSION],[
2856 AC_REQUIRE([AC_PROG_CC])
2858 if test "$GCC" = yes ; then
2859 AC_MSG_CHECKING(version of $CC)
2860 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.]].*//'`"
2861 test -z "$GCC_VERSION" && GCC_VERSION=unknown
2862 AC_MSG_RESULT($GCC_VERSION)
2864 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
2865 CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
2867 dnl ---------------------------------------------------------------------------
2868 dnl CF_GCC_WARNINGS version: 41 updated: 2021/01/01 16:53:59
2870 dnl Check if the compiler supports useful warning options. There's a few that
2871 dnl we don't use, simply because they're too noisy:
2873 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
2874 dnl -Winline (usually not worthwhile)
2875 dnl -Wredundant-decls (system headers make this too noisy)
2876 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
2877 dnl -Wwrite-strings (too noisy, but should review occasionally). This
2878 dnl is enabled for ncurses using "--enable-const".
2882 dnl $1 is an optional list of gcc warning flags that a particular
2883 dnl application might want to use, e.g., "no-unused" for
2886 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
2888 AC_DEFUN([CF_GCC_WARNINGS],
2890 AC_REQUIRE([CF_GCC_VERSION])
2891 if test "x$have_x" = xyes; then CF_CONST_X_STRING fi
2892 cat > "conftest.$ac_ext" <<EOF
2893 #line __oline__ "${as_me:-configure}"
2894 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
2896 if test "$INTEL_COMPILER" = yes
2898 # The "-wdXXX" options suppress warnings:
2899 # remark #1419: external declaration in primary source file
2900 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
2901 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
2902 # remark #193: zero used for undefined preprocessing identifier
2903 # remark #593: variable "curs_sb_left_arrow" was set but never used
2904 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
2905 # remark #869: parameter "tw" was never referenced
2906 # remark #981: operands are evaluated in unspecified order
2907 # warning #279: controlling expression is constant
2909 AC_CHECKING([for $CC warning options])
2910 cf_save_CFLAGS="$CFLAGS"
2911 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
2923 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2924 if AC_TRY_EVAL(ac_compile); then
2925 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2926 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2929 CFLAGS="$cf_save_CFLAGS"
2930 elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown"
2932 AC_CHECKING([for $CC warning options])
2933 cf_save_CFLAGS="$CFLAGS"
2935 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
2936 cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs"
2937 test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings=
2938 for cf_opt in W Wall \
2939 Wbad-function-cast \
2942 Wdeclaration-after-statement \
2945 Wmissing-declarations \
2946 Wmissing-prototypes \
2950 Wstrict-prototypes \
2951 Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST $1
2953 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2954 if AC_TRY_EVAL(ac_compile); then
2955 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2958 case "$GCC_VERSION" in
2960 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2965 case "$GCC_VERSION" in
2967 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2972 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2975 CFLAGS="$cf_save_CFLAGS"
2979 AC_SUBST(EXTRA_CFLAGS)
2981 dnl ---------------------------------------------------------------------------
2982 dnl CF_GETOPT_HEADER version: 8 updated: 2021/06/19 19:16:16
2983 dnl ----------------
2984 dnl Check for getopt's variables which are commonly defined in stdlib.h,
2985 dnl unistd.h or (nonstandard) in getopt.h
2986 AC_DEFUN([CF_GETOPT_HEADER],
2988 AC_HAVE_HEADERS(unistd.h getopt.h)
2989 AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
2990 cf_cv_getopt_header=none
2991 for cf_header in stdio.h stdlib.h unistd.h getopt.h
2994 #include <$cf_header>],
2995 [int x = optind; char *y = optarg; (void)x; (void)y],
2996 [cf_cv_getopt_header=$cf_header
3000 if test "$cf_cv_getopt_header" != none ; then
3001 AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if getopt variables are declared in header])
3003 if test "$cf_cv_getopt_header" = getopt.h ; then
3004 AC_DEFINE(NEED_GETOPT_H,1,[Define to 1 if we must include getopt.h])
3007 dnl ---------------------------------------------------------------------------
3008 dnl CF_GNATPREP_OPT_T version: 1 updated: 2014/08/02 18:37:25
3009 dnl -----------------
3010 AC_DEFUN([CF_GNATPREP_OPT_T],[
3011 AC_CACHE_CHECK(if GNATPREP supports -T option,cf_cv_gnatprep_opt_t,[
3012 cf_cv_gnatprep_opt_t=no
3013 gnatprep -T 2>/dev/null >/dev/null && cf_cv_gnatprep_opt_t=yes
3015 test "$cf_cv_gnatprep_opt_t" = yes && GNATPREP_OPTS="-T $GNATPREP_OPTS"
3016 AC_SUBST(GNATPREP_OPTS)
3018 dnl ---------------------------------------------------------------------------
3019 dnl CF_GNAT_GENERICS version: 7 updated: 2021/01/01 13:31:04
3020 dnl ----------------
3021 AC_DEFUN([CF_GNAT_GENERICS],
3023 AC_REQUIRE([CF_GNAT_VERSION])
3025 AC_MSG_CHECKING(if GNAT supports generics)
3026 case "$cf_cv_gnat_version" in
3027 (3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|[[1-9]][[0-9]].[[0-9]]*|20[[0-9]][[0-9]])
3028 cf_gnat_generics=yes
3034 AC_MSG_RESULT($cf_gnat_generics)
3036 if test "$cf_gnat_generics" = yes
3038 cf_compile_generics=generics
3039 cf_generic_objects="\${GENOBJS}"
3041 cf_compile_generics=
3045 AC_SUBST(cf_compile_generics)
3046 AC_SUBST(cf_generic_objects)
3048 dnl ---------------------------------------------------------------------------
3049 dnl CF_GNAT_PROJECTS version: 13 updated: 2021/01/02 17:09:14
3050 dnl ----------------
3051 dnl GNAT projects are configured with ".gpr" project files.
3052 dnl GNAT libraries are a further development, using the project feature.
3053 AC_DEFUN([CF_GNAT_PROJECTS],
3055 AC_REQUIRE([CF_GNAT_VERSION])
3056 AC_REQUIRE([CF_DISABLE_GNAT_PROJECTS])
3058 cf_gnat_libraries=no
3061 if test "$enable_gnat_projects" != no ; then
3062 AC_MSG_CHECKING(if GNAT supports project files)
3063 case "$cf_cv_gnat_version" in
3067 case "$cf_cv_system_name" in
3071 rm -rf ./conftest* ./*~conftest*
3072 if mkdir conftest.src conftest.bin conftest.lib
3075 rm -rf ./conftest* ./*~conftest*
3076 cat >>library.gpr <<CF_EOF
3078 Kind := External ("LIB_KIND");
3079 for Library_Name use "ConfTest";
3080 for Object_Dir use ".";
3081 for Library_ALI_Dir use External("LIBRARY_DIR");
3082 for Library_Version use External ("SONAME");
3083 for Library_Kind use Kind;
3084 for Library_Dir use External("BUILD_DIR");
3085 Source_Dir := External ("SOURCE_DIR");
3086 for Source_Dirs use (Source_Dir);
3089 cat >>confpackage.ads <<CF_EOF
3090 package ConfPackage is
3094 cat >>confpackage.adb <<CF_EOF
3096 package body ConfPackage is
3097 procedure conftest is
3099 Text_IO.Put ("Hello World");
3104 if ( "$cf_ada_make" $ADAFLAGS \
3106 -XBUILD_DIR="`cd ../conftest.bin;pwd`" \
3107 -XLIBRARY_DIR="`cd ../conftest.lib;pwd`" \
3108 -XSOURCE_DIR="`pwd`" \
3109 -XSONAME=libConfTest.so.1 \
3110 -XLIB_KIND=static 1>&AC_FD_CC 2>&1 ) ; then
3111 cf_gnat_projects=yes
3115 if test -f conftest.lib/confpackage.ali
3117 cf_gnat_libraries=yes
3119 rm -rf ./conftest* ./*~conftest*
3124 AC_MSG_RESULT($cf_gnat_projects)
3125 fi # enable_gnat_projects
3127 if test "$cf_gnat_projects" = yes
3129 AC_MSG_CHECKING(if GNAT supports libraries)
3130 AC_MSG_RESULT($cf_gnat_libraries)
3133 USE_OLD_MAKERULES=""
3134 USE_GNAT_PROJECTS="#"
3135 USE_GNAT_MAKE_GPR="#"
3136 USE_GNAT_GPRBUILD="#"
3138 if test "$cf_gnat_projects" = yes
3140 USE_OLD_MAKERULES="#"
3141 USE_GNAT_PROJECTS=""
3142 if test "$cf_cv_VERSION_GPRBUILD" != no
3144 USE_GNAT_GPRBUILD=""
3145 elif test "$cf_cv_VERSION_GNATMAKE" != no
3147 USE_GNAT_MAKE_GPR=""
3149 AC_MSG_WARN(use old makefile rules since tools are missing)
3153 if test "$cf_gnat_libraries" = yes
3155 USE_GNAT_LIBRARIES=""
3157 USE_GNAT_LIBRARIES="#"
3160 AC_SUBST(USE_OLD_MAKERULES)
3161 AC_SUBST(USE_GNAT_PROJECTS)
3162 AC_SUBST(USE_GNAT_LIBRARIES)
3163 AC_SUBST(USE_GNAT_MAKE_GPR)
3164 AC_SUBST(USE_GNAT_GPRBUILD)
3166 dnl ---------------------------------------------------------------------------
3167 dnl CF_GNAT_SIGINT version: 2 updated: 2021/01/01 13:31:04
3169 dnl Check if gnat supports SIGINT, and presumably tasking. For the latter, it
3170 dnl is noted that gnat may compile a tasking unit even for configurations which
3171 dnl fail at runtime.
3172 AC_DEFUN([CF_GNAT_SIGINT],[
3173 AC_CACHE_CHECK(if GNAT supports SIGINT,cf_cv_gnat_sigint,[
3174 CF_GNAT_TRY_LINK([with Ada.Interrupts.Names;
3178 pragma Warnings (Off); -- the next pragma exists since 3.11p
3179 pragma Unreserve_All_Interrupts;
3180 pragma Warnings (On);
3182 protected Process is
3184 function Continue return Boolean;
3185 pragma Attach_Handler (Stop, Ada.Interrupts.Names.SIGINT);
3187 Done : Boolean := False;
3191 [package body ConfTest is
3192 protected body Process is
3197 function Continue return Boolean is
3203 [cf_cv_gnat_sigint=yes],
3204 [cf_cv_gnat_sigint=no])])
3206 if test "$cf_cv_gnat_sigint" = yes ; then
3211 AC_SUBST(USE_GNAT_SIGINT)
3213 dnl ---------------------------------------------------------------------------
3214 dnl CF_GNAT_TRY_LINK version: 4 updated: 2021/01/01 13:31:04
3215 dnl ----------------
3216 dnl Verify that a test program compiles/links with GNAT.
3217 dnl $cf_ada_make is set to the program that compiles/links
3218 dnl $ADAFLAGS may be set to the GNAT flags.
3220 dnl $1 is the text of the spec
3221 dnl $2 is the text of the body
3222 dnl $3 is the shell command to execute if successful
3223 dnl $4 is the shell command to execute if not successful
3224 AC_DEFUN([CF_GNAT_TRY_LINK],
3226 rm -rf ./conftest* ./*~conftest*
3227 cat >>conftest.ads <<CF_EOF
3230 cat >>conftest.adb <<CF_EOF
3233 if ( "$cf_ada_make" $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
3234 ifelse($3,, :,[ $3])
3238 rm -rf ./conftest* ./*~conftest*
3240 dnl ---------------------------------------------------------------------------
3241 dnl CF_GNAT_TRY_RUN version: 6 updated: 2021/01/01 13:31:04
3243 dnl Verify that a test program compiles and runs with GNAT
3244 dnl $cf_ada_make is set to the program that compiles/links
3245 dnl $ADAFLAGS may be set to the GNAT flags.
3247 dnl $1 is the text of the spec
3248 dnl $2 is the text of the body
3249 dnl $3 is the shell command to execute if successful
3250 dnl $4 is the shell command to execute if not successful
3251 AC_DEFUN([CF_GNAT_TRY_RUN],
3253 rm -rf ./conftest* ./*~conftest*
3254 cat >>conftest.ads <<CF_EOF
3257 cat >>conftest.adb <<CF_EOF
3260 if ( "$cf_ada_make" $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
3261 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
3262 ifelse($3,, :,[ $3])
3269 rm -rf ./conftest* ./*~conftest*
3271 dnl ---------------------------------------------------------------------------
3272 dnl CF_GNAT_VERSION version: 22 updated: 2019/12/31 08:53:54
3274 dnl $1 = cache variable to update
3275 dnl $2 = program name
3276 dnl Verify version of GNAT or related tool
3277 AC_DEFUN([CF_GNAT_VERSION],
3279 AC_CACHE_CHECK(for ifelse($2,,gnat,$2) version, cf_cv_gnat_version,[
3280 cf_cv_gnat_version=`ifelse($2,,${cf_ada_make:-gnatmake},$2) --version 2>&1 | \
3281 grep '[[0-9]].[[0-9]][[0-9]]*' |\
3282 sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
3284 test -z "$cf_cv_gnat_version" && cf_cv_gnat_version=no
3285 ifelse($1,,,[eval $1=$cf_cv_gnat_version; unset cf_cv_gnat_version])
3287 dnl ---------------------------------------------------------------------------
3288 dnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41
3290 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
3291 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
3292 dnl (or misfeature) of glibc2, which breaks portability of many applications,
3293 dnl since it is interwoven with GNU extensions.
3295 dnl Well, yes we could work around it...
3298 dnl $1 is the nominal value for _XOPEN_SOURCE
3299 AC_DEFUN([CF_GNU_SOURCE],
3301 cf_gnu_xopen_source=ifelse($1,,500,$1)
3303 AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[
3304 AC_TRY_COMPILE([#include <sys/types.h>],[
3305 #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0
3307 #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0
3310 # error not GNU C library
3312 [cf_cv_gnu_library=yes],
3313 [cf_cv_gnu_library=no])
3316 if test x$cf_cv_gnu_library = xyes; then
3318 # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE
3319 # was changed to help a little. newlib incorporated the change about 4
3321 AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[
3323 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
3324 AC_TRY_COMPILE([#include <sys/types.h>],[
3325 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2)
3327 #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3)
3330 # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old
3332 [cf_cv_gnu_library_219=yes],
3333 [cf_cv_gnu_library_219=no])
3337 if test "x$cf_cv_gnu_library_219" = xyes; then
3339 AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[
3340 CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source)
3343 #include <sys/types.h>
3345 #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1)
3348 # error GNU C library is too old
3350 [cf_cv_gnu_dftsrc_219=yes],
3351 [cf_cv_gnu_dftsrc_219=no])
3353 test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save"
3355 cf_cv_gnu_dftsrc_219=maybe
3358 if test "x$cf_cv_gnu_dftsrc_219" != xyes; then
3360 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
3361 AC_TRY_COMPILE([#include <sys/types.h>],[
3362 #ifndef _XOPEN_SOURCE
3363 #error expected _XOPEN_SOURCE to be defined
3365 [cf_cv_gnu_source=no],
3366 [cf_save="$CPPFLAGS"
3367 CF_ADD_CFLAGS(-D_GNU_SOURCE)
3368 AC_TRY_COMPILE([#include <sys/types.h>],[
3369 #ifdef _XOPEN_SOURCE
3370 #error expected _XOPEN_SOURCE to be undefined
3372 [cf_cv_gnu_source=no],
3373 [cf_cv_gnu_source=yes])
3378 if test "$cf_cv_gnu_source" = yes
3380 AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[
3381 CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE)
3382 AC_TRY_COMPILE([#include <sys/types.h>],[
3383 #ifdef _DEFAULT_SOURCE
3384 #error expected _DEFAULT_SOURCE to be undefined
3386 [cf_cv_default_source=no],
3387 [cf_cv_default_source=yes])
3389 if test "$cf_cv_default_source" = yes
3391 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
3398 dnl ---------------------------------------------------------------------------
3399 dnl CF_GPP_LIBRARY version: 13 updated: 2021/01/01 13:31:04
3401 dnl If we're trying to use g++, test if libg++ is installed (a rather common
3402 dnl problem :-). If we have the compiler but no library, we'll be able to
3403 dnl configure, but won't be able to build the c++ demo program.
3404 AC_DEFUN([CF_GPP_LIBRARY],
3406 cf_cxx_library=unknown
3407 case "$cf_cv_system_name" in
3415 if test "$GXX" = yes; then
3416 AC_MSG_CHECKING([for lib$cf_gpp_libname])
3418 CF_ADD_LIB($cf_gpp_libname)
3420 #include <$cf_gpp_libname/builtin.h>
3422 [two_arg_error_handler_t foo2 = lib_error_handler],
3424 CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
3425 if test "$cf_gpp_libname" = cpp ; then
3426 AC_DEFINE(HAVE_GPP_BUILTIN_H,1,[Define to 1 if we have gpp builtin.h])
3428 AC_DEFINE(HAVE_GXX_BUILTIN_H,1,[Define to 1 if we have g++ builtin.h])
3431 #include <builtin.h>
3433 [two_arg_error_handler_t foo2 = lib_error_handler],
3435 CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
3436 AC_DEFINE(HAVE_BUILTIN_H,1,[Define to 1 if we have builtin.h])],
3437 [cf_cxx_library=no])])
3439 AC_MSG_RESULT($cf_cxx_library)
3442 dnl ---------------------------------------------------------------------------
3443 dnl CF_GXX_VERSION version: 8 updated: 2017/02/11 14:48:57
3445 dnl Check for version of g++
3446 AC_DEFUN([CF_GXX_VERSION],[
3447 AC_REQUIRE([AC_PROG_CPP])
3449 if test "$GXX" = yes; then
3450 AC_MSG_CHECKING(version of ${CXX:-g++})
3451 GXX_VERSION="`${CXX:-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
3452 if test -z "$GXX_VERSION"
3457 AC_MSG_RESULT($GXX_VERSION)
3460 dnl ---------------------------------------------------------------------------
3461 dnl CF_GXX_WARNINGS version: 11 updated: 2021/01/08 16:50:55
3463 dnl Check if the compiler supports useful warning options.
3465 dnl Most of gcc's options apply to g++, except:
3466 dnl -Wbad-function-cast
3467 dnl -Wmissing-declarations
3468 dnl -Wnested-externs
3470 dnl Omit a few (for now):
3474 dnl $1 is an optional list of g++ warning flags that a particular
3475 dnl application might want to use, e.g., "no-unused" for
3478 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
3480 AC_DEFUN([CF_GXX_WARNINGS],
3483 CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS)
3484 CF_CLANG_COMPILER(GXX,CLANG_CPLUSPLUS,CXXFLAGS)
3486 AC_REQUIRE([CF_GXX_VERSION])
3491 cat > conftest.$ac_ext <<EOF
3492 #line __oline__ "configure"
3493 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
3496 if test "$INTEL_CPLUSPLUS" = yes
3498 # The "-wdXXX" options suppress warnings:
3499 # remark #1419: external declaration in primary source file
3500 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
3501 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
3502 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
3503 # remark #193: zero used for undefined preprocessing identifier
3504 # remark #593: variable "curs_sb_left_arrow" was set but never used
3505 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
3506 # remark #869: parameter "tw" was never referenced
3507 # remark #981: operands are evaluated in unspecified order
3508 # warning #269: invalid format string conversion
3510 AC_CHECKING([for $CC warning options])
3511 cf_save_CXXFLAGS="$CXXFLAGS"
3512 EXTRA_CXXFLAGS="-Wall"
3525 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt"
3526 if AC_TRY_EVAL(ac_compile); then
3527 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
3528 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
3531 CXXFLAGS="$cf_save_CXXFLAGS"
3533 elif test "$GXX" = yes
3535 AC_CHECKING([for $CXX warning options])
3536 cf_save_CXXFLAGS="$CXXFLAGS"
3537 EXTRA_CXXFLAGS="-W -Wall"
3538 cf_gxx_extra_warnings=""
3539 test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings"
3540 case "$GXX_VERSION" in
3544 cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++"
3551 Wignored-qualifiers \
3553 Woverloaded-virtual \
3561 Wundef $cf_gxx_extra_warnings $1
3563 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt"
3564 if AC_TRY_EVAL(ac_compile); then
3565 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
3566 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
3568 test -n "$verbose" && AC_MSG_RESULT(... no -$cf_opt)
3571 CXXFLAGS="$cf_save_CXXFLAGS"
3576 AC_SUBST(EXTRA_CXXFLAGS)
3578 dnl ---------------------------------------------------------------------------
3579 dnl CF_HASHED_DB version: 7 updated: 2015/04/18 08:56:57
3581 dnl Look for an instance of the Berkeley hashed database.
3583 dnl $1 = optional parameter, to specify install-prefix for the database.
3584 AC_DEFUN([CF_HASHED_DB],
3591 if test -d "$1" ; then
3592 CF_ADD_INCDIR($1/include)
3593 CF_ADD_LIBDIR($1/lib)
3597 AC_MSG_WARN(no such directory $1)
3600 CF_FIND_SUB_INCDIR($1)
3601 CF_FIND_SUB_LIBDIR($1)
3607 AC_CHECK_HEADER(db.h,[
3608 CF_HASHED_DB_VERSION
3609 if test "$cf_cv_hashed_db_version" = unknown ; then
3610 AC_MSG_ERROR(Cannot determine version of db)
3613 if test "$cf_cv_hashed_db_libs" = unknown ; then
3614 AC_MSG_ERROR(Cannot determine library for db)
3615 elif test "$cf_cv_hashed_db_libs" != default ; then
3616 CF_ADD_LIB($cf_cv_hashed_db_libs)
3620 AC_MSG_ERROR(Cannot find db.h)
3623 dnl ---------------------------------------------------------------------------
3624 dnl CF_HASHED_DB_LIBS version: 10 updated: 2021/01/02 17:09:14
3625 dnl -----------------
3626 dnl Given that we have the header and version for hashed database, find the
3627 dnl library information.
3628 AC_DEFUN([CF_HASHED_DB_LIBS],
3630 AC_CACHE_CHECK(for db libraries, cf_cv_hashed_db_libs,[
3631 cf_cv_hashed_db_libs=unknown
3632 for cf_db_libs in "" db$cf_cv_hashed_db_version db-$cf_cv_hashed_db_version db ''
3634 cf_save_libs="$LIBS"
3635 if test -n "$cf_db_libs"; then
3636 CF_ADD_LIB($cf_db_libs)
3638 CF_MSG_LOG(checking for library $cf_db_libs)
3640 $ac_includes_default
3643 char *path = "/tmp/foo";
3644 #ifdef DB_VERSION_MAJOR
3645 #if DB_VERSION_MAJOR >= 4
3647 db_create(&result, NULL, 0);
3648 result->open(result,
3655 #elif DB_VERSION_MAJOR >= 3
3657 db_create(&result, NULL, 0);
3658 result->open(result,
3664 #elif DB_VERSION_MAJOR >= 2
3673 #endif /* DB_VERSION_MAJOR */
3675 DB *result = dbopen(path,
3681 ${cf_cv_main_return:-return}(result != 0)
3683 if test -n "$cf_db_libs" ; then
3684 cf_cv_hashed_db_libs=$cf_db_libs
3686 cf_cv_hashed_db_libs=default
3688 LIBS="$cf_save_libs"
3691 LIBS="$cf_save_libs"
3695 dnl ---------------------------------------------------------------------------
3696 dnl CF_HASHED_DB_VERSION version: 4 updated: 2014/04/12 16:47:01
3697 dnl --------------------
3698 dnl Given that we have the header file for hashed database, find the version
3700 AC_DEFUN([CF_HASHED_DB_VERSION],
3702 AC_CACHE_CHECK(for version of db, cf_cv_hashed_db_version,[
3703 cf_cv_hashed_db_version=unknown
3705 for cf_db_version in 1 2 3 4 5 6
3707 CF_MSG_LOG(checking for db version $cf_db_version)
3709 $ac_includes_default
3712 #ifdef DB_VERSION_MAJOR
3713 /* db2 (DB_VERSION_MAJOR=2) has also DB_VERSION_MINOR, tested with 7 */
3714 #if $cf_db_version == DB_VERSION_MAJOR
3720 #if $cf_db_version == 1
3721 /* ok: assuming this is DB 1.8.5 */
3727 cf_cv_hashed_db_version=$cf_db_version
3733 dnl ---------------------------------------------------------------------------
3734 dnl CF_HEADER_PATH version: 15 updated: 2021/01/01 13:31:04
3736 dnl Construct a search-list of directories for a nonstandard header-file
3739 dnl $1 = the variable to return as result
3740 dnl $2 = the package name
3741 AC_DEFUN([CF_HEADER_PATH],
3745 # collect the current set of include-directories from compiler flags
3746 cf_header_path_list=""
3747 if test -n "${CFLAGS}${CPPFLAGS}" ; then
3748 for cf_header_path in $CPPFLAGS $CFLAGS
3750 case "$cf_header_path" in
3752 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
3753 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
3754 cf_header_path_list="$cf_header_path_list [$]$1"
3760 # add the variations for the package we are looking for
3761 CF_SUBDIR_PATH($1,$2,include)
3763 test "$includedir" != NONE && \
3764 test "$includedir" != "/usr/include" && \
3765 test -d "$includedir" && {
3766 test -d "$includedir" && $1="[$]$1 $includedir"
3767 test -d "$includedir/$2" && $1="[$]$1 $includedir/$2"
3770 test "$oldincludedir" != NONE && \
3771 test "$oldincludedir" != "/usr/include" && \
3772 test -d "$oldincludedir" && {
3773 test -d "$oldincludedir" && $1="[$]$1 $oldincludedir"
3774 test -d "$oldincludedir/$2" && $1="[$]$1 $oldincludedir/$2"
3777 $1="[$]$1 $cf_header_path_list"
3779 dnl ---------------------------------------------------------------------------
3780 dnl CF_HELP_MESSAGE version: 4 updated: 2019/12/31 08:53:54
3782 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
3783 AC_DEFUN([CF_HELP_MESSAGE],
3784 [CF_ACVERSION_CHECK(2.53,[],[
3785 AC_DIVERT_HELP($1)])dnl
3787 dnl ---------------------------------------------------------------------------
3788 dnl CF_INCLUDE_DIRS version: 10 updated: 2014/09/19 20:58:42
3790 dnl Construct the list of include-options according to whether we're building
3791 dnl in the source directory or using '--srcdir=DIR' option.
3792 AC_DEFUN([CF_INCLUDE_DIRS],
3794 if test "$srcdir" != "."; then
3795 CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS"
3797 CPPFLAGS="-I../include $CPPFLAGS"
3798 if test "$srcdir" != "."; then
3799 CPPFLAGS="-I\${srcdir} $CPPFLAGS"
3801 CPPFLAGS="-I. $CPPFLAGS"
3804 dnl ---------------------------------------------------------------------------
3805 dnl CF_INSTALL_OPTS version: 2 updated: 2018/08/18 12:19:21
3807 dnl prompt for/fill-in useful install-program options
3808 AC_DEFUN([CF_INSTALL_OPTS],
3814 dnl ---------------------------------------------------------------------------
3815 dnl CF_INSTALL_OPT_O version: 3 updated: 2020/12/31 20:19:42
3816 dnl ----------------
3817 dnl Almost all "install" programs default to the current user's ownership.
3818 dnl Almost - MINIX is an exception.
3819 AC_DEFUN([CF_INSTALL_OPT_O],
3821 AC_MSG_CHECKING(if install needs to be told about ownership)
3822 case `$ac_config_guess` in
3831 AC_MSG_RESULT($with_install_o)
3832 if test "x$with_install_o" = xyes
3834 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'`"
3839 AC_SUBST(INSTALL_OPT_O)
3841 dnl ---------------------------------------------------------------------------
3842 dnl CF_INSTALL_OPT_P version: 3 updated: 2021/01/01 13:31:04
3843 dnl ----------------
3844 dnl Some install-programs accept a "-p" option to preserve file modification
3845 dnl timestamps. That can be useful as an install option, as well as a way to
3846 dnl avoid the need for ranlib after copying a static archive.
3847 AC_DEFUN([CF_INSTALL_OPT_P],
3849 : "${INSTALL:=install}"
3850 AC_CACHE_CHECK(if install accepts -p option, cf_cv_install_p,[
3855 if $INSTALL -p conftest.in conftest.out 2>/dev/null
3857 if test -f conftest.out/conftest.in
3859 test conftest.in -nt conftest.out/conftest.in 2>conftest.err && \
3860 test conftest.out/conftest.in -nt conftest.in 2>conftest.err
3861 if test -s conftest.err
3876 dnl ---------------------------------------------------------------------------
3877 dnl CF_INSTALL_OPT_S version: 3 updated: 2021/01/05 19:23:48
3878 dnl ----------------
3879 dnl By default, we should strip executables which are installed, but leave the
3880 dnl ability to suppress that for unit-testing.
3881 AC_DEFUN([CF_INSTALL_OPT_S],
3883 AC_MSG_CHECKING(if you want to install stripped executables)
3884 CF_ARG_DISABLE(stripping,
3885 [ --disable-stripping do not strip (debug info) installed executables],
3886 [enable_stripping=no],
3887 [enable_stripping=yes])
3888 AC_MSG_RESULT($enable_stripping)
3890 if test "$enable_stripping" = yes
3896 AC_SUBST(INSTALL_OPT_S)
3898 dnl ---------------------------------------------------------------------------
3899 dnl CF_INTEL_COMPILER version: 8 updated: 2021/01/01 16:53:59
3900 dnl -----------------
3901 dnl Check if the given compiler is really the Intel compiler for Linux. It
3902 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
3903 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
3905 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
3906 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
3907 dnl the wrappers for gcc and g++ warnings.
3909 dnl $1 = GCC (default) or GXX
3910 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
3911 dnl $3 = CFLAGS (default) or CXXFLAGS
3912 AC_DEFUN([CF_INTEL_COMPILER],[
3913 AC_REQUIRE([AC_CANONICAL_HOST])
3914 ifelse([$2],,INTEL_COMPILER,[$2])=no
3916 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
3919 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
3920 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
3921 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
3923 #ifdef __INTEL_COMPILER
3927 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
3928 cf_save_CFLAGS="$cf_save_CFLAGS -we147"
3930 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
3931 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
3936 dnl ---------------------------------------------------------------------------
3937 dnl CF_ISASCII version: 4 updated: 2012/10/06 17:56:13
3939 dnl Check if we have either a function or macro for 'isascii()'.
3940 AC_DEFUN([CF_ISASCII],
3942 AC_MSG_CHECKING(for isascii)
3943 AC_CACHE_VAL(cf_cv_have_isascii,[
3944 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
3945 [cf_cv_have_isascii=yes],
3946 [cf_cv_have_isascii=no])
3948 AC_MSG_RESULT($cf_cv_have_isascii)
3949 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII,1,[Define to 1 if we have isascii()])
3951 dnl ---------------------------------------------------------------------------
3952 dnl CF_LARGEFILE version: 12 updated: 2020/03/19 20:23:48
3954 dnl Add checks for large file support.
3955 AC_DEFUN([CF_LARGEFILE],[
3956 ifdef([AC_FUNC_FSEEKO],[
3958 if test "$enable_largefile" != no ; then
3961 # Normally we would collect these definitions in the config.h,
3962 # but (like _XOPEN_SOURCE), some environments rely on having these
3963 # defined before any of the system headers are included. Another
3964 # case comes up with C++, e.g., on AIX the compiler compiles the
3965 # header files by themselves before looking at the body files it is
3966 # told to compile. For ncurses, those header files do not include
3968 if test "$ac_cv_sys_large_files" != no
3970 CF_APPEND_TEXT(CPPFLAGS,-D_LARGE_FILES)
3972 if test "$ac_cv_sys_largefile_source" != no
3974 CF_APPEND_TEXT(CPPFLAGS,-D_LARGEFILE_SOURCE)
3976 if test "$ac_cv_sys_file_offset_bits" != no
3978 CF_APPEND_TEXT(CPPFLAGS,-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits)
3981 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
3983 #pragma GCC diagnostic error "-Wincompatible-pointer-types"
3984 #include <sys/types.h>
3987 /* if transitional largefile support is setup, this is true */
3988 extern struct dirent64 * readdir(DIR *);
3989 struct dirent64 *x = readdir((DIR *)0);
3990 struct dirent *y = readdir((DIR *)0);
3994 [cf_cv_struct_dirent64=yes],
3995 [cf_cv_struct_dirent64=no])
3997 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
4001 dnl ---------------------------------------------------------------------------
4002 dnl CF_LDFLAGS_STATIC version: 14 updated: 2021/01/02 17:09:14
4003 dnl -----------------
4004 dnl Check for compiler/linker flags used to temporarily force usage of static
4005 dnl libraries. This depends on the compiler and platform. Use this to help
4006 dnl ensure that the linker picks up a given library based on its position in
4007 dnl the list of linker options and libraries.
4008 AC_DEFUN([CF_LDFLAGS_STATIC],[
4010 if test "$GCC" = yes ; then
4011 case "$cf_cv_system_name" in
4012 (OS/2*|os2*|aix[[4]]*|solaris2.1[[0-9]]|darwin*)
4016 (*) # normally, except when broken
4017 LDFLAGS_STATIC=-static
4018 LDFLAGS_SHARED=-dynamic
4022 case "$cf_cv_system_name" in
4023 (aix[[4-7]]*) # from ld manpage
4024 LDFLAGS_STATIC=-bstatic
4025 LDFLAGS_SHARED=-bdynamic
4027 (hpux*) # from ld manpage for hpux10.20, hpux11.11
4028 # We could also use just "archive" and "shared".
4029 LDFLAGS_STATIC=-Wl,-a,archive_shared
4030 LDFLAGS_SHARED=-Wl,-a,shared_archive
4032 (irix*) # from ld manpage IRIX64
4033 LDFLAGS_STATIC=-Bstatic
4034 LDFLAGS_SHARED=-Bdynamic
4036 (osf[[45]]*) # from ld manpage osf4.0d, osf5.1
4037 # alternative "-oldstyle_liblookup" (not in cc manpage)
4038 LDFLAGS_STATIC=-noso
4039 LDFLAGS_SHARED=-so_archive
4042 LDFLAGS_STATIC=-Bstatic
4043 LDFLAGS_SHARED=-Bdynamic
4048 if test -n "$LDFLAGS_STATIC" && test -n "$LDFLAGS_SHARED"
4050 AC_MSG_CHECKING(if linker supports switching between static/dynamic)
4053 cat >conftest.$ac_ext <<EOF
4054 #line __oline__ "configure"
4056 int cf_ldflags_static(FILE *fp) { return fflush(fp); }
4058 if AC_TRY_EVAL(ac_compile) ; then
4059 ( $AR $ARFLAGS libconftest.a conftest.o ) 2>&AC_FD_CC 1>/dev/null
4060 ( eval $RANLIB libconftest.a ) 2>&AC_FD_CC >/dev/null
4064 cf_save_LIBS="$LIBS"
4066 LIBS="$LDFLAGS_STATIC -L`pwd` -lconftest $LDFLAGS_DYNAMIC $LIBS"
4068 #line __oline__ "configure"
4070 int cf_ldflags_static(FILE *fp);
4072 return cf_ldflags_static(stdin);
4074 # some linkers simply ignore the -dynamic
4075 case x`file "conftest$ac_exeext" 2>/dev/null` in
4077 cf_ldflags_static=no
4080 cf_ldflags_static=yes
4083 ],[cf_ldflags_static=no])
4086 LIBS="$cf_save_LIBS"
4088 AC_MSG_RESULT($cf_ldflags_static)
4090 if test "$cf_ldflags_static" != yes
4100 AC_SUBST(LDFLAGS_STATIC)
4101 AC_SUBST(LDFLAGS_SHARED)
4103 dnl ---------------------------------------------------------------------------
4104 dnl CF_LD_RPATH_OPT version: 9 updated: 2021/01/01 13:31:04
4106 dnl For the given system and compiler, find the compiler flags to pass to the
4107 dnl loader to use the "rpath" feature.
4108 AC_DEFUN([CF_LD_RPATH_OPT],
4110 AC_REQUIRE([CF_CHECK_CACHE])
4113 if test "x$cf_cv_enable_rpath" != xno
4115 AC_MSG_CHECKING(for an rpath option)
4116 case "$cf_cv_system_name" in
4118 if test "$GCC" = yes; then
4119 LD_RPATH_OPT="-Wl,-rpath,"
4121 LD_RPATH_OPT="-rpath "
4124 (linux*|gnu*|k*bsd*-gnu|freebsd*)
4125 LD_RPATH_OPT="-Wl,-rpath,"
4127 (openbsd[[2-9]].*|mirbsd*)
4128 LD_RPATH_OPT="-Wl,-rpath,"
4131 LD_RPATH_OPT="-rpath "
4134 LD_RPATH_OPT="-Wl,-rpath,"
4137 LD_RPATH_OPT="-rpath "
4145 AC_MSG_RESULT($LD_RPATH_OPT)
4147 case "x$LD_RPATH_OPT" in
4149 AC_MSG_CHECKING(if we need a space after rpath option)
4150 cf_save_LIBS="$LIBS"
4151 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
4152 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
4153 LIBS="$cf_save_LIBS"
4154 AC_MSG_RESULT($cf_rpath_space)
4155 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
4160 dnl ---------------------------------------------------------------------------
4161 dnl CF_LD_SEARCHPATH version: 3 updated: 2021/03/05 19:13:35
4162 dnl ----------------
4163 dnl Try to obtain the linker's search-path, for use in scripts.
4165 dnl Ignore LD_LIBRARY_PATH, etc.
4166 AC_DEFUN([CF_LD_SEARCHPATH],[
4167 AC_CACHE_CHECK(for linker search path,cf_cv_ld_searchpath,[
4169 if test "$cross_compiling" != yes ; then
4171 # GNU binutils' ld does not involve permissions which may stop ldconfig.
4172 cf_pathlist=`ld --verbose 2>/dev/null | grep SEARCH_DIR | sed -e 's,SEARCH_DIR[[("=]][[("=]]*,,g' -e 's/"[[)]];//gp' | sort -u`
4174 # The -NX options tell newer versions of Linux ldconfig to not attempt to
4175 # update the cache, which makes it run faster.
4176 test -z "$cf_pathlist" && \
4177 cf_pathlist=`(ldconfig -NX -v) 2>/dev/null | sed -e '/^[[ ]]/d' -e 's/:$//' | sort -u`
4179 test -z "$cf_pathlist" &&
4180 cf_pathlist=`(ldconfig -v) 2>/dev/null | sed -n -e '/^[[ ]]/d' -e 's/:$//p' | sort -u`
4182 # This works with OpenBSD 6.5, which lists only filenames
4183 test -z "$cf_pathlist" &&
4184 cf_pathlist=`(ldconfig -v) 2>/dev/null | sed -n -e 's,^Adding \(.*\)/.*[$],\1,p' | sort -u`
4186 if test -z "$cf_pathlist"
4188 # dyld default path with MacOS
4189 if test -f /usr/bin/otool && test "x`uname -s`" = xDarwin
4191 # do this to bypass check
4192 cf_cv_ld_searchpath='$HOME/lib'
4193 cf_pathlist="/usr/local/lib /lib /usr/lib"
4197 if test -z "$cf_pathlist"
4199 # Solaris is "SunOS"
4200 if test -f /usr/bin/isainfo && test "x`uname -s`" = xSunOS
4202 case x`(isainfo -b)` in
4204 cf_pathlist="$cf_pathlist /lib/64 /usr/lib/64"
4207 test -d /usr/ccs/lib && cf_pathlist="$cf_pathlist /usr/ccs/lib"
4208 cf_pathlist="$cf_pathlist /lib /usr/lib"
4211 AC_MSG_WARN(problem with Solaris architecture)
4217 if test -z "$cf_pathlist"
4220 if test x"`uname -s`" = xHP-UX
4222 case x`getconf LONG_BIT` in
4224 cf_pathlist="/usr/lib/hpux64"
4227 cf_pathlist="/usr/lib/hpux32"
4235 # If nothing else, assume it is conventional
4236 test -z "$cf_pathlist" && cf_pathlist="/usr/lib /lib"
4238 # Finally, check that this is only directories
4239 for cf_path in [$]0 $cf_pathlist
4241 if test -d "$cf_path"; then
4242 test -n "$cf_cv_ld_searchpath" && cf_cv_ld_searchpath="${cf_cv_ld_searchpath} "
4243 cf_cv_ld_searchpath="${cf_cv_ld_searchpath}${cf_path}"
4247 # Ensure that it is nonempty
4248 test -z "$cf_cv_ld_searchpath" && cf_cv_ld_searchpath=/usr/lib
4251 LD_SEARCHPATH=`echo "$cf_cv_ld_searchpath"|sed -e 's/ /|/g'`
4252 AC_SUBST(LD_SEARCHPATH)
4254 dnl ---------------------------------------------------------------------------
4255 dnl CF_LIBRARY_PATH version: 11 updated: 2021/01/01 13:31:04
4257 dnl Construct a search-list of directories for a nonstandard library-file
4260 dnl $1 = the variable to return as result
4261 dnl $2 = the package name
4262 AC_DEFUN([CF_LIBRARY_PATH],
4265 cf_library_path_list=""
4266 if test -n "${LDFLAGS}${LIBS}" ; then
4267 for cf_library_path in $LDFLAGS $LIBS
4269 case "$cf_library_path" in
4271 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
4272 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
4273 cf_library_path_list="$cf_library_path_list [$]$1"
4279 CF_SUBDIR_PATH($1,$2,lib)
4281 $1="$cf_library_path_list [$]$1"
4283 dnl ---------------------------------------------------------------------------
4284 dnl CF_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
4285 dnl ------------------
4286 AC_DEFUN([CF_LIBTOOL_VERSION],[
4287 if test -n "$LIBTOOL" && test "$LIBTOOL" != none
4289 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.]].*//'`
4291 cf_cv_libtool_version=
4293 test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version
4295 dnl ---------------------------------------------------------------------------
4296 dnl CF_LIB_PREFIX version: 14 updated: 2021/01/01 13:31:04
4298 dnl Compute the library-prefix for the given host system
4299 dnl $1 = variable to set
4300 define([CF_LIB_PREFIX],
4302 case "$cf_cv_system_name" in
4304 if test "$DFT_LWR_MODEL" = libtool; then
4313 (*) LIB_PREFIX='lib'
4316 ifelse($1,,,[$1=$LIB_PREFIX])
4317 AC_SUBST(LIB_PREFIX)
4319 dnl ---------------------------------------------------------------------------
4320 dnl CF_LIB_RULES version: 97 updated: 2021/07/17 13:10:54
4322 dnl Append definitions and rules for the given models to the subdirectory
4323 dnl Makefiles, and the recursion rule for the top-level Makefile. If the
4324 dnl subdirectory is a library-source directory, modify the Libs_To_Make list in
4325 dnl the corresponding makefile to list the models that we'll generate.
4327 dnl For shared libraries, make a list of symbolic links to construct when
4328 dnl generating each library. The convention used for Linux is the simplest
4331 dnl lib<name>.so.<major> ->
4332 dnl lib<name>.so.<maj>.<minor>
4334 dnl Note: Libs_To_Make is mixed case, since it is not a pure autoconf variable.
4335 AC_DEFUN([CF_LIB_RULES],
4336 [AC_REQUIRE([AC_PROG_FGREP])dnl
4337 AC_REQUIRE([CF_MAKE_PHONY])dnl
4339 cf_prefix=$LIB_PREFIX
4340 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
4342 case "$cf_cv_shlib_version" in
4343 (cygdll|msysdll|mingw|msvcdll)
4344 TINFO_NAME=$TINFO_ARG_SUFFIX
4349 if test -n "$TINFO_SUFFIX" ; then
4350 case "$TINFO_SUFFIX" in
4352 TINFO_NAME="${TINFO_NAME}tw${EXTRA_SUFFIX}"
4353 TINFO_SUFFIX=`echo "$TINFO_SUFFIX" | sed 's/^tw'$EXTRA_SUFFIX'//'`
4356 TINFO_NAME="${TINFO_NAME}t${EXTRA_SUFFIX}"
4357 TINFO_SUFFIX=`echo "$TINFO_SUFFIX" | sed 's/^t'$EXTRA_SUFFIX'//'`
4360 TINFO_NAME="${TINFO_NAME}w${EXTRA_SUFFIX}"
4361 TINFO_SUFFIX=`echo "$TINFO_SUFFIX" | sed 's/^w'$EXTRA_SUFFIX'//'`
4366 for cf_dir in $SRC_SUBDIRS
4368 if test ! -d "$srcdir/$cf_dir" ; then
4370 elif test -f "$srcdir/$cf_dir/modules" ; then
4375 if test -n "${cf_cv_abi_version}" && test "x${cf_cv_abi_version}" != "x5"
4377 cf_awk_program="$cf_awk_program\
4378 /deprecated in ABI${cf_cv_abi_version}/ { next; }\
4379 { sub(\"NCURSES([[WT]]+)?\", \"&${cf_cv_abi_version}\"); }\
4383 if test "x$WILDCARD_SYMS" = xno
4385 cf_awk_program="$cf_awk_program\
4386 /[[ ]]_\\*;/ { skip=1; next; }\
4390 if test "x$cf_awk_program" != "x"
4392 cat >>$cf_dir/Makefile <<CF_EOF
4394 # Generated by CF_LIB_RULES
4395 resulting.map: $UNALTERED_SYMS
4396 $AWK 'BEGIN { skip = 1; last=""; } \
4398 { if ( last != "" && ( skip == 0 || \[$]\[$]0 !~ /}/ ) ) { print last; }\
4399 skip = 0; last = \[$]\[$]0; } \
4400 END { print last; }' < "$UNALTERED_SYMS" >\[$]@
4407 for cf_item in $cf_LIST_MODELS
4409 CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
4410 if test "$cf_dir" = "c++"
4412 CF_MAP_LIB_BASENAME(cf_libname,cxx)
4414 CF_MAP_LIB_BASENAME(cf_libname,$cf_dir)
4416 test -z "$cf_libname" && cf_libname="$cf_dir"
4417 if test "$cf_item" = shared ; then
4418 if test -n "${LIB_SUFFIX}"
4420 cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${USE_LIB_SUFFIX}"'//'`
4422 cf_shared_suffix="$cf_suffix"
4424 if test "$cf_cv_do_symlinks" = yes ; then
4427 case "$cf_cv_shlib_version" in
4429 cf_version_name=REL_VERSION
4432 cf_version_name=ABI_VERSION
4436 if test -n "$cf_version_name"
4438 case "$cf_cv_system_name" in
4441 cf_suffix="${USE_LIB_SUFFIX}"'.${'$cf_version_name'}'"$cf_shared_suffix"
4444 cf_suffix="$cf_suffix"'.${'$cf_version_name'}'
4448 if test -n "${USE_LIB_SUFFIX}"
4450 cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${USE_LIB_SUFFIX}"'//'`
4452 cf_shared_suffix="$cf_suffix"
4455 # cygwin needs import library, and has unique naming convention
4456 # use autodetected ${cf_prefix} for import lib and static lib, but
4457 # use 'cyg' prefix for shared lib.
4458 case "$cf_cv_shlib_version" in
4460 cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
4461 cf_add_lib="../lib/cyg${cf_libname}${cf_cygsuf}"
4464 cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
4465 cf_add_lib="../lib/msys-${cf_libname}${cf_cygsuf}"
4468 cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
4469 cf_add_lib="../lib/lib${cf_libname}${cf_cygsuf}"
4472 cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
4473 cf_add_lib="../lib/${cf_libname}${cf_cygsuf}"
4479 if test -n "$cf_add_lib"
4481 Libs_To_Make="$Libs_To_Make $cf_add_lib"
4485 cf_add_lib="../lib/${cf_prefix}${cf_libname}${cf_suffix}"
4486 Libs_To_Make="$Libs_To_Make $cf_add_lib"
4489 if test "$cf_dir" = ncurses ; then
4490 cf_subsets="$LIB_SUBSETS"
4491 cf_r_parts="$cf_subsets"
4492 cf_liblist="$Libs_To_Make"
4494 while test -n "$cf_r_parts"
4496 cf_l_parts=`echo "$cf_r_parts" |sed -e 's/ .*$//'`
4497 cf_r_parts=`echo "$cf_r_parts" |sed -e 's/^[[^ ]]* //'`
4498 if test "$cf_l_parts" != "$cf_r_parts" ; then
4500 case "$cf_l_parts" in
4502 cf_add_lib=`echo "$cf_liblist" |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g`
4505 cf_add_lib=`echo "$cf_liblist" |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TICS_LIB_SUFFIX}%g`
4511 if test -n "$cf_add_lib"; then
4512 Libs_To_Make="$cf_add_lib $Libs_To_Make"
4519 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
4522 if test "$cf_dir" = c++; then
4523 if test "x$with_shared_cxx" != xyes && test -n "$cf_shared_suffix"; then
4525 for cf_item in $Libs_To_Make
4531 cf_item=`echo "$cf_item" | sed -e "s,"$cf_shared_suffix",.a,"`
4534 for cf_test in $cf_list
4536 if test "$cf_test" = "$cf_item"
4538 cf_LIST_MODELS=`echo "$cf_LIST_MODELS" | sed -e 's/normal//'`
4543 test -n "$cf_item" && cf_list="$cf_list $cf_item"
4545 Libs_To_Make="$cf_list"
4549 sed -e "s%@Libs_To_Make@%$Libs_To_Make%" \
4550 -e "s%@SHARED_LIB@%$SHARED_LIB%" \
4551 "$cf_dir/Makefile" >$cf_dir/Makefile.out
4552 mv "$cf_dir/Makefile.out" "$cf_dir/Makefile"
4554 $AWK -f "$srcdir/mk-0th.awk" \
4555 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" ticlib="$TICS_LIB_SUFFIX" termlib="$TINFO_LIB_SUFFIX" \
4556 "$srcdir/$cf_dir/modules" >>$cf_dir/Makefile
4558 for cf_subset in $cf_subsets
4561 for cf_item in $cf_LIST_MODELS
4564 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
4565 CF_UPPER(cf_ITEM,$cf_item)
4568 if test "$CXX_MODEL" = SHARED; then
4569 case "$cf_cv_shlib_version" in
4570 (cygdll|msysdll|mingw|msvcdll)
4571 test "x$with_shared_cxx" = xno && CF_VERBOSE(overriding CXX_MODEL to SHARED)
4575 test "x$with_shared_cxx" = xno && CXX_MODEL=NORMAL
4580 CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
4581 CF_OBJ_SUBDIR($cf_item,cf_subdir)
4583 # Test for case where we build libtinfo with a different name.
4585 if test "$cf_dir" = ncurses ; then
4586 case "$cf_subset" in
4588 cf_libname=${cf_libname}$USE_LIB_SUFFIX
4591 cf_libname=$TINFO_LIB_SUFFIX
4594 cf_libname=$TICS_LIB_SUFFIX
4597 elif test "$cf_dir" = c++ ; then
4598 CF_MAP_LIB_BASENAME(cf_libname,cxx)
4599 cf_libname=${cf_libname}$USE_LIB_SUFFIX
4601 CF_MAP_LIB_BASENAME(cf_libname,$cf_dir)
4602 cf_libname=${cf_libname}$USE_LIB_SUFFIX
4604 if test -n "${USE_ARG_SUFFIX}" ; then
4605 # undo $USE_LIB_SUFFIX add-on in CF_LIB_SUFFIX
4606 cf_suffix=`echo "$cf_suffix" |sed -e "s%^${USE_LIB_SUFFIX}%%"`
4609 # These dependencies really are for development, not
4610 # builds, but they are useful in porting, too.
4611 cf_depend="../include/ncurses_cfg.h"
4612 if test "$srcdir" = "."; then
4615 cf_reldir="\${srcdir}"
4618 if test -f "$srcdir/$cf_dir/$cf_dir.priv.h" ; then
4619 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
4620 elif test -f "$srcdir/$cf_dir/curses.priv.h" ; then
4621 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
4625 old_cf_suffix="$cf_suffix"
4626 if test "$cf_cv_shlib_version_infix" = yes ; then
4627 if test -n "$USE_LIB_SUFFIX" ; then
4628 case "$USE_LIB_SUFFIX" in
4630 cf_libname=`echo "$cf_libname" | sed 's/tw'$EXTRA_SUFFIX'$//'`
4631 cf_suffix=`echo "$cf_suffix" | sed 's/^tw'$EXTRA_SUFFIX'//'`
4632 cf_dir_suffix=tw$EXTRA_SUFFIX
4635 cf_libname=`echo "$cf_libname" | sed 's/t'$EXTRA_SUFFIX'$//'`
4636 cf_suffix=`echo "$cf_suffix" | sed 's/^t'$EXTRA_SUFFIX'//'`
4637 cf_dir_suffix=t$EXTRA_SUFFIX
4640 cf_libname=`echo "$cf_libname" | sed 's/w'$EXTRA_SUFFIX'$//'`
4641 cf_suffix=`echo "$cf_suffix" | sed 's/^w'$EXTRA_SUFFIX'//'`
4642 cf_dir_suffix=w$EXTRA_SUFFIX
4645 cf_libname=`echo "$cf_libname" | sed 's/'$EXTRA_SUFFIX'$//'`
4646 cf_suffix=`echo "$cf_suffix" | sed 's/^'$EXTRA_SUFFIX'//'`
4647 cf_dir_suffix=$EXTRA_SUFFIX
4653 $AWK -f "$srcdir/mk-1st.awk" \
4654 name=${cf_libname}${cf_dir_suffix} \
4655 traces=$LIB_TRACING \
4657 CXX_MODEL=$CXX_MODEL \
4658 LIB_SUFFIX=$LIB_SUFFIX \
4659 USE_LIB_SUFFIX=$USE_LIB_SUFFIX \
4660 make_phony="${cf_cv_make_PHONY:-no}" \
4665 driver=$cf_cv_term_driver \
4667 TermlibRoot=$TINFO_NAME \
4668 TermlibSuffix=$TINFO_SUFFIX \
4669 ShlibVer=$cf_cv_shlib_version \
4670 ShlibVerInfix=$cf_cv_shlib_version_infix \
4671 ReLink=${cf_cv_do_relink:-no} \
4672 ReRanlib=${cf_cv_do_reranlib:-yes} \
4673 DoLinks=$cf_cv_do_symlinks \
4674 rmSoLocs=$cf_cv_rm_so_locs \
4675 ldconfig="$LDCONFIG" \
4676 overwrite=$WITH_OVERWRITE \
4677 depend="$cf_depend" \
4679 libtool_version="$LIBTOOL_VERSION" \
4680 "$srcdir/$cf_dir/modules" >>$cf_dir/Makefile
4682 cf_suffix="$old_cf_suffix"
4684 for cf_subdir2 in $cf_subdirs lib
4686 test "$cf_subdir" = "$cf_subdir2" && break
4688 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
4689 $AWK -f "$srcdir/mk-2nd.awk" \
4691 traces=$LIB_TRACING \
4697 crenames=$cf_cv_prog_CC_c_o \
4698 cxxrenames=$cf_cv_prog_CXX_c_o \
4699 "$srcdir/$cf_dir/modules" >>$cf_dir/Makefile
4700 cf_subdirs="$cf_subdirs $cf_subdir"
4705 echo ' ( cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@ )' >>Makefile
4709 echo '# generated by CF_LIB_RULES' >> Makefile
4711 if test "x$cf_cv_make_PHONY" = xyes ; then
4712 cat >> Makefile <<-CF_EOF
4716 .PHONY : install.includes
4717 .PHONY : uninstall.includes
4718 .PHONY : install.libs
4719 .PHONY : uninstall.libs
4723 for cf_dir in $SRC_SUBDIRS
4725 if test ! -d "$srcdir/$cf_dir" ; then
4729 if test -f "$cf_dir/Makefile" ; then
4732 echo 'libs \' >> Makefile
4733 echo 'install.libs \' >> Makefile
4734 echo 'uninstall.libs ::' >> Makefile
4735 echo ' ( cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@ )' >> Makefile
4740 if test -f "$srcdir/$cf_dir/modules" ; then
4742 if test "x$cf_cv_make_PHONY" = xyes ; then
4743 cat >> Makefile <<-CF_EOF
4745 .PHONY : install.$cf_dir
4746 .PHONY : uninstall.$cf_dir
4751 if test -f "$srcdir/$cf_dir/headers" ; then
4752 cat >> Makefile <<CF_EOF
4754 uninstall.includes \\
4758 cat >> Makefile <<CF_EOF
4765 uninstall.$cf_dir ::
4766 ( cd "$cf_dir" && \${MAKE} \${TOP_MFLAGS} \[$]@ )
4768 elif test -f "$srcdir/$cf_dir/headers" ; then
4769 cat >> Makefile <<CF_EOF
4775 uninstall.includes ::
4776 ( cd "$cf_dir" && \${MAKE} \${TOP_MFLAGS} \[$]@ )
4781 if test "x$cf_cv_make_PHONY" = xyes ; then
4782 cat >> Makefile <<-CF_EOF
4784 .PHONY : install.data
4785 .PHONY : uninstall.data
4789 if test "x$cf_with_db_install" = xyes; then
4790 cat >> Makefile <<CF_EOF
4792 install.libs uninstall.libs \\
4793 install.data uninstall.data ::
4794 $MAKE_TERMINFO ( cd misc && \${MAKE} \${TOP_MFLAGS} \[$]@ )
4797 cat >> Makefile <<CF_EOF
4799 install.libs uninstall.libs ::
4800 ( cd misc && \${MAKE} \${TOP_MFLAGS} \[$]@ )
4804 if test "x$cf_with_manpages" = xyes; then
4806 if test "x$cf_cv_make_PHONY" = xyes ; then
4807 cat >> Makefile <<-CF_EOF
4809 .PHONY : install.man
4810 .PHONY : uninstall.man
4814 cat >> Makefile <<CF_EOF
4818 ( cd man && \${MAKE} \${TOP_MFLAGS} \[$]@ )
4822 cat >> Makefile <<CF_EOF
4825 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
4826 rm -f headers.sh headers.sed mk_shared_lib.sh
4827 rm -f edit_man.* man_alias.*
4828 rm -rf \${DIRS_TO_MAKE}
4831 # Special case: tack's manpage lives in its own directory.
4832 if test "x$cf_with_manpages" = xyes; then
4833 if test "x$cf_with_tack" = "xyes"; then
4834 cat >> Makefile <<CF_EOF
4838 ( cd tack && \${MAKE} \${TOP_MFLAGS} \[$]@ )
4843 dnl If we're installing into a subdirectory of /usr/include, etc., we should
4844 dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
4845 dnl anything, and will make it more standardized. It's awkward to decide this
4846 dnl at configuration because of quoting, so we'll simply make all headers
4847 dnl installed via a script that can do the right thing.
4849 rm -f headers.sed headers.sh
4851 dnl ( generating this script makes the makefiles a little tidier :-)
4852 echo creating headers.sh
4853 cat >headers.sh <<CF_EOF
4855 # This shell script is generated by the 'configure' script. It is invoked in a
4856 # subdirectory of the build tree. It generates a sed-script in the parent
4857 # directory that is used to adjust includes for header files that reside in a
4858 # subdirectory of /usr/include, etc.
4860 while test \[$]# != 3
4862 PRG="\$PRG \[$]1"; shift
4867 TMPSRC=\${TMPDIR:-/tmp}/\`basename \$SRC\`\$\$
4868 TMPSED=\${TMPDIR:-/tmp}/headers.sed\$\$
4869 echo installing \$SRC in \$DST
4872 if test "$WITH_CURSES_H" = yes; then
4873 cat >>headers.sh <<CF_EOF
4876 END=\`basename \$DST\`
4877 for i in \`cat \$REF/../*/headers |${FGREP-fgrep} -v "#"\`
4879 NAME=\`basename \$i\`
4880 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
4890 cat >>headers.sh <<CF_EOF
4893 END=\`basename \$DST\`
4894 for i in \`cat \$REF/../*/headers |${FGREP-fgrep} -v "#"\`
4896 NAME=\`basename \$i\`
4897 if test "\$NAME" = "curses.h"
4899 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
4902 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
4906 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
4911 cat >>headers.sh <<CF_EOF
4913 sed -f \$TMPSED \$SRC > \$TMPSRC
4914 NAME=\`basename \$SRC\`
4916 if test "$WITH_CURSES_H" != yes; then
4917 cat >>headers.sh <<CF_EOF
4918 test "\$NAME" = "curses.h" && NAME=ncurses.h
4921 cat >>headers.sh <<CF_EOF
4922 # Just in case someone gzip'd manpages, remove the conflicting copy.
4923 test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
4925 eval \$PRG \$TMPSRC \$DST/\$NAME
4926 rm -f \$TMPSRC \$TMPSED
4929 chmod 0755 headers.sh
4931 for cf_dir in $SRC_SUBDIRS
4933 if test ! -d "$srcdir/$cf_dir" ; then
4937 if test -f "$srcdir/$cf_dir/headers" ; then
4938 $AWK -f "$srcdir/mk-hdr.awk" \
4939 subset="$LIB_SUBSETS" \
4940 compat="$WITH_CURSES_H" \
4941 "$srcdir/$cf_dir/headers" >>$cf_dir/Makefile
4944 if test -f "$srcdir/$cf_dir/modules" ; then
4945 if test "$cf_dir" != "c++" ; then
4946 if test "x$cf_cv_make_PHONY" = xyes ; then
4947 cat >> $cf_dir/Makefile <<-CF_EOF
4953 cat >>$cf_dir/Makefile <<"CF_EOF"
4954 depend : ${AUTO_SRC}
4955 makedepend -- ${CPPFLAGS} -- ${C_SRC}
4957 # DO NOT DELETE THIS LINE -- make depend depends on it.
4962 AC_SUBST(Libs_To_Make)
4964 dnl ---------------------------------------------------------------------------
4965 dnl CF_LIB_SONAME version: 9 updated: 2021/01/04 18:48:01
4967 dnl Find the and soname for the given shared library. Set the cache variable
4968 dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache
4969 dnl variable to "unknown".
4973 dnl $3 = library name
4974 AC_DEFUN([CF_LIB_SONAME],
4975 [AC_REQUIRE([AC_PROG_FGREP])dnl
4977 AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[
4979 cf_cv_$3_soname=unknown
4980 if test "$cross_compiling" != yes ; then
4981 cat >conftest.$ac_ext <<CF_EOF
4986 ${cf_cv_main_return:-return}(0);
4989 cf_save_LIBS="$LIBS"
4991 if AC_TRY_EVAL(ac_compile) ; then
4992 if AC_TRY_EVAL(ac_link) ; then
4993 cf_cv_$3_soname="`ldd \"conftest$ac_exeext\" 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | ${FGREP-fgrep} lib$3.`"
4994 test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown
4998 LIBS="$cf_save_LIBS"
5002 dnl ---------------------------------------------------------------------------
5003 dnl CF_LIB_SUFFIX version: 28 updated: 2021/01/01 16:53:59
5005 dnl Compute the library file-suffix from the given model name
5007 dnl $2 = variable to set (the nominal library suffix)
5008 dnl $3 = dependency variable to set (actual filename)
5009 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
5010 AC_DEFUN([CF_LIB_SUFFIX],
5018 case "$cf_cv_system_name" in
5029 case "$cf_cv_system_name" in
5040 case "$cf_cv_system_name" in
5049 (cygwin*|msys*|mingw*)
5087 if test -n "${LIB_SUFFIX}${EXTRA_SUFFIX}"
5089 $2="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$2}"
5090 $3="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$3}"
5093 dnl ---------------------------------------------------------------------------
5094 dnl CF_LIB_TYPE version: 5 updated: 2015/04/17 21:13:04
5096 dnl Compute the string to append to -library from the given model name
5098 dnl $2 = variable to set
5099 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
5100 AC_DEFUN([CF_LIB_TYPE],
5106 (profile) $2='_p' ;;
5109 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
5111 dnl ---------------------------------------------------------------------------
5112 dnl CF_LINK_DATAONLY version: 13 updated: 2020/02/08 15:59:30
5113 dnl ----------------
5114 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
5115 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
5116 dnl have to provide wrappers for global tables to ensure they're linked
5118 AC_DEFUN([CF_LINK_DATAONLY],
5120 AC_MSG_CHECKING([if data-only library module links])
5121 AC_CACHE_VAL(cf_cv_link_dataonly,[
5123 cat >conftest.$ac_ext <<EOF
5124 #line __oline__ "configure"
5125 int testdata[[3]] = { 123, 456, 789 };
5127 if AC_TRY_EVAL(ac_compile) ; then
5128 mv conftest.o data.o && \
5129 ( $AR $ARFLAGS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null
5131 rm -f conftest.$ac_ext data.o
5132 cat >conftest.$ac_ext <<EOF
5133 #line __oline__ "configure"
5137 ${cf_cv_main_return:-return}(1); /* I'm told this linker is broken */
5139 extern int testdata[[3]];
5140 return testdata[[0]] == 123
5141 && testdata[[1]] == 456
5142 && testdata[[2]] == 789;
5146 if AC_TRY_EVAL(ac_compile); then
5147 mv conftest.o func.o && \
5148 ( $AR $ARFLAGS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null
5150 rm -f conftest.$ac_ext func.o
5151 ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null
5153 LIBS="conftest.a $LIBS"
5157 extern int testfunc();
5158 ${cf_cv_main_return:-return} (!testfunc());
5161 [cf_cv_link_dataonly=yes],
5162 [cf_cv_link_dataonly=no],
5163 [cf_cv_link_dataonly=unknown])
5166 AC_MSG_RESULT($cf_cv_link_dataonly)
5168 if test "$cf_cv_link_dataonly" = no ; then
5169 AC_DEFINE(BROKEN_LINKER,1,[if data-only library module does not link])
5172 AC_SUBST(BROKEN_LINKER)
5175 dnl ---------------------------------------------------------------------------
5176 dnl CF_LINK_FUNCS version: 11 updated: 2021/04/18 14:08:47
5178 dnl Most Unix systems have both link and symlink, a few don't have symlink.
5179 dnl A few non-Unix systems implement symlink, but not link.
5180 dnl A few non-systems implement neither (or have nonfunctional versions).
5182 dnl This allows for a 2-second difference in modification times to allow for
5183 dnl some marginal NFS implementations.
5184 AC_DEFUN([CF_LINK_FUNCS],
5193 if test "$cross_compiling" = yes ; then
5198 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
5200 for cf_func in link symlink ; do
5203 #include <sys/types.h>
5204 #include <sys/stat.h>
5205 #ifdef HAVE_UNISTD_H
5211 char *src = "conftest.tmp";
5212 char *dst = "conftest.chk";
5213 struct stat src_sb, dst_sb;
5214 FILE *fp = fopen(src, "w");
5215 if (fp == 0) { fail = 3; } else {
5216 fclose(fp); stat(src, &src_sb);
5217 if ($cf_func(src, dst) < 0) {
5219 } else if (stat(dst, &dst_sb) < 0) {
5222 long diff = (dst_sb.st_mtime - src_sb.st_mtime);
5223 if (diff < 0) diff = -diff;
5224 if (diff > 2) fail = 3;
5228 unlink(dst); unlink(src);
5230 remove(dst); remove(src);
5232 ${cf_cv_main_return:-return} (fail);
5235 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
5236 eval 'ac_cv_func_'$cf_func'=yes'],[
5237 eval 'ac_cv_func_'$cf_func'=no'],[
5238 eval 'ac_cv_func_'$cf_func'=error'])
5240 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
5242 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK,1,[Define to 1 if we have link() function])
5243 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK,1,[Define to 1 if we have symlink() function])
5246 dnl ---------------------------------------------------------------------------
5247 dnl CF_MAKEFLAGS version: 20 updated: 2021/01/03 19:29:49
5249 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
5250 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
5251 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
5252 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
5253 AC_DEFUN([CF_MAKEFLAGS],
5254 [AC_REQUIRE([AC_PROG_FGREP])dnl
5256 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
5258 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
5260 cat >cf_makeflags.tmp <<CF_EOF
5263 @ echo '.$cf_option'
5265 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | ${FGREP-fgrep} -v "ing directory" | sed -e 's,[[ ]]*$,,'`
5266 case "$cf_result" in
5268 cf_result="`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`"
5269 case "$cf_result" in
5270 (.*CC=*) cf_cv_makeflags=
5272 (*) cf_cv_makeflags=$cf_option
5280 CF_MSG_LOG(given option \"$cf_option\", no match \"$cf_result\")
5284 rm -f cf_makeflags.tmp
5287 AC_SUBST(cf_cv_makeflags)
5289 dnl ---------------------------------------------------------------------------
5290 dnl CF_MAKE_PHONY version: 3 updated: 2021/01/08 16:08:21
5292 dnl Check if the make-program handles a ".PHONY" target, e.g,. a target which
5293 dnl acts as a placeholder.
5295 dnl The ".PHONY" feature was proposed in 2011 here
5296 dnl https://www.austingroupbugs.net/view.php?id=523
5297 dnl and is scheduled for release in P1003.1 Issue 8 (late 2022).
5299 dnl This is not supported by SVr4 make (or SunOS 4, 4.3SD, etc), but works with
5300 dnl a few others (i.e., GNU make and the non-POSIX "BSD" make):
5302 dnl + This is a GNU make feature (since April 1988, but in turn from binutils,
5303 dnl date unspecified).
5305 dnl + It was adopted in NetBSD make in June 1995.
5307 dnl + The other BSD make programs are derived from the NetBSD make (and for
5308 dnl that reason are not actually different "implementations").
5310 dnl + Some features of NetBSD make were actually adapted from pmake, which
5311 dnl began as a modified GNU make starting in 1993.
5313 dnl + Version 3.8 of the dmake program in January 1992 also implemented this
5314 dnl GNU make extension, but is less well known than the BSD make.
5315 AC_DEFUN([CF_MAKE_PHONY],[
5316 AC_CACHE_CHECK(for \".PHONY\" make-support, cf_cv_make_PHONY,[
5319 mkdir conftest || exit 1
5321 cat >makefile <<'CF_EOF'
5325 @echo "** making [$]@ [$](DATA)"
5327 @echo "** making [$]@ [$](DATA)"
5329 @echo "** making [$]@ [$](DATA)"
5330 echo [$](DATA) > [$]@
5332 @echo "** making [$]@ [$](DATA)"
5333 echo [$](DATA) > [$]@
5335 for cf_data in 1 2 3
5337 ${MAKE:-make} always DATA=$cf_data
5338 ${MAKE:-make} once DATA=$cf_data
5339 ${MAKE:-make} -t always once
5340 if test -f always ; then
5341 echo "no (case 1)" > ../conftest.tmp
5342 elif test ! -f always.out ; then
5343 echo "no (case 2)" > ../conftest.tmp
5344 elif test ! -f once.out ; then
5345 echo "no (case 3)" > ../conftest.tmp
5346 elif ! cmp -s always.out once.out ; then
5347 echo "no (case 4)" > ../conftest.tmp
5348 diff always.out once.out
5350 cf_check="`cat always.out`"
5351 if test "x$cf_check" != "x$cf_data" ; then
5352 echo "no (case 5)" > ../conftest.tmp
5354 echo yes > ../conftest.tmp
5362 cf_cv_make_PHONY="`cat conftest.tmp`"
5367 test "x$cf_cv_make_PHONY" = xyes && MAKE_PHONY=
5368 test "x$cf_cv_make_PHONY" != xyes && MAKE_NO_PHONY=
5369 AC_SUBST(MAKE_NO_PHONY)
5370 AC_SUBST(MAKE_PHONY)
5372 dnl ---------------------------------------------------------------------------
5373 dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
5375 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
5376 dnl a monocase filesystem.
5377 AC_DEFUN([CF_MAKE_TAGS],[
5378 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
5380 AC_CHECK_PROGS(CTAGS, exctags ctags)
5381 AC_CHECK_PROGS(ETAGS, exetags etags)
5383 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
5385 if test "$cf_cv_mixedcase" = yes ; then
5386 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
5391 if test "$MAKE_UPPER_TAGS" = yes ; then
5397 if test "$MAKE_LOWER_TAGS" = yes ; then
5406 AC_SUBST(MAKE_UPPER_TAGS)
5407 AC_SUBST(MAKE_LOWER_TAGS)
5409 dnl ---------------------------------------------------------------------------
5410 dnl CF_MANPAGE_FORMAT version: 14 updated: 2021/01/02 17:09:14
5411 dnl -----------------
5412 dnl Option to allow user to override automatic configuration of manpage format.
5413 dnl There are several special cases:
5415 dnl gzip - man checks for, can display gzip'd files
5416 dnl compress - man checks for, can display compressed files
5417 dnl BSDI - files in the cat-directories are suffixed ".0"
5418 dnl formatted - installer should format (put files in cat-directory)
5419 dnl catonly - installer should only format, e.g., for a turnkey system.
5421 dnl There are other configurations which this macro does not test, e.g., HPUX's
5422 dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming
5423 dnl convention would not match our use).
5424 AC_DEFUN([CF_MANPAGE_FORMAT],
5426 AC_REQUIRE([CF_PATHSEP])
5427 AC_MSG_CHECKING(format of man-pages)
5429 AC_ARG_WITH(manpage-format,
5430 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
5431 optionally formatted/catonly, e.g., gzip,formatted],
5432 [MANPAGE_FORMAT=$withval],
5433 [MANPAGE_FORMAT=unknown])
5435 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown
5436 MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'`
5440 case "$MANPAGE_FORMAT" in
5442 if test -z "$MANPATH" ; then
5443 MANPATH="/usr/man:/usr/share/man"
5446 # look for the 'date' man-page (it's most likely to be installed!)
5452 IFS="${IFS:- }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
5453 for cf_dir in $MANPATH; do
5454 test -z "$cf_dir" && cf_dir=/usr/man
5455 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
5457 cf_test=`echo "$cf_name" | sed -e 's/*//'`
5458 if test "x$cf_test" = "x$cf_name" ; then
5461 (*.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";;
5462 (*.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";;
5463 (*.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";;
5464 (*) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";;
5478 # if we found a match in either man* or cat*, stop looking
5479 if test -n "$MANPAGE_FORMAT" ; then
5481 test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted"
5482 test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly"
5488 test "$cf_found" = yes && break
5491 # only check the first directory in $MANPATH where we find manpages
5492 if test -n "$MANPAGE_FORMAT" ; then
5496 # if we did not find the example, just assume it is normal
5497 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal
5501 for cf_option in $MANPAGE_FORMAT; do
5502 case "$cf_option" in
5503 (gzip|compress|BSDI|normal|formatted|catonly)
5506 cf_unknown="$cf_unknown $cf_option"
5513 AC_MSG_RESULT($MANPAGE_FORMAT)
5514 if test -n "$cf_unknown" ; then
5515 AC_MSG_WARN(Unexpected manpage-format $cf_unknown)
5518 dnl ---------------------------------------------------------------------------
5519 dnl CF_MANPAGE_RENAMES version: 12 updated: 2021/01/01 16:53:59
5520 dnl ------------------
5521 dnl The Debian people have their own naming convention for manpages. This
5522 dnl option lets us override the name of the file containing renaming, or
5523 dnl disable it altogether.
5524 AC_DEFUN([CF_MANPAGE_RENAMES],
5526 AC_MSG_CHECKING(for manpage renaming)
5528 AC_ARG_WITH(manpage-renames,
5529 [ --with-manpage-renames specify manpage-renaming],
5530 [MANPAGE_RENAMES=$withval],
5531 [MANPAGE_RENAMES=yes])
5533 case ".$MANPAGE_RENAMES" in
5537 # Debian 'man' program?
5538 if test -f /etc/debian_version ; then
5539 MANPAGE_RENAMES=`cd "$srcdir" && pwd`/man/man_db.renames
5546 if test "$MANPAGE_RENAMES" != no ; then
5547 if test -f "$srcdir/man/$MANPAGE_RENAMES" ; then
5548 MANPAGE_RENAMES=`cd "$srcdir/man" && pwd`/$MANPAGE_RENAMES
5549 elif test ! -f "$MANPAGE_RENAMES" ; then
5550 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
5553 test ! -d man && mkdir man
5555 # Construct a sed-script to perform renaming within man-pages
5556 if test -n "$MANPAGE_RENAMES" ; then
5557 test ! -d man && mkdir man
5558 $SHELL "$srcdir/man/make_sed.sh" "$MANPAGE_RENAMES" >./edit_man.sed
5562 AC_MSG_RESULT($MANPAGE_RENAMES)
5563 AC_SUBST(MANPAGE_RENAMES)
5565 dnl ---------------------------------------------------------------------------
5566 dnl CF_MANPAGE_SYMLINKS version: 6 updated: 2015/04/17 21:13:04
5567 dnl -------------------
5568 dnl Some people expect each tool to make all aliases for manpages in the
5569 dnl man-directory. This accommodates the older, less-capable implementations
5570 dnl of 'man', and is optional.
5571 AC_DEFUN([CF_MANPAGE_SYMLINKS],
5573 AC_MSG_CHECKING(if manpage aliases will be installed)
5575 AC_ARG_WITH(manpage-aliases,
5576 [ --with-manpage-aliases specify manpage-aliases using .so],
5577 [MANPAGE_ALIASES=$withval],
5578 [MANPAGE_ALIASES=yes])
5580 AC_MSG_RESULT($MANPAGE_ALIASES)
5592 if test "$MANPAGE_ALIASES" = yes ; then
5593 AC_MSG_CHECKING(if manpage symlinks should be used)
5595 AC_ARG_WITH(manpage-symlinks,
5596 [ --with-manpage-symlinks specify manpage-aliases using symlinks],
5597 [MANPAGE_SYMLINKS=$withval],
5598 [MANPAGE_SYMLINKS=$cf_use_symlinks])
5600 if test "$$cf_use_symlinks" = no; then
5601 if test "$MANPAGE_SYMLINKS" = yes ; then
5602 AC_MSG_WARN(cannot make symlinks, will use .so files)
5607 AC_MSG_RESULT($MANPAGE_SYMLINKS)
5611 dnl ---------------------------------------------------------------------------
5612 dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32
5614 dnl This option causes manpages to be run through tbl(1) to generate tables
5616 AC_DEFUN([CF_MANPAGE_TBL],
5618 AC_MSG_CHECKING(for manpage tbl)
5620 AC_ARG_WITH(manpage-tbl,
5621 [ --with-manpage-tbl specify manpage processing with tbl],
5622 [MANPAGE_TBL=$withval],
5625 AC_MSG_RESULT($MANPAGE_TBL)
5627 dnl ---------------------------------------------------------------------------
5628 dnl CF_MAN_PAGES version: 51 updated: 2021/01/05 16:29:19
5630 dnl Try to determine if the man-pages on the system are compressed, and if
5631 dnl so, what format is used. Use this information to construct a script that
5632 dnl will install man-pages.
5633 AC_DEFUN([CF_MAN_PAGES],
5635 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
5641 if test "$prefix" = "NONE" ; then
5642 cf_prefix="$ac_default_prefix"
5647 case "$MANPAGE_FORMAT" in
5662 test ! -d man && mkdir man
5666 case "$MANPAGE_FORMAT" in
5669 cf_compress=compress
5677 cf_edit_man=./edit_man.sh
5678 cf_man_alias=`pwd`/man_alias.sed
5680 cat >$cf_edit_man <<CF_EOF
5682 # this script is generated by the configure-script CF_MAN_PAGES macro.
5685 datarootdir="$datarootdir"
5688 NCURSES_MAJOR="$NCURSES_MAJOR"
5689 NCURSES_MINOR="$NCURSES_MINOR"
5690 NCURSES_PATCH="$NCURSES_PATCH"
5692 NCURSES_OSPEED="$NCURSES_OSPEED"
5693 TERMINFO="$TERMINFO"
5696 INSTALL_DATA="$INSTALL_DATA"
5698 transform="$program_transform_name"
5700 TMP=\${TMPDIR:=/tmp}/man\$\$
5701 trap "rm -f \$TMP" 0 1 2 3 15
5713 top_srcdir=\[$]srcdir/..
5716 if test "\$form" = normal ; then
5717 if test "$cf_format" = yes ; then
5718 if test "$cf_inboth" = no ; then
5719 $SHELL "\[$]0" format "\$verb" "\$mandir" "\$srcdir" "\[$]@"
5723 cf_subdir=\$mandir/man
5724 cf_tables=$MANPAGE_TBL
5726 cf_subdir=\$mandir/cat
5730 # process the list of source-files
5731 for i in "\[$]@" ; do
5735 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
5736 if test "\$verb" = installing ; then
5737 if test ! -d "\$cf_subdir\${section}" ; then
5738 mkdir -p "\$cf_subdir\$section"
5742 # replace variables in man page
5743 if test ! -f "$cf_man_alias" ; then
5744 cat >>$cf_man_alias <<-CF_EOF2
5745 s,@DATADIR@,\$datadir,g
5746 s,@TERMINFO@,\${TERMINFO:="no default value"},g
5747 s,@TERMINFO_DIRS@,\${TERMINFO_DIRS:="no default value"},g
5748 s,@NCURSES_MAJOR@,\${NCURSES_MAJOR:="no default value"},g
5749 s,@NCURSES_MINOR@,\${NCURSES_MINOR:="no default value"},g
5750 s,@NCURSES_PATCH@,\${NCURSES_PATCH:="no default value"},g
5751 s,@NCURSES_OSPEED@,\${NCURSES_OSPEED:="no default value"},g
5756 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
5757 cf_name=`echo "$cf_name" | sed "$program_transform_name"`
5758 cat >>$cf_edit_man <<-CF_EOF
5759 s,@$cf_NAME@,$cf_name,g
5763 cat >>$cf_edit_man <<CF_EOF
5765 echo "...made $cf_man_alias"
5769 cf_source=\`basename "\$i"\`
5771 test ! -f "\$inalias" && inalias="\$srcdir/\$inalias"
5772 if test ! -f "\$inalias" ; then
5773 echo ".. skipped \$cf_source"
5778 if test "$MANPAGE_ALIASES" != no ; then
5779 cat >>$cf_edit_man <<CF_EOF
5781 test "$with_curses_h" = yes && nCurses=ncurses.3x
5782 aliases=\`sed -f "\$top_srcdir/man/manlinks.sed" "\$inalias" |sed -f "$cf_man_alias" | sort -u; test "\$inalias" = "\$nCurses" && echo curses\`
5786 if test "$MANPAGE_RENAMES" = no ; then
5787 cat >>$cf_edit_man <<CF_EOF
5788 # perform program transformations for section 1 man pages
5789 if test \$section = 1 ; then
5790 cf_target=\$cf_subdir\${section}/\`echo \$cf_source|sed "\${transform}"\`
5792 cf_target=\$cf_subdir\${section}/\$cf_source
5796 cat >>$cf_edit_man <<CF_EOF
5797 cf_target=\`grep "^\$cf_source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
5798 if test -z "\$cf_target" ; then
5799 echo "? missing rename for \$cf_source"
5800 cf_target="\$cf_source"
5802 cf_target="\$cf_subdir\${section}/\${cf_target}"
5807 cat >>$cf_edit_man <<CF_EOF
5808 sed -f "$cf_man_alias" \\
5811 if test -f "$MANPAGE_RENAMES" ; then
5812 cat >>$cf_edit_man <<CF_EOF
5813 < "\$i" | sed -f `pwd`/edit_man.sed >\$TMP
5816 cat >>$cf_edit_man <<CF_EOF
5821 cat >>$cf_edit_man <<CF_EOF
5822 if test \$cf_tables = yes ; then
5823 tbl \$TMP >\$TMP.out
5828 if test "$with_overwrite" != yes ; then
5829 cat >>$cf_edit_man <<CF_EOF
5830 sed -e "/\\#[ ]*include/s,<curses.h,<ncurses$LIB_SUFFIX/curses.h," < \$TMP >\$TMP.out
5835 if test "$with_curses_h" != yes ; then
5836 cat >>$cf_edit_man <<CF_EOF
5837 sed -e "/\\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
5842 cat >>$cf_edit_man <<CF_EOF
5843 if test "\$form" = format ; then
5844 nroff -man \$TMP >\$TMP.out
5849 if test -n "$cf_compress" ; then
5850 cat >>$cf_edit_man <<CF_EOF
5851 if test "\$verb" = installing ; then
5852 if ( "$cf_compress" -f \$TMP )
5854 mv \$TMP.$cf_so_strip \$TMP
5857 cf_target="\$cf_target.$cf_so_strip"
5861 case "$MANPAGE_FORMAT" in
5863 cat >>$cf_edit_man <<CF_EOF
5864 if test "\$form" = format ; then
5865 # BSDI installs only .0 suffixes in the cat directories
5866 cf_target="\`echo \$cf_target|sed -e 's/\\.[[1-9]]\\+[[a-z]]*/.0/'\`"
5872 cat >>$cf_edit_man <<CF_EOF
5873 suffix=\`basename "\$cf_target" | sed -e 's%^[[^.]]*%%'\`
5874 if test "\$verb" = installing ; then
5875 echo "\$verb \$cf_target"
5876 \$INSTALL_DATA \$TMP "\$cf_target"
5877 test -d "\$cf_subdir\${section}" &&
5878 test -n "\$aliases" && (
5879 cd "\$cf_subdir\${section}" && (
5880 cf_source=\`echo "\$cf_target" |sed -e 's%^.*/\\([[^/]][[^/]]*/[[^/]][[^/]]*$\\)%\\1%'\`
5881 test -n "$cf_so_strip" && cf_source=\`echo "\$cf_source" |sed -e 's%\\.$cf_so_strip\$%%'\`
5882 cf_target=\`basename "\$cf_target"\`
5883 for cf_alias in \$aliases
5885 if test "\$section" = 1 ; then
5886 cf_alias=\`echo "\$cf_alias" |sed "\${transform}"\`
5889 if test "$MANPAGE_SYMLINKS" = yes ; then
5890 if test -f "\$cf_alias\${suffix}" ; then
5891 if ( cmp -s "\$cf_target" "\$cf_alias\${suffix}" )
5896 echo ".. \$verb alias \$cf_alias\${suffix}"
5900 cat >>$cf_edit_man <<CF_EOF
5901 $LN_S "\$cf_target" "\$cf_alias\${suffix}"
5905 cat >>$cf_edit_man <<CF_EOF
5906 rm -f "\$cf_alias\${suffix}"
5907 $LN_S "\$cf_target" "\$cf_alias\${suffix}"
5911 cat >>$cf_edit_man <<CF_EOF
5912 elif test "\$cf_target" != "\$cf_alias\${suffix}" ; then
5913 echo ".so \$cf_source" >\$TMP
5915 if test -n "$cf_compress" ; then
5916 cat >>$cf_edit_man <<CF_EOF
5917 if test -n "$cf_so_strip" ; then
5918 "$cf_compress" -f \$TMP
5919 mv \$TMP.$cf_so_strip \$TMP
5923 cat >>$cf_edit_man <<CF_EOF
5924 echo ".. \$verb alias \$cf_alias\${suffix}"
5925 rm -f "\$cf_alias\${suffix}"
5926 \$INSTALL_DATA \$TMP "\$cf_alias\${suffix}"
5931 elif test "\$verb" = removing ; then
5932 test -f "\$cf_target" && (
5933 echo "\$verb \$cf_target"
5936 test -d "\$cf_subdir\${section}" &&
5937 test -n "\$aliases" && (
5938 cd "\$cf_subdir\${section}" && (
5939 for cf_alias in \$aliases
5941 if test "\$section" = 1 ; then
5942 cf_alias=\`echo "\$cf_alias" |sed "\${transform}"\`
5945 echo ".. \$verb alias \$cf_alias\${suffix}"
5946 rm -f "\$cf_alias\${suffix}"
5958 if test "$cf_inboth" = yes ; then
5959 if test "\$form" != format ; then
5960 $SHELL "\[$]0" format "\$verb" "\$mandir" "\$srcdir" "\[$]@"
5966 chmod 755 "$cf_edit_man"
5969 dnl ---------------------------------------------------------------------------
5970 dnl CF_MAP_LIB_BASENAME version: 2 updated: 2021/01/02 17:09:14
5971 dnl -------------------
5972 dnl Convert a default-libname to the actual one used via CF_WITH_LIB_BASENAME.
5974 dnl $1 = variable to set
5975 dnl $2 = default-libname
5976 AC_DEFUN([CF_MAP_LIB_BASENAME],[
5977 CF_UPPER(cf_map_lib_basename,$2)
5978 eval $1="\$${cf_map_lib_basename}_NAME"
5980 dnl ---------------------------------------------------------------------------
5981 dnl CF_MATH_LIB version: 10 updated: 2020/12/31 18:40:20
5983 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
5984 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
5985 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
5986 AC_DEFUN([CF_MATH_LIB],
5988 AC_CACHE_CHECK(if -lm needed for math functions,
5995 [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)],
5996 [cf_cv_need_libm=no],
5997 [cf_cv_need_libm=yes])])
5998 if test "$cf_cv_need_libm" = yes
6005 dnl ---------------------------------------------------------------------------
6006 dnl CF_MIXEDCASE_FILENAMES version: 9 updated: 2021/01/01 16:53:59
6007 dnl ----------------------
6008 dnl Check if the file-system supports mixed-case filenames. If we're able to
6009 dnl create a lowercase name and see it as uppercase, it doesn't support that.
6010 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
6012 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
6013 if test "$cross_compiling" = yes ; then
6014 case "$target_alias" in
6015 (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*|darwin*)
6023 rm -f conftest CONFTEST
6025 if test -f CONFTEST ; then
6030 rm -f conftest CONFTEST
6033 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
6035 dnl ---------------------------------------------------------------------------
6036 dnl CF_MKSTEMP version: 11 updated: 2021/01/01 13:31:04
6038 dnl Check for a working mkstemp. This creates two files, checks that they are
6039 dnl successfully created and distinct (AmigaOS apparently fails on the last).
6040 AC_DEFUN([CF_MKSTEMP],[
6044 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
6047 #include <sys/types.h>
6048 #ifdef HAVE_UNISTD_H
6054 #include <sys/stat.h>
6057 char *tmpl = "conftestXXXXXX";
6065 for (n = 0; n < 2; ++n) {
6066 strcpy(name[n], tmpl);
6067 if ((fd = mkstemp(name[n])) >= 0) {
6068 if (!strcmp(name[n], tmpl)
6069 || stat(name[n], &sb) != 0
6070 || (sb.st_mode & S_IFMT) != S_IFREG
6071 || (sb.st_mode & 077) != 0) {
6078 && !strcmp(name[0], name[1]))
6080 ${cf_cv_main_return:-return}(result);
6082 ],[cf_cv_func_mkstemp=yes
6083 ],[cf_cv_func_mkstemp=no
6084 ],[cf_cv_func_mkstemp=maybe])
6086 if test "x$cf_cv_func_mkstemp" = xmaybe ; then
6087 AC_CHECK_FUNC(mkstemp)
6089 if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
6090 AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.])
6093 dnl ---------------------------------------------------------------------------
6094 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
6096 dnl Write a debug message to config.log, along with the line number in the
6097 dnl configure script.
6098 AC_DEFUN([CF_MSG_LOG],[
6099 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
6101 dnl ---------------------------------------------------------------------------
6102 dnl CF_NCURSES_ABI_6 version: 4 updated: 2021/01/01 13:31:04
6103 dnl ----------------
6104 dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and
6105 dnl warn about this.
6106 AC_DEFUN([CF_NCURSES_ABI_6],[
6107 if test "${with_abi_version+set}" != set; then
6108 case "$cf_cv_rel_version" in
6110 cf_cv_rel_version=6.0
6112 AC_MSG_WARN(overriding ABI version to $cf_cv_abi_version)
6117 dnl ---------------------------------------------------------------------------
6118 dnl CF_NCURSES_WITH_ABI_VERSION version: 3 updated: 2021/01/01 13:31:04
6119 dnl ---------------------------
6120 dnl Allow ncurses's ABI to be overridden. Generally this happens when a
6121 dnl packager has incremented the ABI past that used in the original package,
6122 dnl and wishes to keep doing this.
6124 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
6126 AC_DEFUN([CF_NCURSES_WITH_ABI_VERSION],[
6127 CF_WITH_ABI_VERSION($1)
6128 if test "x$cf_cv_abi_version" != "x$with_abi_version"
6130 case "$cf_cv_rel_version" in
6132 cf_cv_rel_version=$with_abi_version.0
6137 dnl ---------------------------------------------------------------------------
6138 dnl CF_NO_LEAKS_OPTION version: 9 updated: 2021/06/13 19:45:41
6139 dnl ------------------
6140 dnl see CF_WITH_NO_LEAKS
6142 dnl $1 = option/name
6144 dnl $3 = symbol to define if the option is set
6145 dnl $4 = additional actions to take if the option is set
6146 AC_DEFUN([CF_NO_LEAKS_OPTION],[
6147 AC_MSG_CHECKING(if you want to use $1 for testing)
6150 [case "x$withval" in
6153 : "${with_cflags:=-g}"
6154 : "${enable_leaks:=no}"
6156 AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
6162 AC_MSG_RESULT(${with_$1:-no})
6164 case ".$with_cflags" in
6176 dnl ---------------------------------------------------------------------------
6177 dnl CF_NUMBER_SYNTAX version: 2 updated: 2015/04/17 21:13:04
6178 dnl ----------------
6179 dnl Check if the given variable is a number. If not, report an error.
6180 dnl $1 is the variable
6181 dnl $2 is the message
6182 AC_DEFUN([CF_NUMBER_SYNTAX],[
6183 if test -n "$1" ; then
6188 AC_MSG_ERROR($2 is not a number: $1)
6192 AC_MSG_ERROR($2 value is empty)
6195 dnl ---------------------------------------------------------------------------
6196 dnl CF_OBJ_SUBDIR version: 8 updated: 2021/01/01 13:31:04
6198 dnl Compute the object-directory name from the given model name
6199 AC_DEFUN([CF_OBJ_SUBDIR],
6202 (libtool) $2='obj_lo' ;;
6203 (normal) $2='objects' ;;
6204 (debug) $2='obj_g' ;;
6205 (profile) $2='obj_p' ;;
6207 case "$cf_cv_system_name" in
6215 dnl ---------------------------------------------------------------------------
6216 dnl CF_PATHSEP version: 8 updated: 2021/01/01 13:31:04
6218 dnl Provide a value for the $PATH and similar separator (or amend the value
6219 dnl as provided in autoconf 2.5x).
6220 AC_DEFUN([CF_PATHSEP],
6222 AC_MSG_CHECKING(for PATH separator)
6223 case "$cf_cv_system_name" in
6224 (os2*) PATH_SEPARATOR=';' ;;
6225 (*) ${PATH_SEPARATOR:=':'} ;;
6227 ifelse([$1],,,[$1=$PATH_SEPARATOR])
6228 AC_SUBST(PATH_SEPARATOR)
6229 AC_MSG_RESULT($PATH_SEPARATOR)
6231 dnl ---------------------------------------------------------------------------
6232 dnl CF_PATH_PROG version: 12 updated: 2021/01/02 09:31:20
6234 dnl Check for a given program, defining corresponding symbol.
6235 dnl $1 = environment variable, which is suffixed by "_PATH" in the #define.
6236 dnl $2 = program name to find.
6237 dnl $3 = optional list of additional program names to test.
6240 dnl If there is more than one token in the result, #define the remaining tokens
6241 dnl to $1_ARGS. We need this for 'install' in particular.
6243 dnl FIXME: we should allow this to be overridden by environment variables
6245 AC_DEFUN([CF_PATH_PROG],[
6246 AC_REQUIRE([CF_PATHSEP])
6247 test -z "[$]$1" && $1="$2"
6248 AC_PATH_PROGS($1,[$]$1 $2 ifelse($3,,,$3),[$]$1, ifelse($4,,,$4))
6252 IFS="${IFS:- }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR"
6253 for cf_temp in $ac_cv_path_$1
6255 if test -z "$cf_path_prog" ; then
6256 if test "$with_full_paths" = yes ; then
6257 CF_PATH_SYNTAX(cf_temp,break)
6258 cf_path_prog="$cf_temp"
6260 cf_path_prog="`basename "$cf_temp"`"
6262 elif test -z "$cf_path_args" ; then
6263 cf_path_args="$cf_temp"
6265 cf_path_args="$cf_path_args $cf_temp"
6270 if test -n "$cf_path_prog" ; then
6271 CF_MSG_LOG(defining path for ${cf_path_prog})
6272 AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog",Define to pathname $1)
6273 test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args",Define to provide args for $1)
6276 dnl ---------------------------------------------------------------------------
6277 dnl CF_PATH_SYNTAX version: 18 updated: 2020/12/31 18:40:20
6279 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
6280 dnl begins with one of the prefix/exec_prefix variables, and then again if the
6281 dnl result begins with 'NONE'. This is necessary to work around autoconf's
6282 dnl delayed evaluation of those symbols.
6283 AC_DEFUN([CF_PATH_SYNTAX],[
6284 if test "x$prefix" != xNONE; then
6285 cf_path_syntax="$prefix"
6287 cf_path_syntax="$ac_default_prefix"
6291 (.\[$]\(*\)*|.\'*\'*)
6295 (.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX
6297 (.\[$]\{*prefix\}*|.\[$]\{*dir\}*)
6301 $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%`
6306 $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%`
6309 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
6313 dnl ---------------------------------------------------------------------------
6314 dnl CF_PKG_CONFIG version: 11 updated: 2021/01/01 13:31:04
6316 dnl Check for the package-config program, unless disabled by command-line.
6317 AC_DEFUN([CF_PKG_CONFIG],
6319 AC_MSG_CHECKING(if you want to use pkg-config)
6320 AC_ARG_WITH(pkg-config,
6321 [ --with-pkg-config{=path} enable/disable use of pkg-config],
6322 [cf_pkg_config=$withval],
6323 [cf_pkg_config=yes])
6324 AC_MSG_RESULT($cf_pkg_config)
6326 case "$cf_pkg_config" in
6331 CF_ACVERSION_CHECK(2.52,
6332 [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
6333 [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
6340 test -z "$PKG_CONFIG" && PKG_CONFIG=none
6341 if test "$PKG_CONFIG" != none ; then
6342 CF_PATH_SYNTAX(PKG_CONFIG)
6343 elif test "x$cf_pkg_config" != xno ; then
6344 AC_MSG_WARN(pkg-config is not installed)
6347 AC_SUBST(PKG_CONFIG)
6349 dnl ---------------------------------------------------------------------------
6350 dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17
6351 dnl -----------------
6352 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
6354 dnl POSIX.1-1990 _POSIX_SOURCE
6355 dnl POSIX.1-1990 and _POSIX_SOURCE and
6356 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
6358 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
6359 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
6360 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
6363 dnl $1 is the nominal value for _POSIX_C_SOURCE
6364 AC_DEFUN([CF_POSIX_C_SOURCE],
6365 [AC_REQUIRE([CF_POSIX_VISIBLE])dnl
6367 if test "$cf_cv_posix_visible" = no; then
6369 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
6371 cf_save_CFLAGS="$CFLAGS"
6372 cf_save_CPPFLAGS="$CPPFLAGS"
6374 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
6375 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
6377 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
6378 CF_MSG_LOG(if the symbol is already defined go no further)
6379 AC_TRY_COMPILE([#include <sys/types.h>],[
6380 #ifndef _POSIX_C_SOURCE
6383 [cf_cv_posix_c_source=no],
6384 [cf_want_posix_source=no
6385 case .$cf_POSIX_C_SOURCE in
6387 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
6390 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
6391 cf_want_posix_source=yes
6394 cf_want_posix_source=yes
6397 if test "$cf_want_posix_source" = yes ; then
6398 AC_TRY_COMPILE([#include <sys/types.h>],[
6399 #ifdef _POSIX_SOURCE
6402 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
6404 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
6405 CFLAGS="$cf_trim_CFLAGS"
6406 CPPFLAGS="$cf_trim_CPPFLAGS"
6407 CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source)
6408 CF_MSG_LOG(if the second compile does not leave our definition intact error)
6409 AC_TRY_COMPILE([#include <sys/types.h>],[
6410 #ifndef _POSIX_C_SOURCE
6413 [cf_cv_posix_c_source=no])
6414 CFLAGS="$cf_save_CFLAGS"
6415 CPPFLAGS="$cf_save_CPPFLAGS"
6419 if test "$cf_cv_posix_c_source" != no ; then
6420 CFLAGS="$cf_trim_CFLAGS"
6421 CPPFLAGS="$cf_trim_CPPFLAGS"
6422 CF_ADD_CFLAGS($cf_cv_posix_c_source)
6425 fi # cf_cv_posix_visible
6428 dnl ---------------------------------------------------------------------------
6429 dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17
6430 dnl ----------------
6431 dnl POSIX documents test-macros which an application may set before any system
6432 dnl headers are included to make features available.
6434 dnl Some BSD platforms (originally FreeBSD, but copied by a few others)
6435 dnl diverged from POSIX in 2002 by setting symbols which make all of the most
6436 dnl recent features visible in the system header files unless the application
6437 dnl overrides the corresponding test-macros. Doing that introduces portability
6440 dnl This macro makes a special check for the symbols used for this, to avoid a
6441 dnl conflicting definition.
6442 AC_DEFUN([CF_POSIX_VISIBLE],
6444 AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[
6445 AC_TRY_COMPILE([#include <stdio.h>],[
6446 #if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \
6447 && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \
6448 && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \
6449 && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0)
6450 #error conflicting symbols found
6452 ],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes])
6455 dnl ---------------------------------------------------------------------------
6456 dnl CF_PREDEFINE version: 2 updated: 2010/05/26 16:44:57
6458 dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles.
6460 dnl $1 = symbol to test
6461 dnl $2 = value (if any) to use for a predefinition
6462 AC_DEFUN([CF_PREDEFINE],
6464 AC_MSG_CHECKING(if we must define $1)
6465 AC_TRY_COMPILE([#include <sys/types.h>
6469 #endif],[cf_result=no],[cf_result=yes])
6470 AC_MSG_RESULT($cf_result)
6472 if test "$cf_result" = yes ; then
6473 CPPFLAGS="$CPPFLAGS ifelse([$2],,-D$1,[-D$1=$2])"
6474 elif test "x$2" != "x" ; then
6475 AC_MSG_CHECKING(checking for compatible value versus $2)
6476 AC_TRY_COMPILE([#include <sys/types.h>
6480 #endif],[cf_result=yes],[cf_result=no])
6481 AC_MSG_RESULT($cf_result)
6482 if test "$cf_result" = no ; then
6483 # perhaps we can override it - try...
6484 CPPFLAGS="$CPPFLAGS -D$1=$2"
6488 dnl ---------------------------------------------------------------------------
6489 dnl CF_PRG_RULES version: 2 updated: 2021/01/01 13:31:04
6491 dnl Append definitions and rules for the given programs to the subdirectory
6492 dnl Makefiles, and the recursion rule for the top-level Makefile.
6495 dnl $1 = script to run
6496 dnl $2 = list of subdirectories
6500 AC_DEFUN([CF_PRG_RULES],
6504 if test ! -d "$srcdir/$cf_dir" ; then
6506 elif test -f "$srcdir/$cf_dir/programs" ; then
6507 $AWK -f $1 "$srcdir/$cf_dir/programs" >>$cf_dir/Makefile
6512 dnl ---------------------------------------------------------------------------
6513 dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22
6515 dnl Check for archiver "ar".
6516 AC_DEFUN([CF_PROG_AR],[
6517 AC_CHECK_TOOL(AR, ar, ar)
6519 dnl ---------------------------------------------------------------------------
6520 dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59
6522 dnl Check for awk, ensure that the check found something.
6523 AC_DEFUN([CF_PROG_AWK],
6526 test -z "$AWK" && AC_MSG_ERROR(No awk program found)
6528 dnl ---------------------------------------------------------------------------
6529 dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54
6531 dnl standard check for CC, plus followup sanity checks
6532 dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
6533 AC_DEFUN([CF_PROG_CC],[
6534 CF_ACVERSION_CHECK(2.53,
6535 [AC_MSG_WARN(this will incorrectly handle gnatgcc choice)
6536 AC_REQUIRE([AC_PROG_CC])],
6538 ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
6540 CF_ACVERSION_CHECK(2.52,
6545 dnl ---------------------------------------------------------------------------
6546 dnl CF_PROG_CC_C_O version: 6 updated: 2021/01/01 13:31:04
6548 dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
6549 dnl the output file can be renamed, and allows for a shell variable that can
6550 dnl be used later. The parameter is either CC or CXX. The result is the
6552 dnl $cf_cv_prog_CC_c_o
6553 dnl $cf_cv_prog_CXX_c_o
6556 dnl $2 = compiler options, if any
6557 AC_DEFUN([CF_PROG_CC_C_O],
6558 [AC_REQUIRE([AC_PROG_CC])dnl
6559 AC_MSG_CHECKING([whether [$]$1 understands -c and -o together])
6560 AC_CACHE_VAL(cf_cv_prog_$1_c_o,
6562 cat > conftest.$ac_ext <<CF_EOF
6565 ${cf_cv_main_return:-return}(0);
6568 # We do the test twice because some compilers refuse to overwrite an
6569 # existing .o file with -o, though they will create one.
6570 ac_try='[$]$1 $2 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC'
6571 if AC_TRY_EVAL(ac_try) &&
6572 test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
6574 eval cf_cv_prog_$1_c_o=yes
6576 eval cf_cv_prog_$1_c_o=no
6580 if test "$cf_cv_prog_$1_c_o" = yes; then
6581 AC_MSG_RESULT([yes])
6586 dnl ---------------------------------------------------------------------------
6587 dnl CF_PROG_GNAT version: 12 updated: 2021/01/02 17:09:14
6589 dnl Check for gnat/gnatmake/etc, ensure that the toolset is complete.
6590 AC_DEFUN([CF_PROG_GNAT],[
6591 for cf_prog_gnat in gnat gnatmake gprconfig gprbuild
6593 CF_UPPER(cf_upper_prog_gnat,${cf_prog_gnat})
6595 unset ac_cv_path_cf_TEMP_gnat
6597 AC_PATH_PROG(cf_TEMP_gnat,$cf_prog_gnat,no)
6598 eval "cf_cv_PATH_$cf_upper_prog_gnat=[$]ac_cv_path_cf_TEMP_gnat"
6600 if test "x$cf_TEMP_gnat" != xno; then
6601 unset cf_cv_gnat_version
6603 CF_GNAT_VERSION(cf_TEMP_gnat,$cf_prog_gnat)
6605 eval "cf_cv_VERSION_$cf_upper_prog_gnat=[$]cf_TEMP_gnat"
6608 unset cf_cv_gnat_version
6609 unset ac_cv_path_cf_TEMP_gnat
6612 if test "x$cf_cv_VERSION_GNATMAKE" = "xno"; then
6614 cf_cv_prog_gnat_correct=no
6616 cf_ada_make=gnatmake
6617 if test "x$cf_cv_VERSION_GPRCONFIG" = "xno"; then
6618 # gprconfig is newer than gnatmake; we can continue...
6621 rm -rf ./conftest* ./*~conftest*
6622 if mkdir conftest.src
6626 for cf_gprconfig in Ada C
6628 AC_MSG_CHECKING(for gprconfig name for $cf_gprconfig)
6629 if test "$cf_gprconfig" = C
6631 for cf_gprconfig_param in \
6632 "$cf_gprconfig,,,,GNATGCC" \
6633 "$cf_gprconfig,,,,GCC" \
6636 cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1`
6637 test -n "$cf_gprconfig_value" && break
6640 cf_gprconfig_param=$cf_gprconfig
6641 cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1`
6643 if test -n "$cf_gprconfig_value"
6645 eval "cf_ada_config_[$]cf_gprconfig=[$]cf_gprconfig_value"
6646 AC_MSG_RESULT($cf_gprconfig_value)
6648 AC_MSG_RESULT(missing)
6654 rm -rf ./conftest* ./*~conftest*
6657 if test "x$cf_ada_config" != "x#"
6660 CF_CHECK_GNAT_VERSION
6661 AC_CHECK_PROG(M4_exists, m4, yes, no)
6662 if test "$ac_cv_prog_M4_exists" = no; then
6663 cf_cv_prog_gnat_correct=no
6664 AC_MSG_WARN(Ada95 binding required program m4 not found. Ada95 binding disabled)
6666 if test "$cf_cv_prog_gnat_correct" = yes; then
6667 AC_MSG_CHECKING(if GNAT works)
6668 CF_GNAT_TRY_RUN([procedure conftest;],
6671 procedure conftest is
6673 Text_IO.Put ("Hello World");
6675 GNAT.OS_Lib.OS_Exit (0);
6677 [cf_cv_prog_gnat_correct=yes],
6678 [cf_cv_prog_gnat_correct=no])
6679 AC_MSG_RESULT($cf_cv_prog_gnat_correct)
6682 cf_cv_prog_gnat_correct=no
6686 AC_SUBST(cf_ada_make)
6687 AC_SUBST(cf_ada_config)
6688 AC_SUBST(cf_ada_config_Ada)
6689 AC_SUBST(cf_ada_config_C)
6691 dnl ---------------------------------------------------------------------------
6692 dnl CF_PROG_INSTALL version: 10 updated: 2021/01/04 19:33:05
6694 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
6695 dnl misc/tabset install won't work properly. Usually this happens only when
6696 dnl using the fallback mkinstalldirs script
6697 AC_DEFUN([CF_PROG_INSTALL],
6703 CF_DIRNAME(cf_dir,$INSTALL)
6704 test -z "$cf_dir" && cf_dir=.
6705 INSTALL="`cd \"$cf_dir\" && pwd`"/"`echo "$INSTALL" | sed -e 's%^.*/%%'`"
6709 dnl ---------------------------------------------------------------------------
6710 dnl CF_PROG_LDCONFIG version: 5 updated: 2015/04/18 08:56:57
6711 dnl ----------------
6712 dnl Check for ldconfig, needed to fixup shared libraries that would be built
6713 dnl and then used in the install.
6714 AC_DEFUN([CF_PROG_LDCONFIG],[
6715 if test "$cross_compiling" = yes ; then
6718 case "$cf_cv_system_name" in
6719 (dragonfly*|mirbsd*|freebsd*)
6720 test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
6722 (*) LDPATH=$PATH:/sbin:/usr/sbin
6723 AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
6729 dnl ---------------------------------------------------------------------------
6730 dnl CF_PROG_LINT version: 4 updated: 2019/11/20 18:55:37
6732 AC_DEFUN([CF_PROG_LINT],
6734 AC_CHECK_PROGS(LINT, lint cppcheck splint)
6736 (xcppcheck|x*/cppcheck)
6737 test -z "$LINT_OPTS" && LINT_OPTS="--enable=all"
6742 dnl ---------------------------------------------------------------------------
6743 dnl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37
6745 dnl Combine checks for "ln -s" and "ln -sf", updating $LN_S to include "-f"
6746 dnl option if it is supported.
6747 AC_DEFUN([CF_PROG_LN_S],[
6749 AC_MSG_CHECKING(if $LN_S -f options work)
6751 rm -f conf$$.src conf$$dst
6753 echo first >conf$$.src
6754 if $LN_S -f conf$$.src conf$$.dst 2>/dev/null; then
6759 rm -f conf$$.dst conf$$src
6760 AC_MSG_RESULT($cf_prog_ln_sf)
6762 test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
6764 dnl ---------------------------------------------------------------------------
6765 dnl CF_REGEX version: 18 updated: 2021/01/01 16:53:59
6767 dnl Attempt to determine if we've got one of the flavors of regular-expression
6768 dnl code that we can support.
6769 AC_DEFUN([CF_REGEX],
6776 # -lsystre -ltre -lintl -liconv
6777 AC_CHECK_LIB(systre,regcomp,[
6778 AC_CHECK_LIB(iconv,libiconv_open,[CF_ADD_LIB(iconv)])
6779 AC_CHECK_LIB(intl,libintl_gettext,[CF_ADD_LIB(intl)])
6780 AC_CHECK_LIB(tre,tre_regcomp,[CF_ADD_LIB(tre)])
6782 cf_regex_func=regcomp
6784 AC_CHECK_LIB(gnurx,regcomp,[
6786 cf_regex_func=regcomp])
6790 cf_regex_libs="regex re"
6791 AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[
6792 for cf_regex_lib in $cf_regex_libs
6794 AC_CHECK_LIB($cf_regex_lib,regcomp,[
6795 CF_ADD_LIB($cf_regex_lib)
6796 cf_regex_func=regcomp
6803 if test "$cf_regex_func" = no ; then
6804 AC_CHECK_FUNC(compile,[cf_regex_func=compile],[
6805 AC_CHECK_LIB(gen,compile,[
6807 cf_regex_func=compile])])
6810 if test "$cf_regex_func" = no ; then
6811 AC_MSG_WARN(cannot find regular expression library)
6814 AC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[
6817 case "$cf_regex_func" in
6819 for cf_regex_hdr in regexp.h regexpr.h
6821 AC_TRY_LINK([#include <$cf_regex_hdr>],[
6822 char *p = compile("", "", "", 0);
6823 int x = step("", "");
6827 cf_cv_regex_hdrs=$cf_regex_hdr
6833 for cf_regex_hdr in regex.h
6835 AC_TRY_LINK([#include <sys/types.h>
6836 #include <$cf_regex_hdr>],[
6838 int x = regcomp(p, "", 0);
6839 int y = regexec(p, "", 0, 0, 0);
6844 cf_cv_regex_hdrs=$cf_regex_hdr
6853 case "$cf_cv_regex_hdrs" in
6854 (no) AC_MSG_WARN(no regular expression header found) ;;
6855 (regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;;
6856 (regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;;
6857 (regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;;
6860 dnl ---------------------------------------------------------------------------
6861 dnl CF_REMOVE_CFLAGS version: 1 updated: 2021/08/28 15:20:37
6862 dnl ----------------
6863 dnl Remove a given option from CFLAGS/CPPFLAGS
6864 dnl $1 = option to remove
6865 dnl $2 = variable to update
6866 dnl $3 = nonempty to allow verbose message
6867 define([CF_REMOVE_CFLAGS],
6869 cf_tmp_cflag=`echo "x$1" | sed -e 's/^.//' -e 's/=.*//'`
6870 cf_old_cflag="[$]$2"
6874 cf_old_cflag=`echo "x$cf_old_cflag" | sed -e 's/^.//' -e "s%$cf_tmp_cflag=[[^ ]]*%%g"`
6877 cf_old_cflag=`echo "x$cf_old_cflag" | sed -e 's/^.//' -e "s%${cf_tmp_cflag}.%%"`
6880 cf_old_cflag=`echo "x$cf_old_cflag" | sed -e 's/^.//' -e "s%$cf_tmp_cflag%%"`
6884 if test "[$]$2" != "$cf_old_cflag" ;
6886 ifelse([$3],,,[CF_VERBOSE(removing old option $1 from $2)])
6890 dnl ---------------------------------------------------------------------------
6891 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
6892 dnl ----------------
6893 dnl Remove all -U and -D options that refer to the given symbol from a list
6894 dnl of C compiler options. This works around the problem that not all
6895 dnl compilers process -U and -D options from left-to-right, so a -U option
6896 dnl cannot be used to cancel the effect of a preceding -D option.
6898 dnl $1 = target (which could be the same as the source variable)
6899 dnl $2 = source (including '$')
6900 dnl $3 = symbol to remove
6901 define([CF_REMOVE_DEFINE],
6904 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
6905 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
6907 dnl ---------------------------------------------------------------------------
6908 dnl CF_REMOVE_LIB version: 1 updated: 2007/02/17 14:11:52
6910 dnl Remove the given library from the symbol
6912 dnl $1 = target (which could be the same as the source variable)
6913 dnl $2 = source (including '$')
6914 dnl $3 = library to remove
6915 define([CF_REMOVE_LIB],
6917 # remove $3 library from $2
6918 $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'`
6920 dnl ---------------------------------------------------------------------------
6921 dnl CF_RESTORE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:47:45
6922 dnl ---------------------
6923 dnl Restore flags saved in CF_SAVE_XTRA_FLAGS
6924 dnl $1 = name of current macro
6925 define([CF_RESTORE_XTRA_FLAGS],
6927 LIBS="$cf_save_LIBS_$1"
6928 CFLAGS="$cf_save_CFLAGS_$1"
6929 CPPFLAGS="$cf_save_CPPFLAGS_$1"
6931 dnl ---------------------------------------------------------------------------
6932 dnl CF_RPATH_HACK version: 13 updated: 2021/01/03 18:30:50
6934 AC_DEFUN([CF_RPATH_HACK],
6935 [AC_REQUIRE([AC_PROG_FGREP])dnl
6936 AC_REQUIRE([CF_LD_RPATH_OPT])dnl
6938 AC_MSG_CHECKING(for updated LDFLAGS)
6939 if test -n "$LD_RPATH_OPT" ; then
6940 AC_MSG_RESULT(maybe)
6942 AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
6943 cf_rpath_list="/usr/lib /lib"
6944 if test "$cf_ldd_prog" != no
6948 AC_TRY_LINK([#include <stdio.h>],
6950 [cf_rpath_oops=`"$cf_ldd_prog" "conftest$ac_exeext" | ${FGREP-fgrep} ' not found' | sed -e 's% =>.*$%%' |sort | uniq`
6951 cf_rpath_list=`"$cf_ldd_prog" "conftest$ac_exeext" | ${FGREP-fgrep} / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`])
6953 # If we passed the link-test, but get a "not found" on a given library,
6954 # this could be due to inept reconfiguration of gcc to make it only
6955 # partly honor /usr/local/lib (or whatever). Sometimes this behavior
6956 # is intentional, e.g., installing gcc in /usr/bin and suppressing the
6957 # /usr/local libraries.
6958 if test -n "$cf_rpath_oops"
6960 for cf_rpath_src in $cf_rpath_oops
6962 for cf_rpath_dir in \
6967 if test -f "$cf_rpath_dir/lib/$cf_rpath_src"
6969 CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
6970 LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
6978 CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
6980 CF_RPATH_HACK_2(LDFLAGS)
6981 CF_RPATH_HACK_2(LIBS)
6983 CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
6987 AC_SUBST(EXTRA_LDFLAGS)
6989 dnl ---------------------------------------------------------------------------
6990 dnl CF_RPATH_HACK_2 version: 8 updated: 2021/01/01 13:31:04
6992 dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
6993 dnl EXTRA_LDFLAGS for each -L option found.
6995 dnl $cf_rpath_list contains a list of directories to ignore.
6997 dnl $1 = variable name to update. The LDFLAGS variable should be the only one,
6998 dnl but LIBS often has misplaced -L options.
6999 AC_DEFUN([CF_RPATH_HACK_2],
7001 CF_VERBOSE(...checking $1 [$]$1)
7004 for cf_rpath_src in [$]$1
7006 case "$cf_rpath_src" in
7009 # check if this refers to a directory which we will ignore
7011 if test -n "$cf_rpath_list"
7013 for cf_rpath_item in $cf_rpath_list
7015 if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
7023 if test "$cf_rpath_skip" = no
7025 # transform the option
7026 if test "$LD_RPATH_OPT" = "-R " ; then
7027 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
7029 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
7032 # if we have not already added this, add it now
7033 cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
7034 if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
7036 CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
7037 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
7042 cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
7046 CF_VERBOSE(...checked $1 [$]$1)
7047 AC_SUBST(EXTRA_LDFLAGS)
7049 dnl ---------------------------------------------------------------------------
7050 dnl CF_SAVE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:46:44
7051 dnl ------------------
7052 dnl Use this macro to save CFLAGS/CPPFLAGS/LIBS before checks against X headers
7053 dnl and libraries which do not update those variables.
7055 dnl $1 = name of current macro
7056 define([CF_SAVE_XTRA_FLAGS],
7058 cf_save_LIBS_$1="$LIBS"
7059 cf_save_CFLAGS_$1="$CFLAGS"
7060 cf_save_CPPFLAGS_$1="$CPPFLAGS"
7061 LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}"
7062 for cf_X_CFLAGS in $X_CFLAGS
7064 case "x$cf_X_CFLAGS" in
7066 CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS"
7069 CFLAGS="$CFLAGS $cf_X_CFLAGS"
7074 dnl ---------------------------------------------------------------------------
7075 dnl CF_SHARED_OPTS version: 106 updated: 2021/08/07 16:59:57
7078 dnl Attempt to determine the appropriate CC/LD options for creating a shared
7082 dnl a) ${LOCAL_LDFLAGS} is used to link executables that will run within
7083 dnl the build-tree, i.e., by making use of the libraries that are compiled in
7084 dnl $rel_builddir/lib We avoid compiling-in a $rel_builddir/lib path for the
7085 dnl shared library since that can lead to unexpected results at runtime.
7086 dnl b) ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared
7087 dnl libraries are compiled in ../../lib
7089 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
7090 dnl to install symbolic links to the rel/abi versions of shared libraries.
7092 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
7093 dnl version when making symbolic links.
7095 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
7096 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
7097 dnl (ex: libncurses.so.<ver>).
7099 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
7100 AC_DEFUN([CF_SHARED_OPTS],
7102 AC_REQUIRE([CF_LD_RPATH_OPT])
7108 INSTALL_LIB="-m 644"
7109 : ${rel_builddir:=.}
7117 cf_cv_do_symlinks=no
7119 test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT"
7121 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
7122 AC_ARG_WITH(shlib-version,
7123 [ --with-shlib-version=X Specify rel or abi version for shared libs],
7124 [test -z "$withval" && withval=auto
7127 cf_cv_shlib_version=auto
7130 cf_cv_shlib_version=$withval
7133 AC_MSG_RESULT($withval)
7134 AC_MSG_ERROR([option value must be one of: rel, abi, or auto])
7137 ],[cf_cv_shlib_version=auto])
7138 AC_MSG_RESULT($cf_cv_shlib_version)
7143 # Some less-capable ports of gcc support only -fpic
7147 if test "$GCC" = yes
7151 case "$cf_cv_system_name" in
7152 (*linux*) # e.g., PGI compiler
7158 if test "$cf_try_fPIC" = yes
7160 AC_MSG_CHECKING(which $CC option to use)
7161 cf_save_CFLAGS="$CFLAGS"
7162 for CC_SHARED_OPTS in -fPIC -fpic ''
7164 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
7165 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
7167 AC_MSG_RESULT($CC_SHARED_OPTS)
7168 CFLAGS="$cf_save_CFLAGS"
7171 cf_cv_shlib_version_infix=no
7173 case "$cf_cv_system_name" in
7174 (aix4.[3-9]*|aix[[5-7]]*)
7175 if test "$GCC" = yes; then
7176 CC_SHARED_OPTS='-Wl,-brtl'
7177 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
7179 CC_SHARED_OPTS='-brtl'
7180 # as well as '-qpic=large -G' or perhaps "-bM:SRE -bnoentry -bexpall"
7181 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
7185 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
7189 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
7190 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
7191 cf_cv_shlib_version=cygdll
7192 cf_cv_shlib_version_infix=cygdll
7195 cat >mk_shared_lib.sh <<-CF_EOF
7198 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
7201 Linking shared library
7202 ** SHARED_LIB \[$]SHARED_LIB
7203 ** IMPORT_LIB \[$]IMPORT_LIB
7205 exec \[$]* ${LDFLAGS} -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
7207 chmod +x mk_shared_lib.sh
7211 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
7212 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
7213 cf_cv_shlib_version=msysdll
7214 cf_cv_shlib_version_infix=msysdll
7217 cat >mk_shared_lib.sh <<-CF_EOF
7220 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
7223 Linking shared library
7224 ** SHARED_LIB \[$]SHARED_LIB
7225 ** IMPORT_LIB \[$]IMPORT_LIB
7227 exec \[$]* ${LDFLAGS} -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
7229 chmod +x mk_shared_lib.sh
7232 cf_try_cflags="no-cpp-precomp"
7233 CC_SHARED_OPTS="-dynamic"
7234 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
7235 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
7236 cf_cv_shlib_version_infix=yes
7237 AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [
7238 cf_save_LDFLAGS=$LDFLAGS
7239 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
7240 AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no)
7241 LDFLAGS=$cf_save_LDFLAGS])
7242 if test "$cf_cv_ldflags_search_paths_first" = yes; then
7243 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
7248 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
7251 # HP-UX 8.07 ld lacks "+b" option used for libdir search-list
7252 if test "$GCC" != yes; then
7255 MK_SHARED_LIB='${LD} ${LDFLAGS} -b -o $[@]'
7256 INSTALL_LIB="-m 555"
7259 # (tested with gcc 2.7.2 -- I don't have c89)
7260 if test "$GCC" = yes; then
7261 LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}'
7264 LD_SHARED_OPTS='-Wl,+b,${libdir}'
7266 MK_SHARED_LIB='${LD} ${LDFLAGS} +b ${libdir} -b -o $[@]'
7267 # HP-UX shared libraries must be executable, and should be
7268 # readonly to exploit a quirk in the memory manager.
7269 INSTALL_LIB="-m 555"
7272 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
7273 if test "$cf_cv_shlib_version" = rel; then
7274 cf_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
7276 cf_shared_soname='`basename $[@]`'
7279 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $[@]'
7282 if test "$cf_cv_enable_rpath" = yes ; then
7283 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
7285 # tested with IRIX 5.2 and 'cc'.
7286 if test "$GCC" != yes; then
7287 CC_SHARED_OPTS='-KPIC'
7288 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -rdata_shared -soname `basename $[@]` -o $[@]'
7290 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,`basename $[@]` -o $[@]'
7292 cf_cv_rm_so_locs=yes
7294 (linux*|gnu*|k*bsd*-gnu)
7295 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
7296 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
7297 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
7299 if test "$cf_cv_enable_rpath" = yes ; then
7300 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
7303 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
7306 cf_cv_shlib_version=msvcdll
7307 cf_cv_shlib_version_infix=msvcdll
7310 if test "$DFT_LWR_MODEL" = "shared" ; then
7311 LOCAL_LDFLAGS="-link -dll"
7312 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
7313 EXTRA_LDFLAGS="-link -dll $EXTRA_LDFLAGS"
7316 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ ${LD} [$]{CFLAGS}'
7317 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.lib"
7318 cat >mk_shared_lib.sh <<-CF_EOF
7321 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.lib/'\`
7326 Linking shared library
7327 ** SHARED LIB \$SHARED_LIB
7328 ** IMPORT_LIB \$IMPORT_LIB
7330 args=\$(echo \[$]* | sed -E "s#-l(\w*)#\1.dll.lib#g" | sed -E "s#-L(\w*)#-LIBPATH:\1#g")
7331 exec \$my_ld -DLL -IMPLIB:"\${IMPORT_LIB}" -OUT:"\${SHARED_LIB}" ${LDFLAGS} \$args
7332 mv "\${IMPORT_LIB}" "\${IMPORT_LIB}"
7334 chmod +x mk_shared_lib.sh
7335 cat >mk_prog.sh <<-CF_EOF
7338 # Ignore first argument (compiler) and use LD (link.exe) unconditionally
7341 ldopts=("/subsystem:console")
7344 while test \[$]# -gt 0; do
7347 # ignore -link argument
7349 -M[[TD]] | -M[[TD]]d)
7350 # ignore runtime-library option
7365 libs+=("\`echo \"\[$]1\" | sed \"s/^-l//\"\`")
7368 ldopts+=("\`echo \"\[$]1\" | sed \"s/^-L/-LIBPATH:/\"\`")
7374 for linkarg in \`echo '\[$]1' | sed -e 's/-Wl,//' -e 's/,/ /'\`; do
7375 ldopts+=("\[$]{linkarg}")
7383 ldopts+=("-out:\[$]1")
7392 if [[ "\$isdll" -ne 0 ]]; then
7393 for lib in \[$]{libs[[*]]}; do
7394 ldopts+=("\[$]lib.dll.lib")
7397 for lib in \[$]{libs[[*]]}; do
7398 ldopts+=("\[$]lib.lib")
7403 ** ld options: "\[$]{ldopts[[@]]}"
7405 exec \[$]LD \[$]{ldopts[[@]]}
7408 LINK_PROGS="$SHELL ${rel_builddir}/mk_prog.sh"
7409 LINK_TESTS="$SHELL ${rel_builddir}/mk_prog.sh"
7412 cf_cv_shlib_version=mingw
7413 cf_cv_shlib_version_infix=mingw
7416 if test "$DFT_LWR_MODEL" = "shared" ; then
7417 LOCAL_LDFLAGS="-Wl,--enable-auto-import"
7418 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
7419 EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS"
7422 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
7423 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
7424 cat >mk_shared_lib.sh <<-CF_EOF
7427 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
7430 Linking shared library
7431 ** SHARED_LIB \[$]SHARED_LIB
7432 ** IMPORT_LIB \[$]IMPORT_LIB
7434 exec \[$]* ${LDFLAGS} -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
7436 chmod +x mk_shared_lib.sh
7438 (openbsd[[2-9]].*|mirbsd*)
7439 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
7440 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
7441 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
7443 if test "$cf_cv_enable_rpath" = yes ; then
7444 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
7446 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
7448 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
7452 MK_SHARED_LIB='${LD} -Wshared -Weld=-export_all -o $[@]'
7456 MK_SHARED_LIB='${LD} -Wshared -Wxld=-export_all -o $[@]'
7458 (nto-qnx*|openbsd*|freebsd[[12]].*)
7459 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
7460 MK_SHARED_LIB='${LD} ${LDFLAGS} -Bshareable -o $[@]'
7461 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
7463 (dragonfly*|freebsd*)
7464 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
7465 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
7466 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
7467 LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
7468 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
7471 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
7474 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
7475 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
7476 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
7477 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
7478 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
7479 if test "$cf_cv_shlib_version" = auto; then
7480 if test -f /usr/libexec/ld.elf_so; then
7481 cf_cv_shlib_version=abi
7483 cf_cv_shlib_version=rel
7487 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]'
7489 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -o $[@]'
7493 # tested with OSF/1 V3.2 and 'cc'
7494 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
7495 # link with shared libs).
7496 MK_SHARED_LIB='${LD} ${LDFLAGS} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`'
7499 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
7502 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
7503 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
7504 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
7505 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
7507 cf_cv_rm_so_locs=yes
7509 (sco3.2v5*) # also uw2* and UW7: hops 13-Apr-98
7510 # tested with osr5.0.5
7511 if test "$GCC" != yes; then
7512 CC_SHARED_OPTS='-belf -KPIC'
7514 MK_SHARED_LIB='${LD} ${LDFLAGS} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@'
7515 if test "$cf_cv_enable_rpath" = yes ; then
7516 # only way is to set LD_RUN_PATH but no switch for it
7519 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
7520 LINK_PROGS='LD_RUN_PATH=${libdir}'
7521 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
7524 # tested with SunOS 4.1.1 and gcc 2.7.0
7525 if test "$GCC" != yes; then
7526 CC_SHARED_OPTS='-KPIC'
7528 MK_SHARED_LIB='${LD} ${LDFLAGS} -assert pure-text -o $[@]'
7529 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
7532 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
7533 # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3
7534 if test "$DFT_LWR_MODEL" = "shared" ; then
7535 LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}"
7536 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
7538 if test "$cf_cv_enable_rpath" = yes ; then
7539 EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS"
7542 if test "$GCC" != yes; then
7543 cf_save_CFLAGS="$CFLAGS"
7544 for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O
7546 CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
7547 AC_TRY_COMPILE([#include <stdio.h>],[printf("Hello\\n");],[break])
7549 CFLAGS="$cf_save_CFLAGS"
7550 CC_SHARED_OPTS=$cf_shared_opts
7551 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -dy -G -h '$cf_cv_shared_soname' -o $[@]'
7553 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]'
7556 (sysv5uw7*|unix_sv*)
7557 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
7558 if test "$GCC" != yes; then
7559 CC_SHARED_OPTS='-KPIC'
7561 MK_SHARED_LIB='${LD} ${LDFLAGS} -d y -G -o [$]@'
7564 CC_SHARED_OPTS='unknown'
7565 MK_SHARED_LIB='echo unknown'
7569 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
7570 case "$cf_cv_shlib_version" in
7572 case "$MK_SHARED_LIB" in
7574 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
7577 AC_MSG_WARN(ignored --with-shlib-version)
7583 if test -n "$cf_try_cflags"
7585 cat > conftest.$ac_ext <<EOF
7586 #line __oline__ "${as_me:-configure}"
7588 int main(int argc, char *argv[[]])
7591 return (argv[[argc-1]] == 0) ;
7594 cf_save_CFLAGS="$CFLAGS"
7595 for cf_opt in $cf_try_cflags
7597 CFLAGS="$cf_save_CFLAGS -$cf_opt"
7598 AC_MSG_CHECKING(if CFLAGS option -$cf_opt works)
7599 if AC_TRY_EVAL(ac_compile); then
7601 cf_save_CFLAGS="$CFLAGS"
7606 CFLAGS="$cf_save_CFLAGS"
7610 # RPATH_LIST is a colon-separated list of directories
7611 test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
7612 test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
7614 test "$cf_cv_rm_so_locs" = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations"
7616 CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS)
7617 CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB)
7619 AC_SUBST(CC_SHARED_OPTS)
7620 AC_SUBST(LD_RPATH_OPT)
7621 AC_SUBST(LD_SHARED_OPTS)
7622 AC_SUBST(MK_SHARED_LIB)
7623 AC_SUBST(RM_SHARED_OPTS)
7625 AC_SUBST(LINK_PROGS)
7626 AC_SUBST(LINK_TESTS)
7628 AC_SUBST(EXTRA_LDFLAGS)
7629 AC_SUBST(LOCAL_LDFLAGS)
7630 AC_SUBST(LOCAL_LDFLAGS2)
7632 AC_SUBST(INSTALL_LIB)
7633 AC_SUBST(RPATH_LIST)
7635 dnl ---------------------------------------------------------------------------
7636 dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
7637 dnl ----------------
7638 dnl utility macro for CF_SHARED_OPTS, constructs "$cf_cv_shared_soname" for
7639 dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar)
7642 dnl $1 is the default that should be used for "$cf_cv_shlib_version".
7643 dnl If missing, use "rel".
7644 define([CF_SHARED_SONAME],
7646 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1)
7647 if test "$cf_cv_shlib_version" = rel; then
7648 cf_cv_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
7650 cf_cv_shared_soname='`basename $[@]`'
7653 dnl ---------------------------------------------------------------------------
7654 dnl CF_SIGWINCH version: 6 updated: 2021/01/01 13:31:04
7656 dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
7657 dnl programs need this test).
7659 dnl This is really a Mac OS X 10.4.3 workaround. Defining _POSIX_C_SOURCE
7660 dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct
7661 dnl winsize declaration is left alone - we may revisit this if Apple choose to
7662 dnl break that part of the interface as well.
7663 AC_DEFUN([CF_SIGWINCH],
7665 AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
7667 #include <sys/types.h>
7668 #include <sys/signal.h>
7669 ],[int x = SIGWINCH; (void)x],
7670 [cf_cv_define_sigwinch=yes],
7672 #undef _XOPEN_SOURCE
7673 #undef _POSIX_SOURCE
7674 #undef _POSIX_C_SOURCE
7675 #include <sys/types.h>
7676 #include <sys/signal.h>
7677 ],[int x = SIGWINCH; (void)x],
7678 [cf_cv_define_sigwinch=maybe],
7679 [cf_cv_define_sigwinch=no])
7683 if test "$cf_cv_define_sigwinch" = maybe ; then
7684 AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
7685 cf_cv_fixup_sigwinch=unknown
7687 while test "$cf_sigwinch" != 1
7690 #undef _XOPEN_SOURCE
7691 #undef _POSIX_SOURCE
7692 #undef _POSIX_C_SOURCE
7693 #include <sys/types.h>
7694 #include <sys/signal.h>
7696 #if SIGWINCH != $cf_sigwinch
7699 int x = SIGWINCH; (void)x],
7700 [cf_cv_fixup_sigwinch=$cf_sigwinch
7703 cf_sigwinch="`expr "$cf_sigwinch" - 1`"
7707 if test "$cf_cv_fixup_sigwinch" != unknown ; then
7708 CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
7712 dnl ---------------------------------------------------------------------------
7713 dnl CF_SIG_ATOMIC_T version: 5 updated: 2020/03/10 18:53:47
7715 dnl signal handler, but there are some gcc dependencies in that recommendation.
7717 AC_DEFUN([CF_SIG_ATOMIC_T],
7719 AC_MSG_CHECKING(for signal global datatype)
7720 AC_CACHE_VAL(cf_cv_sig_atomic_t,[
7722 "volatile sig_atomic_t" \
7727 #include <sys/types.h>
7733 static void handler(int sig)
7738 [signal(SIGINT, handler);
7740 [cf_cv_sig_atomic_t=$cf_type],
7741 [cf_cv_sig_atomic_t=no])
7742 test "$cf_cv_sig_atomic_t" != no && break
7745 AC_MSG_RESULT($cf_cv_sig_atomic_t)
7746 test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype])
7748 dnl ---------------------------------------------------------------------------
7749 dnl CF_SIZECHANGE version: 17 updated: 2021/01/01 13:31:04
7751 dnl Check for definitions & structures needed for window size-changing
7753 dnl https://stackoverflow.com/questions/18878141/difference-between-structures-ttysize-and-winsize/50769952#50769952
7754 AC_DEFUN([CF_SIZECHANGE],
7756 AC_REQUIRE([CF_STRUCT_TERMIOS])
7757 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
7758 cf_cv_sizechange=unknown
7759 cf_save_CPPFLAGS="$CPPFLAGS"
7761 for cf_opts in "" "NEED_PTEM_H"
7764 CPPFLAGS="$cf_save_CPPFLAGS"
7765 if test -n "$cf_opts"
7767 CF_APPEND_TEXT(CPPFLAGS,-D$cf_opts)
7769 AC_TRY_COMPILE([#include <sys/types.h>
7770 #ifdef HAVE_TERMIOS_H
7771 #include <termios.h>
7773 #ifdef HAVE_TERMIO_H
7779 /* This is a workaround for SCO: they neglected to define struct winsize in
7780 * termios.h -- it's only in termio.h and ptem.h
7782 #include <sys/stream.h>
7783 #include <sys/ptem.h>
7786 #ifdef HAVE_SYS_IOCTL_H
7787 #include <sys/ioctl.h>
7791 struct ttysize win; /* SunOS 3.0... */
7792 int y = win.ts_lines = 2;
7793 int x = win.ts_cols = 1;
7798 struct winsize win; /* everything else */
7799 int y = win.ws_row = 2;
7800 int x = win.ws_col = 1;
7804 no TIOCGSIZE or TIOCGWINSZ
7805 #endif /* TIOCGWINSZ */
7806 #endif /* TIOCGSIZE */
7808 [cf_cv_sizechange=yes],
7809 [cf_cv_sizechange=no])
7811 CPPFLAGS="$cf_save_CPPFLAGS"
7812 if test "$cf_cv_sizechange" = yes ; then
7813 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
7814 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
7819 if test "$cf_cv_sizechange" != no ; then
7820 AC_DEFINE(HAVE_SIZECHANGE,1,[Define to 1 if sizechange declarations are provided])
7821 case "$cf_cv_sizechange" in
7823 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
7828 dnl ---------------------------------------------------------------------------
7829 dnl CF_SRC_MODULES version: 33 updated: 2021/01/01 13:31:04
7831 dnl For each parameter, test if the source-directory exists, and if it contains
7832 dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
7833 dnl use in CF_LIB_RULES.
7835 dnl This uses the configured value to make the lists SRC_SUBDIRS and
7836 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
7837 AC_DEFUN([CF_SRC_MODULES],
7839 AC_REQUIRE([CF_CHECK_GNAT_VERSION])
7840 AC_MSG_CHECKING(for src modules)
7842 # dependencies and linker-arguments for test-programs
7843 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
7844 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2"
7845 if test "$DFT_LWR_MODEL" = "libtool"; then
7846 TEST_ARGS="${TEST_DEPS}"
7847 TEST_ARG2="${TEST_DEP2}"
7849 TEST_ARGS="-l${LIB_NAME}${USE_ARG_SUFFIX} $TEST_ARGS"
7850 TEST_ARG2="-l${LIB_NAME}${USE_ARG_SUFFIX} $TEST_ARG2"
7853 PC_MODULES_TO_MAKE="ncurses${USE_ARG_SUFFIX}"
7857 if test -f "$srcdir/$cf_dir/modules" ; then
7859 # We may/may not have tack in the distribution, though the
7861 if test "$cf_dir" = tack ; then
7862 if test "x$cf_with_tack" != "xyes"; then
7867 if test -z "$cf_cv_src_modules"; then
7868 cf_cv_src_modules=$cf_dir
7870 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
7873 # Make the ncurses_cfg.h file record the library interface files as
7874 # well. These are header files that are the same name as their
7875 # directory. Ncurses is the only library that does not follow
7877 if test "$cf_dir" = tack ; then
7879 elif test -f "$srcdir/${cf_dir}/${cf_dir}.h" ; then
7880 CF_UPPER(cf_have_include,$cf_dir)
7881 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
7882 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
7883 CF_MAP_LIB_BASENAME(TEST_ROOT,$cf_dir)
7884 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TEST_ROOT}${DFT_DEP_SUFFIX} $TEST_DEPS"
7885 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${TEST_ROOT}${DFT_DEP_SUFFIX} $TEST_DEP2"
7886 if test "$DFT_LWR_MODEL" = "libtool"; then
7887 TEST_ARGS="${TEST_DEPS}"
7888 TEST_ARG2="${TEST_DEP2}"
7890 TEST_ARGS="-l${TEST_ROOT}${USE_ARG_SUFFIX} $TEST_ARGS"
7891 TEST_ARG2="-l${TEST_ROOT}${USE_ARG_SUFFIX} $TEST_ARG2"
7893 PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ${cf_dir}${USE_ARG_SUFFIX}"
7897 AC_MSG_RESULT($cf_cv_src_modules)
7899 TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
7900 TEST_ARG2="-L${LIB_2ND} $TEST_ARG2"
7909 if test "x$cf_with_manpages" != xno ; then
7910 SRC_SUBDIRS="$SRC_SUBDIRS man"
7912 SRC_SUBDIRS="$SRC_SUBDIRS include"
7913 for cf_dir in $cf_cv_src_modules
7915 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
7917 if test "x$cf_with_tests" != "xno" ; then
7918 SRC_SUBDIRS="$SRC_SUBDIRS test"
7920 # always make this, to install the ncurses-config script
7921 SRC_SUBDIRS="$SRC_SUBDIRS misc"
7922 if test "$cf_with_cxx_binding" != no; then
7923 PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ncurses++${USE_ARG_SUFFIX}"
7924 SRC_SUBDIRS="$SRC_SUBDIRS c++"
7927 test "x$with_termlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TINFO_ARG_SUFFIX"
7928 test "x$with_ticlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TICS_ARG_SUFFIX"
7930 AC_SUBST(PC_MODULES_TO_MAKE)
7933 if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = xyes && test -f "$srcdir/Ada95/Makefile.in" ; then
7934 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
7935 ADA_SUBDIRS="gen src"
7936 if test "x$cf_with_tests" != "xno" ; then
7937 ADA_SUBDIRS="$ADA_SUBDIRS samples"
7942 for cf_dir in $SRC_SUBDIRS
7944 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
7947 if test -n "$ADA_SUBDIRS"; then
7948 for cf_dir in $ADA_SUBDIRS
7950 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
7952 AC_SUBST(ADA_SUBDIRS)
7955 dnl ---------------------------------------------------------------------------
7956 dnl CF_STDCPP_LIBRARY version: 12 updated: 2021/01/01 13:31:04
7957 dnl -----------------
7958 dnl Check for -lstdc++, which is GNU's standard C++ library.
7959 dnl If $CXXLIBS is set, add that to the libraries used for test-linking.
7960 dnl If -lstdc++ was not already added to $LIBS or $CXXLIBS, and is needed,
7961 dnl add it to $CXXLIBS.
7962 AC_DEFUN([CF_STDCPP_LIBRARY],
7964 if test -n "$GXX" ; then
7967 LIBS="$LIBS $CXXLIBS"
7968 AC_MSG_CHECKING(if we already have C++ library)
7970 #include <iostream>],[
7971 std::cout << "Hello World!" << std::endl;],
7972 [cf_have_libstdcpp=yes],
7973 [cf_have_libstdcpp=no])
7974 AC_MSG_RESULT($cf_have_libstdcpp)
7977 if test "$cf_have_libstdcpp" != yes
7979 case "$cf_cv_system_name" in
7981 if test -z "`g++ -dM -E - < /dev/null | grep __KLIBC__`"; then
7982 cf_stdcpp_libname=stdcpp
7984 cf_stdcpp_libname=stdc++
7988 cf_stdcpp_libname=stdc++
7992 AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
7994 LIBS="$LIBS $CXXLIBS"
7995 CF_ADD_LIB($cf_stdcpp_libname)
7997 #include <iostream>],[
7998 std::cout << "Hello World!" << std::endl;],
7999 [cf_cv_libstdcpp=yes],
8000 [cf_cv_libstdcpp=no])
8003 test "$cf_cv_libstdcpp" = yes && { CF_ADD_LIB($cf_stdcpp_libname,CXXLIBS) }
8007 dnl ---------------------------------------------------------------------------
8008 dnl CF_STRIP_G_OPT version: 4 updated: 2021/01/02 09:31:20
8010 dnl Remove "-g" option from the compiler options
8011 AC_DEFUN([CF_STRIP_G_OPT],
8012 [$1=`echo "${$1}" | CF__SED_TRIMBLANKS(-e 's%-g %%' -e 's%-g$%%')`])dnl
8013 dnl ---------------------------------------------------------------------------
8014 dnl CF_STRUCT_SIGACTION version: 5 updated: 2012/10/06 17:56:13
8015 dnl -------------------
8016 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
8017 dnl do this if we've found the sigaction function.
8018 AC_DEFUN([CF_STRUCT_SIGACTION],[
8019 AC_REQUIRE([CF_XOPEN_SOURCE])
8021 if test "$ac_cv_func_sigaction" = yes; then
8022 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
8024 #include <sys/types.h>
8025 #include <signal.h>],
8026 [struct sigaction act],
8030 #define _POSIX_SOURCE
8031 #include <sys/types.h>
8032 #include <signal.h>],
8033 [struct sigaction act],
8035 AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE])],
8036 [sigact_bad=unknown])])
8037 AC_MSG_RESULT($sigact_bad)
8040 dnl ---------------------------------------------------------------------------
8041 dnl CF_STRUCT_TERMIOS version: 11 updated: 2020/03/19 20:46:13
8042 dnl -----------------
8043 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
8044 AC_DEFUN([CF_STRUCT_TERMIOS],[
8045 AC_REQUIRE([CF_XOPEN_SOURCE])
8055 if test "$ac_cv_header_termios_h" = yes ; then
8056 case "$CFLAGS $CPPFLAGS" in
8058 termios_bad=dunno ;;
8059 (*) termios_bad=maybe ;;
8061 if test "$termios_bad" = maybe ; then
8062 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
8063 AC_TRY_COMPILE([#include <termios.h>],
8064 [struct termios foo; int x = foo.c_iflag = 1; (void)x],
8067 #define _POSIX_SOURCE
8068 #include <termios.h>],
8069 [struct termios foo; int x = foo.c_iflag = 2; (void)x],
8070 termios_bad=unknown,
8071 termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE]))
8073 AC_MSG_RESULT($termios_bad)
8077 dnl ---------------------------------------------------------------------------
8078 dnl CF_SUBDIR_PATH version: 7 updated: 2014/12/04 04:33:06
8080 dnl Construct a search-list for a nonstandard header/lib-file
8081 dnl $1 = the variable to return as result
8082 dnl $2 = the package name
8083 dnl $3 = the subdirectory, e.g., bin, include or lib
8084 AC_DEFUN([CF_SUBDIR_PATH],
8088 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
8090 for cf_subdir_prefix in \
8098 CF_ADD_SUBDIR_PATH($1,$2,$3,$cf_subdir_prefix,$prefix)
8101 dnl ---------------------------------------------------------------------------
8102 dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03
8104 dnl Shorthand macro for substituting things that the user may override
8105 dnl with an environment variable.
8107 dnl $1 = condition to pass to "test"
8108 dnl $2 = environment variable
8109 dnl $3 = value if the test succeeds
8110 dnl $4 = value if the test fails
8111 AC_DEFUN([CF_SUBST_IF],
8120 dnl ---------------------------------------------------------------------------
8121 dnl CF_SUBST_NCURSES_VERSION version: 10 updated: 2021/01/04 18:48:01
8122 dnl ------------------------
8123 dnl Get the version-number for use in shared-library naming, etc.
8124 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
8125 [AC_REQUIRE([AC_PROG_EGREP])dnl
8127 NCURSES_MAJOR="`${EGREP-egrep} '^NCURSES_MAJOR[[ ]]*=' "$srcdir/dist.mk" | sed -e 's/^[[^0-9]]*//'`"
8128 NCURSES_MINOR="`${EGREP-egrep} '^NCURSES_MINOR[[ ]]*=' "$srcdir/dist.mk" | sed -e 's/^[[^0-9]]*//'`"
8129 NCURSES_PATCH="`${EGREP-egrep} '^NCURSES_PATCH[[ ]]*=' "$srcdir/dist.mk" | sed -e 's/^[[^0-9]]*//'`"
8130 cf_cv_abi_version=${NCURSES_MAJOR}
8131 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
8132 dnl Show the computed version, for logging
8133 cf_cv_timestamp=`date`
8134 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
8135 dnl We need these values in the generated headers
8136 AC_SUBST(NCURSES_MAJOR)
8137 AC_SUBST(NCURSES_MINOR)
8138 AC_SUBST(NCURSES_PATCH)
8139 dnl We need these values in the generated makefiles
8140 AC_SUBST(cf_cv_rel_version)
8141 AC_SUBST(cf_cv_abi_version)
8142 AC_SUBST(cf_cv_builtin_bool)
8143 AC_SUBST(cf_cv_header_stdbool_h)
8144 AC_SUBST(cf_cv_type_of_bool)dnl
8146 dnl ---------------------------------------------------------------------------
8147 dnl CF_SYS_TIME_SELECT version: 6 updated: 2015/04/18 08:56:57
8148 dnl ------------------
8149 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
8150 dnl older SCO configurations.
8151 AC_DEFUN([CF_SYS_TIME_SELECT],
8153 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
8154 AC_CACHE_VAL(cf_cv_sys_time_select,[
8156 #include <sys/types.h>
8157 #ifdef HAVE_SYS_TIME_H
8158 #include <sys/time.h>
8160 #ifdef HAVE_SYS_SELECT_H
8161 #include <sys/select.h>
8163 ],[],[cf_cv_sys_time_select=yes],
8164 [cf_cv_sys_time_select=no])
8166 AC_MSG_RESULT($cf_cv_sys_time_select)
8167 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>])
8169 dnl ---------------------------------------------------------------------------
8170 dnl CF_TOP_BUILDDIR version: 2 updated: 2013/07/27 17:38:32
8172 dnl Define a top_builddir symbol, for applications that need an absolute path.
8173 AC_DEFUN([CF_TOP_BUILDDIR],
8175 top_builddir=ifelse($1,,`pwd`,$1)
8176 AC_SUBST(top_builddir)
8178 dnl ---------------------------------------------------------------------------
8179 dnl CF_TRY_PKG_CONFIG version: 6 updated: 2020/12/31 10:54:15
8180 dnl -----------------
8181 dnl This is a simple wrapper to use for pkg-config, for libraries which may be
8182 dnl available in that form.
8184 dnl $1 = package name, which may be a shell variable
8185 dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS
8186 dnl $3 = logic to use if pkg-config does not have the package
8187 AC_DEFUN([CF_TRY_PKG_CONFIG],[
8188 AC_REQUIRE([CF_PKG_CONFIG])
8190 if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists "$1"; then
8191 CF_VERBOSE(found package $1)
8192 cf_pkgconfig_incs="`$PKG_CONFIG --cflags "$1" 2>/dev/null`"
8193 cf_pkgconfig_libs="`$PKG_CONFIG --libs "$1" 2>/dev/null`"
8194 CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs)
8195 CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs)
8196 CF_ADD_CFLAGS($cf_pkgconfig_incs)
8197 CF_ADD_LIBS($cf_pkgconfig_libs)
8198 ifelse([$2],,:,[$2])
8202 ifelse([$3],,:,[$3])
8205 dnl ---------------------------------------------------------------------------
8206 dnl CF_TRY_XOPEN_SOURCE version: 3 updated: 2021/08/28 15:20:37
8207 dnl -------------------
8208 dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
8209 dnl can define it successfully.
8210 AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
8211 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
8215 #include <sys/types.h>
8217 #ifndef _XOPEN_SOURCE
8220 [cf_cv_xopen_source=no],
8221 [cf_save="$CPPFLAGS"
8222 CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE)
8226 #include <sys/types.h>
8228 #ifdef _XOPEN_SOURCE
8231 [cf_cv_xopen_source=no],
8232 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
8237 if test "$cf_cv_xopen_source" != no ; then
8238 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
8239 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
8240 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
8241 CF_APPEND_CFLAGS($cf_temp_xopen_source)
8244 dnl ---------------------------------------------------------------------------
8245 dnl CF_TYPEOF_CHTYPE version: 10 updated: 2017/01/21 11:06:25
8246 dnl ----------------
8247 dnl Determine the type we should use for chtype (and attr_t, which is treated
8248 dnl as the same thing). We want around 32 bits, so on most machines want a
8249 dnl long, but on newer 64-bit machines, probably want an int. If we're using
8250 dnl wide characters, we have to have a type compatible with that, as well.
8251 AC_DEFUN([CF_TYPEOF_CHTYPE],
8253 AC_MSG_CHECKING([for type of chtype])
8254 AC_CACHE_VAL(cf_cv_typeof_chtype,[
8256 #define WANT_BITS 31
8260 FILE *fp = fopen("cf_test.out", "w");
8262 char *result = "long";
8263 if (sizeof(unsigned long) > sizeof(unsigned int)) {
8266 for (n = 0; n < WANT_BITS; n++) {
8269 if (y != 1 || x == 0) {
8275 * If x is nonzero, an int is big enough for the bits
8278 result = (x != 0) ? "int" : "long";
8283 ${cf_cv_main_return:-return}(0);
8286 [cf_cv_typeof_chtype=`cat cf_test.out`],
8287 [cf_cv_typeof_chtype=long],
8288 [cf_cv_typeof_chtype=long])
8291 AC_MSG_RESULT($cf_cv_typeof_chtype)
8293 AC_SUBST(cf_cv_typeof_chtype)
8294 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype,[Define to actual type if needed for chtype])
8296 dnl ---------------------------------------------------------------------------
8297 dnl CF_TYPE_SIGACTION version: 4 updated: 2012/10/06 17:56:13
8298 dnl -----------------
8300 AC_DEFUN([CF_TYPE_SIGACTION],
8302 AC_MSG_CHECKING([for type sigaction_t])
8303 AC_CACHE_VAL(cf_cv_type_sigaction,[
8305 #include <signal.h>],
8307 [cf_cv_type_sigaction=yes],
8308 [cf_cv_type_sigaction=no])])
8309 AC_MSG_RESULT($cf_cv_type_sigaction)
8310 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION,1,[Define to 1 if we have the sigaction_t type])
8312 dnl ---------------------------------------------------------------------------
8313 dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
8314 dnl --------------------
8315 dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
8316 dnl won't, but they're still there.
8317 AC_DEFUN([CF_UNSIGNED_LITERALS],
8319 AC_MSG_CHECKING([if unsigned literals are legal])
8320 AC_CACHE_VAL(cf_cv_unsigned_literals,[
8321 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
8322 [cf_cv_unsigned_literals=yes],
8323 [cf_cv_unsigned_literals=no])
8325 AC_MSG_RESULT($cf_cv_unsigned_literals)
8327 dnl ---------------------------------------------------------------------------
8328 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
8330 dnl Make an uppercase version of a variable
8331 dnl $1=uppercase($2)
8332 AC_DEFUN([CF_UPPER],
8334 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
8336 dnl ---------------------------------------------------------------------------
8337 dnl CF_UTF8_LIB version: 9 updated: 2021/05/19 19:35:25
8339 dnl Check for multibyte support, and if not found, utf8 compatibility library
8340 AC_DEFUN([CF_UTF8_LIB],
8342 AC_HAVE_HEADERS(wchar.h)
8343 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
8344 cf_save_LIBS="$LIBS"
8352 [cf_cv_utf8_lib=yes],
8354 #include <libutf8.h>],[putwc(0,0);],utf8,
8355 [cf_cv_utf8_lib=add-on],
8356 [cf_cv_utf8_lib=no])
8359 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
8361 if test "$cf_cv_utf8_lib" = "add-on" ; then
8362 AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
8363 CF_ADD_INCDIR($cf_cv_header_path_utf8)
8364 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
8365 CF_ADD_LIBS($cf_cv_library_file_utf8)
8368 dnl ---------------------------------------------------------------------------
8369 dnl CF_VA_COPY version: 6 updated: 2018/12/04 18:14:25
8371 dnl check for va_copy, part of stdarg.h starting with ISO C 1999.
8372 dnl Also, workaround for glibc's __va_copy, by checking for both.
8373 dnl Finally, try to accommodate pre-ISO C 1999 headers.
8374 AC_DEFUN([CF_VA_COPY],[
8375 AC_CACHE_CHECK(for va_copy, cf_cv_have_va_copy,[
8382 cf_cv_have_va_copy=yes,
8383 cf_cv_have_va_copy=no)])
8385 if test "$cf_cv_have_va_copy" = yes;
8387 AC_DEFINE(HAVE_VA_COPY,1,[Define to 1 if we have va_copy])
8388 else # !cf_cv_have_va_copy
8390 AC_CACHE_CHECK(for __va_copy, cf_cv_have___va_copy,[
8396 __va_copy(dst, src)],
8397 cf_cv_have___va_copy=yes,
8398 cf_cv_have___va_copy=no)])
8400 if test "$cf_cv_have___va_copy" = yes
8402 AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if we have __va_copy])
8403 else # !cf_cv_have___va_copy
8405 AC_CACHE_CHECK(for __builtin_va_copy, cf_cv_have___builtin_va_copy,[
8411 __builtin_va_copy(dst, src)],
8412 cf_cv_have___builtin_va_copy=yes,
8413 cf_cv_have___builtin_va_copy=no)])
8415 test "$cf_cv_have___builtin_va_copy" = yes &&
8416 AC_DEFINE(HAVE___BUILTIN_VA_COPY,1,[Define to 1 if we have __builtin_va_copy])
8418 fi # cf_cv_have___va_copy
8420 fi # cf_cv_have_va_copy
8422 case "${cf_cv_have_va_copy}${cf_cv_have___va_copy}${cf_cv_have___builtin_va_copy}" in
8427 AC_CACHE_CHECK(if we can simply copy va_list, cf_cv_pointer_va_list,[
8434 cf_cv_pointer_va_list=yes,
8435 cf_cv_pointer_va_list=no)])
8437 if test "$cf_cv_pointer_va_list" = no
8439 AC_CACHE_CHECK(if we can copy va_list indirectly, cf_cv_array_va_list,[
8446 cf_cv_array_va_list=yes,
8447 cf_cv_array_va_list=no)])
8448 test "$cf_cv_array_va_list" = yes && AC_DEFINE(ARRAY_VA_LIST,1,[Define to 1 if we can copy va_list indirectly])
8453 dnl ---------------------------------------------------------------------------
8454 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
8456 dnl Use AC_VERBOSE w/o the warnings
8457 AC_DEFUN([CF_VERBOSE],
8458 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
8461 dnl ---------------------------------------------------------------------------
8462 dnl CF_VERSION_INFO version: 8 updated: 2021/01/01 13:31:04
8464 dnl Define several useful symbols derived from the VERSION file. A separate
8465 dnl file is preferred to embedding the version numbers in various scripts.
8466 dnl (automake is a textbook-example of why the latter is a bad idea, but there
8469 dnl The file contents are:
8470 dnl libtool-version release-version patch-version
8474 dnl libtool-version (see ?) consists of 3 integers separated by '.'
8475 dnl release-version consists of a major version and minor version
8476 dnl separated by '.', optionally followed by a patch-version
8477 dnl separated by '-'. The minor version need not be an
8478 dnl integer (but it is preferred).
8479 dnl patch-version is an integer in the form yyyymmdd, so ifdef's and
8480 dnl scripts can easily compare versions.
8482 dnl If libtool is used, the first form is required, since CF_WITH_LIBTOOL
8483 dnl simply extracts the first field using 'cut -f1'.
8485 dnl Optional parameters:
8486 dnl $1 = internal name for package
8487 dnl $2 = external name for package
8488 AC_DEFUN([CF_VERSION_INFO],
8490 if test -f "$srcdir/VERSION" ; then
8491 AC_MSG_CHECKING(for package version)
8493 # if there are not enough fields, cut returns the last one...
8494 cf_field1=`sed -e '2,$d' "$srcdir/VERSION" |cut -f1`
8495 cf_field2=`sed -e '2,$d' "$srcdir/VERSION" |cut -f2`
8496 cf_field3=`sed -e '2,$d' "$srcdir/VERSION" |cut -f3`
8498 # this is how CF_BUNDLED_INTL uses $VERSION:
8499 VERSION="$cf_field1"
8501 VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'`
8502 test -z "$VERSION_MAJOR" && AC_MSG_ERROR(missing major-version)
8504 VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[[^.]]*\.//' -e 's/-.*//'`
8505 test -z "$VERSION_MINOR" && AC_MSG_ERROR(missing minor-version)
8507 AC_MSG_RESULT(${VERSION_MAJOR}.${VERSION_MINOR})
8509 AC_MSG_CHECKING(for package patch date)
8510 VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[[^-]]*-//'`
8511 case .$VERSION_PATCH in
8513 AC_MSG_ERROR(missing patch-date $VERSION_PATCH)
8515 (.[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]])
8518 AC_MSG_ERROR(illegal patch-date $VERSION_PATCH)
8521 AC_MSG_RESULT($VERSION_PATCH)
8523 AC_MSG_ERROR(did not find $srcdir/VERSION)
8526 # show the actual data that we have for versions:
8527 CF_VERBOSE(ABI VERSION $VERSION)
8528 CF_VERBOSE(VERSION_MAJOR $VERSION_MAJOR)
8529 CF_VERBOSE(VERSION_MINOR $VERSION_MINOR)
8530 CF_VERBOSE(VERSION_PATCH $VERSION_PATCH)
8533 AC_SUBST(VERSION_MAJOR)
8534 AC_SUBST(VERSION_MINOR)
8535 AC_SUBST(VERSION_PATCH)
8537 dnl if a package name is given, define its corresponding version info. We
8538 dnl need the package name to ensure that the defined symbols are unique.
8541 PACKAGE=ifelse($2,,$1,$2)
8542 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",[Define to the package-name])
8544 CF_UPPER(cf_PACKAGE,$cf_PACKAGE)
8545 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}")
8546 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_PATCHDATE,${VERSION_PATCH})
8549 dnl ---------------------------------------------------------------------------
8550 dnl CF_WCHAR_TYPE version: 4 updated: 2012/10/06 16:39:58
8552 dnl Check if type wide-character type $1 is declared, and if so, which header
8553 dnl file is needed. The second parameter is used to set a shell variable when
8554 dnl the type is not found. The first parameter sets a shell variable for the
8556 AC_DEFUN([CF_WCHAR_TYPE],
8558 # This is needed on Tru64 5.0 to declare $1
8559 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
8564 #ifdef HAVE_LIBUTF8_H
8565 #include <libutf8.h>
8574 #ifdef HAVE_LIBUTF8_H
8575 #include <libutf8.h>
8579 [cf_cv_$1=unknown])])])
8581 if test "$cf_cv_$1" = yes ; then
8582 AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
8587 # if we do not find $1 in either place, use substitution to provide a fallback.
8588 if test "$cf_cv_$1" = unknown ; then
8593 # if we find $1 in either place, use substitution to provide a fallback.
8594 if test "$cf_cv_$1" != unknown ; then
8599 dnl ---------------------------------------------------------------------------
8600 dnl CF_WEAK_SYMBOLS version: 1 updated: 2008/08/16 19:18:06
8602 dnl Check for compiler-support for weak symbols.
8603 dnl This works with "recent" gcc.
8604 AC_DEFUN([CF_WEAK_SYMBOLS],[
8605 AC_CACHE_CHECK(if $CC supports weak symbols,cf_cv_weak_symbols,[
8608 #include <stdio.h>],
8610 #if defined(__GNUC__)
8611 # if defined __USE_ISOC99
8612 # define _cat_pragma(exp) _Pragma(#exp)
8613 # define _weak_pragma(exp) _cat_pragma(weak name)
8615 # define _weak_pragma(exp)
8617 # define _declare(name) __extension__ extern __typeof__(name) name
8618 # define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak))
8622 ],[cf_cv_weak_symbols=yes],[cf_cv_weak_symbols=no])
8625 dnl ---------------------------------------------------------------------------
8626 dnl CF_WITH_ABI_VERSION version: 4 updated: 2021/01/01 13:31:04
8627 dnl -------------------
8628 dnl Allow library's ABI to be overridden. Generally this happens when a
8629 dnl packager has incremented the ABI past that used in the original package,
8630 dnl and wishes to keep doing this.
8632 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
8634 AC_DEFUN([CF_WITH_ABI_VERSION],[
8635 test -z "$cf_cv_abi_version" && cf_cv_abi_version=0
8636 AC_ARG_WITH(abi-version,
8637 [ --with-abi-version=XXX override derived ABI version],[
8638 if test "x$cf_cv_abi_version" != "x$withval"
8640 AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval)
8641 case "$cf_cv_rel_version" in
8643 cf_cv_rel_version=$withval.0
8646 cf_cv_rel_version=$withval.9 # FIXME: should be 10 as of 6.0 release
8650 cf_cv_abi_version=$withval])
8651 CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version)
8653 $1_ABI=$cf_cv_abi_version
8656 dnl ---------------------------------------------------------------------------
8657 dnl CF_WITH_ADA_COMPILER version: 2 updated: 2010/06/26 17:35:58
8658 dnl --------------------
8659 dnl Command-line option to specify the Ada95 compiler.
8660 AC_DEFUN([CF_WITH_ADA_COMPILER],[
8661 AC_MSG_CHECKING(for ada-compiler)
8662 AC_ARG_WITH(ada-compiler,
8663 [ --with-ada-compiler=CMD specify Ada95 compiler command (default gnatmake)],
8664 [cf_ada_compiler=$withval],
8665 [cf_ada_compiler=gnatmake])
8666 AC_SUBST(cf_ada_compiler)
8667 AC_MSG_RESULT($cf_ada_compiler)
8669 dnl ---------------------------------------------------------------------------
8670 dnl CF_WITH_ADA_INCLUDE version: 2 updated: 2010/06/26 17:35:58
8671 dnl -------------------
8672 dnl Command-line option to specify where Ada includes will install.
8673 AC_DEFUN([CF_WITH_ADA_INCLUDE],[
8674 AC_MSG_CHECKING(for ada-include)
8675 CF_WITH_PATH(ada-include,
8676 [ --with-ada-include=DIR Ada includes are in DIR],
8678 PREFIX/share/ada/adainclude,
8679 [$]prefix/share/ada/adainclude)
8680 AC_SUBST(ADA_INCLUDE)
8681 AC_MSG_RESULT($ADA_INCLUDE)
8683 dnl ---------------------------------------------------------------------------
8684 dnl CF_WITH_ADA_LIBNAME version: 1 updated: 2019/09/07 18:59:41
8685 dnl -------------------
8686 dnl CF_WITH_ADA_LIBNAME
8687 dnl -------------------
8688 dnl Command-line option to specify how to name the resulting Ada library.
8689 dnl $1 = default value
8690 AC_DEFUN([CF_WITH_ADA_LIBNAME],[
8691 AC_MSG_CHECKING(for ada-libname)
8692 AC_ARG_WITH(ada-libname,
8693 [ --with-ada-libname=XXX override default Ada library-name],
8694 ADA_LIBNAME=[$]withval,
8696 case "x$ADA_LIBNAME" in
8701 AC_SUBST(ADA_LIBNAME)
8702 AC_MSG_RESULT($ADA_LIBNAME)
8704 dnl ---------------------------------------------------------------------------
8705 dnl CF_WITH_ADA_OBJECTS version: 2 updated: 2010/06/26 17:35:58
8706 dnl -------------------
8707 dnl Command-line option to specify where Ada objects will install.
8708 AC_DEFUN([CF_WITH_ADA_OBJECTS],[
8709 AC_MSG_CHECKING(for ada-objects)
8710 CF_WITH_PATH(ada-objects,
8711 [ --with-ada-objects=DIR Ada objects are in DIR],
8713 PREFIX/lib/ada/adalib,
8714 [$]prefix/lib/ada/adalib)
8715 AC_SUBST(ADA_OBJECTS)
8716 AC_MSG_RESULT($ADA_OBJECTS)
8718 dnl ---------------------------------------------------------------------------
8719 dnl CF_WITH_ADA_SHAREDLIB version: 5 updated: 2018/07/21 19:10:35
8720 dnl ---------------------
8721 dnl Command-line option to specify if an Ada95 shared-library should be built,
8722 dnl and optionally what its soname should be.
8723 AC_DEFUN([CF_WITH_ADA_SHAREDLIB],[
8724 AC_REQUIRE([CF_GNAT_PROJECTS])
8725 AC_MSG_CHECKING(if an Ada95 shared-library should be built)
8726 AC_ARG_WITH(ada-sharedlib,
8727 [ --with-ada-sharedlib=soname build shared-library (requires GNAT projects)],
8728 [with_ada_sharedlib=$withval],
8729 [with_ada_sharedlib=no])
8730 AC_MSG_RESULT($with_ada_sharedlib)
8732 if test "x$with_ada_sharedlib" != xno
8734 if test "x$cf_gnat_projects" != xyes
8736 AC_MSG_WARN(disabling shared-library since GNAT projects are not supported)
8737 with_ada_sharedlib=no
8741 ADA_SHAREDLIB='lib$(LIB_NAME).so.1'
8742 MAKE_ADA_SHAREDLIB="#"
8744 if test "x$with_ada_sharedlib" != xno
8747 if test "x$with_ada_sharedlib" != xyes
8749 ADA_SHAREDLIB="$with_ada_sharedlib"
8753 AC_SUBST(ADA_SHAREDLIB)
8754 AC_SUBST(MAKE_ADA_SHAREDLIB)
8756 dnl ---------------------------------------------------------------------------
8757 dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
8758 dnl ----------------
8759 dnl Configure-option for dbmalloc. The optional parameter is used to override
8760 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
8761 AC_DEFUN([CF_WITH_DBMALLOC],[
8762 CF_NO_LEAKS_OPTION(dbmalloc,
8763 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
8766 if test "$with_dbmalloc" = yes ; then
8767 AC_CHECK_HEADER(dbmalloc.h,
8768 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
8771 dnl ---------------------------------------------------------------------------
8772 dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
8774 dnl Configure-option for dmalloc. The optional parameter is used to override
8775 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
8776 AC_DEFUN([CF_WITH_DMALLOC],[
8777 CF_NO_LEAKS_OPTION(dmalloc,
8778 [ --with-dmalloc test: use Gray Watson's dmalloc library],
8781 if test "$with_dmalloc" = yes ; then
8782 AC_CHECK_HEADER(dmalloc.h,
8783 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
8786 dnl ---------------------------------------------------------------------------
8787 dnl CF_WITH_EXPORT_SYMS version: 3 updated: 2014/12/20 19:16:08
8788 dnl -------------------
8789 dnl Use this with libtool to specify the list of symbols that may be exported.
8790 dnl The input file contains one symbol per line; comments work with "#".
8792 dnl $1 = basename of the ".sym" file (default $PACKAGE)
8793 AC_DEFUN([CF_WITH_EXPORT_SYMS],
8795 AC_MSG_CHECKING(if exported-symbols file should be used)
8796 AC_ARG_WITH(export-syms,
8797 [ --with-export-syms=XXX limit exported symbols using libtool],
8798 [with_export_syms=$withval],
8799 [with_export_syms=no])
8800 if test "x$with_export_syms" = xyes
8802 with_export_syms='${top_srcdir}/package/ifelse($1,,${PACKAGE},[$1]).sym'
8805 AC_MSG_RESULT($with_export_syms)
8806 if test "x$with_export_syms" != xno
8808 EXPORT_SYMS="-export-symbols $with_export_syms"
8809 AC_SUBST(EXPORT_SYMS)
8812 dnl ---------------------------------------------------------------------------
8813 dnl CF_WITH_GPM version: 10 updated: 2017/04/29 18:32:18
8816 dnl The option parameter (if neither yes/no) is assumed to be the name of
8817 dnl the gpm library, e.g., for dynamic loading.
8818 AC_DEFUN([CF_WITH_GPM],
8820 AC_MSG_CHECKING(if you want to link with the GPM mouse library)
8822 [ --with-gpm use Alessandro Rubini's GPM library],
8823 [with_gpm=$withval],
8825 AC_MSG_RESULT($with_gpm)
8827 if test "$with_gpm" != no ; then
8828 AC_CHECK_HEADER(gpm.h,[
8829 AC_DEFINE(HAVE_GPM_H,1,[Define to 1 if we have gpm.h header])
8830 if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then
8831 CF_VERBOSE(assuming we really have GPM library)
8832 AC_DEFINE(HAVE_LIBGPM,1,[Define to 1 if we have the gpm library])
8835 AC_CHECK_LIB(gpm,Gpm_Open,[with_gpm=yes],[
8836 if test "$with_gpm" = maybe; then
8837 AC_MSG_WARN(Cannot link with GPM library)
8840 AC_MSG_ERROR(Cannot link with GPM library)
8845 test "$with_gpm" != maybe && AC_MSG_WARN(Cannot find GPM header)
8850 dnl ---------------------------------------------------------------------------
8851 dnl CF_WITH_LIBTOOL version: 36 updated: 2021/01/01 13:31:04
8853 dnl Provide a configure option to incorporate libtool. Define several useful
8854 dnl symbols for the makefile rules.
8856 dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
8857 dnl macros from libtool.m4 which is in the aclocal directory of automake.
8858 dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
8859 dnl But that still does not work properly since the macro is expanded outside
8860 dnl the CF_WITH_LIBTOOL macro:
8863 dnl ACLOCAL=`aclocal --print-ac-dir`
8864 dnl if test -z "$ACLOCAL" ; then
8865 dnl echo cannot find aclocal directory
8867 dnl elif test ! -f $ACLOCAL/libtool.m4 ; then
8868 dnl echo cannot find libtool.m4 file
8872 dnl LOCAL=aclocal.m4
8873 dnl ORIG=aclocal.m4.orig
8875 dnl trap "mv $ORIG $LOCAL" 0 1 2 3 15
8879 dnl # sed the LIBTOOL= assignment to omit the current directory?
8880 dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL:-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
8881 dnl cat $ORIG >>$LOCAL
8885 AC_DEFUN([CF_WITH_LIBTOOL],
8887 AC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION])
8888 ifdef([AC_PROG_LIBTOOL],,[
8891 # common library maintenance symbols that are convenient for libtool scripts:
8892 LIB_CREATE='${AR} -cr'
8893 LIB_OBJECT='${OBJECTS}'
8897 # symbols used to prop libtool up to enable it to determine what it should be
8905 AC_MSG_CHECKING(if you want to build libraries with libtool)
8906 AC_ARG_WITH(libtool,
8907 [ --with-libtool generate libraries with libtool],
8908 [with_libtool=$withval],
8910 AC_MSG_RESULT($with_libtool)
8911 if test "$with_libtool" != "no"; then
8912 ifdef([AC_PROG_LIBTOOL],[
8913 # missing_content_AC_PROG_LIBTOOL{{
8915 # missing_content_AC_PROG_LIBTOOL}}
8917 if test "$with_libtool" != "yes" ; then
8918 CF_PATH_SYNTAX(with_libtool)
8919 LIBTOOL=$with_libtool
8921 AC_CHECK_TOOLS(LIBTOOL,[libtool glibtool],none)
8923 if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool
8925 CF_FORGET_TOOL(LIBTOOL)
8926 AC_CHECK_TOOLS(LIBTOOL,[glibtool],none)
8930 if test -z "$LIBTOOL" ; then
8931 AC_MSG_ERROR(Cannot find libtool)
8934 LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${libdir} ${LIBTOOL_VERSION} `cut -f1 ${top_srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o'
8935 LIB_OBJECT='${OBJECTS:.o=.lo}'
8937 LIB_CLEAN='${LIBTOOL} --mode=clean'
8938 LIB_COMPILE='${LIBTOOL} --mode=compile'
8939 LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}'
8940 LIB_INSTALL='${LIBTOOL} --mode=install'
8941 LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
8944 CF_CHECK_LIBTOOL_VERSION
8946 # special hack to add -no-undefined (which libtool should do for itself)
8948 case "$cf_cv_system_name" in
8949 (cygwin*|msys*|mingw32*|os2*|uwin*|aix[[4-7]])
8950 LT_UNDEF=-no-undefined
8953 AC_SUBST([LT_UNDEF])
8955 # special hack to add --tag option for C++ compiler
8956 case "$cf_cv_libtool_version" in
8957 (1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*)
8958 LIBTOOL_CXX="$LIBTOOL --tag=CXX"
8959 LIBTOOL="$LIBTOOL --tag=CC"
8962 LIBTOOL_CXX="$LIBTOOL"
8970 test -z "$LIBTOOL" && ECHO_LT=
8973 AC_SUBST(LIBTOOL_CXX)
8974 AC_SUBST(LIBTOOL_OPTS)
8976 AC_SUBST(LIB_CREATE)
8977 AC_SUBST(LIB_OBJECT)
8978 AC_SUBST(LIB_SUFFIX)
8982 AC_SUBST(LIB_COMPILE)
8984 AC_SUBST(LIB_INSTALL)
8985 AC_SUBST(LIB_UNINSTALL)
8988 dnl ---------------------------------------------------------------------------
8989 dnl CF_WITH_LIBTOOL_OPTS version: 4 updated: 2015/04/17 21:13:04
8990 dnl --------------------
8991 dnl Allow user to pass additional libtool options into the library creation
8992 dnl and link steps. The main use for this is to do something like
8993 dnl ./configure --with-libtool-opts=-static
8994 dnl to get the same behavior as automake-flavored
8995 dnl ./configure --enable-static
8996 AC_DEFUN([CF_WITH_LIBTOOL_OPTS],[
8997 AC_MSG_CHECKING(for additional libtool options)
8998 AC_ARG_WITH(libtool-opts,
8999 [ --with-libtool-opts=XXX specify additional libtool options],
9000 [with_libtool_opts=$withval],
9001 [with_libtool_opts=no])
9002 AC_MSG_RESULT($with_libtool_opts)
9004 case .$with_libtool_opts in
9008 LIBTOOL_OPTS="$LIBTOOL_OPTS $with_libtool_opts"
9012 AC_SUBST(LIBTOOL_OPTS)
9014 dnl ---------------------------------------------------------------------------
9015 dnl CF_WITH_LIB_BASENAME version: 1 updated: 2020/03/07 20:05:14
9016 dnl --------------------
9017 dnl Allow for overriding the basename of a library, i.e., the part to which
9018 dnl prefixes/suffixes are attached.
9020 dnl $1 = variable to set
9021 dnl $2 = option name
9022 dnl $3 = default basename for library, if omitted use $2
9023 AC_DEFUN([CF_WITH_LIB_BASENAME],
9025 AC_MSG_CHECKING(for desired basename for $2 library)
9026 AC_ARG_WITH($2-libname,
9027 [ --with-$2-libname=XXX override ifelse($3,,$2,$3) basename of library],
9028 [with_lib_basename=$withval],
9029 [with_lib_basename=ifelse($3,,$2,$3)])
9030 $1="$with_lib_basename"
9034 $1=ifelse($3,,$2,$3)
9040 AC_MSG_RESULT([$]$1)
9043 dnl ---------------------------------------------------------------------------
9044 dnl CF_WITH_LIB_PREFIX version: 2 updated: 2021/01/01 16:53:59
9045 dnl ------------------
9046 dnl Allow the library-prefix to be overridden. OS/2 EMX originally had no
9047 dnl "lib" prefix, e.g., because it used the dll naming convention.
9049 dnl $1 = variable to set
9050 AC_DEFUN([CF_WITH_LIB_PREFIX],
9052 AC_MSG_CHECKING(if you want to have a library-prefix)
9053 AC_ARG_WITH(lib-prefix,
9054 [ --with-lib-prefix override library-prefix],
9055 [with_lib_prefix=$withval],
9056 [with_lib_prefix=auto])
9057 AC_MSG_RESULT($with_lib_prefix)
9059 if test "$with_lib_prefix" = auto
9062 elif test "$with_lib_prefix" = no
9066 LIB_PREFIX=$with_lib_prefix
9069 dnl ---------------------------------------------------------------------------
9070 dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19
9072 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
9073 dnl defaulting to yes/no.
9075 dnl $1 = option name
9077 dnl $3 = environment variable to set
9078 dnl $4 = default value, shown in the help-message, must be a constant
9079 dnl $5 = default value, if it's an expression & cannot be in the help-message
9081 AC_DEFUN([CF_WITH_PATH],
9082 [AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),,
9083 ifelse([$4],,[withval="${$3}"],[withval="${$3:-ifelse([$5],,[$4],[$5])}"]))dnl
9084 if ifelse([$5],,true,[test -n "$5"]) ; then
9085 CF_PATH_SYNTAX(withval)
9090 dnl ---------------------------------------------------------------------------
9091 dnl CF_WITH_PATHLIST version: 12 updated: 2021/01/01 13:31:04
9092 dnl ----------------
9093 dnl Process an option specifying a list of colon-separated paths.
9095 dnl $1 = option name
9097 dnl $3 = environment variable to set
9098 dnl $4 = default value, shown in the help-message, must be a constant
9099 dnl $5 = default value, if it's an expression & cannot be in the help-message
9100 dnl $6 = flag to tell if we want to define or substitute
9102 AC_DEFUN([CF_WITH_PATHLIST],[
9103 AC_REQUIRE([CF_PATHSEP])
9104 AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
9105 ifelse($4,,[withval=${$3}],[withval=${$3:-ifelse($5,,$4,$5)}]))dnl
9107 IFS="${IFS:- }"; ac_save_ifs="$IFS"; IFS="${PATH_SEPARATOR}"
9109 for cf_src_path in $withval
9111 CF_PATH_SYNTAX(cf_src_path)
9112 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}$PATH_SEPARATOR"
9113 cf_dst_path="${cf_dst_path}${cf_src_path}"
9118 # Strip single quotes from the value, e.g., when it was supplied as a literal
9120 case "$cf_dst_path" in
9122 cf_dst_path="`echo "$cf_dst_path" |sed -e s/\'// -e s/\'\$//`"
9125 cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
9128 # This may use the prefix/exec_prefix symbols which will only yield "NONE"
9129 # so we have to check/work around. We do prefer the result of "eval"...
9130 eval cf_dst_eval="$cf_dst_path"
9131 case "x$cf_dst_eval" in
9142 dnl ---------------------------------------------------------------------------
9143 dnl CF_WITH_PATH_PROG version: 1 updated: 2019/06/30 19:44:43
9144 dnl -----------------
9145 dnl Check for a given program, like CF_PATH_PROG, but allow override using a
9146 dnl "--with-xxx" option.
9149 dnl $1 = environment variable to set/update
9150 dnl $2 = program name
9153 AC_DEFUN([CF_WITH_PATH_PROG],[
9154 AC_ARG_WITH($2-path,
9155 [ --with-$2-path=XXX specify path of $2 ifelse($3,,,$3)],
9156 [AC_MSG_CHECKING(for $2 program ifelse($3,,,$3))
9158 AC_MSG_RESULT([$]$1)
9161 [CF_PATH_PROG($1,$2,,ifelse($4,,,$4))
9164 AC_MSG_WARN(no $2 program found ifelse($3,,,$3))
9168 dnl ---------------------------------------------------------------------------
9169 dnl CF_WITH_PCRE2 version: 6 updated: 2021/08/11 20:35:34
9171 dnl Add PCRE2 (Perl-compatible regular expressions v2) to the build if it is
9172 dnl available and the user requests it. Assume the application will otherwise
9173 dnl use the POSIX interface.
9175 dnl TODO allow $withval to specify package location
9176 AC_DEFUN([CF_WITH_PCRE2],
9178 AC_REQUIRE([CF_PKG_CONFIG])
9180 AC_MSG_CHECKING(if you want to use PCRE2 for regular-expressions)
9182 [ --with-pcre2 use PCRE2 for regular-expressions])
9183 test -z "$with_pcre2" && with_pcre2=no
9184 AC_MSG_RESULT($with_pcre2)
9186 if test "x$with_pcre2" != xno ; then
9188 for cf_with_pcre2 in libpcre2 libpcre2-posix libpcre
9190 CF_TRY_PKG_CONFIG($cf_with_pcre2,[cf_with_pcre2_ok=yes; break])
9192 cf_with_pcre2_ok=yes || AC_MSG_ERROR(Cannot find PCRE2 library)
9194 AC_DEFINE(HAVE_LIB_PCRE2,1,[Define to 1 if we can/should compile with the PCRE2 library])
9196 # if pkgconfig gave no results, look for the libraries directly
9198 (*pcre2-posix*|*pcreposix*)
9201 AC_CHECK_LIB(pcre2-posix,regcomp,[
9202 CF_ADD_LIB(pcre2-posix)],
9203 [AC_CHECK_LIB(pcreposix,regcomp,[
9204 CF_ADD_LIB(pcreposix)
9205 ],[AC_MSG_ERROR(Cannot find PCRE2 POSIX library)])])
9209 # either way, check for the library header files
9210 AC_CHECK_HEADERS(pcre2posix.h pcreposix.h)
9211 AC_CHECK_FUNCS(PCRE2regcomp)
9214 dnl ---------------------------------------------------------------------------
9215 dnl CF_WITH_PKG_CONFIG_LIBDIR version: 11 updated: 2021/01/01 16:16:30
9216 dnl -------------------------
9217 dnl Allow the choice of the pkg-config library directory to be overridden.
9218 AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[
9220 case "$PKG_CONFIG" in
9222 AC_MSG_CHECKING(for pkg-config library directory)
9225 AC_MSG_CHECKING(for $PKG_CONFIG library directory)
9229 PKG_CONFIG_LIBDIR=no
9230 AC_ARG_WITH(pkg-config-libdir,
9231 [ --with-pkg-config-libdir=XXX use given directory for installing pc-files],
9232 [PKG_CONFIG_LIBDIR=$withval],
9233 [test "x$PKG_CONFIG" != xnone && PKG_CONFIG_LIBDIR=yes])
9235 case x$PKG_CONFIG_LIBDIR in
9239 # Look for the library directory using the same prefix as the executable
9240 if test "x$PKG_CONFIG" = xnone
9244 cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`
9247 # If you don't like using the default architecture, you have to specify the
9248 # intended library directory and corresponding compiler/linker options.
9250 # This case allows for Debian's 2014-flavor of multiarch, along with the
9251 # most common variations before that point. Some other variants spell the
9252 # directory differently, e.g., "pkg-config", and put it in unusual places.
9253 # pkg-config has always been poorly standardized, which is ironic...
9254 case x`(arch) 2>/dev/null` in
9257 $cf_path/lib/*64-linux-gnu \
9265 $cf_path/lib/*-linux-gnu \
9274 for cf_config in $cf_search_path
9276 CF_VERBOSE(checking $cf_config/pkgconfig)
9277 if test -d "$cf_config/pkgconfig"
9279 PKG_CONFIG_LIBDIR=$cf_config/pkgconfig
9280 AC_MSG_CHECKING(done)
9289 if test "x$PKG_CONFIG_LIBDIR" != xno ; then
9290 AC_MSG_RESULT($PKG_CONFIG_LIBDIR)
9293 AC_SUBST(PKG_CONFIG_LIBDIR)
9295 dnl ---------------------------------------------------------------------------
9296 dnl CF_WITH_PTHREAD version: 7 updated: 2015/04/18 08:56:57
9298 dnl Check for POSIX thread library.
9299 AC_DEFUN([CF_WITH_PTHREAD],
9301 AC_MSG_CHECKING(if you want to link with the pthread library)
9302 AC_ARG_WITH(pthread,
9303 [ --with-pthread use POSIX thread library],
9304 [with_pthread=$withval],
9306 AC_MSG_RESULT($with_pthread)
9308 if test "$with_pthread" != no ; then
9309 AC_CHECK_HEADER(pthread.h,[
9310 AC_DEFINE(HAVE_PTHREADS_H,1,[Define to 1 if we have pthreads.h header])
9312 for cf_lib_pthread in pthread c_r
9314 AC_MSG_CHECKING(if we can link with the $cf_lib_pthread library)
9315 cf_save_LIBS="$LIBS"
9316 CF_ADD_LIB($cf_lib_pthread)
9318 #include <pthread.h>
9320 int rc = pthread_create(0,0,0,0);
9321 int r2 = pthread_mutexattr_settype(0, 0);
9322 ],[with_pthread=yes],[with_pthread=no])
9323 LIBS="$cf_save_LIBS"
9324 AC_MSG_RESULT($with_pthread)
9325 test "$with_pthread" = yes && break
9328 if test "$with_pthread" = yes ; then
9329 CF_ADD_LIB($cf_lib_pthread)
9330 AC_DEFINE(HAVE_LIBPTHREADS,1,[Define to 1 if we have pthreads library])
9332 AC_MSG_ERROR(Cannot link with pthread library)
9337 dnl ---------------------------------------------------------------------------
9338 dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
9339 dnl -------------------
9340 dnl Allow library's release-version to be overridden. Generally this happens when a
9341 dnl packager has incremented the release-version past that used in the original package,
9342 dnl and wishes to keep doing this.
9344 dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR
9345 dnl and {package}_MINOR symbols
9347 AC_DEFUN([CF_WITH_REL_VERSION],[
9348 test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
9349 AC_ARG_WITH(rel-version,
9350 [ --with-rel-version=XXX override derived release version],
9351 [AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval)
9352 cf_cv_rel_version=$withval])
9354 CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
9356 $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'`
9357 $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'`
9358 CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version)
9359 CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version)
9362 dnl ---------------------------------------------------------------------------
9363 dnl CF_WITH_SYSMOUSE version: 3 updated: 2012/10/06 17:56:13
9364 dnl ----------------
9365 dnl If we can compile with sysmouse, make it available unless it is not wanted.
9366 AC_DEFUN([CF_WITH_SYSMOUSE],[
9367 # not everyone has "test -c"
9368 if test -c /dev/sysmouse 2>/dev/null ; then
9369 AC_MSG_CHECKING(if you want to use sysmouse)
9370 AC_ARG_WITH(sysmouse,
9371 [ --with-sysmouse use sysmouse (FreeBSD console)],
9372 [cf_with_sysmouse=$withval],
9373 [cf_with_sysmouse=maybe])
9374 if test "$cf_with_sysmouse" != no ; then
9376 #include <osreldate.h>
9377 #if (__FreeBSD_version >= 400017)
9378 #include <sys/consio.h>
9379 #include <sys/fbio.h>
9381 #include <machine/console.h>
9384 struct mouse_info the_mouse;
9385 ioctl(0, CONS_MOUSECTL, &the_mouse);
9386 ],[cf_with_sysmouse=yes],[cf_with_sysmouse=no])
9388 AC_MSG_RESULT($cf_with_sysmouse)
9389 test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE,1,[Define to 1 if we can/should use the sysmouse interface])
9392 dnl ---------------------------------------------------------------------------
9393 dnl CF_WITH_SYSTYPE version: 1 updated: 2013/01/26 16:26:12
9395 dnl For testing, override the derived host system-type which is used to decide
9396 dnl things such as the linker commands used to build shared libraries. This is
9397 dnl normally chosen automatically based on the type of system which you are
9398 dnl building on. We use it for testing the configure script.
9400 dnl This is different from the --host option: it is used only for testing parts
9401 dnl of the configure script which would not be reachable with --host since that
9402 dnl relies on the build environment being real, rather than mocked up.
9403 AC_DEFUN([CF_WITH_SYSTYPE],[
9404 CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
9405 AC_ARG_WITH(system-type,
9406 [ --with-system-type=XXX test: override derived host system-type],
9407 [AC_MSG_WARN(overriding system type to $withval)
9408 cf_cv_system_name=$withval
9412 dnl ---------------------------------------------------------------------------
9413 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
9414 dnl ----------------
9415 AC_DEFUN([CF_WITH_VALGRIND],[
9416 CF_NO_LEAKS_OPTION(valgrind,
9417 [ --with-valgrind test: use valgrind],
9420 dnl ---------------------------------------------------------------------------
9421 dnl CF_WITH_VERSIONED_SYMS version: 10 updated: 2021/01/04 18:48:01
9422 dnl ----------------------
9423 dnl Use this when building shared library with ELF, to markup symbols with the
9424 dnl version identifier from the given input file. Generally that identifier is
9425 dnl the same as the SONAME at which the symbol was first introduced.
9427 dnl $1 = basename of the ".map" file (default $PACKAGE)
9428 AC_DEFUN([CF_WITH_VERSIONED_SYMS],
9429 [AC_REQUIRE([AC_PROG_FGREP])dnl
9430 AC_REQUIRE([AC_PROG_EGREP])dnl
9432 AC_MSG_CHECKING(if versioned-symbols file should be used)
9433 AC_ARG_WITH(versioned-syms,
9434 [ --with-versioned-syms=X markup versioned symbols using ld],
9435 [with_versioned_syms=$withval],
9436 [with_versioned_syms=no])
9437 case "x$with_versioned_syms" in
9439 with_versioned_syms='${top_srcdir}/package/ifelse($1,,${PACKAGE},[$1]).map'
9445 test -f "$with_versioned_syms" || AC_MSG_ERROR(expected a filename: $with_versioned_syms)
9448 test -f "$with_versioned_syms" || AC_MSG_ERROR(expected a filename: $with_versioned_syms)
9449 with_versioned_syms=`pwd`/"$with_versioned_syms"
9452 AC_MSG_RESULT($with_versioned_syms)
9458 if test "x$with_versioned_syms" != xno
9460 RESULTING_SYMS=$with_versioned_syms
9461 case "x$MK_SHARED_LIB" in
9463 VERSIONED_SYMS="-Wl,--version-script,\${RESULTING_SYMS}"
9464 MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-Wl,%\\[$]{VERSIONED_SYMS} -Wl,%"`
9465 CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB)
9468 VERSIONED_SYMS="-Wl,-M,\${RESULTING_SYMS}"
9469 MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-dy%\\[$]{VERSIONED_SYMS} -dy%"`
9470 CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB)
9473 AC_MSG_WARN(this system does not support versioned-symbols)
9477 # Linux ld can selectively override scope, e.g., of symbols beginning with
9478 # "_" by first declaring some as global, and then using a wildcard to
9479 # declare the others as local. Some other loaders cannot do this. Check
9480 # by constructing a (very) simple shared library and inspecting its
9482 if test "x$VERSIONED_SYMS" != "x"
9484 AC_MSG_CHECKING(if wildcards can be used to selectively omit symbols)
9490 cat >conftest.ver <<EOF
9519 cat >conftest.$ac_ext <<EOF
9520 #line __oline__ "configure"
9521 int _ismissing(void) { return 1; }
9522 int _localf1(void) { return 1; }
9523 int _localf2(void) { return 2; }
9524 int globalf1(void) { return 1; }
9525 int globalf2(void) { return 2; }
9526 int _sublocalf1(void) { return 1; }
9527 int _sublocalf2(void) { return 2; }
9528 int subglobalf1(void) { return 1; }
9529 int subglobalf2(void) { return 2; }
9531 cat >conftest.mk <<EOF
9534 CPPFLAGS=${CPPFLAGS}
9537 VERSIONED_SYMS=${VERSIONED_SYMS}
9538 RESULTING_SYMS=conftest.ver
9539 MK_SHARED_LIB=${MK_SHARED_LIB}
9540 conftest.so: conftest.$ac_cv_objext
9541 \$(MK_SHARED_LIB) conftest.$ac_cv_objext
9544 # compile source, make library
9545 if make -f conftest.mk 2>&AC_FD_CC >/dev/null
9547 # test for missing symbol in either Data or Text section
9548 cf_missing="`nm -P conftest.so 2>&AC_FD_CC |${FGREP-fgrep} _ismissing | ${EGREP-egrep} '[[ ]][[DT]][[ ]]'`"
9549 test -n "$cf_missing" && WILDCARD_SYMS=yes
9551 AC_MSG_RESULT($WILDCARD_SYMS)
9555 AC_SUBST(RESULTING_SYMS)
9556 AC_SUBST(VERSIONED_SYMS)
9557 AC_SUBST(WILDCARD_SYMS)
9559 dnl ---------------------------------------------------------------------------
9560 dnl CF_WITH_X11_RGB version: 2 updated: 2019/12/31 08:53:54
9562 dnl Handle configure option "--with-x11-rgb", setting these shell
9565 dnl $RGB_PATH is the option value, used for finding the X11 rgb file.
9566 dnl $no_x11_rgb is a "#" (comment) if "--without-x11-rgb" is given.
9568 dnl Most Linux's use this:
9569 dnl /usr/share/X11/rgb.txt
9570 dnl Debian uses this:
9571 dnl /etc/X11/rgb.txt
9572 dnl DragonFlyBSD ports uses this:
9573 dnl /usr/pkg/lib/X11/rgb.txt
9574 dnl FreeBSD ports use these:
9575 dnl /usr/local/lib/X11/rgb.txt
9576 dnl /usr/local/share/X11/rgb.txt
9577 dnl Mandriva has these:
9578 dnl /usr/lib/X11/rgb.txt
9579 dnl /usr/lib64/X11/rgb.txt
9580 dnl NetBSD has these
9581 dnl /usr/X11R7/lib/X11/rgb.txt
9582 dnl OpenSolaris uses
9584 dnl /usr/X11/etc/X11/rgb.txt
9585 dnl /usr/X11/share/X11/rgb.txt
9586 dnl /usr/X11/lib/X11/rgb.txt
9588 dnl /opt/local/share/X11/rgb.txt (MacPorts)
9589 dnl /opt/X11/share/X11/rgb.txt (non-ports)
9591 dnl /usr/X11/etc/X11/rgb.txt
9592 dnl /usr/X11/share/X11/rgb.txt (perhaps)
9593 dnl /usr/X11/lib/amd64/X11/rgb.txt
9594 dnl Solaris10 uses (in this order):
9595 dnl /usr/openwin/lib/X11/rgb.txt
9596 dnl /usr/X11/lib/X11/rgb.txt
9597 AC_DEFUN([CF_WITH_X11_RGB],[
9598 AC_MSG_CHECKING(for X11 rgb file)
9599 AC_ARG_WITH(x11-rgb,
9600 [ --with-x11-rgb=FILE file containing X11 rgb information (EPREFIX/lib/X11/rgb.txt)],
9601 [RGB_PATH=$withval],
9604 if test "x[$]RGB_PATH" = xauto
9606 RGB_PATH='${exec_prefix}/lib/X11/rgb.txt'
9608 /opt/local/share/X11/rgb.txt \
9609 /opt/X11/share/X11/rgb.txt \
9610 /usr/share/X11/rgb.txt \
9611 /usr/X11/share/X11/rgb.txt \
9612 /usr/X11/lib/X11/rgb.txt \
9613 /usr/lib/X11/rgb.txt \
9615 /usr/pkg/lib/X11/rgb.txt \
9616 /usr/X11R7/lib/X11/rgb.txt \
9617 /usr/X11R6/lib/X11/rgb.txt \
9618 /usr/X11R5/lib/X11/rgb.txt \
9619 /usr/X11R4/lib/X11/rgb.txt \
9620 /usr/local/lib/X11/rgb.txt \
9621 /usr/local/share/X11/rgb.txt \
9622 /usr/lib64/X11/rgb.txt
9624 if test -f "$cf_path" ; then
9631 CF_PATH_SYNTAX(cf_path)
9634 AC_MSG_RESULT($RGB_PATH)
9636 AC_DEFINE_UNQUOTED(RGB_PATH,"$cf_path",[Define to the full pathname of rgb.txt])
9639 if test "$RGB_PATH" = no
9643 AC_SUBST(no_x11_rgb)
9645 dnl ---------------------------------------------------------------------------
9646 dnl CF_XOPEN_SOURCE version: 59 updated: 2021/08/28 15:20:37
9648 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
9649 dnl or adapt to the vendor's definitions to get equivalent functionality,
9650 dnl without losing the common non-POSIX features.
9653 dnl $1 is the nominal value for _XOPEN_SOURCE
9654 dnl $2 is the nominal value for _POSIX_C_SOURCE
9655 AC_DEFUN([CF_XOPEN_SOURCE],[
9656 AC_REQUIRE([AC_CANONICAL_HOST])
9657 AC_REQUIRE([CF_POSIX_VISIBLE])
9659 if test "$cf_cv_posix_visible" = no; then
9661 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
9662 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
9667 cf_xopen_source="-D_ALL_SOURCE"
9673 cf_xopen_source="-D_APPLE_C_SOURCE"
9676 cf_xopen_source="-D_DARWIN_C_SOURCE"
9679 (freebsd*|dragonfly*|midnightbsd*)
9680 # 5.x headers associate
9681 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
9682 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
9683 cf_POSIX_C_SOURCE=200112L
9685 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
9688 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
9691 cf_xopen_source="-D_HPUX_SOURCE"
9694 cf_xopen_source="-D_SGI_SOURCE"
9697 (linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
9698 CF_GNU_SOURCE($cf_XOPEN_SOURCE)
9701 cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this...
9704 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
9706 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
9709 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
9712 # OpenBSD 6.x has broken locale support, both compile-time and runtime.
9713 # see https://www.mail-archive.com/bugs@openbsd.org/msg13200.html
9714 # Abusing the conformance level is a workaround.
9715 AC_MSG_WARN(this system does not provide usable locale support)
9716 cf_xopen_source="-D_BSD_SOURCE"
9720 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
9721 cf_xopen_source="-D_BSD_SOURCE"
9725 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
9728 cf_xopen_source="-D_OSF_SOURCE"
9731 cf_xopen_source="-D_QNX_SOURCE"
9734 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
9737 cf_xopen_source="-D__EXTENSIONS__"
9738 cf_cv_xopen_source=broken
9740 (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2)
9746 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
9750 if test -n "$cf_xopen_source" ; then
9751 CF_APPEND_CFLAGS($cf_xopen_source,true)
9754 dnl In anything but the default case, we may have system-specific setting
9755 dnl which is still not guaranteed to provide all of the entrypoints that
9756 dnl _XOPEN_SOURCE would yield.
9757 if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
9758 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
9759 AC_TRY_COMPILE([#include <stdlib.h>],[
9760 #ifndef _XOPEN_SOURCE
9763 [cf_XOPEN_SOURCE_set=yes],
9764 [cf_XOPEN_SOURCE_set=no])
9765 AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
9766 if test "$cf_XOPEN_SOURCE_set" = yes
9768 AC_TRY_COMPILE([#include <stdlib.h>],[
9769 #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
9772 [cf_XOPEN_SOURCE_set_ok=yes],
9773 [cf_XOPEN_SOURCE_set_ok=no])
9774 if test "$cf_XOPEN_SOURCE_set_ok" = no
9776 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
9782 fi # cf_cv_posix_visible
9784 dnl ---------------------------------------------------------------------------
9785 dnl CF__SED_TRIMBLANKS version: 1 updated: 2021/01/02 09:31:20
9786 dnl ------------------
9787 dnl Trim something using sed, then trim extra whitespace
9788 dnl $1 = extra parameters, e.g., in CF_STRIP_G_OPT
9789 define([CF__SED_TRIMBLANKS],[sed ifelse($1,,,[$1] )-e 's%[[ ]]% %g' -e 's% [[ ]]*% %g' -e 's%^ %%' -e 's% [$]%%'])dnl