]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - aclocal.m4
ncurses 6.3 - patch 20220910
[ncurses.git] / aclocal.m4
index 72205319a0265fd488258eb40ea23f8809736dae..15631bb425b4a27497a6218fcaedcf8756902767 100644 (file)
@@ -29,7 +29,7 @@ dnl***************************************************************************
 dnl
 dnl Author: Thomas E. Dickey 1995-on
 dnl
-dnl $Id: aclocal.m4,v 1.1003 2022/01/29 22:05:06 tom Exp $
+dnl $Id: aclocal.m4,v 1.1011 2022/09/10 19:23:45 tom Exp $
 dnl Macros used in NCURSES auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -1731,6 +1731,42 @@ esac
 ])
 ])dnl
 dnl ---------------------------------------------------------------------------
+dnl CF_CPP_OVERRIDE version: 1 updated: 2022/08/20 16:07:10
+dnl ---------------
+dnl Check if the C++ compiler accepts the override keyword.  This is a C++-11
+dnl feature.
+AC_DEFUN([CF_CPP_OVERRIDE],
+[
+if test -n "$CXX"; then
+AC_CACHE_CHECK(if $CXX accepts override keyword,cf_cv_cpp_override,[
+       AC_LANG_SAVE
+       AC_LANG_CPLUSPLUS
+       AC_TRY_RUN([
+
+class base
+{
+public:
+       virtual int foo(float x) = 0; 
+};
+
+
+class derived: public base
+{
+public:
+       int foo(float x) override { return x != 0.0 ? 1 : 0; }
+};
+
+int main(void) { }
+],
+       [cf_cv_cpp_override=yes],
+       [cf_cv_cpp_override=no],
+       [cf_cv_cpp_override=unknown])
+       AC_LANG_RESTORE
+])
+fi
+test "$cf_cv_cpp_override" = yes && AC_DEFINE(CPP_HAS_OVERRIDE,1,[Define to 1 if C++ has override keyword])
+])dnl
+dnl ---------------------------------------------------------------------------
 dnl CF_CPP_PARAM_INIT version: 7 updated: 2017/01/21 11:06:25
 dnl -----------------
 dnl Check if the C++ compiler accepts duplicate parameter initialization.  This
@@ -4273,7 +4309,7 @@ then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_LD_SEARCHPATH version: 3 updated: 2021/03/05 19:13:35
+dnl CF_LD_SEARCHPATH version: 4 updated: 2022/08/27 15:43:08
 dnl ----------------
 dnl Try to obtain the linker's search-path, for use in scripts.
 dnl
@@ -4284,7 +4320,7 @@ AC_CACHE_CHECK(for linker search path,cf_cv_ld_searchpath,[
 if test "$cross_compiling" != yes ; then
 
 # GNU binutils' ld does not involve permissions which may stop ldconfig.
-cf_pathlist=`ld --verbose 2>/dev/null | grep SEARCH_DIR | sed -e 's,SEARCH_DIR[[("=]][[("=]]*,,g' -e 's/"[[)]];//gp' | sort -u`
+cf_pathlist=`${LD:-ld} --verbose 2>/dev/null | grep SEARCH_DIR | sed -e 's,SEARCH_DIR[[("=]][[("=]]*,,g' -e 's/"[[)]];//gp' | sort -u`
 
 # The -NX options tell newer versions of Linux ldconfig to not attempt to
 # update the cache, which makes it run faster.
@@ -5740,7 +5776,7 @@ AC_ARG_WITH(manpage-tbl,
 AC_MSG_RESULT($MANPAGE_TBL)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_MAN_PAGES version: 51 updated: 2021/01/05 16:29:19
+dnl CF_MAN_PAGES version: 52 updated: 2022/02/05 12:31:08
 dnl ------------
 dnl Try to determine if the man-pages on the system are compressed, and if
 dnl so, what format is used.  Use this information to construct a script that
@@ -5813,7 +5849,8 @@ INSTALL_DATA="$INSTALL_DATA"
 transform="$program_transform_name"
 
 TMP=\${TMPDIR:=/tmp}/man\$\$
-trap "rm -f \$TMP" 0 1 2 3 15
+trap "rm -f \$TMP; exit 1" 1 2 3 15
+trap "rm -f \$TMP" 0
 
 form=\[$]1
 shift || exit 1
@@ -6093,7 +6130,7 @@ CF_UPPER(cf_map_lib_basename,$2)
 eval $1="\$${cf_map_lib_basename}_NAME"
 ])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
@@ -6103,18 +6140,42 @@ AC_DEFUN([CF_MATH_LIB],
 AC_CACHE_CHECK(if -lm needed for math functions,
        cf_cv_need_libm,[
        AC_TRY_LINK([
-       #include <stdio.h>
-       #include <stdlib.h>
-       #include <math.h>
+               #include <stdio.h>
+               #include <stdlib.h>
+               #include <math.h>
        ],
        [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 <stdio.h>
+               #include <stdlib.h>
+               #include <math.h>
+       ],
+       [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 ---------------------------------------------------------------------------
@@ -6844,7 +6905,7 @@ fi
 AC_SUBST(LDCONFIG)
 ])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],
 [
@@ -6855,6 +6916,7 @@ case "x$LINT" in
        ;;
 esac
 AC_SUBST(LINT_OPTS)
+AC_SUBST(LINT_LIBS)
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37
@@ -8308,34 +8370,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 <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-],[
-#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 <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-],[
-#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"
        ])
 ])
 
@@ -9802,7 +9850,7 @@ fi
 AC_SUBST(no_x11_rgb)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 59 updated: 2021/08/28 15:20:37
+dnl CF_XOPEN_SOURCE version: 60 updated: 2022/09/10 15:16:16
 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,
@@ -9853,7 +9901,7 @@ case "$host_os" in
        cf_xopen_source="-D_SGI_SOURCE"
        cf_XOPEN_SOURCE=
        ;;
-(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
+(linux*gnu|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
        CF_GNU_SOURCE($cf_XOPEN_SOURCE)
        ;;
 (minix*)
@@ -9902,7 +9950,13 @@ 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...
+       CF_VERBOSE(checking if _POSIX_C_SOURCE inteferes)
+       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"])
        ;;
 esac
 
@@ -9946,3 +10000,23 @@ dnl ------------------
 dnl Trim something using sed, then trim extra whitespace
 dnl $1 = extra parameters, e.g., in CF_STRIP_G_OPT
 define([CF__SED_TRIMBLANKS],[sed ifelse($1,,,[$1] )-e 's%[[    ]]% %g' -e 's% [[ ]]*% %g' -e 's%^ %%' -e 's% [$]%%'])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF__XOPEN_SOURCE_BODY version: 1 updated: 2022/09/10 15:17:35
+dnl ---------------------
+dnl body of test when test-compiling for _XOPEN_SOURCE check
+define([CF__XOPEN_SOURCE_BODY],
+[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif
+])
+dnl ---------------------------------------------------------------------------
+dnl CF__XOPEN_SOURCE_HEAD version: 1 updated: 2022/09/10 15:17:03
+dnl ---------------------
+dnl headers to include when test-compiling for _XOPEN_SOURCE check
+define([CF__XOPEN_SOURCE_HEAD],
+[
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+])