]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Implement NTP_FUNC_REALPATH
authorHarlan Stenn <stenn@ntp.org>
Wed, 14 Oct 2020 05:52:43 +0000 (05:52 +0000)
committerHarlan Stenn <stenn@ntp.org>
Wed, 14 Oct 2020 05:52:43 +0000 (05:52 +0000)
bk: 5f86922bzyQmBj2XWvmDxZUqNjIgJA

ChangeLog
configure.ac
sntp/m4/realpath.m4 [new file with mode: 0644]

index eeceaa9f10cb57b56caf561eaab50a81ec861f63..2e56da12b5588cdd0129c0fff212fb3aa60670e9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+---
+
+* Implement NTP_FUNC_REALPATH.  <stenn@ntp.org>
+
 ---
 (4.2.8p15) 2020/06/23 Released by Harlan Stenn <stenn@ntp.org>
 
index 5dc6aee02edc763c02af86a9417269f5b70d045c..4e1c1dc676d483c8b6b42d405efc837a95a25e3f 100644 (file)
@@ -900,6 +900,7 @@ case "$host" in
     ;;
 esac
 AC_CHECK_FUNCS([nice plock pututline pututxline readlink rtprio])
+NTP_FUNC_REALPATH
 case "$host" in
  *-*-aix[[4-9]]*)
     # XXX only verified thru AIX6.
diff --git a/sntp/m4/realpath.m4 b/sntp/m4/realpath.m4
new file mode 100644 (file)
index 0000000..ad75adc
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# SYNOPSIS
+#
+#   NTP_FUNC_REALPATH
+#
+# DESCRIPTION
+#
+#   This macro defines HAVE_FUNC_REALPATH if we have a realpath()
+#   function that accepts NULL as the 2nd argument.
+#
+# LICENSE
+#
+#   Copyright (c) 2020 Network Time Foundation
+#
+#   Author: Harlan Stenn <stenn@nwtime.org>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 1
+
+AC_DEFUN([NTP_FUNC_REALPATH], [
+       AC_MSG_CHECKING([whether we have a realpath() that accepts NULL as the 2nd argument])
+       AC_REQUIRE([AC_PROG_CC_C99])
+
+       AC_LANG_PUSH([C])
+
+       AC_RUN_IFELSE(
+               [AC_LANG_SOURCE([[
+                       #include <sys/param.h>
+                       #include <stdlib.h>
+                       int main() { exit (NULL == realpath(".", NULL)); }
+                       ]])],
+               and="yes",
+               ans="no",
+               ans="CROSS COMPILE!"
+               )
+       AC_MSG_NOTICE([boink])
+       case "$ans" in
+        yes)
+           AC_DEFINE([HAVE_FUNC_REALPATH], [1],
+                       [Define to 1 if we have realpath() that supports NULL as the 2nd argument]),
+           ;;
+       esac
+       AC_MSG_RESULT([$ans])
+
+       AC_LANG_POP([C])
+       ]);