1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. *
4 dnl Permission is hereby granted, free of charge, to any person obtaining a *
5 dnl copy of this software and associated documentation files (the *
6 dnl "Software"), to deal in the Software without restriction, including *
7 dnl without limitation the rights to use, copy, modify, merge, publish, *
8 dnl distribute, distribute with modifications, sublicense, and/or sell *
9 dnl copies of the Software, and to permit persons to whom the Software is *
10 dnl furnished to do so, subject to the following conditions: *
12 dnl The above copyright notice and this permission notice shall be included *
13 dnl in all copies or substantial portions of the Software. *
15 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 dnl Except as contained in this notice, the name(s) of the above copyright *
24 dnl holders shall not be used in advertising or otherwise to promote the *
25 dnl sale, use or other dealings in this Software without prior written *
27 dnl***************************************************************************
29 dnl Author: Thomas E. Dickey 1995-on
31 dnl $Id: aclocal.m4,v 1.880 2019/09/07 23:00:39 tom Exp $
32 dnl Macros used in NCURSES auto-configuration script.
34 dnl These macros are maintained separately from NCURSES. The copyright on
35 dnl this file applies to the aggregation of macros and does not affect use of
36 dnl these macros in other applications.
38 dnl See https://invisible-island.net/autoconf/ for additional information.
40 dnl ---------------------------------------------------------------------------
41 dnl ---------------------------------------------------------------------------
42 dnl AM_LANGINFO_CODESET version: 4 updated: 2015/04/18 08:56:57
43 dnl -------------------
44 dnl Inserted as requested by gettext 0.10.40
45 dnl File from /usr/share/aclocal
47 dnl ====================
50 dnl From Bruno Haible.
51 AC_DEFUN([AM_LANGINFO_CODESET],
53 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
54 [AC_TRY_LINK([#include <langinfo.h>],
55 [char* cs = nl_langinfo(CODESET);],
56 am_cv_langinfo_codeset=yes,
57 am_cv_langinfo_codeset=no)
59 if test $am_cv_langinfo_codeset = yes; then
60 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
61 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
64 dnl ---------------------------------------------------------------------------
65 dnl CF_ABI_DEFAULTS version: 2 updated: 2015/06/06 13:49:58
67 dnl Provide configure-script defaults for different ncurses ABIs.
68 AC_DEFUN([CF_ABI_DEFAULTS],[
69 AC_REQUIRE([CF_NCURSES_WITH_ABI_VERSION])
70 case x$cf_cv_abi_version in
76 cf_dft_ext_spfuncs=yes
77 cf_dft_filter_syms=yes
78 cf_dft_chtype=uint32_t
79 cf_dft_mmask_t=uint32_t
81 cf_dft_tparm_arg=intptr_t
99 dnl ---------------------------------------------------------------------------
100 dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
101 dnl ------------------
102 dnl Conditionally generate script according to whether we're using a given autoconf.
104 dnl $1 = version to compare against
105 dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
106 dnl $3 = code to use if AC_ACVERSION is older than $1.
107 define([CF_ACVERSION_CHECK],
109 ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
110 ifdef([m4_version_compare],
111 [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
112 [CF_ACVERSION_COMPARE(
113 AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
114 AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
115 dnl ---------------------------------------------------------------------------
116 dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
117 dnl --------------------
118 dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
119 dnl MAJOR2, MINOR2, TERNARY2,
120 dnl PRINTABLE2, not FOUND, FOUND)
121 define([CF_ACVERSION_COMPARE],
122 [ifelse(builtin([eval], [$2 < $5]), 1,
123 [ifelse([$8], , ,[$8])],
124 [ifelse([$9], , ,[$9])])])dnl
125 dnl ---------------------------------------------------------------------------
126 dnl CF_ADA_INCLUDE_DIRS version: 8 updated: 2013/10/14 04:24:07
127 dnl -------------------
128 dnl Construct the list of include-options for the C programs in the Ada95
130 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
132 ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS"
133 if test "$srcdir" != "."; then
134 ACPPFLAGS="-I\${srcdir}/../../include $ACPPFLAGS"
136 if test "$GCC" != yes; then
137 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
138 elif test "$includedir" != "/usr/include"; then
139 if test "$includedir" = '${prefix}/include' ; then
140 if test x$prefix != x/usr ; then
141 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
144 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
149 dnl ---------------------------------------------------------------------------
150 dnl CF_ADD_ADAFLAGS version: 1 updated: 2010/06/19 15:22:18
152 dnl Add to $ADAFLAGS, which is substituted into makefile and scripts.
153 AC_DEFUN([CF_ADD_ADAFLAGS],[
154 ADAFLAGS="$ADAFLAGS $1"
157 dnl ---------------------------------------------------------------------------
158 dnl CF_ADD_CFLAGS version: 13 updated: 2017/02/25 18:57:40
160 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
161 dnl The second parameter if given makes this macro verbose.
163 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
164 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
165 dnl confused by the quotes (which require backslashes to keep them usable).
166 AC_DEFUN([CF_ADD_CFLAGS],
171 cf_new_extra_cppflags=
173 for cf_add_cflags in $1
175 case $cf_fix_cppflags in
177 case $cf_add_cflags in
178 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C)
179 case $cf_add_cflags in
181 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
183 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
184 && test -z "${cf_tst_cflags}" \
185 && cf_fix_cppflags=yes
187 if test $cf_fix_cppflags = yes ; then
188 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
190 elif test "${cf_tst_cflags}" = "\"'" ; then
191 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
200 case $cf_add_cflags in
202 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
203 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
206 CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags)
211 CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags)
216 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
218 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
220 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
221 && test -z "${cf_tst_cflags}" \
222 && cf_fix_cppflags=no
227 if test -n "$cf_new_cflags" ; then
228 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
229 CF_APPEND_TEXT(CFLAGS,$cf_new_cflags)
232 if test -n "$cf_new_cppflags" ; then
233 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
234 CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags)
237 if test -n "$cf_new_extra_cppflags" ; then
238 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
239 CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags)
242 AC_SUBST(EXTRA_CPPFLAGS)
245 dnl ---------------------------------------------------------------------------
246 dnl CF_ADD_INCDIR version: 15 updated: 2018/06/20 20:23:13
248 dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
249 dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
250 dnl but old versions (and some misinstalled ones) need that. To make things
251 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
252 dnl the include-path).
253 AC_DEFUN([CF_ADD_INCDIR],
255 if test -n "$1" ; then
256 for cf_add_incdir in $1
258 while test $cf_add_incdir != /usr/include
260 if test -d $cf_add_incdir
263 if test -n "$CFLAGS$CPPFLAGS" ; then
264 # a loop is needed to ensure we can add subdirs of existing dirs
265 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
266 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
267 cf_have_incdir=yes; break
272 if test "$cf_have_incdir" = no ; then
273 if test "$cf_add_incdir" = /usr/local/include ; then
276 cf_save_CPPFLAGS=$CPPFLAGS
277 CF_APPEND_TEXT(CPPFLAGS,-I$cf_add_incdir)
278 AC_TRY_COMPILE([#include <stdio.h>],
281 [cf_have_incdir=yes])
282 CPPFLAGS=$cf_save_CPPFLAGS
287 if test "$cf_have_incdir" = no ; then
288 CF_VERBOSE(adding $cf_add_incdir to include-path)
289 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
291 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
292 test "$cf_top_incdir" = "$cf_add_incdir" && break
293 cf_add_incdir="$cf_top_incdir"
304 dnl ---------------------------------------------------------------------------
305 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
307 dnl Add a library, used to enforce consistency.
309 dnl $1 = library to add, without the "-l"
310 dnl $2 = variable to update (default $LIBS)
311 AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
312 dnl ---------------------------------------------------------------------------
313 dnl CF_ADD_LIBDIR version: 10 updated: 2015/04/18 08:56:57
315 dnl Adds to the library-path
317 dnl Some machines have trouble with multiple -L options.
319 dnl $1 is the (list of) directory(s) to add
320 dnl $2 is the optional name of the variable to update (default LDFLAGS)
322 AC_DEFUN([CF_ADD_LIBDIR],
324 if test -n "$1" ; then
325 for cf_add_libdir in $1
327 if test $cf_add_libdir = /usr/lib ; then
329 elif test -d $cf_add_libdir
332 if test -n "$LDFLAGS$LIBS" ; then
333 # a loop is needed to ensure we can add subdirs of existing dirs
334 for cf_test_libdir in $LDFLAGS $LIBS ; do
335 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
336 cf_have_libdir=yes; break
340 if test "$cf_have_libdir" = no ; then
341 CF_VERBOSE(adding $cf_add_libdir to library-path)
342 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
348 dnl ---------------------------------------------------------------------------
349 dnl CF_ADD_LIBS version: 2 updated: 2014/07/13 14:33:27
351 dnl Add one or more libraries, used to enforce consistency. Libraries are
352 dnl prepended to an existing list, since their dependencies are assumed to
353 dnl already exist in the list.
355 dnl $1 = libraries to add, with the "-l", etc.
356 dnl $2 = variable to update (default $LIBS)
357 AC_DEFUN([CF_ADD_LIBS],[
359 # Filter out duplicates - this happens with badly-designed ".pc" files...
360 for cf_add_1lib in [$]ifelse($2,,LIBS,[$2])
362 for cf_add_2lib in $cf_add_libs
364 if test "x$cf_add_1lib" = "x$cf_add_2lib"
370 test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib"
372 ifelse($2,,LIBS,[$2])="$cf_add_libs"
374 dnl ---------------------------------------------------------------------------
375 dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05
376 dnl ------------------
377 dnl Append to a search-list for a nonstandard header/lib-file
378 dnl $1 = the variable to return as result
379 dnl $2 = the package name
380 dnl $3 = the subdirectory, e.g., bin, include or lib
381 dnl $4 = the directory under which we will test for subdirectories
382 dnl $5 = a directory that we do not want $4 to match
383 AC_DEFUN([CF_ADD_SUBDIR_PATH],
385 test "x$4" != "x$5" && \
387 ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) {
388 test -n "$verbose" && echo " ... testing for $3-directories under $4"
389 test -d $4/$3 && $1="[$]$1 $4/$3"
390 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
391 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
392 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
393 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
396 dnl ---------------------------------------------------------------------------
397 dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55
399 dnl use this macro for appending text without introducing an extra blank at
401 define([CF_APPEND_TEXT],
403 test -n "[$]$1" && $1="[$]$1 "
406 dnl ---------------------------------------------------------------------------
407 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
409 dnl Allow user to disable a normally-on option.
410 AC_DEFUN([CF_ARG_DISABLE],
411 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
412 dnl ---------------------------------------------------------------------------
413 dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
415 dnl Allow user to enable a normally-off option.
416 AC_DEFUN([CF_ARG_ENABLE],
417 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
418 dnl ---------------------------------------------------------------------------
419 dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14
421 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
427 dnl $3 = action to perform if option is not default
428 dnl $4 = action if perform if option is default
429 dnl $5 = default option value (either 'yes' or 'no')
430 AC_DEFUN([CF_ARG_OPTION],
431 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
432 if test "$enableval" != "$5" ; then
434 ,[ $3]) ifelse([$4],,,[
437 fi],[enableval=$5 ifelse([$4],,,[
441 dnl ---------------------------------------------------------------------------
442 dnl CF_AR_FLAGS version: 6 updated: 2015/10/10 15:25:05
444 dnl Check for suitable "ar" (archiver) options for updating an archive.
446 dnl In particular, handle some obsolete cases where the "-" might be omitted,
447 dnl as well as a workaround for breakage of make's archive rules by the GNU
448 dnl binutils "ar" program.
449 AC_DEFUN([CF_AR_FLAGS],[
450 AC_REQUIRE([CF_PROG_AR])
452 AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[
453 cf_cv_ar_flags=unknown
454 for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv
457 # check if $ARFLAGS already contains this choice
458 if test "x$ARFLAGS" != "x" ; then
459 cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"`
460 if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then
466 rm -f conftest.$ac_cv_objext
469 cat >conftest.$ac_ext <<EOF
470 #line __oline__ "configure"
471 int testdata[[3]] = { 123, 456, 789 };
473 if AC_TRY_EVAL(ac_compile) ; then
474 echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC
475 $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null
476 if test -f conftest.a ; then
477 cf_cv_ar_flags=$cf_ar_flags
481 CF_VERBOSE(cannot compile test-program)
485 rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext
488 if test -n "$ARFLAGS" ; then
489 if test -n "$cf_cv_ar_flags" ; then
490 ARFLAGS="$ARFLAGS $cf_cv_ar_flags"
493 ARFLAGS=$cf_cv_ar_flags
498 dnl ---------------------------------------------------------------------------
499 dnl CF_AWK_BIG_PRINTF version: 5 updated: 2015/04/17 21:13:04
500 dnl -----------------
501 dnl Check if awk can handle big strings using printf. Some older versions of
502 dnl awk choke on large strings passed via "%s".
504 dnl $1 = desired string size
505 dnl $2 = variable to set with result
506 AC_DEFUN([CF_AWK_BIG_PRINTF],
513 if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' 2>/dev/null \
514 | $AWK '{ printf "%d\n", length([$]0); }' 2>/dev/null | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
522 dnl ---------------------------------------------------------------------------
523 dnl CF_BOOL_DECL version: 8 updated: 2004/01/30 15:51:18
525 dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
526 dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
527 dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
529 dnl Treat the configuration-variable specially here, since we're directly
530 dnl substituting its value (i.e., 1/0).
532 dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool
533 AC_DEFUN([CF_BOOL_DECL],
535 AC_MSG_CHECKING(if we should include stdbool.h)
537 AC_CACHE_VAL(cf_cv_header_stdbool_h,[
538 AC_TRY_COMPILE([],[bool foo = false],
539 [cf_cv_header_stdbool_h=0],
544 ],[bool foo = false],
545 [cf_cv_header_stdbool_h=1],
546 [cf_cv_header_stdbool_h=0])])])
548 if test "$cf_cv_header_stdbool_h" = 1
549 then AC_MSG_RESULT(yes)
550 else AC_MSG_RESULT(no)
553 AC_MSG_CHECKING([for builtin bool type])
555 AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
558 #include <sys/types.h>
560 [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
561 [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
564 if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
565 then AC_MSG_RESULT(yes)
566 else AC_MSG_RESULT(no)
569 dnl ---------------------------------------------------------------------------
570 dnl CF_BOOL_SIZE version: 15 updated: 2017/01/21 11:06:25
572 dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
573 dnl Don't bother looking for bool.h, since it's been deprecated.
575 dnl If the current compiler is C rather than C++, we get the bool definition
576 dnl from <stdbool.h>.
577 AC_DEFUN([CF_BOOL_SIZE],
579 AC_MSG_CHECKING([for size of bool])
580 AC_CACHE_VAL(cf_cv_type_of_bool,[
586 #if defined(__cplusplus)
588 #ifdef HAVE_GXX_BUILTIN_H
589 #include <g++/builtin.h>
590 #elif HAVE_GPP_BUILTIN_H
591 #include <gpp/builtin.h>
598 #if $cf_cv_header_stdbool_h
606 FILE *fp = fopen("cf_test.out", "w");
610 fputs("unsigned ", fp);
611 if (sizeof(x) == sizeof(int)) fputs("int", fp);
612 else if (sizeof(x) == sizeof(char)) fputs("char", fp);
613 else if (sizeof(x) == sizeof(short))fputs("short",fp);
614 else if (sizeof(x) == sizeof(long)) fputs("long", fp);
617 ${cf_cv_main_return:-return}(0);
620 [cf_cv_type_of_bool=`cat cf_test.out`
621 if test -z "$cf_cv_type_of_bool"; then
622 cf_cv_type_of_bool=unknown
624 [cf_cv_type_of_bool=unknown],
625 [cf_cv_type_of_bool=unknown])
628 AC_MSG_RESULT($cf_cv_type_of_bool)
629 if test "$cf_cv_type_of_bool" = unknown ; then
630 case .$NCURSES_BOOL in
631 (.auto|.) NCURSES_BOOL=unsigned;;
633 AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool)
634 cf_cv_type_of_bool=$NCURSES_BOOL
637 dnl ---------------------------------------------------------------------------
638 dnl CF_BUILD_CC version: 8 updated: 2018/01/04 20:31:04
640 dnl If we're cross-compiling, allow the user to override the tools and their
641 dnl options. The configure script is oriented toward identifying the host
642 dnl compiler, etc., but we need a build compiler to generate parts of the
645 dnl $1 = default for $CPPFLAGS
646 dnl $2 = default for $LIBS
647 AC_DEFUN([CF_BUILD_CC],[
648 CF_ACVERSION_CHECK(2.52,,
649 [AC_REQUIRE([CF_PROG_EXT])])
650 if test "$cross_compiling" = yes ; then
652 # defaults that we might want to override
653 : ${BUILD_CFLAGS:=''}
654 : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
655 : ${BUILD_LDFLAGS:=''}
656 : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
657 : ${BUILD_EXEEXT:='$x'}
658 : ${BUILD_OBJEXT:='o'}
660 AC_ARG_WITH(build-cc,
661 [ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
662 [BUILD_CC="$withval"],
663 [AC_CHECK_PROGS(BUILD_CC, [gcc clang c99 c89 cc cl],none)])
664 AC_MSG_CHECKING(for native build C compiler)
665 AC_MSG_RESULT($BUILD_CC)
667 AC_MSG_CHECKING(for native build C preprocessor)
668 AC_ARG_WITH(build-cpp,
669 [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
670 [BUILD_CPP="$withval"],
671 [BUILD_CPP='${BUILD_CC} -E'])
672 AC_MSG_RESULT($BUILD_CPP)
674 AC_MSG_CHECKING(for native build C flags)
675 AC_ARG_WITH(build-cflags,
676 [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
677 [BUILD_CFLAGS="$withval"])
678 AC_MSG_RESULT($BUILD_CFLAGS)
680 AC_MSG_CHECKING(for native build C preprocessor-flags)
681 AC_ARG_WITH(build-cppflags,
682 [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
683 [BUILD_CPPFLAGS="$withval"])
684 AC_MSG_RESULT($BUILD_CPPFLAGS)
686 AC_MSG_CHECKING(for native build linker-flags)
687 AC_ARG_WITH(build-ldflags,
688 [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
689 [BUILD_LDFLAGS="$withval"])
690 AC_MSG_RESULT($BUILD_LDFLAGS)
692 AC_MSG_CHECKING(for native build linker-libraries)
693 AC_ARG_WITH(build-libs,
694 [ --with-build-libs=XXX the build libraries (${BUILD_LIBS})],
695 [BUILD_LIBS="$withval"])
696 AC_MSG_RESULT($BUILD_LIBS)
698 # this assumes we're on Unix.
702 : ${BUILD_CC:='${CC}'}
704 if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
705 AC_MSG_ERROR([Cross-build requires two compilers.
706 Use --with-build-cc to specify the native compiler.])
710 : ${BUILD_CC:='${CC}'}
711 : ${BUILD_CPP:='${CPP}'}
712 : ${BUILD_CFLAGS:='${CFLAGS}'}
713 : ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
714 : ${BUILD_LDFLAGS:='${LDFLAGS}'}
715 : ${BUILD_LIBS:='${LIBS}'}
716 : ${BUILD_EXEEXT:='$x'}
717 : ${BUILD_OBJEXT:='o'}
722 AC_SUBST(BUILD_CFLAGS)
723 AC_SUBST(BUILD_CPPFLAGS)
724 AC_SUBST(BUILD_LDFLAGS)
726 AC_SUBST(BUILD_EXEEXT)
727 AC_SUBST(BUILD_OBJEXT)
729 dnl ---------------------------------------------------------------------------
730 dnl CF_CC_ENV_FLAGS version: 9 updated: 2018/07/29 18:03:26
732 dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
733 dnl into CC. This will not help with broken scripts that wrap the compiler
734 dnl with options, but eliminates a more common category of user confusion.
736 dnl In particular, it addresses the problem of being able to run the C
737 dnl preprocessor in a consistent manner.
739 dnl Caveat: this also disallows blanks in the pathname for the compiler, but
740 dnl the nuisance of having inconsistent settings for compiler and preprocessor
741 dnl outweighs that limitation.
742 AC_DEFUN([CF_CC_ENV_FLAGS],
744 # This should have been defined by AC_PROG_CC
747 AC_MSG_CHECKING(\$CFLAGS variable)
750 AC_MSG_RESULT(broken)
751 AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options)
754 for cf_arg in $cf_flags
756 CF_ADD_CFLAGS($cf_arg)
764 AC_MSG_CHECKING(\$CC variable)
767 AC_MSG_RESULT(broken)
768 AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options)
770 cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'`
771 cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'`
773 for cf_arg in $cf_flags
777 CF_ADD_CFLAGS($cf_arg)
784 CF_VERBOSE(resulting CC: '$CC')
785 CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
786 CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
793 dnl ---------------------------------------------------------------------------
794 dnl CF_CFG_DEFAULTS version: 11 updated: 2015/04/17 21:13:04
796 dnl Determine the default configuration into which we'll install ncurses. This
797 dnl can be overridden by the user's command-line options. There's two items to
799 dnl 1. the prefix (e.g., /usr)
800 dnl 2. the header files (e.g., /usr/include/ncurses)
801 dnl We'll look for a previous installation of ncurses and use the same defaults.
803 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
804 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
805 dnl programs from a vendor's.
806 AC_DEFUN([CF_CFG_DEFAULTS],
808 AC_MSG_CHECKING(for prefix)
809 if test "x$prefix" = "xNONE" ; then
810 case "$cf_cv_system_name" in
811 # non-vendor systems don't have a conflict
812 (openbsd*|freebsd*|mirbsd*|linux*|cygwin*|msys*|k*bsd*-gnu|mingw*)
815 (*) prefix=$ac_default_prefix
819 AC_MSG_RESULT($prefix)
821 if test "x$prefix" = "xNONE" ; then
822 AC_MSG_CHECKING(for default include-directory)
823 test -n "$verbose" && echo 1>&AC_FD_MSG
826 $includedir/ncurses \
828 $prefix/include/ncurses \
830 /usr/local/include/ncurses \
834 cf_dir=`eval echo $cf_symbol`
835 if test -f $cf_dir/curses.h ; then
836 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
837 includedir="$cf_symbol"
838 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG
842 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
844 AC_MSG_RESULT($includedir)
847 dnl ---------------------------------------------------------------------------
848 dnl CF_CGETENT version: 6 updated: 2017/01/21 11:06:25
850 dnl Check if the terminal-capability database functions are available. If not,
851 dnl ncurses has a much-reduced version.
852 AC_DEFUN([CF_CGETENT],[
853 AC_CACHE_CHECK(for terminal-capability database functions,cf_cv_cgetent,[
855 #include <stdlib.h>],[
858 char *db_array = temp;
859 cgetent(&buf, &db_array, "vt100");
860 cgetcap(buf, "tc", '=');
861 cgetmatch(buf, "tc");
867 if test "$cf_cv_cgetent" = yes
869 AC_DEFINE(HAVE_BSD_CGETENT,1,[Define to 1 if we have BSD cgetent])
870 AC_CACHE_CHECK(if cgetent uses const parameter,cf_cv_cgetent_const,[
872 #pragma GCC diagnostic error "-Wincompatible-pointer-types-discards-qualifiers"
873 #include <stdlib.h>],[
876 #ifndef _NETBSD_SOURCE /* given, since April 2004 in stdlib.h */
877 const char *db_array = temp;
878 cgetent(&buf, &db_array, "vt100");
880 cgetcap(buf, "tc", '=');
881 cgetmatch(buf, "tc");
883 [cf_cv_cgetent_const=yes],
884 [cf_cv_cgetent_const=no])
886 if test "$cf_cv_cgetent_const" = yes
888 AC_DEFINE_UNQUOTED(CGETENT_CONST,const,[Define to const if needed for some BSD cgetent variations])
892 dnl ---------------------------------------------------------------------------
893 dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
895 dnl Check if we're accidentally using a cache from a different machine.
896 dnl Derive the system name, as a check for reusing the autoconf cache.
898 dnl If we've packaged config.guess and config.sub, run that (since it does a
899 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
900 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
901 dnl which is useful in cross-compiles.
903 dnl Note: we would use $ac_config_sub, but that is one of the places where
904 dnl autoconf 2.5x broke compatibility with autoconf 2.13
905 AC_DEFUN([CF_CHECK_CACHE],
907 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
908 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
909 system_name="$host_os"
911 system_name="`(uname -s -r) 2>/dev/null`"
912 if test -z "$system_name" ; then
913 system_name="`(hostname) 2>/dev/null`"
916 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
917 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
919 test -z "$system_name" && system_name="$cf_cv_system_name"
920 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
922 if test ".$system_name" != ".$cf_cv_system_name" ; then
923 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
924 AC_MSG_ERROR("Please remove config.cache and try again.")
927 dnl ---------------------------------------------------------------------------
928 dnl CF_CHECK_ENVIRON version: 3 updated: 2010/05/26 16:44:57
930 dnl Check for data that is usually declared in <unistd.h>, e.g., the 'environ'
931 dnl variable. Define a DECL_xxx symbol if we must declare it ourselves.
933 dnl $1 = the name to check
934 dnl $2 = the assumed type
935 AC_DEFUN([CF_CHECK_ENVIRON],
937 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
942 #include <unistd.h> ],
943 ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1,
948 if test "$cf_cv_dcl_$1" = no ; then
949 CF_UPPER(cf_result,decl_$1)
950 AC_DEFINE_UNQUOTED($cf_result)
953 # It's possible (for near-UNIX clones) that the data doesn't exist
954 CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
956 dnl ---------------------------------------------------------------------------
957 dnl CF_CHECK_ERRNO version: 12 updated: 2015/04/18 08:56:57
959 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
960 dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
963 dnl $1 = the name to check
964 dnl $2 = the assumed type
965 AC_DEFUN([CF_CHECK_ERRNO],
967 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
973 #include <sys/types.h>
974 #include <errno.h> ],
975 ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1,
980 if test "$cf_cv_dcl_$1" = no ; then
981 CF_UPPER(cf_result,decl_$1)
982 AC_DEFINE_UNQUOTED($cf_result)
985 # It's possible (for near-UNIX clones) that the data doesn't exist
986 CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
988 dnl ---------------------------------------------------------------------------
989 dnl CF_CHECK_EXTERN_DATA version: 4 updated: 2015/04/18 08:56:57
990 dnl --------------------
991 dnl Check for existence of external data in the current set of libraries. If
992 dnl we can modify it, it's real enough.
993 dnl $1 = the name to check
995 AC_DEFUN([CF_CHECK_EXTERN_DATA],
997 AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
1003 [cf_cv_have_$1=yes],
1007 if test "$cf_cv_have_$1" = yes ; then
1008 CF_UPPER(cf_result,have_$1)
1009 AC_DEFINE_UNQUOTED($cf_result)
1013 dnl ---------------------------------------------------------------------------
1014 dnl CF_CHECK_GETENV version: 1 updated: 2019/06/23 15:28:15
1016 dnl Check if repeated getenv calls return the same pointer, e.g., it does not
1017 dnl discard the previous pointer when returning a new one.
1018 AC_DEFUN([CF_CHECK_GETENV],
1020 AC_REQUIRE([CF_CHECK_ENVIRON])
1021 AC_CHECK_FUNC( getenv, ,, AC_MSG_ERROR(getenv not found) )
1022 AC_CHECK_FUNCS( putenv setenv strdup )
1023 AC_CACHE_CHECK(if getenv returns consistent values,cf_cv_consistent_getenv,[
1029 #include <sys/types.h>
1031 #if defined(HAVE_ENVIRON) && defined(DECL_ENVIRON) && !defined(environ)
1032 extern char **environ; /* POSIX, but some systems are not... */
1035 #if defined(HAVE_STRDUP)
1036 #define str_alloc(s) strdup(s)
1038 #define str_alloc(s) strcpy(malloc(strlen(s) + 1, s))
1041 static void set_value(const char *name, const char *value)
1043 #if defined(HAVE_SETENV)
1044 setenv(name, value, 1);
1045 #elif defined(HAVE_PUTENV)
1047 sprintf(buffer, "%s=%s", name, value);
1048 putenv(str_alloc(buffer));
1050 #error neither putenv/setenv found
1056 size_t numenv, limit, j;
1061 for (numenv = 0; environ[numenv]; ++numenv) ;
1062 limit = numenv + 10;
1063 mynames = (char **) calloc(limit + 1, sizeof(char *));
1064 myvalues = (char **) calloc(limit + 1, sizeof(char *));
1065 mypointer = (char **) calloc(limit + 1, sizeof(char *));
1066 #if defined(HAVE_ENVIRON)
1067 for (j = 0; environ[j]; ++j) {
1068 mynames[j] = str_alloc(environ[j]);
1069 equals = strchr(mynames[j], '=');
1072 myvalues[j] = str_alloc(equals);
1074 myvalues[j] = str_alloc("");
1078 for (j = numenv; j < limit; ++j) {
1086 sprintf(name, "TERM%lu", (unsigned long) k);
1087 for (jk = 0; jk < j; ++jk) {
1088 if (!strcmp(name, mynames[jk])) {
1095 sprintf(value, "%lu:%p", (unsigned long) k, &mynames[j]);
1096 set_value(name, value);
1097 mynames[j] = str_alloc(name);
1098 myvalues[j] = str_alloc(value);
1100 for (pass = 0; pass < 3; ++pass) {
1101 for (j = 0; j < limit; ++j) {
1102 char *value = getenv(mynames[j]);
1105 fprintf(stderr, "getenv returned null for %s\n", mynames[j]);
1106 ${cf_cv_main_return:-return}(1);
1107 } else if (value != mypointer[j]) {
1108 fprintf(stderr, "getenv returned different pointer for %s\n", mynames[j]);
1109 ${cf_cv_main_return:-return}(1);
1110 } else if (strcmp(value, myvalues[j])) {
1111 fprintf(stderr, "getenv returned different value for %s\n", mynames[j]);
1112 ${cf_cv_main_return:-return}(1);
1116 mypointer[j] = value;
1117 for (k = 0; k < j; ++k) {
1118 if (mypointer[j] == mypointer[k]) {
1119 fprintf(stderr, "getenv returned same pointer for %s and %s\n", mynames[j], mynames[k]);
1120 ${cf_cv_main_return:-return}(1);
1126 ${cf_cv_main_return:-return}(0);
1129 [cf_cv_consistent_getenv=yes],
1130 [cf_cv_consistent_getenv=no],
1131 [cf_cv_consistent_getenv=unknown])
1134 if test "x$cf_cv_consistent_getenv" = xno
1136 AC_DEFINE(HAVE_CONSISTENT_GETENV,1,[Define to 1 if getenv repeatably returns the same value for a given name])
1139 dnl ---------------------------------------------------------------------------
1140 dnl CF_CHECK_GPM_WGETCH version: 3 updated: 2017/01/21 11:06:25
1141 dnl -------------------
1142 dnl Check if GPM is already linked with curses. If so - and if the linkage
1143 dnl is not "weak" - warn about this because it can create problems linking
1144 dnl applications with ncurses.
1145 AC_DEFUN([CF_CHECK_GPM_WGETCH],[
1146 AC_CHECK_LIB(gpm,Gpm_Wgetch,[
1148 AC_CACHE_CHECK(if GPM is weakly bound to curses library, cf_cv_check_gpm_wgetch,[
1149 cf_cv_check_gpm_wgetch=unknown
1150 if test "$cross_compiling" != yes ; then
1152 cat >conftest.$ac_ext <<CF_EOF
1157 ${cf_cv_main_return:-return}(0);
1161 cf_save_LIBS="$LIBS"
1162 # This only works if we can look at the symbol table. If a shared
1163 # library is stripped for install, we cannot use that. So we're forced
1164 # to rely on the static library, noting that some packagers may not
1166 LIBS="-static -lgpm -dynamic $LIBS"
1167 if AC_TRY_EVAL(ac_compile) ; then
1168 if AC_TRY_EVAL(ac_link) ; then
1169 cf_cv_check_gpm_wgetch=`nm conftest$ac_exeext | egrep '\<wgetch\>' | egrep '\<[[vVwW]]\>'`
1170 test -n "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=yes
1171 test -z "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=no
1175 LIBS="$cf_save_LIBS"
1179 if test "$cf_cv_check_gpm_wgetch" != yes ; then
1180 AC_MSG_WARN(GPM library is already linked with curses - read the FAQ)
1183 dnl ---------------------------------------------------------------------------
1184 dnl CF_CHECK_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
1185 dnl ------------------------
1186 dnl Show the version of libtool
1188 dnl Save the version in a cache variable - this is not entirely a good thing,
1189 dnl but the version string from libtool is very ugly, and for bug reports it
1190 dnl might be useful to have the original string.
1191 AC_DEFUN([CF_CHECK_LIBTOOL_VERSION],[
1192 if test -n "$LIBTOOL" && test "$LIBTOOL" != none
1194 AC_MSG_CHECKING(version of $LIBTOOL)
1196 AC_MSG_RESULT($cf_cv_libtool_version)
1197 if test -z "$cf_cv_libtool_version" ; then
1198 AC_MSG_ERROR(This is not GNU libtool)
1201 AC_MSG_ERROR(GNU libtool has not been found)
1204 dnl ---------------------------------------------------------------------------
1205 dnl CF_CHECK_WCHAR_H version: 2 updated: 2017/01/21 11:06:25
1206 dnl ----------------
1207 dnl Check if wchar.h can be used, i.e., without defining _XOPEN_SOURCE_EXTENDED
1208 AC_DEFUN([CF_CHECK_WCHAR_H],[
1213 AC_CACHE_CHECK(if wchar.h can be used as is,cf_cv_wchar_h_okay,[
1220 #ifdef HAVE_WCTYPE_H
1225 int bar = iswpunct(foo)],
1226 [cf_cv_wchar_h_okay=yes],
1227 [cf_cv_wchar_h_okay=no])])
1229 if test $cf_cv_wchar_h_okay = no
1231 CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED)
1234 dnl ---------------------------------------------------------------------------
1235 dnl CF_CHECK_WCWIDTH_GRAPHICS version: 1 updated: 2015/12/19 17:47:56
1236 dnl -------------------------
1237 dnl Most "modern" terminal emulators are based to some degree on VT100, and
1238 dnl should support line-drawing. Even with Unicode. There is a problem.
1240 dnl While most of the VT100 graphics characters were incorporated into Unicode,
1241 dnl all of those were combined into a page of useful graphics characters.
1243 dnl So far, so good.
1245 dnl However, while they are useful, there are other considerations. CJK
1246 dnl is (because of poor device resolution) often rendered as double-width
1247 dnl characters. So... for these generally-useful characters, what should
1248 dnl be the width (to make them consistent with adjacent characters)?
1250 dnl The obvious choice would have been to make this locale-dependent, and use
1251 dnl wcwidth() to tell applications what the actual width is. That was too
1252 dnl obvious. Instead, we have a slew of "ambiguous-width" characters.
1254 dnl http://www.unicode.org/reports/tr11/tr11-29.html
1255 dnl http://www.cl.cam.ac.uk/~mgk25/ucs/scw-proposal.html
1257 dnl The EastAsianWidth-6.2.0.txt file from the Unicode organization lists
1258 dnl more than 22,000 characters, with 1281 of those as ambiguous-width. For
1259 dnl instance, it lists half (44/96) of the Latin-1 characters as
1260 dnl ambiguous-width. Also, all of the box-characters at 0x2500 are ambiguous.
1262 dnl What this means for the implementor is that on some systems wcwidth() can
1263 dnl give bad advice. On Solaris, some of the ambiguous widths are returned as
1264 dnl 1 (the Latin-1 characters), while others are returned as 2 (line-drawing
1265 dnl characters). These do not necessarily match the behavior of the terminal
1266 dnl emulator. xterm, for instance, does an optional startup check to find if
1267 dnl this problem (or similar) exists with the system's locale tables, rejecting
1268 dnl them if they are too unreliable.
1269 AC_DEFUN([CF_CHECK_WCWIDTH_GRAPHICS],[
1270 AC_CACHE_CHECK(if wcwidth agrees graphics are single-width, cf_cv_wcwidth_graphics,[
1271 cat >conftest.in <<CF_EOF
1273 0x250c upper left corner
1274 0x2514 lower left corner
1275 0x2510 upper right corner
1276 0x2518 lower right corner
1277 0x251c tee pointing left
1278 0x2524 tee pointing right
1279 0x2534 tee pointing up
1280 0x252c tee pointing down
1281 0x2500 horizontal line
1282 0x2502 vertical line
1283 0x253c large plus or crossover
1287 0x2592 checker board (stipple)
1288 0x00b0 degree symbol
1291 - Teletype 5410v1 symbols
1292 0x2190 arrow pointing left
1293 0x2192 arrow pointing right
1294 0x2193 arrow pointing down
1295 0x2191 arrow pointing up
1296 0x2592 board of squares
1297 0x2603 lantern symbol
1298 0x25ae solid square block
1299 - these defaults were invented for ncurses
1302 0x2264 less-than-or-equal-to
1303 0x2265 greater-than-or-equal-to
1306 0x00a3 pound-sterling symbol
1307 - thick-line-drawing
1308 0x250f upper left corner
1309 0x2517 lower left corner
1310 0x2513 upper right corner
1311 0x251b lower right corner
1312 0x2523 tee pointing left
1313 0x252b tee pointing right
1314 0x253b tee pointing up
1315 0x2533 tee pointing down
1316 0x2501 horizontal line
1317 0x2503 vertical line
1318 0x254b large plus or crossover
1319 - double-line-drawing
1320 0x2554 upper left corner
1321 0x255a lower left corner
1322 0x2557 upper right corner
1323 0x255d lower right corner
1324 0x2563 tee pointing left
1325 0x2560 tee pointing right
1326 0x2569 tee pointing up
1327 0x2566 tee pointing down
1328 0x2550 horizontal line
1329 0x2551 vertical line
1330 0x256c large plus or crossover
1344 char buffer[MY_LEN + 1];
1345 char notes[MY_LEN + 1];
1349 if (setlocale(LC_ALL, "en_US.UTF8") ||
1350 setlocale(LC_ALL, "en_US.UTF-8") ||
1351 setlocale(LC_ALL, "en_US.utf8") ||
1352 setlocale(LC_ALL, "en_US.utf-8")) {
1353 if ((fp = fopen("conftest.in", "r")) != 0) {
1354 while (fgets(buffer, MY_LEN, fp) != 0) {
1355 if (*buffer == '-') {
1356 fprintf(stderr, "\t%s", buffer);
1357 } else if (sscanf(buffer, "%x %s", &value, notes) == 2) {
1359 if (wcwidth(value) == 1)
1361 fprintf(stderr, "%d\t%s", wcwidth(value), buffer);
1363 fprintf(stderr, "?\t%s", buffer);
1368 fprintf(stderr, "%d/%d passed wcwidth/graphics check\n", passed, totals);
1369 return (totals == passed) ? 0 : 1;
1372 [cf_cv_wcwidth_graphics=yes],
1373 [cf_cv_wcwidth_graphics=no],
1374 [cf_cv_wcwidth_graphics=unknown])
1377 dnl ---------------------------------------------------------------------------
1378 dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35
1379 dnl -----------------
1380 dnl Check if the given compiler is really clang. clang's C driver defines
1381 dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
1382 dnl not ignore some gcc options.
1384 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1385 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1386 dnl the wrappers for gcc and g++ warnings.
1388 dnl $1 = GCC (default) or GXX
1389 dnl $2 = CLANG_COMPILER (default)
1390 dnl $3 = CFLAGS (default) or CXXFLAGS
1391 AC_DEFUN([CF_CLANG_COMPILER],[
1392 ifelse([$2],,CLANG_COMPILER,[$2])=no
1394 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
1395 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
1396 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1397 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
1403 ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
1404 cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
1406 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1407 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
1410 dnl ---------------------------------------------------------------------------
1411 dnl CF_CONST_X_STRING version: 1 updated: 2019/04/08 17:50:29
1412 dnl -----------------
1413 dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most
1414 dnl character-strings.
1416 dnl It is ambiguous because the specification accommodated the pre-ANSI
1417 dnl compilers bundled by more than one vendor in lieu of providing a standard C
1418 dnl compiler other than by costly add-ons. Because of this, the specification
1419 dnl did not take into account the use of const for telling the compiler that
1420 dnl string literals would be in readonly memory.
1422 dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to
1423 dnl let the compiler decide how to represent Xt's strings which were #define'd.
1424 dnl That does not solve the problem of using the block of Xt's strings which
1425 dnl are compiled into the library (and is less efficient than one might want).
1427 dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both
1428 dnl when compiling the library and compiling using the library, to tell the
1429 dnl compiler that String is const.
1430 AC_DEFUN([CF_CONST_X_STRING],
1435 #include <X11/Intrinsic.h>
1437 [String foo = malloc(1)],[
1439 AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[
1442 #define _CONST_X_STRING /* X11R7.8 (perhaps) */
1443 #undef XTSTRINGDEFINES /* X11R5 and later */
1445 #include <X11/Intrinsic.h>
1446 ],[String foo = malloc(1); *foo = 0],[
1447 cf_cv_const_x_string=no
1449 cf_cv_const_x_string=yes
1453 case $cf_cv_const_x_string in
1455 CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES)
1458 CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING)
1464 dnl ---------------------------------------------------------------------------
1465 dnl CF_CPP_PARAM_INIT version: 7 updated: 2017/01/21 11:06:25
1466 dnl -----------------
1467 dnl Check if the C++ compiler accepts duplicate parameter initialization. This
1468 dnl is a late feature for the standard and is not in some recent compilers
1470 AC_DEFUN([CF_CPP_PARAM_INIT],
1472 if test -n "$CXX"; then
1473 AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[
1485 TEST::TEST(int x = 1) // some compilers do not like second initializer
1491 [cf_cv_cpp_param_init=yes],
1492 [cf_cv_cpp_param_init=no],
1493 [cf_cv_cpp_param_init=unknown])
1497 test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT,1,[Define to 1 if C++ has parameter initialization])
1499 dnl ---------------------------------------------------------------------------
1500 dnl CF_CPP_STATIC_CAST version: 3 updated: 2013/04/13 18:03:21
1501 dnl ------------------
1502 dnl Check if the C++ compiler accepts static_cast in generics. This appears to
1503 dnl not be supported in g++ before 3.0
1504 AC_DEFUN([CF_CPP_STATIC_CAST],
1506 if test -n "$CXX"; then
1508 AC_CACHE_CHECK(if $CXX accepts static_cast,cf_cv_cpp_static_cast,[
1516 NCursesPanel(int nlines,
1526 template<class T> class NCursesUserPanel : public NCursesPanel
1529 NCursesUserPanel (int nlines,
1533 const T* p_UserData = static_cast<T*>(0))
1534 : NCursesPanel (nlines, ncols, begin_y, begin_x)
1537 NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel()
1541 virtual ~NCursesUserPanel() {};
1544 const char* p_UserData = static_cast<char*>(0)],
1545 [cf_cv_cpp_static_cast=yes],
1546 [cf_cv_cpp_static_cast=no])
1553 test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST,1,[Define to 1 if C++ has static_cast])
1555 dnl ---------------------------------------------------------------------------
1556 dnl CF_CXX_AR_FLAGS version: 2 updated: 2015/04/17 21:13:04
1558 dnl Setup special archiver flags for given compilers.
1559 AC_DEFUN([CF_CXX_AR_FLAGS],[
1561 CXX_ARFLAGS='$(ARFLAGS)'
1562 case $cf_cv_system_name in
1564 if test "$GXX" != yes ; then
1566 CXX_ARFLAGS='-ar -o'
1570 CXXLDFLAGS="-u main"
1573 if test "$GXX" != yes ; then
1575 CXX_ARFLAGS='-xar -o'
1579 AC_SUBST(CXXLDFLAGS)
1581 AC_SUBST(CXX_ARFLAGS)
1583 dnl ---------------------------------------------------------------------------
1584 dnl CF_CXX_IOSTREAM_NAMESPACE version: 2 updated: 2012/10/06 17:56:13
1585 dnl -------------------------
1586 dnl For c++, check if iostream uses "std::" namespace.
1587 AC_DEFUN([CF_CXX_IOSTREAM_NAMESPACE],[
1588 AC_CHECK_HEADERS(iostream)
1589 if test x"$ac_cv_header_iostream" = xyes ; then
1590 AC_MSG_CHECKING(if iostream uses std-namespace)
1595 cerr << "testing" << endl;
1596 ],[cf_iostream_namespace=yes],[cf_iostream_namespace=no])
1597 AC_MSG_RESULT($cf_iostream_namespace)
1598 if test "$cf_iostream_namespace" = yes ; then
1599 AC_DEFINE(IOSTREAM_NAMESPACE,1,[Define to 1 if C++ has namespace iostream])
1603 dnl ---------------------------------------------------------------------------
1604 dnl CF_C_INLINE version: 6 updated: 2019/09/07 13:38:36
1606 dnl Check if the C compiler supports "inline".
1607 dnl $1 is the name of a shell variable to set if inline is supported
1608 dnl $2 is the threshold for gcc 4.x's option controlling maximum inline size
1609 AC_DEFUN([CF_C_INLINE],[
1610 AC_REQUIRE([CF_GCC_VERSION])
1613 if test "$ac_cv_c_inline" != no ; then
1615 if test "$INTEL_COMPILER" = yes
1618 elif test "$CLANG_COMPILER" = yes
1621 elif test "$GCC" = yes
1623 AC_CACHE_CHECK(if $CC supports options to tune inlining,cf_cv_gcc_inline,[
1624 cf_save_CFLAGS=$CFLAGS
1625 CFLAGS="$CFLAGS --param max-inline-insns-single=$2"
1626 AC_TRY_COMPILE([inline int foo(void) { return 1; }],
1627 [${cf_cv_main_return:-return} foo()],
1628 [cf_cv_gcc_inline=yes],
1629 [cf_cv_gcc_inline=no])
1630 CFLAGS=$cf_save_CFLAGS
1632 if test "$cf_cv_gcc_inline" = yes ; then
1633 CF_ADD_CFLAGS([--param max-inline-insns-single=$2])
1639 dnl ---------------------------------------------------------------------------
1640 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
1642 dnl "dirname" is not portable, so we fake it with a shell script.
1643 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
1644 dnl ---------------------------------------------------------------------------
1645 dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31
1647 AC_DEFUN([CF_DIRS_TO_MAKE],
1650 for cf_item in $cf_list_models
1652 CF_OBJ_SUBDIR($cf_item,cf_subdir)
1653 for cf_item2 in $DIRS_TO_MAKE
1655 test $cf_item2 = $cf_subdir && break
1657 test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
1659 for cf_dir in $DIRS_TO_MAKE
1661 test ! -d $cf_dir && mkdir $cf_dir
1663 AC_SUBST(DIRS_TO_MAKE)
1665 dnl ---------------------------------------------------------------------------
1666 dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57
1668 dnl You can always use "make -n" to see the actual options, but it's hard to
1669 dnl pick out/analyze warning messages when the compile-line is long.
1672 dnl ECHO_LT - symbol to control if libtool is verbose
1673 dnl ECHO_LD - symbol to prefix "cc -o" lines
1674 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
1675 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
1676 dnl ECHO_CC - symbol to put before any "cc" line
1678 AC_DEFUN([CF_DISABLE_ECHO],[
1679 AC_MSG_CHECKING(if you want to see long compiling messages)
1680 CF_ARG_DISABLE(echo,
1681 [ --disable-echo do not display "compiling" commands],
1684 ECHO_LD='@echo linking [$]@;'
1685 RULE_CC='@echo compiling [$]<'
1686 SHOW_CC='@echo compiling [$]@'
1695 AC_MSG_RESULT($enableval)
1702 dnl ---------------------------------------------------------------------------
1703 dnl CF_DISABLE_GNAT_PROJECTS version: 1 updated: 2014/06/01 11:34:00
1704 dnl ------------------------
1705 AC_DEFUN([CF_DISABLE_GNAT_PROJECTS],[
1706 AC_MSG_CHECKING(if we want to use GNAT projects)
1707 CF_ARG_DISABLE(gnat-projects,
1708 [ --disable-gnat-projects test: disable GNAT projects even if usable],
1709 [enable_gnat_projects=no],
1710 [enable_gnat_projects=yes])
1711 AC_MSG_RESULT($enable_gnat_projects)
1713 dnl ---------------------------------------------------------------------------
1714 dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03
1715 dnl ----------------
1716 dnl Combine no-leak checks with the libraries or tools that are used for the
1718 AC_DEFUN([CF_DISABLE_LEAKS],[
1720 AC_REQUIRE([CF_WITH_DMALLOC])
1721 AC_REQUIRE([CF_WITH_DBMALLOC])
1722 AC_REQUIRE([CF_WITH_VALGRIND])
1724 AC_MSG_CHECKING(if you want to perform memory-leak testing)
1725 AC_ARG_ENABLE(leaks,
1726 [ --disable-leaks test: free permanent memory, analyze leaks],
1727 [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi],
1728 : ${with_no_leaks:=no})
1729 AC_MSG_RESULT($with_no_leaks)
1731 if test "$with_no_leaks" = yes ; then
1732 AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
1733 AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
1736 dnl ---------------------------------------------------------------------------
1737 dnl CF_DISABLE_LIBTOOL_VERSION version: 3 updated: 2015/04/17 21:13:04
1738 dnl --------------------------
1739 dnl Check if we should use the libtool 1.5 feature "-version-number" instead of
1740 dnl the older "-version-info" feature. The newer feature allows us to use
1741 dnl version numbering on shared libraries which make them compatible with
1742 dnl various systems.
1743 AC_DEFUN([CF_DISABLE_LIBTOOL_VERSION],
1745 AC_MSG_CHECKING(if libtool -version-number should be used)
1746 CF_ARG_DISABLE(libtool-version,
1747 [ --disable-libtool-version enable to use libtool's incompatible naming scheme],
1748 [cf_libtool_version=no],
1749 [cf_libtool_version=yes])
1750 AC_MSG_RESULT($cf_libtool_version)
1752 if test "$cf_libtool_version" = yes ; then
1753 LIBTOOL_VERSION="-version-number"
1755 LIBTOOL_VERSION="-version-info"
1758 AC_MSG_WARN(VERSION was not set)
1761 ABI_VERSION="$VERSION"
1762 CF_VERBOSE(ABI_VERSION: $ABI_VERSION)
1765 ABI_VERSION=`echo "$VERSION" | sed -e 's/:/./g'`
1766 CF_VERBOSE(ABI_VERSION: $ABI_VERSION)
1769 AC_MSG_WARN(unexpected VERSION value: $VERSION)
1774 AC_SUBST(ABI_VERSION)
1775 AC_SUBST(LIBTOOL_VERSION)
1777 dnl ---------------------------------------------------------------------------
1778 dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33
1779 dnl ---------------------
1780 dnl The rpath-hack makes it simpler to build programs, particularly with the
1781 dnl *BSD ports which may have essential libraries in unusual places. But it
1782 dnl can interfere with building an executable for the base system. Use this
1783 dnl option in that case.
1784 AC_DEFUN([CF_DISABLE_RPATH_HACK],
1786 AC_MSG_CHECKING(if rpath-hack should be disabled)
1787 CF_ARG_DISABLE(rpath-hack,
1788 [ --disable-rpath-hack don't add rpath options for additional libraries],
1789 [cf_disable_rpath_hack=yes],
1790 [cf_disable_rpath_hack=no])
1791 AC_MSG_RESULT($cf_disable_rpath_hack)
1792 if test "$cf_disable_rpath_hack" = no ; then
1796 dnl ---------------------------------------------------------------------------
1797 dnl CF_ENABLE_PC_FILES version: 13 updated: 2015/11/01 05:27:39
1798 dnl ------------------
1799 dnl This is the "--enable-pc-files" option, which is available if there is a
1800 dnl pkg-config configuration on the local machine.
1801 AC_DEFUN([CF_ENABLE_PC_FILES],[
1802 AC_REQUIRE([CF_PKG_CONFIG])
1803 AC_REQUIRE([CF_WITH_PKG_CONFIG_LIBDIR])
1805 if test "x$PKG_CONFIG" != xnone
1807 AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG)
1809 AC_MSG_CHECKING(if we should install .pc files)
1812 AC_ARG_ENABLE(pc-files,
1813 [ --enable-pc-files generate and install .pc files for pkg-config],
1814 [enable_pc_files=$enableval],
1815 [enable_pc_files=no])
1816 AC_MSG_RESULT($enable_pc_files)
1818 if test "x$enable_pc_files" != xno
1821 case "x$PKG_CONFIG_LIBDIR" in
1823 AC_MSG_WARN(no PKG_CONFIG_LIBDIR was found)
1826 CF_PATH_SYNTAX(PKG_CONFIG_LIBDIR)
1832 AC_SUBST(MAKE_PC_FILES)
1834 dnl ---------------------------------------------------------------------------
1835 dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42
1837 dnl Check if the rpath option should be used, setting cache variable
1838 dnl cf_cv_enable_rpath if so.
1839 AC_DEFUN([CF_ENABLE_RPATH],
1841 AC_MSG_CHECKING(if rpath option should be used)
1842 AC_ARG_ENABLE(rpath,
1843 [ --enable-rpath use rpath option when generating shared libraries],
1844 [cf_cv_enable_rpath=$enableval],
1845 [cf_cv_enable_rpath=no])
1846 AC_MSG_RESULT($cf_cv_enable_rpath)
1848 dnl ---------------------------------------------------------------------------
1849 dnl CF_ENABLE_STRING_HACKS version: 5 updated: 2016/10/08 17:34:11
1850 dnl ----------------------
1851 dnl On a few platforms, the compiler and/or loader nags with untruthful
1852 dnl comments stating that "most" uses of strcat/strcpy/sprintf are incorrect,
1853 dnl and implying that most uses of the recommended alternatives are correct.
1855 dnl Factually speaking, no one has actually counted the number of uses of these
1856 dnl functions versus the total of incorrect uses. Samples of a few thousand
1857 dnl instances are meaningless compared to the hundreds of millions of lines of
1858 dnl existing C code.
1860 dnl strlcat/strlcpy are (as of 2012) non-standard, and are available on some
1861 dnl platforms, in implementations of varying quality. Likewise, snprintf is
1862 dnl standard - but evolved through phases, and older implementations are likely
1863 dnl to yield surprising results, as documented in manpages on various systems.
1864 AC_DEFUN([CF_ENABLE_STRING_HACKS],
1866 AC_MSG_CHECKING(if you want to work around bogus compiler/loader warnings)
1867 AC_ARG_ENABLE(string-hacks,
1868 [ --enable-string-hacks work around bogus compiler/loader warnings],
1869 [with_string_hacks=$enableval],
1870 [with_string_hacks=no])
1871 AC_MSG_RESULT($with_string_hacks)
1873 if test "x$with_string_hacks" = "xyes"; then
1874 AC_DEFINE(USE_STRING_HACKS,1,[Define to 1 to work around bogus compiler/loader warnings])
1875 AC_MSG_WARN(enabling string-hacks to work around bogus compiler/loader warnings)
1876 AC_CHECK_FUNC(strlcat,[
1877 AC_DEFINE(HAVE_STRLCAT,1,[Define to 1 if we have strlcat function])
1879 AC_CHECK_LIB(bsd,strlcat,[
1881 AC_CHECK_HEADERS(bsd/string.h)
1882 AC_DEFINE(HAVE_STRLCAT,1,[Define to 1 if we have strlcat function])
1885 AC_CHECK_FUNCS( strlcpy snprintf )
1888 dnl ---------------------------------------------------------------------------
1889 dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
1891 dnl Check if 'errno' is declared in <errno.h>
1892 AC_DEFUN([CF_ERRNO],
1894 CF_CHECK_ERRNO(errno)
1896 dnl ---------------------------------------------------------------------------
1897 dnl CF_ETIP_DEFINES version: 5 updated: 2012/02/18 17:51:07
1899 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
1900 dnl math.h and builtin.h, only for ncurses
1901 AC_DEFUN([CF_ETIP_DEFINES],
1903 AC_MSG_CHECKING(for special defines needed for etip.h)
1904 cf_save_CXXFLAGS="$CXXFLAGS"
1907 # etip.h includes ncurses.h which includes ncurses_dll.h
1908 # But ncurses_dll.h is generated - fix here.
1909 test -d include || mkdir include
1910 test -f include/ncurses_dll.h || sed -e 's/@NCURSES_WRAP_PREFIX@/'$NCURSES_WRAP_PREFIX'/g' ${srcdir}/include/ncurses_dll.h.in >include/ncurses_dll.h
1912 for cf_math in "" MATH_H
1914 for cf_excp in "" MATH_EXCEPTION
1916 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -Iinclude -I${srcdir}/include"
1917 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
1918 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
1920 #include <etip.h.in>
1922 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
1923 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
1924 cf_result="$cf_math $cf_excp"
1929 AC_MSG_RESULT($cf_result)
1930 CXXFLAGS="$cf_save_CXXFLAGS"
1932 dnl ---------------------------------------------------------------------------
1933 dnl CF_FIND_LINKAGE version: 21 updated: 2018/06/20 20:23:13
1935 dnl Find a library (specifically the linkage used in the code fragment),
1936 dnl searching for it if it is not already in the library path.
1937 dnl See also CF_ADD_SEARCHPATH.
1939 dnl Parameters (4-on are optional):
1940 dnl $1 = headers for library entrypoint
1941 dnl $2 = code fragment for library entrypoint
1942 dnl $3 = the library name without the "-l" option or ".so" suffix.
1943 dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
1944 dnl $5 = action to perform if not successful
1945 dnl $6 = module name, if not the same as the library name
1946 dnl $7 = extra libraries
1948 dnl Sets these variables:
1949 dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
1950 dnl $cf_cv_header_path_$3 - include-directory if needed
1951 dnl $cf_cv_library_path_$3 - library-directory if needed
1952 dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
1953 AC_DEFUN([CF_FIND_LINKAGE],[
1955 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
1956 # will be set on completion of the AC_TRY_LINK below.
1957 cf_cv_header_path_$3=
1958 cf_cv_library_path_$3=
1960 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
1962 cf_save_LIBS="$LIBS"
1964 AC_TRY_LINK([$1],[$2],[
1965 cf_cv_find_linkage_$3=yes
1966 cf_cv_header_path_$3=/usr/include
1967 cf_cv_library_path_$3=/usr/lib
1970 LIBS="-l$3 $7 $cf_save_LIBS"
1972 AC_TRY_LINK([$1],[$2],[
1973 cf_cv_find_linkage_$3=yes
1974 cf_cv_header_path_$3=/usr/include
1975 cf_cv_library_path_$3=/usr/lib
1976 cf_cv_library_file_$3="-l$3"
1978 cf_cv_find_linkage_$3=no
1979 LIBS="$cf_save_LIBS"
1981 CF_VERBOSE(find linkage for $3 library)
1982 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
1984 cf_save_CPPFLAGS="$CPPFLAGS"
1985 cf_test_CPPFLAGS="$CPPFLAGS"
1987 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
1988 for cf_cv_header_path_$3 in $cf_search
1990 if test -d $cf_cv_header_path_$3 ; then
1991 CF_VERBOSE(... testing $cf_cv_header_path_$3)
1992 CPPFLAGS="$cf_save_CPPFLAGS"
1993 CF_APPEND_TEXT(CPPFLAGS,-I$cf_cv_header_path_$3)
1994 AC_TRY_COMPILE([$1],[$2],[
1995 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
1996 cf_cv_find_linkage_$3=maybe
1997 cf_test_CPPFLAGS="$CPPFLAGS"
1999 CPPFLAGS="$cf_save_CPPFLAGS"
2004 if test "$cf_cv_find_linkage_$3" = maybe ; then
2006 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
2008 cf_save_LIBS="$LIBS"
2009 cf_save_LDFLAGS="$LDFLAGS"
2012 CPPFLAGS="$cf_test_CPPFLAGS"
2013 LIBS="-l$3 $7 $cf_save_LIBS"
2014 AC_TRY_LINK([$1],[$2],[
2015 CF_VERBOSE(... found $3 library in system)
2016 cf_cv_find_linkage_$3=yes])
2017 CPPFLAGS="$cf_save_CPPFLAGS"
2018 LIBS="$cf_save_LIBS"
2021 if test "$cf_cv_find_linkage_$3" != yes ; then
2022 CF_LIBRARY_PATH(cf_search,$3)
2023 for cf_cv_library_path_$3 in $cf_search
2025 if test -d $cf_cv_library_path_$3 ; then
2026 CF_VERBOSE(... testing $cf_cv_library_path_$3)
2027 CPPFLAGS="$cf_test_CPPFLAGS"
2028 LIBS="-l$3 $7 $cf_save_LIBS"
2029 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
2030 AC_TRY_LINK([$1],[$2],[
2031 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
2032 cf_cv_find_linkage_$3=yes
2033 cf_cv_library_file_$3="-l$3"
2035 CPPFLAGS="$cf_save_CPPFLAGS"
2036 LIBS="$cf_save_LIBS"
2037 LDFLAGS="$cf_save_LDFLAGS"
2041 CPPFLAGS="$cf_save_CPPFLAGS"
2042 LDFLAGS="$cf_save_LDFLAGS"
2046 cf_cv_find_linkage_$3=no
2051 LIBS="$cf_save_LIBS"
2053 if test "$cf_cv_find_linkage_$3" = yes ; then
2055 CF_ADD_INCDIR($cf_cv_header_path_$3)
2056 CF_ADD_LIBDIR($cf_cv_library_path_$3)
2060 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
2063 dnl ---------------------------------------------------------------------------
2064 dnl CF_FIND_SUB_INCDIR version: 2 updated: 2015/04/17 21:13:04
2065 dnl ------------------
2066 dnl Find an include-directory with the given leaf-name. This is useful for
2067 dnl example with FreeBSD ports, which use this convention to distinguish
2068 dnl different versions of the same port.
2069 AC_DEFUN([CF_FIND_SUB_INCDIR],[
2070 CF_SUBDIR_PATH(cf_search,$1,include)
2071 for cf_item in $cf_search
2075 CF_ADD_INCDIR($cf_item)
2080 dnl ---------------------------------------------------------------------------
2081 dnl CF_FIND_SUB_LIBDIR version: 2 updated: 2015/04/17 21:13:04
2082 dnl ------------------
2083 dnl Find a library-directory with the given leaf-name. This is useful for
2084 dnl example with FreeBSD ports, which use this convention to distinguish
2085 dnl different versions of the same port.
2086 AC_DEFUN([CF_FIND_SUB_LIBDIR],[
2087 CF_SUBDIR_PATH(cf_search,$1,lib)
2088 for cf_item in $cf_search
2092 CF_ADD_LIBDIR($cf_item)
2097 dnl ---------------------------------------------------------------------------
2098 dnl CF_FIXUP_ADAFLAGS version: 2 updated: 2015/04/17 21:13:04
2099 dnl -----------------
2100 dnl make ADAFLAGS consistent with CFLAGS
2101 AC_DEFUN([CF_FIXUP_ADAFLAGS],[
2102 AC_MSG_CHECKING(optimization options for ADAFLAGS)
2110 cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[[ ]].*//'`
2111 CF_ADD_ADAFLAGS($cf_O_flag)
2114 AC_MSG_RESULT($ADAFLAGS)
2116 dnl ---------------------------------------------------------------------------
2117 dnl CF_FOPEN_BIN_R version: 1 updated: 2019/03/30 17:52:21
2119 dnl Check if fopen works when the "b" (binary) flag is added to the mode
2120 dnl parameter. POSIX ignores the "b", which c89 specified. Some very old
2121 dnl systems do not accept it.
2122 AC_DEFUN([CF_FOPEN_BIN_R],[
2123 AC_CACHE_CHECK(if fopen accepts explicit binary mode,cf_cv_fopen_bin_r,[
2127 FILE *fp = fopen("conftest.tmp", "wb");
2131 for (p = 0; p < 256; ++p) {
2135 fp = fopen("conftest.tmp", "rb");
2137 for (p = 0; p < 256; ++p) {
2150 ${cf_cv_main_return:-return} (rc);
2153 [cf_cv_fopen_bin_r=yes],
2154 [cf_cv_fopen_bin_r=no],
2155 [cf_cv_fopen_bin_r=unknown])
2157 test "x$cf_cv_fopen_bin_r" != xno && AC_DEFINE(USE_FOPEN_BIN_R)
2159 dnl ---------------------------------------------------------------------------
2160 dnl CF_FORGET_TOOL version: 1 updated: 2013/04/06 18:03:09
2162 dnl Forget that we saw the given tool.
2163 AC_DEFUN([CF_FORGET_TOOL],[
2164 unset ac_cv_prog_ac_ct_$1
2168 dnl ---------------------------------------------------------------------------
2169 dnl CF_FUNC_DLSYM version: 4 updated: 2015/09/12 14:46:44
2171 dnl Test for dlsym() and related functions, as well as libdl.
2176 AC_DEFUN([CF_FUNC_DLSYM],[
2178 AC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[
2181 AC_CHECK_LIB(dl,dlsym,[
2183 cf_have_libdl=yes])])
2185 if test "$cf_have_dlsym" = yes ; then
2186 test "$cf_have_libdl" = yes && { CF_ADD_LIB(dl) }
2188 AC_MSG_CHECKING(whether able to link to dl*() functions)
2189 AC_TRY_LINK([#include <dlfcn.h>],[
2191 if ((obj = dlopen("filename", 0)) != 0) {
2192 if (dlsym(obj, "symbolname") == 0) {
2196 AC_DEFINE(HAVE_LIBDL,1,[Define to 1 if we have dl library])],[
2197 AC_MSG_ERROR(Cannot link test program for libdl)])
2200 AC_MSG_ERROR(Cannot find dlsym function)
2203 dnl ---------------------------------------------------------------------------
2204 dnl CF_FUNC_MEMMOVE version: 9 updated: 2017/01/21 11:06:25
2206 dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
2207 dnl is found, add our own version of memmove to the list of objects.
2208 AC_DEFUN([CF_FUNC_MEMMOVE],
2210 AC_CHECK_FUNC(memmove,,[
2211 AC_CHECK_FUNC(bcopy,[
2212 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
2215 static char data[] = "abcdefghijklmnopqrstuwwxyz";
2217 bcopy(data, temp, sizeof(data));
2218 bcopy(temp+10, temp, 15);
2219 bcopy(temp+5, temp+15, 10);
2220 ${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
2223 [cf_cv_good_bcopy=yes],
2224 [cf_cv_good_bcopy=no],
2225 [cf_cv_good_bcopy=unknown])
2227 ],[cf_cv_good_bcopy=no])
2228 if test "$cf_cv_good_bcopy" = yes ; then
2229 AC_DEFINE(USE_OK_BCOPY,1,[Define to 1 to use bcopy when memmove is unavailable])
2231 AC_DEFINE(USE_MY_MEMMOVE,1,[Define to 1 to use replacement function when memmove is unavailable])
2234 dnl ---------------------------------------------------------------------------
2235 dnl CF_FUNC_NANOSLEEP version: 5 updated: 2017/01/21 11:06:25
2236 dnl -----------------
2237 dnl Check for existence of workable nanosleep() function. Some systems, e.g.,
2238 dnl AIX 4.x, provide a non-working version.
2239 AC_DEFUN([CF_FUNC_NANOSLEEP],[
2240 AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[
2246 #ifdef HAVE_SYS_TIME_H
2247 #include <sys/time.h>
2251 struct timespec ts1, ts2;
2254 ts1.tv_nsec = 750000000;
2258 code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */
2259 ${cf_cv_main_return:-return}(code != 0);
2262 [cf_cv_func_nanosleep=yes],
2263 [cf_cv_func_nanosleep=no],
2264 [cf_cv_func_nanosleep=unknown])])
2266 test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP,1,[Define to 1 if we have nanosleep()])
2268 dnl ---------------------------------------------------------------------------
2269 dnl CF_FUNC_OPENPTY version: 5 updated: 2015/09/12 14:46:50
2271 dnl Check for openpty() function, along with <pty.h> header. It may need the
2272 dnl "util" library as well.
2273 AC_DEFUN([CF_FUNC_OPENPTY],
2275 AC_CHECK_LIB(util,openpty,cf_cv_lib_util=yes,cf_cv_lib_util=no)
2276 AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[
2277 cf_save_LIBS="$LIBS"
2278 test $cf_cv_lib_util = yes && { CF_ADD_LIB(util) }
2279 for cf_header in pty.h libutil.h util.h
2282 #include <$cf_header>
2284 int x = openpty((int *)0, (int *)0, (char *)0,
2285 (struct termios *)0, (struct winsize *)0);
2287 cf_cv_func_openpty=$cf_header
2290 cf_cv_func_openpty=no
2293 LIBS="$cf_save_LIBS"
2296 dnl ---------------------------------------------------------------------------
2297 dnl CF_FUNC_POLL version: 9 updated: 2015/10/10 13:27:32
2299 dnl See if the poll function really works. Some platforms have poll(), but
2300 dnl it does not work for terminals or files.
2301 AC_DEFUN([CF_FUNC_POLL],[
2302 tty 2>&1 >/dev/null || { AC_CHECK_FUNCS(posix_openpt) }
2303 AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
2312 #include <sys/poll.h>
2315 struct pollfd myfds;
2318 /* check for Darwin bug with respect to "devices" */
2319 myfds.fd = open("/dev/null", 1); /* O_WRONLY */
2322 myfds.events = POLLIN;
2325 ret = poll(&myfds, 1, 100);
2327 if (ret < 0 || (myfds.revents & POLLNVAL)) {
2332 fd = open("/dev/tty", 2); /* O_RDWR */
2334 #ifdef HAVE_POSIX_OPENPT
2336 fd = posix_openpt(O_RDWR);
2341 /* also check with standard input */
2343 myfds.events = POLLIN;
2345 ret = poll(&myfds, 1, 100);
2350 ${cf_cv_main_return:-return}(ret < 0);
2352 [cf_cv_working_poll=yes],
2353 [cf_cv_working_poll=no],
2354 [cf_cv_working_poll=unknown])])
2355 test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL,1,[Define to 1 if the poll function seems to work])
2357 dnl ---------------------------------------------------------------------------
2358 dnl CF_FUNC_TERMIOS version: 3 updated: 2012/10/06 17:56:13
2360 dnl Some old/broken variations define tcgetattr() only as a macro in
2362 AC_DEFUN([CF_FUNC_TERMIOS],[
2363 AC_REQUIRE([CF_STRUCT_TERMIOS])
2364 AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
2366 #include <sys/types.h>
2367 #ifdef HAVE_UNISTD_H
2370 #ifdef HAVE_TERMIOS_H
2371 #include <termios.h>
2372 #define TTY struct termios
2374 #ifdef HAVE_TERMIO_H
2376 #define TTY struct termio
2381 tcgetattr(1, &foo);],
2382 [cf_cv_have_tcgetattr=yes],
2383 [cf_cv_have_tcgetattr=no])])
2384 test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR,1,[Define to 1 if we have tcgetattr])
2386 dnl ---------------------------------------------------------------------------
2387 dnl CF_FUNC_VSSCANF version: 6 updated: 2015/04/18 08:56:57
2389 dnl Check for vsscanf() function, which is in c9x but generally not in earlier
2390 dnl versions of C. It is in the GNU C library, and can often be simulated by
2391 dnl other functions.
2392 AC_DEFUN([CF_FUNC_VSSCANF],
2394 AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
2397 #include <stdio.h>],[
2399 vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
2402 #include <stdio.h>],[
2406 strbuf._flag = _IOREAD;
2407 strbuf._ptr = strbuf._base = (unsigned char *) str;
2408 strbuf._cnt = strlen(str);
2409 strbuf._file = _NFILE;
2410 return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
2413 #include <stdio.h>],[
2417 strbuf._flag = _IOREAD;
2418 strbuf._ptr = strbuf._base = (unsigned char *) str;
2419 strbuf._cnt = strlen(str);
2420 strbuf._file = _NFILE;
2421 return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
2422 cf_cv_func_vsscanf=no])])])])
2424 case $cf_cv_func_vsscanf in
2425 (vsscanf) AC_DEFINE(HAVE_VSSCANF,1,[Define to 1 if we have vsscanf]);;
2426 (vfscanf) AC_DEFINE(HAVE_VFSCANF,1,[Define to 1 if we have vfscanf]);;
2427 (_doscan) AC_DEFINE(HAVE__DOSCAN,1,[Define to 1 if we have _doscan]);;
2431 dnl ---------------------------------------------------------------------------
2432 dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39:00
2433 dnl -----------------
2434 dnl Test for availability of useful gcc __attribute__ directives to quiet
2435 dnl compiler warnings. Though useful, not all are supported -- and contrary
2436 dnl to documentation, unrecognized directives cause older compilers to barf.
2437 AC_DEFUN([CF_GCC_ATTRIBUTES],
2439 if test "$GCC" = yes
2441 cat > conftest.i <<EOF
2443 #define GCC_PRINTF 0
2448 #ifndef GCC_NORETURN
2449 #define GCC_NORETURN /* nothing */
2452 #define GCC_UNUSED /* nothing */
2455 if test "$GCC" = yes
2457 AC_CHECKING([for $CC __attribute__ directives])
2458 cat > conftest.$ac_ext <<EOF
2459 #line __oline__ "${as_me:-configure}"
2460 #include "confdefs.h"
2461 #include "conftest.h"
2462 #include "conftest.i"
2464 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
2466 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
2469 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
2471 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
2473 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
2474 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
2475 extern void foo(void) GCC_NORETURN;
2476 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
2478 cf_printf_attribute=no
2479 cf_scanf_attribute=no
2480 for cf_attribute in scanf printf unused noreturn
2482 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
2483 cf_directive="__attribute__(($cf_attribute))"
2484 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
2486 case $cf_attribute in
2488 cf_printf_attribute=yes
2489 cat >conftest.h <<EOF
2490 #define GCC_$cf_ATTRIBUTE 1
2494 cf_scanf_attribute=yes
2495 cat >conftest.h <<EOF
2496 #define GCC_$cf_ATTRIBUTE 1
2500 cat >conftest.h <<EOF
2501 #define GCC_$cf_ATTRIBUTE $cf_directive
2506 if AC_TRY_EVAL(ac_compile); then
2507 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
2508 cat conftest.h >>confdefs.h
2509 case $cf_attribute in
2511 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
2514 cf_value='/* nothing */'
2515 if test "$cf_printf_attribute" != no ; then
2516 cf_value='__attribute__((format(printf,fmt,var)))'
2517 AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
2519 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
2522 cf_value='/* nothing */'
2523 if test "$cf_scanf_attribute" != no ; then
2524 cf_value='__attribute__((format(scanf,fmt,var)))'
2525 AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
2527 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
2530 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
2536 fgrep define conftest.i >>confdefs.h
2541 dnl ---------------------------------------------------------------------------
2542 dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36
2544 dnl Find version of gcc, and (because icc/clang pretend to be gcc without being
2545 dnl compatible), attempt to determine if icc/clang is actually used.
2546 AC_DEFUN([CF_GCC_VERSION],[
2547 AC_REQUIRE([AC_PROG_CC])
2549 if test "$GCC" = yes ; then
2550 AC_MSG_CHECKING(version of $CC)
2551 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
2552 test -z "$GCC_VERSION" && GCC_VERSION=unknown
2553 AC_MSG_RESULT($GCC_VERSION)
2555 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
2556 CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
2558 dnl ---------------------------------------------------------------------------
2559 dnl CF_GCC_WARNINGS version: 36 updated: 2019/09/07 13:38:36
2561 dnl Check if the compiler supports useful warning options. There's a few that
2562 dnl we don't use, simply because they're too noisy:
2564 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
2565 dnl -Wredundant-decls (system headers make this too noisy)
2566 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
2567 dnl -Wwrite-strings (too noisy, but should review occasionally). This
2568 dnl is enabled for ncurses using "--enable-const".
2572 dnl $1 is an optional list of gcc warning flags that a particular
2573 dnl application might want to use, e.g., "no-unused" for
2576 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
2578 AC_DEFUN([CF_GCC_WARNINGS],
2580 AC_REQUIRE([CF_GCC_VERSION])
2581 if test "x$have_x" = xyes; then CF_CONST_X_STRING fi
2582 cat > conftest.$ac_ext <<EOF
2583 #line __oline__ "${as_me:-configure}"
2584 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
2586 if test "$INTEL_COMPILER" = yes
2588 # The "-wdXXX" options suppress warnings:
2589 # remark #1419: external declaration in primary source file
2590 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
2591 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
2592 # remark #193: zero used for undefined preprocessing identifier
2593 # remark #593: variable "curs_sb_left_arrow" was set but never used
2594 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
2595 # remark #869: parameter "tw" was never referenced
2596 # remark #981: operands are evaluated in unspecified order
2597 # warning #279: controlling expression is constant
2599 AC_CHECKING([for $CC warning options])
2600 cf_save_CFLAGS="$CFLAGS"
2601 EXTRA_CFLAGS="-Wall"
2613 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2614 if AC_TRY_EVAL(ac_compile); then
2615 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2616 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2619 CFLAGS="$cf_save_CFLAGS"
2620 elif test "$GCC" = yes
2622 AC_CHECKING([for $CC warning options])
2623 cf_save_CFLAGS="$CFLAGS"
2626 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
2627 cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs"
2628 test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings=
2629 for cf_opt in W Wall \
2630 Wbad-function-cast \
2633 Wdeclaration-after-statement \
2636 Wmissing-declarations \
2637 Wmissing-prototypes \
2641 Wstrict-prototypes \
2642 Wundef $cf_gcc_warnings $cf_warn_CONST $1
2644 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2645 if AC_TRY_EVAL(ac_compile); then
2646 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2649 case $GCC_VERSION in
2651 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2656 case $GCC_VERSION in
2658 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2663 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2666 CFLAGS="$cf_save_CFLAGS"
2670 AC_SUBST(EXTRA_CFLAGS)
2672 dnl ---------------------------------------------------------------------------
2673 dnl CF_GETOPT_HEADER version: 6 updated: 2014/07/22 14:45:54
2674 dnl ----------------
2675 dnl Check for getopt's variables which are commonly defined in stdlib.h,
2676 dnl unistd.h or (nonstandard) in getopt.h
2677 AC_DEFUN([CF_GETOPT_HEADER],
2679 AC_HAVE_HEADERS(unistd.h getopt.h)
2680 AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
2681 cf_cv_getopt_header=none
2682 for cf_header in stdio.h stdlib.h unistd.h getopt.h
2685 #include <$cf_header>],
2686 [int x = optind; char *y = optarg],
2687 [cf_cv_getopt_header=$cf_header
2691 if test $cf_cv_getopt_header != none ; then
2692 AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if getopt variables are declared in header])
2694 if test $cf_cv_getopt_header = getopt.h ; then
2695 AC_DEFINE(NEED_GETOPT_H,1,[Define to 1 if we must include getopt.h])
2698 dnl ---------------------------------------------------------------------------
2699 dnl CF_GNATPREP_OPT_T version: 1 updated: 2014/08/02 18:37:25
2700 dnl -----------------
2701 AC_DEFUN([CF_GNATPREP_OPT_T],[
2702 AC_CACHE_CHECK(if GNATPREP supports -T option,cf_cv_gnatprep_opt_t,[
2703 cf_cv_gnatprep_opt_t=no
2704 gnatprep -T 2>/dev/null >/dev/null && cf_cv_gnatprep_opt_t=yes
2706 test "$cf_cv_gnatprep_opt_t" = yes && GNATPREP_OPTS="-T $GNATPREP_OPTS"
2707 AC_SUBST(GNATPREP_OPTS)
2709 dnl ---------------------------------------------------------------------------
2710 dnl CF_GNAT_GENERICS version: 3 updated: 2015/04/17 21:13:04
2711 dnl ----------------
2712 AC_DEFUN([CF_GNAT_GENERICS],
2714 AC_REQUIRE([CF_GNAT_VERSION])
2716 AC_MSG_CHECKING(if GNAT supports generics)
2717 case $cf_gnat_version in
2718 (3.[[1-9]]*|[[4-9]].*)
2719 cf_gnat_generics=yes
2725 AC_MSG_RESULT($cf_gnat_generics)
2727 if test "$cf_gnat_generics" = yes
2729 cf_compile_generics=generics
2730 cf_generic_objects="\${GENOBJS}"
2732 cf_compile_generics=
2736 AC_SUBST(cf_compile_generics)
2737 AC_SUBST(cf_generic_objects)
2739 dnl ---------------------------------------------------------------------------
2740 dnl CF_GNAT_PROJECTS version: 9 updated: 2018/01/14 15:46:09
2741 dnl ----------------
2742 dnl GNAT projects are configured with ".gpr" project files.
2743 dnl GNAT libraries are a further development, using the project feature.
2744 AC_DEFUN([CF_GNAT_PROJECTS],
2746 AC_REQUIRE([CF_GNAT_VERSION])
2747 AC_REQUIRE([CF_DISABLE_GNAT_PROJECTS])
2749 cf_gnat_libraries=no
2752 if test "$enable_gnat_projects" != no ; then
2753 AC_MSG_CHECKING(if GNAT supports project files)
2754 case $cf_gnat_version in
2758 case $cf_cv_system_name in
2762 rm -rf conftest* *~conftest*
2763 if mkdir conftest.src conftest.bin conftest.lib
2766 rm -rf conftest* *~conftest*
2767 cat >>library.gpr <<CF_EOF
2769 Kind := External ("LIB_KIND");
2770 for Library_Name use "ConfTest";
2771 for Object_Dir use ".";
2772 for Library_ALI_Dir use External("LIBRARY_DIR");
2773 for Library_Version use External ("SONAME");
2774 for Library_Kind use Kind;
2775 for Library_Dir use External("BUILD_DIR");
2776 Source_Dir := External ("SOURCE_DIR");
2777 for Source_Dirs use (Source_Dir);
2780 cat >>confpackage.ads <<CF_EOF
2781 package ConfPackage is
2785 cat >>confpackage.adb <<CF_EOF
2787 package body ConfPackage is
2788 procedure conftest is
2790 Text_IO.Put ("Hello World");
2795 if ( $cf_ada_make $ADAFLAGS \
2797 -XBUILD_DIR=`cd ../conftest.bin;pwd` \
2798 -XLIBRARY_DIR=`cd ../conftest.lib;pwd` \
2799 -XSOURCE_DIR=`pwd` \
2800 -XSONAME=libConfTest.so.1 \
2801 -XLIB_KIND=static 1>&AC_FD_CC 2>&1 ) ; then
2802 cf_gnat_projects=yes
2806 if test -f conftest.lib/confpackage.ali
2808 cf_gnat_libraries=yes
2810 rm -rf conftest* *~conftest*
2815 AC_MSG_RESULT($cf_gnat_projects)
2816 fi # enable_gnat_projects
2818 if test $cf_gnat_projects = yes
2820 AC_MSG_CHECKING(if GNAT supports libraries)
2821 AC_MSG_RESULT($cf_gnat_libraries)
2824 if test "$cf_gnat_projects" = yes
2826 USE_OLD_MAKERULES="#"
2827 USE_GNAT_PROJECTS=""
2829 USE_OLD_MAKERULES=""
2830 USE_GNAT_PROJECTS="#"
2833 if test "$cf_gnat_libraries" = yes
2835 USE_GNAT_LIBRARIES=""
2837 USE_GNAT_LIBRARIES="#"
2840 AC_SUBST(USE_OLD_MAKERULES)
2841 AC_SUBST(USE_GNAT_PROJECTS)
2842 AC_SUBST(USE_GNAT_LIBRARIES)
2844 dnl ---------------------------------------------------------------------------
2845 dnl CF_GNAT_SIGINT version: 1 updated: 2011/03/27 20:07:59
2847 dnl Check if gnat supports SIGINT, and presumably tasking. For the latter, it
2848 dnl is noted that gnat may compile a tasking unit even for configurations which
2849 dnl fail at runtime.
2850 AC_DEFUN([CF_GNAT_SIGINT],[
2851 AC_CACHE_CHECK(if GNAT supports SIGINT,cf_cv_gnat_sigint,[
2852 CF_GNAT_TRY_LINK([with Ada.Interrupts.Names;
2856 pragma Warnings (Off); -- the next pragma exists since 3.11p
2857 pragma Unreserve_All_Interrupts;
2858 pragma Warnings (On);
2860 protected Process is
2862 function Continue return Boolean;
2863 pragma Attach_Handler (Stop, Ada.Interrupts.Names.SIGINT);
2865 Done : Boolean := False;
2869 [package body ConfTest is
2870 protected body Process is
2875 function Continue return Boolean is
2881 [cf_cv_gnat_sigint=yes],
2882 [cf_cv_gnat_sigint=no])])
2884 if test $cf_cv_gnat_sigint = yes ; then
2889 AC_SUBST(USE_GNAT_SIGINT)
2891 dnl ---------------------------------------------------------------------------
2892 dnl CF_GNAT_TRY_LINK version: 3 updated: 2011/03/19 14:47:45
2893 dnl ----------------
2894 dnl Verify that a test program compiles/links with GNAT.
2895 dnl $cf_ada_make is set to the program that compiles/links
2896 dnl $ADAFLAGS may be set to the GNAT flags.
2898 dnl $1 is the text of the spec
2899 dnl $2 is the text of the body
2900 dnl $3 is the shell command to execute if successful
2901 dnl $4 is the shell command to execute if not successful
2902 AC_DEFUN([CF_GNAT_TRY_LINK],
2904 rm -rf conftest* *~conftest*
2905 cat >>conftest.ads <<CF_EOF
2908 cat >>conftest.adb <<CF_EOF
2911 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
2912 ifelse($3,, :,[ $3])
2916 rm -rf conftest* *~conftest*
2918 dnl ---------------------------------------------------------------------------
2919 dnl CF_GNAT_TRY_RUN version: 5 updated: 2011/03/19 14:47:45
2921 dnl Verify that a test program compiles and runs with GNAT
2922 dnl $cf_ada_make is set to the program that compiles/links
2923 dnl $ADAFLAGS may be set to the GNAT flags.
2925 dnl $1 is the text of the spec
2926 dnl $2 is the text of the body
2927 dnl $3 is the shell command to execute if successful
2928 dnl $4 is the shell command to execute if not successful
2929 AC_DEFUN([CF_GNAT_TRY_RUN],
2931 rm -rf conftest* *~conftest*
2932 cat >>conftest.ads <<CF_EOF
2935 cat >>conftest.adb <<CF_EOF
2938 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
2939 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
2940 ifelse($3,, :,[ $3])
2947 rm -rf conftest* *~conftest*
2949 dnl ---------------------------------------------------------------------------
2950 dnl CF_GNAT_VERSION version: 20 updated: 2015/04/18 08:56:57
2952 dnl Verify version of GNAT.
2953 AC_DEFUN([CF_GNAT_VERSION],
2955 AC_MSG_CHECKING(for gnat version)
2956 cf_gnat_version=`${cf_ada_make:-gnatmake} -v 2>&1 | \
2957 grep '[[0-9]].[[0-9]][[0-9]]*' |\
2958 sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
2959 AC_MSG_RESULT($cf_gnat_version)
2961 case $cf_gnat_version in
2962 (3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|20[[0-9]][[0-9]])
2963 cf_cv_prog_gnat_correct=yes
2966 AC_MSG_WARN(Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding.)
2967 cf_cv_prog_gnat_correct=no
2971 dnl ---------------------------------------------------------------------------
2972 dnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41
2974 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
2975 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
2976 dnl (or misfeature) of glibc2, which breaks portability of many applications,
2977 dnl since it is interwoven with GNU extensions.
2979 dnl Well, yes we could work around it...
2982 dnl $1 is the nominal value for _XOPEN_SOURCE
2983 AC_DEFUN([CF_GNU_SOURCE],
2985 cf_gnu_xopen_source=ifelse($1,,500,$1)
2987 AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[
2988 AC_TRY_COMPILE([#include <sys/types.h>],[
2989 #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0
2991 #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0
2994 # error not GNU C library
2996 [cf_cv_gnu_library=yes],
2997 [cf_cv_gnu_library=no])
3000 if test x$cf_cv_gnu_library = xyes; then
3002 # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE
3003 # was changed to help a little. newlib incorporated the change about 4
3005 AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[
3007 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
3008 AC_TRY_COMPILE([#include <sys/types.h>],[
3009 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2)
3011 #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3)
3014 # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old
3016 [cf_cv_gnu_library_219=yes],
3017 [cf_cv_gnu_library_219=no])
3021 if test "x$cf_cv_gnu_library_219" = xyes; then
3023 AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[
3024 CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source)
3027 #include <sys/types.h>
3029 #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1)
3032 # error GNU C library is too old
3034 [cf_cv_gnu_dftsrc_219=yes],
3035 [cf_cv_gnu_dftsrc_219=no])
3037 test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save"
3039 cf_cv_gnu_dftsrc_219=maybe
3042 if test "x$cf_cv_gnu_dftsrc_219" != xyes; then
3044 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
3045 AC_TRY_COMPILE([#include <sys/types.h>],[
3046 #ifndef _XOPEN_SOURCE
3047 #error expected _XOPEN_SOURCE to be defined
3049 [cf_cv_gnu_source=no],
3050 [cf_save="$CPPFLAGS"
3051 CF_ADD_CFLAGS(-D_GNU_SOURCE)
3052 AC_TRY_COMPILE([#include <sys/types.h>],[
3053 #ifdef _XOPEN_SOURCE
3054 #error expected _XOPEN_SOURCE to be undefined
3056 [cf_cv_gnu_source=no],
3057 [cf_cv_gnu_source=yes])
3062 if test "$cf_cv_gnu_source" = yes
3064 AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[
3065 CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE)
3066 AC_TRY_COMPILE([#include <sys/types.h>],[
3067 #ifdef _DEFAULT_SOURCE
3068 #error expected _DEFAULT_SOURCE to be undefined
3070 [cf_cv_default_source=no],
3071 [cf_cv_default_source=yes])
3073 if test "$cf_cv_default_source" = yes
3075 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
3082 dnl ---------------------------------------------------------------------------
3083 dnl CF_GPP_LIBRARY version: 12 updated: 2015/04/17 21:13:04
3085 dnl If we're trying to use g++, test if libg++ is installed (a rather common
3086 dnl problem :-). If we have the compiler but no library, we'll be able to
3087 dnl configure, but won't be able to build the c++ demo program.
3088 AC_DEFUN([CF_GPP_LIBRARY],
3090 cf_cxx_library=unknown
3091 case $cf_cv_system_name in
3099 if test "$GXX" = yes; then
3100 AC_MSG_CHECKING([for lib$cf_gpp_libname])
3102 CF_ADD_LIB($cf_gpp_libname)
3104 #include <$cf_gpp_libname/builtin.h>
3106 [two_arg_error_handler_t foo2 = lib_error_handler],
3108 CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
3109 if test "$cf_gpp_libname" = cpp ; then
3110 AC_DEFINE(HAVE_GPP_BUILTIN_H,1,[Define to 1 if we have gpp builtin.h])
3112 AC_DEFINE(HAVE_GXX_BUILTIN_H,1,[Define to 1 if we have g++ builtin.h])
3115 #include <builtin.h>
3117 [two_arg_error_handler_t foo2 = lib_error_handler],
3119 CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
3120 AC_DEFINE(HAVE_BUILTIN_H,1,[Define to 1 if we have builtin.h])],
3121 [cf_cxx_library=no])])
3123 AC_MSG_RESULT($cf_cxx_library)
3126 dnl ---------------------------------------------------------------------------
3127 dnl CF_GXX_VERSION version: 8 updated: 2017/02/11 14:48:57
3129 dnl Check for version of g++
3130 AC_DEFUN([CF_GXX_VERSION],[
3131 AC_REQUIRE([AC_PROG_CPP])
3133 if test "$GXX" = yes; then
3134 AC_MSG_CHECKING(version of ${CXX:-g++})
3135 GXX_VERSION="`${CXX:-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
3136 if test -z "$GXX_VERSION"
3141 AC_MSG_RESULT($GXX_VERSION)
3144 dnl ---------------------------------------------------------------------------
3145 dnl CF_GXX_WARNINGS version: 9 updated: 2015/04/17 21:13:04
3147 dnl Check if the compiler supports useful warning options.
3149 dnl Most of gcc's options apply to g++, except:
3150 dnl -Wbad-function-cast
3151 dnl -Wmissing-declarations
3152 dnl -Wnested-externs
3154 dnl Omit a few (for now):
3158 dnl $1 is an optional list of g++ warning flags that a particular
3159 dnl application might want to use, e.g., "no-unused" for
3162 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
3164 AC_DEFUN([CF_GXX_WARNINGS],
3167 CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS)
3168 CF_CLANG_COMPILER(GXX,CLANG_CPLUSPLUS,CXXFLAGS)
3170 AC_REQUIRE([CF_GXX_VERSION])
3175 cat > conftest.$ac_ext <<EOF
3176 #line __oline__ "configure"
3177 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
3180 if test "$INTEL_CPLUSPLUS" = yes
3182 # The "-wdXXX" options suppress warnings:
3183 # remark #1419: external declaration in primary source file
3184 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
3185 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
3186 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
3187 # remark #193: zero used for undefined preprocessing identifier
3188 # remark #593: variable "curs_sb_left_arrow" was set but never used
3189 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
3190 # remark #869: parameter "tw" was never referenced
3191 # remark #981: operands are evaluated in unspecified order
3192 # warning #269: invalid format string conversion
3194 AC_CHECKING([for $CC warning options])
3195 cf_save_CXXFLAGS="$CXXFLAGS"
3196 EXTRA_CXXFLAGS="-Wall"
3209 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt"
3210 if AC_TRY_EVAL(ac_compile); then
3211 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
3212 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
3215 CXXFLAGS="$cf_save_CXXFLAGS"
3217 elif test "$GXX" = yes
3219 AC_CHECKING([for $CXX warning options])
3220 cf_save_CXXFLAGS="$CXXFLAGS"
3221 EXTRA_CXXFLAGS="-W -Wall"
3222 cf_gxx_extra_warnings=""
3223 test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings"
3224 case "$GCC_VERSION" in
3228 cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++"
3235 Wignored-qualifiers \
3237 Woverloaded-virtual \
3245 Wundef $cf_gxx_extra_warnings $1
3247 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt"
3248 if AC_TRY_EVAL(ac_compile); then
3249 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
3250 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
3252 test -n "$verbose" && AC_MSG_RESULT(... no -$cf_opt)
3255 CXXFLAGS="$cf_save_CXXFLAGS"
3260 AC_SUBST(EXTRA_CXXFLAGS)
3262 dnl ---------------------------------------------------------------------------
3263 dnl CF_HASHED_DB version: 7 updated: 2015/04/18 08:56:57
3265 dnl Look for an instance of the Berkeley hashed database.
3267 dnl $1 = optional parameter, to specify install-prefix for the database.
3268 AC_DEFUN([CF_HASHED_DB],
3275 if test -d "$1" ; then
3276 CF_ADD_INCDIR($1/include)
3277 CF_ADD_LIBDIR($1/lib)
3281 AC_MSG_WARN(no such directory $1)
3284 CF_FIND_SUB_INCDIR($1)
3285 CF_FIND_SUB_LIBDIR($1)
3291 AC_CHECK_HEADER(db.h,[
3292 CF_HASHED_DB_VERSION
3293 if test "$cf_cv_hashed_db_version" = unknown ; then
3294 AC_MSG_ERROR(Cannot determine version of db)
3297 if test "$cf_cv_hashed_db_libs" = unknown ; then
3298 AC_MSG_ERROR(Cannot determine library for db)
3299 elif test "$cf_cv_hashed_db_libs" != default ; then
3300 CF_ADD_LIB($cf_cv_hashed_db_libs)
3304 AC_MSG_ERROR(Cannot find db.h)
3307 dnl ---------------------------------------------------------------------------
3308 dnl CF_HASHED_DB_LIBS version: 9 updated: 2010/05/29 16:31:02
3309 dnl -----------------
3310 dnl Given that we have the header and version for hashed database, find the
3311 dnl library information.
3312 AC_DEFUN([CF_HASHED_DB_LIBS],
3314 AC_CACHE_CHECK(for db libraries, cf_cv_hashed_db_libs,[
3315 cf_cv_hashed_db_libs=unknown
3316 for cf_db_libs in "" db$cf_cv_hashed_db_version db-$cf_cv_hashed_db_version db ''
3318 cf_save_libs="$LIBS"
3319 if test -n "$cf_db_libs"; then
3320 CF_ADD_LIB($cf_db_libs)
3322 CF_MSG_LOG(checking for library "$cf_db_libs")
3324 $ac_includes_default
3327 char *path = "/tmp/foo";
3328 #ifdef DB_VERSION_MAJOR
3329 #if DB_VERSION_MAJOR >= 4
3331 db_create(&result, NULL, 0);
3332 result->open(result,
3339 #elif DB_VERSION_MAJOR >= 3
3341 db_create(&result, NULL, 0);
3342 result->open(result,
3348 #elif DB_VERSION_MAJOR >= 2
3357 #endif /* DB_VERSION_MAJOR */
3359 DB *result = dbopen(path,
3365 ${cf_cv_main_return:-return}(result != 0)
3367 if test -n "$cf_db_libs" ; then
3368 cf_cv_hashed_db_libs=$cf_db_libs
3370 cf_cv_hashed_db_libs=default
3372 LIBS="$cf_save_libs"
3375 LIBS="$cf_save_libs"
3379 dnl ---------------------------------------------------------------------------
3380 dnl CF_HASHED_DB_VERSION version: 4 updated: 2014/04/12 16:47:01
3381 dnl --------------------
3382 dnl Given that we have the header file for hashed database, find the version
3384 AC_DEFUN([CF_HASHED_DB_VERSION],
3386 AC_CACHE_CHECK(for version of db, cf_cv_hashed_db_version,[
3387 cf_cv_hashed_db_version=unknown
3389 for cf_db_version in 1 2 3 4 5 6
3391 CF_MSG_LOG(checking for db version $cf_db_version)
3393 $ac_includes_default
3396 #ifdef DB_VERSION_MAJOR
3397 /* db2 (DB_VERSION_MAJOR=2) has also DB_VERSION_MINOR, tested with 7 */
3398 #if $cf_db_version == DB_VERSION_MAJOR
3404 #if $cf_db_version == 1
3405 /* ok: assuming this is DB 1.8.5 */
3411 cf_cv_hashed_db_version=$cf_db_version
3417 dnl ---------------------------------------------------------------------------
3418 dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48
3420 dnl Construct a search-list of directories for a nonstandard header-file
3423 dnl $1 = the variable to return as result
3424 dnl $2 = the package name
3425 AC_DEFUN([CF_HEADER_PATH],
3429 # collect the current set of include-directories from compiler flags
3430 cf_header_path_list=""
3431 if test -n "${CFLAGS}${CPPFLAGS}" ; then
3432 for cf_header_path in $CPPFLAGS $CFLAGS
3434 case $cf_header_path in
3436 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
3437 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
3438 cf_header_path_list="$cf_header_path_list [$]$1"
3444 # add the variations for the package we are looking for
3445 CF_SUBDIR_PATH($1,$2,include)
3447 test "$includedir" != NONE && \
3448 test "$includedir" != "/usr/include" && \
3449 test -d "$includedir" && {
3450 test -d $includedir && $1="[$]$1 $includedir"
3451 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
3454 test "$oldincludedir" != NONE && \
3455 test "$oldincludedir" != "/usr/include" && \
3456 test -d "$oldincludedir" && {
3457 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
3458 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
3461 $1="[$]$1 $cf_header_path_list"
3463 dnl ---------------------------------------------------------------------------
3464 dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
3466 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
3467 AC_DEFUN([CF_HELP_MESSAGE],
3468 [AC_DIVERT_HELP([$1])dnl
3470 dnl ---------------------------------------------------------------------------
3471 dnl CF_INCLUDE_DIRS version: 10 updated: 2014/09/19 20:58:42
3473 dnl Construct the list of include-options according to whether we're building
3474 dnl in the source directory or using '--srcdir=DIR' option.
3475 AC_DEFUN([CF_INCLUDE_DIRS],
3477 if test "$srcdir" != "."; then
3478 CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS"
3480 CPPFLAGS="-I../include $CPPFLAGS"
3481 if test "$srcdir" != "."; then
3482 CPPFLAGS="-I\${srcdir} $CPPFLAGS"
3484 CPPFLAGS="-I. $CPPFLAGS"
3487 dnl ---------------------------------------------------------------------------
3488 dnl CF_INSTALL_OPTS version: 2 updated: 2018/08/18 12:19:21
3490 dnl prompt for/fill-in useful install-program options
3491 AC_DEFUN([CF_INSTALL_OPTS],
3497 dnl ---------------------------------------------------------------------------
3498 dnl CF_INSTALL_OPT_O version: 2 updated: 2015/05/15 19:45:35
3499 dnl ----------------
3500 dnl Almost all "install" programs default to the current user's ownership.
3501 dnl Almost - MINIX is an exception.
3502 AC_DEFUN([CF_INSTALL_OPT_O],
3504 AC_MSG_CHECKING(if install needs to be told about ownership)
3505 case `$ac_config_guess` in
3514 AC_MSG_RESULT($with_install_o)
3515 if test "x$with_install_o" = xyes
3517 INSTALL_OPT_O=`id root|sed -e 's/uid=[[0-9]]*(/ -o /' -e 's/gid=[[0-9]]*(/ -g /' -e 's/ [[^=[:space:]]][[^=[:space:]]]*=.*/ /' -e 's/)//g'`
3522 AC_SUBST(INSTALL_OPT_O)
3524 dnl ---------------------------------------------------------------------------
3525 dnl CF_INSTALL_OPT_P version: 1 updated: 2018/08/18 12:19:21
3526 dnl ----------------
3527 dnl Some install-programs accept a "-p" option to preserve file modification
3528 dnl timestamps. That can be useful as an install option, as well as a way to
3529 dnl avoid the need for ranlib after copying a static archive.
3530 AC_DEFUN([CF_INSTALL_OPT_P],
3532 : ${INSTALL:=install}
3533 AC_CACHE_CHECK(if install accepts -p option, cf_cv_install_p,[
3538 if $INSTALL -p conftest.in conftest.out 2>/dev/null
3540 if test -f conftest.out/conftest.in
3542 test conftest.in -nt conftest.out/conftest.in 2>conftest.err && \
3543 test conftest.out/conftest.in -nt conftest.in 2>conftest.err
3544 if test -s conftest.err
3559 dnl ---------------------------------------------------------------------------
3560 dnl CF_INSTALL_OPT_S version: 2 updated: 2018/08/18 12:19:21
3561 dnl ----------------
3562 dnl By default, we should strip executables which are installed, but leave the
3563 dnl ability to suppress that for unit-testing.
3564 AC_DEFUN([CF_INSTALL_OPT_S],
3566 AC_MSG_CHECKING(if you want to install stripped executables)
3567 CF_ARG_DISABLE(stripping,
3568 [ --disable-stripping do not strip (debug info) installed executables],
3569 [with_stripping=no],
3570 [with_stripping=yes])
3571 AC_MSG_RESULT($with_stripping)
3573 if test "$with_stripping" = yes
3579 AC_SUBST(INSTALL_OPT_S)
3581 dnl ---------------------------------------------------------------------------
3582 dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00
3583 dnl -----------------
3584 dnl Check if the given compiler is really the Intel compiler for Linux. It
3585 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
3586 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
3588 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
3589 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
3590 dnl the wrappers for gcc and g++ warnings.
3592 dnl $1 = GCC (default) or GXX
3593 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
3594 dnl $3 = CFLAGS (default) or CXXFLAGS
3595 AC_DEFUN([CF_INTEL_COMPILER],[
3596 AC_REQUIRE([AC_CANONICAL_HOST])
3597 ifelse([$2],,INTEL_COMPILER,[$2])=no
3599 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
3602 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
3603 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
3604 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
3606 #ifdef __INTEL_COMPILER
3610 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
3611 cf_save_CFLAGS="$cf_save_CFLAGS -we147"
3613 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
3614 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
3619 dnl ---------------------------------------------------------------------------
3620 dnl CF_ISASCII version: 4 updated: 2012/10/06 17:56:13
3622 dnl Check if we have either a function or macro for 'isascii()'.
3623 AC_DEFUN([CF_ISASCII],
3625 AC_MSG_CHECKING(for isascii)
3626 AC_CACHE_VAL(cf_cv_have_isascii,[
3627 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
3628 [cf_cv_have_isascii=yes],
3629 [cf_cv_have_isascii=no])
3631 AC_MSG_RESULT($cf_cv_have_isascii)
3632 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII,1,[Define to 1 if we have isascii()])
3634 dnl ---------------------------------------------------------------------------
3635 dnl CF_LARGEFILE version: 11 updated: 2018/06/20 20:23:13
3637 dnl Add checks for large file support.
3638 AC_DEFUN([CF_LARGEFILE],[
3639 ifdef([AC_FUNC_FSEEKO],[
3641 if test "$enable_largefile" != no ; then
3644 # Normally we would collect these definitions in the config.h,
3645 # but (like _XOPEN_SOURCE), some environments rely on having these
3646 # defined before any of the system headers are included. Another
3647 # case comes up with C++, e.g., on AIX the compiler compiles the
3648 # header files by themselves before looking at the body files it is
3649 # told to compile. For ncurses, those header files do not include
3651 if test "$ac_cv_sys_large_files" != no
3653 CF_APPEND_TEXT(CPPFLAGS,-D_LARGE_FILES)
3655 if test "$ac_cv_sys_largefile_source" != no
3657 CF_APPEND_TEXT(CPPFLAGS,-D_LARGEFILE_SOURCE)
3659 if test "$ac_cv_sys_file_offset_bits" != no
3661 CF_APPEND_TEXT(CPPFLAGS,-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits)
3664 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
3666 #pragma GCC diagnostic error "-Wincompatible-pointer-types"
3667 #include <sys/types.h>
3670 /* if transitional largefile support is setup, this is true */
3671 extern struct dirent64 * readdir(DIR *);
3672 struct dirent64 *x = readdir((DIR *)0);
3673 struct dirent *y = readdir((DIR *)0);
3676 [cf_cv_struct_dirent64=yes],
3677 [cf_cv_struct_dirent64=no])
3679 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
3683 dnl ---------------------------------------------------------------------------
3684 dnl CF_LDFLAGS_STATIC version: 12 updated: 2015/04/18 08:56:57
3685 dnl -----------------
3686 dnl Check for compiler/linker flags used to temporarily force usage of static
3687 dnl libraries. This depends on the compiler and platform. Use this to help
3688 dnl ensure that the linker picks up a given library based on its position in
3689 dnl the list of linker options and libraries.
3690 AC_DEFUN([CF_LDFLAGS_STATIC],[
3692 if test "$GCC" = yes ; then
3693 case $cf_cv_system_name in
3694 (OS/2*|os2*|aix[[4]]*|solaris2.1[[0-9]]|darwin*)
3698 (*) # normally, except when broken
3699 LDFLAGS_STATIC=-static
3700 LDFLAGS_SHARED=-dynamic
3704 case $cf_cv_system_name in
3705 (aix[[4-7]]*) # from ld manpage
3706 LDFLAGS_STATIC=-bstatic
3707 LDFLAGS_SHARED=-bdynamic
3709 (hpux*) # from ld manpage for hpux10.20, hpux11.11
3710 # We could also use just "archive" and "shared".
3711 LDFLAGS_STATIC=-Wl,-a,archive_shared
3712 LDFLAGS_SHARED=-Wl,-a,shared_archive
3714 (irix*) # from ld manpage IRIX64
3715 LDFLAGS_STATIC=-Bstatic
3716 LDFLAGS_SHARED=-Bdynamic
3718 (osf[[45]]*) # from ld manpage osf4.0d, osf5.1
3719 # alternative "-oldstyle_liblookup" (not in cc manpage)
3720 LDFLAGS_STATIC=-noso
3721 LDFLAGS_SHARED=-so_archive
3724 LDFLAGS_STATIC=-Bstatic
3725 LDFLAGS_SHARED=-Bdynamic
3730 if test -n "$LDFLAGS_STATIC" && test -n "$LDFLAGS_SHARED"
3732 AC_MSG_CHECKING(if linker supports switching between static/dynamic)
3735 cat >conftest.$ac_ext <<EOF
3736 #line __oline__ "configure"
3738 int cf_ldflags_static(FILE *fp) { return fflush(fp); }
3740 if AC_TRY_EVAL(ac_compile) ; then
3741 ( $AR $ARFLAGS libconftest.a conftest.o ) 2>&AC_FD_CC 1>/dev/null
3742 ( eval $RANLIB libconftest.a ) 2>&AC_FD_CC >/dev/null
3746 cf_save_LIBS="$LIBS"
3748 LIBS="$LDFLAGS_STATIC -L`pwd` -lconftest $LDFLAGS_DYNAMIC $LIBS"
3750 #line __oline__ "configure"
3752 int cf_ldflags_static(FILE *fp);
3754 return cf_ldflags_static(stdin);
3756 # some linkers simply ignore the -dynamic
3757 case x`file conftest$ac_exeext 2>/dev/null` in
3759 cf_ldflags_static=no
3762 cf_ldflags_static=yes
3765 ],[cf_ldflags_static=no])
3768 LIBS="$cf_save_LIBS"
3770 AC_MSG_RESULT($cf_ldflags_static)
3772 if test $cf_ldflags_static != yes
3782 AC_SUBST(LDFLAGS_STATIC)
3783 AC_SUBST(LDFLAGS_SHARED)
3785 dnl ---------------------------------------------------------------------------
3786 dnl CF_LD_RPATH_OPT version: 8 updated: 2018/08/18 16:36:35
3788 dnl For the given system and compiler, find the compiler flags to pass to the
3789 dnl loader to use the "rpath" feature.
3790 AC_DEFUN([CF_LD_RPATH_OPT],
3792 AC_REQUIRE([CF_CHECK_CACHE])
3795 if test "x$cf_cv_enable_rpath" != xno
3797 AC_MSG_CHECKING(for an rpath option)
3798 case $cf_cv_system_name in
3800 if test "$GCC" = yes; then
3801 LD_RPATH_OPT="-Wl,-rpath,"
3803 LD_RPATH_OPT="-rpath "
3806 (linux*|gnu*|k*bsd*-gnu|freebsd*)
3807 LD_RPATH_OPT="-Wl,-rpath,"
3809 (openbsd[[2-9]].*|mirbsd*)
3810 LD_RPATH_OPT="-Wl,-rpath,"
3813 LD_RPATH_OPT="-rpath "
3816 LD_RPATH_OPT="-Wl,-rpath,"
3819 LD_RPATH_OPT="-rpath "
3827 AC_MSG_RESULT($LD_RPATH_OPT)
3829 case "x$LD_RPATH_OPT" in
3831 AC_MSG_CHECKING(if we need a space after rpath option)
3832 cf_save_LIBS="$LIBS"
3833 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
3834 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
3835 LIBS="$cf_save_LIBS"
3836 AC_MSG_RESULT($cf_rpath_space)
3837 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
3842 dnl ---------------------------------------------------------------------------
3843 dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48
3845 dnl Construct a search-list of directories for a nonstandard library-file
3848 dnl $1 = the variable to return as result
3849 dnl $2 = the package name
3850 AC_DEFUN([CF_LIBRARY_PATH],
3853 cf_library_path_list=""
3854 if test -n "${LDFLAGS}${LIBS}" ; then
3855 for cf_library_path in $LDFLAGS $LIBS
3857 case $cf_library_path in
3859 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
3860 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
3861 cf_library_path_list="$cf_library_path_list [$]$1"
3867 CF_SUBDIR_PATH($1,$2,lib)
3869 $1="$cf_library_path_list [$]$1"
3871 dnl ---------------------------------------------------------------------------
3872 dnl CF_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
3873 dnl ------------------
3874 AC_DEFUN([CF_LIBTOOL_VERSION],[
3875 if test -n "$LIBTOOL" && test "$LIBTOOL" != none
3877 cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
3879 cf_cv_libtool_version=
3881 test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version
3883 dnl ---------------------------------------------------------------------------
3884 dnl CF_LIB_PREFIX version: 12 updated: 2015/10/17 19:03:33
3886 dnl Compute the library-prefix for the given host system
3887 dnl $1 = variable to set
3888 define([CF_LIB_PREFIX],
3890 case $cf_cv_system_name in
3892 if test "$DFT_LWR_MODEL" = libtool; then
3898 (*) LIB_PREFIX='lib'
3901 ifelse($1,,,[$1=$LIB_PREFIX])
3902 AC_SUBST(LIB_PREFIX)
3904 dnl ---------------------------------------------------------------------------
3905 dnl CF_LIB_RULES version: 88 updated: 2018/08/18 12:19:21
3907 dnl Append definitions and rules for the given models to the subdirectory
3908 dnl Makefiles, and the recursion rule for the top-level Makefile. If the
3909 dnl subdirectory is a library-source directory, modify the Libs_To_Make list in
3910 dnl the corresponding makefile to list the models that we'll generate.
3912 dnl For shared libraries, make a list of symbolic links to construct when
3913 dnl generating each library. The convention used for Linux is the simplest
3916 dnl lib<name>.so.<major> ->
3917 dnl lib<name>.so.<maj>.<minor>
3919 dnl Note: Libs_To_Make is mixed case, since it is not a pure autoconf variable.
3920 AC_DEFUN([CF_LIB_RULES],
3922 cf_prefix=$LIB_PREFIX
3923 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
3925 case $cf_cv_shlib_version in
3926 (cygdll|msysdll|mingw)
3927 TINFO_NAME=$TINFO_ARG_SUFFIX
3932 if test -n "$TINFO_SUFFIX" ; then
3933 case $TINFO_SUFFIX in
3935 TINFO_NAME="${TINFO_NAME}tw${EXTRA_SUFFIX}"
3936 TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^tw'$EXTRA_SUFFIX'//'`
3939 TINFO_NAME="${TINFO_NAME}t${EXTRA_SUFFIX}"
3940 TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^t'$EXTRA_SUFFIX'//'`
3943 TINFO_NAME="${TINFO_NAME}w${EXTRA_SUFFIX}"
3944 TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^w'$EXTRA_SUFFIX'//'`
3949 for cf_dir in $SRC_SUBDIRS
3951 if test ! -d $srcdir/$cf_dir ; then
3953 elif test -f $srcdir/$cf_dir/modules; then
3958 if test -n "${cf_cv_abi_version}" && test "x${cf_cv_abi_version}" != "x5"
3960 cf_awk_program="$cf_awk_program\
3961 /deprecated in ABI${cf_cv_abi_version}/ { next; }\
3962 { sub(\"NCURSES([[WT]]+)?\", \"&${cf_cv_abi_version}\"); }\
3966 if test "x$WILDCARD_SYMS" = xno
3968 cf_awk_program="$cf_awk_program\
3969 /[[ ]]_\\*;/ { skip=1; next; }\
3973 if test "x$cf_awk_program" != "x"
3975 cat >>$cf_dir/Makefile <<CF_EOF
3977 # Generated by CF_LIB_RULES
3978 resulting.map: $UNALTERED_SYMS
3979 $AWK 'BEGIN { skip = 1; last=""; } \
3981 { if ( last != "" && ( skip == 0 || \[$]\[$]0 !~ /}/ ) ) { print last; }\
3982 skip = 0; last = \[$]\[$]0; } \
3983 END { print last; }' < $UNALTERED_SYMS >\[$]@
3990 for cf_item in $cf_LIST_MODELS
3992 CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
3994 test "$cf_dir" = c++ && cf_libname=ncurses++
3995 if test $cf_item = shared ; then
3996 if test -n "${LIB_SUFFIX}"
3998 cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${USE_LIB_SUFFIX}"'//'`
4000 cf_shared_suffix="$cf_suffix"
4002 if test "$cf_cv_do_symlinks" = yes ; then
4005 case "$cf_cv_shlib_version" in
4007 cf_version_name=REL_VERSION
4010 cf_version_name=ABI_VERSION
4014 if test -n "$cf_version_name"
4016 case "$cf_cv_system_name" in
4019 cf_suffix="${USE_LIB_SUFFIX}"'.${'$cf_version_name'}'"$cf_shared_suffix"
4022 cf_suffix="$cf_suffix"'.${'$cf_version_name'}'
4026 if test -n "${USE_LIB_SUFFIX}"
4028 cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${USE_LIB_SUFFIX}"'//'`
4030 cf_shared_suffix="$cf_suffix"
4033 # cygwin needs import library, and has unique naming convention
4034 # use autodetected ${cf_prefix} for import lib and static lib, but
4035 # use 'cyg' prefix for shared lib.
4036 case $cf_cv_shlib_version in
4038 cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
4039 cf_add_lib="../lib/cyg${cf_libname}${cf_cygsuf}"
4042 cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
4043 cf_add_lib="../lib/msys-${cf_libname}${cf_cygsuf}"
4046 cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
4047 cf_add_lib="../lib/lib${cf_libname}${cf_cygsuf}"
4053 if test -n "$cf_add_lib"
4055 Libs_To_Make="$Libs_To_Make $cf_add_lib"
4059 cf_add_lib="../lib/${cf_prefix}${cf_libname}${cf_suffix}"
4060 Libs_To_Make="$Libs_To_Make $cf_add_lib"
4063 if test $cf_dir = ncurses ; then
4064 cf_subsets="$LIB_SUBSETS"
4065 cf_r_parts="$cf_subsets"
4066 cf_liblist="$Libs_To_Make"
4068 while test -n "$cf_r_parts"
4070 cf_l_parts=`echo "$cf_r_parts" |sed -e 's/ .*$//'`
4071 cf_r_parts=`echo "$cf_r_parts" |sed -e 's/^[[^ ]]* //'`
4072 if test "$cf_l_parts" != "$cf_r_parts" ; then
4076 cf_add_lib=`echo $cf_liblist |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g`
4079 cf_add_lib=`echo $cf_liblist |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TICS_LIB_SUFFIX}%g`
4085 if test -n "$cf_add_lib"; then
4086 Libs_To_Make="$cf_add_lib $Libs_To_Make"
4093 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
4096 if test $cf_dir = c++; then
4097 if test "x$with_shared_cxx" != xyes && test -n "$cf_shared_suffix"; then
4099 for cf_item in $Libs_To_Make
4105 cf_item=`echo "$cf_item" | sed -e "s,"$cf_shared_suffix",.a,"`
4108 for cf_test in $cf_list
4110 if test "$cf_test" = "$cf_item"
4112 cf_LIST_MODELS=`echo "$cf_LIST_MODELS" | sed -e 's/normal//'`
4117 test -n "$cf_item" && cf_list="$cf_list $cf_item"
4119 Libs_To_Make="$cf_list"
4123 sed -e "s%@Libs_To_Make@%$Libs_To_Make%" \
4124 -e "s%@SHARED_LIB@%$SHARED_LIB%" \
4125 $cf_dir/Makefile >$cf_dir/Makefile.out
4126 mv $cf_dir/Makefile.out $cf_dir/Makefile
4128 $AWK -f $srcdir/mk-0th.awk \
4129 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" ticlib="$TICS_LIB_SUFFIX" termlib="$TINFO_LIB_SUFFIX" \
4130 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
4132 for cf_subset in $cf_subsets
4135 for cf_item in $cf_LIST_MODELS
4138 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
4139 CF_UPPER(cf_ITEM,$cf_item)
4142 if test "$CXX_MODEL" = SHARED; then
4143 case $cf_cv_shlib_version in
4144 (cygdll|msysdll|mingw)
4145 test "x$with_shared_cxx" = xno && CF_VERBOSE(overriding CXX_MODEL to SHARED)
4149 test "x$with_shared_cxx" = xno && CXX_MODEL=NORMAL
4154 CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
4155 CF_OBJ_SUBDIR($cf_item,cf_subdir)
4157 # Test for case where we build libtinfo with a different name.
4159 if test $cf_dir = ncurses ; then
4162 cf_libname=${cf_libname}$USE_LIB_SUFFIX
4165 cf_libname=$TINFO_LIB_SUFFIX
4168 cf_libname=$TICS_LIB_SUFFIX
4171 elif test $cf_dir = c++ ; then
4172 cf_libname=ncurses++$USE_LIB_SUFFIX
4174 cf_libname=${cf_libname}$USE_LIB_SUFFIX
4176 if test -n "${USE_ARG_SUFFIX}" ; then
4177 # undo $USE_LIB_SUFFIX add-on in CF_LIB_SUFFIX
4178 cf_suffix=`echo $cf_suffix |sed -e "s%^${USE_LIB_SUFFIX}%%"`
4181 # These dependencies really are for development, not
4182 # builds, but they are useful in porting, too.
4183 cf_depend="../include/ncurses_cfg.h"
4184 if test "$srcdir" = "."; then
4187 cf_reldir="\${srcdir}"
4190 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
4191 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
4192 elif test -f $srcdir/$cf_dir/curses.priv.h; then
4193 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
4197 old_cf_suffix="$cf_suffix"
4198 if test "$cf_cv_shlib_version_infix" = yes ; then
4199 if test -n "$USE_LIB_SUFFIX" ; then
4200 case $USE_LIB_SUFFIX in
4202 cf_libname=`echo $cf_libname | sed 's/tw'$EXTRA_SUFFIX'$//'`
4203 cf_suffix=`echo $cf_suffix | sed 's/^tw'$EXTRA_SUFFIX'//'`
4204 cf_dir_suffix=tw$EXTRA_SUFFIX
4207 cf_libname=`echo $cf_libname | sed 's/t'$EXTRA_SUFFIX'$//'`
4208 cf_suffix=`echo $cf_suffix | sed 's/^t'$EXTRA_SUFFIX'//'`
4209 cf_dir_suffix=t$EXTRA_SUFFIX
4212 cf_libname=`echo $cf_libname | sed 's/w'$EXTRA_SUFFIX'$//'`
4213 cf_suffix=`echo $cf_suffix | sed 's/^w'$EXTRA_SUFFIX'//'`
4214 cf_dir_suffix=w$EXTRA_SUFFIX
4217 cf_libname=`echo $cf_libname | sed 's/'$EXTRA_SUFFIX'$//'`
4218 cf_suffix=`echo $cf_suffix | sed 's/^'$EXTRA_SUFFIX'//'`
4219 cf_dir_suffix=$EXTRA_SUFFIX
4225 $AWK -f $srcdir/mk-1st.awk \
4226 name=${cf_libname}${cf_dir_suffix} \
4227 traces=$LIB_TRACING \
4229 CXX_MODEL=$CXX_MODEL \
4234 driver=$cf_cv_term_driver \
4236 TermlibRoot=$TINFO_NAME \
4237 TermlibSuffix=$TINFO_SUFFIX \
4238 ShlibVer=$cf_cv_shlib_version \
4239 ShlibVerInfix=$cf_cv_shlib_version_infix \
4240 ReLink=${cf_cv_do_relink:-no} \
4241 ReRanlib=${cf_cv_do_reranlib:-yes} \
4242 DoLinks=$cf_cv_do_symlinks \
4243 rmSoLocs=$cf_cv_rm_so_locs \
4244 ldconfig="$LDCONFIG" \
4245 overwrite=$WITH_OVERWRITE \
4246 depend="$cf_depend" \
4248 libtool_version="$LIBTOOL_VERSION" \
4249 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
4251 cf_suffix="$old_cf_suffix"
4253 for cf_subdir2 in $cf_subdirs lib
4255 test $cf_subdir = $cf_subdir2 && break
4257 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
4258 $AWK -f $srcdir/mk-2nd.awk \
4260 traces=$LIB_TRACING \
4266 crenames=$cf_cv_prog_CC_c_o \
4267 cxxrenames=$cf_cv_prog_CXX_c_o \
4268 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
4269 cf_subdirs="$cf_subdirs $cf_subdir"
4274 echo ' cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >>Makefile
4277 for cf_dir in $SRC_SUBDIRS
4279 if test ! -d $srcdir/$cf_dir ; then
4283 if test -f $cf_dir/Makefile ; then
4286 echo 'libs \' >> Makefile
4287 echo 'install.libs \' >> Makefile
4288 echo 'uninstall.libs ::' >> Makefile
4289 echo ' cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >> Makefile
4294 if test -f $srcdir/$cf_dir/modules; then
4296 if test -f $srcdir/$cf_dir/headers; then
4297 cat >> Makefile <<CF_EOF
4299 uninstall.includes \\
4302 if test "$cf_dir" != "c++" ; then
4303 echo 'lint \' >> Makefile
4305 cat >> Makefile <<CF_EOF
4311 uninstall.$cf_dir ::
4312 cd $cf_dir && \${MAKE} \${TOP_MFLAGS} \[$]@
4314 elif test -f $srcdir/$cf_dir/headers; then
4315 cat >> Makefile <<CF_EOF
4321 uninstall.includes ::
4322 cd $cf_dir && \${MAKE} \${TOP_MFLAGS} \[$]@
4327 if test "x$cf_with_db_install" = xyes; then
4328 cat >> Makefile <<CF_EOF
4330 install.libs uninstall.libs \\
4331 install.data uninstall.data ::
4332 $MAKE_TERMINFO cd misc && \${MAKE} \${TOP_MFLAGS} \[$]@
4335 cat >> Makefile <<CF_EOF
4337 install.libs uninstall.libs ::
4338 cd misc && \${MAKE} \${TOP_MFLAGS} \[$]@
4342 if test "x$cf_with_manpages" = xyes; then
4343 cat >> Makefile <<CF_EOF
4347 cd man && \${MAKE} \${TOP_MFLAGS} \[$]@
4351 cat >> Makefile <<CF_EOF
4354 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
4355 rm -f headers.sh headers.sed mk_shared_lib.sh
4356 rm -f edit_man.* man_alias.*
4357 rm -rf \${DIRS_TO_MAKE}
4360 # Special case: tack's manpage lives in its own directory.
4361 if test "x$cf_with_manpages" = xyes; then
4362 if test "x$cf_with_tack" = "xyes"; then
4363 cat >> Makefile <<CF_EOF
4367 cd tack && \${MAKE} \${TOP_MFLAGS} \[$]@
4372 dnl If we're installing into a subdirectory of /usr/include, etc., we should
4373 dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
4374 dnl anything, and will make it more standardized. It's awkward to decide this
4375 dnl at configuration because of quoting, so we'll simply make all headers
4376 dnl installed via a script that can do the right thing.
4378 rm -f headers.sed headers.sh
4380 dnl ( generating this script makes the makefiles a little tidier :-)
4381 echo creating headers.sh
4382 cat >headers.sh <<CF_EOF
4384 # This shell script is generated by the 'configure' script. It is invoked in a
4385 # subdirectory of the build tree. It generates a sed-script in the parent
4386 # directory that is used to adjust includes for header files that reside in a
4387 # subdirectory of /usr/include, etc.
4389 while test \[$]# != 3
4391 PRG="\$PRG \[$]1"; shift
4396 TMPSRC=\${TMPDIR:-/tmp}/\`basename \$SRC\`\$\$
4397 TMPSED=\${TMPDIR:-/tmp}/headers.sed\$\$
4398 echo installing \$SRC in \$DST
4401 if test $WITH_CURSES_H = yes; then
4402 cat >>headers.sh <<CF_EOF
4405 END=\`basename \$DST\`
4406 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
4408 NAME=\`basename \$i\`
4409 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
4419 cat >>headers.sh <<CF_EOF
4422 END=\`basename \$DST\`
4423 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
4425 NAME=\`basename \$i\`
4426 if test "\$NAME" = "curses.h"
4428 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
4431 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
4435 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
4440 cat >>headers.sh <<CF_EOF
4442 sed -f \$TMPSED \$SRC > \$TMPSRC
4443 NAME=\`basename \$SRC\`
4445 if test $WITH_CURSES_H != yes; then
4446 cat >>headers.sh <<CF_EOF
4447 test "\$NAME" = "curses.h" && NAME=ncurses.h
4450 cat >>headers.sh <<CF_EOF
4451 # Just in case someone gzip'd manpages, remove the conflicting copy.
4452 test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
4454 eval \$PRG \$TMPSRC \$DST/\$NAME
4455 rm -f \$TMPSRC \$TMPSED
4458 chmod 0755 headers.sh
4460 for cf_dir in $SRC_SUBDIRS
4462 if test ! -d $srcdir/$cf_dir ; then
4466 if test -f $srcdir/$cf_dir/headers; then
4467 $AWK -f $srcdir/mk-hdr.awk \
4468 subset="$LIB_SUBSETS" \
4469 compat="$WITH_CURSES_H" \
4470 $srcdir/$cf_dir/headers >>$cf_dir/Makefile
4473 if test -f $srcdir/$cf_dir/modules; then
4474 if test "$cf_dir" != "c++" ; then
4475 cat >>$cf_dir/Makefile <<"CF_EOF"
4476 depend : ${AUTO_SRC}
4477 makedepend -- ${CPPFLAGS} -- ${C_SRC}
4479 # DO NOT DELETE THIS LINE -- make depend depends on it.
4484 AC_SUBST(Libs_To_Make)
4486 dnl ---------------------------------------------------------------------------
4487 dnl CF_LIB_SONAME version: 6 updated: 2017/01/21 11:06:25
4489 dnl Find the and soname for the given shared library. Set the cache variable
4490 dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache
4491 dnl variable to "unknown".
4495 dnl $3 = library name
4496 AC_DEFUN([CF_LIB_SONAME],
4498 AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[
4500 cf_cv_$3_soname=unknown
4501 if test "$cross_compiling" != yes ; then
4502 cat >conftest.$ac_ext <<CF_EOF
4507 ${cf_cv_main_return:-return}(0);
4510 cf_save_LIBS="$LIBS"
4512 if AC_TRY_EVAL(ac_compile) ; then
4513 if AC_TRY_EVAL(ac_link) ; then
4514 cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.`
4515 test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown
4519 LIBS="$cf_save_LIBS"
4523 dnl ---------------------------------------------------------------------------
4524 dnl CF_LIB_SUFFIX version: 25 updated: 2015/04/17 21:13:04
4526 dnl Compute the library file-suffix from the given model name
4528 dnl $2 = variable to set (the nominal library suffix)
4529 dnl $3 = dependency variable to set (actual filename)
4530 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
4531 AC_DEFUN([CF_LIB_SUFFIX],
4547 case $cf_cv_system_name in
4552 (cygwin*|msys*|mingw*)
4583 if test -n "${LIB_SUFFIX}${EXTRA_SUFFIX}"
4585 $2="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$2}"
4586 $3="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$3}"
4589 dnl ---------------------------------------------------------------------------
4590 dnl CF_LIB_TYPE version: 5 updated: 2015/04/17 21:13:04
4592 dnl Compute the string to append to -library from the given model name
4594 dnl $2 = variable to set
4595 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
4596 AC_DEFUN([CF_LIB_TYPE],
4602 (profile) $2='_p' ;;
4605 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
4607 dnl ---------------------------------------------------------------------------
4608 dnl CF_LINK_DATAONLY version: 12 updated: 2017/07/23 17:46:07
4609 dnl ----------------
4610 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
4611 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
4612 dnl have to provide wrappers for global tables to ensure they're linked
4614 AC_DEFUN([CF_LINK_DATAONLY],
4616 AC_MSG_CHECKING([if data-only library module links])
4617 AC_CACHE_VAL(cf_cv_link_dataonly,[
4619 cat >conftest.$ac_ext <<EOF
4620 #line __oline__ "configure"
4621 int testdata[[3]] = { 123, 456, 789 };
4623 if AC_TRY_EVAL(ac_compile) ; then
4624 mv conftest.o data.o && \
4625 ( $AR $ARFLAGS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null
4627 rm -f conftest.$ac_ext data.o
4628 cat >conftest.$ac_ext <<EOF
4629 #line __oline__ "configure"
4633 ${cf_cv_main_return:-return}(1); /* I'm told this linker is broken */
4635 extern int testdata[[3]];
4636 return testdata[[0]] == 123
4637 && testdata[[1]] == 456
4638 && testdata[[2]] == 789;
4642 if AC_TRY_EVAL(ac_compile); then
4643 mv conftest.o func.o && \
4644 ( $AR $ARFLAGS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null
4646 rm -f conftest.$ac_ext func.o
4647 ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null
4649 LIBS="conftest.a $LIBS"
4653 extern int testfunc();
4654 ${cf_cv_main_return:-return} (!testfunc());
4657 [cf_cv_link_dataonly=yes],
4658 [cf_cv_link_dataonly=no],
4659 [cf_cv_link_dataonly=unknown])
4662 AC_MSG_RESULT($cf_cv_link_dataonly)
4664 if test "$cf_cv_link_dataonly" = no ; then
4665 AC_DEFINE(BROKEN_LINKER,1,[if data-only library module does not link])
4670 dnl ---------------------------------------------------------------------------
4671 dnl CF_LINK_FUNCS version: 9 updated: 2017/01/21 11:11:02
4673 dnl Most Unix systems have both link and symlink, a few don't have symlink.
4674 dnl A few non-Unix systems implement symlink, but not link.
4675 dnl A few non-systems implement neither (or have nonfunctional versions).
4676 AC_DEFUN([CF_LINK_FUNCS],
4685 if test "$cross_compiling" = yes ; then
4690 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
4692 for cf_func in link symlink ; do
4694 #include <sys/types.h>
4695 #include <sys/stat.h>
4696 #ifdef HAVE_UNISTD_H
4702 char *src = "config.log";
4703 char *dst = "conftest.chk";
4708 fail = ($cf_func("config.log", "conftest.chk") < 0)
4709 || (stat(dst, &dst_sb) < 0)
4710 || (dst_sb.st_mtime != src_sb.st_mtime);
4716 ${cf_cv_main_return:-return} (fail);
4719 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
4720 eval 'ac_cv_func_'$cf_func'=yes'],[
4721 eval 'ac_cv_func_'$cf_func'=no'],[
4722 eval 'ac_cv_func_'$cf_func'=error'])
4724 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
4726 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK,1,[Define to 1 if we have link() function])
4727 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK,1,[Define to 1 if we have symlink() function])
4730 dnl ---------------------------------------------------------------------------
4731 dnl CF_MAKEFLAGS version: 18 updated: 2018/02/21 21:26:03
4733 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
4734 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
4735 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
4736 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
4737 AC_DEFUN([CF_MAKEFLAGS],
4739 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
4741 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
4743 cat >cf_makeflags.tmp <<CF_EOF
4746 @ echo '.$cf_option'
4748 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'`
4749 case "$cf_result" in
4751 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
4752 case "$cf_result" in
4753 (.*CC=*) cf_cv_makeflags=
4755 (*) cf_cv_makeflags=$cf_option
4763 CF_MSG_LOG(given option \"$cf_option\", no match \"$cf_result\")
4767 rm -f cf_makeflags.tmp
4770 AC_SUBST(cf_cv_makeflags)
4772 dnl ---------------------------------------------------------------------------
4773 dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
4775 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
4776 dnl a monocase filesystem.
4777 AC_DEFUN([CF_MAKE_TAGS],[
4778 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
4780 AC_CHECK_PROGS(CTAGS, exctags ctags)
4781 AC_CHECK_PROGS(ETAGS, exetags etags)
4783 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
4785 if test "$cf_cv_mixedcase" = yes ; then
4786 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
4791 if test "$MAKE_UPPER_TAGS" = yes ; then
4797 if test "$MAKE_LOWER_TAGS" = yes ; then
4806 AC_SUBST(MAKE_UPPER_TAGS)
4807 AC_SUBST(MAKE_LOWER_TAGS)
4809 dnl ---------------------------------------------------------------------------
4810 dnl CF_MANPAGE_FORMAT version: 11 updated: 2015/04/18 08:56:57
4811 dnl -----------------
4812 dnl Option to allow user to override automatic configuration of manpage format.
4813 dnl There are several special cases:
4815 dnl gzip - man checks for, can display gzip'd files
4816 dnl compress - man checks for, can display compressed files
4817 dnl BSDI - files in the cat-directories are suffixed ".0"
4818 dnl formatted - installer should format (put files in cat-directory)
4819 dnl catonly - installer should only format, e.g., for a turnkey system.
4821 dnl There are other configurations which this macro does not test, e.g., HPUX's
4822 dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming
4823 dnl convention would not match our use).
4824 AC_DEFUN([CF_MANPAGE_FORMAT],
4826 AC_REQUIRE([CF_PATHSEP])
4827 AC_MSG_CHECKING(format of man-pages)
4829 AC_ARG_WITH(manpage-format,
4830 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
4831 optionally formatted/catonly, e.g., gzip,formatted],
4832 [MANPAGE_FORMAT=$withval],
4833 [MANPAGE_FORMAT=unknown])
4835 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown
4836 MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'`
4840 case $MANPAGE_FORMAT in
4842 if test -z "$MANPATH" ; then
4843 MANPATH="/usr/man:/usr/share/man"
4846 # look for the 'date' man-page (it's most likely to be installed!)
4852 IFS="${IFS:- }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
4853 for cf_dir in $MANPATH; do
4854 test -z "$cf_dir" && cf_dir=/usr/man
4855 for cf_name in $cf_dir/man*/$cf_example.[[01]]* $cf_dir/cat*/$cf_example.[[01]]* $cf_dir/man*/$cf_example $cf_dir/cat*/$cf_example
4857 cf_test=`echo $cf_name | sed -e 's/*//'`
4858 if test "x$cf_test" = "x$cf_name" ; then
4861 (*.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";;
4862 (*.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";;
4863 (*.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";;
4864 (*) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";;
4878 # if we found a match in either man* or cat*, stop looking
4879 if test -n "$MANPAGE_FORMAT" ; then
4881 test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted"
4882 test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly"
4888 test $cf_found=yes && break
4891 # only check the first directory in $MANPATH where we find manpages
4892 if test -n "$MANPAGE_FORMAT" ; then
4896 # if we did not find the example, just assume it is normal
4897 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal
4901 for cf_option in $MANPAGE_FORMAT; do
4903 (gzip|compress|BSDI|normal|formatted|catonly)
4906 cf_unknown="$cf_unknown $cf_option"
4913 AC_MSG_RESULT($MANPAGE_FORMAT)
4914 if test -n "$cf_unknown" ; then
4915 AC_MSG_WARN(Unexpected manpage-format $cf_unknown)
4918 dnl ---------------------------------------------------------------------------
4919 dnl CF_MANPAGE_RENAMES version: 10 updated: 2015/08/05 20:44:28
4920 dnl ------------------
4921 dnl The Debian people have their own naming convention for manpages. This
4922 dnl option lets us override the name of the file containing renaming, or
4923 dnl disable it altogether.
4924 AC_DEFUN([CF_MANPAGE_RENAMES],
4926 AC_MSG_CHECKING(for manpage renaming)
4928 AC_ARG_WITH(manpage-renames,
4929 [ --with-manpage-renames specify manpage-renaming],
4930 [MANPAGE_RENAMES=$withval],
4931 [MANPAGE_RENAMES=yes])
4933 case ".$MANPAGE_RENAMES" in
4937 # Debian 'man' program?
4938 if test -f /etc/debian_version ; then
4939 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
4946 if test "$MANPAGE_RENAMES" != no ; then
4947 if test -f $srcdir/man/$MANPAGE_RENAMES ; then
4948 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
4949 elif test ! -f $MANPAGE_RENAMES ; then
4950 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
4953 test ! -d man && mkdir man
4955 # Construct a sed-script to perform renaming within man-pages
4956 if test -n "$MANPAGE_RENAMES" ; then
4957 test ! -d man && mkdir man
4958 $SHELL $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed
4962 AC_MSG_RESULT($MANPAGE_RENAMES)
4963 AC_SUBST(MANPAGE_RENAMES)
4965 dnl ---------------------------------------------------------------------------
4966 dnl CF_MANPAGE_SYMLINKS version: 6 updated: 2015/04/17 21:13:04
4967 dnl -------------------
4968 dnl Some people expect each tool to make all aliases for manpages in the
4969 dnl man-directory. This accommodates the older, less-capable implementations
4970 dnl of 'man', and is optional.
4971 AC_DEFUN([CF_MANPAGE_SYMLINKS],
4973 AC_MSG_CHECKING(if manpage aliases will be installed)
4975 AC_ARG_WITH(manpage-aliases,
4976 [ --with-manpage-aliases specify manpage-aliases using .so],
4977 [MANPAGE_ALIASES=$withval],
4978 [MANPAGE_ALIASES=yes])
4980 AC_MSG_RESULT($MANPAGE_ALIASES)
4992 if test "$MANPAGE_ALIASES" = yes ; then
4993 AC_MSG_CHECKING(if manpage symlinks should be used)
4995 AC_ARG_WITH(manpage-symlinks,
4996 [ --with-manpage-symlinks specify manpage-aliases using symlinks],
4997 [MANPAGE_SYMLINKS=$withval],
4998 [MANPAGE_SYMLINKS=$cf_use_symlinks])
5000 if test "$$cf_use_symlinks" = no; then
5001 if test "$MANPAGE_SYMLINKS" = yes ; then
5002 AC_MSG_WARN(cannot make symlinks, will use .so files)
5007 AC_MSG_RESULT($MANPAGE_SYMLINKS)
5011 dnl ---------------------------------------------------------------------------
5012 dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32
5014 dnl This option causes manpages to be run through tbl(1) to generate tables
5016 AC_DEFUN([CF_MANPAGE_TBL],
5018 AC_MSG_CHECKING(for manpage tbl)
5020 AC_ARG_WITH(manpage-tbl,
5021 [ --with-manpage-tbl specify manpage processing with tbl],
5022 [MANPAGE_TBL=$withval],
5025 AC_MSG_RESULT($MANPAGE_TBL)
5027 dnl ---------------------------------------------------------------------------
5028 dnl CF_MAN_PAGES version: 47 updated: 2017/08/12 07:58:51
5030 dnl Try to determine if the man-pages on the system are compressed, and if
5031 dnl so, what format is used. Use this information to construct a script that
5032 dnl will install man-pages.
5033 AC_DEFUN([CF_MAN_PAGES],
5035 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
5041 if test "$prefix" = "NONE" ; then
5042 cf_prefix="$ac_default_prefix"
5047 case "$MANPAGE_FORMAT" in
5062 test ! -d man && mkdir man
5066 case "$MANPAGE_FORMAT" in
5069 cf_compress=compress
5077 cf_edit_man=./edit_man.sh
5078 cf_man_alias=`pwd`/man_alias.sed
5080 cat >$cf_edit_man <<CF_EOF
5082 # this script is generated by the configure-script CF_MAN_PAGES macro.
5085 datarootdir="$datarootdir"
5088 NCURSES_MAJOR="$NCURSES_MAJOR"
5089 NCURSES_MINOR="$NCURSES_MINOR"
5090 NCURSES_PATCH="$NCURSES_PATCH"
5092 NCURSES_OSPEED="$NCURSES_OSPEED"
5093 TERMINFO="$TERMINFO"
5096 INSTALL_DATA="$INSTALL_DATA"
5098 transform="$program_transform_name"
5100 TMP=\${TMPDIR:=/tmp}/man\$\$
5101 trap "rm -f \$TMP" 0 1 2 3 15
5113 top_srcdir=\[$]srcdir/..
5116 if test "\$form" = normal ; then
5117 if test "$cf_format" = yes ; then
5118 if test "$cf_inboth" = no ; then
5119 $SHELL \[$]0 format \$verb \$mandir \$srcdir \[$]*
5123 cf_subdir=\$mandir/man
5124 cf_tables=$MANPAGE_TBL
5126 cf_subdir=\$mandir/cat
5130 # process the list of source-files
5135 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
5136 if test \$verb = installing ; then
5137 if test ! -d \$cf_subdir\${section} ; then
5138 mkdir -p \$cf_subdir\$section
5142 # replace variables in man page
5143 if test ! -f $cf_man_alias ; then
5144 cat >>$cf_man_alias <<-CF_EOF2
5145 s,@DATADIR@,\$datadir,g
5146 s,@TERMINFO@,\${TERMINFO:="no default value"},g
5147 s,@TERMINFO_DIRS@,\${TERMINFO_DIRS:="no default value"},g
5148 s,@NCURSES_MAJOR@,\${NCURSES_MAJOR:="no default value"},g
5149 s,@NCURSES_MINOR@,\${NCURSES_MINOR:="no default value"},g
5150 s,@NCURSES_PATCH@,\${NCURSES_PATCH:="no default value"},g
5151 s,@NCURSES_OSPEED@,\${NCURSES_OSPEED:="no default value"},g
5156 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
5157 cf_name=`echo $cf_name|sed "$program_transform_name"`
5158 cat >>$cf_edit_man <<-CF_EOF
5159 s,@$cf_NAME@,$cf_name,g
5163 cat >>$cf_edit_man <<CF_EOF
5165 echo "...made $cf_man_alias"
5169 cf_source=\`basename \$i\`
5171 test ! -f \$inalias && inalias="\$srcdir/\$inalias"
5172 if test ! -f \$inalias ; then
5173 echo .. skipped \$cf_source
5178 if test "$MANPAGE_ALIASES" != no ; then
5179 cat >>$cf_edit_man <<CF_EOF
5181 test $with_curses_h = yes && nCurses=ncurses.3x
5182 aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u; test \$inalias = \$nCurses && echo curses\`
5186 if test "$MANPAGE_RENAMES" = no ; then
5187 cat >>$cf_edit_man <<CF_EOF
5188 # perform program transformations for section 1 man pages
5189 if test \$section = 1 ; then
5190 cf_target=\$cf_subdir\${section}/\`echo \$cf_source|sed "\${transform}"\`
5192 cf_target=\$cf_subdir\${section}/\$cf_source
5196 cat >>$cf_edit_man <<CF_EOF
5197 cf_target=\`grep "^\$cf_source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
5198 if test -z "\$cf_target" ; then
5199 echo '? missing rename for '\$cf_source
5200 cf_target="\$cf_source"
5202 cf_target="\$cf_subdir\${section}/\${cf_target}"
5207 cat >>$cf_edit_man <<CF_EOF
5208 sed -f $cf_man_alias \\
5211 if test -f $MANPAGE_RENAMES ; then
5212 cat >>$cf_edit_man <<CF_EOF
5213 < \$i | sed -f `pwd`/edit_man.sed >\$TMP
5216 cat >>$cf_edit_man <<CF_EOF
5221 cat >>$cf_edit_man <<CF_EOF
5222 if test \$cf_tables = yes ; then
5223 tbl \$TMP >\$TMP.out
5228 if test $with_overwrite != yes ; then
5229 cat >>$cf_edit_man <<CF_EOF
5230 sed -e "/\#[ ]*include/s,<curses.h,<ncurses$LIB_SUFFIX/curses.h," < \$TMP >\$TMP.out
5235 if test $with_curses_h != yes ; then
5236 cat >>$cf_edit_man <<CF_EOF
5237 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
5242 cat >>$cf_edit_man <<CF_EOF
5243 if test \$form = format ; then
5244 nroff -man \$TMP >\$TMP.out
5249 if test -n "$cf_compress" ; then
5250 cat >>$cf_edit_man <<CF_EOF
5251 if test \$verb = installing ; then
5252 if ( $cf_compress -f \$TMP )
5254 mv \$TMP.$cf_so_strip \$TMP
5257 cf_target="\$cf_target.$cf_so_strip"
5261 case "$MANPAGE_FORMAT" in
5263 cat >>$cf_edit_man <<CF_EOF
5264 if test \$form = format ; then
5265 # BSDI installs only .0 suffixes in the cat directories
5266 cf_target="\`echo \$cf_target|sed -e 's/\.[[1-9]]\+[[a-z]]*/.0/'\`"
5272 cat >>$cf_edit_man <<CF_EOF
5273 suffix=\`basename \$cf_target | sed -e 's%^[[^.]]*%%'\`
5274 if test \$verb = installing ; then
5275 echo \$verb \$cf_target
5276 \$INSTALL_DATA \$TMP \$cf_target
5277 test -d \$cf_subdir\${section} &&
5278 test -n "\$aliases" && (
5279 cd \$cf_subdir\${section} && (
5280 cf_source=\`echo \$cf_target |sed -e 's%^.*/\([[^/]][[^/]]*/[[^/]][[^/]]*$\)%\1%'\`
5281 test -n "$cf_so_strip" && cf_source=\`echo \$cf_source |sed -e 's%\.$cf_so_strip\$%%'\`
5282 cf_target=\`basename \$cf_target\`
5283 for cf_alias in \$aliases
5285 if test \$section = 1 ; then
5286 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
5289 if test "$MANPAGE_SYMLINKS" = yes ; then
5290 if test -f \$cf_alias\${suffix} ; then
5291 if ( cmp -s \$cf_target \$cf_alias\${suffix} )
5296 echo .. \$verb alias \$cf_alias\${suffix}
5300 cat >>$cf_edit_man <<CF_EOF
5301 $LN_S \$cf_target \$cf_alias\${suffix}
5305 cat >>$cf_edit_man <<CF_EOF
5306 rm -f \$cf_alias\${suffix}
5307 $LN_S \$cf_target \$cf_alias\${suffix}
5311 cat >>$cf_edit_man <<CF_EOF
5312 elif test "\$cf_target" != "\$cf_alias\${suffix}" ; then
5313 echo ".so \$cf_source" >\$TMP
5315 if test -n "$cf_compress" ; then
5316 cat >>$cf_edit_man <<CF_EOF
5317 if test -n "$cf_so_strip" ; then
5318 $cf_compress -f \$TMP
5319 mv \$TMP.$cf_so_strip \$TMP
5323 cat >>$cf_edit_man <<CF_EOF
5324 echo .. \$verb alias \$cf_alias\${suffix}
5325 rm -f \$cf_alias\${suffix}
5326 \$INSTALL_DATA \$TMP \$cf_alias\${suffix}
5331 elif test \$verb = removing ; then
5332 test -f \$cf_target && (
5333 echo \$verb \$cf_target
5336 test -d \$cf_subdir\${section} &&
5337 test -n "\$aliases" && (
5338 cd \$cf_subdir\${section} && (
5339 for cf_alias in \$aliases
5341 if test \$section = 1 ; then
5342 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
5345 echo .. \$verb alias \$cf_alias\${suffix}
5346 rm -f \$cf_alias\${suffix}
5358 if test $cf_inboth = yes ; then
5359 if test \$form != format ; then
5360 $SHELL \[$]0 format \$verb \$mandir \$srcdir \[$]*
5366 chmod 755 $cf_edit_man
5369 dnl ---------------------------------------------------------------------------
5370 dnl CF_MATH_LIB version: 9 updated: 2017/01/21 11:06:25
5372 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
5373 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
5374 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
5375 AC_DEFUN([CF_MATH_LIB],
5377 AC_CACHE_CHECK(if -lm needed for math functions,
5384 [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)],
5385 [cf_cv_need_libm=no],
5386 [cf_cv_need_libm=yes])])
5387 if test "$cf_cv_need_libm" = yes
5394 dnl ---------------------------------------------------------------------------
5395 dnl CF_MIXEDCASE_FILENAMES version: 7 updated: 2015/04/12 15:39:00
5396 dnl ----------------------
5397 dnl Check if the file-system supports mixed-case filenames. If we're able to
5398 dnl create a lowercase name and see it as uppercase, it doesn't support that.
5399 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
5401 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
5402 if test "$cross_compiling" = yes ; then
5403 case $target_alias in
5404 (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*)
5412 rm -f conftest CONFTEST
5414 if test -f CONFTEST ; then
5419 rm -f conftest CONFTEST
5422 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
5424 dnl ---------------------------------------------------------------------------
5425 dnl CF_MKSTEMP version: 10 updated: 2017/01/21 11:12:16
5427 dnl Check for a working mkstemp. This creates two files, checks that they are
5428 dnl successfully created and distinct (AmigaOS apparently fails on the last).
5429 AC_DEFUN([CF_MKSTEMP],[
5433 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
5436 #include <sys/types.h>
5437 #ifdef HAVE_UNISTD_H
5443 #include <sys/stat.h>
5446 char *tmpl = "conftestXXXXXX";
5454 for (n = 0; n < 2; ++n) {
5455 strcpy(name[n], tmpl);
5456 if ((fd = mkstemp(name[n])) >= 0) {
5457 if (!strcmp(name[n], tmpl)
5458 || stat(name[n], &sb) != 0
5459 || (sb.st_mode & S_IFMT) != S_IFREG
5460 || (sb.st_mode & 077) != 0) {
5467 && !strcmp(name[0], name[1]))
5469 ${cf_cv_main_return:-return}(result);
5471 ],[cf_cv_func_mkstemp=yes
5472 ],[cf_cv_func_mkstemp=no
5473 ],[cf_cv_func_mkstemp=maybe])
5475 if test "x$cf_cv_func_mkstemp" = xmaybe ; then
5476 AC_CHECK_FUNC(mkstemp)
5478 if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
5479 AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.])
5482 dnl ---------------------------------------------------------------------------
5483 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
5485 dnl Write a debug message to config.log, along with the line number in the
5486 dnl configure script.
5487 AC_DEFUN([CF_MSG_LOG],[
5488 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
5490 dnl ---------------------------------------------------------------------------
5491 dnl CF_NCURSES_ABI_6 version: 3 updated: 2015/06/06 16:10:11
5492 dnl ----------------
5493 dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and
5494 dnl warn about this.
5495 AC_DEFUN([CF_NCURSES_ABI_6],[
5496 if test "${with_abi_version+set}" != set; then
5497 case $cf_cv_rel_version in
5499 cf_cv_rel_version=6.0
5501 AC_MSG_WARN(overriding ABI version to $cf_cv_abi_version)
5506 dnl ---------------------------------------------------------------------------
5507 dnl CF_NCURSES_WITH_ABI_VERSION version: 2 updated: 2015/12/19 17:51:52
5508 dnl ---------------------------
5509 dnl Allow ncurses's ABI to be overridden. Generally this happens when a
5510 dnl packager has incremented the ABI past that used in the original package,
5511 dnl and wishes to keep doing this.
5513 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
5515 AC_DEFUN([CF_NCURSES_WITH_ABI_VERSION],[
5516 CF_WITH_ABI_VERSION($1)
5517 if test "x$cf_cv_abi_version" != "x$with_abi_version"
5519 case $cf_cv_rel_version in
5521 cf_cv_rel_version=$with_abi_version.0
5526 dnl ---------------------------------------------------------------------------
5527 dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00
5528 dnl ------------------
5529 dnl see CF_WITH_NO_LEAKS
5530 AC_DEFUN([CF_NO_LEAKS_OPTION],[
5531 AC_MSG_CHECKING(if you want to use $1 for testing)
5534 [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
5537 : ${with_cflags:=-g}
5538 : ${with_no_leaks:=yes}
5541 AC_MSG_RESULT(${with_$1:-no})
5543 case .$with_cflags in
5555 dnl ---------------------------------------------------------------------------
5556 dnl CF_NUMBER_SYNTAX version: 2 updated: 2015/04/17 21:13:04
5557 dnl ----------------
5558 dnl Check if the given variable is a number. If not, report an error.
5559 dnl $1 is the variable
5560 dnl $2 is the message
5561 AC_DEFUN([CF_NUMBER_SYNTAX],[
5562 if test -n "$1" ; then
5567 AC_MSG_ERROR($2 is not a number: $1)
5571 AC_MSG_ERROR($2 value is empty)
5574 dnl ---------------------------------------------------------------------------
5575 dnl CF_OBJ_SUBDIR version: 7 updated: 2015/04/17 21:13:04
5577 dnl Compute the object-directory name from the given model name
5578 AC_DEFUN([CF_OBJ_SUBDIR],
5581 (libtool) $2='obj_lo' ;;
5582 (normal) $2='objects' ;;
5583 (debug) $2='obj_g' ;;
5584 (profile) $2='obj_p' ;;
5586 case $cf_cv_system_name in
5594 dnl ---------------------------------------------------------------------------
5595 dnl CF_PATHSEP version: 7 updated: 2015/04/12 15:39:00
5597 dnl Provide a value for the $PATH and similar separator (or amend the value
5598 dnl as provided in autoconf 2.5x).
5599 AC_DEFUN([CF_PATHSEP],
5601 AC_MSG_CHECKING(for PATH separator)
5602 case $cf_cv_system_name in
5603 (os2*) PATH_SEPARATOR=';' ;;
5604 (*) ${PATH_SEPARATOR:=':'} ;;
5606 ifelse([$1],,,[$1=$PATH_SEPARATOR])
5607 AC_SUBST(PATH_SEPARATOR)
5608 AC_MSG_RESULT($PATH_SEPARATOR)
5610 dnl ---------------------------------------------------------------------------
5611 dnl CF_PATH_PROG version: 10 updated: 2019/06/30 19:44:43
5613 dnl Check for a given program, defining corresponding symbol.
5614 dnl $1 = environment variable, which is suffixed by "_PATH" in the #define.
5615 dnl $2 = program name to find.
5616 dnl $3 = optional list of additional program names to test.
5619 dnl If there is more than one token in the result, #define the remaining tokens
5620 dnl to $1_ARGS. We need this for 'install' in particular.
5622 dnl FIXME: we should allow this to be overridden by environment variables
5624 AC_DEFUN([CF_PATH_PROG],[
5625 AC_REQUIRE([CF_PATHSEP])
5626 test -z "[$]$1" && $1=$2
5627 AC_PATH_PROGS($1,[$]$1 $2 ifelse($3,,,$3),[$]$1, ifelse($4,,,$4))
5631 IFS="${IFS:- }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR"
5632 for cf_temp in $ac_cv_path_$1
5634 if test -z "$cf_path_prog" ; then
5635 if test "$with_full_paths" = yes ; then
5636 CF_PATH_SYNTAX(cf_temp,break)
5637 cf_path_prog="$cf_temp"
5639 cf_path_prog="`basename $cf_temp`"
5641 elif test -z "$cf_path_args" ; then
5642 cf_path_args="$cf_temp"
5644 cf_path_args="$cf_path_args $cf_temp"
5649 if test -n "$cf_path_prog" ; then
5650 CF_MSG_LOG(defining path for ${cf_path_prog})
5651 AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog",Define to pathname $1)
5652 test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args",Define to provide args for $1)
5655 dnl ---------------------------------------------------------------------------
5656 dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57
5658 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
5659 dnl begins with one of the prefix/exec_prefix variables, and then again if the
5660 dnl result begins with 'NONE'. This is necessary to work around autoconf's
5661 dnl delayed evaluation of those symbols.
5662 AC_DEFUN([CF_PATH_SYNTAX],[
5663 if test "x$prefix" != xNONE; then
5664 cf_path_syntax="$prefix"
5666 cf_path_syntax="$ac_default_prefix"
5670 (.\[$]\(*\)*|.\'*\'*)
5674 (.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX
5676 (.\[$]{*prefix}*|.\[$]{*dir}*)
5680 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
5685 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
5688 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
5692 dnl ---------------------------------------------------------------------------
5693 dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58
5695 dnl Check for the package-config program, unless disabled by command-line.
5696 AC_DEFUN([CF_PKG_CONFIG],
5698 AC_MSG_CHECKING(if you want to use pkg-config)
5699 AC_ARG_WITH(pkg-config,
5700 [ --with-pkg-config{=path} enable/disable use of pkg-config],
5701 [cf_pkg_config=$withval],
5702 [cf_pkg_config=yes])
5703 AC_MSG_RESULT($cf_pkg_config)
5705 case $cf_pkg_config in
5710 CF_ACVERSION_CHECK(2.52,
5711 [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
5712 [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
5719 test -z "$PKG_CONFIG" && PKG_CONFIG=none
5720 if test "$PKG_CONFIG" != none ; then
5721 CF_PATH_SYNTAX(PKG_CONFIG)
5722 elif test "x$cf_pkg_config" != xno ; then
5723 AC_MSG_WARN(pkg-config is not installed)
5726 AC_SUBST(PKG_CONFIG)
5728 dnl ---------------------------------------------------------------------------
5729 dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17
5730 dnl -----------------
5731 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
5733 dnl POSIX.1-1990 _POSIX_SOURCE
5734 dnl POSIX.1-1990 and _POSIX_SOURCE and
5735 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
5737 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
5738 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
5739 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
5742 dnl $1 is the nominal value for _POSIX_C_SOURCE
5743 AC_DEFUN([CF_POSIX_C_SOURCE],
5744 [AC_REQUIRE([CF_POSIX_VISIBLE])dnl
5746 if test "$cf_cv_posix_visible" = no; then
5748 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
5750 cf_save_CFLAGS="$CFLAGS"
5751 cf_save_CPPFLAGS="$CPPFLAGS"
5753 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
5754 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
5756 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
5757 CF_MSG_LOG(if the symbol is already defined go no further)
5758 AC_TRY_COMPILE([#include <sys/types.h>],[
5759 #ifndef _POSIX_C_SOURCE
5762 [cf_cv_posix_c_source=no],
5763 [cf_want_posix_source=no
5764 case .$cf_POSIX_C_SOURCE in
5766 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
5769 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
5770 cf_want_posix_source=yes
5773 cf_want_posix_source=yes
5776 if test "$cf_want_posix_source" = yes ; then
5777 AC_TRY_COMPILE([#include <sys/types.h>],[
5778 #ifdef _POSIX_SOURCE
5781 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
5783 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
5784 CFLAGS="$cf_trim_CFLAGS"
5785 CPPFLAGS="$cf_trim_CPPFLAGS"
5786 CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source)
5787 CF_MSG_LOG(if the second compile does not leave our definition intact error)
5788 AC_TRY_COMPILE([#include <sys/types.h>],[
5789 #ifndef _POSIX_C_SOURCE
5792 [cf_cv_posix_c_source=no])
5793 CFLAGS="$cf_save_CFLAGS"
5794 CPPFLAGS="$cf_save_CPPFLAGS"
5798 if test "$cf_cv_posix_c_source" != no ; then
5799 CFLAGS="$cf_trim_CFLAGS"
5800 CPPFLAGS="$cf_trim_CPPFLAGS"
5801 CF_ADD_CFLAGS($cf_cv_posix_c_source)
5804 fi # cf_cv_posix_visible
5807 dnl ---------------------------------------------------------------------------
5808 dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17
5809 dnl ----------------
5810 dnl POSIX documents test-macros which an application may set before any system
5811 dnl headers are included to make features available.
5813 dnl Some BSD platforms (originally FreeBSD, but copied by a few others)
5814 dnl diverged from POSIX in 2002 by setting symbols which make all of the most
5815 dnl recent features visible in the system header files unless the application
5816 dnl overrides the corresponding test-macros. Doing that introduces portability
5819 dnl This macro makes a special check for the symbols used for this, to avoid a
5820 dnl conflicting definition.
5821 AC_DEFUN([CF_POSIX_VISIBLE],
5823 AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[
5824 AC_TRY_COMPILE([#include <stdio.h>],[
5825 #if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \
5826 && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \
5827 && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \
5828 && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0)
5829 #error conflicting symbols found
5831 ],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes])
5834 dnl ---------------------------------------------------------------------------
5835 dnl CF_PREDEFINE version: 2 updated: 2010/05/26 16:44:57
5837 dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles.
5839 dnl $1 = symbol to test
5840 dnl $2 = value (if any) to use for a predefinition
5841 AC_DEFUN([CF_PREDEFINE],
5843 AC_MSG_CHECKING(if we must define $1)
5844 AC_TRY_COMPILE([#include <sys/types.h>
5848 #endif],[cf_result=no],[cf_result=yes])
5849 AC_MSG_RESULT($cf_result)
5851 if test "$cf_result" = yes ; then
5852 CPPFLAGS="$CPPFLAGS ifelse([$2],,-D$1,[-D$1=$2])"
5853 elif test "x$2" != "x" ; then
5854 AC_MSG_CHECKING(checking for compatible value versus $2)
5855 AC_TRY_COMPILE([#include <sys/types.h>
5859 #endif],[cf_result=yes],[cf_result=no])
5860 AC_MSG_RESULT($cf_result)
5861 if test "$cf_result" = no ; then
5862 # perhaps we can override it - try...
5863 CPPFLAGS="$CPPFLAGS -D$1=$2"
5867 dnl ---------------------------------------------------------------------------
5868 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
5870 dnl Append definitions and rules for the given programs to the subdirectory
5871 dnl Makefiles, and the recursion rule for the top-level Makefile.
5874 dnl $1 = script to run
5875 dnl $2 = list of subdirectories
5879 AC_DEFUN([CF_PRG_RULES],
5883 if test ! -d $srcdir/$cf_dir; then
5885 elif test -f $srcdir/$cf_dir/programs; then
5886 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
5891 dnl ---------------------------------------------------------------------------
5892 dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22
5894 dnl Check for archiver "ar".
5895 AC_DEFUN([CF_PROG_AR],[
5896 AC_CHECK_TOOL(AR, ar, ar)
5898 dnl ---------------------------------------------------------------------------
5899 dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59
5901 dnl Check for awk, ensure that the check found something.
5902 AC_DEFUN([CF_PROG_AWK],
5905 test -z "$AWK" && AC_MSG_ERROR(No awk program found)
5907 dnl ---------------------------------------------------------------------------
5908 dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58
5910 dnl standard check for CC, plus followup sanity checks
5911 dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
5912 AC_DEFUN([CF_PROG_CC],[
5913 ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
5915 CF_ACVERSION_CHECK(2.52,
5920 dnl ---------------------------------------------------------------------------
5921 dnl CF_PROG_CC_C_O version: 5 updated: 2017/01/21 11:06:25
5923 dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
5924 dnl the output file can be renamed, and allows for a shell variable that can
5925 dnl be used later. The parameter is either CC or CXX. The result is the
5927 dnl $cf_cv_prog_CC_c_o
5928 dnl $cf_cv_prog_CXX_c_o
5931 dnl $2 = compiler options, if any
5932 AC_DEFUN([CF_PROG_CC_C_O],
5933 [AC_REQUIRE([AC_PROG_CC])dnl
5934 AC_MSG_CHECKING([whether [$]$1 understands -c and -o together])
5935 AC_CACHE_VAL(cf_cv_prog_$1_c_o,
5937 cat > conftest.$ac_ext <<CF_EOF
5940 ${cf_cv_main_return:-return}(0);
5943 # We do the test twice because some compilers refuse to overwrite an
5944 # existing .o file with -o, though they will create one.
5945 ac_try='[$]$1 $2 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC'
5946 if AC_TRY_EVAL(ac_try) &&
5947 test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
5949 eval cf_cv_prog_$1_c_o=yes
5951 eval cf_cv_prog_$1_c_o=no
5955 if test $cf_cv_prog_$1_c_o = yes; then
5956 AC_MSG_RESULT([yes])
5961 dnl ---------------------------------------------------------------------------
5962 dnl CF_PROG_EGREP version: 2 updated: 2015/04/18 08:56:57
5964 dnl AC_PROG_EGREP was introduced in autoconf 2.53.
5965 dnl This macro adds a check to ensure the script found something.
5966 AC_DEFUN([CF_PROG_EGREP],
5967 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
5968 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
5969 then ac_cv_prog_egrep='grep -E'
5970 else ac_cv_prog_egrep='egrep'
5972 EGREP=$ac_cv_prog_egrep
5974 test -z "$EGREP" && AC_MSG_ERROR(No egrep program found)
5976 dnl ---------------------------------------------------------------------------
5977 dnl CF_PROG_GNAT version: 8 updated: 2018/11/10 19:47:04
5979 dnl Check for gnatmake, ensure that it is complete.
5980 AC_DEFUN([CF_PROG_GNAT],[
5981 cf_ada_make=gnatmake
5983 AC_CHECK_PROG(gnatmake_exists, $cf_ada_make, yes, no)
5984 if test "$ac_cv_prog_gnatmake_exists" = no; then
5986 cf_cv_prog_gnat_correct=no
5988 AC_CHECK_PROG(gprconfig_exists, gprconfig, yes, no)
5989 if test "$ac_cv_prog_gprconfig_exists" = yes
5991 rm -rf conftest* *~conftest*
5992 if mkdir conftest.src
5996 for cf_gprconfig in Ada C
5998 AC_MSG_CHECKING(for gprconfig name for $cf_gprconfig)
5999 if test $cf_gprconfig = C
6001 for cf_gprconfig_param in \
6002 $cf_gprconfig,,,,GNATGCC \
6003 $cf_gprconfig,,,,GCC \
6006 cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1`
6007 test -n "$cf_gprconfig_value" && break
6010 cf_gprconfig_param=$cf_gprconfig
6011 cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1`
6013 if test -n "$cf_gprconfig_value"
6015 eval cf_ada_config_[$]cf_gprconfig=[$]cf_gprconfig_value
6016 AC_MSG_RESULT($cf_gprconfig_value)
6018 AC_MSG_RESULT(missing)
6024 rm -rf conftest* *~conftest*
6027 # gprconfig is newer than gnatmake; we can continue...
6030 if test "x$cf_ada_config" != "x#"
6033 AC_CHECK_PROG(M4_exists, m4, yes, no)
6034 if test "$ac_cv_prog_M4_exists" = no; then
6035 cf_cv_prog_gnat_correct=no
6036 echo Ada95 binding required program m4 not found. Ada95 binding disabled.
6038 if test "$cf_cv_prog_gnat_correct" = yes; then
6039 AC_MSG_CHECKING(if GNAT works)
6040 CF_GNAT_TRY_RUN([procedure conftest;],
6043 procedure conftest is
6045 Text_IO.Put ("Hello World");
6047 GNAT.OS_Lib.OS_Exit (0);
6048 end conftest;],[cf_cv_prog_gnat_correct=yes],[cf_cv_prog_gnat_correct=no])
6049 AC_MSG_RESULT($cf_cv_prog_gnat_correct)
6052 cf_cv_prog_gnat_correct=no
6056 AC_SUBST(cf_ada_make)
6057 AC_SUBST(cf_ada_config)
6058 AC_SUBST(cf_ada_config_Ada)
6059 AC_SUBST(cf_ada_config_C)
6061 dnl ---------------------------------------------------------------------------
6062 dnl CF_PROG_INSTALL version: 7 updated: 2015/04/18 08:56:57
6064 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
6065 dnl misc/tabset install won't work properly. Usually this happens only when
6066 dnl using the fallback mkinstalldirs script
6067 AC_DEFUN([CF_PROG_INSTALL],
6073 CF_DIRNAME(cf_dir,$INSTALL)
6074 test -z "$cf_dir" && cf_dir=.
6075 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
6079 dnl ---------------------------------------------------------------------------
6080 dnl CF_PROG_LDCONFIG version: 5 updated: 2015/04/18 08:56:57
6081 dnl ----------------
6082 dnl Check for ldconfig, needed to fixup shared libraries that would be built
6083 dnl and then used in the install.
6084 AC_DEFUN([CF_PROG_LDCONFIG],[
6085 if test "$cross_compiling" = yes ; then
6088 case "$cf_cv_system_name" in
6089 (dragonfly*|mirbsd*|freebsd*)
6090 test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
6092 (*) LDPATH=$PATH:/sbin:/usr/sbin
6093 AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
6099 dnl ---------------------------------------------------------------------------
6100 dnl CF_PROG_LINT version: 3 updated: 2016/05/22 15:25:54
6102 AC_DEFUN([CF_PROG_LINT],
6104 AC_CHECK_PROGS(LINT, lint cppcheck splint)
6107 dnl ---------------------------------------------------------------------------
6108 dnl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37
6110 dnl Combine checks for "ln -s" and "ln -sf", updating $LN_S to include "-f"
6111 dnl option if it is supported.
6112 AC_DEFUN([CF_PROG_LN_S],[
6114 AC_MSG_CHECKING(if $LN_S -f options work)
6116 rm -f conf$$.src conf$$dst
6118 echo first >conf$$.src
6119 if $LN_S -f conf$$.src conf$$.dst 2>/dev/null; then
6124 rm -f conf$$.dst conf$$src
6125 AC_MSG_RESULT($cf_prog_ln_sf)
6127 test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
6129 dnl ---------------------------------------------------------------------------
6130 dnl CF_REGEX version: 12 updated: 2015/04/18 08:56:57
6132 dnl Attempt to determine if we've got one of the flavors of regular-expression
6133 dnl code that we can support.
6134 AC_DEFUN([CF_REGEX],
6139 cf_regex_libs="regex re"
6142 cf_regex_libs="gnurx $cf_regex_libs"
6146 AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[
6147 for cf_regex_lib in $cf_regex_libs
6149 AC_CHECK_LIB($cf_regex_lib,regcomp,[
6150 CF_ADD_LIB($cf_regex_lib)
6151 cf_regex_func=regcomp
6156 if test "$cf_regex_func" = no ; then
6157 AC_CHECK_FUNC(compile,[cf_regex_func=compile],[
6158 AC_CHECK_LIB(gen,compile,[
6160 cf_regex_func=compile])])
6163 if test "$cf_regex_func" = no ; then
6164 AC_MSG_WARN(cannot find regular expression library)
6167 AC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[
6170 case $cf_regex_func in
6172 for cf_regex_hdr in regexp.h regexpr.h
6174 AC_TRY_LINK([#include <$cf_regex_hdr>],[
6175 char *p = compile("", "", "", 0);
6176 int x = step("", "");
6178 cf_cv_regex_hdrs=$cf_regex_hdr
6184 for cf_regex_hdr in regex.h
6186 AC_TRY_LINK([#include <sys/types.h>
6187 #include <$cf_regex_hdr>],[
6189 int x = regcomp(p, "", 0);
6190 int y = regexec(p, "", 0, 0, 0);
6193 cf_cv_regex_hdrs=$cf_regex_hdr
6202 case $cf_cv_regex_hdrs in
6203 (no) AC_MSG_WARN(no regular expression header found) ;;
6204 (regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;;
6205 (regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;;
6206 (regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;;
6209 dnl ---------------------------------------------------------------------------
6210 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
6211 dnl ----------------
6212 dnl Remove all -U and -D options that refer to the given symbol from a list
6213 dnl of C compiler options. This works around the problem that not all
6214 dnl compilers process -U and -D options from left-to-right, so a -U option
6215 dnl cannot be used to cancel the effect of a preceding -D option.
6217 dnl $1 = target (which could be the same as the source variable)
6218 dnl $2 = source (including '$')
6219 dnl $3 = symbol to remove
6220 define([CF_REMOVE_DEFINE],
6223 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
6224 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
6226 dnl ---------------------------------------------------------------------------
6227 dnl CF_REMOVE_LIB version: 1 updated: 2007/02/17 14:11:52
6229 dnl Remove the given library from the symbol
6231 dnl $1 = target (which could be the same as the source variable)
6232 dnl $2 = source (including '$')
6233 dnl $3 = library to remove
6234 define([CF_REMOVE_LIB],
6236 # remove $3 library from $2
6237 $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'`
6239 dnl ---------------------------------------------------------------------------
6240 dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00
6242 AC_DEFUN([CF_RPATH_HACK],
6244 AC_REQUIRE([CF_LD_RPATH_OPT])
6245 AC_MSG_CHECKING(for updated LDFLAGS)
6246 if test -n "$LD_RPATH_OPT" ; then
6247 AC_MSG_RESULT(maybe)
6249 AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
6250 cf_rpath_list="/usr/lib /lib"
6251 if test "$cf_ldd_prog" != no
6255 AC_TRY_LINK([#include <stdio.h>],
6257 [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq`
6258 cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`])
6260 # If we passed the link-test, but get a "not found" on a given library,
6261 # this could be due to inept reconfiguration of gcc to make it only
6262 # partly honor /usr/local/lib (or whatever). Sometimes this behavior
6263 # is intentional, e.g., installing gcc in /usr/bin and suppressing the
6264 # /usr/local libraries.
6265 if test -n "$cf_rpath_oops"
6267 for cf_rpath_src in $cf_rpath_oops
6269 for cf_rpath_dir in \
6274 if test -f $cf_rpath_dir/lib/$cf_rpath_src
6276 CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
6277 LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
6285 CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
6287 CF_RPATH_HACK_2(LDFLAGS)
6288 CF_RPATH_HACK_2(LIBS)
6290 CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
6294 AC_SUBST(EXTRA_LDFLAGS)
6296 dnl ---------------------------------------------------------------------------
6297 dnl CF_RPATH_HACK_2 version: 7 updated: 2015/04/12 15:39:00
6299 dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
6300 dnl EXTRA_LDFLAGS for each -L option found.
6302 dnl $cf_rpath_list contains a list of directories to ignore.
6304 dnl $1 = variable name to update. The LDFLAGS variable should be the only one,
6305 dnl but LIBS often has misplaced -L options.
6306 AC_DEFUN([CF_RPATH_HACK_2],
6308 CF_VERBOSE(...checking $1 [$]$1)
6311 for cf_rpath_src in [$]$1
6313 case $cf_rpath_src in
6316 # check if this refers to a directory which we will ignore
6318 if test -n "$cf_rpath_list"
6320 for cf_rpath_item in $cf_rpath_list
6322 if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
6330 if test "$cf_rpath_skip" = no
6332 # transform the option
6333 if test "$LD_RPATH_OPT" = "-R " ; then
6334 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
6336 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
6339 # if we have not already added this, add it now
6340 cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
6341 if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
6343 CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
6344 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
6349 cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
6353 CF_VERBOSE(...checked $1 [$]$1)
6354 AC_SUBST(EXTRA_LDFLAGS)
6356 dnl ---------------------------------------------------------------------------
6357 dnl CF_SHARED_OPTS version: 93 updated: 2018/08/18 16:36:35
6360 dnl Attempt to determine the appropriate CC/LD options for creating a shared
6364 dnl a) ${LOCAL_LDFLAGS} is used to link executables that will run within
6365 dnl the build-tree, i.e., by making use of the libraries that are compiled in
6366 dnl $rel_builddir/lib We avoid compiling-in a $rel_builddir/lib path for the
6367 dnl shared library since that can lead to unexpected results at runtime.
6368 dnl b) ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared
6369 dnl libraries are compiled in ../../lib
6371 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
6372 dnl to install symbolic links to the rel/abi versions of shared libraries.
6374 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
6375 dnl version when making symbolic links.
6377 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
6378 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
6379 dnl (ex: libncurses.so.<ver>).
6381 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
6382 AC_DEFUN([CF_SHARED_OPTS],
6384 AC_REQUIRE([CF_LD_RPATH_OPT])
6390 INSTALL_LIB="-m 644"
6391 : ${rel_builddir:=.}
6399 cf_cv_do_symlinks=no
6401 test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT"
6403 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
6404 AC_ARG_WITH(shlib-version,
6405 [ --with-shlib-version=X Specify rel or abi version for shared libs],
6406 [test -z "$withval" && withval=auto
6409 cf_cv_shlib_version=auto
6412 cf_cv_shlib_version=$withval
6415 AC_MSG_RESULT($withval)
6416 AC_MSG_ERROR([option value must be one of: rel, abi, or auto])
6419 ],[cf_cv_shlib_version=auto])
6420 AC_MSG_RESULT($cf_cv_shlib_version)
6425 # Some less-capable ports of gcc support only -fpic
6429 if test "$GCC" = yes
6433 case $cf_cv_system_name in
6434 (*linux*) # e.g., PGI compiler
6440 if test "$cf_try_fPIC" = yes
6442 AC_MSG_CHECKING(which $CC option to use)
6443 cf_save_CFLAGS="$CFLAGS"
6444 for CC_SHARED_OPTS in -fPIC -fpic ''
6446 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
6447 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
6449 AC_MSG_RESULT($CC_SHARED_OPTS)
6450 CFLAGS="$cf_save_CFLAGS"
6453 cf_cv_shlib_version_infix=no
6455 case $cf_cv_system_name in
6456 (aix4.[3-9]*|aix[[5-7]]*)
6457 if test "$GCC" = yes; then
6458 CC_SHARED_OPTS='-Wl,-brtl'
6459 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
6461 CC_SHARED_OPTS='-brtl'
6462 # as well as '-qpic=large -G' or perhaps "-bM:SRE -bnoentry -bexpall"
6463 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
6467 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
6471 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
6472 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
6473 cf_cv_shlib_version=cygdll
6474 cf_cv_shlib_version_infix=cygdll
6477 cat >mk_shared_lib.sh <<-CF_EOF
6480 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
6483 Linking shared library
6484 ** SHARED_LIB \[$]SHARED_LIB
6485 ** IMPORT_LIB \[$]IMPORT_LIB
6487 exec \[$]* ${LDFLAGS} -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
6489 chmod +x mk_shared_lib.sh
6493 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
6494 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
6495 cf_cv_shlib_version=msysdll
6496 cf_cv_shlib_version_infix=msysdll
6499 cat >mk_shared_lib.sh <<-CF_EOF
6502 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
6505 Linking shared library
6506 ** SHARED_LIB \[$]SHARED_LIB
6507 ** IMPORT_LIB \[$]IMPORT_LIB
6509 exec \[$]* ${LDFLAGS} -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
6511 chmod +x mk_shared_lib.sh
6514 cf_try_cflags="no-cpp-precomp"
6515 CC_SHARED_OPTS="-dynamic"
6516 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
6517 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
6518 cf_cv_shlib_version_infix=yes
6519 AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [
6520 cf_save_LDFLAGS=$LDFLAGS
6521 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
6522 AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no)
6523 LDFLAGS=$cf_save_LDFLAGS])
6524 if test $cf_cv_ldflags_search_paths_first = yes; then
6525 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
6529 # HP-UX 8.07 ld lacks "+b" option used for libdir search-list
6530 if test "$GCC" != yes; then
6533 MK_SHARED_LIB='${LD} ${LDFLAGS} -b -o $[@]'
6534 INSTALL_LIB="-m 555"
6537 # (tested with gcc 2.7.2 -- I don't have c89)
6538 if test "$GCC" = yes; then
6539 LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}'
6542 LD_SHARED_OPTS='-Wl,+b,${libdir}'
6544 MK_SHARED_LIB='${LD} ${LDFLAGS} +b ${libdir} -b -o $[@]'
6545 # HP-UX shared libraries must be executable, and should be
6546 # readonly to exploit a quirk in the memory manager.
6547 INSTALL_LIB="-m 555"
6550 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
6551 if test "$cf_cv_shlib_version" = rel; then
6552 cf_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
6554 cf_shared_soname='`basename $[@]`'
6557 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $[@]'
6560 if test "$cf_cv_enable_rpath" = yes ; then
6561 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
6563 # tested with IRIX 5.2 and 'cc'.
6564 if test "$GCC" != yes; then
6565 CC_SHARED_OPTS='-KPIC'
6566 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -rdata_shared -soname `basename $[@]` -o $[@]'
6568 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,`basename $[@]` -o $[@]'
6570 cf_cv_rm_so_locs=yes
6572 (linux*|gnu*|k*bsd*-gnu)
6573 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
6574 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
6575 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6577 if test "$cf_cv_enable_rpath" = yes ; then
6578 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
6581 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
6584 cf_cv_shlib_version=mingw
6585 cf_cv_shlib_version_infix=mingw
6588 if test "$DFT_LWR_MODEL" = "shared" ; then
6589 LOCAL_LDFLAGS="-Wl,--enable-auto-import"
6590 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6591 EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS"
6594 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
6595 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
6596 cat >mk_shared_lib.sh <<-CF_EOF
6599 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
6602 Linking shared library
6603 ** SHARED_LIB \[$]SHARED_LIB
6604 ** IMPORT_LIB \[$]IMPORT_LIB
6606 exec \[$]* ${LDFLAGS} -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
6608 chmod +x mk_shared_lib.sh
6610 (openbsd[[2-9]].*|mirbsd*)
6611 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
6612 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
6613 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6615 if test "$cf_cv_enable_rpath" = yes ; then
6616 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
6618 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
6620 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
6622 (nto-qnx*|openbsd*|freebsd[[12]].*)
6623 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
6624 MK_SHARED_LIB='${LD} ${LDFLAGS} -Bshareable -o $[@]'
6625 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
6627 (dragonfly*|freebsd*)
6628 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
6629 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
6630 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
6631 LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
6632 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
6635 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
6638 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
6639 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
6640 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
6641 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6642 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
6643 if test "$cf_cv_shlib_version" = auto; then
6644 if test -f /usr/libexec/ld.elf_so; then
6645 cf_cv_shlib_version=abi
6647 cf_cv_shlib_version=rel
6651 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]'
6653 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -Wl,-shared -Wl,-Bshareable -o $[@]'
6657 # tested with OSF/1 V3.2 and 'cc'
6658 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
6659 # link with shared libs).
6660 MK_SHARED_LIB='${LD} ${LDFLAGS} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`'
6663 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
6666 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
6667 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
6668 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
6669 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6671 cf_cv_rm_so_locs=yes
6673 (sco3.2v5*) # also uw2* and UW7: hops 13-Apr-98
6674 # tested with osr5.0.5
6675 if test "$GCC" != yes; then
6676 CC_SHARED_OPTS='-belf -KPIC'
6678 MK_SHARED_LIB='${LD} ${LDFLAGS} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@'
6679 if test "$cf_cv_enable_rpath" = yes ; then
6680 # only way is to set LD_RUN_PATH but no switch for it
6683 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
6684 LINK_PROGS='LD_RUN_PATH=${libdir}'
6685 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
6688 # tested with SunOS 4.1.1 and gcc 2.7.0
6689 if test "$GCC" != yes; then
6690 CC_SHARED_OPTS='-KPIC'
6692 MK_SHARED_LIB='${LD} ${LDFLAGS} -assert pure-text -o $[@]'
6693 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
6696 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
6697 # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3
6698 if test "$DFT_LWR_MODEL" = "shared" ; then
6699 LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}"
6700 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
6702 if test "$cf_cv_enable_rpath" = yes ; then
6703 EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS"
6706 if test "$GCC" != yes; then
6707 cf_save_CFLAGS="$CFLAGS"
6708 for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O
6710 CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
6711 AC_TRY_COMPILE([#include <stdio.h>],[printf("Hello\n");],[break])
6713 CFLAGS="$cf_save_CFLAGS"
6714 CC_SHARED_OPTS=$cf_shared_opts
6715 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -dy -G -h '$cf_cv_shared_soname' -o $[@]'
6717 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]'
6720 (sysv5uw7*|unix_sv*)
6721 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
6722 if test "$GCC" != yes; then
6723 CC_SHARED_OPTS='-KPIC'
6725 MK_SHARED_LIB='${LD} ${LDFLAGS} -d y -G -o [$]@'
6728 CC_SHARED_OPTS='unknown'
6729 MK_SHARED_LIB='echo unknown'
6733 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
6734 case "$cf_cv_shlib_version" in
6736 case "$MK_SHARED_LIB" in
6738 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
6741 AC_MSG_WARN(ignored --with-shlib-version)
6747 if test -n "$cf_try_cflags"
6749 cat > conftest.$ac_ext <<EOF
6750 #line __oline__ "${as_me:-configure}"
6752 int main(int argc, char *argv[[]])
6755 return (argv[[argc-1]] == 0) ;
6758 cf_save_CFLAGS="$CFLAGS"
6759 for cf_opt in $cf_try_cflags
6761 CFLAGS="$cf_save_CFLAGS -$cf_opt"
6762 AC_MSG_CHECKING(if CFLAGS option -$cf_opt works)
6763 if AC_TRY_EVAL(ac_compile); then
6765 cf_save_CFLAGS="$CFLAGS"
6770 CFLAGS="$cf_save_CFLAGS"
6774 # RPATH_LIST is a colon-separated list of directories
6775 test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
6776 test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
6778 test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations"
6780 CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS)
6781 CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB)
6783 AC_SUBST(CC_SHARED_OPTS)
6784 AC_SUBST(LD_RPATH_OPT)
6785 AC_SUBST(LD_SHARED_OPTS)
6786 AC_SUBST(MK_SHARED_LIB)
6787 AC_SUBST(RM_SHARED_OPTS)
6789 AC_SUBST(LINK_PROGS)
6790 AC_SUBST(LINK_TESTS)
6792 AC_SUBST(EXTRA_LDFLAGS)
6793 AC_SUBST(LOCAL_LDFLAGS)
6794 AC_SUBST(LOCAL_LDFLAGS2)
6796 AC_SUBST(INSTALL_LIB)
6797 AC_SUBST(RPATH_LIST)
6799 dnl ---------------------------------------------------------------------------
6800 dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
6801 dnl ----------------
6802 dnl utility macro for CF_SHARED_OPTS, constructs "$cf_cv_shared_soname" for
6803 dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar)
6806 dnl $1 is the default that should be used for "$cf_cv_shlib_version".
6807 dnl If missing, use "rel".
6808 define([CF_SHARED_SONAME],
6810 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1)
6811 if test "$cf_cv_shlib_version" = rel; then
6812 cf_cv_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
6814 cf_cv_shared_soname='`basename $[@]`'
6817 dnl ---------------------------------------------------------------------------
6818 dnl CF_SIGWINCH version: 2 updated: 2019/03/23 19:54:44
6820 dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
6821 dnl programs need this test).
6823 dnl This is really a Mac OS X 10.4.3 workaround. Defining _POSIX_C_SOURCE
6824 dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct
6825 dnl winsize declaration is left alone - we may revisit this if Apple choose to
6826 dnl break that part of the interface as well.
6827 AC_DEFUN([CF_SIGWINCH],
6829 AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
6831 #include <sys/types.h>
6832 #include <sys/signal.h>
6833 ],[int x = SIGWINCH],
6834 [cf_cv_define_sigwinch=yes],
6836 #undef _XOPEN_SOURCE
6837 #undef _POSIX_SOURCE
6838 #undef _POSIX_C_SOURCE
6839 #include <sys/types.h>
6840 #include <sys/signal.h>
6841 ],[int x = SIGWINCH],
6842 [cf_cv_define_sigwinch=maybe],
6843 [cf_cv_define_sigwinch=no])
6847 if test "$cf_cv_define_sigwinch" = maybe ; then
6848 AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
6849 cf_cv_fixup_sigwinch=unknown
6851 while test $cf_sigwinch != 1
6854 #undef _XOPEN_SOURCE
6855 #undef _POSIX_SOURCE
6856 #undef _POSIX_C_SOURCE
6857 #include <sys/types.h>
6858 #include <sys/signal.h>
6860 #if SIGWINCH != $cf_sigwinch
6864 [cf_cv_fixup_sigwinch=$cf_sigwinch
6867 cf_sigwinch=`expr $cf_sigwinch - 1`
6871 if test "$cf_cv_fixup_sigwinch" != unknown ; then
6872 CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
6876 dnl ---------------------------------------------------------------------------
6877 dnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20
6879 dnl signal handler, but there are some gcc depedencies in that recommendation.
6881 AC_DEFUN([CF_SIG_ATOMIC_T],
6883 AC_MSG_CHECKING(for signal global datatype)
6884 AC_CACHE_VAL(cf_cv_sig_atomic_t,[
6886 "volatile sig_atomic_t" \
6891 #include <sys/types.h>
6897 static void handler(int sig)
6901 [signal(SIGINT, handler);
6903 [cf_cv_sig_atomic_t=$cf_type],
6904 [cf_cv_sig_atomic_t=no])
6905 test "$cf_cv_sig_atomic_t" != no && break
6908 AC_MSG_RESULT($cf_cv_sig_atomic_t)
6909 test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype])
6911 dnl ---------------------------------------------------------------------------
6912 dnl CF_SIZECHANGE version: 14 updated: 2018/06/20 20:23:13
6914 dnl Check for definitions & structures needed for window size-changing
6916 dnl https://stackoverflow.com/questions/18878141/difference-between-structures-ttysize-and-winsize/50769952#50769952
6917 AC_DEFUN([CF_SIZECHANGE],
6919 AC_REQUIRE([CF_STRUCT_TERMIOS])
6920 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
6921 cf_cv_sizechange=unknown
6922 cf_save_CPPFLAGS="$CPPFLAGS"
6924 for cf_opts in "" "NEED_PTEM_H"
6927 CPPFLAGS="$cf_save_CPPFLAGS"
6928 if test -n "$cf_opts"
6930 CF_APPEND_TEXT(CPPFLAGS,-D$cf_opts)
6932 AC_TRY_COMPILE([#include <sys/types.h>
6933 #ifdef HAVE_TERMIOS_H
6934 #include <termios.h>
6936 #ifdef HAVE_TERMIO_H
6942 /* This is a workaround for SCO: they neglected to define struct winsize in
6943 * termios.h -- it's only in termio.h and ptem.h
6945 #include <sys/stream.h>
6946 #include <sys/ptem.h>
6949 #ifdef HAVE_SYS_IOCTL_H
6950 #include <sys/ioctl.h>
6954 struct ttysize win; /* SunOS 3.0... */
6955 int y = win.ts_lines;
6956 int x = win.ts_cols;
6959 struct winsize win; /* everything else */
6963 no TIOCGSIZE or TIOCGWINSZ
6964 #endif /* TIOCGWINSZ */
6965 #endif /* TIOCGSIZE */
6967 [cf_cv_sizechange=yes],
6968 [cf_cv_sizechange=no])
6970 CPPFLAGS="$cf_save_CPPFLAGS"
6971 if test "$cf_cv_sizechange" = yes ; then
6972 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
6973 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
6978 if test "$cf_cv_sizechange" != no ; then
6979 AC_DEFINE(HAVE_SIZECHANGE,1,[Define to 1 if sizechange declarations are provided])
6980 case $cf_cv_sizechange in
6982 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
6987 dnl ---------------------------------------------------------------------------
6988 dnl CF_SRC_MODULES version: 30 updated: 2017/07/26 17:08:35
6990 dnl For each parameter, test if the source-directory exists, and if it contains
6991 dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
6992 dnl use in CF_LIB_RULES.
6994 dnl This uses the configured value to make the lists SRC_SUBDIRS and
6995 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
6996 AC_DEFUN([CF_SRC_MODULES],
6998 AC_MSG_CHECKING(for src modules)
7000 # dependencies and linker-arguments for test-programs
7001 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
7002 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2"
7003 if test "$DFT_LWR_MODEL" = "libtool"; then
7004 TEST_ARGS="${TEST_DEPS}"
7005 TEST_ARG2="${TEST_DEP2}"
7007 TEST_ARGS="-l${LIB_NAME}${USE_ARG_SUFFIX} $TEST_ARGS"
7008 TEST_ARG2="-l${LIB_NAME}${USE_ARG_SUFFIX} $TEST_ARG2"
7011 PC_MODULES_TO_MAKE="ncurses${USE_ARG_SUFFIX}"
7015 if test -f $srcdir/$cf_dir/modules; then
7017 # We may/may not have tack in the distribution, though the
7019 if test $cf_dir = tack ; then
7020 if test "x$cf_with_tack" != "xyes"; then
7025 if test -z "$cf_cv_src_modules"; then
7026 cf_cv_src_modules=$cf_dir
7028 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
7031 # Make the ncurses_cfg.h file record the library interface files as
7032 # well. These are header files that are the same name as their
7033 # directory. Ncurses is the only library that does not follow
7035 if test $cf_dir = tack ; then
7037 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
7038 CF_UPPER(cf_have_include,$cf_dir)
7039 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
7040 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
7041 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
7042 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2"
7043 if test "$DFT_LWR_MODEL" = "libtool"; then
7044 TEST_ARGS="${TEST_DEPS}"
7045 TEST_ARG2="${TEST_DEP2}"
7047 TEST_ARGS="-l${cf_dir}${USE_ARG_SUFFIX} $TEST_ARGS"
7048 TEST_ARG2="-l${cf_dir}${USE_ARG_SUFFIX} $TEST_ARG2"
7050 PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ${cf_dir}${USE_ARG_SUFFIX}"
7054 AC_MSG_RESULT($cf_cv_src_modules)
7056 TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
7057 TEST_ARG2="-L${LIB_2ND} $TEST_ARG2"
7066 if test "x$cf_with_manpages" != xno ; then
7067 SRC_SUBDIRS="$SRC_SUBDIRS man"
7069 SRC_SUBDIRS="$SRC_SUBDIRS include"
7070 for cf_dir in $cf_cv_src_modules
7072 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
7074 if test "x$cf_with_tests" != "xno" ; then
7075 SRC_SUBDIRS="$SRC_SUBDIRS test"
7077 # always make this, to install the ncurses-config script
7078 SRC_SUBDIRS="$SRC_SUBDIRS misc"
7079 if test "$cf_with_cxx_binding" != no; then
7080 PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ncurses++${USE_ARG_SUFFIX}"
7081 SRC_SUBDIRS="$SRC_SUBDIRS c++"
7084 test "x$with_termlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TINFO_ARG_SUFFIX"
7085 test "x$with_ticlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TICS_ARG_SUFFIX"
7087 AC_SUBST(PC_MODULES_TO_MAKE)
7090 if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = xyes && test -f $srcdir/Ada95/Makefile.in; then
7091 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
7092 ADA_SUBDIRS="gen src"
7093 if test "x$cf_with_tests" != "xno" ; then
7094 ADA_SUBDIRS="$ADA_SUBDIRS samples"
7099 for cf_dir in $SRC_SUBDIRS
7101 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
7104 if test -n "$ADA_SUBDIRS"; then
7105 for cf_dir in $ADA_SUBDIRS
7107 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
7109 AC_SUBST(ADA_SUBDIRS)
7112 dnl ---------------------------------------------------------------------------
7113 dnl CF_STDCPP_LIBRARY version: 11 updated: 2015/10/17 19:03:33
7114 dnl -----------------
7115 dnl Check for -lstdc++, which is GNU's standard C++ library.
7116 dnl If $CXXLIBS is set, add that to the libraries used for test-linking.
7117 dnl If -lstdc++ was not already added to $LIBS or $CXXLIBS, and is needed,
7118 dnl add it to $CXXLIBS.
7119 AC_DEFUN([CF_STDCPP_LIBRARY],
7121 if test -n "$GXX" ; then
7124 LIBS="$LIBS $CXXLIBS"
7125 AC_MSG_CHECKING(if we already have C++ library)
7127 #include <iostream>],[
7128 std::cout << "Hello World!" << std::endl;],
7129 [cf_have_libstdcpp=yes],
7130 [cf_have_libstdcpp=no])
7131 AC_MSG_RESULT($cf_have_libstdcpp)
7134 if test $cf_have_libstdcpp != yes
7136 case $cf_cv_system_name in
7138 if test -z "`g++ -dM -E - < /dev/null | grep __KLIBC__`"; then
7139 cf_stdcpp_libname=stdcpp
7141 cf_stdcpp_libname=stdc++
7145 cf_stdcpp_libname=stdc++
7149 AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
7151 LIBS="$LIBS $CXXLIBS"
7152 CF_ADD_LIB($cf_stdcpp_libname)
7154 #include <iostream>],[
7155 std::cout << "Hello World!" << std::endl;],
7156 [cf_cv_libstdcpp=yes],
7157 [cf_cv_libstdcpp=no])
7160 test "$cf_cv_libstdcpp" = yes && { CF_ADD_LIB($cf_stdcpp_libname,CXXLIBS) }
7164 dnl ---------------------------------------------------------------------------
7165 dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
7167 dnl Remove "-g" option from the compiler options
7168 AC_DEFUN([CF_STRIP_G_OPT],
7169 [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
7170 dnl ---------------------------------------------------------------------------
7171 dnl CF_STRUCT_SIGACTION version: 5 updated: 2012/10/06 17:56:13
7172 dnl -------------------
7173 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
7174 dnl do this if we've found the sigaction function.
7175 AC_DEFUN([CF_STRUCT_SIGACTION],[
7176 AC_REQUIRE([CF_XOPEN_SOURCE])
7178 if test "$ac_cv_func_sigaction" = yes; then
7179 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
7181 #include <sys/types.h>
7182 #include <signal.h>],
7183 [struct sigaction act],
7187 #define _POSIX_SOURCE
7188 #include <sys/types.h>
7189 #include <signal.h>],
7190 [struct sigaction act],
7192 AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE])],
7193 [sigact_bad=unknown])])
7194 AC_MSG_RESULT($sigact_bad)
7197 dnl ---------------------------------------------------------------------------
7198 dnl CF_STRUCT_TERMIOS version: 9 updated: 2018/06/08 21:57:23
7199 dnl -----------------
7200 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
7201 AC_DEFUN([CF_STRUCT_TERMIOS],[
7202 AC_REQUIRE([CF_XOPEN_SOURCE])
7212 if test "$ac_cv_header_termios_h" = yes ; then
7213 case "$CFLAGS $CPPFLAGS" in
7215 termios_bad=dunno ;;
7216 (*) termios_bad=maybe ;;
7218 if test "$termios_bad" = maybe ; then
7219 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
7220 AC_TRY_COMPILE([#include <termios.h>],
7221 [struct termios foo; int x = foo.c_iflag],
7224 #define _POSIX_SOURCE
7225 #include <termios.h>],
7226 [struct termios foo; int x = foo.c_iflag],
7227 termios_bad=unknown,
7228 termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE]))
7230 AC_MSG_RESULT($termios_bad)
7234 dnl ---------------------------------------------------------------------------
7235 dnl CF_SUBDIR_PATH version: 7 updated: 2014/12/04 04:33:06
7237 dnl Construct a search-list for a nonstandard header/lib-file
7238 dnl $1 = the variable to return as result
7239 dnl $2 = the package name
7240 dnl $3 = the subdirectory, e.g., bin, include or lib
7241 AC_DEFUN([CF_SUBDIR_PATH],
7245 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
7247 for cf_subdir_prefix in \
7255 CF_ADD_SUBDIR_PATH($1,$2,$3,$cf_subdir_prefix,$prefix)
7258 dnl ---------------------------------------------------------------------------
7259 dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03
7261 dnl Shorthand macro for substituting things that the user may override
7262 dnl with an environment variable.
7264 dnl $1 = condition to pass to "test"
7265 dnl $2 = environment variable
7266 dnl $3 = value if the test succeeds
7267 dnl $4 = value if the test fails
7268 AC_DEFUN([CF_SUBST_IF],
7277 dnl ---------------------------------------------------------------------------
7278 dnl CF_SUBST_NCURSES_VERSION version: 8 updated: 2006/09/16 11:40:59
7279 dnl ------------------------
7280 dnl Get the version-number for use in shared-library naming, etc.
7281 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
7283 AC_REQUIRE([CF_PROG_EGREP])
7284 NCURSES_MAJOR="`$ac_cv_prog_egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
7285 NCURSES_MINOR="`$ac_cv_prog_egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
7286 NCURSES_PATCH="`$ac_cv_prog_egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
7287 cf_cv_abi_version=${NCURSES_MAJOR}
7288 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
7289 dnl Show the computed version, for logging
7290 cf_cv_timestamp=`date`
7291 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
7292 dnl We need these values in the generated headers
7293 AC_SUBST(NCURSES_MAJOR)
7294 AC_SUBST(NCURSES_MINOR)
7295 AC_SUBST(NCURSES_PATCH)
7296 dnl We need these values in the generated makefiles
7297 AC_SUBST(cf_cv_rel_version)
7298 AC_SUBST(cf_cv_abi_version)
7299 AC_SUBST(cf_cv_builtin_bool)
7300 AC_SUBST(cf_cv_header_stdbool_h)
7301 AC_SUBST(cf_cv_type_of_bool)dnl
7303 dnl ---------------------------------------------------------------------------
7304 dnl CF_SYS_TIME_SELECT version: 6 updated: 2015/04/18 08:56:57
7305 dnl ------------------
7306 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
7307 dnl older SCO configurations.
7308 AC_DEFUN([CF_SYS_TIME_SELECT],
7310 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
7311 AC_CACHE_VAL(cf_cv_sys_time_select,[
7313 #include <sys/types.h>
7314 #ifdef HAVE_SYS_TIME_H
7315 #include <sys/time.h>
7317 #ifdef HAVE_SYS_SELECT_H
7318 #include <sys/select.h>
7320 ],[],[cf_cv_sys_time_select=yes],
7321 [cf_cv_sys_time_select=no])
7323 AC_MSG_RESULT($cf_cv_sys_time_select)
7324 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT,1,[Define to 1 if we can include <sys/time.h> with <sys/select.h>])
7326 dnl ---------------------------------------------------------------------------
7327 dnl CF_TOP_BUILDDIR version: 2 updated: 2013/07/27 17:38:32
7329 dnl Define a top_builddir symbol, for applications that need an absolute path.
7330 AC_DEFUN([CF_TOP_BUILDDIR],
7332 top_builddir=ifelse($1,,`pwd`,$1)
7333 AC_SUBST(top_builddir)
7335 dnl ---------------------------------------------------------------------------
7336 dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06
7337 dnl -----------------
7338 dnl This is a simple wrapper to use for pkg-config, for libraries which may be
7339 dnl available in that form.
7341 dnl $1 = package name
7342 dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS
7343 dnl $3 = logic to use if pkg-config does not have the package
7344 AC_DEFUN([CF_TRY_PKG_CONFIG],[
7345 AC_REQUIRE([CF_PKG_CONFIG])
7347 if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then
7348 CF_VERBOSE(found package $1)
7349 cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`"
7350 cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`"
7351 CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs)
7352 CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs)
7353 CF_ADD_CFLAGS($cf_pkgconfig_incs)
7354 CF_ADD_LIBS($cf_pkgconfig_libs)
7355 ifelse([$2],,:,[$2])
7359 ifelse([$3],,:,[$3])
7362 dnl ---------------------------------------------------------------------------
7363 dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13
7364 dnl -------------------
7365 dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
7366 dnl can define it successfully.
7367 AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
7368 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
7372 #include <sys/types.h>
7374 #ifndef _XOPEN_SOURCE
7377 [cf_cv_xopen_source=no],
7378 [cf_save="$CPPFLAGS"
7379 CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE)
7383 #include <sys/types.h>
7385 #ifdef _XOPEN_SOURCE
7388 [cf_cv_xopen_source=no],
7389 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
7394 if test "$cf_cv_xopen_source" != no ; then
7395 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
7396 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
7397 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
7398 CF_ADD_CFLAGS($cf_temp_xopen_source)
7401 dnl ---------------------------------------------------------------------------
7402 dnl CF_TYPEOF_CHTYPE version: 10 updated: 2017/01/21 11:06:25
7403 dnl ----------------
7404 dnl Determine the type we should use for chtype (and attr_t, which is treated
7405 dnl as the same thing). We want around 32 bits, so on most machines want a
7406 dnl long, but on newer 64-bit machines, probably want an int. If we're using
7407 dnl wide characters, we have to have a type compatible with that, as well.
7408 AC_DEFUN([CF_TYPEOF_CHTYPE],
7410 AC_MSG_CHECKING([for type of chtype])
7411 AC_CACHE_VAL(cf_cv_typeof_chtype,[
7413 #define WANT_BITS 31
7417 FILE *fp = fopen("cf_test.out", "w");
7419 char *result = "long";
7420 if (sizeof(unsigned long) > sizeof(unsigned int)) {
7423 for (n = 0; n < WANT_BITS; n++) {
7426 if (y != 1 || x == 0) {
7432 * If x is nonzero, an int is big enough for the bits
7435 result = (x != 0) ? "int" : "long";
7440 ${cf_cv_main_return:-return}(0);
7443 [cf_cv_typeof_chtype=`cat cf_test.out`],
7444 [cf_cv_typeof_chtype=long],
7445 [cf_cv_typeof_chtype=long])
7448 AC_MSG_RESULT($cf_cv_typeof_chtype)
7450 AC_SUBST(cf_cv_typeof_chtype)
7451 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype,[Define to actual type if needed for chtype])
7453 dnl ---------------------------------------------------------------------------
7454 dnl CF_TYPE_SIGACTION version: 4 updated: 2012/10/06 17:56:13
7455 dnl -----------------
7457 AC_DEFUN([CF_TYPE_SIGACTION],
7459 AC_MSG_CHECKING([for type sigaction_t])
7460 AC_CACHE_VAL(cf_cv_type_sigaction,[
7462 #include <signal.h>],
7464 [cf_cv_type_sigaction=yes],
7465 [cf_cv_type_sigaction=no])])
7466 AC_MSG_RESULT($cf_cv_type_sigaction)
7467 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION,1,[Define to 1 if we have the sigaction_t type])
7469 dnl ---------------------------------------------------------------------------
7470 dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
7471 dnl --------------------
7472 dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
7473 dnl won't, but they're still there.
7474 AC_DEFUN([CF_UNSIGNED_LITERALS],
7476 AC_MSG_CHECKING([if unsigned literals are legal])
7477 AC_CACHE_VAL(cf_cv_unsigned_literals,[
7478 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
7479 [cf_cv_unsigned_literals=yes],
7480 [cf_cv_unsigned_literals=no])
7482 AC_MSG_RESULT($cf_cv_unsigned_literals)
7484 dnl ---------------------------------------------------------------------------
7485 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
7487 dnl Make an uppercase version of a variable
7488 dnl $1=uppercase($2)
7489 AC_DEFUN([CF_UPPER],
7491 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
7493 dnl ---------------------------------------------------------------------------
7494 dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
7496 dnl Check for multibyte support, and if not found, utf8 compatibility library
7497 AC_DEFUN([CF_UTF8_LIB],
7499 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
7500 cf_save_LIBS="$LIBS"
7502 #include <stdlib.h>],[putwc(0,0);],
7503 [cf_cv_utf8_lib=yes],
7505 #include <libutf8.h>],[putwc(0,0);],utf8,
7506 [cf_cv_utf8_lib=add-on],
7507 [cf_cv_utf8_lib=no])
7510 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
7512 if test "$cf_cv_utf8_lib" = "add-on" ; then
7513 AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
7514 CF_ADD_INCDIR($cf_cv_header_path_utf8)
7515 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
7516 CF_ADD_LIBS($cf_cv_library_file_utf8)
7519 dnl ---------------------------------------------------------------------------
7520 dnl CF_VA_COPY version: 6 updated: 2018/12/04 18:14:25
7522 dnl check for va_copy, part of stdarg.h starting with ISO C 1999.
7523 dnl Also, workaround for glibc's __va_copy, by checking for both.
7524 dnl Finally, try to accommodate pre-ISO C 1999 headers.
7525 AC_DEFUN([CF_VA_COPY],[
7526 AC_CACHE_CHECK(for va_copy, cf_cv_have_va_copy,[
7533 cf_cv_have_va_copy=yes,
7534 cf_cv_have_va_copy=no)])
7536 if test "$cf_cv_have_va_copy" = yes;
7538 AC_DEFINE(HAVE_VA_COPY,1,[Define to 1 if we have va_copy])
7539 else # !cf_cv_have_va_copy
7541 AC_CACHE_CHECK(for __va_copy, cf_cv_have___va_copy,[
7547 __va_copy(dst, src)],
7548 cf_cv_have___va_copy=yes,
7549 cf_cv_have___va_copy=no)])
7551 if test "$cf_cv_have___va_copy" = yes
7553 AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if we have __va_copy])
7554 else # !cf_cv_have___va_copy
7556 AC_CACHE_CHECK(for __builtin_va_copy, cf_cv_have___builtin_va_copy,[
7562 __builtin_va_copy(dst, src)],
7563 cf_cv_have___builtin_va_copy=yes,
7564 cf_cv_have___builtin_va_copy=no)])
7566 test "$cf_cv_have___builtin_va_copy" = yes &&
7567 AC_DEFINE(HAVE___BUILTIN_VA_COPY,1,[Define to 1 if we have __builtin_va_copy])
7569 fi # cf_cv_have___va_copy
7571 fi # cf_cv_have_va_copy
7573 case "${cf_cv_have_va_copy}${cf_cv_have___va_copy}${cf_cv_have___builtin_va_copy}" in
7578 AC_CACHE_CHECK(if we can simply copy va_list, cf_cv_pointer_va_list,[
7585 cf_cv_pointer_va_list=yes,
7586 cf_cv_pointer_va_list=no)])
7588 if test "$cf_cv_pointer_va_list" = no
7590 AC_CACHE_CHECK(if we can copy va_list indirectly, cf_cv_array_va_list,[
7597 cf_cv_array_va_list=yes,
7598 cf_cv_array_va_list=no)])
7599 test "$cf_cv_array_va_list" = yes && AC_DEFINE(ARRAY_VA_LIST,1,[Define to 1 if we can copy va_list indirectly])
7604 dnl ---------------------------------------------------------------------------
7605 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
7607 dnl Use AC_VERBOSE w/o the warnings
7608 AC_DEFUN([CF_VERBOSE],
7609 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
7612 dnl ---------------------------------------------------------------------------
7613 dnl CF_VERSION_INFO version: 7 updated: 2015/04/17 21:13:04
7615 dnl Define several useful symbols derived from the VERSION file. A separate
7616 dnl file is preferred to embedding the version numbers in various scripts.
7617 dnl (automake is a textbook-example of why the latter is a bad idea, but there
7620 dnl The file contents are:
7621 dnl libtool-version release-version patch-version
7625 dnl libtool-version (see ?) consists of 3 integers separated by '.'
7626 dnl release-version consists of a major version and minor version
7627 dnl separated by '.', optionally followed by a patch-version
7628 dnl separated by '-'. The minor version need not be an
7629 dnl integer (but it is preferred).
7630 dnl patch-version is an integer in the form yyyymmdd, so ifdef's and
7631 dnl scripts can easily compare versions.
7633 dnl If libtool is used, the first form is required, since CF_WITH_LIBTOOL
7634 dnl simply extracts the first field using 'cut -f1'.
7636 dnl Optional parameters:
7637 dnl $1 = internal name for package
7638 dnl $2 = external name for package
7639 AC_DEFUN([CF_VERSION_INFO],
7641 if test -f $srcdir/VERSION ; then
7642 AC_MSG_CHECKING(for package version)
7644 # if there are not enough fields, cut returns the last one...
7645 cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
7646 cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2`
7647 cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3`
7649 # this is how CF_BUNDLED_INTL uses $VERSION:
7650 VERSION="$cf_field1"
7652 VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'`
7653 test -z "$VERSION_MAJOR" && AC_MSG_ERROR(missing major-version)
7655 VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[[^.]]*\.//' -e 's/-.*//'`
7656 test -z "$VERSION_MINOR" && AC_MSG_ERROR(missing minor-version)
7658 AC_MSG_RESULT(${VERSION_MAJOR}.${VERSION_MINOR})
7660 AC_MSG_CHECKING(for package patch date)
7661 VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[[^-]]*-//'`
7662 case .$VERSION_PATCH in
7664 AC_MSG_ERROR(missing patch-date $VERSION_PATCH)
7666 (.[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]])
7669 AC_MSG_ERROR(illegal patch-date $VERSION_PATCH)
7672 AC_MSG_RESULT($VERSION_PATCH)
7674 AC_MSG_ERROR(did not find $srcdir/VERSION)
7677 # show the actual data that we have for versions:
7678 CF_VERBOSE(ABI VERSION $VERSION)
7679 CF_VERBOSE(VERSION_MAJOR $VERSION_MAJOR)
7680 CF_VERBOSE(VERSION_MINOR $VERSION_MINOR)
7681 CF_VERBOSE(VERSION_PATCH $VERSION_PATCH)
7684 AC_SUBST(VERSION_MAJOR)
7685 AC_SUBST(VERSION_MINOR)
7686 AC_SUBST(VERSION_PATCH)
7688 dnl if a package name is given, define its corresponding version info. We
7689 dnl need the package name to ensure that the defined symbols are unique.
7692 PACKAGE=ifelse($2,,$1,$2)
7693 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",[Define to the package-name])
7695 CF_UPPER(cf_PACKAGE,$cf_PACKAGE)
7696 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}")
7697 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_PATCHDATE,${VERSION_PATCH})
7700 dnl ---------------------------------------------------------------------------
7701 dnl CF_WCHAR_TYPE version: 4 updated: 2012/10/06 16:39:58
7703 dnl Check if type wide-character type $1 is declared, and if so, which header
7704 dnl file is needed. The second parameter is used to set a shell variable when
7705 dnl the type is not found. The first parameter sets a shell variable for the
7707 AC_DEFUN([CF_WCHAR_TYPE],
7709 # This is needed on Tru64 5.0 to declare $1
7710 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
7715 #ifdef HAVE_LIBUTF8_H
7716 #include <libutf8.h>
7725 #ifdef HAVE_LIBUTF8_H
7726 #include <libutf8.h>
7730 [cf_cv_$1=unknown])])])
7732 if test "$cf_cv_$1" = yes ; then
7733 AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
7738 # if we do not find $1 in either place, use substitution to provide a fallback.
7739 if test "$cf_cv_$1" = unknown ; then
7744 # if we find $1 in either place, use substitution to provide a fallback.
7745 if test "$cf_cv_$1" != unknown ; then
7750 dnl ---------------------------------------------------------------------------
7751 dnl CF_WEAK_SYMBOLS version: 1 updated: 2008/08/16 19:18:06
7753 dnl Check for compiler-support for weak symbols.
7754 dnl This works with "recent" gcc.
7755 AC_DEFUN([CF_WEAK_SYMBOLS],[
7756 AC_CACHE_CHECK(if $CC supports weak symbols,cf_cv_weak_symbols,[
7759 #include <stdio.h>],
7761 #if defined(__GNUC__)
7762 # if defined __USE_ISOC99
7763 # define _cat_pragma(exp) _Pragma(#exp)
7764 # define _weak_pragma(exp) _cat_pragma(weak name)
7766 # define _weak_pragma(exp)
7768 # define _declare(name) __extension__ extern __typeof__(name) name
7769 # define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak))
7773 ],[cf_cv_weak_symbols=yes],[cf_cv_weak_symbols=no])
7776 dnl ---------------------------------------------------------------------------
7777 dnl CF_WITH_ABI_VERSION version: 3 updated: 2015/06/06 16:10:11
7778 dnl -------------------
7779 dnl Allow library's ABI to be overridden. Generally this happens when a
7780 dnl packager has incremented the ABI past that used in the original package,
7781 dnl and wishes to keep doing this.
7783 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
7785 AC_DEFUN([CF_WITH_ABI_VERSION],[
7786 test -z "$cf_cv_abi_version" && cf_cv_abi_version=0
7787 AC_ARG_WITH(abi-version,
7788 [ --with-abi-version=XXX override derived ABI version],[
7789 if test "x$cf_cv_abi_version" != "x$withval"
7791 AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval)
7792 case $cf_cv_rel_version in
7794 cf_cv_rel_version=$withval.0
7797 cf_cv_rel_version=$withval.9 # FIXME: should be 10 as of 6.0 release
7801 cf_cv_abi_version=$withval])
7802 CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version)
7804 $1_ABI=$cf_cv_abi_version
7807 dnl ---------------------------------------------------------------------------
7808 dnl CF_WITH_ADA_COMPILER version: 2 updated: 2010/06/26 17:35:58
7809 dnl --------------------
7810 dnl Command-line option to specify the Ada95 compiler.
7811 AC_DEFUN([CF_WITH_ADA_COMPILER],[
7812 AC_MSG_CHECKING(for ada-compiler)
7813 AC_ARG_WITH(ada-compiler,
7814 [ --with-ada-compiler=CMD specify Ada95 compiler command (default gnatmake)],
7815 [cf_ada_compiler=$withval],
7816 [cf_ada_compiler=gnatmake])
7817 AC_SUBST(cf_ada_compiler)
7818 AC_MSG_RESULT($cf_ada_compiler)
7820 dnl ---------------------------------------------------------------------------
7821 dnl CF_WITH_ADA_INCLUDE version: 2 updated: 2010/06/26 17:35:58
7822 dnl -------------------
7823 dnl Command-line option to specify where Ada includes will install.
7824 AC_DEFUN([CF_WITH_ADA_INCLUDE],[
7825 AC_MSG_CHECKING(for ada-include)
7826 CF_WITH_PATH(ada-include,
7827 [ --with-ada-include=DIR Ada includes are in DIR],
7829 PREFIX/share/ada/adainclude,
7830 [$]prefix/share/ada/adainclude)
7831 AC_SUBST(ADA_INCLUDE)
7832 AC_MSG_RESULT($ADA_INCLUDE)
7834 dnl ---------------------------------------------------------------------------
7835 dnl CF_WITH_ADA_LIBNAME version: 1 updated: 2019/09/07 18:59:41
7836 dnl -------------------
7837 dnl CF_WITH_ADA_LIBNAME
7838 dnl -------------------
7839 dnl Command-line option to specify how to name the resulting Ada library.
7840 dnl $1 = default value
7841 AC_DEFUN([CF_WITH_ADA_LIBNAME],[
7842 AC_MSG_CHECKING(for ada-libname)
7843 AC_ARG_WITH(ada-libname,
7844 [ --with-ada-libname=XXX override default Ada library-name],
7845 ADA_LIBNAME=[$]withval,
7847 case "x$ADA_LIBNAME" in
7852 AC_SUBST(ADA_LIBNAME)
7853 AC_MSG_RESULT($ADA_LIBNAME)
7855 dnl ---------------------------------------------------------------------------
7856 dnl CF_WITH_ADA_OBJECTS version: 2 updated: 2010/06/26 17:35:58
7857 dnl -------------------
7858 dnl Command-line option to specify where Ada objects will install.
7859 AC_DEFUN([CF_WITH_ADA_OBJECTS],[
7860 AC_MSG_CHECKING(for ada-objects)
7861 CF_WITH_PATH(ada-objects,
7862 [ --with-ada-objects=DIR Ada objects are in DIR],
7864 PREFIX/lib/ada/adalib,
7865 [$]prefix/lib/ada/adalib)
7866 AC_SUBST(ADA_OBJECTS)
7867 AC_MSG_RESULT($ADA_OBJECTS)
7869 dnl ---------------------------------------------------------------------------
7870 dnl CF_WITH_ADA_SHAREDLIB version: 5 updated: 2018/07/21 19:10:35
7871 dnl ---------------------
7872 dnl Command-line option to specify if an Ada95 shared-library should be built,
7873 dnl and optionally what its soname should be.
7874 AC_DEFUN([CF_WITH_ADA_SHAREDLIB],[
7875 AC_REQUIRE([CF_GNAT_PROJECTS])
7876 AC_MSG_CHECKING(if an Ada95 shared-library should be built)
7877 AC_ARG_WITH(ada-sharedlib,
7878 [ --with-ada-sharedlib=soname build shared-library (requires GNAT projects)],
7879 [with_ada_sharedlib=$withval],
7880 [with_ada_sharedlib=no])
7881 AC_MSG_RESULT($with_ada_sharedlib)
7883 if test "x$with_ada_sharedlib" != xno
7885 if test "x$cf_gnat_projects" != xyes
7887 AC_MSG_WARN(disabling shared-library since GNAT projects are not supported)
7888 with_ada_sharedlib=no
7892 ADA_SHAREDLIB='lib$(LIB_NAME).so.1'
7893 MAKE_ADA_SHAREDLIB="#"
7895 if test "x$with_ada_sharedlib" != xno
7898 if test "x$with_ada_sharedlib" != xyes
7900 ADA_SHAREDLIB="$with_ada_sharedlib"
7904 AC_SUBST(ADA_SHAREDLIB)
7905 AC_SUBST(MAKE_ADA_SHAREDLIB)
7907 dnl ---------------------------------------------------------------------------
7908 dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
7909 dnl ----------------
7910 dnl Configure-option for dbmalloc. The optional parameter is used to override
7911 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
7912 AC_DEFUN([CF_WITH_DBMALLOC],[
7913 CF_NO_LEAKS_OPTION(dbmalloc,
7914 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
7917 if test "$with_dbmalloc" = yes ; then
7918 AC_CHECK_HEADER(dbmalloc.h,
7919 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
7922 dnl ---------------------------------------------------------------------------
7923 dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
7925 dnl Configure-option for dmalloc. The optional parameter is used to override
7926 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
7927 AC_DEFUN([CF_WITH_DMALLOC],[
7928 CF_NO_LEAKS_OPTION(dmalloc,
7929 [ --with-dmalloc test: use Gray Watson's dmalloc library],
7932 if test "$with_dmalloc" = yes ; then
7933 AC_CHECK_HEADER(dmalloc.h,
7934 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
7937 dnl ---------------------------------------------------------------------------
7938 dnl CF_WITH_EXPORT_SYMS version: 3 updated: 2014/12/20 19:16:08
7939 dnl -------------------
7940 dnl Use this with libtool to specify the list of symbols that may be exported.
7941 dnl The input file contains one symbol per line; comments work with "#".
7943 dnl $1 = basename of the ".sym" file (default $PACKAGE)
7944 AC_DEFUN([CF_WITH_EXPORT_SYMS],
7946 AC_MSG_CHECKING(if exported-symbols file should be used)
7947 AC_ARG_WITH(export-syms,
7948 [ --with-export-syms=XXX limit exported symbols using libtool],
7949 [with_export_syms=$withval],
7950 [with_export_syms=no])
7951 if test "x$with_export_syms" = xyes
7953 with_export_syms='${top_srcdir}/package/ifelse($1,,${PACKAGE},[$1]).sym'
7956 AC_MSG_RESULT($with_export_syms)
7957 if test "x$with_export_syms" != xno
7959 EXPORT_SYMS="-export-symbols $with_export_syms"
7960 AC_SUBST(EXPORT_SYMS)
7963 dnl ---------------------------------------------------------------------------
7964 dnl CF_WITH_GPM version: 10 updated: 2017/04/29 18:32:18
7967 dnl The option parameter (if neither yes/no) is assumed to be the name of
7968 dnl the gpm library, e.g., for dynamic loading.
7969 AC_DEFUN([CF_WITH_GPM],
7971 AC_MSG_CHECKING(if you want to link with the GPM mouse library)
7973 [ --with-gpm use Alessandro Rubini's GPM library],
7974 [with_gpm=$withval],
7976 AC_MSG_RESULT($with_gpm)
7978 if test "$with_gpm" != no ; then
7979 AC_CHECK_HEADER(gpm.h,[
7980 AC_DEFINE(HAVE_GPM_H,1,[Define to 1 if we have gpm.h header])
7981 if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then
7982 CF_VERBOSE(assuming we really have GPM library)
7983 AC_DEFINE(HAVE_LIBGPM,1,[Define to 1 if we have the gpm library])
7986 AC_CHECK_LIB(gpm,Gpm_Open,[with_gpm=yes],[
7987 if test "$with_gpm" = maybe; then
7988 AC_MSG_WARN(Cannot link with GPM library)
7991 AC_MSG_ERROR(Cannot link with GPM library)
7996 test "$with_gpm" != maybe && AC_MSG_WARN(Cannot find GPM header)
8001 dnl ---------------------------------------------------------------------------
8002 dnl CF_WITH_LIBTOOL version: 35 updated: 2017/08/12 07:58:51
8004 dnl Provide a configure option to incorporate libtool. Define several useful
8005 dnl symbols for the makefile rules.
8007 dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
8008 dnl macros from libtool.m4 which is in the aclocal directory of automake.
8009 dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
8010 dnl But that still does not work properly since the macro is expanded outside
8011 dnl the CF_WITH_LIBTOOL macro:
8014 dnl ACLOCAL=`aclocal --print-ac-dir`
8015 dnl if test -z "$ACLOCAL" ; then
8016 dnl echo cannot find aclocal directory
8018 dnl elif test ! -f $ACLOCAL/libtool.m4 ; then
8019 dnl echo cannot find libtool.m4 file
8023 dnl LOCAL=aclocal.m4
8024 dnl ORIG=aclocal.m4.orig
8026 dnl trap "mv $ORIG $LOCAL" 0 1 2 3 15
8030 dnl # sed the LIBTOOL= assignment to omit the current directory?
8031 dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL:-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
8032 dnl cat $ORIG >>$LOCAL
8036 AC_DEFUN([CF_WITH_LIBTOOL],
8038 AC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION])
8039 ifdef([AC_PROG_LIBTOOL],,[
8042 # common library maintenance symbols that are convenient for libtool scripts:
8043 LIB_CREATE='${AR} -cr'
8044 LIB_OBJECT='${OBJECTS}'
8048 # symbols used to prop libtool up to enable it to determine what it should be
8056 AC_MSG_CHECKING(if you want to build libraries with libtool)
8057 AC_ARG_WITH(libtool,
8058 [ --with-libtool generate libraries with libtool],
8059 [with_libtool=$withval],
8061 AC_MSG_RESULT($with_libtool)
8062 if test "$with_libtool" != "no"; then
8063 ifdef([AC_PROG_LIBTOOL],[
8064 # missing_content_AC_PROG_LIBTOOL{{
8066 # missing_content_AC_PROG_LIBTOOL}}
8068 if test "$with_libtool" != "yes" ; then
8069 CF_PATH_SYNTAX(with_libtool)
8070 LIBTOOL=$with_libtool
8072 AC_CHECK_TOOLS(LIBTOOL,[libtool glibtool],none)
8074 if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool
8076 CF_FORGET_TOOL(LIBTOOL)
8077 AC_CHECK_TOOLS(LIBTOOL,[glibtool],none)
8081 if test -z "$LIBTOOL" ; then
8082 AC_MSG_ERROR(Cannot find libtool)
8085 LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${libdir} ${LIBTOOL_VERSION} `cut -f1 ${top_srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o'
8086 LIB_OBJECT='${OBJECTS:.o=.lo}'
8088 LIB_CLEAN='${LIBTOOL} --mode=clean'
8089 LIB_COMPILE='${LIBTOOL} --mode=compile'
8090 LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}'
8091 LIB_INSTALL='${LIBTOOL} --mode=install'
8092 LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
8095 CF_CHECK_LIBTOOL_VERSION
8097 # special hack to add -no-undefined (which libtool should do for itself)
8099 case "$cf_cv_system_name" in
8100 (cygwin*|msys*|mingw32*|os2*|uwin*|aix[[4-7]])
8101 LT_UNDEF=-no-undefined
8104 AC_SUBST([LT_UNDEF])
8106 # special hack to add --tag option for C++ compiler
8107 case $cf_cv_libtool_version in
8108 (1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*)
8109 LIBTOOL_CXX="$LIBTOOL --tag=CXX"
8110 LIBTOOL="$LIBTOOL --tag=CC"
8113 LIBTOOL_CXX="$LIBTOOL"
8121 test -z "$LIBTOOL" && ECHO_LT=
8124 AC_SUBST(LIBTOOL_CXX)
8125 AC_SUBST(LIBTOOL_OPTS)
8127 AC_SUBST(LIB_CREATE)
8128 AC_SUBST(LIB_OBJECT)
8129 AC_SUBST(LIB_SUFFIX)
8133 AC_SUBST(LIB_COMPILE)
8135 AC_SUBST(LIB_INSTALL)
8136 AC_SUBST(LIB_UNINSTALL)
8139 dnl ---------------------------------------------------------------------------
8140 dnl CF_WITH_LIBTOOL_OPTS version: 4 updated: 2015/04/17 21:13:04
8141 dnl --------------------
8142 dnl Allow user to pass additional libtool options into the library creation
8143 dnl and link steps. The main use for this is to do something like
8144 dnl ./configure --with-libtool-opts=-static
8145 dnl to get the same behavior as automake-flavored
8146 dnl ./configure --enable-static
8147 AC_DEFUN([CF_WITH_LIBTOOL_OPTS],[
8148 AC_MSG_CHECKING(for additional libtool options)
8149 AC_ARG_WITH(libtool-opts,
8150 [ --with-libtool-opts=XXX specify additional libtool options],
8151 [with_libtool_opts=$withval],
8152 [with_libtool_opts=no])
8153 AC_MSG_RESULT($with_libtool_opts)
8155 case .$with_libtool_opts in
8159 LIBTOOL_OPTS="$LIBTOOL_OPTS $with_libtool_opts"
8163 AC_SUBST(LIBTOOL_OPTS)
8165 dnl ---------------------------------------------------------------------------
8166 dnl CF_WITH_LIB_PREFIX version: 1 updated: 2012/01/21 19:28:10
8167 dnl ------------------
8168 dnl Allow the library-prefix to be overridden. OS/2 EMX originally had no
8169 dnl "lib" prefix, e.g., because it used the dll naming convention.
8171 dnl $1 = variable to set
8172 AC_DEFUN([CF_WITH_LIB_PREFIX],
8174 AC_MSG_CHECKING(if you want to have a library-prefix)
8175 AC_ARG_WITH(lib-prefix,
8176 [ --with-lib-prefix override library-prefix],
8177 [with_lib_prefix=$withval],
8178 [with_lib_prefix=auto])
8179 AC_MSG_RESULT($with_lib_prefix)
8181 if test $with_lib_prefix = auto
8184 elif test $with_lib_prefix = no
8188 LIB_PREFIX=$with_lib_prefix
8191 dnl ---------------------------------------------------------------------------
8192 dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19
8194 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
8195 dnl defaulting to yes/no.
8197 dnl $1 = option name
8199 dnl $3 = environment variable to set
8200 dnl $4 = default value, shown in the help-message, must be a constant
8201 dnl $5 = default value, if it's an expression & cannot be in the help-message
8203 AC_DEFUN([CF_WITH_PATH],
8204 [AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),,
8205 ifelse([$4],,[withval="${$3}"],[withval="${$3:-ifelse([$5],,[$4],[$5])}"]))dnl
8206 if ifelse([$5],,true,[test -n "$5"]) ; then
8207 CF_PATH_SYNTAX(withval)
8212 dnl ---------------------------------------------------------------------------
8213 dnl CF_WITH_PATHLIST version: 10 updated: 2015/04/17 21:13:04
8214 dnl ----------------
8215 dnl Process an option specifying a list of colon-separated paths.
8217 dnl $1 = option name
8219 dnl $3 = environment variable to set
8220 dnl $4 = default value, shown in the help-message, must be a constant
8221 dnl $5 = default value, if it's an expression & cannot be in the help-message
8222 dnl $6 = flag to tell if we want to define or substitute
8224 AC_DEFUN([CF_WITH_PATHLIST],[
8225 AC_REQUIRE([CF_PATHSEP])
8226 AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
8227 ifelse($4,,[withval=${$3}],[withval=${$3:-ifelse($5,,$4,$5)}]))dnl
8229 IFS="${IFS:- }"; ac_save_ifs="$IFS"; IFS="${PATH_SEPARATOR}"
8231 for cf_src_path in $withval
8233 CF_PATH_SYNTAX(cf_src_path)
8234 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}$PATH_SEPARATOR"
8235 cf_dst_path="${cf_dst_path}${cf_src_path}"
8240 # Strip single quotes from the value, e.g., when it was supplied as a literal
8242 case $cf_dst_path in
8244 cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//`
8247 cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
8250 # This may use the prefix/exec_prefix symbols which will only yield "NONE"
8251 # so we have to check/work around. We do prefer the result of "eval"...
8252 eval cf_dst_eval="$cf_dst_path"
8253 case "x$cf_dst_eval" in
8264 dnl ---------------------------------------------------------------------------
8265 dnl CF_WITH_PCRE2 version: 2 updated: 2018/07/14 16:47:56
8267 dnl Add PCRE2 (Perl-compatible regular expressions v2) to the build if it is
8268 dnl available and the user requests it. Assume the application will otherwise
8269 dnl use the POSIX interface.
8271 dnl TODO allow $withval to specify package location
8272 AC_DEFUN([CF_WITH_PCRE2],
8274 AC_REQUIRE([CF_PKG_CONFIG])
8276 AC_MSG_CHECKING(if you want to use PCRE2 for regular-expressions)
8278 [ --with-pcre2 use PCRE2 for regular-expressions])
8279 test -z "$with_pcre2" && with_pcre2=no
8280 AC_MSG_RESULT($with_pcre2)
8282 if test "x$with_pcre2" != xno ; then
8283 CF_TRY_PKG_CONFIG(libpcre2,,[
8284 CF_TRY_PKG_CONFIG(libpcre,,[
8285 AC_MSG_ERROR(Cannot find PCRE2 library)])])
8287 AC_DEFINE(HAVE_LIB_PCRE2,1,[Define to 1 if we can/should compile with the PCRE2 library])
8289 # if pkgconfig gave no results, look for the libraries directly
8291 (*pcre2-posix*|*pcreposix*)
8294 AC_CHECK_LIB(pcre2-posix,regcomp,[
8295 CF_ADD_LIB(pcre2-posix)],
8296 [AC_CHECK_LIB(pcreposix,regcomp,[
8297 CF_ADD_LIB(pcreposix)
8298 ],[AC_MSG_ERROR(Cannot find PCRE2 POSIX library)])])
8302 # either way, check for the library header files
8303 AC_CHECK_HEADERS(pcre2-posix.h pcreposix.h)
8306 dnl ---------------------------------------------------------------------------
8307 dnl CF_WITH_PKG_CONFIG_LIBDIR version: 10 updated: 2015/08/22 17:10:56
8308 dnl -------------------------
8309 dnl Allow the choice of the pkg-config library directory to be overridden.
8310 AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[
8314 AC_MSG_CHECKING(for pkg-config library directory)
8317 AC_MSG_CHECKING(for $PKG_CONFIG library directory)
8321 PKG_CONFIG_LIBDIR=no
8322 AC_ARG_WITH(pkg-config-libdir,
8323 [ --with-pkg-config-libdir=XXX use given directory for installing pc-files],
8324 [PKG_CONFIG_LIBDIR=$withval],
8325 [test "x$PKG_CONFIG" != xnone && PKG_CONFIG_LIBDIR=yes])
8327 case x$PKG_CONFIG_LIBDIR in
8331 # Look for the library directory using the same prefix as the executable
8332 if test "x$PKG_CONFIG" = xnone
8336 cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`
8339 # If you don't like using the default architecture, you have to specify the
8340 # intended library directory and corresponding compiler/linker options.
8342 # This case allows for Debian's 2014-flavor of multiarch, along with the
8343 # most common variations before that point. Some other variants spell the
8344 # directory differently, e.g., "pkg-config", and put it in unusual places.
8345 # pkg-config has always been poorly standardized, which is ironic...
8346 case x`(arch) 2>/dev/null` in
8349 $cf_path/lib/*64-linux-gnu \
8357 $cf_path/lib/*-linux-gnu \
8366 for cf_config in $cf_search_path
8368 CF_VERBOSE(checking $cf_config/pkgconfig)
8369 if test -d $cf_config/pkgconfig
8371 PKG_CONFIG_LIBDIR=$cf_config/pkgconfig
8372 AC_MSG_CHECKING(done)
8381 if test "x$PKG_CONFIG_LIBDIR" != xno ; then
8382 AC_MSG_RESULT($PKG_CONFIG_LIBDIR)
8385 AC_SUBST(PKG_CONFIG_LIBDIR)
8387 dnl ---------------------------------------------------------------------------
8388 dnl CF_WITH_PATH_PROG version: 1 updated: 2019/06/30 19:44:43
8389 dnl -----------------
8390 dnl Check for a given program, like CF_PATH_PROG, but allow override using a
8391 dnl "--with-xxx" option.
8394 dnl $1 = environment variable to set/update
8395 dnl $2 = program name
8398 AC_DEFUN([CF_WITH_PATH_PROG],[
8399 AC_ARG_WITH($2-path,
8400 [ --with-$2-path=XXX specify path of $2 ifelse($3,,,$3)],
8401 [AC_MSG_CHECKING(for $2 program ifelse($3,,,$3))
8403 AC_MSG_RESULT([$]$1)
8406 [CF_PATH_PROG($1,$2,,ifelse($4,,,$4))
8409 AC_MSG_WARN(no $2 program found ifelse($3,,,$3))
8413 dnl ---------------------------------------------------------------------------
8414 dnl CF_WITH_PTHREAD version: 7 updated: 2015/04/18 08:56:57
8416 dnl Check for POSIX thread library.
8417 AC_DEFUN([CF_WITH_PTHREAD],
8419 AC_MSG_CHECKING(if you want to link with the pthread library)
8420 AC_ARG_WITH(pthread,
8421 [ --with-pthread use POSIX thread library],
8422 [with_pthread=$withval],
8424 AC_MSG_RESULT($with_pthread)
8426 if test "$with_pthread" != no ; then
8427 AC_CHECK_HEADER(pthread.h,[
8428 AC_DEFINE(HAVE_PTHREADS_H,1,[Define to 1 if we have pthreads.h header])
8430 for cf_lib_pthread in pthread c_r
8432 AC_MSG_CHECKING(if we can link with the $cf_lib_pthread library)
8433 cf_save_LIBS="$LIBS"
8434 CF_ADD_LIB($cf_lib_pthread)
8436 #include <pthread.h>
8438 int rc = pthread_create(0,0,0,0);
8439 int r2 = pthread_mutexattr_settype(0, 0);
8440 ],[with_pthread=yes],[with_pthread=no])
8441 LIBS="$cf_save_LIBS"
8442 AC_MSG_RESULT($with_pthread)
8443 test "$with_pthread" = yes && break
8446 if test "$with_pthread" = yes ; then
8447 CF_ADD_LIB($cf_lib_pthread)
8448 AC_DEFINE(HAVE_LIBPTHREADS,1,[Define to 1 if we have pthreads library])
8450 AC_MSG_ERROR(Cannot link with pthread library)
8455 dnl ---------------------------------------------------------------------------
8456 dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
8457 dnl -------------------
8458 dnl Allow library's release-version to be overridden. Generally this happens when a
8459 dnl packager has incremented the release-version past that used in the original package,
8460 dnl and wishes to keep doing this.
8462 dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR
8463 dnl and {package}_MINOR symbols
8465 AC_DEFUN([CF_WITH_REL_VERSION],[
8466 test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
8467 AC_ARG_WITH(rel-version,
8468 [ --with-rel-version=XXX override derived release version],
8469 [AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval)
8470 cf_cv_rel_version=$withval])
8472 CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
8474 $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'`
8475 $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'`
8476 CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version)
8477 CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version)
8480 dnl ---------------------------------------------------------------------------
8481 dnl CF_WITH_SYSMOUSE version: 3 updated: 2012/10/06 17:56:13
8482 dnl ----------------
8483 dnl If we can compile with sysmouse, make it available unless it is not wanted.
8484 AC_DEFUN([CF_WITH_SYSMOUSE],[
8485 # not everyone has "test -c"
8486 if test -c /dev/sysmouse 2>/dev/null ; then
8487 AC_MSG_CHECKING(if you want to use sysmouse)
8488 AC_ARG_WITH(sysmouse,
8489 [ --with-sysmouse use sysmouse (FreeBSD console)],
8490 [cf_with_sysmouse=$withval],
8491 [cf_with_sysmouse=maybe])
8492 if test "$cf_with_sysmouse" != no ; then
8494 #include <osreldate.h>
8495 #if (__FreeBSD_version >= 400017)
8496 #include <sys/consio.h>
8497 #include <sys/fbio.h>
8499 #include <machine/console.h>
8502 struct mouse_info the_mouse;
8503 ioctl(0, CONS_MOUSECTL, &the_mouse);
8504 ],[cf_with_sysmouse=yes],[cf_with_sysmouse=no])
8506 AC_MSG_RESULT($cf_with_sysmouse)
8507 test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE,1,[Define to 1 if we can/should use the sysmouse interface])
8510 dnl ---------------------------------------------------------------------------
8511 dnl CF_WITH_SYSTYPE version: 1 updated: 2013/01/26 16:26:12
8513 dnl For testing, override the derived host system-type which is used to decide
8514 dnl things such as the linker commands used to build shared libraries. This is
8515 dnl normally chosen automatically based on the type of system which you are
8516 dnl building on. We use it for testing the configure script.
8518 dnl This is different from the --host option: it is used only for testing parts
8519 dnl of the configure script which would not be reachable with --host since that
8520 dnl relies on the build environment being real, rather than mocked up.
8521 AC_DEFUN([CF_WITH_SYSTYPE],[
8522 CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
8523 AC_ARG_WITH(system-type,
8524 [ --with-system-type=XXX test: override derived host system-type],
8525 [AC_MSG_WARN(overriding system type to $withval)
8526 cf_cv_system_name=$withval
8530 dnl ---------------------------------------------------------------------------
8531 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
8532 dnl ----------------
8533 AC_DEFUN([CF_WITH_VALGRIND],[
8534 CF_NO_LEAKS_OPTION(valgrind,
8535 [ --with-valgrind test: use valgrind],
8538 dnl ---------------------------------------------------------------------------
8539 dnl CF_WITH_VERSIONED_SYMS version: 8 updated: 2018/10/20 20:24:34
8540 dnl ----------------------
8541 dnl Use this when building shared library with ELF, to markup symbols with the
8542 dnl version identifier from the given input file. Generally that identifier is
8543 dnl the same as the SONAME at which the symbol was first introduced.
8545 dnl $1 = basename of the ".map" file (default $PACKAGE)
8546 AC_DEFUN([CF_WITH_VERSIONED_SYMS],
8548 AC_MSG_CHECKING(if versioned-symbols file should be used)
8549 AC_ARG_WITH(versioned-syms,
8550 [ --with-versioned-syms=X markup versioned symbols using ld],
8551 [with_versioned_syms=$withval],
8552 [with_versioned_syms=no])
8553 case "x$with_versioned_syms" in
8555 with_versioned_syms='${top_srcdir}/package/ifelse($1,,${PACKAGE},[$1]).map'
8561 test -f "$with_versioned_syms" || AC_MSG_ERROR(expected a filename: $with_versioned_syms)
8564 test -f "$with_versioned_syms" || AC_MSG_ERROR(expected a filename: $with_versioned_syms)
8565 with_versioned_syms=`pwd`/"$with_versioned_syms"
8568 AC_MSG_RESULT($with_versioned_syms)
8574 if test "x$with_versioned_syms" != xno
8576 RESULTING_SYMS=$with_versioned_syms
8577 case "x$MK_SHARED_LIB" in
8579 VERSIONED_SYMS="-Wl,--version-script,\${RESULTING_SYMS}"
8580 MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-Wl,%\\[$]{VERSIONED_SYMS} -Wl,%"`
8581 CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB)
8584 VERSIONED_SYMS="-Wl,-M,\${RESULTING_SYMS}"
8585 MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-dy%\\[$]{VERSIONED_SYMS} -dy%"`
8586 CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB)
8589 AC_MSG_WARN(this system does not support versioned-symbols)
8593 # Linux ld can selectively override scope, e.g., of symbols beginning with
8594 # "_" by first declaring some as global, and then using a wildcard to
8595 # declare the others as local. Some other loaders cannot do this. Check
8596 # by constructing a (very) simple shared library and inspecting its
8598 if test "x$VERSIONED_SYMS" != "x"
8600 AC_MSG_CHECKING(if wildcards can be used to selectively omit symbols)
8606 cat >conftest.ver <<EOF
8635 cat >conftest.$ac_ext <<EOF
8636 #line __oline__ "configure"
8637 int _ismissing(void) { return 1; }
8638 int _localf1(void) { return 1; }
8639 int _localf2(void) { return 2; }
8640 int globalf1(void) { return 1; }
8641 int globalf2(void) { return 2; }
8642 int _sublocalf1(void) { return 1; }
8643 int _sublocalf2(void) { return 2; }
8644 int subglobalf1(void) { return 1; }
8645 int subglobalf2(void) { return 2; }
8647 cat >conftest.mk <<EOF
8650 CPPFLAGS=${CPPFLAGS}
8653 VERSIONED_SYMS=${VERSIONED_SYMS}
8654 RESULTING_SYMS=conftest.ver
8655 MK_SHARED_LIB=${MK_SHARED_LIB}
8656 conftest.so: conftest.$ac_cv_objext
8657 \$(MK_SHARED_LIB) conftest.$ac_cv_objext
8660 # compile source, make library
8661 if make -f conftest.mk 2>&AC_FD_CC >/dev/null
8663 # test for missing symbol in either Data or Text section
8664 cf_missing=`nm -P conftest.so 2>&AC_FD_CC |fgrep _ismissing | egrep '[[ ]][[DT]][[ ]]'`
8665 test -n "$cf_missing" && WILDCARD_SYMS=yes
8667 AC_MSG_RESULT($WILDCARD_SYMS)
8671 AC_SUBST(RESULTING_SYMS)
8672 AC_SUBST(VERSIONED_SYMS)
8673 AC_SUBST(WILDCARD_SYMS)
8675 dnl ---------------------------------------------------------------------------
8676 dnl CF_WITH_X11_RGB version: 1 updated: 2017/11/25 17:32:16
8678 dnl Handle configure option "--with-x11-rgb", setting these shell
8681 dnl $RGB_PATH is the option value, used for finding the X11 rgb file.
8682 dnl $no_x11_rgb is a "#" (comment) if "--without-x11-rgb" is given.
8684 dnl Most Linux's use this:
8685 dnl /usr/share/X11/rgb.txt
8686 dnl Debian uses this:
8687 dnl /etc/X11/rgb.txt
8688 dnl DragonFlyBSD ports uses this:
8689 dnl /usr/pkg/lib/X11/rgb.txt
8690 dnl FreeBSD ports use these:
8691 dnl /usr/local/lib/X11/rgb.txt
8692 dnl /usr/local/share/X11/rgb.txt
8693 dnl Mandriva has these:
8694 dnl /usr/lib/X11/rgb.txt
8695 dnl /usr/lib64/X11/rgb.txt
8696 dnl NetBSD has these
8697 dnl /usr/X11R7/lib/X11/rgb.txt
8698 dnl OpenSolaris uses
8700 dnl /usr/X11/etc/X11/rgb.txt
8701 dnl /usr/X11/share/X11/rgb.txt
8702 dnl /usr/X11/lib/X11/rgb.txt
8704 dnl /opt/local/share/X11/rgb.txt (MacPorts)
8705 dnl /opt/X11/share/X11/rgb.txt (non-ports)
8707 dnl /usr/X11/etc/X11/rgb.txt
8708 dnl /usr/X11/share/X11/rgb.txt (perhaps)
8709 dnl /usr/X11/lib/amd64/X11/rgb.txt
8710 dnl Solaris10 uses (in this order):
8711 dnl /usr/openwin/lib/X11/rgb.txt
8712 dnl /usr/X11/lib/X11/rgb.txt
8713 AC_DEFUN([CF_WITH_X11_RGB],[
8714 AC_MSG_CHECKING(for X11 rgb file)
8715 AC_ARG_WITH(x11-rgb,
8716 [ --with-x11-rgb=FILE file containing X11 rgb information (EPREFIX/lib/X11/rgb.txt)],
8717 [RGB_PATH=$withval],
8720 if test "x[$]RGB_PATH" = xauto
8722 RGB_PATH='${exec_prefix}/lib/X11/rgb.txt'
8724 /opt/local/share/X11/rgb.txt \
8725 /opt/X11/share/X11/rgb.txt \
8726 /usr/share/X11/rgb.txt \
8727 /usr/X11/share/X11/rgb.txt \
8728 /usr/X11/lib/X11/rgb.txt \
8729 /usr/lib/X11/rgb.txt \
8731 /usr/pkg/lib/X11/rgb.txt \
8732 /usr/X11R7/lib/X11/rgb.txt \
8733 /usr/X11R6/lib/X11/rgb.txt \
8734 /usr/X11R5/lib/X11/rgb.txt \
8735 /usr/X11R4/lib/X11/rgb.txt \
8736 /usr/local/lib/X11/rgb.txt \
8737 /usr/local/share/X11/rgb.txt \
8738 /usr/lib64/X11/rgb.txt
8740 if test -f "$cf_path" ; then
8747 CF_PATH_SYNTAX(cf_path)
8750 AC_MSG_RESULT($RGB_PATH)
8752 AC_DEFINE_UNQUOTED(RGB_PATH,"$cf_path")
8755 if test "$RGB_PATH" = no
8759 AC_SUBST(no_x11_rgb)
8761 dnl ---------------------------------------------------------------------------
8762 dnl CF_XOPEN_SOURCE version: 55 updated: 2018/12/31 20:46:17
8764 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
8765 dnl or adapt to the vendor's definitions to get equivalent functionality,
8766 dnl without losing the common non-POSIX features.
8769 dnl $1 is the nominal value for _XOPEN_SOURCE
8770 dnl $2 is the nominal value for _POSIX_C_SOURCE
8771 AC_DEFUN([CF_XOPEN_SOURCE],[
8772 AC_REQUIRE([AC_CANONICAL_HOST])
8773 AC_REQUIRE([CF_POSIX_VISIBLE])
8775 if test "$cf_cv_posix_visible" = no; then
8777 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
8778 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
8783 cf_xopen_source="-D_ALL_SOURCE"
8789 cf_xopen_source="-D_APPLE_C_SOURCE"
8792 cf_xopen_source="-D_DARWIN_C_SOURCE"
8795 (freebsd*|dragonfly*|midnightbsd*)
8796 # 5.x headers associate
8797 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
8798 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
8799 cf_POSIX_C_SOURCE=200112L
8801 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
8804 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
8807 cf_xopen_source="-D_HPUX_SOURCE"
8810 cf_xopen_source="-D_SGI_SOURCE"
8813 (linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
8814 CF_GNU_SOURCE($cf_XOPEN_SOURCE)
8817 cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this...
8820 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
8822 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
8825 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
8828 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
8829 cf_xopen_source="-D_BSD_SOURCE"
8833 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
8836 cf_xopen_source="-D_OSF_SOURCE"
8839 cf_xopen_source="-D_QNX_SOURCE"
8842 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
8845 cf_xopen_source="-D__EXTENSIONS__"
8846 cf_cv_xopen_source=broken
8848 (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2)
8854 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
8858 if test -n "$cf_xopen_source" ; then
8859 CF_ADD_CFLAGS($cf_xopen_source,true)
8862 dnl In anything but the default case, we may have system-specific setting
8863 dnl which is still not guaranteed to provide all of the entrypoints that
8864 dnl _XOPEN_SOURCE would yield.
8865 if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
8866 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
8867 AC_TRY_COMPILE([#include <stdlib.h>],[
8868 #ifndef _XOPEN_SOURCE
8871 [cf_XOPEN_SOURCE_set=yes],
8872 [cf_XOPEN_SOURCE_set=no])
8873 AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
8874 if test $cf_XOPEN_SOURCE_set = yes
8876 AC_TRY_COMPILE([#include <stdlib.h>],[
8877 #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
8880 [cf_XOPEN_SOURCE_set_ok=yes],
8881 [cf_XOPEN_SOURCE_set_ok=no])
8882 if test $cf_XOPEN_SOURCE_set_ok = no
8884 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
8890 fi # cf_cv_posix_visible