From ef8a7e64afe800d669d99dc772136431a22cce17 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 8 Nov 2012 19:00:18 +0100 Subject: [PATCH] s3: Fix bug 9369, dirfd detection on FreeBSD --- lib/replace/repdir.m4 | 9 +++++++-- source3/configure.in | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/replace/repdir.m4 b/lib/replace/repdir.m4 index 682ab44..182945f 100644 --- a/lib/replace/repdir.m4 +++ b/lib/replace/repdir.m4 @@ -7,8 +7,13 @@ AC_CACHE_CHECK([for broken readdir],libreplace_cv_READDIR_NEEDED,[ [libreplace_cv_READDIR_NEEDED="assuming not"]) ]) -AC_CHECK_FUNCS(dirfd) -AC_HAVE_DECL(dirfd, [#include ]) +########################################### +# Check for the dirfd function/macro. +AC_CACHE_CHECK([for dirfd as func or macro], libreplace_cv_have_dirfd, [ +AC_TRY_COMPILE([ +#include +#include <$ac_header_dirent>], [DIR *d; (void)dirfd(d);], + [libreplace_cv_have_dirfd=yes], [libreplace_cv_have_dirfd=no])]) # # try to replace with getdirentries() if needed diff --git a/source3/configure.in b/source3/configure.in index 014d844..20f3b4e 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -974,9 +974,9 @@ if test x"$samba_cv_msghdr_msg_acctrights" = x"yes"; then [If we can use msg_acctrights for passing file descriptors]) fi -AC_CHECK_FUNCS(dirfd) -if test x"$ac_cv_func_dirfd" = x"yes"; then - default_shared_modules="$default_shared_modules vfs_syncops vfs_dirsort" +if test x"$libreplace_cv_have_dirfd" = x"yes"; then + AC_DEFINE(HAVE_DIRFD,1,[Whether we have dirfd as func or macro]) + default_shared_modules="$default_shared_modules vfs_syncops vfs_dirsort" fi AC_CACHE_CHECK([for struct sigevent type],samba_cv_struct_sigevent, [ -- 1.7.9.5