From e4b6007f33ba26cd7c1d041bac2d296f680d5794 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 11 Dec 2018 20:31:40 +0100 Subject: [PATCH] Check for dirfd in autoconf build This commit via https://anonhg.netbsd.org/pkgsrc/file/tip/shells/fish/patches/patch-configure.ac, credit to jklos@pkgsrc.org. --- configure.ac | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5d83402f3..ef60461c6 100644 --- a/configure.ac +++ b/configure.ac @@ -322,7 +322,24 @@ AC_CHECK_FUNCS( wcslcpy lrand48_r killpg ) AC_CHECK_FUNCS( backtrace_symbols getifaddrs ) AC_CHECK_FUNCS( futimens clock_gettime ) AC_CHECK_FUNCS( getpwent flock ) -AC_CHECK_FUNCS( dirfd ) + +AC_MSG_CHECKING([dirfd]) +AC_LINK_IFELSE([ + +#include + +DIR *dirp; + +int +main(void) +{ + return dirfd(dirp); +} +], [ AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_DIRFD], 1, [ Define to 1 if you have the `dirfd' function or macro. ]) + ], + [ AC_MSG_RESULT([no])] +) AC_CHECK_DECL( [__NetBSD__], AC_DEFINE([TPARM_VARARGS], 1, [ Make tparm take varargs ]) ) AC_CHECK_DECL( [mkostemp], [ AC_CHECK_FUNCS([mkostemp]) ] )