-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
361 lines (305 loc) · 11.3 KB
/
configure.ac
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
AC_INIT([polyvaccine],[0.6],[[email protected]],[],[])
AM_INIT_AUTOMAKE([subdir-objects])
AM_PROG_LIBTOOL
AC_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/ax_python_module.m4])
m4_include([m4/ax_pkg_swig.m4])
m4_include([m4/debug.m4])
AC_PREREQ(2.59)
AC_PROG_INSTALL
AC_LANG([C])
AC_PROG_CC
#AC_PROG_CXX
AC_PROG_MAKE_SET
#AC_SUBST([AM_CFLAGS], [-Wall -fPIC -Wunused-variable])
#AC_SUBST([AM_CPPFLAGS], [-Wall -fPIC -Wunused-variable])
dnl AC_CANONICAL_HOST
AC_CANONICAL_HOST
AM_CONDITIONAL([__FREEBSD__],false)
AM_CONDITIONAL([__LINUX__],false)
case $host in
*free*)
AC_DEFINE([__FREEBSD__],[1],[FreeBSD Host])
AM_CONDITIONAL([__FREEBSD__],true)
;;
*linux*)
AC_DEFINE([__LINUX__],[1],[Linux Host])
AM_CONDITIONAL([__LINUX__],true)
;;
esac
AM_PATH_PYTHON(2.6)
AC_PATH_PROGS([SWIG],[swig swig2.0])
if test -z "$SWIG" ; then
enable_swig=no
else
enable_swig=yes
AX_PKG_SWIG(1.3.36,[] ,[AC_MSG_ERROR("Swig is required.")])
AX_SWIG_ENABLE_CXX
AX_SWIG_MULTI_MODULE_SUPPORT
AX_SWIG_PYTHON
fi
dnl Checks for libraries
AC_PYTHON_MODULE(unittest)
AX_PYTHON
AC_CHECK_LIB(glib-2.0, main, ,AC_MSG_ERROR("Install glib library"),)
#AC_CHECK_HEADER([glib.h], ,[AC_MSG_ERROR("glib.h header not found.")],)
#AC_CHECK_HEADER([glib-2.0/glib.h], ,[AC_MSG_ERROR("glib.h header not found.")],)
dnl pcap
AC_CHECK_LIB(pcap, main, ,AC_MSG_ERROR("Install pcap library"),)
AC_CHECK_HEADER(pcap.h, ,[AC_MSG_ERROR("pcap.h header not found.")],)
dnl pcap
AC_CHECK_LIB(log4c, main, ,AC_MSG_ERROR("Install log4c library"),)
AC_CHECK_HEADER(log4c.h, ,[AC_MSG_ERROR("log4c.h header not found.")],)
SECCOMP="yes"
AC_CHECK_LIB(seccomp,main,,SECCOMP="no")
if test "$SECCOMP" = "no"; then
echo
echo " ERROR! libseccomp library not found, go get it"
echo " from http://sourceforge.net/projects/libseccomp/."
echo
exit
fi
AC_CHECK_HEADER(seccomp.h,,[AC_MSG_ERROR("seccomp.h header not found.")],)
AC_MSG_CHECKING(for perl regular expressions support)
AC_ARG_WITH(pcre, AC_HELP_STRING([--with-pcre],[Enable pcre support (default yes)]),
[WITH_PCRE=$withval],[WITH_PCRE=yes])
AC_MSG_RESULT([$WITH_PCRE])
if test "$WITH_PCRE" != "no"; then
AC_PATH_PROG(PCRECONFIG, pcre-config)
if test x"$PCRECONFIG" != x; then
PCRE_LIB=`$PCRECONFIG --libs`
CPPFLAGS="$CPPFLAGS `$PCRECONFIG --cflags`"
AC_DEFINE([HAVE_LIBPCRE], [1], [libpcre])
AC_DEFINE([HAVE_PCRE_H], [1], [pcre.h])
else
AC_MSG_ERROR([pcre-config not found, install the pcre-devel package or build with --without-pcre])
fi
fi
AC_SUBST(PCRE_LIB)
AC_MSG_CHECKING(for PCRE JIT support)
AC_TRY_COMPILE([ #include <pcre.h> ],
[
int jit = 0;
pcre_config(PCRE_CONFIG_JIT, &jit);
],
[ pcre_jit_available=yes ], [ pcre_jit_available=no ]
)
if test "x$pcre_jit_available" = "xyes"; then
AC_MSG_RESULT(yes)
AC_DEFINE([PCRE_HAVE_JIT], [1], [Pcre with JIT compiler support enabled])
AC_MSG_CHECKING(for PCRE JIT support usability)
AC_TRY_COMPILE([ #include <pcre.h> ],
[
const char* regexstr = "(a|b|c|d)";
pcre *re;
const char *error;
pcre_extra *extra;
int err_offset;
re = pcre_compile(regexstr,0, &error, &err_offset,NULL);
extra = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error);
if (extra == NULL)
exit(EXIT_FAILURE);
int jit = 0;
int ret = pcre_fullinfo(re, extra, PCRE_INFO_JIT, &jit);
if (ret != 0 || jit != 1)
exit(EXIT_FAILURE);
exit(EXIT_SUCCESS);
],
[ pcre_jit_works=yes ], [:]
)
if test "x$pcre_jit_works" != "xyes"; then
AC_MSG_RESULT(no)
echo
echo " PCRE JIT support detection worked but testing it failed"
echo " something odd is going on, please file a bug report."
echo
exit 1
else
AC_MSG_RESULT(yes)
fi
fi
#PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.10.3],[],AC_MSG_ERROR($GLIB_PKG_ERRORS))
#PKG_CHECK_MODULES(Seccomp,libseccomp)
PKG_CHECK_MODULES(DBUS,dbus-1 )
AC_CHECK_DEBUG
AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test -z "$DOXYGEN";
then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
enable_doxygen=no
else
enable_doxygen=yes
fi
AM_CONDITIONAL([HAVE_DOXYGEN],
[test -n "$DOXYGEN"])AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([docs/doxyfile])])
#enable support for NFQUEUE
AM_CONDITIONAL([HAVE_PROTECTION_ENGINE],false)
NFQ_ENABLE="no"
#NFQ="no"
AC_ARG_ENABLE(nfqueue,
AS_HELP_STRING([--enable-nfqueue], [Enable NFQUEUE support for Protection Engine]),,[enable_nfqueue=no])
AS_IF([test "x$enable_nfqueue" = "xyes"], [
CFLAGS="$CFLAGS -DNFQ"
#libnfnetlink
case $host in
*-*-mingw32*)
;;
*)
AC_ARG_WITH(libnfnetlink_includes,
[ --with-libnfnetlink-includes=DIR libnfnetlink include directory],
[with_libnfnetlink_includes="$withval"],[with_libnfnetlink_includes=no])
AC_ARG_WITH(libnfnetlink_libraries,
[ --with-libnfnetlink-libraries=DIR libnfnetlink library directory],
[with_libnfnetlink_libraries="$withval"],[with_libnfnetlink_libraries="no"])
if test "$with_libnfnetlink_includes" != "no"; then
CPPFLAGS="${CPPFLAGS} -I${with_libnfnetlink_includes}"
fi
AC_CHECK_HEADER(libnfnetlink/libnfnetlink.h,,[AC_ERROR(libnfnetlink.h not found ...)])
if test "$with_libnfnetlink_libraries" != "no"; then
LDFLAGS="${LDFLAGS} -L${with_libnfnetlink_libraries}"
fi
AM_CONDITIONAL([HAVE_PROTECTION_ENGINE],true)
NFNL=""
AC_CHECK_LIB(nfnetlink, nfnl_fd,, NFNL="no")
if test "$NFNL" = "no"; then
echo
echo " ERROR! nfnetlink library not found, go get it"
echo " from www.netfilter.org."
echo " we automatically append libnetfilter_queue/ when searching"
echo " for headers etc. when the --with-libnfnetlink-inlcudes directive"
echo " is used"
echo
exit
fi
;;
esac
AC_ARG_ENABLE(valgrind,
AS_HELP_STRING([--enable-valgrind],
[compile with valgrind macros to assist with debugging]),[enable_valgrind=yes],[enable_valgrind=no])
AS_IF([test "x$enable_valgrind" = "xyes"],
[AC_CHECK_HEADERS(valgrind/memcheck.h,
[AC_DEFINE([USE_VALGRIND],[1], [Use Valgrind Macros])])])
#libnetfilter_queue
AC_ARG_WITH(libnetfilter_queue_includes,
[ --with-libnetfilter_queue-includes=DIR libnetfilter_queue include directory],
[with_libnetfilter_queue_includes="$withval"],[with_libnetfilter_queue_includes=no])
AC_ARG_WITH(libnetfilter_queue_libraries,
[ --with-libnetfilter_queue-libraries=DIR libnetfilter_queue library directory],
[with_libnetfilter_queue_libraries="$withval"],[with_libnetfilter_queue_libraries="no"])
if test "$with_libnetfilter_queue_includes" != "no"; then
CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_queue_includes}"
fi
AC_CHECK_HEADER(libnetfilter_queue/libnetfilter_queue.h,,[AC_ERROR(libnetfilter_queue/libnetfilter_queue.h not found ...)])
if test "$with_libnetfilter_queue_libraries" != "no"; then
LDFLAGS="${LDFLAGS} -L${with_libnetfilter_queue_libraries}"
fi
#LDFLAGS="${LDFLAGS} -lnetfilter_queue"
# NFQ=""
case $host in
*-*-mingw32*)
AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",-lws2_32)
AC_ARG_WITH(netfilterforwin_includes,
[ --with-netfilterforwin-includes=DIR netfilterforwin include directory],
[with_netfilterforwin_includes="$withval"],[with_netfilterforwin_includes=no])
if test "$with_netfilterforwin_includes" != "no"; then
CPPFLAGS="${CPPFLAGS} -I${with_netfilterforwin_includes}"
else
CPPFLAGS="${CPPFLAGS} -I../../netfilterforwin"
fi
;;
*)
AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",)
AC_CHECK_LIB([netfilter_queue], [nfq_set_queue_maxlen],AC_DEFINE_UNQUOTED([HAVE_NFQ_MAXLEN],[1],[Found queue max length support in netfilter_queue]) ,,[-lnfnetlink])
AC_CHECK_LIB([netfilter_queue], [nfq_set_verdict2],AC_DEFINE_UNQUOTED([HAVE_NFQ_SET_VERDICT2],[1],[Found nfq_set_verdict2 function in netfilter_queue]) ,,[-lnfnetlink])
# check if the argument to nfq_get_payload is signed or unsigned
AC_MSG_CHECKING([for signed nfq_get_payload payload argument])
STORECFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} -Werror"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[
#include <libnetfilter_queue/libnetfilter_queue.h>
],
[
char *pktdata;
nfq_get_payload(NULL, &pktdata);
])],
[libnetfilter_queue_nfq_get_payload_signed="yes"],
[libnetfilter_queue_nfq_get_payload_signed="no"])
AC_MSG_RESULT($libnetfilter_queue_nfq_get_payload_signed)
if test "x$libnetfilter_queue_nfq_get_payload_signed" = "xyes"; then
AC_DEFINE([NFQ_GET_PAYLOAD_SIGNED], [], [For signed version of nfq_get_payload])
fi
CFLAGS="${STORECFLAGS}"
;;
esac
if test "$NFQ" = "no"; then
echo
echo " ERROR! libnetfilter_queue library not found, go get it"
echo " from www.netfilter.org."
echo " we automatically append libnetfilter_queue/ when searching"
echo " for headers etc. when the --with-libnfq-includes directive"
echo " is used"
echo
exit 1
else
NFQ_ENABLE="yes"
fi
])
AC_ARG_ENABLE(malloc,
AS_HELP_STRING([--enable-malloc], [Enable malloc instead the glib allocator]),[enable_malloc=yes],[enable_malloc=no])
if test "x$enable_malloc" == "xyes"; then
AC_DEFINE([HAVE_MALLOC],[1],[Use malloc instead glib allocator])
fi
dnl IPv6 support
AC_ARG_ENABLE(ipv6,
AS_HELP_STRING([--enable-ipv6], [Enable IPv6 support]),[enable_ipv6=yes],[enable_ipv6=no])
if test x"$enable_ipv6" == "xyes"; then
AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
[AC_TRY_LINK([ #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],
[struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0; ],
[ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])])
if test "$ac_cv_ipv6_support" = yes; then
AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
fi
fi
AC_OUTPUT([
Makefile
asm/Makefile
extra/Makefile
src/utils/Makefile
src/opcodes/Makefile
src/bus/Makefile
src/core/Makefile
src/detection/Makefile
src/protection/Makefile
test/Makefile
test/pcapfiles/Makefile
docs/Makefile
samples/exploits/Makefile
samples/exploits/http/Makefile
samples/exploits/sip/Makefile
])
echo "
Polyvaccine
($PACKAGE_NAME) version $PACKAGE_VERSION
Platform................: $host
Prefix..................: $prefix
C preprocessor..........: $CPP
C Compiler..............: $CC
C preprocessor flags....: $CPPFLAGS
C compiler flags........: $CFLAGS
Linker flags............: $LDFLAGS
Extra libraries.........: $LIBS
Debug Build.............: $enable_debug
Doxygen.................: $enable_doxygen
Swig enable.............: $enable_swig
Protection Engine.......: $NFQ_ENABLE
IPv6 support............: $enable_ipv6
Pcre JIT support........: $pcre_jit_available
Valgrind support........: $enable_valgrind
Enable malloc...........: $enable_malloc
Seccomp support.........: $SECCOMP
"