Browse code

clamonacc - add configure check for existence of CURLOPT_UNIX_SOCKET_PATH; add configure option to conditionally build clamonacc

Mickey Sola authored on 2019/06/12 04:19:29
Showing 4 changed files
... ...
@@ -18,7 +18,7 @@
18 18
 #  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19
 #  MA 02110-1301, USA.
20 20
 
21
-if BUILD_CLAMD
21
+if BUILD_CLAMONACC
22 22
 
23 23
 bin_PROGRAMS = clamonacc
24 24
 
... ...
@@ -66,7 +66,6 @@ clamonacc_SOURCES += ./misc/fts.c
66 66
 endif
67 67
 
68 68
 AM_CFLAGS=@WERR_CFLAGS@
69
-endif
70 69
 
71 70
 DEFS = @DEFS@ -DCL_NOLIBCLAMAV
72 71
 LIBS = $(top_builddir)/libclamav/libclamav_internal_utils.la @CURL_LIBS@ @CLAMONACC_LIBS@ @THREAD_LIBS@
... ...
@@ -74,3 +73,5 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/clamd -I$(top_srcdir)/shared -I$(t
74 74
 
75 75
 AM_INSTALLCHECK_STD_OPTIONS_EXEMPT=clamonacc$(EXEEXT)
76 76
 CLEANFILES=*.gcda *.gcno
77
+
78
+endif
... ...
@@ -150,6 +150,9 @@ m4_include([m4/reorganization/libs/curl.m4])
150 150
 m4_include([m4/reorganization/substitutions.m4])
151 151
 m4_include([m4/reorganization/strni.m4])
152 152
 
153
+dnl Clamonacc loading
154
+m4_include([m4/reorganization/clamonacc.m4])
155
+
153 156
 if test "x$use_internal_mspack" = "xyes"; then
154 157
     mspack_msg="Internal"
155 158
     AC_SYS_LARGEFILE
156 159
new file mode 100644
... ...
@@ -0,0 +1,33 @@
0
+AC_ARG_ENABLE(clamonacc,
1
+	     [AC_HELP_STRING([--enable-clamonacc], [build clamonacc tool @<:@default=auto@:>@])],
2
+[enable_clamonacc=$enableval], [enable_clamonacc="auto"])
3
+
4
+if test "$enable_clamonacc" != "no"; then
5
+	AC_CANONICAL_HOST
6
+
7
+
8
+        case "${host_os}" in
9
+
10
+        	linux*)
11
+			LIBCURL_CHECK_CONFIG(
12
+			[],
13
+			[7.40.0],
14
+			[$enable_clamonacc="yes"], 
15
+			[AC_MSG_ERROR([Your libcurl (e.g. libcurl-devel) is too old. ClamAV requires libcurl 7.40 or higher.]])
16
+			)
17
+			dnl AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <curl/curl.h>]],[[
18
+			dnl	int x;
19
+			dnl	curl_easy_setopt(NULL,CURLOPT_URL,NULL);
20
+			dnl	x=CURLOPT_UNIX_SOCKET_PATH;
21
+			dnl	if (x) {;}]])],$enable_clamonacc="yes", AC_MSG_ERROR([Your libcurl (e.g. libcurl-devel) is too old. ClamAV requires libcurl 7.40 or higher.]))
22
+			;;
23
+		*)
24
+			if test "$enable_clamonacc" == "yes"; then
25
+				AC_MSG_ERROR([Clamonacc was explicitly requested, but the platform ($host_os) you are trying to build on is not currently supported for this tool.])
26
+			fi
27
+                        ;;
28
+	esac
29
+fi
30
+
31
+
32
+AM_CONDITIONAL([BUILD_CLAMONACC], [test x$enable_clamonacc == xyes])
... ...
@@ -48,6 +48,7 @@ if test "X$have_curl" = "Xyes"; then
48 48
     fi
49 49
     save_LDFLAGS="$LDFLAGS"
50 50
     LDFLAGS="$CURL_LDFLAGS $CURL_LIBS"
51
+
51 52
     AC_CHECK_LIB(
52 53
         [curl],
53 54
         [curl_easy_init],
... ...
@@ -64,6 +65,7 @@ if test "X$have_curl" = "Xyes"; then
64 64
         ],
65 65
         [$CURL_LIBS]
66 66
     )
67
+
67 68
     LDFLAGS="$save_LDFLAGS"
68 69
 else
69 70
     AC_MSG_ERROR([libcurl not found. libcurl (e.g. libcurl-devel) is required in order to build freshclam and clamsubmit.])