• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/timemachine/gettext-0.17/gettext-tools/gnulib-m4/
1# acl.m4 - check for access control list (ACL) primitives
2
3# Copyright (C) 2002, 2004, 2005, 2006, 2007 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.
7
8# Written by Paul Eggert and Jim Meyering.
9
10AC_DEFUN([AC_FUNC_ACL],
11[
12  AC_LIBOBJ([acl])
13  AC_LIBOBJ([file-has-acl])
14
15  dnl Prerequisites of lib/acl.c.
16  AC_CHECK_HEADERS(sys/acl.h)
17  AC_CHECK_FUNCS(acl)
18  ac_save_LIBS="$LIBS"
19    AC_SEARCH_LIBS(acl_get_file, acl,
20		   [test "$ac_cv_search_acl_get_file" = "none required" ||
21		    LIB_ACL=$ac_cv_search_acl_get_file])
22    AC_SUBST(LIB_ACL)
23    AC_CHECK_HEADERS(acl/libacl.h)
24    AC_CHECK_FUNCS(acl_get_file acl_get_fd acl_set_file acl_set_fd \
25		   acl_free acl_from_mode acl_from_text \
26		   acl_delete_def_file acl_extended_file)
27    if test $ac_cv_header_sys_acl_h = yes; then
28      use_acl=1
29      if test $ac_cv_func_acl_get_file = yes; then
30	# If we detect the acl_get_file bug, disable ACL support altogether.
31	gl_ACL_GET_FILE( , [use_acl=0])
32      fi
33    else
34      use_acl=0
35    fi
36    if test $use_acl = 1 &&
37       test $ac_cv_func_acl_get_file = yes &&
38       test $ac_cv_func_acl_free = yes; then
39      AC_REPLACE_FUNCS([acl_entries])
40    fi
41  LIBS="$ac_save_LIBS"
42  if test $use_acl = 1; then
43    ac_save_LIBS="$LIBS"
44    AC_SEARCH_LIBS([acl_trivial], [sec],
45      [AC_DEFINE([HAVE_ACL_TRIVIAL], 1,
46	 [Define to 1 if you have the `acl_trivial' function.])
47       test "$ac_cv_search_acl_trivial" = "none required" ||
48       LIB_ACL_TRIVIAL="$ac_cv_search_acl_trivial"])
49    AC_SUBST([LIB_ACL_TRIVIAL])
50    LIBS="$ac_save_LIBS"
51  fi
52  AC_DEFINE_UNQUOTED(USE_ACL, $use_acl,
53		     [Define if you want access control list support.])
54])
55
56# gl_ACL_GET_FILE(IF-WORKS, IF-NOT)
57# -------------------------------------
58# If `acl_get_file' works (does not have a particular bug),
59# run IF-WORKS, otherwise, IF-NOT.
60# This tests for a Darwin 8.7.0 bug, whereby acl_get_file returns NULL,
61# but sets errno = ENOENT for an existing file or directory.
62AC_DEFUN([gl_ACL_GET_FILE],
63[
64  AC_CACHE_CHECK([for working acl_get_file], gl_cv_func_working_acl_get_file,
65    [AC_RUN_IFELSE(
66       [AC_LANG_PROGRAM(
67	  [[#include <sys/types.h>
68	   #include <sys/acl.h>
69	   #include <errno.h>
70	  ]],
71	  [[return !! (!acl_get_file (".", ACL_TYPE_ACCESS)
72		       && errno == ENOENT);]])],
73       [gl_cv_func_working_acl_get_file=yes],
74       [gl_cv_func_working_acl_get_file=no],
75       [gl_cv_func_working_acl_get_file=cross-compiling])])
76
77  AS_IF([test $gl_cv_func_working_acl_get_file = yes], [$1], [$2])
78])
79