summaryrefslogtreecommitdiff
blob: ea761f7e3476360cfde249b8389375032d863a8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--- a/configure.in
+++ b/configure.in
@@ -5,6 +5,7 @@
 unset CDPATH
 
 AC_PROG_CXX
+PKG_PROG_PKG_CONFIG
 
 AC_PREFIX_DEFAULT(/usr/local)
 
@@ -83,48 +84,15 @@
 	AC_DEFINE(SSLTUNNEL)
 fi
 
-AC_MSG_CHECKING(for ClamAV scanner library)
-
 if test "$enable_clamav" = "yes"
 then
-	clamprefix="`clamav-config --prefix 2>/dev/null`"
-	clamversion="`clamav-config --version 2>/dev/null`"
-
-	if test "x$clamprefix" = "x"
-	then
-		AC_MSG_RESULT([clamav-config not found])
-
-		echo ""
-		echo " Error finding ClamAV installation!"
-		echo " Add ClamAV binaries path to PATH and run configure again."
-		echo ""
-		echo " To disable ClamAV library support, use --disable-clamav."
-		echo ""
-
-		exit 1
-	fi
-
-	for cl in `clamav-config --cflags 2>/dev/null`; do
-		if test "x`echo $cl | perl -ne 'print if (/^-I/)' 2>/dev/null`" != "x"
-		then
-			CFLAGS="$CFLAGS $cl"
-		fi
-	done
-
-	for cl in `clamav-config --libs 2>/dev/null`; do
-		if test "x`echo $cl | perl -ne 'print if (/(^-L|thread|c_r)/)' 2>/dev/null`" != "x"
-		then
-			LDFLAGS="$LDFLAGS $cl"
-		fi
-	done
-	LDFLAGS="$LDFLAGS -lclamav"
-
-	SCANNEROBJECTS="clamlibscanner.o"
-	AC_DEFINE(USECLAMLIB)
-
-	AC_MSG_RESULT([found $clamversion in $clamprefix])
-else
-	AC_MSG_RESULT([disabled :-(])
+	PKG_CHECK_MODULES(clamav, libclamav,
+		[CFLAGS="$clamav_CFLAGS $CFLAGS"
+		 LDFLAGS="$clamav_LIBS $LDFLAGS"
+
+		 SCANNEROBJECTS="clamlibscanner.o"
+		 AC_DEFINE(USECLAMLIB)
+		])
 fi
 
 AC_MSG_CHECKING(for Trend Micro scanner)