[Libguestfs] [PATCH v3 2/7] appliance: add yara dependency

Matteo Cafasso
2017-02-19T17:09:53Z

libyara3 on Debian/Ubuntu
yara on SUSE/RedHat

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
---
 appliance/packagelist.in |  4 ++++
 daemon/Makefile.am       |  3 ++-
 m4/guestfs_daemon.m4     | 14 ++++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/appliance/packagelist.in b/appliance/packagelist.in
index 8ed3afedc..0b9e786d9 100644
--- a/appliance/packagelist.in
+++ b/appliance/packagelist.in
@@ -51,6 +51,7 @@ ifelse(REDHAT,1,
   vim-minimal
   xz
   yajl
+  yara
   zfs-fuse
 )

@@ -84,6 +85,7 @@ dnl iproute has been renamed to iproute2
   libsystemd-id128-0
   libsystemd-journal0
   libyajl2
+  libyara3
   linux-image
   dnl syslinux 'suggests' mtools, but in reality it's a hard
dependency:
   mtools
@@ -126,6 +128,7 @@ ifelse(ARCHLINUX,1,
   vim
   xz
   yajl
+  yara
 )

 ifelse(SUSE,1,
@@ -155,6 +158,7 @@ ifelse(SUSE,1,
   systemd
   vim
   xz
+  yara
 )

 ifelse(FRUGALWARE,1,
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 5c4ae8e0a..2236abdd0 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -186,7 +186,8 @@ guestfsd_LDADD = \
 	$(LIBINTL) \
 	$(SERVENT_LIB) \
 	$(PCRE_LIBS) \
-	$(TSK_LIBS)
+	$(TSK_LIBS) \
+	$(YARA_LIBS)

 guestfsd_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib \
diff --git a/m4/guestfs_daemon.m4 b/m4/guestfs_daemon.m4
index eb5a6d5cf..522cd5f0e 100644
--- a/m4/guestfs_daemon.m4
+++ b/m4/guestfs_daemon.m4
@@ -126,3 +126,17 @@ AC_CHECK_LIB([tsk],[tsk_version_print],[
         AC_DEFINE([HAVE_LIBTSK], [1], [Define to 1 if The Sleuth Kit library
(libtsk) is available.])
     ], [])
 ],[AC_MSG_WARN([The Sleuth Kit library (libtsk) not found])])
+
+dnl yara library (optional)
+PKG_CHECK_MODULES([YARA], [libyara],[
+    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])])
+])
--
2.11.0