X-Git-Url: http://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=test%2Faclocal.m4;h=fdab359ae5f1c6048c116eaf5091d27d0e751594;hb=HEAD;hp=93285193c3e2c2d3cc005945558c09d1b27f06e6;hpb=e27924b560884229fa4c9cf5a90778aa6b7e5e96;p=ncurses.git diff --git a/test/aclocal.m4 b/test/aclocal.m4 index 93285193..1968f039 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright 2018-2022,2023 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.212 2023/02/18 22:50:36 tom Exp $ +dnl $Id: aclocal.m4,v 1.222 2024/05/18 18:08:04 tom Exp $ dnl dnl Author: Thomas E. Dickey dnl @@ -449,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 @@ -490,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 @@ -697,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. @@ -732,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 @@ -1097,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, @@ -1143,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 @@ -1684,18 +1685,51 @@ 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_GETTIME version: 1 updated: 2023/02/18 17:41:25 +dnl CF_FUNC_GETTIME version: 3 updated: 2024/05/11 13:40:02 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],[ +cf_save_libs="$LIBS" +AC_CHECK_FUNC(clock_gettime, + cf_cv_test_clock_gettime=yes, + AC_CHECK_LIB(rt, clock_gettime, + [LIBS="-lrt $LIBS" + cf_cv_test_clock_gettime=yes], + cf_cv_test_clock_gettime=no)) + +if test "$cf_cv_test_clock_gettime" = yes ; then +AC_CACHE_CHECK(if clock_gettime links,cf_cv_func_clock_gettime,[ + AC_TRY_LINK([ +$ac_includes_default +#include + ], + [struct timespec ts; + int rc = clock_gettime(CLOCK_REALTIME, &ts) + + clock_gettime(CLOCK_MONOTONIC, &ts); + (void) rc; (void)ts], + [cf_cv_func_clock_gettime=yes], + [cf_cv_func_clock_gettime=no]) +]) +else + cf_cv_func_clock_gettime=no +fi + +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: 6 updated: 2021/01/01 13:31:04 +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. @@ -1712,6 +1746,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 @@ -1836,7 +1871,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. @@ -1845,7 +1880,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 @@ -2166,7 +2201,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], @@ -2174,6 +2209,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 @@ -2260,6 +2296,72 @@ fi AC_SUBST(INSTALL_OPT_S) ])dnl dnl --------------------------------------------------------------------------- +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 @@ -2989,7 +3091,7 @@ then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_VERSION version: 17 updated: 2023/01/05 18:54:02 +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 @@ -3019,7 +3121,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); @@ -3229,7 +3331,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 @@ -3238,7 +3340,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) @@ -3993,7 +4095,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 @@ -4010,7 +4112,7 @@ AC_TRY_COMPILE([ #ifdef HAVE_LIBUTF8_H #include #endif], - [$1 state], + [$1 state; (void)state], [cf_cv_$1=no], [AC_TRY_COMPILE([ #include @@ -4020,7 +4122,7 @@ AC_TRY_COMPILE([ #ifdef HAVE_LIBUTF8_H #include #endif], - [$1 value], + [$1 value; (void) value], [cf_cv_$1=yes], [cf_cv_$1=unknown])])]) @@ -4097,7 +4199,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. @@ -4109,7 +4211,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" @@ -4215,7 +4317,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: @@ -4255,7 +4357,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]) @@ -4301,7 +4403,7 @@ fi AC_SUBST(no_x11_rgb) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_CURSES version: 18 updated: 2023/01/11 04:05:23 +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. @@ -4318,15 +4420,16 @@ $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); @@ -4342,9 +4445,10 @@ make an error /* prefer to fall-through on the second checks */ #define $cf_try_xopen_extension 1 $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; @@ -4365,7 +4469,7 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 64 updated: 2023/02/18 17:41:25 +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, @@ -4374,6 +4478,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]) @@ -4413,7 +4529,7 @@ case "$host_os" in cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; -(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys) +(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*) @@ -4465,8 +4581,8 @@ case "$host_os" in 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 inteferes) + 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"])