[PATCH 12/89] m4/virt-lib: add new parameter to override default fail action

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

 



This allows to use two or more LIBVIRT_CHECK_(LIB|LIB_ALT|PKG) macros
for one library.  For example, when we check for existence of
pgk-config file of some library and we know that not all versions of
that library that libvirt requires provides this file, we can fallback
to use library check.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 m4/virt-lib.m4 | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/m4/virt-lib.m4 b/m4/virt-lib.m4
index 7d7e597b66..b02caf15cc 100644
--- a/m4/virt-lib.m4
+++ b/m4/virt-lib.m4
@@ -24,7 +24,8 @@ dnl config header var, WITH_XXXX make conditional and
 dnl with_XXX configure shell var.
 dnl
 dnl  LIBVIRT_CHECK_LIB([CHECK_NAME], [LIBRARY_NAME],
-dnl                    [FUNCTION_NAME], [HEADER_NAME])
+dnl                    [FUNCTION_NAME], [HEADER_NAME],
+dnl                    [FAIL_ACTION])
 dnl
 dnl  CHECK_NAME: Suffix/prefix used for variables / flags, in uppercase.
 dnl              Used to set
@@ -37,6 +38,8 @@ dnl
 dnl   LIBRARY_NAME: base name of library to check for eg libXXX.so
 dnl  FUNCTION_NAME: function to check for in libXXX.so
 dnl    HEADER_NAME: header file to check for
+dnl    FAIL_ACTION: overrides the default fail action
+dnl
 dnl
 dnl e.g.
 dnl
@@ -52,6 +55,7 @@ AC_DEFUN([LIBVIRT_CHECK_LIB],[
   m4_pushdef([library_name], [$2])
   m4_pushdef([function_name], [$3])
   m4_pushdef([header_name], [$4])
+  m4_pushdef([fail_action], [$5])
 
   m4_pushdef([check_name_lc], m4_tolower(check_name))
 
@@ -96,7 +100,8 @@ AC_DEFUN([LIBVIRT_CHECK_LIB],[
   CFLAGS=$old_CFLAGS
 
   if test $fail = 1; then
-    AC_MSG_ERROR([You must install the lib]library_name[ library & headers to compile libvirt])
+    m4_default(fail_action,
+      [AC_MSG_ERROR([You must install the lib]library_name[ library & headers to compile libvirt])])
   else
     if test "x$with_var" = "xyes" ; then
       if test "x$libs_var" = 'x' ; then
@@ -121,6 +126,7 @@ AC_DEFUN([LIBVIRT_CHECK_LIB],[
 
   m4_popdef([check_name_lc])
 
+  m4_popdef([fail_action])
   m4_popdef([header_name])
   m4_popdef([function_name])
   m4_popdef([library_name])
@@ -134,7 +140,8 @@ dnl
 dnl  LIBVIRT_CHECK_LIB_ALT([CHECK_NAME], [LIBRARY_NAME],
 dnl                        [FUNCTION_NAME], [HEADER_NAME],
 dnl                        [CHECK_NAME_ALT, [LIBRARY_NAME_ALT],
-dnl                        [FUNCTION_NAME_ALT], [HEADER_NAME_ALT])
+dnl                        [FUNCTION_NAME_ALT], [HEADER_NAME_ALT],
+dnl                        [FAIL_ACTION])
 dnl
 dnl  CHECK_NAME: Suffix/prefix used for variables / flags, in uppercase.
 dnl              Used to set
@@ -156,6 +163,7 @@ dnl                    NB all vars for CHECK_NAME are also set
 dnl   LIBRARY_NAME_ALT: alternative library name to check for
 dnl  FUNCTION_NAME_ALT: alternative function name to check for
 dnl    HEADER_NAME_ALT: alternative header file to check for
+dnl        FAIL_ACTION: overrides the default fail action
 dnl
 dnl e.g.
 dnl
@@ -173,6 +181,7 @@ AC_DEFUN([LIBVIRT_CHECK_LIB_ALT],[
   m4_pushdef([library_name_alt], [$6])
   m4_pushdef([function_name_alt], [$7])
   m4_pushdef([header_name_alt], [$8])
+  m4_pushdef([fail_action], [$9])
 
   m4_pushdef([check_name_lc], m4_tolower(check_name))
 
@@ -228,7 +237,8 @@ AC_DEFUN([LIBVIRT_CHECK_LIB_ALT],[
   CFLAGS=$old_CFLAGS
 
   if test $fail = 1; then
-    AC_MSG_ERROR([You must install the lib]library_name[ library & headers to compile libvirt])
+    m4_default(fail_action,
+      [AC_MSG_ERROR([You must install the lib]library_name[ library & headers to compile libvirt])])
   else
     if test "x$with_var" = "xyes" ; then
       if test "x$libs_var" = 'x' ; then
@@ -260,6 +270,7 @@ AC_DEFUN([LIBVIRT_CHECK_LIB_ALT],[
 
   m4_popdef([check_name_lc])
 
+  m4_popdef([fail_action])
   m4_popdef([header_name_alt])
   m4_popdef([function_name_alt])
   m4_popdef([library_name_alt])
@@ -274,7 +285,8 @@ dnl Probe for existence of libXXXX and set WITH_XXX
 dnl config header var, WITH_XXXX make conditional and
 dnl with_XXX configure shell var.
 dnl
-dnl  LIBVIRT_CHECK_PKG([CHECK_NAME], [PC_NAME], [PC_VERSION])
+dnl  LIBVIRT_CHECK_PKG([CHECK_NAME], [PC_NAME], [PC_VERSION],
+dnl                    [FAIL_ACTION])
 dnl
 dnl  CHECK_NAME: Suffix/prefix used for variables / flags, in uppercase.
 dnl              Used to set
@@ -285,6 +297,7 @@ dnl                configure: --with-xxx argument
 dnl                configure: with_xxx variable
 dnl    PC_NAME: Name of the pkg-config module
 dnl    PC_VERSION: Version of the pkg-config module
+dnl    FAIL_ACTION: overrides the default fail action
 dnl
 dnl eg
 dnl
@@ -294,6 +307,7 @@ AC_DEFUN([LIBVIRT_CHECK_PKG],[
   m4_pushdef([check_name], [$1])
   m4_pushdef([pc_name], [$2])
   m4_pushdef([pc_version], [$3])
+  m4_pushdef([fail_action], [$4])
 
   m4_pushdef([check_name_lc], m4_tolower(check_name))
 
@@ -316,7 +330,8 @@ AC_DEFUN([LIBVIRT_CHECK_PKG],[
   fi
 
   if test $fail = 1; then
-    AC_MSG_ERROR([You must install the ]pc_name[ >= ]pc_version[ pkg-config module to compile libvirt])
+    m4_default(fail_action,
+      [AC_MSG_ERROR([You must install the ]pc_name[ >= ]pc_version[ pkg-config module to compile libvirt])])
   fi
 
   if test "x$with_var" = "xyes" ; then
@@ -333,6 +348,7 @@ AC_DEFUN([LIBVIRT_CHECK_PKG],[
 
   m4_popdef([check_name_lc])
 
+  m4_popdef([fail_action])
   m4_popdef([pc_version])
   m4_popdef([pc_name])
   m4_popdef([check_name])
-- 
2.11.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux