X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Faclocal.m4;h=22c288fd11ca65f848b7cd426268be48ea47b997;hp=b48e6ba2a2e4a097082fdeb44b95904bfa5ef87c;hb=60cbc89987842cf6036aabced6618988b5117810;hpb=9f479192e3ca3413d235c66bf058f8cc63764898 diff --git a/test/aclocal.m4 b/test/aclocal.m4 index b48e6ba2..22c288fd 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -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.195 2021/06/19 23:43:02 tom Exp $ +dnl $Id: aclocal.m4,v 1.201 2021/09/05 21:29:34 tom Exp $ dnl dnl Author: Thomas E. Dickey dnl @@ -181,9 +181,9 @@ AC_SUBST(EXTRA_CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_INCDIR version: 16 updated: 2020/12/31 20:19:42 +dnl CF_ADD_INCDIR version: 17 updated: 2021/09/04 06:35:04 dnl ------------- -dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's +dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it is dnl redundant. We don't normally need to add -I/usr/local/include for gcc, dnl but old versions (and some misinstalled ones) need that. To make things dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to @@ -345,6 +345,25 @@ ifelse([$5],NONE,,[{ test -z "$5" || test "x$5" = xNONE || test "x$4" != "x$5"; } ])dnl dnl --------------------------------------------------------------------------- +dnl CF_APPEND_CFLAGS version: 3 updated: 2021/09/05 17:25:40 +dnl ---------------- +dnl Use CF_ADD_CFLAGS after first checking for potential redefinitions. +dnl $1 = flags to add +dnl $2 = if given makes this macro verbose. +define([CF_APPEND_CFLAGS], +[ +for cf_add_cflags in $1 +do + case "x$cf_add_cflags" in + (x-[[DU]]*) + CF_REMOVE_CFLAGS($cf_add_cflags,CFLAGS,[$2]) + CF_REMOVE_CFLAGS($cf_add_cflags,CPPFLAGS,[$2]) + ;; + esac + CF_ADD_CFLAGS([$cf_add_cflags],[$2]) +done +])dnl +dnl --------------------------------------------------------------------------- dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 dnl -------------- dnl use this macro for appending text without introducing an extra blank at @@ -550,7 +569,7 @@ AC_TRY_LINK([#include ],[printf("Hello world");],, fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_CURSES_LIB version: 3 updated: 2021/01/04 19:45:09 +dnl CF_CHECK_CURSES_LIB version: 4 updated: 2021/09/05 17:25:40 dnl ------------------- dnl $1 = nominal library name, used also for header lookup dnl $2 = suffix to append to library name @@ -572,10 +591,11 @@ elif test "x${PKG_CONFIG:=none}" != xnone; then AC_MSG_CHECKING(if the $1$2 package files work) + cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" cf_save_LIBS="$LIBS" - CF_ADD_CFLAGS(`$PKG_CONFIG --cflags "$1$2"`) + CF_APPEND_CFLAGS(`$PKG_CONFIG --cflags "$1$2"`) CF_ADD_LIBS(`$PKG_CONFIG --libs "$1$2"`) AC_TRY_LINK([#include <$1.h>], @@ -589,13 +609,14 @@ elif test "x${PKG_CONFIG:=none}" != xnone; then [cf_have_curses_lib=no]) AC_MSG_RESULT($cf_have_curses_lib) test "$cf_have_curses_lib" = maybe && cf_have_curses_lib=yes - if test "$cf_have_curses_lib" != "yes" + if test "$cf_have_curses_lib" = "yes" then - CPPFLAGS="$cf_save_CPPFLAGS" - LIBS="$cf_save_LIBS" - else CF_UPPER(cf_upper,have_lib$1) AC_DEFINE_UNQUOTED($cf_upper,1) + else + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" fi fi fi @@ -1262,9 +1283,9 @@ dnl ---------- dnl "dirname" is not portable, so we fake it with a shell script. AC_DEFUN([CF_DIRNAME],[$1=`echo "$2" | sed -e 's%/[[^/]]*$%%'`])dnl dnl --------------------------------------------------------------------------- -dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57 +dnl CF_DISABLE_ECHO version: 14 updated: 2021/09/04 06:35:04 dnl --------------- -dnl You can always use "make -n" to see the actual options, but it's hard to +dnl You can always use "make -n" to see the actual options, but it is hard to dnl pick out/analyze warning messages when the compile-line is long. dnl dnl Sets: @@ -2341,6 +2362,89 @@ CF_SUBDIR_PATH($1,$2,lib) $1="$cf_library_path_list [$]$1" ])dnl dnl --------------------------------------------------------------------------- +dnl CF_MAKE_PHONY version: 3 updated: 2021/01/08 16:08:21 +dnl ------------- +dnl Check if the make-program handles a ".PHONY" target, e.g,. a target which +dnl acts as a placeholder. +dnl +dnl The ".PHONY" feature was proposed in 2011 here +dnl https://www.austingroupbugs.net/view.php?id=523 +dnl and is scheduled for release in P1003.1 Issue 8 (late 2022). +dnl +dnl This is not supported by SVr4 make (or SunOS 4, 4.3SD, etc), but works with +dnl a few others (i.e., GNU make and the non-POSIX "BSD" make): +dnl +dnl + This is a GNU make feature (since April 1988, but in turn from binutils, +dnl date unspecified). +dnl +dnl + It was adopted in NetBSD make in June 1995. +dnl +dnl + The other BSD make programs are derived from the NetBSD make (and for +dnl that reason are not actually different "implementations"). +dnl +dnl + Some features of NetBSD make were actually adapted from pmake, which +dnl began as a modified GNU make starting in 1993. +dnl +dnl + Version 3.8 of the dmake program in January 1992 also implemented this +dnl GNU make extension, but is less well known than the BSD make. +AC_DEFUN([CF_MAKE_PHONY],[ +AC_CACHE_CHECK(for \".PHONY\" make-support, cf_cv_make_PHONY,[ + rm -rf conftest* + ( + mkdir conftest || exit 1 + cd conftest + cat >makefile <<'CF_EOF' +.PHONY: always +DATA=0 +always: always.out + @echo "** making [$]@ [$](DATA)" +once: once.out + @echo "** making [$]@ [$](DATA)" +always.out: + @echo "** making [$]@ [$](DATA)" + echo [$](DATA) > [$]@ +once.out: + @echo "** making [$]@ [$](DATA)" + echo [$](DATA) > [$]@ +CF_EOF + for cf_data in 1 2 3 + do + ${MAKE:-make} always DATA=$cf_data + ${MAKE:-make} once DATA=$cf_data + ${MAKE:-make} -t always once + if test -f always ; then + echo "no (case 1)" > ../conftest.tmp + elif test ! -f always.out ; then + echo "no (case 2)" > ../conftest.tmp + elif test ! -f once.out ; then + echo "no (case 3)" > ../conftest.tmp + elif ! cmp -s always.out once.out ; then + echo "no (case 4)" > ../conftest.tmp + diff always.out once.out + else + cf_check="`cat always.out`" + if test "x$cf_check" != "x$cf_data" ; then + echo "no (case 5)" > ../conftest.tmp + else + echo yes > ../conftest.tmp + rm -f ./*.out + continue + fi + fi + break + done + ) >&AC_FD_CC 2>&1 + cf_cv_make_PHONY="`cat conftest.tmp`" + rm -rf conftest* +]) +MAKE_NO_PHONY="#" +MAKE_PHONY="#" +test "x$cf_cv_make_PHONY" = xyes && MAKE_PHONY= +test "x$cf_cv_make_PHONY" != xyes && MAKE_NO_PHONY= +AC_SUBST(MAKE_NO_PHONY) +AC_SUBST(MAKE_PHONY) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 dnl ------------ dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have @@ -2474,7 +2578,7 @@ printf("old\\n"); ,[$1=no]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CONFIG version: 27 updated: 2021/05/19 19:35:25 +dnl CF_NCURSES_CONFIG version: 28 updated: 2021/08/28 15:20:37 dnl ----------------- dnl Tie together the configure-script macros for ncurses, preferring these in dnl order: @@ -2535,7 +2639,7 @@ if test "x${PKG_CONFIG:=none}" != xnone; then ;; esac - CF_ADD_CFLAGS($cf_pkg_cflags) + CF_APPEND_CFLAGS($cf_pkg_cflags) CF_ADD_LIBS($cf_pkg_libs) AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], @@ -2577,7 +2681,7 @@ if test "x$cf_have_ncuconfig" = "xno"; then if test "$NCURSES_CONFIG" != none ; then - CF_ADD_CFLAGS(`$NCURSES_CONFIG --cflags`) + CF_APPEND_CFLAGS(`$NCURSES_CONFIG --cflags`) CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) # even with config script, some packages use no-override for curses.h @@ -2756,7 +2860,7 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_LIBS version: 20 updated: 2021/01/03 08:05:37 +dnl CF_NCURSES_LIBS version: 21 updated: 2021/09/04 06:37:12 dnl --------------- dnl Look for the ncurses library. This is a little complicated on Linux, dnl because it may be linked with the gpm (general purpose mouse) library. @@ -2785,7 +2889,7 @@ AC_CHECK_LIB(gpm,Gpm_Open, case "$host_os" in (freebsd*) # This is only necessary if you are linking against an obsolete - # version of ncurses (but it should do no harm, since it's static). + # version of ncurses (but it should do no harm, since it is static). if test "$cf_nculib_root" = ncurses ; then AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) fi @@ -3291,6 +3395,24 @@ esac AC_SUBST(LINT_OPTS) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_REMOVE_CFLAGS version: 3 updated: 2021/09/05 17:25:40 +dnl ---------------- +dnl Remove a given option from CFLAGS/CPPFLAGS +dnl $1 = option to remove +dnl $2 = variable to update +dnl $3 = nonempty to allow verbose message +define([CF_REMOVE_CFLAGS], +[ +cf_tmp_cflag=`echo "x$1" | sed -e 's/^.//' -e 's/=.*//'` +while true +do + cf_old_cflag=`echo "x[$]$2" | sed -e 's/^.//' -e 's/[[ ]][[ ]]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[[^ ]][[^ ]]*\\)\?%%" -e 's/^[[ ]]*//' -e 's%[[ ]][[ ]]*-D% -D%g' -e 's%[[ ]][[ ]]*-I% -I%g'` + test "[$]$2" != "$cf_old_cflag" || break + ifelse([$3],,,[CF_VERBOSE(removing old option $1 from $2)]) + $2="$cf_old_cflag" +done +])dnl +dnl --------------------------------------------------------------------------- dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 dnl ---------------- dnl Remove all -U and -D options that refer to the given symbol from a list @@ -3747,7 +3869,7 @@ else fi ]) dnl --------------------------------------------------------------------------- -dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13 +dnl CF_TRY_XOPEN_SOURCE version: 3 updated: 2021/08/28 15:20:37 dnl ------------------- dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we dnl can define it successfully. @@ -3782,7 +3904,7 @@ if test "$cf_cv_xopen_source" != no ; then CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" - CF_ADD_CFLAGS($cf_temp_xopen_source) + CF_APPEND_CFLAGS($cf_temp_xopen_source) fi ]) dnl --------------------------------------------------------------------------- @@ -4142,7 +4264,7 @@ fi AC_SUBST(no_x11_rgb) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_CURSES version: 16 updated: 2021/01/02 09:31:20 +dnl CF_XOPEN_CURSES version: 17 updated: 2021/07/10 12:22:27 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. @@ -4162,15 +4284,14 @@ AC_TRY_LINK([ make an error #endif #endif -#ifdef NCURSES_VERSION +#ifdef NCURSES_WIDECHAR +make an error /* prefer to fall-through on the second checks */ +#endif cchar_t check; int check2 = curs_set((int)sizeof(check)); -#endif long x = winnstr(stdscr, "", 0); int x1, y1; -#ifdef NCURSES_VERSION (void)check2; -#endif getbegyx(stdscr, y1, x1); (void)x; (void)y1; @@ -4184,16 +4305,12 @@ AC_TRY_LINK([ #define $cf_try_xopen_extension 1 #include #include <${cf_cv_ncurses_header:-curses.h}>],[ -#ifdef NCURSES_VERSION cchar_t check; int check2 = curs_set((int)sizeof(check)); -#endif long x = winnstr(stdscr, "", 0); int x1, y1; getbegyx(stdscr, y1, x1); -#ifdef NCURSES_VERSION (void)check2; -#endif (void)x; (void)y1; (void)x1; @@ -4211,7 +4328,7 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 58 updated: 2021/05/01 17:49:36 +dnl CF_XOPEN_SOURCE version: 59 updated: 2021/08/28 15:20:37 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, @@ -4316,7 +4433,7 @@ case "$host_os" in esac if test -n "$cf_xopen_source" ; then - CF_ADD_CFLAGS($cf_xopen_source,true) + CF_APPEND_CFLAGS($cf_xopen_source,true) fi dnl In anything but the default case, we may have system-specific setting