X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Faclocal.m4;h=02025f837309bde6275e0a0523fe29578dbe7b81;hp=6836f43893d141f58727eb61699db413063f2094;hb=HEAD;hpb=91e462de27aeecd5b1c8965a6dba078f7a438003 diff --git a/test/aclocal.m4 b/test/aclocal.m4 index 6836f438..fdab359a 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright 2018-2020,2021 Thomas E. Dickey * +dnl Copyright 2018-2023,2024 Thomas E. Dickey * dnl Copyright 2003-2017,2018 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,7 +27,7 @@ dnl sale, use or other dealings in this Software without prior written * dnl authorization. * dnl*************************************************************************** dnl -dnl $Id: aclocal.m4,v 1.202 2021/10/11 00:18:09 tom Exp $ +dnl $Id: aclocal.m4,v 1.221 2024/01/19 18:27:20 tom Exp $ dnl dnl Author: Thomas E. Dickey dnl @@ -43,7 +43,7 @@ dnl https://invisible-island.net/autoconf/my-autoconf.html dnl dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- -dnl AM_LANGINFO_CODESET version: 6 updated: 2021/01/01 16:53:59 +dnl AM_LANGINFO_CODESET version: 7 updated: 2023/01/11 04:05:23 dnl ------------------- dnl Inserted as requested by gettext 0.10.40 dnl File from /usr/share/aclocal @@ -55,7 +55,9 @@ dnl From Bruno Haible. AC_DEFUN([AM_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, - [AC_TRY_LINK([#include ], + [AC_TRY_LINK([ +$ac_includes_default +#include ], [char* cs = nl_langinfo(CODESET); (void)cs], am_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=no) @@ -409,7 +411,7 @@ ifelse([$3],,[ :]dnl ])dnl ])])dnl dnl --------------------------------------------------------------------------- -dnl CF_C11_NORETURN version: 3 updated: 2021/03/28 11:36:23 +dnl CF_C11_NORETURN version: 4 updated: 2023/02/18 17:41:25 dnl --------------- AC_DEFUN([CF_C11_NORETURN], [ @@ -423,8 +425,7 @@ AC_MSG_RESULT($enable_stdnoreturn) if test $enable_stdnoreturn = yes; then AC_CACHE_CHECK([for C11 _Noreturn feature], cf_cv_c11_noreturn, [AC_TRY_COMPILE([ -#include -#include +$ac_includes_default #include static _Noreturn void giveup(void) { exit(0); } ], @@ -448,7 +449,7 @@ AC_SUBST(HAVE_STDNORETURN_H) AC_SUBST(STDC_NORETURN) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CC_ENV_FLAGS version: 10 updated: 2020/12/31 18:40:20 +dnl CF_CC_ENV_FLAGS version: 11 updated: 2023/02/20 11:15:46 dnl --------------- dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content dnl into CC. This will not help with broken scripts that wrap the compiler @@ -489,7 +490,7 @@ case "$CC" in AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) # humor him... cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` - cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'` + cf_flags=`echo "$CC" | sed -e "s%^$cf_prog%%"` CC="$cf_prog" for cf_arg in $cf_flags do @@ -628,7 +629,7 @@ if test "$cf_have_curses_lib" = no; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CLANG_COMPILER version: 8 updated: 2021/01/01 13:31:04 +dnl CF_CLANG_COMPILER version: 9 updated: 2023/02/18 17:41:25 dnl ----------------- dnl Check if the given compiler is really clang. clang's C driver defines dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does @@ -650,7 +651,7 @@ if test "$ifelse([$1],,[$1],GCC)" = yes ; then AC_TRY_COMPILE([],[ #ifdef __clang__ #else -make an error +#error __clang__ is not defined #endif ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes ],[]) @@ -696,7 +697,7 @@ if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then fi ]) dnl --------------------------------------------------------------------------- -dnl CF_CONST_X_STRING version: 7 updated: 2021/06/07 17:39:17 +dnl CF_CONST_X_STRING version: 8 updated: 2023/12/01 17:22:50 dnl ----------------- dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most dnl character-strings. @@ -731,6 +732,7 @@ AC_TRY_COMPILE( AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ AC_TRY_COMPILE( [ +#undef _CONST_X_STRING #define _CONST_X_STRING /* X11R7.8 (perhaps) */ #undef XTSTRINGDEFINES /* X11R5 and later */ #include @@ -939,7 +941,7 @@ if (foo + 1234L > 5678L) done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_HEADER version: 5 updated: 2015/04/23 20:35:30 +dnl CF_CURSES_HEADER version: 6 updated: 2022/12/02 20:06:52 dnl ---------------- dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common dnl variations of ncurses' installs. @@ -953,7 +955,7 @@ for cf_header in \ curses.h ifelse($1,,,[$1/curses.h]) ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) do AC_TRY_COMPILE([#include <${cf_header}>], - [initscr(); tgoto("?", 0,0)], + [initscr(); endwin()], [cf_cv_ncurses_header=$cf_header; break],[]) done ]) @@ -966,7 +968,7 @@ fi AC_CHECK_HEADERS($cf_cv_ncurses_header) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_LIBS version: 44 updated: 2021/01/02 09:31:20 +dnl CF_CURSES_LIBS version: 45 updated: 2022/12/02 20:06:52 dnl -------------- dnl Look for the curses libraries. Older curses implementations may require dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. @@ -975,7 +977,7 @@ AC_DEFUN([CF_CURSES_LIBS],[ AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl AC_MSG_CHECKING(if we have identified curses libraries) AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], - [initscr(); tgoto("?", 0,0)], + [initscr(); endwin()], cf_result=yes, cf_result=no) AC_MSG_RESULT($cf_result) @@ -1076,7 +1078,7 @@ if test ".$ac_cv_func_initscr" != .yes ; then elif test "$cf_term_lib" != predefined ; then AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], - [initscr(); tgoto((char *)0, 0, 0);], + [initscr(); endwin();], [cf_result=no], [ LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" @@ -1096,7 +1098,7 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_TERM_H version: 15 updated: 2021/01/02 09:31:20 +dnl CF_CURSES_TERM_H version: 16 updated: 2024/01/07 06:34:16 dnl ---------------- dnl SVr4 curses should have term.h as well (where it puts the definitions of dnl the low-level interface). This may not be true in old/broken implementations, @@ -1142,7 +1144,7 @@ case "$cf_cv_term_header" in #ifdef NCURSES_VERSION #include <${cf_header}> #else -make an error +#error expected NCURSES_VERSION to be defined #endif], [WINDOW *x; (void)x], [cf_cv_term_header=$cf_header @@ -1618,7 +1620,7 @@ ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5]) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FIX_WARNINGS version: 3 updated: 2020/12/31 18:40:20 +dnl CF_FIX_WARNINGS version: 4 updated: 2021/12/16 18:22:31 dnl --------------- dnl Warning flags do not belong in CFLAGS, CPPFLAGS, etc. Any of gcc's dnl "-Werror" flags can interfere with configure-checks. Those go into @@ -1630,11 +1632,13 @@ if test "$GCC" = yes || test "$GXX" = yes then case [$]$1 in (*-Werror=*) - CF_VERBOSE(repairing $1: [$]$1) cf_temp_flags= for cf_temp_scan in [$]$1 do case "x$cf_temp_scan" in + (x-Werror=format*) + CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) + ;; (x-Werror=*) CF_APPEND_TEXT(EXTRA_CFLAGS,$cf_temp_scan) ;; @@ -1643,16 +1647,20 @@ then ;; esac done - $1="$cf_temp_flags" - CF_VERBOSE(... fixed [$]$1) - CF_VERBOSE(... extra $EXTRA_CFLAGS) + if test "x[$]$1" != "x$cf_temp_flags" + then + CF_VERBOSE(repairing $1: [$]$1) + $1="$cf_temp_flags" + CF_VERBOSE(... fixed [$]$1) + CF_VERBOSE(... extra $EXTRA_CFLAGS) + fi ;; esac fi AC_SUBST(EXTRA_CFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FUNC_CURSES_VERSION version: 8 updated: 2021/01/02 09:31:20 +dnl CF_FUNC_CURSES_VERSION version: 9 updated: 2023/01/05 18:06:10 dnl ---------------------- dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS. dnl It's a character string "SVR4", not documented. @@ -1660,11 +1668,14 @@ AC_DEFUN([CF_FUNC_CURSES_VERSION], [ AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[ AC_TRY_RUN([ +$ac_includes_default + #include <${cf_cv_ncurses_header:-curses.h}> + int main(void) { char temp[1024]; - sprintf(temp, "%s\\n", curses_version()); + sprintf(temp, "%.999s\\n", curses_version()); ${cf_cv_main_return:-return}(0); }] ,[cf_cv_func_curses_version=yes] @@ -1674,7 +1685,34 @@ rm -f core]) test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION,1,[Define to 1 if we have curses_version function]) ]) dnl --------------------------------------------------------------------------- -dnl CF_FUNC_OPENPTY version: 6 updated: 2021/01/01 13:31:04 +dnl CF_FUNC_GETTIME version: 2 updated: 2023/02/25 08:45:56 +dnl --------------- +dnl Check for gettimeofday or clock_gettime. In 2023, the former is still more +dnl widely supported, but "deprecated" (2008), so we will use the latter if it +dnl is available, to reduce compiler warnings. +AC_DEFUN([CF_FUNC_GETTIME],[ +AC_CACHE_CHECK(for clock_gettime,cf_cv_func_clock_gettime,[ + AC_TRY_LINK([#include ], + [struct timespec ts; + int rc = clock_gettime(CLOCK_REALTIME, &ts); (void) rc; (void)ts], + [cf_cv_func_clock_gettime=yes], + [cf_cv_func_clock_gettime=no]) +]) + +if test "$cf_cv_func_clock_gettime" = yes +then + AC_DEFINE(HAVE_CLOCK_GETTIME,1,[Define to 1 if we have clock_gettime function]) +else +AC_CHECK_FUNC(gettimeofday, + AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function]),[ + +AC_CHECK_LIB(bsd, gettimeofday, + AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function]) + CF_ADD_LIB(bsd))])dnl CLIX: bzero, select, gettimeofday +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_FUNC_OPENPTY version: 7 updated: 2023/12/03 09:21:34 dnl --------------- dnl Check for openpty() function, along with header. It may need the dnl "util" library as well. @@ -1691,6 +1729,7 @@ AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[ ],[ int x = openpty((int *)0, (int *)0, (char *)0, (struct termios *)0, (struct winsize *)0); + (void)x; ],[ cf_cv_func_openpty=$cf_header break @@ -1732,6 +1771,7 @@ then AC_CHECKING([for $CC __attribute__ directives]) cat > "conftest.$ac_ext" < #include "confdefs.h" #include "conftest.h" #include "conftest.i" @@ -1814,7 +1854,7 @@ rm -rf ./conftest* fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36 +dnl CF_GCC_VERSION version: 9 updated: 2023/03/05 14:30:13 dnl -------------- dnl Find version of gcc, and (because icc/clang pretend to be gcc without being dnl compatible), attempt to determine if icc/clang is actually used. @@ -1823,7 +1863,7 @@ AC_REQUIRE([AC_PROG_CC]) GCC_VERSION=none if test "$GCC" = yes ; then AC_MSG_CHECKING(version of $CC) - 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.]].*//'`" + GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^[[^(]]*([[^)]][[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown AC_MSG_RESULT($GCC_VERSION) fi @@ -2144,7 +2184,7 @@ AC_DEFUN([CF_INHERIT_SCRIPT], test -f $1 || ( test -f ../$1 && cp ../$1 ./ ) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INSTALL_OPTS version: 2 updated: 2018/08/18 12:19:21 +dnl CF_INSTALL_OPTS version: 3 updated: 2023/06/03 15:17:30 dnl --------------- dnl prompt for/fill-in useful install-program options AC_DEFUN([CF_INSTALL_OPTS], @@ -2152,6 +2192,7 @@ AC_DEFUN([CF_INSTALL_OPTS], CF_INSTALL_OPT_S CF_INSTALL_OPT_P CF_INSTALL_OPT_O +CF_INSTALL_OPT_STRIP_PROG ])dnl dnl --------------------------------------------------------------------------- dnl CF_INSTALL_OPT_O version: 3 updated: 2020/12/31 20:19:42 @@ -2238,7 +2279,73 @@ fi AC_SUBST(INSTALL_OPT_S) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INTEL_COMPILER version: 8 updated: 2021/01/01 16:53:59 +dnl CF_INSTALL_OPT_STRIP_PROG version: 1 updated: 2023/06/03 15:17:30 +dnl ------------------------- +dnl Provide an option for overriding the strip program used in install "-s" +dnl +dnl coreutils install provides a --strip-program option +dnl FreeBSD uses STRIPBIN environment variable, while NetBSD and OpenBSD use +dnl STRIP environment variable. Other versions of install do not support this. +AC_DEFUN([CF_INSTALL_OPT_STRIP_PROG], +[ +AC_REQUIRE([CF_INSTALL_OPT_S]) +if test -n "$INSTALL_OPT_S" +then + AC_MSG_CHECKING(if you want to specify strip-program) + AC_ARG_WITH(strip-program, + [ --with-strip-program=XX specify program to use when stripping in install], + [with_strip_program=$withval], + [with_strip_program=no]) + AC_MSG_RESULT($with_strip_program) + if test "$with_strip_program" != no + then + AC_MSG_CHECKING(if strip-program is supported with this installer) + cf_install_program=`echo "$INSTALL" | sed -e 's%[[ ]]*[[ ]]-.%%'` + check_install_strip=no + if test -f "$cf_install_program" + then + check_install_version=`"$cf_install_program" --version 2>/dev/null | head -n 1 | grep coreutils` + if test -n "$check_install_version" + then + check_install_strip="option" + else + for check_strip_variable in STRIPBIN STRIP + do + if strings "$cf_install_program" | grep "^$check_strip_variable[$]" >/dev/null + then + check_install_strip="environ" + break + fi + done + fi + fi + AC_MSG_RESULT($check_install_strip) + case "$check_install_strip" in + (no) + AC_MSG_WARN($cf_install_program does not support strip program option) + with_strip_program=no + ;; + (environ) + cat >install.tmp <<-CF_EOF + #! $SHELL + STRIPBIN="$with_strip_program" \\ + STRIP="$with_strip_program" \\ + $INSTALL "[$]@" + CF_EOF + INSTALL="`pwd`/install.tmp" + chmod +x "$INSTALL" + CF_VERBOSE(created $INSTALL) + ;; + (option) + INSTALL_OPT_S="$INSTALL_OPT_S --strip-program=\"$with_strip_program\"" + ;; + esac + fi +fi +AC_SUBST(INSTALL_OPT_S) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INTEL_COMPILER version: 9 updated: 2023/02/18 17:41:25 dnl ----------------- dnl Check if the given compiler is really the Intel compiler for Linux. It dnl tries to imitate gcc, but does not return an error when it finds a mismatch @@ -2264,7 +2371,7 @@ if test "$ifelse([$1],,[$1],GCC)" = yes ; then AC_TRY_COMPILE([],[ #ifdef __INTEL_COMPILER #else -make an error +#error __INTEL_COMPILER is not defined #endif ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" @@ -2482,7 +2589,7 @@ AC_SUBST(MAKE_UPPER_TAGS) AC_SUBST(MAKE_LOWER_TAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MATH_LIB version: 10 updated: 2020/12/31 18:40:20 +dnl CF_MATH_LIB version: 11 updated: 2022/07/27 19:01:48 dnl ----------- dnl Checks for libraries. At least one UNIX system, Apple Macintosh dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler @@ -2492,18 +2599,42 @@ AC_DEFUN([CF_MATH_LIB], AC_CACHE_CHECK(if -lm needed for math functions, cf_cv_need_libm,[ AC_TRY_LINK([ - #include - #include - #include + #include + #include + #include ], [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)], [cf_cv_need_libm=no], [cf_cv_need_libm=yes])]) + if test "$cf_cv_need_libm" = yes then -ifelse($1,,[ - CF_ADD_LIB(m) -],[$1=-lm]) + + cf_save_LIBS="$LIBS" + LIBS="$LIBS -lm" + AC_CACHE_CHECK(if -lm is available for math functions, + cf_cv_have_libm,[ + AC_TRY_LINK([ + #include + #include + #include + ], + [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)], + [cf_cv_have_libm=yes], + [cf_cv_have_libm=no])]) + LIBS="$cf_save_LIBS" + + if test "$cf_cv_have_libm" = yes + then + ifelse($1,,[CF_ADD_LIB(m)],[$1=-lm]) + fi +else + cf_cv_have_libm=yes +fi + +if test "$cf_cv_have_libm" = yes +then + AC_DEFINE(HAVE_MATH_FUNCS,1,[Define to 1 if math functions are available]) fi ]) dnl --------------------------------------------------------------------------- @@ -2545,7 +2676,7 @@ AC_DEFUN([CF_MSG_LOG],[ echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CC_CHECK version: 5 updated: 2020/12/31 20:19:42 +dnl CF_NCURSES_CC_CHECK version: 6 updated: 2023/02/18 17:47:58 dnl ------------------- dnl Check if we can compile with ncurses' header file dnl $1 is the cache variable to set @@ -2562,7 +2693,7 @@ AC_DEFUN([CF_NCURSES_CC_CHECK],[ #ifdef NCURSES_VERSION ]ifelse($3,ncursesw,[ #ifndef WACS_BSSB - make an error + #error WACS_BSSB is not defined #endif ])[ printf("%s\\n", NCURSES_VERSION); @@ -2570,7 +2701,7 @@ printf("%s\\n", NCURSES_VERSION); #ifdef __NCURSES_H printf("old\\n"); #else - make an error + #error __NCURSES_H is not defined #endif #endif ] @@ -2943,7 +3074,7 @@ then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_VERSION version: 16 updated: 2020/12/31 20:19:42 +dnl CF_NCURSES_VERSION version: 18 updated: 2024/01/07 06:34:16 dnl ------------------ dnl Check for the version of ncurses, to aid in reporting bugs, etc. dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use @@ -2956,8 +3087,10 @@ AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[ cf_tempfile=out$$ rm -f "$cf_tempfile" AC_TRY_RUN([ +$ac_includes_default + #include <${cf_cv_ncurses_header:-curses.h}> -#include + int main(void) { FILE *fp = fopen("$cf_tempfile", "w"); @@ -2971,7 +3104,7 @@ int main(void) # ifdef __NCURSES_H fprintf(fp, "old\\n"); # else - make an error + #error expected ncurses header to define __NCURSES_H # endif #endif ${cf_cv_main_return:-return}(0); @@ -3181,7 +3314,7 @@ else fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PKG_CONFIG version: 12 updated: 2021/10/10 20:18:09 +dnl CF_PKG_CONFIG version: 13 updated: 2023/10/28 11:59:01 dnl ------------- dnl Check for the package-config program, unless disabled by command-line. dnl @@ -3190,7 +3323,7 @@ AC_DEFUN([CF_PKG_CONFIG], [ AC_MSG_CHECKING(if you want to use pkg-config) AC_ARG_WITH(pkg-config, - [ --with-pkg-config{=path} enable/disable use of pkg-config], + [[ --with-pkg-config[=CMD] enable/disable use of pkg-config and its name CMD]], [cf_pkg_config=$withval], [cf_pkg_config=yes]) AC_MSG_RESULT($cf_pkg_config) @@ -3219,7 +3352,7 @@ fi AC_SUBST(PKG_CONFIG) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17 +dnl CF_POSIX_C_SOURCE version: 12 updated: 2023/02/18 17:41:25 dnl ----------------- dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. dnl @@ -3250,7 +3383,7 @@ AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ CF_MSG_LOG(if the symbol is already defined go no further) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE -make an error +#error _POSIX_C_SOURCE is not defined #endif], [cf_cv_posix_c_source=no], [cf_want_posix_source=no @@ -3269,7 +3402,7 @@ make an error if test "$cf_want_posix_source" = yes ; then AC_TRY_COMPILE([#include ],[ #ifdef _POSIX_SOURCE -make an error +#error _POSIX_SOURCE is defined #endif],[], cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") fi @@ -3280,7 +3413,7 @@ make an error CF_MSG_LOG(if the second compile does not leave our definition intact error) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE -make an error +#error _POSIX_C_SOURCE is not defined #endif],, [cf_cv_posix_c_source=no]) CFLAGS="$cf_save_CFLAGS" @@ -3384,7 +3517,7 @@ case $INSTALL in esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_LINT version: 4 updated: 2019/11/20 18:55:37 +dnl CF_PROG_LINT version: 5 updated: 2022/08/20 15:44:13 dnl ------------ AC_DEFUN([CF_PROG_LINT], [ @@ -3395,6 +3528,7 @@ case "x$LINT" in ;; esac AC_SUBST(LINT_OPTS) +AC_SUBST(LINT_LIBS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_REMOVE_CFLAGS version: 3 updated: 2021/09/05 17:25:40 @@ -3586,7 +3720,7 @@ do done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SIGWINCH version: 6 updated: 2021/01/01 13:31:04 +dnl CF_SIGWINCH version: 7 updated: 2023/02/18 17:41:25 dnl ----------- dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all dnl programs need this test). @@ -3629,7 +3763,7 @@ do #include ],[ #if SIGWINCH != $cf_sigwinch -make an error +#error SIGWINCH is not $cf_sigwinch #endif int x = SIGWINCH; (void)x], [cf_cv_fixup_sigwinch=$cf_sigwinch @@ -3871,34 +4005,20 @@ else fi ]) dnl --------------------------------------------------------------------------- -dnl CF_TRY_XOPEN_SOURCE version: 3 updated: 2021/08/28 15:20:37 +dnl CF_TRY_XOPEN_SOURCE version: 4 updated: 2022/09/10 15:16:16 dnl ------------------- dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we dnl can define it successfully. AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ - AC_TRY_COMPILE([ -#include -#include -#include -],[ -#ifndef _XOPEN_SOURCE -make an error -#endif], + AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, [cf_cv_xopen_source=no], [cf_save="$CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) - AC_TRY_COMPILE([ -#include -#include -#include -],[ -#ifdef _XOPEN_SOURCE -make an error -#endif], - [cf_cv_xopen_source=no], - [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) - CPPFLAGS="$cf_save" + AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, + [cf_cv_xopen_source=no], + [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) + CPPFLAGS="$cf_save" ]) ]) @@ -3919,7 +4039,7 @@ AC_DEFUN([CF_UPPER], $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` ])dnl dnl --------------------------------------------------------------------------- -dnl CF_UTF8_LIB version: 9 updated: 2021/05/19 19:35:25 +dnl CF_UTF8_LIB version: 10 updated: 2023/01/11 04:05:23 dnl ----------- dnl Check for multibyte support, and if not found, utf8 compatibility library AC_DEFUN([CF_UTF8_LIB], @@ -3928,8 +4048,7 @@ AC_HAVE_HEADERS(wchar.h) AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[ cf_save_LIBS="$LIBS" AC_TRY_LINK([ -#include -#include +$ac_includes_default #ifdef HAVE_WCHAR_H #include #endif @@ -3959,7 +4078,7 @@ AC_DEFUN([CF_VERBOSE], CF_MSG_LOG([$1]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WCHAR_TYPE version: 4 updated: 2012/10/06 16:39:58 +dnl CF_WCHAR_TYPE version: 5 updated: 2023/12/03 09:21:34 dnl ------------- dnl Check if type wide-character type $1 is declared, and if so, which header dnl file is needed. The second parameter is used to set a shell variable when @@ -3976,7 +4095,7 @@ AC_TRY_COMPILE([ #ifdef HAVE_LIBUTF8_H #include #endif], - [$1 state], + [$1 state; (void)state], [cf_cv_$1=no], [AC_TRY_COMPILE([ #include @@ -3986,7 +4105,7 @@ AC_TRY_COMPILE([ #ifdef HAVE_LIBUTF8_H #include #endif], - [$1 value], + [$1 value; (void) value], [cf_cv_$1=yes], [cf_cv_$1=unknown])])]) @@ -4063,7 +4182,7 @@ if test "$with_dmalloc" = yes ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_LIB_BASENAME version: 1 updated: 2020/03/07 20:05:14 +dnl CF_WITH_LIB_BASENAME version: 2 updated: 2023/11/22 20:48:30 dnl -------------------- dnl Allow for overriding the basename of a library, i.e., the part to which dnl prefixes/suffixes are attached. @@ -4075,7 +4194,7 @@ AC_DEFUN([CF_WITH_LIB_BASENAME], [ AC_MSG_CHECKING(for desired basename for $2 library) AC_ARG_WITH($2-libname, - [ --with-$2-libname=XXX override ifelse($3,,$2,$3) basename of library], + [[ --with-$2-libname[=XXX] override ifelse($3,,$2,$3) basename of library]], [with_lib_basename=$withval], [with_lib_basename=ifelse($3,,$2,$3)]) $1="$with_lib_basename" @@ -4092,7 +4211,7 @@ AC_MSG_RESULT([$]$1) AC_SUBST($1) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_NCURSES_ETC version: 5 updated: 2016/02/20 19:23:20 +dnl CF_WITH_NCURSES_ETC version: 6 updated: 2023/01/16 10:10:06 dnl ------------------- dnl Use this macro for programs which use any variant of "curses", e.g., dnl "ncurses", and "PDCurses". Programs that can use curses and some unrelated @@ -4152,6 +4271,7 @@ case $cf_cv_screen in esac CF_NCURSES_PTHREADS($cf_cv_screen) +AC_SUBST(cf_cv_screen) ])dnl dnl --------------------------------------------------------------------------- @@ -4180,7 +4300,7 @@ CF_NO_LEAKS_OPTION(valgrind, [USE_VALGRIND]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_X11_RGB version: 2 updated: 2019/12/31 08:53:54 +dnl CF_WITH_X11_RGB version: 3 updated: 2023/10/28 11:59:01 dnl --------------- dnl Handle configure option "--with-x11-rgb", setting these shell dnl variables: @@ -4220,7 +4340,7 @@ dnl /usr/X11/lib/X11/rgb.txt AC_DEFUN([CF_WITH_X11_RGB],[ AC_MSG_CHECKING(for X11 rgb file) AC_ARG_WITH(x11-rgb, - [ --with-x11-rgb=FILE file containing X11 rgb information (EPREFIX/lib/X11/rgb.txt)], + [ --with-x11-rgb=FILE obtain X11 color definitions from FILE (default: EPREFIX/lib/X11/rgb.txt)], [RGB_PATH=$withval], [RGB_PATH=auto]) @@ -4266,7 +4386,7 @@ fi AC_SUBST(no_x11_rgb) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_CURSES version: 17 updated: 2021/07/10 12:22:27 +dnl CF_XOPEN_CURSES version: 20 updated: 2024/01/07 06:54:12 dnl --------------- dnl Test if we should define X/Open source for curses, needed on Digital Unix dnl 4.x, to see the extended functions, but breaks on IRIX 6.x. @@ -4279,19 +4399,20 @@ AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl AC_CACHE_CHECK(definition to turn on extended curses functions,cf_cv_need_xopen_extension,[ cf_cv_need_xopen_extension=unknown AC_TRY_LINK([ -#include +$ac_includes_default #include <${cf_cv_ncurses_header:-curses.h}>],[ #if defined(NCURSES_VERSION_PATCH) #if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) - make an error + #error disallow ncurses versions between 2020/04/03 and 2010/05/01 #endif #endif #ifdef NCURSES_WIDECHAR -make an error /* prefer to fall-through on the second checks */ +#error prefer to fall-through on the second checks #endif + static char dummy[10]; cchar_t check; int check2 = curs_set((int)sizeof(check)); - long x = winnstr(stdscr, "", 0); + long x = winnstr(stdscr, dummy, 5); int x1, y1; (void)check2; getbegyx(stdscr, y1, x1); @@ -4305,11 +4426,12 @@ make an error /* prefer to fall-through on the second checks */ do AC_TRY_LINK([ #define $cf_try_xopen_extension 1 -#include +$ac_includes_default #include <${cf_cv_ncurses_header:-curses.h}>],[ + static char dummy[10]; cchar_t check; int check2 = curs_set((int)sizeof(check)); - long x = winnstr(stdscr, "", 0); + long x = winnstr(stdscr, dummy, 5); int x1, y1; getbegyx(stdscr, y1, x1); (void)check2; @@ -4330,7 +4452,7 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 59 updated: 2021/08/28 15:20:37 +dnl CF_XOPEN_SOURCE version: 67 updated: 2023/09/06 18:55:27 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, @@ -4339,6 +4461,18 @@ dnl dnl Parameters: dnl $1 is the nominal value for _XOPEN_SOURCE dnl $2 is the nominal value for _POSIX_C_SOURCE +dnl +dnl The default case prefers _XOPEN_SOURCE over _POSIX_C_SOURCE if the +dnl implementation predefines it, because X/Open and most implementations agree +dnl that the latter is a legacy or "aligned" value. +dnl +dnl Because _XOPEN_SOURCE is preferred, if defining _POSIX_C_SOURCE turns +dnl that off, then refrain from setting _POSIX_C_SOURCE explicitly. +dnl +dnl References: +dnl https://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html +dnl https://docs.oracle.com/cd/E19253-01/816-5175/standards-5/index.html +dnl https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html AC_DEFUN([CF_XOPEN_SOURCE],[ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([CF_POSIX_VISIBLE]) @@ -4353,9 +4487,6 @@ case "$host_os" in (aix[[4-7]]*) cf_xopen_source="-D_ALL_SOURCE" ;; -(msys) - cf_XOPEN_SOURCE=600 - ;; (darwin[[0-8]].*) cf_xopen_source="-D_APPLE_C_SOURCE" ;; @@ -4381,7 +4512,7 @@ case "$host_os" in cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; -(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) +(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc) CF_GNU_SOURCE($cf_XOPEN_SOURCE) ;; (minix*) @@ -4430,7 +4561,15 @@ case "$host_os" in ;; (*) CF_TRY_XOPEN_SOURCE + cf_save_xopen_cppflags="$CPPFLAGS" CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) + # Some of these niche implementations use copy/paste, double-check... + if test "$cf_cv_xopen_source" = no ; then + CF_VERBOSE(checking if _POSIX_C_SOURCE interferes with _XOPEN_SOURCE) + AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY,,[ + AC_MSG_WARN(_POSIX_C_SOURCE definition is not usable) + CPPFLAGS="$cf_save_xopen_cppflags"]) + fi ;; esac @@ -4445,7 +4584,7 @@ if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) AC_TRY_COMPILE([#include ],[ #ifndef _XOPEN_SOURCE -make an error +#error _XOPEN_SOURCE is not defined #endif], [cf_XOPEN_SOURCE_set=yes], [cf_XOPEN_SOURCE_set=no]) @@ -4454,7 +4593,7 @@ make an error then AC_TRY_COMPILE([#include ],[ #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE -make an error +#error (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE #endif], [cf_XOPEN_SOURCE_set_ok=yes], [cf_XOPEN_SOURCE_set_ok=no]) @@ -4469,7 +4608,7 @@ fi fi # cf_cv_posix_visible ]) dnl --------------------------------------------------------------------------- -dnl CF_X_ATHENA version: 24 updated: 2020/03/10 18:53:47 +dnl CF_X_ATHENA version: 25 updated: 2023/01/11 04:05:23 dnl ----------- dnl Check for Xaw (Athena) libraries dnl @@ -4543,6 +4682,7 @@ if test "$PKG_CONFIG" != none ; then AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[ AC_TRY_LINK([ +$ac_includes_default #include ],[ int check = XmuCompareISOLatin1("big", "small"); @@ -4629,7 +4769,7 @@ elif test "$cf_x_athena_inc" != default ; then fi ]) dnl --------------------------------------------------------------------------- -dnl CF_X_ATHENA_LIBS version: 13 updated: 2020/01/11 18:16:10 +dnl CF_X_ATHENA_LIBS version: 14 updated: 2023/01/11 04:05:23 dnl ---------------- dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. @@ -4662,6 +4802,7 @@ do CF_ADD_LIBS($cf_libs) AC_MSG_CHECKING(for $cf_test in $cf_libs) AC_TRY_LINK([ +$ac_includes_default #include #include ],[ @@ -4698,7 +4839,7 @@ CF_TRY_PKG_CONFIG(Xext,,[ [CF_ADD_LIB(Xext)])]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_X_TOOLKIT version: 26 updated: 2021/01/02 09:31:20 +dnl CF_X_TOOLKIT version: 27 updated: 2023/01/11 04:05:23 dnl ------------ dnl Check for X Toolkit libraries AC_DEFUN([CF_X_TOOLKIT], @@ -4733,6 +4874,7 @@ CF_TRY_PKG_CONFIG(xt,[ # we have an "xt" package, but it may omit Xt's dependency on X11 AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[ AC_TRY_LINK([ +$ac_includes_default #include ],[ int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); @@ -4751,6 +4893,7 @@ AC_TRY_LINK([ AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[ AC_TRY_LINK([ +$ac_includes_default #include ],[int num = IceConnectionNumber(0); (void) num ],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])]) @@ -4836,3 +4979,21 @@ char * XCursesProgramName = "test"; #endif #endif ]) +dnl --------------------------------------------------------------------------- +dnl CF__XOPEN_SOURCE_BODY version: 2 updated: 2023/02/18 17:41:25 +dnl --------------------- +dnl body of test when test-compiling for _XOPEN_SOURCE check +define([CF__XOPEN_SOURCE_BODY], +[ +#ifndef _XOPEN_SOURCE +#error _XOPEN_SOURCE is not defined +#endif +]) +dnl --------------------------------------------------------------------------- +dnl CF__XOPEN_SOURCE_HEAD version: 2 updated: 2023/02/18 17:41:25 +dnl --------------------- +dnl headers to include when test-compiling for _XOPEN_SOURCE check +define([CF__XOPEN_SOURCE_HEAD], +[ +$ac_includes_default +])