Browse code

Autotools, freshclam: remove BUILD_CLAMD macro

There is an autotools variable and clamav-config.h macro BUILD_CLAMD
which dates back 17 years to a time where libpthread support was
optional and users could build clamscan without building clamd,
clamdscan, clamav-milter, etc. We don't live in that world anymore and
certainly don't test that configuration.

To get the NotifyClamd freshclam feature to work with CMake builds we
either have to define BUILD_CLAMD from CMake as well, or remove the
feature entirely. I chose to remove it, because we don't test builds
without BUILD_CLAMD enabled and it adds needless complexity to our build
system and source.

Micah Snyder authored on 2020/08/26 05:06:08
Showing 11 changed files
... ...
@@ -9,9 +9,6 @@
9 9
 /* enable bind8 compatibility */
10 10
 #undef BIND_8_COMPAT
11 11
 
12
-/* "build clamd" */
13
-#undef BUILD_CLAMD
14
-
15 12
 /* use ClamAuth */
16 13
 #undef CLAMAUTH
17 14
 
... ...
@@ -18,7 +18,6 @@
18 18
 #  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19
 #  MA 02110-1301, USA.
20 20
 
21
-if BUILD_CLAMD
22 21
 if HAVE_MILTER
23 22
 
24 23
 sbin_PROGRAMS = clamav-milter
... ...
@@ -37,7 +36,6 @@ man_MANS = $(top_builddir)/docs/man/clamav-milter.8
37 37
 AM_CFLAGS=@WERR_CFLAGS_MILTER@
38 38
 
39 39
 endif
40
-endif
41 40
 
42 41
 LIBS = $(top_builddir)/libclamav/libclamav.la $(top_builddir)/shared/libshared.la @CLAMAV_MILTER_LIBS@ @THREAD_LIBS@
43 42
 AM_CPPFLAGS = -I$(top_srcdir)/clamd -I$(top_srcdir)/libclamav -I$(top_builddir)/libclamav -I$(top_srcdir)/libclamunrar_iface -I$(top_srcdir)/shared -I$(top_srcdir) @SSL_CPPFLAGS@ @JSON_CPPFLAGS@ @PCRE_CPPFLAGS@
... ...
@@ -18,8 +18,6 @@
18 18
 #  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19
 #  MA 02110-1301, USA.
20 20
 
21
-if BUILD_CLAMD
22
-
23 21
 sbin_PROGRAMS = clamd
24 22
 
25 23
 clamd_SOURCES = \
... ...
@@ -46,8 +44,6 @@ if INSTALL_SYSTEMD_UNITS
46 46
 systemdsystemunit_DATA = clamav-daemon.socket clamav-daemon.service
47 47
 endif
48 48
 
49
-endif
50
-
51 49
 LIBS = $(top_builddir)/libclamav/libclamav.la $(top_builddir)/shared/libshared.la @CLAMD_LIBS@ @THREAD_LIBS@
52 50
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav -I$(top_builddir)/libclamav -I$(top_srcdir)/libclamunrar_iface @SSL_CPPFLAGS@ @JSON_CPPFLAGS@ @PCRE_CPPFLAGS@
53 51
 
... ...
@@ -17,8 +17,6 @@
17 17
 #  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 18
 #  MA 02110-1301, USA.
19 19
 
20
-if BUILD_CLAMD
21
-
22 20
 bin_PROGRAMS = clamdscan
23 21
 
24 22
 clamdscan_SOURCES = \
... ...
@@ -29,8 +27,6 @@ clamdscan_SOURCES = \
29 29
     client.h
30 30
 
31 31
 AM_CFLAGS=@WERR_CFLAGS@
32
-endif
33
-
34 32
 
35 33
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/clamscan -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav -I$(top_builddir)/libclamav -I$(top_srcdir)/libclamunrar_iface @SSL_CPPFLAGS@ @CLAMDSCAN_CPPFLAGS@ @JSON_CPPFLAGS@ @PCRE_CPPFLAGS@
36 34
 LIBS = $(top_builddir)/shared/libshared.la $(top_builddir)/libclamav/libclamav.la @CLAMDSCAN_LIBS@ @THREAD_LIBS@
... ...
@@ -23,8 +23,6 @@ CFGINST = @CFGDIR@
23 23
 
24 24
 sysconf_DATA = clamd.conf.sample freshclam.conf.sample
25 25
 
26
-if BUILD_CLAMD
27 26
 if HAVE_MILTER
28 27
 sysconf_DATA += clamav-milter.conf.sample
29 28
 endif
30
-endif
... ...
@@ -167,9 +167,7 @@ static void help(void)
167 167
     printf("    --no-dns                             Force old non-DNS verification method\n");
168 168
     printf("    --checks=#n          -c #n           Number of checks per day, 1 <= n <= 50\n");
169 169
     printf("    --datadir=DIRECTORY                  Download new databases into DIRECTORY\n");
170
-#ifdef BUILD_CLAMD
171 170
     printf("    --daemon-notify[=/path/clamd.conf]   Send RELOAD command to clamd\n");
172
-#endif
173 171
     printf("    --local-address=IP   -a IP           Bind to IP for HTTP downloads\n");
174 172
     printf("    --on-update-execute=COMMAND          Execute COMMAND after successful update\n");
175 173
     printf("    --on-error-execute=COMMAND           Execute COMMAND if errors occurred\n");
... ...
@@ -1528,10 +1526,8 @@ fc_error_t perform_database_update(
1528 1528
     }
1529 1529
 
1530 1530
     if (0 < nTotalUpdated) {
1531
-#ifdef BUILD_CLAMD
1532 1531
         if (NULL != notifyClamd)
1533 1532
             notify(notifyClamd);
1534
-#endif
1535 1533
 
1536 1534
         if (NULL != onUpdateExecute) {
1537 1535
             execute("OnUpdateExecute", onUpdateExecute, bDaemonized);
... ...
@@ -1905,7 +1901,7 @@ int main(int argc, char **argv)
1905 1905
         /* Write PID of daemon process to pidfile. */
1906 1906
         if ((opt = optget(opts, "PidFile"))->enabled) {
1907 1907
             g_pidfile = opt->strarg;
1908
-            if (writepid(g_pidfile)){
1908
+            if (writepid(g_pidfile)) {
1909 1909
                 status = FC_EINIT;
1910 1910
                 goto done;
1911 1911
             }
... ...
@@ -1916,7 +1912,7 @@ int main(int argc, char **argv)
1916 1916
          * written the PidFile.  If it does not get this signal, it
1917 1917
          * will wait for our exit status (and we don't exit in daemon mode).
1918 1918
          */
1919
-        if (parentPid != getpid()){ //we have been daemonized
1919
+        if (parentPid != getpid()) { //we have been daemonized
1920 1920
             daemonize_signal_parent(parentPid);
1921 1921
         }
1922 1922
 #endif
... ...
@@ -21,8 +21,6 @@
21 21
 #include "clamav-config.h"
22 22
 #endif
23 23
 
24
-#ifdef BUILD_CLAMD
25
-
26 24
 #include <stdio.h>
27 25
 #ifdef HAVE_UNISTD_H
28 26
 #include <unistd.h>
... ...
@@ -176,4 +174,3 @@ int notify(const char *cfgfile)
176 176
     logg("Clamd successfully notified about the update.\n");
177 177
     return 0;
178 178
 }
179
-#endif
... ...
@@ -4,7 +4,6 @@ then
4 4
     LIBS="$THREAD_LIBS $LIBS"
5 5
     AC_CHECK_FUNCS([sched_yield pthread_yield])
6 6
     LIBS="$save_LIBS"
7
-    AC_DEFINE([BUILD_CLAMD], 1, "build clamd")
8 7
     dnl define these here, so we don't forget any system
9 8
     AC_DEFINE([CL_THREAD_SAFE],1,[thread safe])
10 9
     AC_DEFINE([_REENTRANT],1,[thread safe])
... ...
@@ -25,5 +25,4 @@ if test "$have_milter" = "yes"; then
25 25
     ])
26 26
 fi
27 27
 
28
-AM_CONDITIONAL([BUILD_CLAMD],[test "$have_pthreads" = "yes"])
29 28
 AM_CONDITIONAL([HAVE_MILTER],[test "$have_milter" = "yes"])
... ...
@@ -11,9 +11,6 @@
11 11
 /* enable bind8 compatibility */
12 12
 /* #undef BIND_8_COMPAT */
13 13
 
14
-/* "build clamd" */
15
-#define BUILD_CLAMD 1
16
-
17 14
 /* name of the clamav group */
18 15
 #define CLAMAVGROUP "clamav"
19 16
 
... ...
@@ -24,7 +24,6 @@ my %CONF = (
24 24
     'AC_APPLE_UNIVERSAL_BUILD' => -1,
25 25
     'ANONYMOUS_MAP' => -1,
26 26
     'BIND_8_COMPAT' => -1,
27
-    'BUILD_CLAMD' => '1',
28 27
     'CLAMAVGROUP' => '"clamav"',
29 28
     'CLAMAVUSER' => '"clamav"',
30 29
     'CLAMUKO' => -1,