1 # inoclam - Inotify+ClamAV virus scanner
2 # Copyright (C) 2007 Vermont Department of Taxes
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Tom Cort <tom.cort@state.vt.us>
22 SET (libdirs /usr/lib /usr/pkg/lib /usr/local/lib /usr/lib64 /usr/local/lib64 /usr/lib32 /usr/local/lib32)
23 SET (bindirs /usr/bin /usr/pkg/bin /usr/local/bin)
24 SET (incdirs /usr/include /usr/local/include /usr/pkg/include)
26 #############################################
28 #############################################
30 FIND_LIBRARY(LIBCLAMAV clamav ${libdirs})
33 MESSAGE(STATUS "Found libclamav: ${LIBCLAMAV}")
35 MESSAGE (FATAL_ERROR "libclamav not found.")
38 FIND_PATH(LIBCLAMAV_INCLUDE_DIR clamav.h ${incdirs})
40 IF (LIBCLAMAV_INCLUDE_DIR)
41 MESSAGE(STATUS "Found clamav.h in ${LIBCLAMAV_INCLUDE_DIR}")
42 ELSE (LIBCLAMAV_INCLUDE_DIR)
43 MESSAGE (FATAL_ERROR "clamav.h not found.")
44 ENDIF (LIBCLAMAV_INCLUDE_DIR)
46 #############################################
48 #############################################
50 FIND_LIBRARY(LIBDAEMON daemon ${libdirs})
53 MESSAGE(STATUS "Found libdaemon: ${LIBDAEMON}")
55 MESSAGE (FATAL_ERROR "libdaemon not found.")
58 FIND_PATH(LIBDAEMON_INCLUDE_DIR libdaemon/daemon.h ${incdirs})
60 IF (LIBDAEMON_INCLUDE_DIR)
61 MESSAGE(STATUS "Found libdaemon/daemon.h in ${LIBDAEMON_INCLUDE_DIR}")
62 ELSE (LIBDAEMON_INCLUDE_DIR)
63 MESSAGE (FATAL_ERROR "libdaemon/daemon.h not found.")
64 ENDIF (LIBDAEMON_INCLUDE_DIR)
66 #############################################
67 # libinotifytools checks
68 #############################################
70 FIND_LIBRARY(LIBINOTIFYTOOLS inotifytools ${libdirs})
73 MESSAGE(STATUS "Found libnotifytools: ${LIBINOTIFYTOOLS}")
74 ELSE (LIBINOTIFYTOOLS)
75 MESSAGE (FATAL_ERROR "libinotifytools not found.")
76 ENDIF (LIBINOTIFYTOOLS)
78 FIND_PATH(LIBINOTIFYTOOLS_INCLUDE_DIR inotifytools/inotify.h ${incdirs})
80 IF (LIBINOTIFYTOOLS_INCLUDE_DIR)
81 MESSAGE(STATUS "Found inotifytools/inotify.h in ${LIBINOTIFYTOOLS_INCLUDE_DIR}")
82 ELSE (LIBINOTIFYTOOLS_INCLUDE_DIR)
83 MESSAGE (FATAL_ERROR "inotifytools/inotify.h not found.")
84 ENDIF (LIBINOTIFYTOOLS_INCLUDE_DIR)
86 #############################################
88 #############################################
90 FIND_PATH(INOTIFY_INCLUDE_DIR sys/inotify.h ${incdirs})
92 IF (INOTIFY_INCLUDE_DIR)
93 MESSAGE(STATUS "Found sys/inotify.h in ${INOTIFY_INCLUDE_DIR}")
94 ELSE (INOTIFY_INCLUDE_DIR)
95 MESSAGE (FATAL_ERROR "sys/inotify.h not found.")
96 ENDIF (INOTIFY_INCLUDE_DIR)
98 #############################################
100 #############################################
102 INCLUDE_DIRECTORIES(${incdirs} ${LIBCLAMAV_INCLUDE_DIR} ${LIBDAEMON_INCLUDE_DIR} ${LIBINOTIFYTOOLS_INCLUDE_DIR} ${INOTIFY_INCLUDE_DIR})
104 #############################################
106 #############################################
108 ADD_EXECUTABLE(inoclam clam.c inoclam.c inotify.c monitor.c sig.c)
110 #############################################
112 #############################################
114 TARGET_LINK_LIBRARIES(inoclam ${LIBCLAMAV} ${LIBDAEMON} ${LIBINOTIFYTOOLS})