m4: Fix check for yajl.pc
[libvirt/ericb.git] / m4 / virt-sanlock.m4
blob00de7980e8299e357c57ce093e77f87a1e83651b
1 dnl The libsanlock_client.so library
2 dnl
3 dnl Copyright (C) 2012-2013 Red Hat, Inc.
4 dnl
5 dnl This library is free software; you can redistribute it and/or
6 dnl modify it under the terms of the GNU Lesser General Public
7 dnl License as published by the Free Software Foundation; either
8 dnl version 2.1 of the License, or (at your option) any later version.
9 dnl
10 dnl This library is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 dnl Lesser General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU Lesser General Public
16 dnl License along with this library.  If not, see
17 dnl <http://www.gnu.org/licenses/>.
18 dnl
20 AC_DEFUN([LIBVIRT_ARG_SANLOCK],[
21   LIBVIRT_ARG_WITH_FEATURE([SANLOCK], [sanlock-client], [check])
24 AC_DEFUN([LIBVIRT_CHECK_SANLOCK],[
25   LIBVIRT_CHECK_LIB([SANLOCK], [sanlock_client], [sanlock_init], [sanlock.h])
27   if test "x$with_sanlock" = "xyes" ; then
28     AC_CHECK_DECLS([SANLK_INQ_WAIT], [sanlock_inq_wait=1], [sanlock_inq_wait=0], [[
29       #include <stdint.h>
30       #include <sanlock_admin.h>
31     ]])
33     old_cppflags="$CPPFLAGS"
34     old_libs="$LIBS"
35     CPPFLAGS="$CPPFLAGS $SANLOCK_CFLAGS"
36     LIBS="$LIBS $SANLOCK_LIBS"
38     AC_CHECK_LIB([sanlock_client], [sanlock_killpath],
39                  [sanlock_killpath=yes], [sanlock_killpath=no])
40     if test "x$sanlock_killpath" = "xyes" ; then
41       AC_DEFINE_UNQUOTED([HAVE_SANLOCK_KILLPATH], 1,
42         [whether Sanlock supports sanlock_killpath])
43     fi
45     AC_CHECK_LIB([sanlock_client], [sanlock_inq_lockspace],
46                [sanlock_inq_lockspace=yes], [sanlock_inq_lockspace=no])
47     if test "x$sanlock_inq_lockspace" = "xyes" && \
48        test $sanlock_inq_wait = 1; then
49       AC_DEFINE_UNQUOTED([HAVE_SANLOCK_INQ_LOCKSPACE], 1,
50         [whether sanlock supports sanlock_inq_lockspace])
51     fi
53     dnl Ideally, we would check for sanlock_add_lockspace_timeout here too, but
54     dnl sanlock_write_lockspace has been introduced 2 releases after
55     dnl sanlock_add_lockspace_timeout therefore if sanlock_write_lockspace is found
56     dnl it is safe to assume sanlock_add_lockspace_timeout is present too.
57     AC_CHECK_LIB([sanlock_client], [sanlock_write_lockspace],
58                  [sanlock_write_lockspace=yes], [sanlock_write_lockspace=no])
59     if test "x$sanlock_write_lockspace" = "xyes" ; then
60       AC_DEFINE_UNQUOTED([HAVE_SANLOCK_IO_TIMEOUT], 1,
61         [whether sanlock supports sanlock_write_lockspace])
62     fi
64     AC_CHECK_LIB([sanlock_client], [sanlock_strerror],
65                  [sanlock_strerror=yes], [sanlock_strerror=no])
66     if test "x$sanlock_strerror" = "xyes" ; then
67       AC_DEFINE_UNQUOTED([HAVE_SANLOCK_STRERROR], 1,
68         [whether sanlock supports sanlock_strerror])
69     fi
71     CPPFLAGS="$old_cppflags"
72     LIBS="$old_libs"
73   fi
76 AC_DEFUN([LIBVIRT_RESULT_SANLOCK],[
77   LIBVIRT_RESULT_LIB([SANLOCK])