diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2021-12-10 01:35:03 -0500 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2021-12-10 01:35:59 -0500 |
commit | 18850c5c889bd48e0caeddf719bcf05c2029b95f (patch) | |
tree | 386ac9d67d842bd8dd606e21f5365e78321f37d5 | |
parent | 8a535e7e064b0c33c3b60a92df88b349d79b94c2 (diff) | |
download | lighttpd-git-18850c5c889bd48e0caeddf719bcf05c2029b95f.tar.gz |
[build] check getxattr before attr_get and -lattr
check getxattr before attr_get and -lattr;
do not link with -lattr if getxattr is available from glibc
(modern glibc systems do not require libattr-devel build dependency)
-rw-r--r-- | configure.ac | 23 | ||||
-rw-r--r-- | src/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/config.h.cmake | 2 | ||||
-rw-r--r-- | src/meson.build | 9 |
4 files changed, 31 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac index 698e4191..edc4883c 100644 --- a/configure.ac +++ b/configure.ac @@ -489,16 +489,6 @@ AC_MSG_RESULT([$WITH_ATTR]) if test "$WITH_ATTR" != no; then have_xattr=no - # libattr (linux only?) - AC_CHECK_LIB([attr], [attr_get], [ - AC_CHECK_HEADERS([attr/attributes.h], [ - ATTR_LIB=-lattr - AC_DEFINE([HAVE_XATTR], [1], [libattr]) - AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1]) - have_xattr=yes - ]) - ]) - AC_SUBST([ATTR_LIB]) # Linux getxattr AC_CHECK_FUNC([getxattr], [ @@ -518,6 +508,19 @@ if test "$WITH_ATTR" != no; then ]) ]) + # libattr (linux only?) + if test "$have_xattr" = no; then + AC_CHECK_LIB([attr], [attr_get], [ + AC_CHECK_HEADERS([attr/attributes.h], [ + ATTR_LIB=-lattr + AC_DEFINE([HAVE_XATTR], [1], [libattr]) + AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1]) + have_xattr=yes + ]) + ]) + fi + AC_SUBST([ATTR_LIB]) + if test "$have_xattr" = no; then AC_MSG_ERROR([no backend found implementing extended attributes]) fi diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9aa9b339..67b3821c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -272,9 +272,13 @@ endmacro(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags) if(WITH_XATTR) check_include_files("sys/types.h;sys/xattr.h" HAVE_SYS_XATTR_H) check_function_exists(getxattr HAVE_XATTR) - check_include_files("sys/types.h;attr/attributes.h" HAVE_ATTR_ATTRIBUTES_H) - if(HAVE_ATTR_ATTRIBUTES_H) - check_library_exists(attr attr_get "" HAVE_XATTR) + check_include_files("sys/types.h;sys/extattr.h" HAVE_SYS_EXTATTR_H) + check_function_exists(extattr_get_file HAVE_EXTATTR) + if(NOT HAVE_XATTR AND NOT HAVE_EXTATTR) + check_include_files("sys/types.h;attr/attributes.h" HAVE_ATTR_ATTRIBUTES_H) + if(HAVE_ATTR_ATTRIBUTES_H) + check_library_exists(attr attr_get "" HAVE_XATTR) + endif() endif() else() unset(HAVE_ATTR_ATTRIBUTES_H) diff --git a/src/config.h.cmake b/src/config.h.cmake index fbcc385a..9465925d 100644 --- a/src/config.h.cmake +++ b/src/config.h.cmake @@ -39,6 +39,8 @@ #cmakedefine HAVE_ATTR_ATTRIBUTES_H #cmakedefine HAVE_SYS_XATTR_H #cmakedefine HAVE_XATTR +#cmakedefine HAVE_SYS_EXTATTR_H +#cmakedefine HAVE_EXTATTR /* mySQL */ #cmakedefine HAVE_MYSQL_H diff --git a/src/meson.build b/src/meson.build index 32624599..ac5dfa3f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -656,6 +656,15 @@ if get_option('with_xattr') ) conf_data.set('HAVE_SYS_XATTR_H', true) conf_data.set('HAVE_XATTR', true) + elif compiler.has_function('extattr_get_file', + args: defs, + prefix: ''' + #include <sys/types.h> + #include <sys/extattr.h> + ''' + ) + conf_data.set('HAVE_SYS_EXTATTR_H', true) + conf_data.set('HAVE_EXTATTR', true) else libattr = [ compiler.find_library('attr') ] if not(compiler.has_function('attr_get', |