1*a466cc55SCy Schubert# 2*a466cc55SCy Schubert# SYNOPSIS 3*a466cc55SCy Schubert# 4*a466cc55SCy Schubert# NTP_FUNC_REALPATH 5*a466cc55SCy Schubert# 6*a466cc55SCy Schubert# DESCRIPTION 7*a466cc55SCy Schubert# 8*a466cc55SCy Schubert# This macro defines HAVE_FUNC_REALPATH if we have a realpath() 9*a466cc55SCy Schubert# function that accepts NULL as the 2nd argument. 10*a466cc55SCy Schubert# 11*a466cc55SCy Schubert# LICENSE 12*a466cc55SCy Schubert# 13*a466cc55SCy Schubert# Copyright (c) 2020 Network Time Foundation 14*a466cc55SCy Schubert# 15*a466cc55SCy Schubert# Author: Harlan Stenn <stenn@nwtime.org> 16*a466cc55SCy Schubert# 17*a466cc55SCy Schubert# Copying and distribution of this file, with or without modification, are 18*a466cc55SCy Schubert# permitted in any medium without royalty provided the copyright notice 19*a466cc55SCy Schubert# and this notice are preserved. This file is offered as-is, without any 20*a466cc55SCy Schubert# warranty. 21*a466cc55SCy Schubert 22*a466cc55SCy Schubert#serial 1 23*a466cc55SCy Schubert 24*a466cc55SCy SchubertAC_DEFUN([NTP_FUNC_REALPATH], [ 25*a466cc55SCy Schubert AC_MSG_CHECKING([for a POSIX-2008 compliant realpath()]) 26*a466cc55SCy Schubert AC_REQUIRE([AC_PROG_CC_C99]) 27*a466cc55SCy Schubert 28*a466cc55SCy Schubert AC_LANG_PUSH([C]) 29*a466cc55SCy Schubert 30*a466cc55SCy Schubert AC_RUN_IFELSE( 31*a466cc55SCy Schubert [AC_LANG_SOURCE([[ 32*a466cc55SCy Schubert #include <sys/param.h> 33*a466cc55SCy Schubert #include <stdlib.h> 34*a466cc55SCy Schubert int main() { return (NULL == realpath(".", NULL)); } 35*a466cc55SCy Schubert ]])], 36*a466cc55SCy Schubert ans="yes", 37*a466cc55SCy Schubert ans="no", 38*a466cc55SCy Schubert ans="CROSS COMPILE!" 39*a466cc55SCy Schubert ) 40*a466cc55SCy Schubert AC_MSG_RESULT([$ans]) 41*a466cc55SCy Schubert case "$ans" in 42*a466cc55SCy Schubert yes) 43*a466cc55SCy Schubert AC_DEFINE([HAVE_FUNC_POSIX_REALPATH], [1], 44*a466cc55SCy Schubert [Define to 1 if we have realpath() that supports NULL as the 2nd argument]) 45*a466cc55SCy Schubert ;; 46*a466cc55SCy Schubert esac 47*a466cc55SCy Schubert 48*a466cc55SCy Schubert AC_LANG_POP([C]) 49*a466cc55SCy Schubert ]); 50