dnl ICP_CHECK_NOTCH_FUNCS
|
|
dnl Check for various functions that may not be present
|
|
dnl everywhere, and for which we provide a replacement.
|
|
dnl
|
|
AC_DEFUN([ICP_CHECK_NOTCH_FUNCS],[
|
|
AC_CHECK_HEADERS([err.h], [], [AC_CONFIG_LINKS([err.h:lib/err.compat.h])])
|
|
AC_REPLACE_FUNCS([asprintf err])
|
|
AC_CHECK_DECLS([program_invocation_short_name], [],
|
|
[AC_CHECK_FUNCS([getprogname setprogname], [],
|
|
[AC_LIBOBJ([progname])])],
|
|
[#include <errno.h>
|
|
])
|
|
AH_BOTTOM([#include <compat.h>
|
|
])
|
|
])
|
|
|
|
dnl ICP_CHECK_SANE_REALPATH([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
|
dnl Check for the realpath function. If it is available, then
|
|
dnl check if it is safely usable.
|
|
dnl
|
|
AC_DEFUN([ICP_CHECK_SANE_REALPATH],[
|
|
AC_CHECK_FUNCS([realpath])
|
|
if test "x$ac_cv_func_realpath" = xyes ; then
|
|
AC_MSG_CHECKING([whether realpath is POSIX.1-2008 compliant])
|
|
AC_RUN_IFELSE(
|
|
[AC_LANG_PROGRAM(
|
|
[[#include <stdlib.h>]],
|
|
[[
|
|
char *p = NULL;
|
|
p = realpath("/tmp", NULL);
|
|
if ( p == NULL )
|
|
return 1;
|
|
else
|
|
free(p);
|
|
]])],
|
|
[AC_MSG_RESULT([yes])
|
|
m4_default([$1], [AC_DEFINE([HAVE_SANE_REALPATH], [1],
|
|
[Define to 1 if realpath is POSIX.1-2008 compliant.])])],
|
|
[AC_MSG_RESULT([no])
|
|
$2],
|
|
[AC_MSG_RESULT([cross-compiling, assuming no])
|
|
$2])
|
|
else
|
|
m4_default([$2], [:])
|
|
fi
|
|
])
|