autoconf test for dirfd and dd_fd

This commit is contained in:
Love Hornquist Astrand
2010-02-25 22:18:32 -08:00
parent 53024a5a22
commit 94a8d9c5e5
2 changed files with 24 additions and 1 deletions

View File

@@ -392,6 +392,25 @@ AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
#include <vis.h>
#endif], rk_func)])
AC_MSG_CHECKING([checking for dirfd])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
]],
[[DIR *d = 0; dirfd(d);]])],
[ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
if test "$ac_rk_have_dirfd" = "yes" ; then
AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
fi
AC_MSG_RESULT($ac_rk_have_dirfd)
AC_HAVE_STRUCT_FIELD(struct dirent, dd_fd, [#include <sys/types.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif])
AC_BROKEN2(inet_aton,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>

View File

@@ -652,8 +652,12 @@ ROKEN_LIB_FUNCTION unsigned short ROKEN_LIB_CALL bswap16(unsigned short);
int rk_flock(int fd, int operation);
#endif /* HAVE_FLOCK */
#if defined(SunOS) || defined(_AIX)
#ifndef HAVE_DIRFD
#ifdef HAVE_STRUCT_DIRENT_DD_FD
#define dirfd(x) ((x)->dd_fd)
#else
#error Missing dirfd() and ->dd_fd
#endif
#endif
ROKEN_LIB_FUNCTION time_t ROKEN_LIB_CALL tm2time (struct tm, int);