From 27bf672be9e38466b872942fd3a29838f4619e8f 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 | 13 +++++++++++-- lib/replace/wscript | 6 ++++++ source3/configure.in | 5 ++--- source3/wscript | 7 ++----- 4 Dateien geändert, 21 Zeilen hinzugefügt(+), 10 Zeilen entfernt(-) diff --git a/lib/replace/repdir.m4 b/lib/replace/repdir.m4 index 682ab44..0d292f9 100644 --- a/lib/replace/repdir.m4 +++ b/lib/replace/repdir.m4 @@ -7,8 +7,17 @@ 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 ], [DIR *d; (void)dirfd(d);], + [libreplace_cv_have_dirfd=yes], [libreplace_cv_have_dirfd=no])]) + +if test x"$libreplace_cv_have_dirfd" = x"yes"; then + AC_DEFINE(HAVE_DIRFD,1,[Whether we have dirfd as func or macro]) +fi # # try to replace with getdirentries() if needed diff --git a/lib/replace/wscript b/lib/replace/wscript index c24d6e7..0cf8823 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -390,6 +390,12 @@ def configure(conf): define='REPLACE_GETPASS', cflags='-DNO_CONFIG_H') + conf.CHECK_CODE('''#include + #include + int main(void) { DIR *d; (void)dirfd(d); }''', + addmain=False, + define='HAVE_DIRFD') + conf.RECURSE('system') conf.SAMBA_CONFIG_H() diff --git a/source3/configure.in b/source3/configure.in index 014d844..9e6dc20 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -974,9 +974,8 @@ 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 + default_shared_modules="$default_shared_modules vfs_syncops vfs_dirsort" fi AC_CACHE_CHECK([for struct sigevent type],samba_cv_struct_sigevent, [ diff --git a/source3/wscript b/source3/wscript index 1ea3559..2f8bc63 100644 --- a/source3/wscript +++ b/source3/wscript @@ -370,9 +370,6 @@ return acl_get_perm_np(permset_d, perm); conf.DEFINE('HAVE_NO_ACLS', 1) conf.SET_TARGET_TYPE('acl', 'EMPTY') - if conf.CHECK_FUNCS('dirfd'): - conf.DEFINE('HAVE_DIRFD_DECL', 1) - conf.CHECK_CODE('struct statfs fsd; fsid_t fsid = fsd.f_fsid; return statfs(".", &fsd);', 'HAVE_STATFS_F_FSID', msg="vfs_fileid: checking for statfs() and struct statfs.f_fsid", @@ -1774,8 +1771,8 @@ main() { if conf.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'): default_shared_modules.extend(TO_LIST('vfs_zfsacl')) - if conf.CONFIG_SET('HAVE_DIRFD_DECL'): - default_shared_modules.extend(TO_LIST('vfs_syncops vfs_dirsort')) + if conf.CONFIG_SET('HAVE_DIRFD'): + default_shared_modules.extend(TO_LIST('vfs_syncops vfs_dirsort')) if conf.CONFIG_SET('HAVE_STATFS_F_FSID'): default_shared_modules.extend(TO_LIST('vfs_fileid')) -- 1.7.11.5