1
From 3bfb03f1f9b8317ff355f0c65cde1e9b3fd5cc43 Mon Sep 17 00:00:00 2001
2
From: Scott Kitterman <scott@kitterman.com>
3
Date: Mon, 10 Mar 2014 19:46:48 -0400
4
Subject: configure: use pkg-config for check so test is detected and tests
8
configure.ac | 19 ++++++-------------
9
unit_tests/Makefile.am | 4 ++--
10
2 files changed, 8 insertions(+), 15 deletions(-)
12
diff --git a/configure.ac b/configure.ac
13
index c91baeb..41df5d0 100644
16
@@ -464,22 +464,15 @@ enable_ut_install=no
18
[ --enable-check Enable 'check' unit tests (default=auto)], enable_check_ut=$enableval, enable_check_ut="auto" )
20
-if test "$enable_check_ut" != "no" ; then
21
- AC_LIB_FIND([check],[check.h],
22
- AC_LANG_PROGRAM([#include <check.h>],[srunner_create(0)]),
23
- [CHECK_CPPFLAGS="$INCCHECK"; CHECK_LIBS="$LTLIBCHECK"],
25
+if test "$enable_check_ut" = "auto" ; then
26
+ PKG_CHECK_EXISTS([check], [enable_check_ut="yes"],
27
+ [enable_check_ut="no"])
29
-AC_SUBST([CHECK_CPPFLAGS])
30
-AC_SUBST([CHECK_LIBS])
31
-AM_CONDITIONAL([HAVE_LIBCHECK],test "X$HAVE_LIBCHECK" = "Xyes")
33
-if test "x$CHECK_LIBS" = "x" -a "$enable_check_ut" = "yes"; then
36
-ERROR! Check was configured, but not found. Get it from http://check.sf.net/
38
+if test "$enable_check_ut" = "yes" ; then
39
+ PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
41
+AM_CONDITIONAL([HAVE_LIBCHECK],test "X$CHECK_LIBS" != "X")
43
AC_ARG_ENABLE(coverage,
44
AC_HELP_STRING([--enable-coverage],
45
diff --git a/unit_tests/Makefile.am b/unit_tests/Makefile.am
46
index d85d7b6..a4d9d84 100644
47
--- a/unit_tests/Makefile.am
48
+++ b/unit_tests/Makefile.am
49
@@ -33,10 +33,10 @@ check_clamav_SOURCES = check_clamav.c checks.h checks_common.h $(top_builddir)/l
50
check_jsnorm.c check_str.c check_regex.c\
51
check_disasm.c check_uniq.c check_matchers.c\
52
check_htmlnorm.c check_bytecode.c
53
-check_clamav_CPPFLAGS = -I$(top_srcdir) @CHECK_CPPFLAGS@ -DSRCDIR=\"$(abs_srcdir)\" -DOBJDIR=\"$(abs_builddir)\"
54
+check_clamav_CPPFLAGS = -I$(top_srcdir) @CHECK_CFLAGS@ -DSRCDIR=\"$(abs_srcdir)\" -DOBJDIR=\"$(abs_builddir)\"
55
check_clamav_LDADD = $(top_builddir)/libclamav/libclamav.la @THREAD_LIBS@ @CHECK_LIBS@
56
check_clamd_SOURCES = check_clamd.c checks_common.h
57
-check_clamd_CPPFLAGS = -I$(top_srcdir) @CHECK_CPPFLAGS@ -DSRCDIR=\"$(abs_srcdir)\" -DBUILDDIR=\"$(abs_builddir)\"
58
+check_clamd_CPPFLAGS = -I$(top_srcdir) @CHECK_CFLAGS@ -DSRCDIR=\"$(abs_srcdir)\" -DBUILDDIR=\"$(abs_builddir)\"
59
check_clamd_LDADD = @CHECK_LIBS@ @CLAMD_LIBS@
61
check_clamd_SOURCES = check_clamav_skip.c