From 63b0d66ee9816094a9d9a463a7b36bee1e79c943 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 | 5 +---- 4 Dateien geändert, 20 Zeilen hinzugefügt(+), 9 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 9dfa985..897c9ce 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -493,6 +493,12 @@ removeea setea 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 179d12d..79e18a1 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -809,9 +809,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 96ab4de..6f4ce99 100644 --- a/source3/wscript +++ b/source3/wscript @@ -365,9 +365,6 @@ return acl_get_perm_np(permset_d, perm); default_static_modules.extend(TO_LIST('vfs_posixacl')) - 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", @@ -1620,7 +1617,7 @@ main() { if conf.CONFIG_SET('HAVE_FREEBSD_SUNACL_H'): default_shared_modules.extend(TO_LIST('vfs_zfsacl')) - if conf.CONFIG_SET('HAVE_DIRFD_DECL'): + if conf.CONFIG_SET('HAVE_DIRFD'): default_shared_modules.extend(TO_LIST('vfs_syncops vfs_dirsort')) if conf.CONFIG_SET('HAVE_STATFS_F_FSID'): -- 1.7.11.5