summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Schubert <bernd.schubert@fastmail.fm>2011-02-20 21:51:52 +0100
committerBernd Schubert <bernd.schubert@fastmail.fm>2011-02-20 21:51:52 +0100
commitc9d4954b1a463c16cac09f9135d16d881b673e05 (patch)
treed085535281f214c961930d992fafcadcfc10e0fb
parent20bc19d6f2e63351e253a7d811a7fc0ee39f3f6a (diff)
downloadunionfs-fuse-c9d4954b1a463c16cac09f9135d16d881b673e05.tar.gz
xattr: Let CMake check if xattrs are really available
Also renames the compiler option -DHAVE_SETXATTR into -DHAVE_XATTR
-rw-r--r--CMakeLists.txt16
-rw-r--r--src/Makefile2
-rw-r--r--src/unionfs.c8
3 files changed, 17 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4991462..54b13d0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,7 @@
project(unionfs-fuse)
cmake_minimum_required(VERSION 2.0)
+INCLUDE (CheckIncludeFiles)
# Set a default build type for single-configuration
# CMake generators if no build type is set.
@@ -16,10 +17,17 @@ SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG")
add_definitions(-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26)
-option(WITH_XATTR "Enable support for extended attributes")
-if(WITH_XATTR)
- add_definitions(-DHAVE_SETXATTR)
-endif(WITH_XATTR)
+option(WITH_XATTR "Enable support for extended attributes" OFF)
+
+# .h include files
+if (WITH_XATTR)
+ CHECK_INCLUDE_FILES("sys/xattr.h" HAVE_XATTR)
+ IF (HAVE_XATTR)
+ add_definitions(-DHAVE_XATTR)
+ ENDIF(HAVE_XATTR)
+ENDIF (WITH_XATTR)
+
+
add_subdirectory(src)
add_subdirectory(man)
diff --git a/src/Makefile b/src/Makefile
index 1e4e55c..44cf67c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,7 +1,7 @@
CFLAGS += -Wall
CPPFLAGS += $(shell pkg-config --cflags fuse)
CPPFLAGS += -DFUSE_USE_VERSION=26
-#CPPFLAGS += -DHAVE_SETXATTR
+#CPPFLAGS += -DHAVE_XATTR
LDFLAGS +=
diff --git a/src/unionfs.c b/src/unionfs.c
index 184a714..b385c53 100644
--- a/src/unionfs.c
+++ b/src/unionfs.c
@@ -34,7 +34,7 @@
#include <sys/statvfs.h>
#endif
-#ifdef HAVE_SETXATTR
+#ifdef HAVE_XATTR
#include <sys/xattr.h>
#endif
@@ -707,7 +707,7 @@ static int unionfs_write(const char *path, const char *buf, size_t size, off_t o
RETURN(res);
}
-#ifdef HAVE_SETXATTR
+#ifdef HAVE_XATTR
static int unionfs_getxattr(const char *path, const char *name, char *value, size_t size) {
DBG("%s\n", path);
@@ -771,7 +771,7 @@ static int unionfs_setxattr(const char *path, const char *name, const char *valu
RETURN(res);
}
-#endif // HAVE_SETXATTR
+#endif // HAVE_XATTR
static struct fuse_operations unionfs_oper = {
.chmod = unionfs_chmod,
@@ -797,7 +797,7 @@ static struct fuse_operations unionfs_oper = {
.unlink = unionfs_unlink,
.utimens = unionfs_utimens,
.write = unionfs_write,
-#ifdef HAVE_SETXATTR
+#ifdef HAVE_XATTR
.getxattr = unionfs_getxattr,
.listxattr = unionfs_listxattr,
.removexattr = unionfs_removexattr,