]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/aclocal.m4
ncurses 6.2 - patch 20210710
[ncurses.git] / test / aclocal.m4
index ad31a6434faa4cad4b2287abdcc1f2a724d973d8..a78dec7e08a32c3ea8a346e0cbee7a1e221a0214 100644 (file)
@@ -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.191 2021/03/20 16:33:11 tom Exp $
+dnl $Id: aclocal.m4,v 1.197 2021/07/10 21:40:29 tom Exp $
 dnl
 dnl Author: Thomas E. Dickey
 dnl
@@ -390,24 +390,35 @@ ifelse([$3],,[    :]dnl
 ])dnl
 ])])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_C11_NORETURN version: 1 updated: 2021/03/20 12:00:25
+dnl CF_C11_NORETURN version: 3 updated: 2021/03/28 11:36:23
 dnl ---------------
 AC_DEFUN([CF_C11_NORETURN],
 [
+AC_MSG_CHECKING(if you want to use C11 _Noreturn feature)
+CF_ARG_ENABLE(stdnoreturn,
+       [  --enable-stdnoreturn    enable C11 _Noreturn feature for diagnostics],
+       [enable_stdnoreturn=yes],
+       [enable_stdnoreturn=no])
+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 <stdio.h>
 #include <stdlib.h>
 #include <stdnoreturn.h>
-static void giveup(void) { exit(0); }
+static _Noreturn void giveup(void) { exit(0); }
        ],
        [if (feof(stdin)) giveup()],
        cf_cv_c11_noreturn=yes,
        cf_cv_c11_noreturn=no)
        ])
+else
+       cf_cv_c11_noreturn=no,
+fi
 
 if test "$cf_cv_c11_noreturn" = yes; then
-       AC_DEFINE(HAVE_STDNORETURN_H, 1)
+       AC_DEFINE(HAVE_STDNORETURN_H, 1,[Define if <stdnoreturn.h> header is available and working])
        AC_DEFINE_UNQUOTED(STDC_NORETURN,_Noreturn,[Define if C11 _Noreturn keyword is supported])
        HAVE_STDNORETURN_H=1
 else
@@ -415,6 +426,7 @@ else
 fi
 
 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
@@ -663,7 +675,7 @@ if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_CONST_X_STRING version: 6 updated: 2021/01/01 13:31:04
+dnl CF_CONST_X_STRING version: 7 updated: 2021/06/07 17:39:17
 dnl -----------------
 dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most
 dnl character-strings.
@@ -693,7 +705,7 @@ AC_TRY_COMPILE(
 #include <stdlib.h>
 #include <X11/Intrinsic.h>
 ],
-[String foo = malloc(1); (void)foo],[
+[String foo = malloc(1); free((void*)foo)],[
 
 AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[
        AC_TRY_COMPILE(
@@ -1287,7 +1299,7 @@ AC_SUBST(SHOW_CC)
 AC_SUBST(ECHO_CC)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_DISABLE_LEAKS version: 8 updated: 2021/01/05 20:05:09
+dnl CF_DISABLE_LEAKS version: 9 updated: 2021/04/03 16:41:50
 dnl ----------------
 dnl Combine no-leak checks with the libraries or tools that are used for the
 dnl checks.
@@ -1300,9 +1312,9 @@ AC_REQUIRE([CF_WITH_VALGRIND])
 AC_MSG_CHECKING(if you want to perform memory-leak testing)
 AC_ARG_ENABLE(leaks,
        [  --disable-leaks         test: free permanent memory, analyze leaks],
-       [enable_leaks=no],
+       [enable_leaks=$enableval],
        [enable_leaks=yes])
-dnl TODO - drop with_no_leaks
+dnl with_no_leaks is more readable...
 if test "x$enable_leaks" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi
 AC_MSG_RESULT($with_no_leaks)
 
@@ -1912,7 +1924,7 @@ rm -rf ./conftest*
 AC_SUBST(EXTRA_CFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GETOPT_HEADER version: 7 updated: 2021/01/01 13:31:04
+dnl CF_GETOPT_HEADER version: 8 updated: 2021/06/19 19:16:16
 dnl ----------------
 dnl Check for getopt's variables which are commonly defined in stdlib.h,
 dnl unistd.h or (nonstandard) in getopt.h
@@ -1925,7 +1937,7 @@ for cf_header in stdio.h stdlib.h unistd.h getopt.h
 do
 AC_TRY_COMPILE([
 #include <$cf_header>],
-[int x = optind; char *y = optarg],
+[int x = optind; char *y = optarg; (void)x; (void)y],
 [cf_cv_getopt_header=$cf_header
  break])
 done
@@ -2329,6 +2341,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
@@ -2462,7 +2557,7 @@ printf("old\\n");
        ,[$1=no])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_CONFIG version: 26 updated: 2021/01/03 08:05:37
+dnl CF_NCURSES_CONFIG version: 27 updated: 2021/05/19 19:35:25
 dnl -----------------
 dnl Tie together the configure-script macros for ncurses, preferring these in
 dnl order:
@@ -2504,7 +2599,7 @@ if test "x${PKG_CONFIG:=none}" != xnone; then
                                [initscr(); mousemask(0,0); tigetstr((char *)0);],
                                [AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}>
                                        int main(void)
-                                       { char *xx = curses_version(); return (xx == 0); }],
+                                       { const char *xx = curses_version(); return (xx == 0); }],
                                        [cf_test_ncuconfig=yes],
                                        [cf_test_ncuconfig=no],
                                        [cf_test_ncuconfig=maybe])],
@@ -2530,7 +2625,7 @@ if test "x${PKG_CONFIG:=none}" != xnone; then
                        [initscr(); mousemask(0,0); tigetstr((char *)0);],
                        [AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}>
                                int main(void)
-                               { char *xx = curses_version(); return (xx == 0); }],
+                               { const char *xx = curses_version(); return (xx == 0); }],
                                [cf_have_ncuconfig=yes],
                                [cf_have_ncuconfig=no],
                                [cf_have_ncuconfig=maybe])],
@@ -2944,19 +3039,29 @@ AC_TRY_COMPILE([
 test "$cf_cv_netbsd_menu_h" = yes && AC_DEFINE(HAVE_NETBSD_MENU_H,1,[Define to 1 if we appear to be using NetBSD menu.h])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NO_LEAKS_OPTION version: 8 updated: 2021/01/05 20:05:09
+dnl CF_NO_LEAKS_OPTION version: 9 updated: 2021/06/13 19:45:41
 dnl ------------------
 dnl see CF_WITH_NO_LEAKS
+dnl
+dnl $1 = option/name
+dnl $2 = help-text
+dnl $3 = symbol to define if the option is set
+dnl $4 = additional actions to take if the option is set
 AC_DEFUN([CF_NO_LEAKS_OPTION],[
 AC_MSG_CHECKING(if you want to use $1 for testing)
 AC_ARG_WITH($1,
        [$2],
-       [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
+       [case "x$withval" in
+       (x|xno) ;;
+       (*)
+               : "${with_cflags:=-g}"
+               : "${enable_leaks:=no}"
+               with_$1=yes
+               AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
         $4
 ])
-       : "${with_cflags:=-g}"
-       : "${enable_leaks:=no}"
-        with_$1=yes],
+               ;;
+       esac],
        [with_$1=])
 AC_MSG_RESULT(${with_$1:-no})
 
@@ -3773,15 +3878,21 @@ AC_DEFUN([CF_UPPER],
 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
+dnl CF_UTF8_LIB version: 9 updated: 2021/05/19 19:35:25
 dnl -----------
 dnl Check for multibyte support, and if not found, utf8 compatibility library
 AC_DEFUN([CF_UTF8_LIB],
 [
+AC_HAVE_HEADERS(wchar.h)
 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
        cf_save_LIBS="$LIBS"
        AC_TRY_LINK([
-#include <stdlib.h>],[putwc(0,0);],
+#include <stdlib.h>
+#include <stdio.h>
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+],[putwc(0,0);],
        [cf_cv_utf8_lib=yes],
        [CF_FIND_LINKAGE([
 #include <libutf8.h>],[putwc(0,0);],utf8,
@@ -4114,7 +4225,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.
@@ -4134,15 +4245,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;
@@ -4156,16 +4266,12 @@ AC_TRY_LINK([
 #define $cf_try_xopen_extension 1
 #include <stdlib.h>
 #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;
@@ -4183,7 +4289,7 @@ esac
 
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 57 updated: 2021/01/01 16:53:59
+dnl CF_XOPEN_SOURCE version: 58 updated: 2021/05/01 17:49:36
 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,
@@ -4248,7 +4354,15 @@ case "$host_os" in
 (netbsd*)
        cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
        ;;
-(openbsd[[4-9]]*)
+(openbsd[[6-9]]*)
+       # OpenBSD 6.x has broken locale support, both compile-time and runtime.
+       # see https://www.mail-archive.com/bugs@openbsd.org/msg13200.html
+       # Abusing the conformance level is a workaround.
+       AC_MSG_WARN(this system does not provide usable locale support)
+       cf_xopen_source="-D_BSD_SOURCE"
+       cf_XOPEN_SOURCE=700
+       ;;
+(openbsd[[4-5]]*)
        # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
        cf_xopen_source="-D_BSD_SOURCE"
        cf_XOPEN_SOURCE=600