[libvirt] [PATCH 5/9] Convert sanlock check to use LIBVIRT_CHECK_LIB

Eric Blake eblake at redhat.com
Thu Jan 10 23:32:26 UTC 2013


On 01/10/2013 01:18 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  configure.ac       | 78 ++----------------------------------------------------
>  m4/virt-sanlock.m4 | 38 ++++++++++++++++++++++++++
>  2 files changed, 40 insertions(+), 76 deletions(-)
>  create mode 100644 m4/virt-sanlock.m4
> 

> +++ b/m4/virt-sanlock.m4
> @@ -0,0 +1,38 @@
> +dnl The libsanlock_client.so library
> +
> +AC_DEFUN([LIBVIRT_CHECK_SANLOCK],[
> +  LIBVIRT_CHECK_LIB([SANLOCK], [sanlock_client], [sanlock_init], [sanlock.h])
> +

It might be worth making the rest of this macro conditional:

if test "x$with_sanlock" != "xno" ; 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])

That is, no need to waste time checking for a library function if we
already know we aren't going to use the library.

> +  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])
> +])
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130110/d1dc35cd/attachment-0001.sig>


More information about the libvir-list mailing list