summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Watkins <noahwatkins@gmail.com>2013-07-20 18:41:40 -0700
committerNoah Watkins <noahwatkins@gmail.com>2013-07-20 18:41:40 -0700
commit2b14beb1b71574dd182028b4f8da456a9794e71e (patch)
treec7451a4ce1e2ba1fcbca842b8b6c3e8e1e8c082b
parent6339abb9d707a244640a962cfe9838259ceb22ed (diff)
downloadceph-2b14beb1b71574dd182028b4f8da456a9794e71e.tar.gz
fuse: better fuse check and compiler error fixes
Use pkg-config to look for libfuse (which also catches fuse4x on OSX). This also fixes the HAVE_FUSE_GETGROUPS feature test, which hadn't been updating LIBS prior to the test. This enabled code with an error in fuse_ll.cc that had compiler errors. Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
-rw-r--r--configure.ac24
-rw-r--r--src/Makefile.am7
-rw-r--r--src/client/fuse_ll.cc3
3 files changed, 17 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac
index 71e323c549d..8f6b17b86e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -241,24 +241,22 @@ AS_IF([test "$RADOSGW" = "1"],
AC_DEFINE([HAVE_CURL_MULTI_WAIT], [1], [Define if have curl_multi_wait()]))
])
+
# fuse?
AC_ARG_WITH([fuse],
[AS_HELP_STRING([--without-fuse], [disable FUSE userspace client])],
[],
[with_fuse=yes])
-LIBFUSE=
-AS_IF([test "x$with_fuse" != xno],
- [AC_CHECK_LIB([fuse], [fuse_main],
- [AC_SUBST([LIBFUSE], ["-lfuse"])
- AC_DEFINE([HAVE_LIBFUSE], [1],
- [Define if you have fuse])
- HAVE_LIBFUSE=1
- # look for fuse_getgroups and define FUSE_GETGROUPS if found
- AC_CHECK_FUNCS([fuse_getgroups])
- ],
- [AC_MSG_FAILURE(
- [no FUSE found (use --without-fuse to disable)])])])
-AM_CONDITIONAL(WITH_FUSE, [test "$HAVE_LIBFUSE" = "1"])
+
+AS_IF([test "x$with_fuse" != "xno"], [
+ PKG_CHECK_MODULES([fuse], [fuse >= 2.6.0], [have_libfuse=yes],
+ [AC_MSG_FAILURE([no FUSE found (use --without-fuse to disable)])])
+ saved_LIBS="$LIBS"
+ LIBS="$LIBS $fuse_LIBS"
+ AC_CHECK_FUNCS([fuse_getgroups])
+ LIBS="$saved_LIBS"
+])
+AM_CONDITIONAL(WITH_FUSE, [test "x$have_libfuse" = "xyes"])
# tcmalloc?
AC_ARG_WITH([tcmalloc],
diff --git a/src/Makefile.am b/src/Makefile.am
index d8e331fb141..e9665f1e0e0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -188,15 +188,16 @@ base: ceph-mon ceph-osd ceph-mds \
# fuse targets?
if WITH_FUSE
ceph_fuse_SOURCES = ceph_fuse.cc client/fuse_ll.cc
-ceph_fuse_LDADD = -lfuse libclient.la $(LIBGLOBAL_LDA)
+ceph_fuse_LDADD = $(fuse_LIBS) libclient.la $(LIBGLOBAL_LDA)
ceph_fuse_CXXFLAGS = ${AM_CXXFLAGS}
+ceph_fuse_CFLAGS = $(fuse_CFLAGS)
bin_PROGRAMS += ceph-fuse
rbd_fuse_SOURCES = rbd_fuse/rbd-fuse.c
-rbd_fuse_LDADD = -lfuse librados.la librbd.la $(LIBGLOBAL_LDA)
+rbd_fuse_LDADD = $(fuse_LIBS) librados.la librbd.la $(LIBGLOBAL_LDA)
rbd_fuse_CXXFLAGS = ${AM_CXXFLAGS}
+rbd_fuse_CFLAGS = $(fuse_CFLAGS)
bin_PROGRAMS += rbd-fuse
-
endif
# tcmalloc?
diff --git a/src/client/fuse_ll.cc b/src/client/fuse_ll.cc
index 83395534d0d..ce0c6de1260 100644
--- a/src/client/fuse_ll.cc
+++ b/src/client/fuse_ll.cc
@@ -14,6 +14,7 @@
#define FUSE_USE_VERSION 26
+#include <fuse/fuse.h>
#include <fuse/fuse_lowlevel.h>
#include <signal.h>
#include <stdio.h>
@@ -520,7 +521,7 @@ static int getgroups_cb(void *handle, uid_t uid, gid_t **sgids)
return 0;
}
- *sgids = malloc(c*sizeof(**sgids));
+ *sgids = (gid_t*)malloc(c*sizeof(**sgids));
if (!*sgids) {
return -ENOMEM;
}