[Libguestfs] [PATCH 2/3] build: eliminate the AC_CHECK_LIB / AC_CHECK_HEADER tests for Yara

Laszlo Ersek lersek at redhat.com
Wed Oct 13 13:36:10 UTC 2021


Eliminate the AC_CHECK_LIB / AC_CHECK_HEADER tests for Yara, for the
following reasons:

- Upstream Yara has provided a pkg-config file since 2015, so the
  (now-fixed) pkg-config check should always find it, without the
  AC_CHECK_LIB / AC_CHECK_HEADER fallback branch.

- In a subsequent patch, we'll want to test for the incompatible Yara API
  changes described at
  <https://github.com/VirusTotal/yara/wiki/Backward-incompatible-changes-in-YARA-4.0-API>.

  That's easy to do with pkg-config, but impossible with AC_CHECK_*,
  without a custom test. Namely, both AC_CHECK_DECLS and AC_CHECK_TYPES
  appear unable to check the parameter list of a function pointer typedef
  (namely YR_CALLBACK_FUNC and YR_COMPILER_CALLBACK_FUNC). And writing a
  dedicated test for this is overkill.

Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
 m4/guestfs-daemon.m4 | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/m4/guestfs-daemon.m4 b/m4/guestfs-daemon.m4
index 0790f8848249..316a811d30a9 100644
--- a/m4/guestfs-daemon.m4
+++ b/m4/guestfs-daemon.m4
@@ -138,11 +138,4 @@ PKG_CHECK_MODULES([YARA], [yara],[
     AC_SUBST([YARA_CFLAGS])
     AC_SUBST([YARA_LIBS])
     AC_DEFINE([HAVE_YARA],[1],[yara library found at compile time.])
-],[
-    AC_CHECK_LIB([yara],[yr_initialize],[
-        AC_CHECK_HEADER([yara.h],[
-            AC_SUBST([YARA_LIBS], [-lyara])
-            AC_DEFINE([HAVE_YARA], [1], [Define to 1 if Yara library is available.])
-        ], [])
-    ],[AC_MSG_WARN([Yara library not found])])
-])
+],[AC_MSG_WARN([Yara library not found])])
-- 
2.19.1.3.g30247aa5d201




More information about the Libguestfs mailing list