+dnl CURL_CHECK_FUNC_FREMOVEXATTR
+dnl -------------------------------------------------
+dnl Verify if fremovexattr 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_fremovexattr, then
+dnl HAVE_FREMOVEXATTR will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_FREMOVEXATTR], [
+ AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
+ #
+ tst_links_fremovexattr="unknown"
+ tst_proto_fremovexattr="unknown"
+ tst_compi_fremovexattr="unknown"
+ tst_allow_fremovexattr="unknown"
+ tst_nargs_fremovexattr="unknown"
+ #
+ AC_MSG_CHECKING([if fremovexattr can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_FUNC_LINK_TRY([fremovexattr])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_fremovexattr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_fremovexattr="no"
+ ])
+ #
+ if test "$tst_links_fremovexattr" = "yes"; then
+ AC_MSG_CHECKING([if fremovexattr is prototyped])
+ AC_EGREP_CPP([fremovexattr],[
+ $curl_includes_sys_xattr
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_fremovexattr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_fremovexattr="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_fremovexattr" = "yes"; then
+ if test "$tst_nargs_fremovexattr" = "unknown"; then
+ AC_MSG_CHECKING([if fremovexattr takes 2 args.])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_sys_xattr
+ ]],[[
+ if(0 != fremovexattr(0, 0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_fremovexattr="yes"
+ tst_nargs_fremovexattr="2"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_fremovexattr="no"
+ ])
+ fi
+ if test "$tst_nargs_fremovexattr" = "unknown"; then
+ AC_MSG_CHECKING([if fremovexattr takes 3 args.])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_sys_xattr
+ ]],[[
+ if(0 != fremovexattr(0, 0, 0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_fremovexattr="yes"
+ tst_nargs_fremovexattr="3"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_fremovexattr="no"
+ ])
+ fi
+ AC_MSG_CHECKING([if fremovexattr is compilable])
+ if test "$tst_compi_fremovexattr" = "yes"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+ #
+ if test "$tst_compi_fremovexattr" = "yes"; then
+ AC_MSG_CHECKING([if fremovexattr usage allowed])
+ if test "x$curl_disallow_fremovexattr" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_fremovexattr="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_fremovexattr="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if fremovexattr might be used])
+ if test "$tst_links_fremovexattr" = "yes" &&
+ test "$tst_proto_fremovexattr" = "yes" &&
+ test "$tst_compi_fremovexattr" = "yes" &&
+ test "$tst_allow_fremovexattr" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_FREMOVEXATTR, 1,
+ [Define to 1 if you have the fremovexattr function.])
+ dnl AC_DEFINE_UNQUOTED(FREMOVEXATTR_ARGS, $tst_nargs_fremovexattr,
+ dnl [Specifies the number of arguments to fremovexattr])
+ #
+ if test "$tst_nargs_fremovexattr" -eq "2"; then
+ AC_DEFINE(HAVE_FREMOVEXATTR_2, 1, [fremovexattr() takes 2 args])
+ elif test "$tst_nargs_fremovexattr" -eq "3"; then
+ AC_DEFINE(HAVE_FREMOVEXATTR_3, 1, [fremovexattr() takes 3 args])
+ fi
+ #
+ ac_cv_func_fremovexattr="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_fremovexattr="no"
+ fi
+])
+
+
+dnl CURL_CHECK_FUNC_FSETXATTR
+dnl -------------------------------------------------
+dnl Verify if fsetxattr 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_fsetxattr, then
+dnl HAVE_FSETXATTR will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_FSETXATTR], [
+ AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
+ #
+ tst_links_fsetxattr="unknown"
+ tst_proto_fsetxattr="unknown"
+ tst_compi_fsetxattr="unknown"
+ tst_allow_fsetxattr="unknown"
+ tst_nargs_fsetxattr="unknown"
+ #
+ AC_MSG_CHECKING([if fsetxattr can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_FUNC_LINK_TRY([fsetxattr])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_fsetxattr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_fsetxattr="no"
+ ])
+ #
+ if test "$tst_links_fsetxattr" = "yes"; then
+ AC_MSG_CHECKING([if fsetxattr is prototyped])
+ AC_EGREP_CPP([fsetxattr],[
+ $curl_includes_sys_xattr
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_fsetxattr="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_fsetxattr="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_fsetxattr" = "yes"; then
+ if test "$tst_nargs_fsetxattr" = "unknown"; then
+ AC_MSG_CHECKING([if fsetxattr takes 5 args.])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_sys_xattr
+ ]],[[
+ if(0 != fsetxattr(0, 0, 0, 0, 0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_fsetxattr="yes"
+ tst_nargs_fsetxattr="5"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_fsetxattr="no"
+ ])
+ fi
+ if test "$tst_nargs_fsetxattr" = "unknown"; then
+ AC_MSG_CHECKING([if fsetxattr takes 6 args.])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_sys_xattr
+ ]],[[
+ if(0 != fsetxattr(0, 0, 0, 0, 0, 0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_fsetxattr="yes"
+ tst_nargs_fsetxattr="6"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_fsetxattr="no"
+ ])
+ fi
+ AC_MSG_CHECKING([if fsetxattr is compilable])
+ if test "$tst_compi_fsetxattr" = "yes"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+ #
+ if test "$tst_compi_fsetxattr" = "yes"; then
+ AC_MSG_CHECKING([if fsetxattr usage allowed])
+ if test "x$curl_disallow_fsetxattr" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_fsetxattr="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_fsetxattr="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if fsetxattr might be used])
+ if test "$tst_links_fsetxattr" = "yes" &&
+ test "$tst_proto_fsetxattr" = "yes" &&
+ test "$tst_compi_fsetxattr" = "yes" &&
+ test "$tst_allow_fsetxattr" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_FSETXATTR, 1,
+ [Define to 1 if you have the fsetxattr function.])
+ dnl AC_DEFINE_UNQUOTED(FSETXATTR_ARGS, $tst_nargs_fsetxattr,
+ dnl [Specifies the number of arguments to fsetxattr])
+ #
+ if test "$tst_nargs_fsetxattr" -eq "5"; then
+ AC_DEFINE(HAVE_FSETXATTR_5, 1, [fsetxattr() takes 5 args])
+ elif test "$tst_nargs_fsetxattr" -eq "6"; then
+ AC_DEFINE(HAVE_FSETXATTR_6, 1, [fsetxattr() takes 6 args])
+ fi
+ #
+ ac_cv_func_fsetxattr="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_fsetxattr="no"
+ fi
+])
+
+