From: Radoslaw Korzeniewski Date: Tue, 17 Apr 2018 09:11:55 +0000 (+0200) Subject: Update the build for ACL/XATTR support. X-Git-Tag: Release-9.2.0~116 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=90bc2f92f80a88823c48be4daef388022a2bcfc2;p=thirdparty%2Fbacula.git Update the build for ACL/XATTR support. --- diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 5e2cb00e45..ce00de8ac7 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -2596,69 +2596,64 @@ if test x$support_acl = xyes -o x$support_acl = xauto; then dnl First check for acl_get_file in libc dnl AC_CHECK_FUNC(acl_get_file, - [ - have_acl=yes - ] - ) + [ + have_acl=yes + ]) dnl dnl Check for acl_get_file in libacl (Linux) dnl if test $have_acl = no; then AC_CHECK_LIB(acl, acl_get_file, - [ - have_acl=yes - if test $have_afs = yes; then - dnl - dnl Because of possible naming conflict with AFS libacl make sure we use the one in /usr/lib64 or /usr/lib !!! - dnl - if test -d /usr/lib64/; then - FDLIBS="-L/usr/lib64 -lacl $FDLIBS" - else - FDLIBS="-L/usr/lib -lacl $FDLIBS" - fi - else - FDLIBS="-lacl $FDLIBS" - fi - ] - ) + [ + have_acl=yes + if test $have_afs = yes; then + dnl + dnl Because of possible naming conflict with AFS libacl make sure we use the one in /usr/lib64 or /usr/lib !!! + dnl + if test -d /usr/lib64/; then + FDLIBS="-L/usr/lib64 -lacl $FDLIBS" + else + FDLIBS="-L/usr/lib -lacl $FDLIBS" + fi + else + FDLIBS="-lacl $FDLIBS" + fi + ]) fi dnl dnl Check for acl_get_file in libpacl (OSF1) dnl and if ACL_TYPE_DEFAULT_DIR is defined. dnl - if test $have_acl = no -a \ - x${HAVE_OSF1_OS_TRUE} = x; then + if test $have_acl = no -a x${HAVE_OSF1_OS_TRUE} = x; then AC_CHECK_LIB(pacl, acl_get_file, - [ - have_acl=yes - FDLIBS="-lpacl $FDLIBS" - ] - ) + [ + have_acl=yes + FDLIBS="-lpacl $FDLIBS" + ]) AC_MSG_CHECKING(for ACL_TYPE_DEFAULT_DIR in acl.h include file) grep ACL_TYPE_DEFAULT_DIR /usr/include/sys/acl.h > /dev/null 2>&1 if test $? = 0; then - AC_DEFINE(HAVE_ACL_TYPE_DEFAULT_DIR,1,[Defines if your system have the ACL_TYPE_DEFAULT_DIR acl type]) - AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ACL_TYPE_DEFAULT_DIR,1,[Defines if your system have the ACL_TYPE_DEFAULT_DIR acl type]) + AC_MSG_RESULT(yes) else - AC_MSG_RESULT(no) + AC_MSG_RESULT(no) fi fi dnl dnl On OSX check for availability of ACL_TYPE_EXTENDED dnl - if test $have_acl = yes -a \ - x${HAVE_DARWIN_OS_TRUE} = x; then + if test $have_acl = yes -a x${HAVE_DARWIN_OS_TRUE} = x; then AC_MSG_CHECKING(for ACL_TYPE_EXTENDED in acl.h include file) grep ACL_TYPE_EXTENDED /usr/include/sys/acl.h > /dev/null 2>&1 if test $? = 0; then - AC_DEFINE(HAVE_ACL_TYPE_EXTENDED,1,[Defines if your system have the ACL_TYPE_EXTENDED acl type]) - AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ACL_TYPE_EXTENDED,1,[Defines if your system have the ACL_TYPE_EXTENDED acl type]) + AC_MSG_RESULT(yes) else - AC_MSG_RESULT(no) + AC_MSG_RESULT(no) fi fi @@ -2666,14 +2661,14 @@ if test x$support_acl = xyes -o x$support_acl = xauto; then dnl On FreeBSD check for availability of ACL_TYPE_NFS4 dnl if test $have_acl = yes -a \ - x${HAVE_FREEBSD_OS_TRUE} = x; then + x${HAVE_FREEBSD_OS_TRUE} = x; then AC_MSG_CHECKING(for ACL_TYPE_NFS4 in acl.h include file) grep ACL_TYPE_NFS4 /usr/include/sys/acl.h > /dev/null 2>&1 if test $? = 0; then - AC_DEFINE(HAVE_ACL_TYPE_NFS4,1,[Defines if your system have the ACL_TYPE_NFS4 acl type]) - AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ACL_TYPE_NFS4,1,[Defines if your system have the ACL_TYPE_NFS4 acl type]) + AC_MSG_RESULT(yes) else - AC_MSG_RESULT(no) + AC_MSG_RESULT(no) fi fi @@ -2681,18 +2676,18 @@ if test x$support_acl = xyes -o x$support_acl = xauto; then dnl Check for acltotext and acl_totext (Solaris) dnl if test $have_acl = no -a \ - x${HAVE_SUN_OS_TRUE} = x; then + x${HAVE_SUN_OS_TRUE} = x; then AC_CHECK_LIB(sec, acltotext, - [ - have_acl=yes - FDLIBS="-lsec $FDLIBS" + [ + have_acl=yes + FDLIBS="-lsec $FDLIBS" - AC_CHECK_LIB(sec, acl_totext, - [ - have_extended_acl=yes - ] - ) - ] + AC_CHECK_LIB(sec, acl_totext, + [ + have_extended_acl=yes + ] + ) + ] ) fi @@ -2714,19 +2709,35 @@ if test x$support_acl = xyes -o x$support_acl = xauto; then ) fi +ACLOBJS= if test x$support_acl = xyes -a $have_acl != yes; then AC_MSG_ERROR([acl support explicitly enabled but no supported acl implementation found, please either load the acl libraries or rerun configure without --enable-acl]) else if test $have_acl = yes; then - AC_DEFINE([HAVE_ACL],1,[Normal acl support]) + AC_DEFINE([HAVE_ACL],1,[Normal acl support]) + dnl + dnl Prepare obj building + dnl + if test x${HAVE_LINUX_OS_TRUE} = x; then + ACLOBJS="bacl.c bacl_linux.c" + fi + if test x${HAVE_SUN_OS_TRUE} = x; then + ACLOBJS="bacl.c bacl_solaris.c" + fi + if test x${HAVE_FREEBSD_OS_TRUE} = x; then + ACLOBJS="bacl.c bacl_freebsd.c" + fi + if test x${HAVE_DARWIN_OS_TRUE} = x; then + ACLOBJS="bacl.c bacl_osx.c" + fi fi - if test $have_extended_acl = yes; then - AC_DEFINE([HAVE_EXTENDED_ACL],1,[Extended acl support]) + AC_DEFINE([HAVE_EXTENDED_ACL],1,[Extended acl support]) fi fi fi +AC_SUBST(ACLOBJS) dnl dnl Check for XATTR support @@ -2903,15 +2914,32 @@ if test x$support_xattr = xyes -o x$support_xattr = xauto; then fi fi +XATTROBJS= if test x$support_xattr = xyes -a $have_xattr != yes; then AC_MSG_ERROR([xattr support explicitly enabled but no supported xattr implementation found, please either load the xattr libraries or rerun configure without --enable-xattr]) else if test $have_xattr = yes; then - AC_DEFINE([HAVE_XATTR],1,[Extended Attributes support]) + AC_DEFINE([HAVE_XATTR],1,[Extended Attributes support]) + dnl + dnl Prepare obj building + dnl + if test x${HAVE_LINUX_OS_TRUE} = x; then + XATTROBJS="bxattr.c bxattr_linux.c" + fi + if test x${HAVE_SUN_OS_TRUE} = x; then + XATTROBJS="bxattr.c bxattr_solaris.c" + fi + if test x${HAVE_FREEBSD_OS_TRUE} = x; then + XATTROBJS="bxattr.c bxattr_freebsd.c" + fi + if test x${HAVE_DARWIN_OS_TRUE} = x; then + XATTROBJS="bxattr.c bxattr_osx.c" + fi fi fi fi +AC_SUBST(XATTROBJS) dnl dnl Check for pthread libraries diff --git a/bacula/configure b/bacula/configure index 0ed31eb02f..34b79f6f72 100755 --- a/bacula/configure +++ b/bacula/configure @@ -648,6 +648,8 @@ DINCLUDE DEBUG FDLIBS CAP_LIBS +XATTROBJS +ACLOBJS LZO_LIBS LZO_INC AFS_LIBS @@ -29858,8 +29860,7 @@ fi ac_fn_c_check_func "$LINENO" "acl_get_file" "ac_cv_func_acl_get_file" if test "x$ac_cv_func_acl_get_file" = xyes; then : - have_acl=yes - + have_acl=yes fi @@ -29903,24 +29904,22 @@ fi $as_echo "$ac_cv_lib_acl_acl_get_file" >&6; } if test "x$ac_cv_lib_acl_acl_get_file" = xyes; then : - have_acl=yes - if test $have_afs = yes; then - if test -d /usr/lib64/; then - FDLIBS="-L/usr/lib64 -lacl $FDLIBS" - else - FDLIBS="-L/usr/lib -lacl $FDLIBS" - fi - else - FDLIBS="-lacl $FDLIBS" - fi - + have_acl=yes + if test $have_afs = yes; then + if test -d /usr/lib64/; then + FDLIBS="-L/usr/lib64 -lacl $FDLIBS" + else + FDLIBS="-L/usr/lib -lacl $FDLIBS" + fi + else + FDLIBS="-lacl $FDLIBS" + fi fi fi - if test $have_acl = no -a \ - x${HAVE_OSF1_OS_TRUE} = x; then + if test $have_acl = no -a x${HAVE_OSF1_OS_TRUE} = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_get_file in -lpacl" >&5 $as_echo_n "checking for acl_get_file in -lpacl... " >&6; } if ${ac_cv_lib_pacl_acl_get_file+:} false; then : @@ -29959,9 +29958,8 @@ fi $as_echo "$ac_cv_lib_pacl_acl_get_file" >&6; } if test "x$ac_cv_lib_pacl_acl_get_file" = xyes; then : - have_acl=yes - FDLIBS="-lpacl $FDLIBS" - + have_acl=yes + FDLIBS="-lpacl $FDLIBS" fi @@ -29973,16 +29971,15 @@ $as_echo_n "checking for ACL_TYPE_DEFAULT_DIR in acl.h include file... " >&6; } $as_echo "#define HAVE_ACL_TYPE_DEFAULT_DIR 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi - if test $have_acl = yes -a \ - x${HAVE_DARWIN_OS_TRUE} = x; then + if test $have_acl = yes -a x${HAVE_DARWIN_OS_TRUE} = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ACL_TYPE_EXTENDED in acl.h include file" >&5 $as_echo_n "checking for ACL_TYPE_EXTENDED in acl.h include file... " >&6; } grep ACL_TYPE_EXTENDED /usr/include/sys/acl.h > /dev/null 2>&1 @@ -29990,16 +29987,16 @@ $as_echo_n "checking for ACL_TYPE_EXTENDED in acl.h include file... " >&6; } $as_echo "#define HAVE_ACL_TYPE_EXTENDED 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test $have_acl = yes -a \ - x${HAVE_FREEBSD_OS_TRUE} = x; then + x${HAVE_FREEBSD_OS_TRUE} = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ACL_TYPE_NFS4 in acl.h include file" >&5 $as_echo_n "checking for ACL_TYPE_NFS4 in acl.h include file... " >&6; } grep ACL_TYPE_NFS4 /usr/include/sys/acl.h > /dev/null 2>&1 @@ -30007,16 +30004,16 @@ $as_echo_n "checking for ACL_TYPE_NFS4 in acl.h include file... " >&6; } $as_echo "#define HAVE_ACL_TYPE_NFS4 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test $have_acl = no -a \ - x${HAVE_SUN_OS_TRUE} = x; then + x${HAVE_SUN_OS_TRUE} = x; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acltotext in -lsec" >&5 $as_echo_n "checking for acltotext in -lsec... " >&6; } if ${ac_cv_lib_sec_acltotext+:} false; then : @@ -30055,10 +30052,10 @@ fi $as_echo "$ac_cv_lib_sec_acltotext" >&6; } if test "x$ac_cv_lib_sec_acltotext" = xyes; then : - have_acl=yes - FDLIBS="-lsec $FDLIBS" + have_acl=yes + FDLIBS="-lsec $FDLIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_totext in -lsec" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_totext in -lsec" >&5 $as_echo_n "checking for acl_totext in -lsec... " >&6; } if ${ac_cv_lib_sec_acl_totext+:} false; then : $as_echo_n "(cached) " >&6 @@ -30096,7 +30093,7 @@ fi $as_echo "$ac_cv_lib_sec_acl_totext" >&6; } if test "x$ac_cv_lib_sec_acl_totext" = xyes; then : - have_extended_acl=yes + have_extended_acl=yes fi @@ -30128,6 +30125,7 @@ fi fi +ACLOBJS= if test x$support_acl = xyes -a $have_acl != yes; then as_fn_error $? "acl support explicitly enabled but no supported acl implementation found, please either load the acl libraries or rerun configure without --enable-acl" "$LINENO" 5 @@ -30136,8 +30134,19 @@ fi $as_echo "#define HAVE_ACL 1" >>confdefs.h + if test x${HAVE_LINUX_OS_TRUE} = x; then + ACLOBJS="bacl.c bacl_linux.c" + fi + if test x${HAVE_SUN_OS_TRUE} = x; then + ACLOBJS="bacl.c bacl_solaris.c" + fi + if test x${HAVE_FREEBSD_OS_TRUE} = x; then + ACLOBJS="bacl.c bacl_freebsd.c" + fi + if test x${HAVE_DARWIN_OS_TRUE} = x; then + ACLOBJS="bacl.c bacl_osx.c" + fi fi - if test $have_extended_acl = yes; then $as_echo "#define HAVE_EXTENDED_ACL 1" >>confdefs.h @@ -30146,6 +30155,7 @@ $as_echo "#define HAVE_EXTENDED_ACL 1" >>confdefs.h fi fi + support_xattr=auto # Check whether --enable-xattr was given. if test "${enable_xattr+set}" = set; then : @@ -30586,6 +30596,7 @@ done fi fi +XATTROBJS= if test x$support_xattr = xyes -a $have_xattr != yes; then as_fn_error $? "xattr support explicitly enabled but no supported xattr implementation found, please either load the xattr libraries or rerun configure without --enable-xattr" "$LINENO" 5 @@ -30594,10 +30605,23 @@ done $as_echo "#define HAVE_XATTR 1" >>confdefs.h + if test x${HAVE_LINUX_OS_TRUE} = x; then + XATTROBJS="bxattr.c bxattr_linux.c" + fi + if test x${HAVE_SUN_OS_TRUE} = x; then + XATTROBJS="bxattr.c bxattr_solaris.c" + fi + if test x${HAVE_FREEBSD_OS_TRUE} = x; then + XATTROBJS="bxattr.c bxattr_freebsd.c" + fi + if test x${HAVE_DARWIN_OS_TRUE} = x; then + XATTROBJS="bxattr.c bxattr_osx.c" + fi fi fi fi + PTHREAD_LIB="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } diff --git a/bacula/src/filed/Makefile.in b/bacula/src/filed/Makefile.in index 643f410267..6c8ace6b3d 100644 --- a/bacula/src/filed/Makefile.in +++ b/bacula/src/filed/Makefile.in @@ -25,6 +25,8 @@ GETTEXT_LIBS = @LIBINTL@ AFS_CFLAGS = @AFS_CFLAGS@ AFS_LIBS = @AFS_LIBS@ +ACLOBJS = @ACLOBJS@ +XATTROBJS=@XATTROBJS@ first_rule: all dummy: @@ -35,8 +37,8 @@ SVRSRCS = filed.c authenticate.c backup.c crypto.c \ fd_plugins.c accurate.c \ filed_conf.c heartbeat.c hello.c job.c fd_snapshot.c \ restore.c status.c verify.c verify_vol.c \ - bacl.c bacl_linux.c bacl_osx.c bacl_solaris.c bacl_freebsd.c \ - bxattr.c bxattr_linux.c bxattr_osx.c bxattr_solaris.c bxattr_freebsd.c + $(ACLOBJS) $(XATTROBJS) + SVROBJS = $(SVRSRCS:.c=.o) JSONOBJS = bfdjson.o filed_conf.o