[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 06/29] Convert sanlock check to use LIBVIRT_CHECK_LIB



From: "Daniel P. Berrange" <berrange redhat com>

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 configure.ac       | 57 ++----------------------------------------------------
 m4/virt-sanlock.m4 |  9 +++++++++
 2 files changed, 11 insertions(+), 55 deletions(-)
 create mode 100644 m4/virt-sanlock.m4

diff --git a/configure.ac b/configure.ac
index ccd6480..c58c1f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,6 +149,7 @@ AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
 LIBVIRT_COMPILE_WARNINGS
 
 LIBVIRT_CHECK_LIBATTR
+LIBVIRT_CHECK_SANLOCK
 LIBVIRT_CHECK_YAJL
 
 AC_MSG_CHECKING([for CPUID instruction])
@@ -1093,56 +1094,6 @@ AC_SUBST([SASL_CFLAGS])
 AC_SUBST([SASL_LIBS])
 
 
-dnl SANLOCK https://fedorahosted.org/sanlock/
-AC_ARG_WITH([sanlock],
-  AC_HELP_STRING([--with-sanlock], [build Sanlock plugin for lock management @<:@default=check@:>@]),
-  [],
-  [with_sanlock=check])
-
-SANLOCK_CFLAGS=
-SANLOCK_LIBS=
-if test "x$with_sanlock" != "xno"; then
-  if test "x$with_sanlock" != "xyes" && test "x$with_sanlock" != "xcheck"; then
-    SANLOCK_CFLAGS="-I$with_sanlock/include"
-    SANLOCK_LIBS="-L$with_sanlock/lib"
-  fi
-  fail=0
-  old_cppflags="$CPPFLAGS"
-  old_libs="$LIBS"
-  CPPFLAGS="$CPPFLAGS $SANLOCK_CFLAGS"
-  LIBS="$LIBS $SANLOCK_LIBS"
-  AC_CHECK_HEADER([sanlock.h],[],[
-    if test "x$with_sanlock" = "xcheck" ; then
-        with_sanlock=no
-    else
-        fail=1
-    fi])
-  if test "x$with_sanlock" != "xno" ; then
-    AC_CHECK_LIB([sanlock_client], [sanlock_init],[
-      SANLOCK_LIBS="$SANLOCK_LIBS -lsanlock_client"
-      with_sanlock=yes
-    ],[
-      if test "x$with_sanlock" = "xcheck" ; then
-        with_sanlock=no
-      else
-        fail=1
-      fi
-    ])
-  fi
-  test $fail = 1 &&
-    AC_MSG_ERROR([You must install the Sanlock development package in order to compile libvirt])
-  CPPFLAGS="$old_cppflags"
-  LIBS="$old_libs"
-  if test "x$with_sanlock" = "xyes" ; then
-    AC_DEFINE_UNQUOTED([WITH_SANLOCK], 1,
-      [whether Sanlock plugin for lock management is available])
-  fi
-fi
-AM_CONDITIONAL([WITH_SANLOCK], [test "x$with_sanlock" = "xyes"])
-AC_SUBST([SANLOCK_CFLAGS])
-AC_SUBST([SANLOCK_LIBS])
-
-
 dnl DBus library
 DBUS_CFLAGS=
 DBUS_LIBS=
@@ -3005,6 +2956,7 @@ AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Libraries])
 AC_MSG_NOTICE([])
 LIBVIRT_RESULT_LIBATTR
+LIBVIRT_RESULT_SANLOCK
 LIBVIRT_RESULT_YAJL
 AC_MSG_NOTICE([  libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
 AC_MSG_NOTICE([  dlopen: $DLOPEN_LIBS])
@@ -3029,11 +2981,6 @@ AC_MSG_NOTICE([    sasl: $SASL_CFLAGS $SASL_LIBS])
 else
 AC_MSG_NOTICE([    sasl: no])
 fi
-if test "$with_sanlock" != "no" ; then
-AC_MSG_NOTICE([ sanlock: $SANLOCK_CFLAGS $SANLOCK_LIBS])
-else
-AC_MSG_NOTICE([ sanlock: no])
-fi
 AC_MSG_NOTICE([firewalld: $with_firewalld])
 if test "$with_avahi" = "yes" ; then
 AC_MSG_NOTICE([   avahi: $AVAHI_CFLAGS $AVAHI_LIBS])
diff --git a/m4/virt-sanlock.m4 b/m4/virt-sanlock.m4
new file mode 100644
index 0000000..f964161
--- /dev/null
+++ b/m4/virt-sanlock.m4
@@ -0,0 +1,9 @@
+dnl The libsanlock_client.so library
+
+AC_DEFUN([LIBVIRT_CHECK_SANLOCK],[
+  LIBVIRT_CHECK_LIB([SANLOCK], [sanlock], [sanlock_client], [sanlock_init], [sanlock.h])
+])
+
+AC_DEFUN([LIBVIRT_RESULT_SANLOCK],[
+  LIBVIRT_RESULT_LIB([SANLOCK], [sanlock])
+])
-- 
1.7.11.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]