dnl***************************************************************************
-dnl Copyright 2018-2021,2022 Thomas E. Dickey *
+dnl Copyright 2018-2022,2023 Thomas E. Dickey *
dnl Copyright 2010-2017,2018 Free Software Foundation, Inc. *
dnl *
dnl Permission is hereby granted, free of charge, to any person obtaining a *
dnl
dnl Author: Thomas E. Dickey
dnl
-dnl $Id: aclocal.m4,v 1.195 2022/09/24 20:42:30 tom Exp $
+dnl $Id: aclocal.m4,v 1.202 2023/04/15 20:02:10 tom Exp $
dnl Macros used in NCURSES Ada95 auto-configuration script.
dnl
dnl These macros are maintained separately from NCURSES. The copyright on
AC_SUBST(ARFLAGS)
])
dnl ---------------------------------------------------------------------------
-dnl CF_BUILD_CC version: 10 updated: 2022/09/24 16:36:41
+dnl CF_BUILD_CC version: 11 updated: 2022/12/04 15:40:08
dnl -----------
dnl If we're cross-compiling, allow the user to override the tools and their
dnl options. The configure script is oriented toward identifying the host
cf_save_crossed=$cross_compiling
cf_save_ac_link=$ac_link
cross_compiling=no
- ac_link='$BUILD_CC -o "conftest$ac_exeext" $BUILD_CFLAGS $BUILD_CPPFLAGS $BUILD_LDFLAGS "conftest.$ac_ext" $BUILD_LIBS >&AS_MESSAGE_LOG_FD'
+ cf_build_cppflags=$BUILD_CPPFLAGS
+ test "$cf_build_cppflags" = "#" && cf_build_cppflags=
+ ac_link='$BUILD_CC -o "conftest$ac_exeext" $BUILD_CFLAGS $cf_build_cppflags $BUILD_LDFLAGS "conftest.$ac_ext" $BUILD_LIBS >&AS_MESSAGE_LOG_FD'
AC_TRY_RUN([#include <stdio.h>
int main(int argc, char *argv[])
AC_SUBST(BUILD_OBJEXT)
])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],
[
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>
+$ac_includes_default
#include <stdnoreturn.h>
static _Noreturn void giveup(void) { exit(0); }
],
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
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
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
AC_TRY_COMPILE([],[
#ifdef __clang__
#else
-make an error
+#error __clang__ is not defined
#endif
],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
],[])
])
])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.
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
])
AC_SUBST(EXTRA_CFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
+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 <time.h>],
+ [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_GCC_ATTRIBUTES version: 24 updated: 2021/03/20 12:00:25
dnl -----------------
dnl Test for availability of useful gcc __attribute__ directives to quiet
AC_CHECKING([for $CC __attribute__ directives])
cat > "conftest.$ac_ext" <<EOF
#line __oline__ "${as_me:-configure}"
+#include <stdio.h>
#include "confdefs.h"
#include "conftest.h"
#include "conftest.i"
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.
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
AC_SUBST(INSTALL_OPT_S)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_INTEL_COMPILER version: 8 updated: 2021/01/01 16:53:59
+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
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"
test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_MKSTEMP version: 11 updated: 2021/01/01 13:31:04
+dnl CF_MKSTEMP version: 12 updated: 2023/01/05 17:53:11
dnl ----------
dnl Check for a working mkstemp. This creates two files, checks that they are
dnl successfully created and distinct (AmigaOS apparently fails on the last).
AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
rm -rf ./conftest*
AC_TRY_RUN([
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
+$ac_includes_default
+
int main(void)
{
char *tmpl = "conftestXXXXXX";
])
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
#ifdef NCURSES_VERSION
]ifelse($3,ncursesw,[
#ifndef WACS_BSSB
- make an error
+ #error WACS_BSSB is not defined
#endif
])[
printf("%s\\n", NCURSES_VERSION);
#ifdef __NCURSES_H
printf("old\\n");
#else
- make an error
+ #error __NCURSES_H is not defined
#endif
#endif
]
AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_VERSION version: 16 updated: 2020/12/31 20:19:42
+dnl CF_NCURSES_VERSION version: 17 updated: 2023/01/05 18:54:02
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
cf_tempfile=out$$
rm -f "$cf_tempfile"
AC_TRY_RUN([
+$ac_includes_default
+
#include <${cf_cv_ncurses_header:-curses.h}>
-#include <stdio.h>
+
int main(void)
{
FILE *fp = fopen("$cf_tempfile", "w");
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
CF_MSG_LOG(if the symbol is already defined go no further)
AC_TRY_COMPILE([#include <sys/types.h>],[
#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
if test "$cf_want_posix_source" = yes ; then
AC_TRY_COMPILE([#include <sys/types.h>],[
#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
CF_MSG_LOG(if the second compile does not leave our definition intact error)
AC_TRY_COMPILE([#include <sys/types.h>],[
#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"
$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],
AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
cf_save_LIBS="$LIBS"
AC_TRY_LINK([
-#include <stdlib.h>
-#include <stdio.h>
+$ac_includes_default
#ifdef HAVE_WCHAR_H
#include <wchar.h>
#endif
AC_SUBST($3)dnl
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PKG_CONFIG_LIBDIR version: 20 updated: 2022/01/29 17:03:42
+dnl CF_WITH_PKG_CONFIG_LIBDIR version: 21 updated: 2023/01/22 13:37:42
dnl -------------------------
dnl Allow the choice of the pkg-config library directory to be overridden.
dnl
dnl c) builtin-list (added if $PKG_CONFIG_LIBDIR is not set)
dnl
dnl pkgconf (used with some systems such as FreeBSD in place of pkg-config)
-dnl optionally ignores $PKG_CONFIG_LIBDIR.
+dnl optionally ignores $PKG_CONFIG_LIBDIR. Very old versions of pkg-config,
+dnl e.g., Solaris 10 also do not recognize $PKG_CONFIG_LIBDIR.
AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[
case "$PKG_CONFIG" in
esac
# if $PKG_CONFIG_LIBDIR is set, try to use that
-cf_search_path=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/:/ /g' -e 's,^[[ ]]*,,'`
+if test -n "$PKG_CONFIG_PATH"; then
+ cf_search_path=`echo "$PKG_CONFIG_PATH" | sed -e 's/:/ /g' -e 's,^[[ ]]*,,' -e 's,[[ ]]*$,,'`
+elif test -n "$PKG_CONFIG_LIBDIR"; then
+ cf_search_path=`echo "$PKG_CONFIG_LIBDIR" | sed -e 's/:/ /g' -e 's,^[[ ]]*,,' -e 's,[[ ]]*$,,'`
+else
+ cf_search_path=auto
+fi
# if the option is used, let that override. otherwise default to "libdir"
AC_ARG_WITH(pkg-config-libdir,
])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 60 updated: 2022/09/10 15:16:16
+dnl CF_XOPEN_SOURCE version: 66 updated: 2023/04/03 04:19: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,
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])
(aix[[4-7]]*)
cf_xopen_source="-D_ALL_SOURCE"
;;
-(msys)
- cf_XOPEN_SOURCE=600
- ;;
(darwin[[0-8]].*)
cf_xopen_source="-D_APPLE_C_SOURCE"
;;
cf_xopen_source="-D_SGI_SOURCE"
cf_XOPEN_SOURCE=
;;
-(linux*gnu|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*)
CF_GNU_SOURCE($cf_XOPEN_SOURCE)
;;
(minix*)
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"])
+ 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
AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
AC_TRY_COMPILE([#include <stdlib.h>],[
#ifndef _XOPEN_SOURCE
-make an error
+#error _XOPEN_SOURCE is not defined
#endif],
[cf_XOPEN_SOURCE_set=yes],
[cf_XOPEN_SOURCE_set=no])
then
AC_TRY_COMPILE([#include <stdlib.h>],[
#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])
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 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
-make an error
+#error _XOPEN_SOURCE is not defined
#endif
])
dnl ---------------------------------------------------------------------------
-dnl CF__XOPEN_SOURCE_HEAD version: 1 updated: 2022/09/10 15:17:03
+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],
[
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
+$ac_includes_default
])