summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2010-11-05 14:07:38 +0100
committerDaniel Stenberg <daniel@haxx.se>2010-11-05 14:07:38 +0100
commit95719fbea6acf52d03b17de742f16be8f1f0ce70 (patch)
tree00092046ba3080c7813dff31bd6d3155a83fe326 /m4
parentfbf51696ef1435cf358943c671ac55944ccec26c (diff)
downloadcurl-95719fbea6acf52d03b17de742f16be8f1f0ce70.tar.gz
xattr: add configure check and #ifdefs
setxattr is a glibc call to set extended attributes, so configure now checks for it and the code is adapted to only build when the functionality is present.
Diffstat (limited to 'm4')
-rw-r--r--m4/curl-functions.m484
1 files changed, 84 insertions, 0 deletions
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index 36bd31c49..3673e5300 100644
--- a/m4/curl-functions.m4
+++ b/m4/curl-functions.m4
@@ -5903,3 +5903,87 @@ AC_DEFUN([CURL_CHECK_FUNC_WRITEV], [
ac_cv_func_writev="no"
fi
])
+
+dnl CURL_CHECK_FUNC_SETXATTR
+dnl -------------------------------------------------
+dnl Verify if setxattr is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_setxattr, then
+dnl HAVE_SETXATTR will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_SETXATTR], [
+ AC_REQUIRE([CURL_INCLUDES_SYS_UIO])dnl
+ #
+ tst_links_setxattr="unknown"
+ tst_proto_setxattr="unknown"
+ tst_compi_setxattr="unknown"
+ tst_allow_setxattr="unknown"
+ #
+ AC_MSG_CHECKING([if setxattr can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_FUNC_LINK_TRY([setxattr])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_setxattr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_setxattr="no"
+ ])
+ #
+ if test "$tst_links_setxattr" = "yes"; then
+ AC_MSG_CHECKING([if setxattr is prototyped])
+ AC_EGREP_CPP([setxattr],[
+ $curl_includes_sys_uio
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_setxattr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_setxattr="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_setxattr" = "yes"; then
+ AC_MSG_CHECKING([if setxattr is compilable])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_sys_uio
+ ]],[[
+ if(0 != setxattr(0, 0, 0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_setxattr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_setxattr="no"
+ ])
+ fi
+ #
+ if test "$tst_compi_setxattr" = "yes"; then
+ AC_MSG_CHECKING([if setxattr usage allowed])
+ if test "x$curl_disallow_setxattr" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_setxattr="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_setxattr="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if setxattr might be used])
+ if test "$tst_links_setxattr" = "yes" &&
+ test "$tst_proto_setxattr" = "yes" &&
+ test "$tst_compi_setxattr" = "yes" &&
+ test "$tst_allow_setxattr" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_SETXATTR, 1,
+ [Define to 1 if you have the setxattr function.])
+ ac_cv_func_setxattr="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_setxattr="no"
+ fi
+])