+dnl CF_FUNC_GETTIME version: 3 updated: 2024/05/11 13:40:02
+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],[
+cf_save_libs="$LIBS"
+AC_CHECK_FUNC(clock_gettime,
+ cf_cv_test_clock_gettime=yes,
+ AC_CHECK_LIB(rt, clock_gettime,
+ [LIBS="-lrt $LIBS"
+ cf_cv_test_clock_gettime=yes],
+ cf_cv_test_clock_gettime=no))
+
+if test "$cf_cv_test_clock_gettime" = yes ; then
+AC_CACHE_CHECK(if clock_gettime links,cf_cv_func_clock_gettime,[
+ AC_TRY_LINK([
+$ac_includes_default
+#include <time.h>
+ ],
+ [struct timespec ts;
+ int rc = clock_gettime(CLOCK_REALTIME, &ts)
+ + clock_gettime(CLOCK_MONOTONIC, &ts);
+ (void) rc; (void)ts],
+ [cf_cv_func_clock_gettime=yes],
+ [cf_cv_func_clock_gettime=no])
+])
+else
+ cf_cv_func_clock_gettime=no
+fi
+
+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_FUNC_GETTTYNAM version: 2 updated: 2023/01/05 18:06:28
+dnl -----------------
+dnl Check if the 4.3BSD function getttyname exists, as well as if <ttyent.h>
+dnl defines the _PATH_TTYS symbol. If the corresponding file exists, but the
+dnl other checks fail, just define HAVE_PATH_TTYS.
+AC_DEFUN([CF_FUNC_GETTTYNAM],[
+AC_CACHE_CHECK(if _PATH_TTYS is defined in ttyent.h,cf_cv_PATH_TTYS,[
+AC_TRY_COMPILE([
+#include <stdio.h>
+#include <ttyent.h>],[
+FILE *fp = fopen(_PATH_TTYS, "r"); (void)fp],
+ [cf_cv_PATH_TTYS=yes],
+ [cf_cv_PATH_TTYS=no])])
+
+if test $cf_cv_PATH_TTYS = no
+then
+ for cf_ttys in /etc/ttytype /etc/ttys
+ do
+ if test -f $cf_ttys
+ then
+ cf_cv_PATH_TTYS=maybe
+ AC_DEFINE(_PATH_TTYS,$cf_ttys,[define to pathname of file containing mapping from tty name to terminal type])
+ break
+ fi
+ done
+fi
+
+if test $cf_cv_PATH_TTYS != no
+then
+ AC_CACHE_CHECK(if _PATH_TTYS file exists,cf_cv_have_PATH_TTYS,[
+ AC_TRY_RUN([
+$ac_includes_default
+
+#include <ttyent.h>
+
+int main(void) {
+ FILE *fp = fopen(_PATH_TTYS, "r");
+ ${cf_cv_main_return:-return} (fp == 0);
+}],
+ [cf_cv_have_PATH_TTYS=yes],
+ [cf_cv_have_PATH_TTYS=no],
+ [cf_cv_have_PATH_TTYS=unknown])])
+ test "$cf_cv_have_PATH_TTYS" = no && cf_cv_PATH_TTYS=no
+fi
+
+if test $cf_cv_PATH_TTYS != no
+then
+ AC_DEFINE(HAVE_PATH_TTYS,1,[define to 1 if system can map tty name to terminal type])
+ AC_CACHE_CHECK(for getttynam,cf_cv_func_getttynam,[
+ AC_TRY_LINK([#include <ttyent.h>],
+ [struct ttyent *fp = getttynam("/dev/tty"); (void)fp],
+ [cf_cv_func_getttynam=yes],
+ [cf_cv_func_getttynam=no])])
+ test "$cf_cv_func_getttynam" = yes && AC_DEFINE(HAVE_GETTTYNAM)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_FUNC_MEMMOVE version: 10 updated: 2023/01/05 18:51:28