build: eliminate the AC_CHECK_LIB / AC_CHECK_HEADER tests for Yara

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@redhat.com>
Message-Id: <20211013133611.21599-3-lersek@redhat.com>
Acked-by: Eric Blake <eblake@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
This commit is contained in:
Laszlo Ersek
2021-10-13 15:36:10 +02:00
parent 54187b7f98
commit 4daec34a01

View File

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