Improve the test for dirfd(), some systems #define it rather than have
an actual function.
diff --git a/configure.in b/configure.in
index 71e0a8f..138d562 100644
--- a/configure.in
+++ b/configure.in
@@ -2587,7 +2587,7 @@
 
 # checks for library functions
 AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
- clock confstr ctermid dirfd execv fchmod fchown fork fpathconf ftime ftruncate \
+ clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
  gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
  getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
  initgroups kill killpg lchmod lchown lstat mbrtowc mkfifo mknod mktime \
@@ -2601,6 +2601,12 @@
  truncate uname unsetenv utimes waitpid wait3 wait4 \
  wcscoll wcsftime wcsxfrm _getpty)
 
+AC_CHECK_DECL(dirfd,
+    AC_DEFINE(HAVE_DIRFD, 1,
+              Define if you have the 'dirfd' function or macro.), ,
+      [#include <sys/types.h>
+       #include <dirent.h>])
+
 # For some functions, having a definition is not sufficient, since
 # we want to take their address.
 AC_MSG_CHECKING(for chroot)