[AC_MSG_RESULT(no)
])
+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)
+
+OPENAFS_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif])
+
dnl Eventually, this will look for the system one, or for OpenSSL
LIB_hcrypto="-lafshcrypto"
AC_SUBST(LIB_hcrypto)
--- /dev/null
+dnl Borrowed from Heimdal, but renamed as I don't think we
+dnl should be shipping AC_ macros.
+
+AC_DEFUN([OPENAFS_HAVE_STRUCT_FIELD], [
+define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_]))
+AC_CACHE_CHECK([for $2 in $1], cache_val,[
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$3]],
+ [[$1 x; memset(&x, 0, sizeof(x)); x.$2]])],
+ [cache_val=yes],
+ [cache_val=no])
+])
+if test "$cache_val" = yes; then
+ define(foo, translit(HAVE_$1_$2, [a-z ], [A-Z_]))
+ AC_DEFINE(foo, 1, [Define if $1 has field $2.])
+ undefine([foo])
+fi
+undefine([cache_val])
+])
+
${CCRULE}
evp.o: ${UPSTREAM}/hcrypto/evp.c
- ${CCRULE}
+ ${CCRULE} -DHAVE_CONFIG_H
evp-hcrypto.o: ${UPSTREAM}/hcrypto/evp-hcrypto.c
${CCRULE}
strlcpy (char *, const char *, size_t);
#endif
+#ifndef HAVE_DIRFD
+# ifdef HAVE_DIR_DD_FD
+# define dirfd(x) ((x)->dd_fd)
+# else
+# ifndef _WIN32 /* Windows code never calls dirfd */
+# error Missing dirfd() and ->dd_fd
+# endif
+# endif
+#endif
+
/* This is a bodge, but it's only used by the tests */
#define emalloc(x) malloc(x)