]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - Ada95/aclocal.m4
ncurses 6.4 - patch 20230225
[ncurses.git] / Ada95 / aclocal.m4
index 14160e4bb6de9d34b5598c0511c3c0e7806a710a..76367b001fd37f14e8d6e80b5e27617008c8b320 100644 (file)
@@ -29,7 +29,7 @@ dnl***************************************************************************
 dnl
 dnl Author: Thomas E. Dickey
 dnl
-dnl $Id: aclocal.m4,v 1.200 2023/02/18 22:48:17 tom Exp $
+dnl $Id: aclocal.m4,v 1.201 2023/02/25 13:45:56 tom Exp $
 dnl Macros used in NCURSES Ada95 auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -632,7 +632,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
@@ -673,7 +673,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
@@ -1393,15 +1393,31 @@ fi
 AC_SUBST(EXTRA_CFLAGS)
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_GETTIME version: 1 updated: 2023/02/18 17:41:25
+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
@@ -3296,7 +3312,7 @@ int main(void)
 # ifdef __NCURSES_H
        fprintf(fp, "old\\n");
 # else
-       #error __NCURSES_H is not defined
+       make an error
 # endif
 #endif
        ${cf_cv_main_return:-return}(0);