Improve the test for dirfd().  Some systems #define it rather than
have it as a library function.
diff --git a/configure.in b/configure.in
index 0aa094a..f0beb6b 100644
--- a/configure.in
+++ b/configure.in
@@ -2562,7 +2562,7 @@
 
 # checks for library functions
 AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
- clock confstr ctermid dirfd execv faccessat fchmod fchmodat fchown fchownat \
+ clock confstr ctermid execv faccessat fchmod fchmodat fchown fchownat \
  fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \
  futimens futimes gai_strerror \
  getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \
@@ -2584,6 +2584,12 @@
  truncate uname unlinkat unsetenv utimensat utimes waitid waitpid wait3 wait4 \
  wcscoll wcsftime wcsxfrm writev _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)