From: Harlan Stenn Date: Wed, 14 Oct 2020 05:52:43 +0000 (+0000) Subject: Implement NTP_FUNC_REALPATH X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b21aba728587e76855bef1d2359cb037849232d;p=thirdparty%2Fntp.git Implement NTP_FUNC_REALPATH bk: 5f86922bzyQmBj2XWvmDxZUqNjIgJA --- diff --git a/ChangeLog b/ChangeLog index eeceaa9f1..2e56da12b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +--- + +* Implement NTP_FUNC_REALPATH. + --- (4.2.8p15) 2020/06/23 Released by Harlan Stenn diff --git a/configure.ac b/configure.ac index 5dc6aee02..4e1c1dc67 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 000000000..ad75adc9d --- /dev/null +++ b/sntp/m4/realpath.m4 @@ -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 +# +# 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 + #include + 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]) + ]);