summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMartin Matuska <martin@matuska.org>2017-03-13 15:49:38 +0100
committerMartin Matuska <martin@matuska.org>2017-03-14 12:48:53 +0100
commitf57d129d828f411d6f1eb81ca51dfd9e1fead353 (patch)
tree2683fbe533ae01206a3e0a2365ae2d263eb5e697 /configure.ac
parent500b90526996eb64b9cb5a02ac9de61f0a2ec14f (diff)
downloadlibarchive-f57d129d828f411d6f1eb81ca51dfd9e1fead353.tar.gz
Move platform-specific ACL code to individual source files.
This makes the code much more readable and eases the addition of new ACL implementatons in the future. Additional changes: - most of ACL detection is now done at configure stage - configuration now reports what ACL was detected - NFSv4 ACL tests now test INHERIT_ONLY and NO_PROPAGATE_INHERIT
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac221
1 files changed, 166 insertions, 55 deletions
diff --git a/configure.ac b/configure.ac
index 18420dc7..24e96d68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -253,6 +253,7 @@ esac
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS([acl/libacl.h])
AC_CHECK_HEADERS([copyfile.h ctype.h])
AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h grp.h])
@@ -283,10 +284,10 @@ AS_VAR_IF([ac_cv_have_decl_FS_IOC_GETFLAGS], [yes],
[AC_DEFINE_UNQUOTED([HAVE_WORKING_FS_IOC_GETFLAGS], [1],
[Define to 1 if you have a working FS_IOC_GETFLAGS])])
-AC_CHECK_HEADERS([locale.h paths.h poll.h pthread.h pwd.h])
+AC_CHECK_HEADERS([locale.h membership.h paths.h poll.h pthread.h pwd.h])
AC_CHECK_HEADERS([readpassphrase.h signal.h spawn.h])
AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h])
-AC_CHECK_HEADERS([sys/cdefs.h sys/extattr.h])
+AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/extattr.h])
AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h])
AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/statfs.h sys/statvfs.h])
AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h])
@@ -699,66 +700,176 @@ AC_ARG_ENABLE([acl],
[Disable ACL support (default: check)]))
if test "x$enable_acl" != "xno"; then
- AC_CHECK_HEADERS([acl/libacl.h])
- AC_CHECK_HEADERS([sys/acl.h])
- AC_CHECK_HEADERS([membership.h])
- AC_CHECK_LIB([acl],[acl_get_file])
- AC_CHECK_FUNCS([acl_create_entry acl_get_fd_np])
- AC_CHECK_FUNCS([acl_init acl_set_fd acl_set_fd_np acl_set_file])
-
- AC_CHECK_TYPES(acl_permset_t,,,
- [#if HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #if HAVE_SYS_ACL_H
- #include <sys/acl.h>
- #endif
- ])
+ # Libacl
+ AC_CHECK_LIB([acl], [acl_get_file])
+
+ AC_CHECK_TYPES([acl_t, acl_entry_t, acl_permset_t, acl_tag_t], [], [], [
+ #if HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #if HAVE_SYS_ACL_H
+ #include <sys/acl.h>
+ #endif
+ ])
- # The "acl_get_perm()" function was omitted from the POSIX draft.
- # (It's a pretty obvious oversight; otherwise, there's no way to
- # test for specific permissions in a permset.) Linux uses the obvious
- # name, FreeBSD adds _np to mark it as "non-Posix extension."
- # Test for both as a double-check that we really have POSIX-style ACL
- # support.
- AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm acl_get_link acl_get_link_np,,,
- [#if HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #if HAVE_SYS_ACL_H
- #include <sys/acl.h>
- #endif
- ])
+ # Solaris and derivates ACLs
+ AC_CHECK_FUNCS(acl facl)
- # Check for acl_is_trivial_np on FreeBSD
- AC_CHECK_FUNCS(acl_is_trivial_np,,,
- [#if HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #if HAVE_SYS_ACL_H
- #include <sys/acl.h>
- #endif
+ if test "x$ac_cv_func_acl" = "xyes" \
+ -a "x$ac_cv_func_facl" = "xyes"; then
+ AC_CHECK_TYPES([aclent_t], [], [], [[#include <sys/acl.h>]])
+ if test "x$ac_cv_type_aclent_t" = "xyes"; then
+ AC_CACHE_VAL([ac_cv_archive_acl_sunos],
+ [AC_CHECK_DECLS([GETACL, SETACL, GETACLCNT],
+ [ac_cv_archive_acl_sunos=yes], [ac_cv_archive_acl_sunos=no],
+ [#include <sys/acl.h>])])
+ AC_CHECK_TYPES([ace_t], [], [], [[#include <sys/acl.h>]])
+ if test "x$ac_cv_type_ace_t" = "xyes"; then
+ AC_CACHE_VAL([ac_cv_archive_acl_sunos_nfs4],
+ [AC_CHECK_DECLS([ACE_GETACL, ACE_SETACL, ACE_GETACLCNT],
+ [ac_cv_archive_acl_sunos_nfs4=yes],
+ [ac_cv_archive_acl_sonos_nfs4=no],
+ [#include <sys/acl.h>])])
+ fi
+ fi
+ elif test "x$ac_cv_type_acl_t" = "xyes" \
+ -a "x$ac_cv_type_acl_entry_t" = "xyes" \
+ -a "x$ac_cv_type_acl_permset_t" = "xyes" \
+ -a "x$ac_cv_type_acl_tag_t" = "xyes"; then
+ # POSIX.1e ACL functions
+ AC_CACHE_VAL([ac_cv_posix_acl_funcs],
+ [AC_CHECK_FUNCS(acl_add_perm \
+ acl_clear_perms \
+ acl_create_entry \
+ acl_delete_def_file \
+ acl_free \
+ acl_get_entry \
+ acl_get_fd \
+ acl_get_file \
+ acl_get_permset \
+ acl_get_qualifier \
+ acl_get_tag_type \
+ acl_init \
+ acl_set_fd \
+ acl_set_file \
+ acl_set_qualifier \
+ acl_set_tag_type,
+ [ac_cv_posix_acl_funcs=yes], [ac_cv_posix_acl_funcs=no],
+ [#if HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #if HAVE_SYS_ACL_H
+ #include <sys/acl.h>
+ #endif
+ ])
])
- # FreeBSD and POSIX
- # MacOS has no ACL_USER in acl.h
- AC_CHECK_DECLS([ACL_TYPE_NFS4, ACL_USER],
- [], [],
- [#include <sys/types.h>
- #include <sys/acl.h>])
-
- # MacOS ACL support
- AC_CHECK_DECLS([ACL_TYPE_EXTENDED, ACL_SYNCHRONIZE], [], [],
- [#include <sys/types.h>
- #include <sys/acl.h>])
+ AC_CHECK_FUNCS(acl_get_perm)
- # Solaris and derivates ACLs
- AC_CHECK_TYPES([aclent_t], [], [], [[#include <sys/acl.h>]])
- AC_CHECK_TYPES([ace_t], [], [], [[#include <sys/acl.h>]])
- AC_CHECK_FUNCS(acl facl)
- AC_CHECK_DECLS([GETACL, SETACL, GETACLCNT, ACE_GETACL, ACE_SETACL, ACE_GETACLCNT], [], [], [#include <sys/acl.h>])
+ if test "x$ac_cv_posix_acl_funcs" = "xyes" \
+ -a "x$ac_cv_header_acl_libacl_h" = "xyes" \
+ -a "x$ac_cv_lib_acl_acl_get_file" = "xyes" \
+ -a "x$ac_cv_func_acl_get_perm"; then
+ AC_CACHE_VAL([ac_cv_archive_acl_libacl],
+ [ac_cv_archive_acl_libacl=yes])
+ AC_DEFINE([ARCHIVE_ACL_LIBACL], [1],
+ [POSIX.1e ACL support via libacl])
+ else
+ # FreeBSD/Darwin
+ AC_CHECK_FUNCS(acl_add_flag_np \
+ acl_clear_flags_np \
+ acl_get_brand_np \
+ acl_get_entry_type_np \
+ acl_get_flag_np \
+ acl_get_flagset_np \
+ acl_get_fd_np \
+ acl_get_link_np \
+ acl_get_perm_np \
+ acl_is_trivial_np \
+ acl_set_entry_type_np \
+ acl_set_fd_np \
+ acl_set_link_np,,,
+ [#include <sys/types.h>
+ #include <sys/acl.h>])
+
+ AC_CHECK_FUNCS(mbr_uid_to_uuid \
+ mbr_uuid_to_id \
+ mbr_gid_to_uuid,,,
+ [#include <membership.h>])
+
+ AC_CHECK_DECLS([ACL_TYPE_EXTENDED, ACL_TYPE_NFS4, ACL_USER,
+ ACL_SYNCHRONIZE], [], [],
+ [#include <sys/types.h>
+ #include <sys/acl.h>])
+ if test "x$ac_cv_posix_acl_funcs" = "xyes" \
+ -a "x$ac_cv_func_acl_get_fd_np" = "xyes" \
+ -a "x$ac_cv_func_acl_get_perm" != "xyes" \
+ -a "x$ac_cv_func_acl_get_perm_np" = "xyes" \
+ -a "x$ac_cv_func_acl_set_fd_np" = "xyes"; then
+ if test "x$ac_cv_have_decl_ACL_USER" = "xyes"; then
+ AC_CACHE_VAL([ac_cv_archive_acl_freebsd],
+ [ac_cv_archive_acl_freebsd=yes])
+ if test "x$ac_cv_have_decl_ACL_TYPE_NFS4" = "xyes" \
+ -a "x$ac_cv_func_acl_add_flag_np" = "xyes" \
+ -a "x$ac_cv_func_acl_get_brand_np" = "xyes" \
+ -a "x$ac_cv_func_acl_get_entry_type_np" = "xyes" \
+ -a "x$ac_cv_func_acl_get_flagset_np" = "xyes" \
+ -a "x$ac_cv_func_acl_set_entry_type_np" = "xyes"; then
+ AC_CACHE_VAL([ac_cv_archive_acl_freebsd_nfs4],
+ [ac_cv_archive_acl_freebsd_nfs4=yes])
+ fi
+ elif test "x$ac_cv_have_decl_ACL_TYPE_EXTENDED" = "xyes" \
+ -a "x$ac_cv_func_acl_add_flag_np" = "xyes" \
+ -a "x$ac_cv_func_acl_get_flagset_np" = "xyes" \
+ -a "x$ac_cv_func_acl_get_link_np" = "xyes" \
+ -a "x$ac_cv_func_acl_set_link_np" = "xyes" \
+ -a "x$ac_cv_func_mbr_uid_to_uuid" = "xyes" \
+ -a "x$ac_cv_func_mbr_uuid_to_id" = "xyes" \
+ -a "x$ac_cv_func_mbr_gid_to_uuid" = "xyes"; then
+ AC_CACHE_VAL([ac_cv_archive_acl_darwin],
+ [ac_cv_archive_acl_darwin=yes])
+ fi
+ fi
+ fi
+ fi
+ AC_MSG_CHECKING([for ACL support])
+ if test "x$ac_cv_archive_acl_libacl" = "xyes"; then
+ AC_MSG_RESULT([libacl (POSIX.1e)])
+ AC_DEFINE([ARCHIVE_ACL_LIBACL], [1], [Linux ACL support via libacl])
+ elif test "x$ac_cv_archive_acl_darwin" = "xyes"; then
+ AC_DEFINE([ARCHIVE_ACL_DARWIN], [1], [Darwin ACL support])
+ AC_MSG_RESULT([Darwin (limited NFSv4)])
+ elif test "x$ac_cv_archive_acl_sunos" = "xyes"; then
+ AC_DEFINE([ARCHIVE_ACL_SUNOS], [1], [Solaris ACL support])
+ if test "x$ac_cv_archive_acl_sunos_nfs4" = "xyes"; then
+ AC_DEFINE([ARCHIVE_ACL_SUNOS_NFS4], [1],
+ [Solaris NFSv4 ACL support])
+ AC_MSG_RESULT([Solaris (POSIX.1e and NFSv4)])
+ else
+ AC_MSG_RESULT([Solaris (POSIX.1e)])
+ fi
+ elif test "x$ac_cv_archive_acl_freebsd" = "xyes"; then
+ AC_DEFINE([ARCHIVE_ACL_FREEBSD], [1], [FreeBSD ACL support])
+ if test "x$ac_cv_archive_acl_freebsd_nfs4" = "xyes"; then
+ AC_DEFINE([ARCHIVE_ACL_FREEBSD_NFS4], [1],
+ [FreeBSD NFSv4 ACL support])
+ AC_MSG_RESULT([FreeBSD (POSIX.1e and NFSv4)])
+ else
+ AC_MSG_RESULT([FreeBSD (POSIX.1e)])
+ fi
+ else
+ AC_MSG_RESULT([none])
+ fi
fi
+
+AM_CONDITIONAL([INC_LINUX_ACL], [test "x$ac_cv_archive_acl_libacl" = "xyes"])
+AM_CONDITIONAL([INC_SUNOS_ACL], [test "x$ac_cv_archive_acl_sunos" = "xyes"])
+AM_CONDITIONAL([INC_DARWIN_ACL],
+ [test "x$ac_cv_archive_acl_darwin" = "xyes"])
+AM_CONDITIONAL([INC_FREEBSD_ACL],
+ [test "x$ac_cv_archive_acl_freebsd" = "xyes"])
+
# Additional requirements
AC_SYS_LARGEFILE