Warning, /frameworks/kio/cmake/FindACL.cmake is written in an unsupported language. File is not indexed.

0001 # - Determine if system supports ACLs.
0002 # Once done this will define
0003 #
0004 #  ACL_FOUND - system has the ACL feature
0005 #  ACL_LIBS - The libraries needed to use ACL
0006 
0007 # SPDX-FileCopyrightText: 2006 Pino Toscano <toscano.pino@tiscali.it>
0008 #
0009 # SPDX-License-Identifier: BSD-3-Clause
0010 
0011 include(CheckIncludeFiles)
0012 
0013 check_include_files(attr/libattr.h HAVE_ATTR_LIBATTR_H)
0014 check_include_files(sys/xattr.h HAVE_SYS_XATTR_H)
0015 check_include_files(sys/acl.h HAVE_SYS_ACL_H)
0016 check_include_files(acl/libacl.h HAVE_ACL_LIBACL_H)
0017 check_include_files("sys/types.h;sys/extattr.h" HAVE_SYS_EXTATTR_H)
0018 
0019 if ((HAVE_ATTR_LIBATTR_H AND HAVE_SYS_XATTR_H AND HAVE_SYS_ACL_H AND HAVE_ACL_LIBACL_H)
0020     OR HAVE_SYS_EXTATTR_H)
0021    set(ACL_HEADERS_FOUND TRUE)
0022 endif ()
0023 
0024 find_library(ACL_LIBS NAMES acl )
0025 find_library(ATTR_LIBS NAMES attr )
0026 
0027 if (ACL_LIBS AND ATTR_LIBS)
0028    set(ACL_LIBS_FOUND TRUE)
0029 endif()
0030 
0031 # FreeBSD has ACL bits in its libc, so no extra libraries are required
0032 if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
0033    set(ACL_LIBS "" CACHE STRING "" FORCE)
0034    set(ATTR_LIBS "" CACHE STRING "" FORCE)
0035    set(ACL_LIBS_FOUND TRUE)
0036 endif()
0037 
0038 # Now check for non-POSIX acl_*() functions we are requiring
0039 include(CheckSymbolExists)
0040 
0041 set(_required_headers)
0042 if (HAVE_SYS_ACL_H)
0043    list(APPEND _required_headers "sys/types.h" "sys/acl.h")
0044 endif()
0045 if (HAVE_ACL_LIBACL_H)
0046    list(APPEND _required_headers "acl/libacl.h")
0047 endif()
0048 
0049 set(CMAKE_REQUIRED_LIBRARIES ${ACL_LIBS})
0050 
0051 check_symbol_exists(acl_cmp "${_required_headers}" HAVE_ACL_CMP)
0052 check_symbol_exists(acl_from_mode "${_required_headers}" HAVE_ACL_FROM_MODE)
0053 check_symbol_exists(acl_equiv_mode "${_required_headers}" HAVE_ACL_EQUIV_MODE)
0054 check_symbol_exists(acl_extended_file "${_required_headers}" HAVE_ACL_EXTENDED_FILE)
0055 check_symbol_exists(acl_get_perm "${_required_headers}" HAVE_ACL_GET_PERM)
0056 
0057 check_symbol_exists(acl_cmp_np "${_required_headers}" HAVE_ACL_CMP_NP)
0058 check_symbol_exists(acl_from_mode_np "${_required_headers}" HAVE_ACL_FROM_MODE_NP)
0059 check_symbol_exists(acl_equiv_mode_np "${_required_headers}" HAVE_ACL_EQUIV_MODE_NP)
0060 check_symbol_exists(acl_extended_file_np "${_required_headers}" HAVE_ACL_EXTENDED_FILE_NP)
0061 check_symbol_exists(acl_get_perm_np "${_required_headers}" HAVE_ACL_GET_PERM_NP)
0062 
0063 if (HAVE_ACL_CMP AND HAVE_ACL_FROM_MODE AND HAVE_ACL_EQUIV_MODE
0064    AND HAVE_ACL_EXTENDED_FILE AND HAVE_ACL_GET_PERM)
0065    set(ACL_NONSTANDARD_FUNCS_FOUND TRUE)
0066 endif()
0067 
0068 if (HAVE_ACL_CMP_NP AND HAVE_ACL_FROM_MODE_NP AND HAVE_ACL_EQUIV_MODE_NP
0069    AND HAVE_ACL_EXTENDED_FILE_NP AND HAVE_ACL_GET_PERM_NP)
0070    set(ACL_NONSTANDARD_FUNCS_FOUND TRUE)
0071 endif()
0072 
0073 if (ACL_HEADERS_FOUND AND ACL_LIBS_FOUND AND ACL_NONSTANDARD_FUNCS_FOUND)
0074    set(ACL_FOUND TRUE)
0075    set(ACL_LIBS ${ACL_LIBS} ${ATTR_LIBS})
0076    message(STATUS "Found ACL support: ${ACL_LIBS}")
0077 endif ()
0078 
0079 mark_as_advanced(ACL_LIBS  ATTR_LIBS)