Re: some gvfs code
- From: Christian Neumair <chris gnome-de org>
- To: Alexander Larsson <alexl redhat com>
- Cc: "gnome-vfs-list gnome org" <gnome-vfs-list gnome org>
- Subject: Re: some gvfs code
- Date: Sun, 08 Oct 2006 18:33:48 +0200
Am Sonntag, den 08.10.2006, 14:21 +0200 schrieb Alexander Larsson:
> On Sun, 2006-10-08 at 12:40 +0200, Christian Neumair wrote:
> > My personal preference would be to simply check for <sys/xattr.h>
> > presence, and only look for libattr if that fails to support glibc 2.2.
> > If either libattr is present, or <sys/xattr.h> is around, HAVE_XATTR
> > would be used. As claimed in a followup of [1], the glibc syscalls are
> > stubbed out for operating systems not supporting xattrs, and will return
> > ENOSYS.
>
> Sounds good to me. Wanna hack it up?
Proposed patch attached.
--
Christian Neumair <chris gnome-de org>
diff --git a/INSTALL b/INSTALL
diff --git a/README b/README
diff --git a/configure.ac b/configure.ac
index 1c59f3f..ff72a02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,12 +68,35 @@ msg_xattr=no
XATTR_LIBS=
if test "x$enable_xattr" != "xno"; then
+dnl either glibc or libattr can provide xattr support
+
+dnl for both of them, we check for getxattr being in
+dnl the library and a valid xattr header.
+
+dnl try glibc
AC_CHECK_LIB(c, getxattr,
- [AC_CHECK_HEADERS(attr/xattr.h,
+ [AC_CHECK_HEADERS(sys/xattr.h,
[AC_DEFINE(HAVE_XATTR, 1, [Define to 1 if xattr is available])
- XATTR_LIBS="-lattr"
msg_xattr=yes])
])
+
+ if test "x$msg_xattr" != "xyes"; then
+dnl failure. try libattr
+ AC_CHECK_LIB(attr, getxattr,
+ [AC_CHECK_HEADERS(attr/xattr.h,
+ [AC_DEFINE(HAVE_XATTR, 1, [Define to 1 if xattr is available])
+ XATTR_LIBS="-lattr"
+ msg_xattr=yes])
+ ])
+
+dnl bail if none of them was available
+ if test "x$msg_xattr" != "xyes"; then
+ echo "ERROR: Neither found glibc with extended attribute support and a <sys/xattr.h> header,"
+ echo " nor a usable \"libattr\" extended attribute support library and a <attr/xattr.h> header."
+ echo " Either install the required libraries/headers, or pass \"--disable-xattr\"."
+ exit 1;
+ fi
+ fi
fi
AC_SUBST(XATTR_LIBS)
diff --git a/gtk-doc.make b/gtk-doc.make
diff --git a/gvfs/gfileinfosimple.c b/gvfs/gfileinfosimple.c
index 98f1a91..e98cf31 100644
--- a/gvfs/gfileinfosimple.c
+++ b/gvfs/gfileinfosimple.c
@@ -9,8 +9,16 @@ #endif
#include <sys/types.h>
#ifdef HAVE_XATTR
-#include <sys/xattr.h>
-#endif
+
+#if defined HAVE_SYS_XATTR_H
+ #include <sys/xattr.h>
+#elif defined HAVE_ATTR_XATTR_H
+ #include <attr/xattr.h>
+#else
+ #error "Neither <sys/xattr.h> nor <attr/xattr.h> is present but extended attribute support is enabled."
+#endif /* defined HAVE_SYS_XATTR_H || HAVE_ATTR_XATTR_H */
+
+#endif /* HAVE_XATTR */
#include <glib/gstdio.h>
#include <glib/gi18n-lib.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]