1 # acl.m4 - check for access control list (ACL) primitives
3 # Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
8 # Written by Paul Eggert and Jim Meyering.
10 AC_DEFUN([AC_FUNC_ACL],
14 dnl Prerequisites of lib/acl.c.
15 AC_CHECK_HEADERS(sys/acl.h)
18 AC_SEARCH_LIBS(acl_get_file, acl,
19 [test "$ac_cv_search_acl_get_file" = "none required" ||
20 LIB_ACL=$ac_cv_search_acl_get_file])
22 AC_CHECK_HEADERS(acl/libacl.h)
23 AC_CHECK_FUNCS(acl_get_file acl_get_fd acl_set_file acl_set_fd \
24 acl_free acl_from_mode acl_from_text acl_to_text \
25 acl_delete_def_file acl_entries acl_extended_file)
26 if test "$ac_cv_header_sys_acl_h" = yes; then
28 if test "$ac_cv_func_acl_get_file" = yes; then
29 # If we detect the acl_get_file bug, disable ACL support altogether.
30 gl_ACL_GET_FILE( , [use_acl=0])
36 AC_DEFINE_UNQUOTED(USE_ACL, $use_acl,
37 [Define if you want access control list support.])
40 # gl_ACL_GET_FILE(IF-WORKS, IF-NOT)
41 # -------------------------------------
42 # If `acl_get_file' works (does not have a particular bug),
43 # run IF-WORKS, otherwise, IF-NOT.
44 # This tests for a Darwin 8.7.0 bug, whereby acl_get_file returns NULL,
45 # but sets errno = ENOENT for an existing file or directory.
46 AC_DEFUN([gl_ACL_GET_FILE],
48 AC_CACHE_CHECK([for working acl_get_file], gl_cv_func_working_acl_get_file,
51 [[#include <sys/types.h>
55 [[return !! (!acl_get_file (".", ACL_TYPE_ACCESS)
56 || errno == ENOENT);]])],
57 [gl_cv_func_working_acl_get_file=yes],
58 [gl_cv_func_working_acl_get_file=no],
59 [gl_cv_func_working_acl_get_file=cross-compiling])])
61 AS_IF([test $gl_cv_func_working_acl_get_file = yes], [$1], [$2])