1 dnl***************************************************************************
2 dnl Copyright (c) 2010-2019,2020 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
31 dnl $Id: aclocal.m4,v 1.151 2020/01/11 23:42:04 tom Exp $
32 dnl Macros used in NCURSES Ada95 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 these pages for additional information:
39 dnl https://invisible-island.net/autoconf/
40 dnl https://invisible-island.net/autoconf/my-autoconf.html
42 dnl ---------------------------------------------------------------------------
43 dnl ---------------------------------------------------------------------------
44 dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
45 dnl ------------------
46 dnl Conditionally generate script according to whether we're using a given autoconf.
48 dnl $1 = version to compare against
49 dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
50 dnl $3 = code to use if AC_ACVERSION is older than $1.
51 define([CF_ACVERSION_CHECK],
53 ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
54 ifdef([m4_version_compare],
55 [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
56 [CF_ACVERSION_COMPARE(
57 AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
58 AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
59 dnl ---------------------------------------------------------------------------
60 dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
61 dnl --------------------
62 dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
63 dnl MAJOR2, MINOR2, TERNARY2,
64 dnl PRINTABLE2, not FOUND, FOUND)
65 define([CF_ACVERSION_COMPARE],
66 [ifelse(builtin([eval], [$2 < $5]), 1,
67 [ifelse([$8], , ,[$8])],
68 [ifelse([$9], , ,[$9])])])dnl
69 dnl ---------------------------------------------------------------------------
70 dnl CF_ADA_INCLUDE_DIRS version: 8 updated: 2013/10/14 04:24:07
71 dnl -------------------
72 dnl Construct the list of include-options for the C programs in the Ada95
74 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
76 ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS"
77 if test "$srcdir" != "."; then
78 ACPPFLAGS="-I\${srcdir}/../../include $ACPPFLAGS"
80 if test "$GCC" != yes; then
81 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
82 elif test "$includedir" != "/usr/include"; then
83 if test "$includedir" = '${prefix}/include' ; then
84 if test x$prefix != x/usr ; then
85 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
88 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
93 dnl ---------------------------------------------------------------------------
94 dnl CF_ADD_ADAFLAGS version: 1 updated: 2010/06/19 15:22:18
96 dnl Add to $ADAFLAGS, which is substituted into makefile and scripts.
97 AC_DEFUN([CF_ADD_ADAFLAGS],[
98 ADAFLAGS="$ADAFLAGS $1"
101 dnl ---------------------------------------------------------------------------
102 dnl CF_ADD_CFLAGS version: 13 updated: 2017/02/25 18:57:40
104 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
105 dnl The second parameter if given makes this macro verbose.
107 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
108 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
109 dnl confused by the quotes (which require backslashes to keep them usable).
110 AC_DEFUN([CF_ADD_CFLAGS],
115 cf_new_extra_cppflags=
117 for cf_add_cflags in $1
119 case $cf_fix_cppflags in
121 case $cf_add_cflags in
122 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C)
123 case $cf_add_cflags in
125 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
127 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
128 && test -z "${cf_tst_cflags}" \
129 && cf_fix_cppflags=yes
131 if test $cf_fix_cppflags = yes ; then
132 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
134 elif test "${cf_tst_cflags}" = "\"'" ; then
135 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
144 case $cf_add_cflags in
146 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
147 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
150 CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags)
155 CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags)
160 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
162 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
164 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
165 && test -z "${cf_tst_cflags}" \
166 && cf_fix_cppflags=no
171 if test -n "$cf_new_cflags" ; then
172 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
173 CF_APPEND_TEXT(CFLAGS,$cf_new_cflags)
176 if test -n "$cf_new_cppflags" ; then
177 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
178 CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags)
181 if test -n "$cf_new_extra_cppflags" ; then
182 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
183 CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags)
186 AC_SUBST(EXTRA_CPPFLAGS)
189 dnl ---------------------------------------------------------------------------
190 dnl CF_ADD_INCDIR version: 15 updated: 2018/06/20 20:23:13
192 dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
193 dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
194 dnl but old versions (and some misinstalled ones) need that. To make things
195 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
196 dnl the include-path).
197 AC_DEFUN([CF_ADD_INCDIR],
199 if test -n "$1" ; then
200 for cf_add_incdir in $1
202 while test $cf_add_incdir != /usr/include
204 if test -d $cf_add_incdir
207 if test -n "$CFLAGS$CPPFLAGS" ; then
208 # a loop is needed to ensure we can add subdirs of existing dirs
209 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
210 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
211 cf_have_incdir=yes; break
216 if test "$cf_have_incdir" = no ; then
217 if test "$cf_add_incdir" = /usr/local/include ; then
220 cf_save_CPPFLAGS=$CPPFLAGS
221 CF_APPEND_TEXT(CPPFLAGS,-I$cf_add_incdir)
222 AC_TRY_COMPILE([#include <stdio.h>],
225 [cf_have_incdir=yes])
226 CPPFLAGS=$cf_save_CPPFLAGS
231 if test "$cf_have_incdir" = no ; then
232 CF_VERBOSE(adding $cf_add_incdir to include-path)
233 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
235 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
236 test "$cf_top_incdir" = "$cf_add_incdir" && break
237 cf_add_incdir="$cf_top_incdir"
248 dnl ---------------------------------------------------------------------------
249 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
251 dnl Add a library, used to enforce consistency.
253 dnl $1 = library to add, without the "-l"
254 dnl $2 = variable to update (default $LIBS)
255 AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
256 dnl ---------------------------------------------------------------------------
257 dnl CF_ADD_LIBDIR version: 10 updated: 2015/04/18 08:56:57
259 dnl Adds to the library-path
261 dnl Some machines have trouble with multiple -L options.
263 dnl $1 is the (list of) directory(s) to add
264 dnl $2 is the optional name of the variable to update (default LDFLAGS)
266 AC_DEFUN([CF_ADD_LIBDIR],
268 if test -n "$1" ; then
269 for cf_add_libdir in $1
271 if test $cf_add_libdir = /usr/lib ; then
273 elif test -d $cf_add_libdir
276 if test -n "$LDFLAGS$LIBS" ; then
277 # a loop is needed to ensure we can add subdirs of existing dirs
278 for cf_test_libdir in $LDFLAGS $LIBS ; do
279 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
280 cf_have_libdir=yes; break
284 if test "$cf_have_libdir" = no ; then
285 CF_VERBOSE(adding $cf_add_libdir to library-path)
286 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
292 dnl ---------------------------------------------------------------------------
293 dnl CF_ADD_LIBS version: 3 updated: 2019/11/02 16:47:33
295 dnl Add one or more libraries, used to enforce consistency. Libraries are
296 dnl prepended to an existing list, since their dependencies are assumed to
297 dnl already exist in the list.
299 dnl $1 = libraries to add, with the "-l", etc.
300 dnl $2 = variable to update (default $LIBS)
301 AC_DEFUN([CF_ADD_LIBS],[
302 cf_add_libs="[$]ifelse($2,,LIBS,[$2])"
305 for cf_add_1lib in $1; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done
307 for cf_add_1lib in $cf_add_0lib; do
308 for cf_add_2lib in $cf_add_libs; do
309 if test "x$cf_add_1lib" = "x$cf_add_2lib"; then
314 test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs"
316 ifelse($2,,LIBS,[$2])="$cf_add_libs"
318 dnl ---------------------------------------------------------------------------
319 dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05
320 dnl ------------------
321 dnl Append to a search-list for a nonstandard header/lib-file
322 dnl $1 = the variable to return as result
323 dnl $2 = the package name
324 dnl $3 = the subdirectory, e.g., bin, include or lib
325 dnl $4 = the directory under which we will test for subdirectories
326 dnl $5 = a directory that we do not want $4 to match
327 AC_DEFUN([CF_ADD_SUBDIR_PATH],
329 test "x$4" != "x$5" && \
331 ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) {
332 test -n "$verbose" && echo " ... testing for $3-directories under $4"
333 test -d $4/$3 && $1="[$]$1 $4/$3"
334 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
335 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
336 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
337 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
340 dnl ---------------------------------------------------------------------------
341 dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55
343 dnl use this macro for appending text without introducing an extra blank at
345 define([CF_APPEND_TEXT],
347 test -n "[$]$1" && $1="[$]$1 "
350 dnl ---------------------------------------------------------------------------
351 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
353 dnl Allow user to disable a normally-on option.
354 AC_DEFUN([CF_ARG_DISABLE],
355 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
356 dnl ---------------------------------------------------------------------------
357 dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14
359 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
365 dnl $3 = action to perform if option is not default
366 dnl $4 = action if perform if option is default
367 dnl $5 = default option value (either 'yes' or 'no')
368 AC_DEFUN([CF_ARG_OPTION],
369 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
370 if test "$enableval" != "$5" ; then
372 ,[ $3]) ifelse([$4],,,[
375 fi],[enableval=$5 ifelse([$4],,,[
379 dnl ---------------------------------------------------------------------------
380 dnl CF_AR_FLAGS version: 6 updated: 2015/10/10 15:25:05
382 dnl Check for suitable "ar" (archiver) options for updating an archive.
384 dnl In particular, handle some obsolete cases where the "-" might be omitted,
385 dnl as well as a workaround for breakage of make's archive rules by the GNU
386 dnl binutils "ar" program.
387 AC_DEFUN([CF_AR_FLAGS],[
388 AC_REQUIRE([CF_PROG_AR])
390 AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[
391 cf_cv_ar_flags=unknown
392 for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv
395 # check if $ARFLAGS already contains this choice
396 if test "x$ARFLAGS" != "x" ; then
397 cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"`
398 if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then
404 rm -f conftest.$ac_cv_objext
407 cat >conftest.$ac_ext <<EOF
408 #line __oline__ "configure"
409 int testdata[[3]] = { 123, 456, 789 };
411 if AC_TRY_EVAL(ac_compile) ; then
412 echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC
413 $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null
414 if test -f conftest.a ; then
415 cf_cv_ar_flags=$cf_ar_flags
419 CF_VERBOSE(cannot compile test-program)
423 rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext
426 if test -n "$ARFLAGS" ; then
427 if test -n "$cf_cv_ar_flags" ; then
428 ARFLAGS="$ARFLAGS $cf_cv_ar_flags"
431 ARFLAGS=$cf_cv_ar_flags
436 dnl ---------------------------------------------------------------------------
437 dnl CF_BUILD_CC version: 8 updated: 2018/01/04 20:31:04
439 dnl If we're cross-compiling, allow the user to override the tools and their
440 dnl options. The configure script is oriented toward identifying the host
441 dnl compiler, etc., but we need a build compiler to generate parts of the
444 dnl $1 = default for $CPPFLAGS
445 dnl $2 = default for $LIBS
446 AC_DEFUN([CF_BUILD_CC],[
447 CF_ACVERSION_CHECK(2.52,,
448 [AC_REQUIRE([CF_PROG_EXT])])
449 if test "$cross_compiling" = yes ; then
451 # defaults that we might want to override
452 : ${BUILD_CFLAGS:=''}
453 : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
454 : ${BUILD_LDFLAGS:=''}
455 : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
456 : ${BUILD_EXEEXT:='$x'}
457 : ${BUILD_OBJEXT:='o'}
459 AC_ARG_WITH(build-cc,
460 [ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
461 [BUILD_CC="$withval"],
462 [AC_CHECK_PROGS(BUILD_CC, [gcc clang c99 c89 cc cl],none)])
463 AC_MSG_CHECKING(for native build C compiler)
464 AC_MSG_RESULT($BUILD_CC)
466 AC_MSG_CHECKING(for native build C preprocessor)
467 AC_ARG_WITH(build-cpp,
468 [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
469 [BUILD_CPP="$withval"],
470 [BUILD_CPP='${BUILD_CC} -E'])
471 AC_MSG_RESULT($BUILD_CPP)
473 AC_MSG_CHECKING(for native build C flags)
474 AC_ARG_WITH(build-cflags,
475 [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
476 [BUILD_CFLAGS="$withval"])
477 AC_MSG_RESULT($BUILD_CFLAGS)
479 AC_MSG_CHECKING(for native build C preprocessor-flags)
480 AC_ARG_WITH(build-cppflags,
481 [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
482 [BUILD_CPPFLAGS="$withval"])
483 AC_MSG_RESULT($BUILD_CPPFLAGS)
485 AC_MSG_CHECKING(for native build linker-flags)
486 AC_ARG_WITH(build-ldflags,
487 [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
488 [BUILD_LDFLAGS="$withval"])
489 AC_MSG_RESULT($BUILD_LDFLAGS)
491 AC_MSG_CHECKING(for native build linker-libraries)
492 AC_ARG_WITH(build-libs,
493 [ --with-build-libs=XXX the build libraries (${BUILD_LIBS})],
494 [BUILD_LIBS="$withval"])
495 AC_MSG_RESULT($BUILD_LIBS)
497 # this assumes we're on Unix.
501 : ${BUILD_CC:='${CC}'}
503 if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
504 AC_MSG_ERROR([Cross-build requires two compilers.
505 Use --with-build-cc to specify the native compiler.])
509 : ${BUILD_CC:='${CC}'}
510 : ${BUILD_CPP:='${CPP}'}
511 : ${BUILD_CFLAGS:='${CFLAGS}'}
512 : ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
513 : ${BUILD_LDFLAGS:='${LDFLAGS}'}
514 : ${BUILD_LIBS:='${LIBS}'}
515 : ${BUILD_EXEEXT:='$x'}
516 : ${BUILD_OBJEXT:='o'}
521 AC_SUBST(BUILD_CFLAGS)
522 AC_SUBST(BUILD_CPPFLAGS)
523 AC_SUBST(BUILD_LDFLAGS)
525 AC_SUBST(BUILD_EXEEXT)
526 AC_SUBST(BUILD_OBJEXT)
528 dnl ---------------------------------------------------------------------------
529 dnl CF_CC_ENV_FLAGS version: 9 updated: 2018/07/29 18:03:26
531 dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
532 dnl into CC. This will not help with broken scripts that wrap the compiler
533 dnl with options, but eliminates a more common category of user confusion.
535 dnl In particular, it addresses the problem of being able to run the C
536 dnl preprocessor in a consistent manner.
538 dnl Caveat: this also disallows blanks in the pathname for the compiler, but
539 dnl the nuisance of having inconsistent settings for compiler and preprocessor
540 dnl outweighs that limitation.
541 AC_DEFUN([CF_CC_ENV_FLAGS],
543 # This should have been defined by AC_PROG_CC
546 AC_MSG_CHECKING(\$CFLAGS variable)
549 AC_MSG_RESULT(broken)
550 AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options)
553 for cf_arg in $cf_flags
555 CF_ADD_CFLAGS($cf_arg)
563 AC_MSG_CHECKING(\$CC variable)
566 AC_MSG_RESULT(broken)
567 AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options)
569 cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'`
570 cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'`
572 for cf_arg in $cf_flags
576 CF_ADD_CFLAGS($cf_arg)
583 CF_VERBOSE(resulting CC: '$CC')
584 CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
585 CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
592 dnl ---------------------------------------------------------------------------
593 dnl CF_CFG_DEFAULTS version: 11 updated: 2015/04/17 21:13:04
595 dnl Determine the default configuration into which we'll install ncurses. This
596 dnl can be overridden by the user's command-line options. There's two items to
598 dnl 1. the prefix (e.g., /usr)
599 dnl 2. the header files (e.g., /usr/include/ncurses)
600 dnl We'll look for a previous installation of ncurses and use the same defaults.
602 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
603 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
604 dnl programs from a vendor's.
605 AC_DEFUN([CF_CFG_DEFAULTS],
607 AC_MSG_CHECKING(for prefix)
608 if test "x$prefix" = "xNONE" ; then
609 case "$cf_cv_system_name" in
610 # non-vendor systems don't have a conflict
611 (openbsd*|freebsd*|mirbsd*|linux*|cygwin*|msys*|k*bsd*-gnu|mingw*)
614 (*) prefix=$ac_default_prefix
618 AC_MSG_RESULT($prefix)
620 if test "x$prefix" = "xNONE" ; then
621 AC_MSG_CHECKING(for default include-directory)
622 test -n "$verbose" && echo 1>&AC_FD_MSG
625 $includedir/ncurses \
627 $prefix/include/ncurses \
629 /usr/local/include/ncurses \
633 cf_dir=`eval echo $cf_symbol`
634 if test -f $cf_dir/curses.h ; then
635 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
636 includedir="$cf_symbol"
637 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG
641 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
643 AC_MSG_RESULT($includedir)
646 dnl ---------------------------------------------------------------------------
647 dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
649 dnl Check if we're accidentally using a cache from a different machine.
650 dnl Derive the system name, as a check for reusing the autoconf cache.
652 dnl If we've packaged config.guess and config.sub, run that (since it does a
653 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
654 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
655 dnl which is useful in cross-compiles.
657 dnl Note: we would use $ac_config_sub, but that is one of the places where
658 dnl autoconf 2.5x broke compatibility with autoconf 2.13
659 AC_DEFUN([CF_CHECK_CACHE],
661 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
662 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
663 system_name="$host_os"
665 system_name="`(uname -s -r) 2>/dev/null`"
666 if test -z "$system_name" ; then
667 system_name="`(hostname) 2>/dev/null`"
670 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
671 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
673 test -z "$system_name" && system_name="$cf_cv_system_name"
674 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
676 if test ".$system_name" != ".$cf_cv_system_name" ; then
677 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
678 AC_MSG_ERROR("Please remove config.cache and try again.")
681 dnl ---------------------------------------------------------------------------
682 dnl CF_CHECK_GNAT_VERSION version: 2 updated: 2019/12/31 08:53:54
683 dnl ---------------------
684 AC_DEFUN([CF_CHECK_GNAT_VERSION],
686 AC_REQUIRE([CF_GNAT_VERSION])
687 case $cf_cv_gnat_version in
688 (3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|20[[0-9]][[0-9]])
689 cf_cv_prog_gnat_correct=yes
692 AC_MSG_WARN(Unsupported GNAT version $cf_cv_gnat_version. We require 3.11 or better. Disabling Ada95 binding.)
693 cf_cv_prog_gnat_correct=no
697 dnl ---------------------------------------------------------------------------
698 dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35
699 dnl -----------------
700 dnl Check if the given compiler is really clang. clang's C driver defines
701 dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
702 dnl not ignore some gcc options.
704 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
705 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
706 dnl the wrappers for gcc and g++ warnings.
708 dnl $1 = GCC (default) or GXX
709 dnl $2 = CLANG_COMPILER (default)
710 dnl $3 = CFLAGS (default) or CXXFLAGS
711 AC_DEFUN([CF_CLANG_COMPILER],[
712 ifelse([$2],,CLANG_COMPILER,[$2])=no
714 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
715 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
716 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
717 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
723 ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
724 cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
726 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
727 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
730 dnl ---------------------------------------------------------------------------
731 dnl CF_CONST_X_STRING version: 3 updated: 2020/01/11 18:39:22
732 dnl -----------------
733 dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most
734 dnl character-strings.
736 dnl It is ambiguous because the specification accommodated the pre-ANSI
737 dnl compilers bundled by more than one vendor in lieu of providing a standard C
738 dnl compiler other than by costly add-ons. Because of this, the specification
739 dnl did not take into account the use of const for telling the compiler that
740 dnl string literals would be in readonly memory.
742 dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to
743 dnl let the compiler decide how to represent Xt's strings which were #define'd.
744 dnl That does not solve the problem of using the block of Xt's strings which
745 dnl are compiled into the library (and is less efficient than one might want).
747 dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both
748 dnl when compiling the library and compiling using the library, to tell the
749 dnl compiler that String is const.
750 AC_DEFUN([CF_CONST_X_STRING],
752 AC_REQUIRE([AC_PATH_XTRA])
754 CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING])
759 #include <X11/Intrinsic.h>
761 [String foo = malloc(1)],[
763 AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[
766 #define _CONST_X_STRING /* X11R7.8 (perhaps) */
767 #undef XTSTRINGDEFINES /* X11R5 and later */
769 #include <X11/Intrinsic.h>
770 ],[String foo = malloc(1); *foo = 0],[
771 cf_cv_const_x_string=no
773 cf_cv_const_x_string=yes
777 CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING])
779 case $cf_cv_const_x_string in
781 CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES)
784 CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING)
790 dnl ---------------------------------------------------------------------------
791 dnl CF_CONST_X_STRING version: 3 updated: 2020/01/11 18:39:22
792 dnl -----------------
793 dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most
794 dnl character-strings.
796 dnl It is ambiguous because the specification accommodated the pre-ANSI
797 dnl compilers bundled by more than one vendor in lieu of providing a standard C
798 dnl compiler other than by costly add-ons. Because of this, the specification
799 dnl did not take into account the use of const for telling the compiler that
800 dnl string literals would be in readonly memory.
802 dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to
803 dnl let the compiler decide how to represent Xt's strings which were #define'd.
804 dnl That does not solve the problem of using the block of Xt's strings which
805 dnl are compiled into the library (and is less efficient than one might want).
807 dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both
808 dnl when compiling the library and compiling using the library, to tell the
809 dnl compiler that String is const.
810 AC_DEFUN([CF_CONST_X_STRING],
812 AC_REQUIRE([AC_PATH_XTRA])
814 CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING])
819 #include <X11/Intrinsic.h>
821 [String foo = malloc(1)],[
823 AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[
826 #define _CONST_X_STRING /* X11R7.8 (perhaps) */
827 #undef XTSTRINGDEFINES /* X11R5 and later */
829 #include <X11/Intrinsic.h>
830 ],[String foo = malloc(1); *foo = 0],[
831 cf_cv_const_x_string=no
833 cf_cv_const_x_string=yes
837 CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING])
839 case $cf_cv_const_x_string in
841 CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES)
844 CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING)
850 dnl ---------------------------------------------------------------------------
851 dnl CF_CURSES_HEADER version: 5 updated: 2015/04/23 20:35:30
853 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
854 dnl variations of ncurses' installs.
856 dnl $1 = ncurses when looking for ncurses, or is empty
857 AC_DEFUN([CF_CURSES_HEADER],[
858 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
859 cf_cv_ncurses_header=none
861 ncurses.h ifelse($1,,,[$1/ncurses.h]) \
862 curses.h ifelse($1,,,[$1/curses.h]) ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
864 AC_TRY_COMPILE([#include <${cf_header}>],
865 [initscr(); tgoto("?", 0,0)],
866 [cf_cv_ncurses_header=$cf_header; break],[])
870 if test "$cf_cv_ncurses_header" = none ; then
871 AC_MSG_ERROR(No curses header-files found)
874 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
875 AC_CHECK_HEADERS($cf_cv_ncurses_header)
877 dnl ---------------------------------------------------------------------------
878 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
880 dnl "dirname" is not portable, so we fake it with a shell script.
881 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
882 dnl ---------------------------------------------------------------------------
883 dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57
885 dnl You can always use "make -n" to see the actual options, but it's hard to
886 dnl pick out/analyze warning messages when the compile-line is long.
889 dnl ECHO_LT - symbol to control if libtool is verbose
890 dnl ECHO_LD - symbol to prefix "cc -o" lines
891 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
892 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
893 dnl ECHO_CC - symbol to put before any "cc" line
895 AC_DEFUN([CF_DISABLE_ECHO],[
896 AC_MSG_CHECKING(if you want to see long compiling messages)
898 [ --disable-echo do not display "compiling" commands],
901 ECHO_LD='@echo linking [$]@;'
902 RULE_CC='@echo compiling [$]<'
903 SHOW_CC='@echo compiling [$]@'
912 AC_MSG_RESULT($enableval)
919 dnl ---------------------------------------------------------------------------
920 dnl CF_DISABLE_GNAT_PROJECTS version: 1 updated: 2014/06/01 11:34:00
921 dnl ------------------------
922 AC_DEFUN([CF_DISABLE_GNAT_PROJECTS],[
923 AC_MSG_CHECKING(if we want to use GNAT projects)
924 CF_ARG_DISABLE(gnat-projects,
925 [ --disable-gnat-projects test: disable GNAT projects even if usable],
926 [enable_gnat_projects=no],
927 [enable_gnat_projects=yes])
928 AC_MSG_RESULT($enable_gnat_projects)
930 dnl ---------------------------------------------------------------------------
931 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
933 dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
934 dnl prefer a standard location, and use -L options only if we do not find the
935 dnl library in the standard library location(s).
936 dnl $1 = library name
937 dnl $2 = library class, usually the same as library name
939 dnl $4 = code fragment to compile/link
940 dnl $5 = corresponding function-name
941 dnl $6 = flag, nonnull if failure should not cause an error-exit
943 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
944 dnl to use a -L option.
945 AC_DEFUN([CF_FIND_LIBRARY],
947 eval 'cf_cv_have_lib_'$1'=no'
950 eval 'cf_cv_have_lib_'$1'=yes',[
952 AC_MSG_CHECKING(for $5 in -l$1)
954 AC_TRY_LINK([$3],[$4],
956 eval 'cf_cv_have_lib_'$1'=yes'
959 CF_LIBRARY_PATH(cf_search,$2)
960 for cf_libdir in $cf_search
962 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
963 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
964 AC_TRY_LINK([$3],[$4],
966 eval 'cf_cv_have_lib_'$1'=yes'
969 LIBS="$cf_save_LIBS"])
973 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
975 if test $cf_found_library = no ; then
976 AC_MSG_ERROR(Cannot link $1 library)
980 dnl ---------------------------------------------------------------------------
981 dnl CF_FIND_LINKAGE version: 21 updated: 2018/06/20 20:23:13
983 dnl Find a library (specifically the linkage used in the code fragment),
984 dnl searching for it if it is not already in the library path.
985 dnl See also CF_ADD_SEARCHPATH.
987 dnl Parameters (4-on are optional):
988 dnl $1 = headers for library entrypoint
989 dnl $2 = code fragment for library entrypoint
990 dnl $3 = the library name without the "-l" option or ".so" suffix.
991 dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
992 dnl $5 = action to perform if not successful
993 dnl $6 = module name, if not the same as the library name
994 dnl $7 = extra libraries
996 dnl Sets these variables:
997 dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
998 dnl $cf_cv_header_path_$3 - include-directory if needed
999 dnl $cf_cv_library_path_$3 - library-directory if needed
1000 dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
1001 AC_DEFUN([CF_FIND_LINKAGE],[
1003 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
1004 # will be set on completion of the AC_TRY_LINK below.
1005 cf_cv_header_path_$3=
1006 cf_cv_library_path_$3=
1008 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
1010 cf_save_LIBS="$LIBS"
1012 AC_TRY_LINK([$1],[$2],[
1013 cf_cv_find_linkage_$3=yes
1014 cf_cv_header_path_$3=/usr/include
1015 cf_cv_library_path_$3=/usr/lib
1018 LIBS="-l$3 $7 $cf_save_LIBS"
1020 AC_TRY_LINK([$1],[$2],[
1021 cf_cv_find_linkage_$3=yes
1022 cf_cv_header_path_$3=/usr/include
1023 cf_cv_library_path_$3=/usr/lib
1024 cf_cv_library_file_$3="-l$3"
1026 cf_cv_find_linkage_$3=no
1027 LIBS="$cf_save_LIBS"
1029 CF_VERBOSE(find linkage for $3 library)
1030 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
1032 cf_save_CPPFLAGS="$CPPFLAGS"
1033 cf_test_CPPFLAGS="$CPPFLAGS"
1035 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
1036 for cf_cv_header_path_$3 in $cf_search
1038 if test -d $cf_cv_header_path_$3 ; then
1039 CF_VERBOSE(... testing $cf_cv_header_path_$3)
1040 CPPFLAGS="$cf_save_CPPFLAGS"
1041 CF_APPEND_TEXT(CPPFLAGS,-I$cf_cv_header_path_$3)
1042 AC_TRY_COMPILE([$1],[$2],[
1043 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
1044 cf_cv_find_linkage_$3=maybe
1045 cf_test_CPPFLAGS="$CPPFLAGS"
1047 CPPFLAGS="$cf_save_CPPFLAGS"
1052 if test "$cf_cv_find_linkage_$3" = maybe ; then
1054 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
1056 cf_save_LIBS="$LIBS"
1057 cf_save_LDFLAGS="$LDFLAGS"
1060 CPPFLAGS="$cf_test_CPPFLAGS"
1061 LIBS="-l$3 $7 $cf_save_LIBS"
1062 AC_TRY_LINK([$1],[$2],[
1063 CF_VERBOSE(... found $3 library in system)
1064 cf_cv_find_linkage_$3=yes])
1065 CPPFLAGS="$cf_save_CPPFLAGS"
1066 LIBS="$cf_save_LIBS"
1069 if test "$cf_cv_find_linkage_$3" != yes ; then
1070 CF_LIBRARY_PATH(cf_search,$3)
1071 for cf_cv_library_path_$3 in $cf_search
1073 if test -d $cf_cv_library_path_$3 ; then
1074 CF_VERBOSE(... testing $cf_cv_library_path_$3)
1075 CPPFLAGS="$cf_test_CPPFLAGS"
1076 LIBS="-l$3 $7 $cf_save_LIBS"
1077 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
1078 AC_TRY_LINK([$1],[$2],[
1079 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
1080 cf_cv_find_linkage_$3=yes
1081 cf_cv_library_file_$3="-l$3"
1083 CPPFLAGS="$cf_save_CPPFLAGS"
1084 LIBS="$cf_save_LIBS"
1085 LDFLAGS="$cf_save_LDFLAGS"
1089 CPPFLAGS="$cf_save_CPPFLAGS"
1090 LDFLAGS="$cf_save_LDFLAGS"
1094 cf_cv_find_linkage_$3=no
1099 LIBS="$cf_save_LIBS"
1101 if test "$cf_cv_find_linkage_$3" = yes ; then
1103 CF_ADD_INCDIR($cf_cv_header_path_$3)
1104 CF_ADD_LIBDIR($cf_cv_library_path_$3)
1108 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
1111 dnl ---------------------------------------------------------------------------
1112 dnl CF_FIXUP_ADAFLAGS version: 2 updated: 2015/04/17 21:13:04
1113 dnl -----------------
1114 dnl make ADAFLAGS consistent with CFLAGS
1115 AC_DEFUN([CF_FIXUP_ADAFLAGS],[
1116 AC_MSG_CHECKING(optimization options for ADAFLAGS)
1124 cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[[ ]].*//'`
1125 CF_ADD_ADAFLAGS($cf_O_flag)
1128 AC_MSG_RESULT($ADAFLAGS)
1130 dnl ---------------------------------------------------------------------------
1131 dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39:00
1132 dnl -----------------
1133 dnl Test for availability of useful gcc __attribute__ directives to quiet
1134 dnl compiler warnings. Though useful, not all are supported -- and contrary
1135 dnl to documentation, unrecognized directives cause older compilers to barf.
1136 AC_DEFUN([CF_GCC_ATTRIBUTES],
1138 if test "$GCC" = yes
1140 cat > conftest.i <<EOF
1142 #define GCC_PRINTF 0
1147 #ifndef GCC_NORETURN
1148 #define GCC_NORETURN /* nothing */
1151 #define GCC_UNUSED /* nothing */
1154 if test "$GCC" = yes
1156 AC_CHECKING([for $CC __attribute__ directives])
1157 cat > conftest.$ac_ext <<EOF
1158 #line __oline__ "${as_me:-configure}"
1159 #include "confdefs.h"
1160 #include "conftest.h"
1161 #include "conftest.i"
1163 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1165 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1168 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1170 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
1172 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1173 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1174 extern void foo(void) GCC_NORETURN;
1175 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1177 cf_printf_attribute=no
1178 cf_scanf_attribute=no
1179 for cf_attribute in scanf printf unused noreturn
1181 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1182 cf_directive="__attribute__(($cf_attribute))"
1183 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
1185 case $cf_attribute in
1187 cf_printf_attribute=yes
1188 cat >conftest.h <<EOF
1189 #define GCC_$cf_ATTRIBUTE 1
1193 cf_scanf_attribute=yes
1194 cat >conftest.h <<EOF
1195 #define GCC_$cf_ATTRIBUTE 1
1199 cat >conftest.h <<EOF
1200 #define GCC_$cf_ATTRIBUTE $cf_directive
1205 if AC_TRY_EVAL(ac_compile); then
1206 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
1207 cat conftest.h >>confdefs.h
1208 case $cf_attribute in
1210 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
1213 cf_value='/* nothing */'
1214 if test "$cf_printf_attribute" != no ; then
1215 cf_value='__attribute__((format(printf,fmt,var)))'
1216 AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
1218 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
1221 cf_value='/* nothing */'
1222 if test "$cf_scanf_attribute" != no ; then
1223 cf_value='__attribute__((format(scanf,fmt,var)))'
1224 AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
1226 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
1229 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
1235 fgrep define conftest.i >>confdefs.h
1240 dnl ---------------------------------------------------------------------------
1241 dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36
1243 dnl Find version of gcc, and (because icc/clang pretend to be gcc without being
1244 dnl compatible), attempt to determine if icc/clang is actually used.
1245 AC_DEFUN([CF_GCC_VERSION],[
1246 AC_REQUIRE([AC_PROG_CC])
1248 if test "$GCC" = yes ; then
1249 AC_MSG_CHECKING(version of $CC)
1250 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.]].*//'`"
1251 test -z "$GCC_VERSION" && GCC_VERSION=unknown
1252 AC_MSG_RESULT($GCC_VERSION)
1254 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
1255 CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
1257 dnl ---------------------------------------------------------------------------
1258 dnl CF_GCC_WARNINGS version: 37 updated: 2020/01/05 20:04:12
1260 dnl Check if the compiler supports useful warning options. There's a few that
1261 dnl we don't use, simply because they're too noisy:
1263 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
1264 dnl -Winline (usually not worthwhile)
1265 dnl -Wredundant-decls (system headers make this too noisy)
1266 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
1267 dnl -Wwrite-strings (too noisy, but should review occasionally). This
1268 dnl is enabled for ncurses using "--enable-const".
1272 dnl $1 is an optional list of gcc warning flags that a particular
1273 dnl application might want to use, e.g., "no-unused" for
1276 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1278 AC_DEFUN([CF_GCC_WARNINGS],
1280 AC_REQUIRE([CF_GCC_VERSION])
1281 if test "x$have_x" = xyes; then CF_CONST_X_STRING fi
1282 cat > conftest.$ac_ext <<EOF
1283 #line __oline__ "${as_me:-configure}"
1284 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1286 if test "$INTEL_COMPILER" = yes
1288 # The "-wdXXX" options suppress warnings:
1289 # remark #1419: external declaration in primary source file
1290 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1291 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1292 # remark #193: zero used for undefined preprocessing identifier
1293 # remark #593: variable "curs_sb_left_arrow" was set but never used
1294 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1295 # remark #869: parameter "tw" was never referenced
1296 # remark #981: operands are evaluated in unspecified order
1297 # warning #279: controlling expression is constant
1299 AC_CHECKING([for $CC warning options])
1300 cf_save_CFLAGS="$CFLAGS"
1301 EXTRA_CFLAGS="-Wall"
1313 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1314 if AC_TRY_EVAL(ac_compile); then
1315 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1316 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1319 CFLAGS="$cf_save_CFLAGS"
1320 elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown"
1322 AC_CHECKING([for $CC warning options])
1323 cf_save_CFLAGS="$CFLAGS"
1326 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1327 cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs"
1328 test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings=
1329 for cf_opt in W Wall \
1330 Wbad-function-cast \
1333 Wdeclaration-after-statement \
1336 Wmissing-declarations \
1337 Wmissing-prototypes \
1341 Wstrict-prototypes \
1342 Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST $1
1344 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1345 if AC_TRY_EVAL(ac_compile); then
1346 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1349 case $GCC_VERSION in
1351 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1356 case $GCC_VERSION in
1358 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1363 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1366 CFLAGS="$cf_save_CFLAGS"
1370 AC_SUBST(EXTRA_CFLAGS)
1372 dnl ---------------------------------------------------------------------------
1373 dnl CF_GNATPREP_OPT_T version: 1 updated: 2014/08/02 18:37:25
1374 dnl -----------------
1375 AC_DEFUN([CF_GNATPREP_OPT_T],[
1376 AC_CACHE_CHECK(if GNATPREP supports -T option,cf_cv_gnatprep_opt_t,[
1377 cf_cv_gnatprep_opt_t=no
1378 gnatprep -T 2>/dev/null >/dev/null && cf_cv_gnatprep_opt_t=yes
1380 test "$cf_cv_gnatprep_opt_t" = yes && GNATPREP_OPTS="-T $GNATPREP_OPTS"
1381 AC_SUBST(GNATPREP_OPTS)
1383 dnl ---------------------------------------------------------------------------
1384 dnl CF_GNAT_GENERICS version: 4 updated: 2019/12/31 08:53:54
1385 dnl ----------------
1386 AC_DEFUN([CF_GNAT_GENERICS],
1388 AC_REQUIRE([CF_GNAT_VERSION])
1390 AC_MSG_CHECKING(if GNAT supports generics)
1391 case $cf_cv_gnat_version in
1392 (3.[[1-9]]*|[[4-9]].*)
1393 cf_gnat_generics=yes
1399 AC_MSG_RESULT($cf_gnat_generics)
1401 if test "$cf_gnat_generics" = yes
1403 cf_compile_generics=generics
1404 cf_generic_objects="\${GENOBJS}"
1406 cf_compile_generics=
1410 AC_SUBST(cf_compile_generics)
1411 AC_SUBST(cf_generic_objects)
1413 dnl ---------------------------------------------------------------------------
1414 dnl CF_GNAT_PROJECTS version: 10 updated: 2019/12/31 08:53:54
1415 dnl ----------------
1416 dnl GNAT projects are configured with ".gpr" project files.
1417 dnl GNAT libraries are a further development, using the project feature.
1418 AC_DEFUN([CF_GNAT_PROJECTS],
1420 AC_REQUIRE([CF_GNAT_VERSION])
1421 AC_REQUIRE([CF_DISABLE_GNAT_PROJECTS])
1423 cf_gnat_libraries=no
1426 if test "$enable_gnat_projects" != no ; then
1427 AC_MSG_CHECKING(if GNAT supports project files)
1428 case $cf_cv_gnat_version in
1432 case $cf_cv_system_name in
1436 rm -rf conftest* *~conftest*
1437 if mkdir conftest.src conftest.bin conftest.lib
1440 rm -rf conftest* *~conftest*
1441 cat >>library.gpr <<CF_EOF
1443 Kind := External ("LIB_KIND");
1444 for Library_Name use "ConfTest";
1445 for Object_Dir use ".";
1446 for Library_ALI_Dir use External("LIBRARY_DIR");
1447 for Library_Version use External ("SONAME");
1448 for Library_Kind use Kind;
1449 for Library_Dir use External("BUILD_DIR");
1450 Source_Dir := External ("SOURCE_DIR");
1451 for Source_Dirs use (Source_Dir);
1454 cat >>confpackage.ads <<CF_EOF
1455 package ConfPackage is
1459 cat >>confpackage.adb <<CF_EOF
1461 package body ConfPackage is
1462 procedure conftest is
1464 Text_IO.Put ("Hello World");
1469 if ( $cf_ada_make $ADAFLAGS \
1471 -XBUILD_DIR=`cd ../conftest.bin;pwd` \
1472 -XLIBRARY_DIR=`cd ../conftest.lib;pwd` \
1473 -XSOURCE_DIR=`pwd` \
1474 -XSONAME=libConfTest.so.1 \
1475 -XLIB_KIND=static 1>&AC_FD_CC 2>&1 ) ; then
1476 cf_gnat_projects=yes
1480 if test -f conftest.lib/confpackage.ali
1482 cf_gnat_libraries=yes
1484 rm -rf conftest* *~conftest*
1489 AC_MSG_RESULT($cf_gnat_projects)
1490 fi # enable_gnat_projects
1492 if test $cf_gnat_projects = yes
1494 AC_MSG_CHECKING(if GNAT supports libraries)
1495 AC_MSG_RESULT($cf_gnat_libraries)
1498 if test "$cf_gnat_projects" = yes
1500 USE_OLD_MAKERULES="#"
1501 USE_GNAT_PROJECTS=""
1503 USE_OLD_MAKERULES=""
1504 USE_GNAT_PROJECTS="#"
1507 if test "$cf_gnat_libraries" = yes
1509 USE_GNAT_LIBRARIES=""
1511 USE_GNAT_LIBRARIES="#"
1514 AC_SUBST(USE_OLD_MAKERULES)
1515 AC_SUBST(USE_GNAT_PROJECTS)
1516 AC_SUBST(USE_GNAT_LIBRARIES)
1518 dnl ---------------------------------------------------------------------------
1519 dnl CF_GNAT_SIGINT version: 1 updated: 2011/03/27 20:07:59
1521 dnl Check if gnat supports SIGINT, and presumably tasking. For the latter, it
1522 dnl is noted that gnat may compile a tasking unit even for configurations which
1523 dnl fail at runtime.
1524 AC_DEFUN([CF_GNAT_SIGINT],[
1525 AC_CACHE_CHECK(if GNAT supports SIGINT,cf_cv_gnat_sigint,[
1526 CF_GNAT_TRY_LINK([with Ada.Interrupts.Names;
1530 pragma Warnings (Off); -- the next pragma exists since 3.11p
1531 pragma Unreserve_All_Interrupts;
1532 pragma Warnings (On);
1534 protected Process is
1536 function Continue return Boolean;
1537 pragma Attach_Handler (Stop, Ada.Interrupts.Names.SIGINT);
1539 Done : Boolean := False;
1543 [package body ConfTest is
1544 protected body Process is
1549 function Continue return Boolean is
1555 [cf_cv_gnat_sigint=yes],
1556 [cf_cv_gnat_sigint=no])])
1558 if test $cf_cv_gnat_sigint = yes ; then
1563 AC_SUBST(USE_GNAT_SIGINT)
1565 dnl ---------------------------------------------------------------------------
1566 dnl CF_GNAT_TRY_LINK version: 3 updated: 2011/03/19 14:47:45
1567 dnl ----------------
1568 dnl Verify that a test program compiles/links with GNAT.
1569 dnl $cf_ada_make is set to the program that compiles/links
1570 dnl $ADAFLAGS may be set to the GNAT flags.
1572 dnl $1 is the text of the spec
1573 dnl $2 is the text of the body
1574 dnl $3 is the shell command to execute if successful
1575 dnl $4 is the shell command to execute if not successful
1576 AC_DEFUN([CF_GNAT_TRY_LINK],
1578 rm -rf conftest* *~conftest*
1579 cat >>conftest.ads <<CF_EOF
1582 cat >>conftest.adb <<CF_EOF
1585 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1586 ifelse($3,, :,[ $3])
1590 rm -rf conftest* *~conftest*
1592 dnl ---------------------------------------------------------------------------
1593 dnl CF_GNAT_TRY_RUN version: 5 updated: 2011/03/19 14:47:45
1595 dnl Verify that a test program compiles and runs with GNAT
1596 dnl $cf_ada_make is set to the program that compiles/links
1597 dnl $ADAFLAGS may be set to the GNAT flags.
1599 dnl $1 is the text of the spec
1600 dnl $2 is the text of the body
1601 dnl $3 is the shell command to execute if successful
1602 dnl $4 is the shell command to execute if not successful
1603 AC_DEFUN([CF_GNAT_TRY_RUN],
1605 rm -rf conftest* *~conftest*
1606 cat >>conftest.ads <<CF_EOF
1609 cat >>conftest.adb <<CF_EOF
1612 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1613 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
1614 ifelse($3,, :,[ $3])
1621 rm -rf conftest* *~conftest*
1623 dnl ---------------------------------------------------------------------------
1624 dnl CF_GNAT_VERSION version: 22 updated: 2019/12/31 08:53:54
1626 dnl $1 = cache variable to update
1627 dnl $2 = program name
1628 dnl Verify version of GNAT or related tool
1629 AC_DEFUN([CF_GNAT_VERSION],
1631 AC_CACHE_CHECK(for ifelse($2,,gnat,$2) version, cf_cv_gnat_version,[
1632 cf_cv_gnat_version=`ifelse($2,,${cf_ada_make:-gnatmake},$2) --version 2>&1 | \
1633 grep '[[0-9]].[[0-9]][[0-9]]*' |\
1634 sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
1636 test -z "$cf_cv_gnat_version" && cf_cv_gnat_version=no
1637 ifelse($1,,,[eval $1=$cf_cv_gnat_version; unset cf_cv_gnat_version])
1639 dnl ---------------------------------------------------------------------------
1640 dnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41
1642 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1643 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1644 dnl (or misfeature) of glibc2, which breaks portability of many applications,
1645 dnl since it is interwoven with GNU extensions.
1647 dnl Well, yes we could work around it...
1650 dnl $1 is the nominal value for _XOPEN_SOURCE
1651 AC_DEFUN([CF_GNU_SOURCE],
1653 cf_gnu_xopen_source=ifelse($1,,500,$1)
1655 AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[
1656 AC_TRY_COMPILE([#include <sys/types.h>],[
1657 #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0
1659 #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0
1662 # error not GNU C library
1664 [cf_cv_gnu_library=yes],
1665 [cf_cv_gnu_library=no])
1668 if test x$cf_cv_gnu_library = xyes; then
1670 # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE
1671 # was changed to help a little. newlib incorporated the change about 4
1673 AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[
1675 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
1676 AC_TRY_COMPILE([#include <sys/types.h>],[
1677 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2)
1679 #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3)
1682 # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old
1684 [cf_cv_gnu_library_219=yes],
1685 [cf_cv_gnu_library_219=no])
1689 if test "x$cf_cv_gnu_library_219" = xyes; then
1691 AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[
1692 CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source)
1695 #include <sys/types.h>
1697 #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1)
1700 # error GNU C library is too old
1702 [cf_cv_gnu_dftsrc_219=yes],
1703 [cf_cv_gnu_dftsrc_219=no])
1705 test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save"
1707 cf_cv_gnu_dftsrc_219=maybe
1710 if test "x$cf_cv_gnu_dftsrc_219" != xyes; then
1712 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1713 AC_TRY_COMPILE([#include <sys/types.h>],[
1714 #ifndef _XOPEN_SOURCE
1715 #error expected _XOPEN_SOURCE to be defined
1717 [cf_cv_gnu_source=no],
1718 [cf_save="$CPPFLAGS"
1719 CF_ADD_CFLAGS(-D_GNU_SOURCE)
1720 AC_TRY_COMPILE([#include <sys/types.h>],[
1721 #ifdef _XOPEN_SOURCE
1722 #error expected _XOPEN_SOURCE to be undefined
1724 [cf_cv_gnu_source=no],
1725 [cf_cv_gnu_source=yes])
1730 if test "$cf_cv_gnu_source" = yes
1732 AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[
1733 CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE)
1734 AC_TRY_COMPILE([#include <sys/types.h>],[
1735 #ifdef _DEFAULT_SOURCE
1736 #error expected _DEFAULT_SOURCE to be undefined
1738 [cf_cv_default_source=no],
1739 [cf_cv_default_source=yes])
1741 if test "$cf_cv_default_source" = yes
1743 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE)
1750 dnl ---------------------------------------------------------------------------
1751 dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48
1753 dnl Construct a search-list of directories for a nonstandard header-file
1756 dnl $1 = the variable to return as result
1757 dnl $2 = the package name
1758 AC_DEFUN([CF_HEADER_PATH],
1762 # collect the current set of include-directories from compiler flags
1763 cf_header_path_list=""
1764 if test -n "${CFLAGS}${CPPFLAGS}" ; then
1765 for cf_header_path in $CPPFLAGS $CFLAGS
1767 case $cf_header_path in
1769 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
1770 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
1771 cf_header_path_list="$cf_header_path_list [$]$1"
1777 # add the variations for the package we are looking for
1778 CF_SUBDIR_PATH($1,$2,include)
1780 test "$includedir" != NONE && \
1781 test "$includedir" != "/usr/include" && \
1782 test -d "$includedir" && {
1783 test -d $includedir && $1="[$]$1 $includedir"
1784 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
1787 test "$oldincludedir" != NONE && \
1788 test "$oldincludedir" != "/usr/include" && \
1789 test -d "$oldincludedir" && {
1790 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
1791 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
1794 $1="[$]$1 $cf_header_path_list"
1796 dnl ---------------------------------------------------------------------------
1797 dnl CF_HELP_MESSAGE version: 4 updated: 2019/12/31 08:53:54
1799 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
1800 AC_DEFUN([CF_HELP_MESSAGE],
1801 [CF_ACVERSION_CHECK(2.53,[],[
1802 AC_DIVERT_HELP($1)])dnl
1804 dnl ---------------------------------------------------------------------------
1805 dnl CF_INCLUDE_DIRS version: 10 updated: 2014/09/19 20:58:42
1807 dnl Construct the list of include-options according to whether we're building
1808 dnl in the source directory or using '--srcdir=DIR' option.
1809 AC_DEFUN([CF_INCLUDE_DIRS],
1811 if test "$srcdir" != "."; then
1812 CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS"
1814 CPPFLAGS="-I../include $CPPFLAGS"
1815 if test "$srcdir" != "."; then
1816 CPPFLAGS="-I\${srcdir} $CPPFLAGS"
1818 CPPFLAGS="-I. $CPPFLAGS"
1821 dnl ---------------------------------------------------------------------------
1822 dnl CF_INSTALL_OPTS version: 2 updated: 2018/08/18 12:19:21
1824 dnl prompt for/fill-in useful install-program options
1825 AC_DEFUN([CF_INSTALL_OPTS],
1831 dnl ---------------------------------------------------------------------------
1832 dnl CF_INSTALL_OPT_O version: 2 updated: 2015/05/15 19:45:35
1833 dnl ----------------
1834 dnl Almost all "install" programs default to the current user's ownership.
1835 dnl Almost - MINIX is an exception.
1836 AC_DEFUN([CF_INSTALL_OPT_O],
1838 AC_MSG_CHECKING(if install needs to be told about ownership)
1839 case `$ac_config_guess` in
1848 AC_MSG_RESULT($with_install_o)
1849 if test "x$with_install_o" = xyes
1851 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'`
1856 AC_SUBST(INSTALL_OPT_O)
1858 dnl ---------------------------------------------------------------------------
1859 dnl CF_INSTALL_OPT_P version: 1 updated: 2018/08/18 12:19:21
1860 dnl ----------------
1861 dnl Some install-programs accept a "-p" option to preserve file modification
1862 dnl timestamps. That can be useful as an install option, as well as a way to
1863 dnl avoid the need for ranlib after copying a static archive.
1864 AC_DEFUN([CF_INSTALL_OPT_P],
1866 : ${INSTALL:=install}
1867 AC_CACHE_CHECK(if install accepts -p option, cf_cv_install_p,[
1872 if $INSTALL -p conftest.in conftest.out 2>/dev/null
1874 if test -f conftest.out/conftest.in
1876 test conftest.in -nt conftest.out/conftest.in 2>conftest.err && \
1877 test conftest.out/conftest.in -nt conftest.in 2>conftest.err
1878 if test -s conftest.err
1893 dnl ---------------------------------------------------------------------------
1894 dnl CF_INSTALL_OPT_S version: 2 updated: 2018/08/18 12:19:21
1895 dnl ----------------
1896 dnl By default, we should strip executables which are installed, but leave the
1897 dnl ability to suppress that for unit-testing.
1898 AC_DEFUN([CF_INSTALL_OPT_S],
1900 AC_MSG_CHECKING(if you want to install stripped executables)
1901 CF_ARG_DISABLE(stripping,
1902 [ --disable-stripping do not strip (debug info) installed executables],
1903 [with_stripping=no],
1904 [with_stripping=yes])
1905 AC_MSG_RESULT($with_stripping)
1907 if test "$with_stripping" = yes
1913 AC_SUBST(INSTALL_OPT_S)
1915 dnl ---------------------------------------------------------------------------
1916 dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00
1917 dnl -----------------
1918 dnl Check if the given compiler is really the Intel compiler for Linux. It
1919 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1920 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1922 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1923 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1924 dnl the wrappers for gcc and g++ warnings.
1926 dnl $1 = GCC (default) or GXX
1927 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1928 dnl $3 = CFLAGS (default) or CXXFLAGS
1929 AC_DEFUN([CF_INTEL_COMPILER],[
1930 AC_REQUIRE([AC_CANONICAL_HOST])
1931 ifelse([$2],,INTEL_COMPILER,[$2])=no
1933 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
1936 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
1937 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1938 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
1940 #ifdef __INTEL_COMPILER
1944 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
1945 cf_save_CFLAGS="$cf_save_CFLAGS -we147"
1947 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1948 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
1953 dnl ---------------------------------------------------------------------------
1954 dnl CF_LARGEFILE version: 11 updated: 2018/06/20 20:23:13
1956 dnl Add checks for large file support.
1957 AC_DEFUN([CF_LARGEFILE],[
1958 ifdef([AC_FUNC_FSEEKO],[
1960 if test "$enable_largefile" != no ; then
1963 # Normally we would collect these definitions in the config.h,
1964 # but (like _XOPEN_SOURCE), some environments rely on having these
1965 # defined before any of the system headers are included. Another
1966 # case comes up with C++, e.g., on AIX the compiler compiles the
1967 # header files by themselves before looking at the body files it is
1968 # told to compile. For ncurses, those header files do not include
1970 if test "$ac_cv_sys_large_files" != no
1972 CF_APPEND_TEXT(CPPFLAGS,-D_LARGE_FILES)
1974 if test "$ac_cv_sys_largefile_source" != no
1976 CF_APPEND_TEXT(CPPFLAGS,-D_LARGEFILE_SOURCE)
1978 if test "$ac_cv_sys_file_offset_bits" != no
1980 CF_APPEND_TEXT(CPPFLAGS,-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits)
1983 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
1985 #pragma GCC diagnostic error "-Wincompatible-pointer-types"
1986 #include <sys/types.h>
1989 /* if transitional largefile support is setup, this is true */
1990 extern struct dirent64 * readdir(DIR *);
1991 struct dirent64 *x = readdir((DIR *)0);
1992 struct dirent *y = readdir((DIR *)0);
1995 [cf_cv_struct_dirent64=yes],
1996 [cf_cv_struct_dirent64=no])
1998 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
2002 dnl ---------------------------------------------------------------------------
2003 dnl CF_LD_RPATH_OPT version: 8 updated: 2018/08/18 16:36:35
2005 dnl For the given system and compiler, find the compiler flags to pass to the
2006 dnl loader to use the "rpath" feature.
2007 AC_DEFUN([CF_LD_RPATH_OPT],
2009 AC_REQUIRE([CF_CHECK_CACHE])
2012 if test "x$cf_cv_enable_rpath" != xno
2014 AC_MSG_CHECKING(for an rpath option)
2015 case $cf_cv_system_name in
2017 if test "$GCC" = yes; then
2018 LD_RPATH_OPT="-Wl,-rpath,"
2020 LD_RPATH_OPT="-rpath "
2023 (linux*|gnu*|k*bsd*-gnu|freebsd*)
2024 LD_RPATH_OPT="-Wl,-rpath,"
2026 (openbsd[[2-9]].*|mirbsd*)
2027 LD_RPATH_OPT="-Wl,-rpath,"
2030 LD_RPATH_OPT="-rpath "
2033 LD_RPATH_OPT="-Wl,-rpath,"
2036 LD_RPATH_OPT="-rpath "
2044 AC_MSG_RESULT($LD_RPATH_OPT)
2046 case "x$LD_RPATH_OPT" in
2048 AC_MSG_CHECKING(if we need a space after rpath option)
2049 cf_save_LIBS="$LIBS"
2050 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
2051 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
2052 LIBS="$cf_save_LIBS"
2053 AC_MSG_RESULT($cf_rpath_space)
2054 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
2059 dnl ---------------------------------------------------------------------------
2060 dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48
2062 dnl Construct a search-list of directories for a nonstandard library-file
2065 dnl $1 = the variable to return as result
2066 dnl $2 = the package name
2067 AC_DEFUN([CF_LIBRARY_PATH],
2070 cf_library_path_list=""
2071 if test -n "${LDFLAGS}${LIBS}" ; then
2072 for cf_library_path in $LDFLAGS $LIBS
2074 case $cf_library_path in
2076 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
2077 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
2078 cf_library_path_list="$cf_library_path_list [$]$1"
2084 CF_SUBDIR_PATH($1,$2,lib)
2086 $1="$cf_library_path_list [$]$1"
2088 dnl ---------------------------------------------------------------------------
2089 dnl CF_LIB_PREFIX version: 12 updated: 2015/10/17 19:03:33
2091 dnl Compute the library-prefix for the given host system
2092 dnl $1 = variable to set
2093 define([CF_LIB_PREFIX],
2095 case $cf_cv_system_name in
2097 if test "$DFT_LWR_MODEL" = libtool; then
2103 (*) LIB_PREFIX='lib'
2106 ifelse($1,,,[$1=$LIB_PREFIX])
2107 AC_SUBST(LIB_PREFIX)
2109 dnl ---------------------------------------------------------------------------
2110 dnl CF_LIB_SUFFIX version: 25 updated: 2015/04/17 21:13:04
2112 dnl Compute the library file-suffix from the given model name
2114 dnl $2 = variable to set (the nominal library suffix)
2115 dnl $3 = dependency variable to set (actual filename)
2116 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2117 AC_DEFUN([CF_LIB_SUFFIX],
2133 case $cf_cv_system_name in
2138 (cygwin*|msys*|mingw*)
2169 if test -n "${LIB_SUFFIX}${EXTRA_SUFFIX}"
2171 $2="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$2}"
2172 $3="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$3}"
2175 dnl ---------------------------------------------------------------------------
2176 dnl CF_LIB_TYPE version: 5 updated: 2015/04/17 21:13:04
2178 dnl Compute the string to append to -library from the given model name
2180 dnl $2 = variable to set
2181 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2182 AC_DEFUN([CF_LIB_TYPE],
2188 (profile) $2='_p' ;;
2191 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2193 dnl ---------------------------------------------------------------------------
2194 dnl CF_LINK_DATAONLY version: 12 updated: 2017/07/23 17:46:07
2195 dnl ----------------
2196 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
2197 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
2198 dnl have to provide wrappers for global tables to ensure they're linked
2200 AC_DEFUN([CF_LINK_DATAONLY],
2202 AC_MSG_CHECKING([if data-only library module links])
2203 AC_CACHE_VAL(cf_cv_link_dataonly,[
2205 cat >conftest.$ac_ext <<EOF
2206 #line __oline__ "configure"
2207 int testdata[[3]] = { 123, 456, 789 };
2209 if AC_TRY_EVAL(ac_compile) ; then
2210 mv conftest.o data.o && \
2211 ( $AR $ARFLAGS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null
2213 rm -f conftest.$ac_ext data.o
2214 cat >conftest.$ac_ext <<EOF
2215 #line __oline__ "configure"
2219 ${cf_cv_main_return:-return}(1); /* I'm told this linker is broken */
2221 extern int testdata[[3]];
2222 return testdata[[0]] == 123
2223 && testdata[[1]] == 456
2224 && testdata[[2]] == 789;
2228 if AC_TRY_EVAL(ac_compile); then
2229 mv conftest.o func.o && \
2230 ( $AR $ARFLAGS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null
2232 rm -f conftest.$ac_ext func.o
2233 ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null
2235 LIBS="conftest.a $LIBS"
2239 extern int testfunc();
2240 ${cf_cv_main_return:-return} (!testfunc());
2243 [cf_cv_link_dataonly=yes],
2244 [cf_cv_link_dataonly=no],
2245 [cf_cv_link_dataonly=unknown])
2248 AC_MSG_RESULT($cf_cv_link_dataonly)
2250 if test "$cf_cv_link_dataonly" = no ; then
2251 AC_DEFINE(BROKEN_LINKER,1,[if data-only library module does not link])
2256 dnl ---------------------------------------------------------------------------
2257 dnl CF_MAKEFLAGS version: 18 updated: 2018/02/21 21:26:03
2259 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
2260 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
2261 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
2262 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
2263 AC_DEFUN([CF_MAKEFLAGS],
2265 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
2267 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
2269 cat >cf_makeflags.tmp <<CF_EOF
2272 @ echo '.$cf_option'
2274 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'`
2275 case "$cf_result" in
2277 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
2278 case "$cf_result" in
2279 (.*CC=*) cf_cv_makeflags=
2281 (*) cf_cv_makeflags=$cf_option
2289 CF_MSG_LOG(given option \"$cf_option\", no match \"$cf_result\")
2293 rm -f cf_makeflags.tmp
2296 AC_SUBST(cf_cv_makeflags)
2298 dnl ---------------------------------------------------------------------------
2299 dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
2301 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
2302 dnl a monocase filesystem.
2303 AC_DEFUN([CF_MAKE_TAGS],[
2304 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
2306 AC_CHECK_PROGS(CTAGS, exctags ctags)
2307 AC_CHECK_PROGS(ETAGS, exetags etags)
2309 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
2311 if test "$cf_cv_mixedcase" = yes ; then
2312 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
2317 if test "$MAKE_UPPER_TAGS" = yes ; then
2323 if test "$MAKE_LOWER_TAGS" = yes ; then
2332 AC_SUBST(MAKE_UPPER_TAGS)
2333 AC_SUBST(MAKE_LOWER_TAGS)
2335 dnl ---------------------------------------------------------------------------
2336 dnl CF_MIXEDCASE_FILENAMES version: 7 updated: 2015/04/12 15:39:00
2337 dnl ----------------------
2338 dnl Check if the file-system supports mixed-case filenames. If we're able to
2339 dnl create a lowercase name and see it as uppercase, it doesn't support that.
2340 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
2342 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
2343 if test "$cross_compiling" = yes ; then
2344 case $target_alias in
2345 (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*)
2353 rm -f conftest CONFTEST
2355 if test -f CONFTEST ; then
2360 rm -f conftest CONFTEST
2363 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
2365 dnl ---------------------------------------------------------------------------
2366 dnl CF_MKSTEMP version: 10 updated: 2017/01/21 11:12:16
2368 dnl Check for a working mkstemp. This creates two files, checks that they are
2369 dnl successfully created and distinct (AmigaOS apparently fails on the last).
2370 AC_DEFUN([CF_MKSTEMP],[
2374 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
2377 #include <sys/types.h>
2378 #ifdef HAVE_UNISTD_H
2384 #include <sys/stat.h>
2387 char *tmpl = "conftestXXXXXX";
2395 for (n = 0; n < 2; ++n) {
2396 strcpy(name[n], tmpl);
2397 if ((fd = mkstemp(name[n])) >= 0) {
2398 if (!strcmp(name[n], tmpl)
2399 || stat(name[n], &sb) != 0
2400 || (sb.st_mode & S_IFMT) != S_IFREG
2401 || (sb.st_mode & 077) != 0) {
2408 && !strcmp(name[0], name[1]))
2410 ${cf_cv_main_return:-return}(result);
2412 ],[cf_cv_func_mkstemp=yes
2413 ],[cf_cv_func_mkstemp=no
2414 ],[cf_cv_func_mkstemp=maybe])
2416 if test "x$cf_cv_func_mkstemp" = xmaybe ; then
2417 AC_CHECK_FUNC(mkstemp)
2419 if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
2420 AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.])
2423 dnl ---------------------------------------------------------------------------
2424 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
2426 dnl Write a debug message to config.log, along with the line number in the
2427 dnl configure script.
2428 AC_DEFUN([CF_MSG_LOG],[
2429 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
2431 dnl ---------------------------------------------------------------------------
2432 dnl CF_NCURSES_ADDON version: 5 updated: 2015/04/26 18:06:58
2433 dnl ----------------
2434 dnl Configure an ncurses add-on, built outside the ncurses tree.
2435 AC_DEFUN([CF_NCURSES_ADDON],[
2436 AC_REQUIRE([CF_NCURSES_CONFIG])
2438 AC_PROVIDE([CF_SUBST_NCURSES_VERSION])
2440 AC_MSG_CHECKING(if you want wide-character code)
2441 AC_ARG_ENABLE(widec,
2442 [ --enable-widec compile with wide-char/UTF-8 code],
2443 [with_widec=$enableval],
2445 AC_MSG_RESULT($with_widec)
2446 if test "$with_widec" = yes ; then
2448 CF_NCURSES_CONFIG(ncursesw)
2450 CF_NCURSES_CONFIG(ncurses)
2453 if test "$NCURSES_CONFIG_PKG" != none ; then
2454 cf_version=`$PKG_CONFIG --modversion $NCURSES_CONFIG_PKG 2>/dev/null`
2456 NCURSES_MAJOR=`echo "$cf_version" | sed -e 's/\..*//'`
2457 NCURSES_MINOR=`echo "$cf_version" | sed -e 's/^[[0-9]][[0-9]]*\.//' -e 's/\..*//'`
2458 NCURSES_PATCH=`echo "$cf_version" | sed -e 's/^[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.//'`
2460 cf_cv_abi_version=`$PKG_CONFIG --variable=abi_version $NCURSES_CONFIG_PKG 2>/dev/null`
2461 if test -z "$cf_cv_abi_version"
2463 cf_cv_abi_version=`$PKG_CONFIG --variable=major_version $NCURSES_CONFIG_PKG 2>/dev/null`
2466 elif test "$NCURSES_CONFIG" != none ; then
2468 cf_version=`$NCURSES_CONFIG --version 2>/dev/null`
2470 NCURSES_MAJOR=`echo "$cf_version" | sed -e 's/\..*//'`
2471 NCURSES_MINOR=`echo "$cf_version" | sed -e 's/^[[0-9]][[0-9]]*\.//' -e 's/\..*//'`
2472 NCURSES_PATCH=`echo "$cf_version" | sed -e 's/^[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.//'`
2474 # ABI version is not available from headers
2475 cf_cv_abi_version=`$NCURSES_CONFIG --abi-version 2>/dev/null`
2479 for cf_name in MAJOR MINOR PATCH
2481 cat >conftest.$ac_ext <<CF_EOF
2482 #include <${cf_cv_ncurses_header:-curses.h}>
2483 AUTOCONF_$cf_name NCURSES_VERSION_$cf_name
2485 cf_try="$ac_cpp conftest.$ac_ext 2>&5 | fgrep AUTOCONF_$cf_name >conftest.out"
2487 if test -f conftest.out ; then
2488 cf_result=`cat conftest.out | sed -e "s/^.*AUTOCONF_$cf_name[[ ]][[ ]]*//"`
2489 eval NCURSES_$cf_name=\"$cf_result\"
2490 # cat conftest.$ac_ext
2495 cf_cv_abi_version=${NCURSES_MAJOR}
2499 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
2501 dnl Show the computed version, for logging
2502 cf_cv_timestamp=`date`
2504 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
2506 dnl We need these values in the generated headers
2507 AC_SUBST(NCURSES_MAJOR)
2508 AC_SUBST(NCURSES_MINOR)
2509 AC_SUBST(NCURSES_PATCH)
2511 dnl We need these values in the generated makefiles
2512 AC_SUBST(cf_cv_rel_version)
2513 AC_SUBST(cf_cv_abi_version)
2515 dnl FIXME - not needed for Ada95
2516 AC_SUBST(cf_cv_builtin_bool)
2517 AC_SUBST(cf_cv_header_stdbool_h)
2518 AC_SUBST(cf_cv_type_of_bool)dnl
2521 dnl ---------------------------------------------------------------------------
2522 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
2523 dnl -------------------
2524 dnl Check if we can compile with ncurses' header file
2525 dnl $1 is the cache variable to set
2526 dnl $2 is the header-file to include
2527 dnl $3 is the root name (ncurses or ncursesw)
2528 AC_DEFUN([CF_NCURSES_CC_CHECK],[
2530 ]ifelse($3,ncursesw,[
2531 #define _XOPEN_SOURCE_EXTENDED
2532 #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
2533 #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
2536 #ifdef NCURSES_VERSION
2537 ]ifelse($3,ncursesw,[
2542 printf("%s\n", NCURSES_VERSION);
2554 dnl ---------------------------------------------------------------------------
2555 dnl CF_NCURSES_CONFIG version: 21 updated: 2018/06/20 20:23:13
2556 dnl -----------------
2557 dnl Tie together the configure-script macros for ncurses, preferring these in
2559 dnl a) ".pc" files for pkg-config, using $NCURSES_CONFIG_PKG
2560 dnl b) the "-config" script from ncurses, using $NCURSES_CONFIG
2561 dnl c) just plain libraries
2563 dnl $1 is the root library name (default: "ncurses")
2564 AC_DEFUN([CF_NCURSES_CONFIG],[
2565 AC_REQUIRE([CF_PKG_CONFIG])
2566 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
2567 cf_have_ncuconfig=no
2569 if test "x${PKG_CONFIG:=none}" != xnone; then
2570 AC_MSG_CHECKING(pkg-config for $cf_ncuconfig_root)
2571 if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then
2574 AC_MSG_CHECKING(if the $cf_ncuconfig_root package files work)
2575 cf_have_ncuconfig=unknown
2577 cf_save_CPPFLAGS="$CPPFLAGS"
2578 cf_save_LIBS="$LIBS"
2580 CF_ADD_CFLAGS(`$PKG_CONFIG --cflags $cf_ncuconfig_root`)
2581 CF_ADD_LIBS(`$PKG_CONFIG --libs $cf_ncuconfig_root`)
2583 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
2584 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
2585 [AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}>
2587 { char *xx = curses_version(); return (xx == 0); }],
2588 [cf_have_ncuconfig=yes],
2589 [cf_have_ncuconfig=no],
2590 [cf_have_ncuconfig=maybe])],
2591 [cf_have_ncuconfig=no])
2592 AC_MSG_RESULT($cf_have_ncuconfig)
2593 test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes
2594 if test "$cf_have_ncuconfig" != "yes"
2596 CPPFLAGS="$cf_save_CPPFLAGS"
2597 LIBS="$cf_save_LIBS"
2598 NCURSES_CONFIG_PKG=none
2600 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2601 NCURSES_CONFIG_PKG=$cf_ncuconfig_root
2607 NCURSES_CONFIG_PKG=none
2610 NCURSES_CONFIG_PKG=none
2613 if test "x$cf_have_ncuconfig" = "xno"; then
2614 cf_ncurses_config="${cf_ncuconfig_root}${NCURSES_CONFIG_SUFFIX}-config"; echo "Looking for ${cf_ncurses_config}"
2616 CF_ACVERSION_CHECK(2.52,
2617 [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)],
2618 [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)])
2620 if test "$NCURSES_CONFIG" != none ; then
2622 CF_ADD_CFLAGS(`$NCURSES_CONFIG --cflags`)
2623 CF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
2625 # even with config script, some packages use no-override for curses.h
2626 CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
2628 dnl like CF_NCURSES_CPPFLAGS
2629 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2631 dnl like CF_NCURSES_LIBS
2632 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
2633 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2635 dnl like CF_NCURSES_VERSION
2636 cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
2640 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
2641 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
2648 dnl ---------------------------------------------------------------------------
2649 dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51
2650 dnl -------------------
2651 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
2652 dnl the CPPFLAGS variable so we can include its header.
2654 dnl The header files may be installed as either curses.h, or ncurses.h (would
2655 dnl be obsolete, except that some packagers prefer this name to distinguish it
2656 dnl from a "native" curses implementation). If not installed for overwrite,
2657 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
2658 dnl /usr/include/ncurses), but someone may have installed overwriting the
2659 dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
2660 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
2663 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
2664 dnl is already in the include-path, don't even bother with this, since we cannot
2665 dnl easily determine which file it is. In this case, it has to be <curses.h>.
2667 dnl The optional parameter gives the root name of the library, in case it is
2668 dnl not installed as the default curses library. That is how the
2669 dnl wide-character version of ncurses is installed.
2670 AC_DEFUN([CF_NCURSES_CPPFLAGS],
2671 [AC_REQUIRE([CF_WITH_CURSES_DIR])
2673 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
2674 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
2676 test -n "$cf_cv_curses_dir" && \
2677 test "$cf_cv_curses_dir" != "no" && { \
2678 CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root)
2681 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
2682 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
2683 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
2684 for cf_header in $cf_header_list
2686 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
2687 test "$cf_cv_ncurses_h" != no && break
2694 # some applications need this, but should check for NCURSES_VERSION
2695 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2699 dnl ---------------------------------------------------------------------------
2700 dnl CF_NCURSES_HEADER version: 4 updated: 2015/04/15 19:08:48
2701 dnl -----------------
2702 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
2703 dnl variations of ncurses' installs.
2705 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
2706 AC_DEFUN([CF_NCURSES_HEADER],[
2708 if test "$cf_cv_ncurses_h" != no ; then
2709 cf_cv_ncurses_header=$cf_cv_ncurses_h
2712 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
2713 test -n "$verbose" && echo
2714 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
2715 test -n "$verbose" && echo search path $cf_search
2716 cf_save2_CPPFLAGS="$CPPFLAGS"
2717 for cf_incdir in $cf_search
2719 CF_ADD_INCDIR($cf_incdir)
2724 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
2725 if test "$cf_cv_ncurses_h2" != no ; then
2726 cf_cv_ncurses_h2=$cf_incdir/$cf_header
2727 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
2730 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
2732 CPPFLAGS="$cf_save2_CPPFLAGS"
2733 test "$cf_cv_ncurses_h2" != no && break
2735 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
2738 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
2739 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
2740 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
2741 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
2743 CF_ADD_INCDIR($cf_1st_incdir)
2747 # Set definitions to allow ifdef'ing for ncurses.h
2749 case $cf_cv_ncurses_header in
2751 AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h])
2755 case $cf_cv_ncurses_header in
2756 (ncurses/curses.h|ncurses/ncurses.h)
2757 AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h])
2759 (ncursesw/curses.h|ncursesw/ncurses.h)
2760 AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h])
2765 dnl ---------------------------------------------------------------------------
2766 dnl CF_NCURSES_LIBS version: 17 updated: 2015/04/15 19:08:48
2768 dnl Look for the ncurses library. This is a little complicated on Linux,
2769 dnl because it may be linked with the gpm (general purpose mouse) library.
2770 dnl Some distributions have gpm linked with (bsd) curses, which makes it
2771 dnl unusable with ncurses. However, we don't want to link with gpm unless
2772 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
2773 dnl and the linker will record a dependency.
2775 dnl The optional parameter gives the root name of the library, in case it is
2776 dnl not installed as the default curses library. That is how the
2777 dnl wide-character version of ncurses is installed.
2778 AC_DEFUN([CF_NCURSES_LIBS],
2779 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
2781 cf_nculib_root=ifelse($1,,ncurses,$1)
2782 # This works, except for the special case where we find gpm, but
2783 # ncurses is in a nonstandard location via $LIBS, and we really want
2786 cf_ncurses_SAVE="$LIBS"
2787 AC_CHECK_LIB(gpm,Gpm_Open,
2788 [AC_CHECK_LIB(gpm,initscr,
2789 [LIBS="$cf_ncurses_SAVE"],
2790 [cf_ncurses_LIBS="-lgpm"])])
2794 # This is only necessary if you are linking against an obsolete
2795 # version of ncurses (but it should do no harm, since it's static).
2796 if test "$cf_nculib_root" = ncurses ; then
2797 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
2802 CF_ADD_LIBS($cf_ncurses_LIBS)
2804 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
2806 CF_ADD_LIBS(-l$cf_nculib_root)
2808 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
2809 [#include <${cf_cv_ncurses_header:-curses.h}>],
2814 if test -n "$cf_ncurses_LIBS" ; then
2815 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
2816 cf_ncurses_SAVE="$LIBS"
2817 for p in $cf_ncurses_LIBS ; do
2818 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
2819 if test "$q" != "$LIBS" ; then
2823 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
2824 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
2825 [AC_MSG_RESULT(yes)],
2827 LIBS="$cf_ncurses_SAVE"])
2830 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
2831 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2833 dnl ---------------------------------------------------------------------------
2834 dnl CF_NCURSES_VERSION version: 15 updated: 2017/05/09 19:26:10
2835 dnl ------------------
2836 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
2837 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
2838 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
2839 AC_DEFUN([CF_NCURSES_VERSION],
2841 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
2842 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
2843 cf_cv_ncurses_version=no
2847 #include <${cf_cv_ncurses_header:-curses.h}>
2851 FILE *fp = fopen("$cf_tempfile", "w");
2852 #ifdef NCURSES_VERSION
2853 # ifdef NCURSES_VERSION_PATCH
2854 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
2856 fprintf(fp, "%s\n", NCURSES_VERSION);
2860 fprintf(fp, "old\n");
2865 ${cf_cv_main_return:-return}(0);
2867 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
2869 # This will not work if the preprocessor splits the line after the
2870 # Autoconf token. The 'unproto' program does that.
2871 cat > conftest.$ac_ext <<EOF
2872 #include <${cf_cv_ncurses_header:-curses.h}>
2874 #ifdef NCURSES_VERSION
2875 Autoconf NCURSES_VERSION
2883 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
2885 if test -f conftest.out ; then
2886 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
2887 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
2893 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2895 dnl ---------------------------------------------------------------------------
2896 dnl CF_OBJ_SUBDIR version: 7 updated: 2015/04/17 21:13:04
2898 dnl Compute the object-directory name from the given model name
2899 AC_DEFUN([CF_OBJ_SUBDIR],
2902 (libtool) $2='obj_lo' ;;
2903 (normal) $2='objects' ;;
2904 (debug) $2='obj_g' ;;
2905 (profile) $2='obj_p' ;;
2907 case $cf_cv_system_name in
2915 dnl ---------------------------------------------------------------------------
2916 dnl CF_PATHSEP version: 7 updated: 2015/04/12 15:39:00
2918 dnl Provide a value for the $PATH and similar separator (or amend the value
2919 dnl as provided in autoconf 2.5x).
2920 AC_DEFUN([CF_PATHSEP],
2922 AC_MSG_CHECKING(for PATH separator)
2923 case $cf_cv_system_name in
2924 (os2*) PATH_SEPARATOR=';' ;;
2925 (*) ${PATH_SEPARATOR:=':'} ;;
2927 ifelse([$1],,,[$1=$PATH_SEPARATOR])
2928 AC_SUBST(PATH_SEPARATOR)
2929 AC_MSG_RESULT($PATH_SEPARATOR)
2931 dnl ---------------------------------------------------------------------------
2932 dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57
2934 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
2935 dnl begins with one of the prefix/exec_prefix variables, and then again if the
2936 dnl result begins with 'NONE'. This is necessary to work around autoconf's
2937 dnl delayed evaluation of those symbols.
2938 AC_DEFUN([CF_PATH_SYNTAX],[
2939 if test "x$prefix" != xNONE; then
2940 cf_path_syntax="$prefix"
2942 cf_path_syntax="$ac_default_prefix"
2946 (.\[$]\(*\)*|.\'*\'*)
2950 (.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX
2952 (.\[$]{*prefix}*|.\[$]{*dir}*)
2956 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
2961 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
2964 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
2968 dnl ---------------------------------------------------------------------------
2969 dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58
2971 dnl Check for the package-config program, unless disabled by command-line.
2972 AC_DEFUN([CF_PKG_CONFIG],
2974 AC_MSG_CHECKING(if you want to use pkg-config)
2975 AC_ARG_WITH(pkg-config,
2976 [ --with-pkg-config{=path} enable/disable use of pkg-config],
2977 [cf_pkg_config=$withval],
2978 [cf_pkg_config=yes])
2979 AC_MSG_RESULT($cf_pkg_config)
2981 case $cf_pkg_config in
2986 CF_ACVERSION_CHECK(2.52,
2987 [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
2988 [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
2995 test -z "$PKG_CONFIG" && PKG_CONFIG=none
2996 if test "$PKG_CONFIG" != none ; then
2997 CF_PATH_SYNTAX(PKG_CONFIG)
2998 elif test "x$cf_pkg_config" != xno ; then
2999 AC_MSG_WARN(pkg-config is not installed)
3002 AC_SUBST(PKG_CONFIG)
3004 dnl ---------------------------------------------------------------------------
3005 dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17
3006 dnl -----------------
3007 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
3009 dnl POSIX.1-1990 _POSIX_SOURCE
3010 dnl POSIX.1-1990 and _POSIX_SOURCE and
3011 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
3013 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
3014 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
3015 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
3018 dnl $1 is the nominal value for _POSIX_C_SOURCE
3019 AC_DEFUN([CF_POSIX_C_SOURCE],
3020 [AC_REQUIRE([CF_POSIX_VISIBLE])dnl
3022 if test "$cf_cv_posix_visible" = no; then
3024 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
3026 cf_save_CFLAGS="$CFLAGS"
3027 cf_save_CPPFLAGS="$CPPFLAGS"
3029 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
3030 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
3032 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
3033 CF_MSG_LOG(if the symbol is already defined go no further)
3034 AC_TRY_COMPILE([#include <sys/types.h>],[
3035 #ifndef _POSIX_C_SOURCE
3038 [cf_cv_posix_c_source=no],
3039 [cf_want_posix_source=no
3040 case .$cf_POSIX_C_SOURCE in
3042 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3045 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3046 cf_want_posix_source=yes
3049 cf_want_posix_source=yes
3052 if test "$cf_want_posix_source" = yes ; then
3053 AC_TRY_COMPILE([#include <sys/types.h>],[
3054 #ifdef _POSIX_SOURCE
3057 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
3059 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
3060 CFLAGS="$cf_trim_CFLAGS"
3061 CPPFLAGS="$cf_trim_CPPFLAGS"
3062 CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source)
3063 CF_MSG_LOG(if the second compile does not leave our definition intact error)
3064 AC_TRY_COMPILE([#include <sys/types.h>],[
3065 #ifndef _POSIX_C_SOURCE
3068 [cf_cv_posix_c_source=no])
3069 CFLAGS="$cf_save_CFLAGS"
3070 CPPFLAGS="$cf_save_CPPFLAGS"
3074 if test "$cf_cv_posix_c_source" != no ; then
3075 CFLAGS="$cf_trim_CFLAGS"
3076 CPPFLAGS="$cf_trim_CPPFLAGS"
3077 CF_ADD_CFLAGS($cf_cv_posix_c_source)
3080 fi # cf_cv_posix_visible
3083 dnl ---------------------------------------------------------------------------
3084 dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17
3085 dnl ----------------
3086 dnl POSIX documents test-macros which an application may set before any system
3087 dnl headers are included to make features available.
3089 dnl Some BSD platforms (originally FreeBSD, but copied by a few others)
3090 dnl diverged from POSIX in 2002 by setting symbols which make all of the most
3091 dnl recent features visible in the system header files unless the application
3092 dnl overrides the corresponding test-macros. Doing that introduces portability
3095 dnl This macro makes a special check for the symbols used for this, to avoid a
3096 dnl conflicting definition.
3097 AC_DEFUN([CF_POSIX_VISIBLE],
3099 AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[
3100 AC_TRY_COMPILE([#include <stdio.h>],[
3101 #if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \
3102 && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \
3103 && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \
3104 && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0)
3105 #error conflicting symbols found
3107 ],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes])
3110 dnl ---------------------------------------------------------------------------
3111 dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22
3113 dnl Check for archiver "ar".
3114 AC_DEFUN([CF_PROG_AR],[
3115 AC_CHECK_TOOL(AR, ar, ar)
3117 dnl ---------------------------------------------------------------------------
3118 dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59
3120 dnl Check for awk, ensure that the check found something.
3121 AC_DEFUN([CF_PROG_AWK],
3124 test -z "$AWK" && AC_MSG_ERROR(No awk program found)
3126 dnl ---------------------------------------------------------------------------
3127 dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54
3129 dnl standard check for CC, plus followup sanity checks
3130 dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
3131 AC_DEFUN([CF_PROG_CC],[
3132 CF_ACVERSION_CHECK(2.53,
3133 [AC_MSG_WARN(this will incorrectly handle gnatgcc choice)
3134 AC_REQUIRE([AC_PROG_CC])],
3136 ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
3138 CF_ACVERSION_CHECK(2.52,
3143 dnl ---------------------------------------------------------------------------
3144 dnl CF_PROG_CC_C_O version: 5 updated: 2017/01/21 11:06:25
3146 dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
3147 dnl the output file can be renamed, and allows for a shell variable that can
3148 dnl be used later. The parameter is either CC or CXX. The result is the
3150 dnl $cf_cv_prog_CC_c_o
3151 dnl $cf_cv_prog_CXX_c_o
3154 dnl $2 = compiler options, if any
3155 AC_DEFUN([CF_PROG_CC_C_O],
3156 [AC_REQUIRE([AC_PROG_CC])dnl
3157 AC_MSG_CHECKING([whether [$]$1 understands -c and -o together])
3158 AC_CACHE_VAL(cf_cv_prog_$1_c_o,
3160 cat > conftest.$ac_ext <<CF_EOF
3163 ${cf_cv_main_return:-return}(0);
3166 # We do the test twice because some compilers refuse to overwrite an
3167 # existing .o file with -o, though they will create one.
3168 ac_try='[$]$1 $2 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC'
3169 if AC_TRY_EVAL(ac_try) &&
3170 test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
3172 eval cf_cv_prog_$1_c_o=yes
3174 eval cf_cv_prog_$1_c_o=no
3178 if test $cf_cv_prog_$1_c_o = yes; then
3179 AC_MSG_RESULT([yes])
3184 dnl ---------------------------------------------------------------------------
3185 dnl CF_PROG_EGREP version: 2 updated: 2015/04/18 08:56:57
3187 dnl AC_PROG_EGREP was introduced in autoconf 2.53.
3188 dnl This macro adds a check to ensure the script found something.
3189 AC_DEFUN([CF_PROG_EGREP],
3190 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
3191 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
3192 then ac_cv_prog_egrep='grep -E'
3193 else ac_cv_prog_egrep='egrep'
3195 EGREP=$ac_cv_prog_egrep
3197 test -z "$EGREP" && AC_MSG_ERROR(No egrep program found)
3199 dnl ---------------------------------------------------------------------------
3200 dnl CF_PROG_EXT version: 14 updated: 2018/06/20 20:23:13
3202 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
3203 AC_DEFUN([CF_PROG_EXT],
3205 AC_REQUIRE([CF_CHECK_CACHE])
3206 case $cf_cv_system_name in
3208 CFLAGS="$CFLAGS -Zmt"
3209 CF_APPEND_TEXT(CPPFLAGS,-D__ST_MT_ERRNO__)
3210 CXXFLAGS="$CXXFLAGS -Zmt"
3211 # autoconf's macro sets -Zexe and suffix both, which conflict:w
3212 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
3222 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
3224 dnl ---------------------------------------------------------------------------
3225 dnl CF_PROG_GNAT version: 10 updated: 2019/12/31 08:53:54
3227 dnl Check for gnat/gnatmake/etc, ensure that the toolset is complete.
3228 AC_DEFUN([CF_PROG_GNAT],[
3229 for cf_prog_gnat in gnat gnatmake gprconfig gprbuild
3231 CF_UPPER(cf_upper_prog_gnat,${cf_prog_gnat})
3233 unset ac_cv_path_cf_TEMP_gnat
3235 AC_PATH_PROG(cf_TEMP_gnat,$cf_prog_gnat,no)
3236 eval cf_cv_PATH_$cf_upper_prog_gnat=[$]ac_cv_path_cf_TEMP_gnat
3238 if test "x$cf_TEMP_gnat" != xno; then
3239 unset cf_cv_gnat_version
3241 CF_GNAT_VERSION(cf_TEMP_gnat,$cf_prog_gnat)
3243 eval cf_cv_VERSION_$cf_upper_prog_gnat=[$]cf_TEMP_gnat
3246 unset cf_cv_gnat_version
3247 unset ac_cv_path_cf_TEMP_gnat
3250 if test "x$cf_cv_VERSION_GNATMAKE" = "xno"; then
3252 cf_cv_prog_gnat_correct=no
3254 cf_ada_make=gnatmake
3255 if test "x$cf_cv_VERSION_GPRCONFIG" = "xno"; then
3256 # gprconfig is newer than gnatmake; we can continue...
3259 rm -rf conftest* *~conftest*
3260 if mkdir conftest.src
3264 for cf_gprconfig in Ada C
3266 AC_MSG_CHECKING(for gprconfig name for $cf_gprconfig)
3267 if test $cf_gprconfig = C
3269 for cf_gprconfig_param in \
3270 $cf_gprconfig,,,,GNATGCC \
3271 $cf_gprconfig,,,,GCC \
3274 cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1`
3275 test -n "$cf_gprconfig_value" && break
3278 cf_gprconfig_param=$cf_gprconfig
3279 cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1`
3281 if test -n "$cf_gprconfig_value"
3283 eval cf_ada_config_[$]cf_gprconfig=[$]cf_gprconfig_value
3284 AC_MSG_RESULT($cf_gprconfig_value)
3286 AC_MSG_RESULT(missing)
3292 rm -rf conftest* *~conftest*
3295 if test "x$cf_ada_config" != "x#"
3298 CF_CHECK_GNAT_VERSION
3299 AC_CHECK_PROG(M4_exists, m4, yes, no)
3300 if test "$ac_cv_prog_M4_exists" = no; then
3301 cf_cv_prog_gnat_correct=no
3302 AC_MSG_WARN(Ada95 binding required program m4 not found. Ada95 binding disabled)
3304 if test "$cf_cv_prog_gnat_correct" = yes; then
3305 AC_MSG_CHECKING(if GNAT works)
3306 CF_GNAT_TRY_RUN([procedure conftest;],
3309 procedure conftest is
3311 Text_IO.Put ("Hello World");
3313 GNAT.OS_Lib.OS_Exit (0);
3315 [cf_cv_prog_gnat_correct=yes],
3316 [cf_cv_prog_gnat_correct=no])
3317 AC_MSG_RESULT($cf_cv_prog_gnat_correct)
3320 cf_cv_prog_gnat_correct=no
3324 AC_SUBST(cf_ada_make)
3325 AC_SUBST(cf_ada_config)
3326 AC_SUBST(cf_ada_config_Ada)
3327 AC_SUBST(cf_ada_config_C)
3329 dnl ---------------------------------------------------------------------------
3330 dnl CF_PROG_INSTALL version: 7 updated: 2015/04/18 08:56:57
3332 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
3333 dnl misc/tabset install won't work properly. Usually this happens only when
3334 dnl using the fallback mkinstalldirs script
3335 AC_DEFUN([CF_PROG_INSTALL],
3341 CF_DIRNAME(cf_dir,$INSTALL)
3342 test -z "$cf_dir" && cf_dir=.
3343 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
3347 dnl ---------------------------------------------------------------------------
3348 dnl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37
3350 dnl Combine checks for "ln -s" and "ln -sf", updating $LN_S to include "-f"
3351 dnl option if it is supported.
3352 AC_DEFUN([CF_PROG_LN_S],[
3354 AC_MSG_CHECKING(if $LN_S -f options work)
3356 rm -f conf$$.src conf$$dst
3358 echo first >conf$$.src
3359 if $LN_S -f conf$$.src conf$$.dst 2>/dev/null; then
3364 rm -f conf$$.dst conf$$src
3365 AC_MSG_RESULT($cf_prog_ln_sf)
3367 test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
3369 dnl ---------------------------------------------------------------------------
3370 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
3371 dnl ----------------
3372 dnl Remove all -U and -D options that refer to the given symbol from a list
3373 dnl of C compiler options. This works around the problem that not all
3374 dnl compilers process -U and -D options from left-to-right, so a -U option
3375 dnl cannot be used to cancel the effect of a preceding -D option.
3377 dnl $1 = target (which could be the same as the source variable)
3378 dnl $2 = source (including '$')
3379 dnl $3 = symbol to remove
3380 define([CF_REMOVE_DEFINE],
3383 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
3384 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
3386 dnl ---------------------------------------------------------------------------
3387 dnl CF_REMOVE_LIB version: 1 updated: 2007/02/17 14:11:52
3389 dnl Remove the given library from the symbol
3391 dnl $1 = target (which could be the same as the source variable)
3392 dnl $2 = source (including '$')
3393 dnl $3 = library to remove
3394 define([CF_REMOVE_LIB],
3396 # remove $3 library from $2
3397 $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'`
3399 dnl ---------------------------------------------------------------------------
3400 dnl CF_RESTORE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:47:45
3401 dnl ---------------------
3402 dnl Restore flags saved in CF_SAVE_XTRA_FLAGS
3403 dnl $1 = name of current macro
3404 define([CF_RESTORE_XTRA_FLAGS],
3406 LIBS="$cf_save_LIBS_$1"
3407 CFLAGS="$cf_save_CFLAGS_$1"
3408 CPPFLAGS="$cf_save_CPPFLAGS_$1"
3410 dnl ---------------------------------------------------------------------------
3411 dnl CF_SAVE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:46:44
3412 dnl ------------------
3413 dnl Use this macro to save CFLAGS/CPPFLAGS/LIBS before checks against X headers
3414 dnl and libraries which do not update those variables.
3416 dnl $1 = name of current macro
3417 define([CF_SAVE_XTRA_FLAGS],
3419 cf_save_LIBS_$1="$LIBS"
3420 cf_save_CFLAGS_$1="$CFLAGS"
3421 cf_save_CPPFLAGS_$1="$CPPFLAGS"
3422 LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}"
3423 for cf_X_CFLAGS in $X_CFLAGS
3425 case "x$cf_X_CFLAGS" in
3427 CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS"
3430 CFLAGS="$CFLAGS $cf_X_CFLAGS"
3435 dnl ---------------------------------------------------------------------------
3436 dnl CF_SHARED_OPTS version: 93 updated: 2018/08/18 16:36:35
3439 dnl Attempt to determine the appropriate CC/LD options for creating a shared
3443 dnl a) ${LOCAL_LDFLAGS} is used to link executables that will run within
3444 dnl the build-tree, i.e., by making use of the libraries that are compiled in
3445 dnl $rel_builddir/lib We avoid compiling-in a $rel_builddir/lib path for the
3446 dnl shared library since that can lead to unexpected results at runtime.
3447 dnl b) ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared
3448 dnl libraries are compiled in ../../lib
3450 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
3451 dnl to install symbolic links to the rel/abi versions of shared libraries.
3453 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
3454 dnl version when making symbolic links.
3456 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
3457 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
3458 dnl (ex: libncurses.so.<ver>).
3460 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
3461 AC_DEFUN([CF_SHARED_OPTS],
3463 AC_REQUIRE([CF_LD_RPATH_OPT])
3469 INSTALL_LIB="-m 644"
3470 : ${rel_builddir:=.}
3478 cf_cv_do_symlinks=no
3480 test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT"
3482 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
3483 AC_ARG_WITH(shlib-version,
3484 [ --with-shlib-version=X Specify rel or abi version for shared libs],
3485 [test -z "$withval" && withval=auto
3488 cf_cv_shlib_version=auto
3491 cf_cv_shlib_version=$withval
3494 AC_MSG_RESULT($withval)
3495 AC_MSG_ERROR([option value must be one of: rel, abi, or auto])
3498 ],[cf_cv_shlib_version=auto])
3499 AC_MSG_RESULT($cf_cv_shlib_version)
3504 # Some less-capable ports of gcc support only -fpic
3508 if test "$GCC" = yes
3512 case $cf_cv_system_name in
3513 (*linux*) # e.g., PGI compiler
3519 if test "$cf_try_fPIC" = yes
3521 AC_MSG_CHECKING(which $CC option to use)
3522 cf_save_CFLAGS="$CFLAGS"
3523 for CC_SHARED_OPTS in -fPIC -fpic ''
3525 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
3526 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
3528 AC_MSG_RESULT($CC_SHARED_OPTS)
3529 CFLAGS="$cf_save_CFLAGS"
3532 cf_cv_shlib_version_infix=no
3534 case $cf_cv_system_name in
3535 (aix4.[3-9]*|aix[[5-7]]*)
3536 if test "$GCC" = yes; then
3537 CC_SHARED_OPTS='-Wl,-brtl'
3538 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
3540 CC_SHARED_OPTS='-brtl'
3541 # as well as '-qpic=large -G' or perhaps "-bM:SRE -bnoentry -bexpall"
3542 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
3546 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
3550 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
3551 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
3552 cf_cv_shlib_version=cygdll
3553 cf_cv_shlib_version_infix=cygdll
3556 cat >mk_shared_lib.sh <<-CF_EOF
3559 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3562 Linking shared library
3563 ** SHARED_LIB \[$]SHARED_LIB
3564 ** IMPORT_LIB \[$]IMPORT_LIB
3566 exec \[$]* ${LDFLAGS} -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3568 chmod +x mk_shared_lib.sh
3572 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
3573 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
3574 cf_cv_shlib_version=msysdll
3575 cf_cv_shlib_version_infix=msysdll
3578 cat >mk_shared_lib.sh <<-CF_EOF
3581 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3584 Linking shared library
3585 ** SHARED_LIB \[$]SHARED_LIB
3586 ** IMPORT_LIB \[$]IMPORT_LIB
3588 exec \[$]* ${LDFLAGS} -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3590 chmod +x mk_shared_lib.sh
3593 cf_try_cflags="no-cpp-precomp"
3594 CC_SHARED_OPTS="-dynamic"
3595 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
3596 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
3597 cf_cv_shlib_version_infix=yes
3598 AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [
3599 cf_save_LDFLAGS=$LDFLAGS
3600 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
3601 AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no)
3602 LDFLAGS=$cf_save_LDFLAGS])
3603 if test $cf_cv_ldflags_search_paths_first = yes; then
3604 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
3608 # HP-UX 8.07 ld lacks "+b" option used for libdir search-list
3609 if test "$GCC" != yes; then
3612 MK_SHARED_LIB='${LD} ${LDFLAGS} -b -o $[@]'
3613 INSTALL_LIB="-m 555"
3616 # (tested with gcc 2.7.2 -- I don't have c89)
3617 if test "$GCC" = yes; then
3618 LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}'
3621 LD_SHARED_OPTS='-Wl,+b,${libdir}'
3623 MK_SHARED_LIB='${LD} ${LDFLAGS} +b ${libdir} -b -o $[@]'
3624 # HP-UX shared libraries must be executable, and should be
3625 # readonly to exploit a quirk in the memory manager.
3626 INSTALL_LIB="-m 555"
3629 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3630 if test "$cf_cv_shlib_version" = rel; then
3631 cf_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
3633 cf_shared_soname='`basename $[@]`'
3636 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $[@]'
3639 if test "$cf_cv_enable_rpath" = yes ; then
3640 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3642 # tested with IRIX 5.2 and 'cc'.
3643 if test "$GCC" != yes; then
3644 CC_SHARED_OPTS='-KPIC'
3645 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -rdata_shared -soname `basename $[@]` -o $[@]'
3647 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,`basename $[@]` -o $[@]'
3649 cf_cv_rm_so_locs=yes
3651 (linux*|gnu*|k*bsd*-gnu)
3652 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
3653 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
3654 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3656 if test "$cf_cv_enable_rpath" = yes ; then
3657 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3660 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
3663 cf_cv_shlib_version=mingw
3664 cf_cv_shlib_version_infix=mingw
3667 if test "$DFT_LWR_MODEL" = "shared" ; then
3668 LOCAL_LDFLAGS="-Wl,--enable-auto-import"
3669 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3670 EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS"
3673 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
3674 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
3675 cat >mk_shared_lib.sh <<-CF_EOF
3678 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3681 Linking shared library
3682 ** SHARED_LIB \[$]SHARED_LIB
3683 ** IMPORT_LIB \[$]IMPORT_LIB
3685 exec \[$]* ${LDFLAGS} -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3687 chmod +x mk_shared_lib.sh
3689 (openbsd[[2-9]].*|mirbsd*)
3690 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
3691 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
3692 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3694 if test "$cf_cv_enable_rpath" = yes ; then
3695 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3697 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3699 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
3701 (nto-qnx*|openbsd*|freebsd[[12]].*)
3702 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3703 MK_SHARED_LIB='${LD} ${LDFLAGS} -Bshareable -o $[@]'
3704 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3706 (dragonfly*|freebsd*)
3707 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3708 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
3709 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
3710 LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
3711 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3714 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
3717 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3718 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
3719 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
3720 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3721 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3722 if test "$cf_cv_shlib_version" = auto; then
3723 if test -f /usr/libexec/ld.elf_so; then
3724 cf_cv_shlib_version=abi
3726 cf_cv_shlib_version=rel
3730 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]'
3732 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -Wl,-shared -Wl,-Bshareable -o $[@]'
3736 # tested with OSF/1 V3.2 and 'cc'
3737 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
3738 # link with shared libs).
3739 MK_SHARED_LIB='${LD} ${LDFLAGS} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`'
3742 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
3745 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
3746 if test "$DFT_LWR_MODEL" = "shared" && test -n "$LD_RPATH_OPT" ; then
3747 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
3748 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3750 cf_cv_rm_so_locs=yes
3752 (sco3.2v5*) # also uw2* and UW7: hops 13-Apr-98
3753 # tested with osr5.0.5
3754 if test "$GCC" != yes; then
3755 CC_SHARED_OPTS='-belf -KPIC'
3757 MK_SHARED_LIB='${LD} ${LDFLAGS} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@'
3758 if test "$cf_cv_enable_rpath" = yes ; then
3759 # only way is to set LD_RUN_PATH but no switch for it
3762 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3763 LINK_PROGS='LD_RUN_PATH=${libdir}'
3764 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
3767 # tested with SunOS 4.1.1 and gcc 2.7.0
3768 if test "$GCC" != yes; then
3769 CC_SHARED_OPTS='-KPIC'
3771 MK_SHARED_LIB='${LD} ${LDFLAGS} -assert pure-text -o $[@]'
3772 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3775 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
3776 # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3
3777 if test "$DFT_LWR_MODEL" = "shared" ; then
3778 LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}"
3779 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3781 if test "$cf_cv_enable_rpath" = yes ; then
3782 EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS"
3785 if test "$GCC" != yes; then
3786 cf_save_CFLAGS="$CFLAGS"
3787 for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O
3789 CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
3790 AC_TRY_COMPILE([#include <stdio.h>],[printf("Hello\n");],[break])
3792 CFLAGS="$cf_save_CFLAGS"
3793 CC_SHARED_OPTS=$cf_shared_opts
3794 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -dy -G -h '$cf_cv_shared_soname' -o $[@]'
3796 MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]'
3799 (sysv5uw7*|unix_sv*)
3800 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
3801 if test "$GCC" != yes; then
3802 CC_SHARED_OPTS='-KPIC'
3804 MK_SHARED_LIB='${LD} ${LDFLAGS} -d y -G -o [$]@'
3807 CC_SHARED_OPTS='unknown'
3808 MK_SHARED_LIB='echo unknown'
3812 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
3813 case "$cf_cv_shlib_version" in
3815 case "$MK_SHARED_LIB" in
3817 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
3820 AC_MSG_WARN(ignored --with-shlib-version)
3826 if test -n "$cf_try_cflags"
3828 cat > conftest.$ac_ext <<EOF
3829 #line __oline__ "${as_me:-configure}"
3831 int main(int argc, char *argv[[]])
3834 return (argv[[argc-1]] == 0) ;
3837 cf_save_CFLAGS="$CFLAGS"
3838 for cf_opt in $cf_try_cflags
3840 CFLAGS="$cf_save_CFLAGS -$cf_opt"
3841 AC_MSG_CHECKING(if CFLAGS option -$cf_opt works)
3842 if AC_TRY_EVAL(ac_compile); then
3844 cf_save_CFLAGS="$CFLAGS"
3849 CFLAGS="$cf_save_CFLAGS"
3853 # RPATH_LIST is a colon-separated list of directories
3854 test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
3855 test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
3857 test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations"
3859 CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS)
3860 CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB)
3862 AC_SUBST(CC_SHARED_OPTS)
3863 AC_SUBST(LD_RPATH_OPT)
3864 AC_SUBST(LD_SHARED_OPTS)
3865 AC_SUBST(MK_SHARED_LIB)
3866 AC_SUBST(RM_SHARED_OPTS)
3868 AC_SUBST(LINK_PROGS)
3869 AC_SUBST(LINK_TESTS)
3871 AC_SUBST(EXTRA_LDFLAGS)
3872 AC_SUBST(LOCAL_LDFLAGS)
3873 AC_SUBST(LOCAL_LDFLAGS2)
3875 AC_SUBST(INSTALL_LIB)
3876 AC_SUBST(RPATH_LIST)
3878 dnl ---------------------------------------------------------------------------
3879 dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
3880 dnl ----------------
3881 dnl utility macro for CF_SHARED_OPTS, constructs "$cf_cv_shared_soname" for
3882 dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar)
3885 dnl $1 is the default that should be used for "$cf_cv_shlib_version".
3886 dnl If missing, use "rel".
3887 define([CF_SHARED_SONAME],
3889 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1)
3890 if test "$cf_cv_shlib_version" = rel; then
3891 cf_cv_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
3893 cf_cv_shared_soname='`basename $[@]`'
3896 dnl ---------------------------------------------------------------------------
3897 dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
3899 dnl Remove "-g" option from the compiler options
3900 AC_DEFUN([CF_STRIP_G_OPT],
3901 [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
3902 dnl ---------------------------------------------------------------------------
3903 dnl CF_SUBDIR_PATH version: 7 updated: 2014/12/04 04:33:06
3905 dnl Construct a search-list for a nonstandard header/lib-file
3906 dnl $1 = the variable to return as result
3907 dnl $2 = the package name
3908 dnl $3 = the subdirectory, e.g., bin, include or lib
3909 AC_DEFUN([CF_SUBDIR_PATH],
3913 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
3915 for cf_subdir_prefix in \
3923 CF_ADD_SUBDIR_PATH($1,$2,$3,$cf_subdir_prefix,$prefix)
3926 dnl ---------------------------------------------------------------------------
3927 dnl CF_TERM_HEADER version: 4 updated: 2015/04/15 19:08:48
3929 dnl Look for term.h, which is part of X/Open curses. It defines the interface
3930 dnl to terminfo database. Usually it is in the same include-path as curses.h,
3931 dnl but some packagers change this, breaking various applications.
3932 AC_DEFUN([CF_TERM_HEADER],[
3933 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
3934 case ${cf_cv_ncurses_header} in
3935 (*/ncurses.h|*/ncursesw.h)
3936 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
3939 cf_term_header=term.h
3943 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
3945 AC_TRY_COMPILE([#include <stdio.h>
3946 #include <${cf_cv_ncurses_header:-curses.h}>
3948 ],[int x = auto_left_margin],[
3949 cf_cv_term_header="$cf_test"],[
3950 cf_cv_term_header=unknown
3952 test "$cf_cv_term_header" != unknown && break
3956 # Set definitions to allow ifdef'ing to accommodate subdirectories
3958 case $cf_cv_term_header in
3960 AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
3964 case $cf_cv_term_header in
3966 AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
3969 AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
3973 dnl ---------------------------------------------------------------------------
3974 dnl CF_TOP_BUILDDIR version: 2 updated: 2013/07/27 17:38:32
3976 dnl Define a top_builddir symbol, for applications that need an absolute path.
3977 AC_DEFUN([CF_TOP_BUILDDIR],
3979 top_builddir=ifelse($1,,`pwd`,$1)
3980 AC_SUBST(top_builddir)
3982 dnl ---------------------------------------------------------------------------
3983 dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13
3984 dnl -------------------
3985 dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
3986 dnl can define it successfully.
3987 AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
3988 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
3992 #include <sys/types.h>
3994 #ifndef _XOPEN_SOURCE
3997 [cf_cv_xopen_source=no],
3998 [cf_save="$CPPFLAGS"
3999 CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE)
4003 #include <sys/types.h>
4005 #ifdef _XOPEN_SOURCE
4008 [cf_cv_xopen_source=no],
4009 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
4014 if test "$cf_cv_xopen_source" != no ; then
4015 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
4016 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
4017 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
4018 CF_ADD_CFLAGS($cf_temp_xopen_source)
4021 dnl ---------------------------------------------------------------------------
4022 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
4024 dnl Make an uppercase version of a variable
4025 dnl $1=uppercase($2)
4026 AC_DEFUN([CF_UPPER],
4028 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
4030 dnl ---------------------------------------------------------------------------
4031 dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
4033 dnl Check for multibyte support, and if not found, utf8 compatibility library
4034 AC_DEFUN([CF_UTF8_LIB],
4036 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
4037 cf_save_LIBS="$LIBS"
4039 #include <stdlib.h>],[putwc(0,0);],
4040 [cf_cv_utf8_lib=yes],
4042 #include <libutf8.h>],[putwc(0,0);],utf8,
4043 [cf_cv_utf8_lib=add-on],
4044 [cf_cv_utf8_lib=no])
4047 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
4049 if test "$cf_cv_utf8_lib" = "add-on" ; then
4050 AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
4051 CF_ADD_INCDIR($cf_cv_header_path_utf8)
4052 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
4053 CF_ADD_LIBS($cf_cv_library_file_utf8)
4056 dnl ---------------------------------------------------------------------------
4057 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
4059 dnl Use AC_VERBOSE w/o the warnings
4060 AC_DEFUN([CF_VERBOSE],
4061 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
4064 dnl ---------------------------------------------------------------------------
4065 dnl CF_WEAK_SYMBOLS version: 1 updated: 2008/08/16 19:18:06
4067 dnl Check for compiler-support for weak symbols.
4068 dnl This works with "recent" gcc.
4069 AC_DEFUN([CF_WEAK_SYMBOLS],[
4070 AC_CACHE_CHECK(if $CC supports weak symbols,cf_cv_weak_symbols,[
4073 #include <stdio.h>],
4075 #if defined(__GNUC__)
4076 # if defined __USE_ISOC99
4077 # define _cat_pragma(exp) _Pragma(#exp)
4078 # define _weak_pragma(exp) _cat_pragma(weak name)
4080 # define _weak_pragma(exp)
4082 # define _declare(name) __extension__ extern __typeof__(name) name
4083 # define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak))
4087 ],[cf_cv_weak_symbols=yes],[cf_cv_weak_symbols=no])
4090 dnl ---------------------------------------------------------------------------
4091 dnl CF_WITH_ADA_COMPILER version: 2 updated: 2010/06/26 17:35:58
4092 dnl --------------------
4093 dnl Command-line option to specify the Ada95 compiler.
4094 AC_DEFUN([CF_WITH_ADA_COMPILER],[
4095 AC_MSG_CHECKING(for ada-compiler)
4096 AC_ARG_WITH(ada-compiler,
4097 [ --with-ada-compiler=CMD specify Ada95 compiler command (default gnatmake)],
4098 [cf_ada_compiler=$withval],
4099 [cf_ada_compiler=gnatmake])
4100 AC_SUBST(cf_ada_compiler)
4101 AC_MSG_RESULT($cf_ada_compiler)
4103 dnl ---------------------------------------------------------------------------
4104 dnl CF_WITH_ADA_INCLUDE version: 2 updated: 2010/06/26 17:35:58
4105 dnl -------------------
4106 dnl Command-line option to specify where Ada includes will install.
4107 AC_DEFUN([CF_WITH_ADA_INCLUDE],[
4108 AC_MSG_CHECKING(for ada-include)
4109 CF_WITH_PATH(ada-include,
4110 [ --with-ada-include=DIR Ada includes are in DIR],
4112 PREFIX/share/ada/adainclude,
4113 [$]prefix/share/ada/adainclude)
4114 AC_SUBST(ADA_INCLUDE)
4115 AC_MSG_RESULT($ADA_INCLUDE)
4117 dnl ---------------------------------------------------------------------------
4118 dnl CF_WITH_ADA_LIBNAME version: 1 updated: 2019/09/07 18:59:41
4119 dnl -------------------
4120 dnl CF_WITH_ADA_LIBNAME
4121 dnl -------------------
4122 dnl Command-line option to specify how to name the resulting Ada library.
4123 dnl $1 = default value
4124 AC_DEFUN([CF_WITH_ADA_LIBNAME],[
4125 AC_MSG_CHECKING(for ada-libname)
4126 AC_ARG_WITH(ada-libname,
4127 [ --with-ada-libname=XXX override default Ada library-name],
4128 ADA_LIBNAME=[$]withval,
4130 case "x$ADA_LIBNAME" in
4135 AC_SUBST(ADA_LIBNAME)
4136 AC_MSG_RESULT($ADA_LIBNAME)
4138 dnl ---------------------------------------------------------------------------
4139 dnl CF_WITH_ADA_OBJECTS version: 2 updated: 2010/06/26 17:35:58
4140 dnl -------------------
4141 dnl Command-line option to specify where Ada objects will install.
4142 AC_DEFUN([CF_WITH_ADA_OBJECTS],[
4143 AC_MSG_CHECKING(for ada-objects)
4144 CF_WITH_PATH(ada-objects,
4145 [ --with-ada-objects=DIR Ada objects are in DIR],
4147 PREFIX/lib/ada/adalib,
4148 [$]prefix/lib/ada/adalib)
4149 AC_SUBST(ADA_OBJECTS)
4150 AC_MSG_RESULT($ADA_OBJECTS)
4152 dnl ---------------------------------------------------------------------------
4153 dnl CF_WITH_ADA_SHAREDLIB version: 5 updated: 2018/07/21 19:10:35
4154 dnl ---------------------
4155 dnl Command-line option to specify if an Ada95 shared-library should be built,
4156 dnl and optionally what its soname should be.
4157 AC_DEFUN([CF_WITH_ADA_SHAREDLIB],[
4158 AC_REQUIRE([CF_GNAT_PROJECTS])
4159 AC_MSG_CHECKING(if an Ada95 shared-library should be built)
4160 AC_ARG_WITH(ada-sharedlib,
4161 [ --with-ada-sharedlib=soname build shared-library (requires GNAT projects)],
4162 [with_ada_sharedlib=$withval],
4163 [with_ada_sharedlib=no])
4164 AC_MSG_RESULT($with_ada_sharedlib)
4166 if test "x$with_ada_sharedlib" != xno
4168 if test "x$cf_gnat_projects" != xyes
4170 AC_MSG_WARN(disabling shared-library since GNAT projects are not supported)
4171 with_ada_sharedlib=no
4175 ADA_SHAREDLIB='lib$(LIB_NAME).so.1'
4176 MAKE_ADA_SHAREDLIB="#"
4178 if test "x$with_ada_sharedlib" != xno
4181 if test "x$with_ada_sharedlib" != xyes
4183 ADA_SHAREDLIB="$with_ada_sharedlib"
4187 AC_SUBST(ADA_SHAREDLIB)
4188 AC_SUBST(MAKE_ADA_SHAREDLIB)
4190 dnl ---------------------------------------------------------------------------
4191 dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38
4192 dnl ------------------
4193 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
4195 AC_DEFUN([CF_WITH_CURSES_DIR],[
4197 AC_MSG_CHECKING(for specific curses-directory)
4198 AC_ARG_WITH(curses-dir,
4199 [ --with-curses-dir=DIR directory in which (n)curses is installed],
4200 [cf_cv_curses_dir=$withval],
4201 [cf_cv_curses_dir=no])
4202 AC_MSG_RESULT($cf_cv_curses_dir)
4204 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
4206 CF_PATH_SYNTAX(withval)
4207 if test -d "$cf_cv_curses_dir"
4209 CF_ADD_INCDIR($cf_cv_curses_dir/include)
4210 CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
4214 dnl ---------------------------------------------------------------------------
4215 dnl CF_WITH_LIB_PREFIX version: 1 updated: 2012/01/21 19:28:10
4216 dnl ------------------
4217 dnl Allow the library-prefix to be overridden. OS/2 EMX originally had no
4218 dnl "lib" prefix, e.g., because it used the dll naming convention.
4220 dnl $1 = variable to set
4221 AC_DEFUN([CF_WITH_LIB_PREFIX],
4223 AC_MSG_CHECKING(if you want to have a library-prefix)
4224 AC_ARG_WITH(lib-prefix,
4225 [ --with-lib-prefix override library-prefix],
4226 [with_lib_prefix=$withval],
4227 [with_lib_prefix=auto])
4228 AC_MSG_RESULT($with_lib_prefix)
4230 if test $with_lib_prefix = auto
4233 elif test $with_lib_prefix = no
4237 LIB_PREFIX=$with_lib_prefix
4240 dnl ---------------------------------------------------------------------------
4241 dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19
4243 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
4244 dnl defaulting to yes/no.
4246 dnl $1 = option name
4248 dnl $3 = environment variable to set
4249 dnl $4 = default value, shown in the help-message, must be a constant
4250 dnl $5 = default value, if it's an expression & cannot be in the help-message
4252 AC_DEFUN([CF_WITH_PATH],
4253 [AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),,
4254 ifelse([$4],,[withval="${$3}"],[withval="${$3:-ifelse([$5],,[$4],[$5])}"]))dnl
4255 if ifelse([$5],,true,[test -n "$5"]) ; then
4256 CF_PATH_SYNTAX(withval)
4261 dnl ---------------------------------------------------------------------------
4262 dnl CF_WITH_PKG_CONFIG_LIBDIR version: 10 updated: 2015/08/22 17:10:56
4263 dnl -------------------------
4264 dnl Allow the choice of the pkg-config library directory to be overridden.
4265 AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[
4269 AC_MSG_CHECKING(for pkg-config library directory)
4272 AC_MSG_CHECKING(for $PKG_CONFIG library directory)
4276 PKG_CONFIG_LIBDIR=no
4277 AC_ARG_WITH(pkg-config-libdir,
4278 [ --with-pkg-config-libdir=XXX use given directory for installing pc-files],
4279 [PKG_CONFIG_LIBDIR=$withval],
4280 [test "x$PKG_CONFIG" != xnone && PKG_CONFIG_LIBDIR=yes])
4282 case x$PKG_CONFIG_LIBDIR in
4286 # Look for the library directory using the same prefix as the executable
4287 if test "x$PKG_CONFIG" = xnone
4291 cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`
4294 # If you don't like using the default architecture, you have to specify the
4295 # intended library directory and corresponding compiler/linker options.
4297 # This case allows for Debian's 2014-flavor of multiarch, along with the
4298 # most common variations before that point. Some other variants spell the
4299 # directory differently, e.g., "pkg-config", and put it in unusual places.
4300 # pkg-config has always been poorly standardized, which is ironic...
4301 case x`(arch) 2>/dev/null` in
4304 $cf_path/lib/*64-linux-gnu \
4312 $cf_path/lib/*-linux-gnu \
4321 for cf_config in $cf_search_path
4323 CF_VERBOSE(checking $cf_config/pkgconfig)
4324 if test -d $cf_config/pkgconfig
4326 PKG_CONFIG_LIBDIR=$cf_config/pkgconfig
4327 AC_MSG_CHECKING(done)
4336 if test "x$PKG_CONFIG_LIBDIR" != xno ; then
4337 AC_MSG_RESULT($PKG_CONFIG_LIBDIR)
4340 AC_SUBST(PKG_CONFIG_LIBDIR)
4342 dnl ---------------------------------------------------------------------------
4343 dnl CF_WITH_PTHREAD version: 7 updated: 2015/04/18 08:56:57
4345 dnl Check for POSIX thread library.
4346 AC_DEFUN([CF_WITH_PTHREAD],
4348 AC_MSG_CHECKING(if you want to link with the pthread library)
4349 AC_ARG_WITH(pthread,
4350 [ --with-pthread use POSIX thread library],
4351 [with_pthread=$withval],
4353 AC_MSG_RESULT($with_pthread)
4355 if test "$with_pthread" != no ; then
4356 AC_CHECK_HEADER(pthread.h,[
4357 AC_DEFINE(HAVE_PTHREADS_H,1,[Define to 1 if we have pthreads.h header])
4359 for cf_lib_pthread in pthread c_r
4361 AC_MSG_CHECKING(if we can link with the $cf_lib_pthread library)
4362 cf_save_LIBS="$LIBS"
4363 CF_ADD_LIB($cf_lib_pthread)
4365 #include <pthread.h>
4367 int rc = pthread_create(0,0,0,0);
4368 int r2 = pthread_mutexattr_settype(0, 0);
4369 ],[with_pthread=yes],[with_pthread=no])
4370 LIBS="$cf_save_LIBS"
4371 AC_MSG_RESULT($with_pthread)
4372 test "$with_pthread" = yes && break
4375 if test "$with_pthread" = yes ; then
4376 CF_ADD_LIB($cf_lib_pthread)
4377 AC_DEFINE(HAVE_LIBPTHREADS,1,[Define to 1 if we have pthreads library])
4379 AC_MSG_ERROR(Cannot link with pthread library)
4384 dnl ---------------------------------------------------------------------------
4385 dnl CF_WITH_SYSTYPE version: 1 updated: 2013/01/26 16:26:12
4387 dnl For testing, override the derived host system-type which is used to decide
4388 dnl things such as the linker commands used to build shared libraries. This is
4389 dnl normally chosen automatically based on the type of system which you are
4390 dnl building on. We use it for testing the configure script.
4392 dnl This is different from the --host option: it is used only for testing parts
4393 dnl of the configure script which would not be reachable with --host since that
4394 dnl relies on the build environment being real, rather than mocked up.
4395 AC_DEFUN([CF_WITH_SYSTYPE],[
4396 CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
4397 AC_ARG_WITH(system-type,
4398 [ --with-system-type=XXX test: override derived host system-type],
4399 [AC_MSG_WARN(overriding system type to $withval)
4400 cf_cv_system_name=$withval
4404 dnl ---------------------------------------------------------------------------
4405 dnl CF_XOPEN_SOURCE version: 55 updated: 2018/12/31 20:46:17
4407 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
4408 dnl or adapt to the vendor's definitions to get equivalent functionality,
4409 dnl without losing the common non-POSIX features.
4412 dnl $1 is the nominal value for _XOPEN_SOURCE
4413 dnl $2 is the nominal value for _POSIX_C_SOURCE
4414 AC_DEFUN([CF_XOPEN_SOURCE],[
4415 AC_REQUIRE([AC_CANONICAL_HOST])
4416 AC_REQUIRE([CF_POSIX_VISIBLE])
4418 if test "$cf_cv_posix_visible" = no; then
4420 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
4421 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
4426 cf_xopen_source="-D_ALL_SOURCE"
4432 cf_xopen_source="-D_APPLE_C_SOURCE"
4435 cf_xopen_source="-D_DARWIN_C_SOURCE"
4438 (freebsd*|dragonfly*|midnightbsd*)
4439 # 5.x headers associate
4440 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
4441 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
4442 cf_POSIX_C_SOURCE=200112L
4444 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4447 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
4450 cf_xopen_source="-D_HPUX_SOURCE"
4453 cf_xopen_source="-D_SGI_SOURCE"
4456 (linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
4457 CF_GNU_SOURCE($cf_XOPEN_SOURCE)
4460 cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this...
4463 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
4465 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
4468 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
4471 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
4472 cf_xopen_source="-D_BSD_SOURCE"
4476 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
4479 cf_xopen_source="-D_OSF_SOURCE"
4482 cf_xopen_source="-D_QNX_SOURCE"
4485 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
4488 cf_xopen_source="-D__EXTENSIONS__"
4489 cf_cv_xopen_source=broken
4491 (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2)
4497 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
4501 if test -n "$cf_xopen_source" ; then
4502 CF_ADD_CFLAGS($cf_xopen_source,true)
4505 dnl In anything but the default case, we may have system-specific setting
4506 dnl which is still not guaranteed to provide all of the entrypoints that
4507 dnl _XOPEN_SOURCE would yield.
4508 if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
4509 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
4510 AC_TRY_COMPILE([#include <stdlib.h>],[
4511 #ifndef _XOPEN_SOURCE
4514 [cf_XOPEN_SOURCE_set=yes],
4515 [cf_XOPEN_SOURCE_set=no])
4516 AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
4517 if test $cf_XOPEN_SOURCE_set = yes
4519 AC_TRY_COMPILE([#include <stdlib.h>],[
4520 #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
4523 [cf_XOPEN_SOURCE_set_ok=yes],
4524 [cf_XOPEN_SOURCE_set_ok=no])
4525 if test $cf_XOPEN_SOURCE_set_ok = no
4527 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
4533 fi # cf_cv_posix_visible