about summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-03-08 20:20:47 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-03-08 20:20:47 +0000
commit6594c0375b91c3aa1bd991c30ae50197a6d889d4 (patch)
tree02d80eee3e6b6b962aba6fab9377584234a6f490 /configure.ac
parentd968acfacd3db570a4275f8abfc5804024230bd3 (diff)
downloadzsh-6594c0375b91c3aa1bd991c30ae50197a6d889d4.tar.gz
zsh-6594c0375b91c3aa1bd991c30ae50197a6d889d4.tar.xz
zsh-6594c0375b91c3aa1bd991c30ae50197a6d889d4.zip
26697: test for Linux- and Mac-style xattr functions
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac43
1 files changed, 43 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 136086545..296172224 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1251,6 +1251,49 @@ if test x$dynamic = xyes; then
 		shl_load shl_unload shl_findsym)
 fi
 
+AH_TEMPLATE([XATTR_EXTRA_ARGS],
+Define if getxattr() etc. require additional MacOS-style arguments)
+if test x$ac_cv_func_getxattr = xyes && test x$ac_cv_header_sys_xattr_h = xyes
+then
+  AC_CACHE_CHECK(if getxattr etc. are Linux-like,
+  zsh_cv_getxattr_linux,
+  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <sys/xattr.h>]],
+  [[
+  (void)listxattr("", 0, 0);
+  (void)getxattr("", "", 0, 0);
+  (void)setxattr("", "", "", 0, 0);
+  (void)removexattr("", "");
+  ]])],
+  [zsh_cv_getxattr_linux=yes],
+  [zsh_cv_getxattr_linux=no])])
+
+  if test x$zsh_cv_getxattr_linux != xyes; then
+    AC_CACHE_CHECK(if getxattr etc. are MAC-like,
+    zsh_cv_getxattr_mac,
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#include <sys/xattr.h>]],
+    [[(void)listxattr("", 0, 0, 0);
+    (void)getxattr("", "", 0, 0, 0, 0);
+    (void)setxattr("", "", "", 0, 0, 0);
+    (void)removexattr("", "", 0);]])],
+    [zsh_cv_getxattr_mac=yes],
+    [zsh_cv_getxattr_mac=no])])
+
+    if test x$zsh_cv_getxattr_mac = xyes; then
+      AC_DEFINE(XATTR_EXTRA_ARGS)
+    fi
+  fi
+fi
+
+AC_CACHE_CHECK(if getxattr etc. are usable,
+zsh_cv_use_xattr,
+[if test x$zsh_cv_getxattr_linux = xyes || test x$zsh_cv_getxattr_mac = xyes
+then
+zsh_cv_use_xattr=yes
+else
+zsh_cv_use_xattr=no
+fi])
 
 dnl -------------
 dnl CHECK SIGNALS