From 642ffbc971124d0f40f762cf00eef4faf68a3f02 Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Wed, 7 Oct 2009 09:15:22 +0200 Subject: [PATCH] Add autoconf support for detecting the xBSD extattr interface and some other cleanups of the configure.in Newly generated config.h.in also added --- bacula/autoconf/config.h.in | 46 ++++++++++---- bacula/autoconf/configure.in | 119 +++++++++++++++++++++++------------ 2 files changed, 115 insertions(+), 50 deletions(-) diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in index e162d65521..c78abd026f 100644 --- a/bacula/autoconf/config.h.in +++ b/bacula/autoconf/config.h.in @@ -255,7 +255,7 @@ language is requested. */ #undef ENABLE_NLS -/* Normal attribute support */ +/* Normal acl support */ #undef HAVE_ACL /* Define to 1 if you have `alloca', as a function or macro. */ @@ -347,13 +347,28 @@ /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT -/* Extended attribute support */ +/* Define to 1 if you have the `extattr_get_link' function. */ +#undef HAVE_EXTATTR_GET_LINK + +/* Define to 1 if you have the `extattr_list_link' function. */ +#undef HAVE_EXTATTR_LIST_LINK + +/* Define to 1 if you have the `extattr_namespace_to_string' function. */ +#undef HAVE_EXTATTR_NAMESPACE_TO_STRING + +/* Define to 1 if you have the `extattr_set_link' function. */ +#undef HAVE_EXTATTR_SET_LINK + +/* Define to 1 if you have the `extattr_string_to_namespace' function. */ +#undef HAVE_EXTATTR_STRING_TO_NAMESPACE + +/* Extended acl support */ #undef HAVE_EXTENDED_ACL /* Define to 1 if you have the `fchdir' function. */ #undef HAVE_FCHDIR -/* FCHOWNAT support */ +/* Define to 1 if you have the `fchownat' function. */ #undef HAVE_FCHOWNAT /* Define to 1 if you have the header file. */ @@ -368,10 +383,10 @@ /* Define to 1 if you have the `fseeko' function. */ #undef HAVE_FSEEKO -/* FSTATAT support */ +/* Define to 1 if you have the `fstatat' function. */ #undef HAVE_FSTATAT -/* FUTIMESAT support */ +/* Define to 1 if you have the `futimesat' function. */ #undef HAVE_FUTIMESAT /* Define to 1 if you have the `fwprintf' function. */ @@ -462,7 +477,7 @@ /* Define if your file defines LC_MESSAGES. */ #undef HAVE_LC_MESSAGES -/* LGETXATTR support */ +/* Define to 1 if you have the `lgetxattr' function. */ #undef HAVE_LGETXATTR /* Define if you have libcap */ @@ -489,6 +504,9 @@ /* Define to 1 if you have the `util' library (-lutil). */ #undef HAVE_LIBUTIL +/* Defines if your system have the libutil.h header file */ +#undef HAVE_LIBUTIL_H + /* Set to enable libwraper support */ #undef HAVE_LIBWRAP @@ -501,7 +519,7 @@ /* Define to 1 if you have the `listxattr' function. */ #undef HAVE_LISTXATTR -/* LLISTXATTR support */ +/* Define to 1 if you have the `llistxattr' function. */ #undef HAVE_LLISTXATTR /* Define to 1 if you have the header file. */ @@ -516,7 +534,7 @@ /* Define if you have the 'long long' type. */ #undef HAVE_LONG_LONG -/* LSETXATTR support */ +/* Define to 1 if you have the `lsetxattr' function. */ #undef HAVE_LSETXATTR /* Define to 1 if you have the `lstat' function. */ @@ -552,7 +570,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_NL_TYPES_H -/* OPENAT support */ +/* Define to 1 if you have the `nvlist_next_nvpair' function. */ +#undef HAVE_NVLIST_NEXT_NVPAIR + +/* Define to 1 if you have the `openat' function. */ #undef HAVE_OPENAT /* Define if OpenSSL library is available */ @@ -719,6 +740,9 @@ */ #undef HAVE_SYS_DIR_H +/* Defines if your system have the sys/extattr.h header file */ +#undef HAVE_SYS_EXTATTR_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H @@ -806,7 +830,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* UNLINKAT support */ +/* Define to 1 if you have the `unlinkat' function. */ #undef HAVE_UNLINKAT /* Define if you have the 'unsigned long long' type. */ @@ -839,7 +863,7 @@ /* Define if you have the 'wint_t' type. */ #undef HAVE_WINT_T -/* XATTR support */ +/* Exteded Attributes support */ #undef HAVE_XATTR /* Define to 1 if you have the header file. */ diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 9f4b443c25..07a28949f5 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -2368,11 +2368,11 @@ if test x$support_acl = xyes -o x$support_acl = xauto; then please either load the acl libraries or rerun configure without --enable-acl]) else if test $have_acl = yes; then - AC_DEFINE([HAVE_ACL], [], [Normal attribute support]) + AC_DEFINE([HAVE_ACL],1,[Normal acl support]) fi if test $have_extended_acl = yes; then - AC_DEFINE([HAVE_EXTENDED_ACL], [], [Extended attribute support]) + AC_DEFINE([HAVE_EXTENDED_ACL],1,[Extended acl support]) fi fi fi @@ -2394,55 +2394,96 @@ AC_ARG_ENABLE(xattr, have_xattr=no if test x$support_xattr = xyes -o x$support_xattr = xauto; then - AC_CHECK_HEADER(sys/xattr.h, [ AC_DEFINE(HAVE_SYS_XATTR_H,1,[Defines if your system have the sys/xattr.h header file])] , ) - AC_CHECK_FUNCS(llistxattr lgetxattr lsetxattr, + dnl + dnl First check for *BSD support + dnl + AC_CHECK_HEADER(sys/extattr.h, [ AC_DEFINE(HAVE_SYS_EXTATTR_H,1,[Defines if your system have the sys/extattr.h header file])] , ) + AC_CHECK_HEADER(libutil.h, [ AC_DEFINE(HAVE_LIBUTIL_H,1,[Defines if your system have the libutil.h header file])] , ) + AC_CHECK_FUNCS(extattr_get_link extattr_set_link extattr_list_link, [ have_xattr=yes - AC_DEFINE([HAVE_LLISTXATTR], [], [LLISTXATTR support]) - AC_DEFINE([HAVE_LGETXATTR], [], [LGETXATTR support]) - AC_DEFINE([HAVE_LSETXATTR], [], [LSETXATTR support]) + AC_DEFINE([HAVE_EXTATTR_GET_LINK],1,[Define to 1 if you have the `extattr_get_link' function.]) + AC_DEFINE([HAVE_EXTATTR_SET_LINK],1,[Define to 1 if you have the `extattr_set_link' function.]) + AC_DEFINE([HAVE_EXTATTR_LIST_LINK],1,[Define to 1 if you have the `extattr_list_link' function.]) ] ) - - # - # OSX specific - # - if test $have_xattr = no; then - AC_CHECK_FUNCS(listxattr getxattr setxattr, - [ - have_xattr=yes - AC_DEFINE([HAVE_LLISTXATTR], [], [LLISTXATTR support]) - AC_DEFINE([HAVE_LGETXATTR], [], [LGETXATTR support]) - AC_DEFINE([HAVE_LSETXATTR], [], [LSETXATTR support]) - ] + + if test $have_xattr = yes; then + have_extattr_string_in_libc=no + AC_CHECK_FUNCS(extattr_namespace_to_string extattr_string_to_namespace, + [ + have_extattr_string_in_libc=yes + AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the `extattr_namespace_to_string' function.]) + AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the `extattr_string_to_namespace' function.]) + ] ) + + dnl + dnl If extattr_namespace_to_string and extattr_string_to_namespace are not in libc see if they are in libutil + dnl + if test $have_extattr_string_in_libc = no; then + AC_CHECK_LIB(util, extattr_namespace_to_string extattr_string_to_namespace, + [ + AC_DEFINE([HAVE_EXTATTR_NAMESPACE_TO_STRING],1,[Define to 1 if you have the `extattr_namespace_to_string' function.]) + AC_DEFINE([HAVE_EXTATTR_STRING_TO_NAMESPACE],1,[Define to 1 if you have the `extattr_string_to_namespace' function.]) + FDLIBS="-lutil $FDLIBS" + ] + ) + fi fi - # - # Solaris specific - # + dnl + dnl If we failed to find *BSD support try the Linux or OSX implementation of xattr + dnl if test $have_xattr = no; then - AC_CHECK_HEADER(sys/attr.h, [ AC_DEFINE(HAVE_SYS_ATTR_H,1,[Defines if your system have the sys/attr.h header file])] , ) - AC_CHECK_HEADER(sys/nvpair.h, [ AC_DEFINE(HAVE_SYS_NVPAIR_H,1,[Defines if your system have the sys/nvpair.h header file])] , ) - AC_CHECK_HEADER(attr.h, [ AC_DEFINE(HAVE_ATTR_H,1,[Defines if your system have the attr.h header file])] , ) - - AC_CHECK_FUNCS(openat fstatat unlinkat fchownat futimesat, - [ + AC_CHECK_HEADER(sys/xattr.h, [ AC_DEFINE(HAVE_SYS_XATTR_H,1,[Defines if your system have the sys/xattr.h header file])] , ) + AC_CHECK_FUNCS(llistxattr lgetxattr lsetxattr, + [ have_xattr=yes - AC_DEFINE([HAVE_OPENAT], [], [OPENAT support]) - AC_DEFINE([HAVE_FSTATAT], [], [FSTATAT support]) - AC_DEFINE([HAVE_UNLINKAT], [], [UNLINKAT support]) - AC_DEFINE([HAVE_FCHOWNAT], [], [FCHOWNAT support]) - AC_DEFINE([HAVE_FUTIMESAT], [], [FUTIMESAT support]) - ] + AC_DEFINE([HAVE_LLISTXATTR],1,[Define to 1 if you have the `llistxattr' function.]) + AC_DEFINE([HAVE_LGETXATTR],1,[Define to 1 if you have the `lgetxattr' function.]) + AC_DEFINE([HAVE_LSETXATTR],1,[Define to 1 if you have the `lsetxattr' function.]) + ] ) - if test $have_xattr = yes; then - AC_CHECK_LIB(nvpair, nvlist_next_nvpair, + if test $have_xattr = no; then + AC_CHECK_FUNCS(listxattr getxattr setxattr, [ - FDLIBS="-lnvpair $FDLIBS" + have_xattr=yes + AC_DEFINE([HAVE_LISTXATTR],1,[Define to 1 if you have the `listxattr' function.]) + AC_DEFINE([HAVE_GETXATTR],1,[Define to 1 if you have the `getxattr' function.]) + AC_DEFINE([HAVE_SETXATTR],1,[Define to 1 if you have the `setxattr' function.]) ] - ) + ) + fi + + # + # Solaris specific + # + if test $have_xattr = no; then + AC_CHECK_HEADER(sys/attr.h, [ AC_DEFINE(HAVE_SYS_ATTR_H,1,[Defines if your system have the sys/attr.h header file])] , ) + AC_CHECK_HEADER(sys/nvpair.h, [ AC_DEFINE(HAVE_SYS_NVPAIR_H,1,[Defines if your system have the sys/nvpair.h header file])] , ) + AC_CHECK_HEADER(attr.h, [ AC_DEFINE(HAVE_ATTR_H,1,[Defines if your system have the attr.h header file])] , ) + + AC_CHECK_FUNCS(openat fstatat unlinkat fchownat futimesat, + [ + have_xattr=yes + AC_DEFINE([HAVE_OPENAT],1,[Define to 1 if you have the `openat' function.]) + AC_DEFINE([HAVE_FSTATAT],1,[Define to 1 if you have the `fstatat' function.]) + AC_DEFINE([HAVE_UNLINKAT],1,[Define to 1 if you have the `unlinkat' function.]) + AC_DEFINE([HAVE_FCHOWNAT],1,[Define to 1 if you have the `fchownat' function.]) + AC_DEFINE([HAVE_FUTIMESAT],1,[Define to 1 if you have the `futimesat' function.]) + ] + ) + + if test $have_xattr = yes; then + AC_CHECK_LIB(nvpair, nvlist_next_nvpair, + [ + AC_DEFINE([HAVE_NVLIST_NEXT_NVPAIR],1,[Define to 1 if you have the `nvlist_next_nvpair' function.]) + FDLIBS="-lnvpair $FDLIBS" + ] + ) + fi fi fi @@ -2451,7 +2492,7 @@ if test x$support_xattr = xyes -o x$support_xattr = xauto; then please either load the xattr libraries or rerun configure without --enable-xatt]) else if test $have_xattr = yes; then - AC_DEFINE([HAVE_XATTR], [], [XATTR support]) + AC_DEFINE([HAVE_XATTR],1,[Exteded Attributes support]) fi fi fi -- 2.39.5