summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2013-06-27 13:44:18 +0200
committerVijay Bellur <vbellur@redhat.com>2013-06-27 05:39:43 -0700
commit505f57e07c8096f74ddf5c43679b57bc978d501c (patch)
treef37fe7cb4b78d4ac50d37f64804651d3b2f106b0
parent162b6684beb3d567a1cd9d05efa790460ece684b (diff)
build: declare lvm_lv_from_name() if it is missing from lvm2app.hv3.4.0beta4
The bd-xlator can not be built successfully on certain Debian distributions due to a missing declaration of lvm_lv_from_name(). This function is available for linking, but it does not exist in the header file. This change adds a detection for lvm_lv_from_name() in both the library for linking, and the declaration in the header file. If the 1st is missing, the bd-xlator can not be built, and if only the 2nd one is missing, we'll declare lvm_lv_from_name() ourselves. This makes it possible to build the bd-xlator on the affected Debian distributions too. Change-Id: If1845f6b6d676793677ebbcc6daf9ff12f7c3fd6 BUG: 976946 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/5260 Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--configure.ac15
-rw-r--r--xlators/storage/bd_map/src/bd_map.h6
2 files changed, 20 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 6b10365..06c1ff6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -282,9 +282,18 @@ AC_ARG_ENABLE([bd-xlator],
if test "x$enable_bd_xlator" != "xno"; then
AC_CHECK_LIB([lvm2app],
- [lvm_init],
+ [lvm_init,lvm_lv_from_name],
[HAVE_BD_LIB="yes"],
[HAVE_BD_LIB="no"])
+
+ if test "x$HAVE_BD_LIB" = "xyes"; then
+ # lvm_lv_from_name() has been made public with lvm2-2.02.79
+ AC_CHECK_DECLS(
+ [lvm_lv_from_name],
+ [NEED_LVM_LV_FROM_NAME_DECL="no"],
+ [NEED_LVM_LV_FROM_NAME_DECL="yes"],
+ [[#include <lvm2app.h>]])
+ fi
fi
if test "x$enable_bd_xlator" = "xyes" -a "x$HAVE_BD_LIB" = "xno"; then
@@ -297,6 +306,10 @@ if test "x${enable_bd_xlator}" != "xno" -a "x${HAVE_BD_LIB}" = "xyes"; then
BUILD_BD_XLATOR=yes
AC_DEFINE(HAVE_BD_XLATOR, 1, [define if lvm2app library found and bd
xlator enabled])
+ if test "x$NEED_LVM_LV_FROM_NAME_DECL" = "xyes"; then
+ AC_DEFINE(NEED_LVM_LV_FROM_NAME_DECL, 1, [defined if lvm_lv_from_name()
+ was not found in the lvm2app.h header, but can be linked])
+ fi
fi
AM_CONDITIONAL([ENABLE_BD_XLATOR], [test x$BUILD_BD_XLATOR = xyes])
diff --git a/xlators/storage/bd_map/src/bd_map.h b/xlators/storage/bd_map/src/bd_map.h
index 1a0f424..fa10e97 100644
--- a/xlators/storage/bd_map/src/bd_map.h
+++ b/xlators/storage/bd_map/src/bd_map.h
@@ -30,6 +30,12 @@
#define BACKEND_VG "vg"
+/* lvm2-2.02.79 added this in lvm2app.h, but it is available for linking in
+ * older versions already */
+#if NEED_LVM_LV_FROM_NAME_DECL
+lv_t lvm_lv_from_name(vg_t vg, const char *name);
+#endif
+
enum gf_bd_mem_types_ {
gf_bd_fd = gf_common_mt_end + 1,
gf_bd_private,