1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

Convert sanlock check to use LIBVIRT_CHECK_LIB

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2012-09-20 13:04:57 +01:00
parent 4da3000c66
commit a38dbf6673
2 changed files with 58 additions and 76 deletions

View File

@ -155,6 +155,7 @@ AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
LIBVIRT_COMPILE_WARNINGS
LIBVIRT_CHECK_SANLOCK
LIBVIRT_CHECK_YAJL
AC_MSG_CHECKING([for CPUID instruction])
@ -1142,77 +1143,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
if test $fail = 1; then
AC_MSG_ERROR([You must install the Sanlock development package in order to compile libvirt])
else
AC_CHECK_DECLS([SANLK_INQ_WAIT], [sanlock_inq_wait=1], [sanlock_inq_wait=0], [[
#include <stdint.h>
#include <sanlock_admin.h>
]])
fi
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])
AC_CHECK_LIB([sanlock_client], [sanlock_killpath],
[sanlock_killpath=yes], [sanlock_killpath=no])
if test "x$sanlock_killpath" = "xyes" ; then
AC_DEFINE_UNQUOTED([HAVE_SANLOCK_KILLPATH], 1,
[whether Sanlock supports sanlock_killpath])
fi
AC_CHECK_LIB([sanlock_client], [sanlock_inq_lockspace],
[sanlock_inq_lockspace=yes], [sanlock_inq_lockspace=no])
if test "x$sanlock_inq_lockspace" = "xyes" && \
test $sanlock_inq_wait = 1; then
AC_DEFINE_UNQUOTED([HAVE_SANLOCK_INQ_LOCKSPACE], 1,
[whether sanlock supports sanlock_inq_lockspace])
fi
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=
@ -3108,6 +3038,7 @@ fi
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Libraries])
AC_MSG_NOTICE([])
LIBVIRT_RESULT_SANLOCK
LIBVIRT_RESULT_YAJL
AC_MSG_NOTICE([ libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
AC_MSG_NOTICE([ dlopen: $DLOPEN_LIBS])
@ -3136,11 +3067,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])

56
m4/virt-sanlock.m4 Normal file
View File

@ -0,0 +1,56 @@
dnl The libsanlock_client.so library
dnl
dnl Copyright (C) 2012-2013 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library. If not, see
dnl <http://www.gnu.org/licenses/>.
dnl
AC_DEFUN([LIBVIRT_CHECK_SANLOCK],[
LIBVIRT_CHECK_LIB([SANLOCK], [sanlock_client], [sanlock_init], [sanlock.h])
if test "x$with_sanlock" = "xyes" ; then
AC_CHECK_DECLS([SANLK_INQ_WAIT], [sanlock_inq_wait=1], [sanlock_inq_wait=0], [[
#include <stdint.h>
#include <sanlock_admin.h>
]])
old_cppflags="$CPPFLAGS"
old_libs="$LIBS"
CPPFLAGS="$CPPFLAGS $SANLOCK_CFLAGS"
LIBS="$LIBS $SANLOCK_LIBS"
AC_CHECK_LIB([sanlock_client], [sanlock_killpath],
[sanlock_killpath=yes], [sanlock_killpath=no])
if test "x$sanlock_killpath" = "xyes" ; then
AC_DEFINE_UNQUOTED([HAVE_SANLOCK_KILLPATH], 1,
[whether Sanlock supports sanlock_killpath])
fi
AC_CHECK_LIB([sanlock_client], [sanlock_inq_lockspace],
[sanlock_inq_lockspace=yes], [sanlock_inq_lockspace=no])
if test "x$sanlock_inq_lockspace" = "xyes" && \
test $sanlock_inq_wait = 1; then
AC_DEFINE_UNQUOTED([HAVE_SANLOCK_INQ_LOCKSPACE], 1,
[whether sanlock supports sanlock_inq_lockspace])
fi
CPPFLAGS="$old_cppflags"
LIBS="$old_libs"
fi
])
AC_DEFUN([LIBVIRT_RESULT_SANLOCK],[
LIBVIRT_RESULT_LIB([SANLOCK])
])