]>
Commit | Line | Data |
---|---|---|
3fdfec86 | 1 | AC_INIT([suricata],[7.0.0-dev]) |
d258a11f | 2 | m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])AM_SILENT_RULES([yes]) |
900f1522 | 3 | AC_CONFIG_HEADERS([src/autoconf.h]) |
7dbc97b0 | 4 | AC_CONFIG_SRCDIR([src/suricata.c]) |
0cef0b88 | 5 | AC_CONFIG_MACRO_DIR(m4) |
600b0d7c | 6 | AM_INIT_AUTOMAKE([tar-ustar subdir-objects]) |
a3510f20 | 7 | |
0795dc1e | 8 | AC_LANG([C]) |
0795dc1e | 9 | LT_INIT |
119115d3 | 10 | PKG_PROG_PKG_CONFIG |
a3510f20 | 11 | |
ba81c4d2 VJ |
12 | dnl Taken from https://llvm.org/svn/llvm-project/llvm/trunk/autoconf/configure.ac |
13 | dnl check if we compile using clang or gcc. On some systems the gcc binary is | |
14 | dnl is actually clang, so do a compile test. | |
15 | AC_MSG_CHECKING([whether GCC or Clang is our compiler]) | |
16 | AC_LANG_PUSH([C]) | |
17 | compiler=unknown | |
18 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __clang__ | |
19 | #error | |
20 | #endif | |
21 | ]])], | |
22 | compiler=clang, | |
23 | [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __GNUC__ | |
24 | #error | |
25 | #endif | |
26 | ]])], | |
27 | compiler=gcc, [])]) | |
28 | AC_LANG_POP([C]) | |
29 | AC_MSG_RESULT([${compiler}]) | |
30 | ||
e3f00c3d HB |
31 | AC_ARG_WITH([clang], |
32 | [ --with-clang=PROGRAM path to Clang for compiling eBPF code. Use if the main C compiler is not Clang.], | |
33 | [CLANG="$withval"], | |
34 | [AS_IF([test "$compiler" = clang], | |
35 | [CLANG="$CC"], | |
36 | [AC_PATH_PROG([CLANG],[clang])])]) | |
37 | ||
38 | AC_SUBST([CLANG]) | |
39 | ||
ba81c4d2 VJ |
40 | case "$compiler" in |
41 | clang) | |
9858ae41 | 42 | CLANG_CFLAGS="-Wextra -Werror-implicit-function-declaration -Wno-error=unused-command-line-argument" |
ba81c4d2 VJ |
43 | AC_SUBST(CLANG_CFLAGS) |
44 | ;; | |
45 | gcc) | |
46 | dnl get gcc version | |
47 | AC_MSG_CHECKING([gcc version]) | |
48 | gccver=$($CC -dumpversion) | |
49 | gccvermajor=$(echo $gccver | cut -d . -f1) | |
50 | gccverminor=$(echo $gccver | cut -d . -f2) | |
51 | gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor) | |
52 | AC_MSG_RESULT($gccver) | |
53 | ||
54 | if test "$gccvernum" -ge "400"; then | |
1f94239d | 55 | dnl gcc 4.0 or later |
ba81c4d2 | 56 | GCC_CFLAGS="-Wextra -Werror-implicit-function-declaration" |
ba81c4d2 VJ |
57 | else |
58 | GCC_CFLAGS="-W" | |
59 | fi | |
60 | AC_SUBST(GCC_CFLAGS) | |
61 | ;; | |
62 | *) | |
63 | AC_MSG_WARN([unsupported/untested compiler, this may or may not work]) | |
64 | ;; | |
65 | esac | |
0ffa1c24 | 66 | |
89cee0ad | 67 | # Checks for programs. |
fa5939ca BR |
68 | AC_PROG_AWK |
69 | AC_PROG_CC | |
70 | AC_PROG_CPP | |
99d48cc9 | 71 | AC_PROG_RANLIB |
fa5939ca BR |
72 | AC_PROG_INSTALL |
73 | AC_PROG_LN_S | |
74 | AC_PROG_MAKE_SET | |
91e1256b | 75 | AC_PROG_GREP |
fa5939ca | 76 | |
24d6a164 | 77 | AC_PATH_PROG(HAVE_CYGPATH, cygpath, "no") |
ce0ae81d | 78 | AM_CONDITIONAL([HAVE_CYGPATH], [test "x$HAVE_CYGPATH" != "xno"]) |
24d6a164 | 79 | |
9f1d779a WM |
80 | AC_PATH_PROG(HAVE_PKG_CONFIG, pkg-config, "no") |
81 | if test "$HAVE_PKG_CONFIG" = "no"; then | |
89cee0ad VJ |
82 | echo |
83 | echo " ERROR! pkg-config not found, go get it " | |
84 | echo " http://pkg-config.freedesktop.org/wiki/ " | |
85 | echo " or install from your distribution " | |
86 | echo | |
87 | exit 1 | |
9f1d779a WM |
88 | fi |
89 | ||
a228986c JI |
90 | python_path="not set" |
91 | ||
dc1bd5b6 | 92 | AC_ARG_ENABLE(python, |
a228986c JI |
93 | AS_HELP_STRING([--enable-python], [Enable python]), |
94 | [enable_python=$enableval],[enable_python=yes]) | |
95 | if test "x$enable_python" != "xyes"; then | |
cd305c3a | 96 | enable_python="no" |
a228986c JI |
97 | else |
98 | AC_PATH_PROGS(HAVE_PYTHON, python3 python2.7 python2 python, "no") | |
99 | if test "$HAVE_PYTHON" = "no"; then | |
100 | echo | |
00ad7a91 JI |
101 | echo " Warning! Python not found." |
102 | echo | |
103 | echo " Python is required for additional tools like" | |
104 | echo " suricatasc, suricatactl and suricata-update." | |
105 | echo " It is also required when building from git." | |
a228986c JI |
106 | echo |
107 | enable_python="no" | |
108 | else | |
109 | python_path="$HAVE_PYTHON" | |
a228986c | 110 | fi |
cd305c3a | 111 | fi |
dc1bd5b6 | 112 | AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" = "xyes"]) |
cd305c3a | 113 | |
c4b856ea JI |
114 | # Get the Python major version. This is only for information |
115 | # messages displayed during configure. | |
116 | if test "x$HAVE_PYTHON" != "xno"; then | |
c44f82cf | 117 | pymv="$($HAVE_PYTHON -c 'import sys; print(sys.version_info[[0]]);')" |
c4b856ea JI |
118 | fi |
119 | ||
a69afd5c JI |
120 | # Check for python-distutils (setup). |
121 | have_python_distutils="no" | |
122 | if test "x$enable_python" = "xyes"; then | |
123 | AC_MSG_CHECKING([for python-distutils]) | |
124 | if $HAVE_PYTHON -c "import distutils; from distutils.core import setup" 2>/dev/null; then | |
125 | AC_MSG_RESULT([yes]) | |
126 | have_python_distutils="yes" | |
127 | else | |
128 | AC_MSG_RESULT([no]) | |
129 | fi | |
130 | fi | |
131 | AM_CONDITIONAL([HAVE_PYTHON_DISTUTILS], | |
132 | [test "x$have_python_distutils" = "xyes"]) | |
133 | if test "$have_python_distutils" = "no"; then | |
134 | echo "" | |
135 | echo " Warning: Python distutils not found. Python tools will" | |
136 | echo " not be installed." | |
137 | echo "" | |
109cf368 JI |
138 | echo " Install the distutils module for Python ${pymv} to enable" |
139 | echo " the Python tools." | |
a69afd5c JI |
140 | echo "" |
141 | fi | |
142 | ||
db367087 JI |
143 | # Check for python-yaml. |
144 | have_python_yaml="no" | |
145 | if test "x$enable_python" = "xyes"; then | |
146 | AC_MSG_CHECKING([for python-yaml]) | |
147 | if $HAVE_PYTHON -c "import yaml" 2>/dev/null; then | |
148 | have_python_yaml="yes" | |
149 | AC_MSG_RESULT([yes]) | |
150 | else | |
151 | AC_MSG_RESULT([no]) | |
152 | fi | |
153 | fi | |
154 | AM_CONDITIONAL([HAVE_PYTHON_YAML], [test "x$have_python_yaml" = "xyes"]) | |
155 | ||
daa9dcb7 EL |
156 | AC_PATH_PROG(HAVE_WGET, wget, "no") |
157 | if test "$HAVE_WGET" = "no"; then | |
158 | AC_PATH_PROG(HAVE_CURL, curl, "no") | |
159 | if test "$HAVE_CURL" = "no"; then | |
160 | echo | |
161 | echo " Warning curl or wget not found, you won't be able to" | |
162 | echo " download latest ruleset with 'make install-rules'" | |
163 | fi | |
164 | fi | |
165 | AM_CONDITIONAL([HAVE_FETCH_COMMAND], [test "x$HAVE_WGET" != "xno" || test "x$HAVE_CURL" != "xno"]) | |
166 | AM_CONDITIONAL([HAVE_WGET_COMMAND], [test "x$HAVE_WGET" != "xno"]) | |
7c841e1d | 167 | |
89cee0ad | 168 | # Checks for libraries. |
7c841e1d | 169 | |
89cee0ad | 170 | # Checks for header files. |
4086938f | 171 | AC_CHECK_HEADERS([stddef.h]) |
472e061c VJ |
172 | AC_CHECK_HEADERS([arpa/inet.h assert.h ctype.h errno.h fcntl.h inttypes.h]) |
173 | AC_CHECK_HEADERS([getopt.h]) | |
174 | AC_CHECK_HEADERS([limits.h netdb.h netinet/in.h poll.h sched.h signal.h]) | |
2c01985e | 175 | AC_CHECK_HEADERS([stdarg.h stdint.h stdio.h stdlib.h stdbool.h string.h strings.h sys/ioctl.h]) |
472e061c | 176 | AC_CHECK_HEADERS([syslog.h sys/prctl.h sys/socket.h sys/stat.h sys/syscall.h]) |
99d48cc9 | 177 | AC_CHECK_HEADERS([sys/time.h time.h unistd.h sys/param.h]) |
472e061c | 178 | AC_CHECK_HEADERS([sys/ioctl.h linux/if_ether.h linux/if_packet.h linux/filter.h]) |
fcc87595 | 179 | AC_CHECK_HEADERS([linux/ethtool.h linux/sockios.h]) |
df79613f | 180 | AC_CHECK_HEADERS([glob.h locale.h grp.h pwd.h]) |
bbb93e48 | 181 | AC_CHECK_HEADERS([dirent.h fnmatch.h]) |
c02739e5 | 182 | AC_CHECK_HEADERS([sys/resource.h sys/types.h sys/un.h]) |
9b94679f | 183 | AC_CHECK_HEADERS([sys/random.h]) |
dbdac737 | 184 | AC_CHECK_HEADERS([utime.h]) |
6ffa0507 | 185 | AC_CHECK_HEADERS([libgen.h]) |
99d48cc9 | 186 | AC_CHECK_HEADERS([mach/mach.h]) |
32cfd71f | 187 | AC_CHECK_HEADERS([stdatomic.h]) |
75bc9d9d | 188 | AC_CHECK_HEADERS([sys/queue.h]) |
472e061c VJ |
189 | |
190 | AC_CHECK_HEADERS([sys/socket.h net/if.h sys/mman.h linux/if_arp.h], [], [], | |
5656e344 | 191 | [[#ifdef HAVE_SYS_SOCKET_H |
472e061c VJ |
192 | #include <sys/types.h> |
193 | #include <sys/socket.h> | |
194 | #endif | |
5656e344 EL |
195 | ]]) |
196 | ||
d1b6be99 | 197 | AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h w32api/wtypes.h], [], [], |
06f9b0ad VJ |
198 | [[ |
199 | #ifndef _X86_ | |
200 | #define _X86_ | |
201 | #endif | |
b63c2eda | 202 | ]]) |
d1b6be99 | 203 | AC_CHECK_HEADERS([w32api/winbase.h wincrypt.h], [], [], |
06f9b0ad VJ |
204 | [[ |
205 | #ifndef _X86_ | |
206 | #define _X86_ | |
207 | #endif | |
208 | #include <windows.h> | |
b63c2eda | 209 | ]]) |
fa5939ca | 210 | |
89cee0ad | 211 | # Checks for typedefs, structures, and compiler characteristics. |
fa5939ca | 212 | AC_C_INLINE |
99d48cc9 | 213 | AC_C_RESTRICT |
fa5939ca | 214 | AC_TYPE_PID_T |
99d48cc9 | 215 | AC_TYPE_MODE_T |
fa5939ca | 216 | AC_TYPE_SIZE_T |
99d48cc9 VJ |
217 | AC_TYPE_SSIZE_T |
218 | AC_TYPE_INT8_T | |
219 | AC_TYPE_INT16_T | |
fa5939ca | 220 | AC_TYPE_INT32_T |
99d48cc9 VJ |
221 | AC_TYPE_INT64_T |
222 | AC_TYPE_UINT8_T | |
fa5939ca BR |
223 | AC_TYPE_UINT16_T |
224 | AC_TYPE_UINT32_T | |
225 | AC_TYPE_UINT64_T | |
7691fc4f VJ |
226 | AC_TYPE_UINT |
227 | AC_TYPE_USHORT | |
228 | AC_TYPE_ULONG | |
229 | AC_TYPE_UCHAR | |
99d48cc9 VJ |
230 | AC_STRUCT_TIMEZONE |
231 | AC_CHECK_TYPES([ptrdiff_t]) | |
fa5939ca BR |
232 | AC_HEADER_STDBOOL |
233 | ||
89cee0ad | 234 | # Checks for library functions. |
fa5939ca BR |
235 | AC_FUNC_MALLOC |
236 | AC_FUNC_REALLOC | |
99d48cc9 VJ |
237 | AC_FUNC_FORK |
238 | AC_FUNC_MKTIME | |
239 | AC_FUNC_MMAP | |
240 | AC_FUNC_STRTOD | |
241 | ||
242 | AC_CHECK_FUNCS([memmem memset memchr memrchr memmove]) | |
243 | AC_CHECK_FUNCS([strcasecmp strchr strrchr strdup strndup strncasecmp strtol strtoul strstr strpbrk strtoull strtoumax]) | |
244 | AC_CHECK_FUNCS([strerror]) | |
245 | AC_CHECK_FUNCS([gethostname inet_ntoa uname]) | |
246 | AC_CHECK_FUNCS([gettimeofday clock_gettime utime strptime tzset localtime_r]) | |
247 | AC_CHECK_FUNCS([socket setenv select putenv dup2 endgrent endpwent atexit munmap]) | |
ba81c4d2 | 248 | |
15b4554a JL |
249 | AC_CHECK_FUNCS([fwrite_unlocked]) |
250 | ||
9b94679f VJ |
251 | AC_CHECK_DECL([getrandom], |
252 | AC_DEFINE([HAVE_GETRANDOM], [1], [Use getrandom]), | |
253 | [], [ | |
254 | #include <sys/random.h> | |
255 | ]) | |
256 | ||
ba81c4d2 VJ |
257 | OCFLAGS=$CFLAGS |
258 | CFLAGS="" | |
8e946b92 | 259 | AC_CHECK_FUNCS([strlcpy strlcat]) |
ba81c4d2 | 260 | CFLAGS=$OCFLAGS |
fa5939ca | 261 | |
89cee0ad | 262 | # Add large file support |
3b3f5816 WM |
263 | AC_SYS_LARGEFILE |
264 | ||
89cee0ad | 265 | #check for os |
769022f4 PR |
266 | AC_MSG_CHECKING([host os]) |
267 | ||
5f1c8517 | 268 | # Default lua libname if not detected otherwise. |
7396237c VJ |
269 | LUA_LIB_NAME="lua5.1" |
270 | ||
769022f4 | 271 | # If no host os was detected, try with uname |
25804f5a | 272 | if test -z "$host" ; then |
769022f4 PR |
273 | host="`uname`" |
274 | fi | |
a49bce63 | 275 | echo -n "installation for $host OS... " |
769022f4 | 276 | |
a178ec6b | 277 | RUST_SURICATA_LIBNAME="libsuricata_rust.a" |
48566358 | 278 | |
15c98c60 AH |
279 | e_magic_file="" |
280 | e_magic_file_comment="#" | |
d1e839ea | 281 | PCAP_LIB_NAME="pcap" |
769022f4 | 282 | case "$host" in |
829238e4 | 283 | *-*-*freebsd*) |
7396237c | 284 | LUA_LIB_NAME="lua-5.1" |
829238e4 VJ |
285 | CFLAGS="${CFLAGS} -DOS_FREEBSD" |
286 | CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet11" | |
287 | LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/local/lib/libnet11" | |
48566358 | 288 | RUST_LDADD="-lrt -lm" |
829238e4 | 289 | ;; |
829238e4 | 290 | *-*-openbsd*) |
ddf9b417 | 291 | CFLAGS="${CFLAGS} -D__OpenBSD__" |
829238e4 VJ |
292 | CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1" |
293 | LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1" | |
8a2b94c6 | 294 | RUST_LDADD="-lm -lc++ -lc++abi" |
829238e4 VJ |
295 | ;; |
296 | *darwin*|*Darwin*) | |
1177d489 | 297 | LUA_LIB_NAME="lua-5.1" |
829238e4 VJ |
298 | CFLAGS="${CFLAGS} -DOS_DARWIN" |
299 | CPPFLAGS="${CPPFLAGS} -I/opt/local/include" | |
300 | LDFLAGS="${LDFLAGS} -L/opt/local/lib" | |
301 | ;; | |
302 | *-*-linux*) | |
e227d97e JI |
303 | # Always compile with -fPIC on Linux for shared library support. |
304 | CFLAGS="${CFLAGS} -fPIC" | |
56d93f42 | 305 | RUST_LDADD="-ldl -lrt -lm" |
e227d97e | 306 | can_build_shared_library="yes" |
829238e4 | 307 | ;; |
bae83e61 | 308 | *-*-mingw32*|*-*-msys) |
829238e4 | 309 | CFLAGS="${CFLAGS} -DOS_WIN32" |
829238e4 | 310 | WINDOWS_PATH="yes" |
d1e839ea | 311 | PCAP_LIB_NAME="wpcap" |
d8ddd3b5 | 312 | AC_DEFINE([HAVE_NON_POSIX_MKDIR], [1], [mkdir is not POSIX compliant: single arg]) |
10f639e9 | 313 | RUST_LDADD=" -lws2_32 -liphlpapi -lwbemuuid -lOle32 -lOleAut32 -lUuid -luserenv -lshell32 -ladvapi32 -lgcc_eh" |
829238e4 VJ |
314 | ;; |
315 | *-*-cygwin) | |
43c5b949 | 316 | LUA_LIB_NAME="lua" |
829238e4 | 317 | WINDOWS_PATH="yes" |
d1e839ea | 318 | PCAP_LIB_NAME="wpcap" |
829238e4 | 319 | ;; |
7847c4f8 VJ |
320 | *-*-solaris*) |
321 | AC_MSG_WARN([support for Solaris/Illumos/SunOS is experimental]) | |
322 | LDFLAGS="${LDFLAGS} -lsocket -lnsl" | |
323 | ;; | |
829238e4 VJ |
324 | *) |
325 | AC_MSG_WARN([unsupported OS this may or may not work]) | |
326 | ;; | |
769022f4 PR |
327 | esac |
328 | AC_MSG_RESULT(ok) | |
329 | ||
f8159bd3 VJ |
330 | # check if our target supports c11 |
331 | AC_MSG_CHECKING(for c11 support) | |
332 | OCFLAGS=$CFLAGS | |
333 | CFLAGS="-std=c11" | |
3ba4afd4 VJ |
334 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], |
335 | [[ static _Thread_local int i; i = 1; i++; ]])], | |
f8159bd3 VJ |
336 | AC_MSG_RESULT([yes]) |
337 | [AC_DEFINE([TLS_C11], [1], [C11 Thread local storage]) | |
338 | CFLAGS="$OCFLAGS -std=c11"], | |
3ba4afd4 | 339 | [AC_MSG_RESULT([no]) |
f8159bd3 VJ |
340 | CFLAGS="$OCFLAGS" |
341 | have_c11=no | |
3ba4afd4 | 342 | have_c11_tls=no]) |
f8159bd3 VJ |
343 | if [ test "x$have_c11" = "xno" ]; then |
344 | CFLAGS="$CFLAGS -std=gnu99" | |
345 | fi | |
346 | ||
3ba4afd4 VJ |
347 | # check if our target supports thread local storage |
348 | AC_MSG_CHECKING(for thread local storage gnu __thread support) | |
349 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]], | |
350 | [[ static __thread int i; i = 1; i++; ]])], | |
351 | [AC_DEFINE([TLS_GNU], [1], [Thread local storage]) | |
352 | AC_MSG_RESULT([yes])], | |
353 | [AC_MSG_RESULT([no]) | |
354 | have_gnu_tls=no]) | |
355 | if [ test "x$have_c11_tls" = "xno" ] && [ test "x$have_gnu_tls" = "xno" ]; then | |
356 | AC_MSG_ERROR("no thread local support available.") | |
357 | exit 1 | |
358 | fi | |
900918a5 | 359 | |
89cee0ad VJ |
360 | #Enable support for gcc compile time security options. There is no great way to do detection of valid cflags that I have found |
361 | #AX_CFLAGS_GCC_OPTION don't seem to do a better job than the code below and are a pain because of extra m4 files etc. | |
362 | #These flags seem to be supported on CentOS 5+, Ubuntu 8.04+, and FedoreCore 11+ | |
363 | #Options are taken from https://wiki.ubuntu.com/CompilerFlags | |
c49785fb | 364 | AC_ARG_ENABLE(gccprotect, |
d01ce2e5 | 365 | AS_HELP_STRING([--enable-gccprotect], [Detect and use gcc hardening options]),[enable_gccprotect=$enableval],[enable_gccprotect=no]) |
c49785fb | 366 | |
e07e9e16 | 367 | AS_IF([test "x$enable_gccprotect" = "xyes"], [ |
98b9009b WM |
368 | #buffer overflow protection |
369 | AC_MSG_CHECKING(for -fstack-protector) | |
370 | TMPCFLAGS="${CFLAGS}" | |
371 | CFLAGS="${CFLAGS} -fstack-protector" | |
0795dc1e AH |
372 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="-fstack-protector" |
373 | AC_MSG_RESULT(yes)], | |
374 | [AC_MSG_RESULT(no)]) | |
98b9009b WM |
375 | CFLAGS="${TMPCFLAGS}" |
376 | ||
377 | #compile-time best-practices errors for certain libc functions, provides checks of buffer lengths and memory regions | |
378 | AC_MSG_CHECKING(for -D_FORTIFY_SOURCE=2) | |
379 | TMPCFLAGS="${CFLAGS}" | |
380 | CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=2" | |
0795dc1e AH |
381 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="${SECCFLAGS} -D_FORTIFY_SOURCE=2" |
382 | AC_MSG_RESULT(yes)], | |
383 | [AC_MSG_RESULT(no)]) | |
98b9009b WM |
384 | CFLAGS="${TMPCFLAGS}" |
385 | ||
386 | #compile-time warnings about misuse of format strings | |
387 | AC_MSG_CHECKING(for -Wformat -Wformat-security) | |
388 | TMPCFLAGS="${CFLAGS}" | |
389 | CFLAGS="${CFLAGS} -Wformat -Wformat-security" | |
0795dc1e AH |
390 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="${SECCFLAGS} -Wformat -Wformat-security" |
391 | AC_MSG_RESULT(yes)], | |
392 | [AC_MSG_RESULT(no)]) | |
98b9009b WM |
393 | CFLAGS="${TMPCFLAGS}" |
394 | ||
395 | #provides a read-only relocation table area in the final ELF | |
396 | AC_MSG_CHECKING(for -z relro) | |
397 | TMPLDFLAGS="${LDFLAGS}" | |
398 | LDFLAGS="${LDFLAGS} -z relro" | |
0795dc1e AH |
399 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECLDFLAGS="${SECLDFLAGS} -z relro" |
400 | AC_MSG_RESULT(yes)], | |
401 | [AC_MSG_RESULT(no)]) | |
98b9009b WM |
402 | LDFLAGS="${TMPLDFLAGS}" |
403 | ||
404 | #forces all relocations to be resolved at run-time | |
405 | AC_MSG_CHECKING(for -z now) | |
406 | TMPLDFLAGS="${LDFLAGS}" | |
407 | LDFLAGS="${LDFLAGS} -z now" | |
0795dc1e AH |
408 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECLDFLAGS="${SECLDFLAGS} -z now" |
409 | AC_MSG_RESULT(yes)], | |
410 | [AC_MSG_RESULT(no)]) | |
98b9009b WM |
411 | LDFLAGS="${TMPLDFLAGS}" |
412 | ||
ba81c4d2 VJ |
413 | AC_SUBST(SECCFLAGS) |
414 | AC_SUBST(SECLDFLAGS) | |
e07e9e16 | 415 | ]) |
5bde1217 | 416 | |
ff81212d JI |
417 | #check for plugin support |
418 | AC_CHECK_HEADERS([dlfcn.h]) | |
419 | AC_MSG_CHECKING([for plugin support]) | |
420 | TMPLDFLAGS="${LDFLAGS}" | |
421 | LDFLAGS="${LDFLAGS} -rdynamic" | |
422 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <dlfcn.h>]], [[]])], | |
423 | [ | |
424 | AC_MSG_RESULT(yes) | |
425 | has_rdynamic=yes | |
426 | ], | |
427 | [ | |
428 | AC_MSG_RESULT(no) | |
429 | has_rdynamic=no | |
430 | ]) | |
431 | ||
432 | if test "x$has_rdynamic" = "xyes"; then | |
433 | plugin_support=yes | |
434 | AC_DEFINE([HAVE_PLUGINS], [1], [Plugin support]) | |
435 | else | |
436 | plugin_support=no | |
437 | LDFLAGS="${TMPLDFLAGS}" | |
438 | fi | |
439 | ||
89cee0ad | 440 | #enable profile generation |
5bde1217 | 441 | AC_ARG_ENABLE(gccprofile, |
d01ce2e5 | 442 | AS_HELP_STRING([--enable-gccprofile], [Enable gcc profile info i.e -pg flag is set]),[enable_gccprofile=$enableval],[enable_gccprofile=no]) |
e07e9e16 WM |
443 | AS_IF([test "x$enable_gccprofile" = "xyes"], [ |
444 | CFLAGS="${CFLAGS} -pg" | |
445 | ]) | |
5bde1217 | 446 | |
89cee0ad | 447 | #enable gcc march=native gcc 4.2 or later |
22f3e3d8 | 448 | AC_ARG_ENABLE(gccmarch_native, |
d01ce2e5 | 449 | AS_HELP_STRING([--enable-gccmarch-native], [Enable gcc march=native gcc 4.2 and later only]),[enable_gccmarch_native=$enableval],[enable_gccmarch_native=yes]) |
e07e9e16 | 450 | AS_IF([test "x$enable_gccmarch_native" = "xyes"], [ |
ffba26d0 VJ |
451 | case "$host" in |
452 | *powerpc*) | |
453 | ;; | |
454 | *) | |
37b05b23 EL |
455 | OFLAGS="$CFLAGS" |
456 | CFLAGS="$CFLAGS -march=native" | |
457 | AC_MSG_CHECKING([checking if $CC supports -march=native]) | |
458 | AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h>]])], | |
459 | [ | |
460 | AC_MSG_RESULT([yes]) | |
ba81c4d2 VJ |
461 | OPTIMIZATION_CFLAGS="-march=native" |
462 | AC_SUBST(OPTIMIZATION_CFLAGS) | |
37b05b23 EL |
463 | ], |
464 | [ | |
465 | AC_MSG_RESULT([no]) | |
466 | CFLAGS="$OFLAGS" | |
467 | enable_gccmarch_native=no | |
468 | ] | |
469 | ) | |
ffba26d0 VJ |
470 | ;; |
471 | esac | |
e07e9e16 | 472 | ]) |
22f3e3d8 | 473 | |
89cee0ad VJ |
474 | # options |
475 | ||
600b0d7c | 476 | |
89cee0ad VJ |
477 | # enable the running of unit tests |
478 | AC_ARG_ENABLE(unittests, | |
d01ce2e5 | 479 | AS_HELP_STRING([--enable-unittests], [Enable compilation of the unit tests]),[enable_unittests=$enableval],[enable_unittests=no]) |
89cee0ad | 480 | AS_IF([test "x$enable_unittests" = "xyes"], [ |
ba81c4d2 | 481 | AC_DEFINE([UNITTESTS],[1],[Enable built-in unittests]) |
89cee0ad | 482 | ]) |
89cee0ad VJ |
483 | AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$enable_unittests" = "xyes"]) |
484 | ||
91e1256b EL |
485 | # enable the building of ebpf files |
486 | AC_ARG_ENABLE(ebpf-build, | |
d01ce2e5 | 487 | AS_HELP_STRING([--enable-ebpf-build], [Enable compilation of ebpf files]),[enable_ebpf_build=$enableval],[enable_ebpf_build=no]) |
91e1256b EL |
488 | AM_CONDITIONAL([BUILD_EBPF], [test "x$enable_ebpf_build" = "xyes"]) |
489 | ||
f105bb72 HB |
490 | AS_IF([test "x$enable_ebpf_build" = "xyes"], |
491 | [ | |
492 | AS_IF([test "$CLANG" != no], | |
493 | [ | |
37b1595c | 494 | llc_candidates=$($CLANG --version | sed -e 's/.*clang version/clang version/' | \ |
f105bb72 HB |
495 | awk '/^clang version/ { |
496 | split($3, v, "."); | |
497 | printf("llc-%s.%s llc-%s llc", v[[1]], v[[2]], v[[1]]) | |
498 | }') | |
499 | AC_CHECK_PROGS([LLC], [$llc_candidates], "no") | |
d14fe372 JI |
500 | if test "$LLC" = "no"; then |
501 | AC_MSG_ERROR([unable to find any of $llc_candidates needed to build ebpf files]) | |
502 | fi | |
503 | AC_SUBST(LLC) | |
f105bb72 HB |
504 | ], |
505 | [AC_MSG_ERROR([clang needed to build ebpf files])]) | |
506 | ]) | |
91e1256b | 507 | |
89cee0ad VJ |
508 | # enable debug output |
509 | AC_ARG_ENABLE(debug, | |
d01ce2e5 | 510 | AS_HELP_STRING([--enable-debug], [Enable debug output]),[enable_debug=$enableval],[enable_debug=no]) |
89cee0ad | 511 | AS_IF([test "x$enable_debug" = "xyes"], [ |
ba81c4d2 | 512 | AC_DEFINE([DEBUG],[1],[Enable debug output]) |
89cee0ad | 513 | ]) |
ba81c4d2 | 514 | AM_CONDITIONAL([DEBUG], [test "x$enable_debug" = "xyes"]) |
89cee0ad VJ |
515 | |
516 | # enable debug validation functions & macro's output | |
517 | AC_ARG_ENABLE(debug-validation, | |
d01ce2e5 | 518 | AS_HELP_STRING([--enable-debug-validation], [Enable (debug) validation code output]),[enable_debug_validation=$enableval],[enable_debug_validation=no]) |
89cee0ad | 519 | AS_IF([test "x$enable_debug_validation" = "xyes"], [ |
a18af732 AH |
520 | if test "$enable_unittests" = "yes"; then |
521 | AC_MSG_ERROR([debug_validation can't be enabled with enabled unittests!]) | |
522 | else | |
523 | AC_DEFINE([DEBUG_VALIDATION],[1],[Enable (debug) validation code output]) | |
524 | fi | |
89cee0ad | 525 | ]) |
6db1f19d | 526 | AM_CONDITIONAL([DEBUG_VALIDATION], [test "x$enable_debug_validation" = "xyes"]) |
89cee0ad VJ |
527 | |
528 | # profiling support | |
529 | AC_ARG_ENABLE(profiling, | |
d01ce2e5 | 530 | AS_HELP_STRING([--enable-profiling], [Enable performance profiling]),[enable_profiling=$enableval],[enable_profiling=no]) |
89cee0ad | 531 | AS_IF([test "x$enable_profiling" = "xyes"], [ |
ba81c4d2 VJ |
532 | case "$host" in |
533 | *-*-openbsd*) | |
534 | AC_MSG_ERROR([profiling is not supported on OpenBSD]) | |
535 | ;; | |
536 | *) | |
537 | AC_DEFINE([PROFILING],[1],[Enable performance profiling]) | |
538 | ;; | |
539 | esac | |
89cee0ad VJ |
540 | ]) |
541 | ||
d908e707 VJ |
542 | # profiling support, locking |
543 | AC_ARG_ENABLE(profiling-locks, | |
d01ce2e5 | 544 | AS_HELP_STRING([--enable-profiling-locks], [Enable performance profiling for locks]),[enable_profiling_locks=$enableval],[enable_profiling_locks=no]) |
d908e707 | 545 | AS_IF([test "x$enable_profiling_locks" = "xyes"], [ |
ba81c4d2 VJ |
546 | AC_DEFINE([PROFILING],[1],[Enable performance profiling]) |
547 | AC_DEFINE([PROFILE_LOCKING],[1],[Enable performance profiling for locks]) | |
d908e707 VJ |
548 | ]) |
549 | ||
89cee0ad VJ |
550 | # enable support for IPFW |
551 | AC_ARG_ENABLE(ipfw, | |
d01ce2e5 | 552 | AS_HELP_STRING([--enable-ipfw], [Enable FreeBSD IPFW support for inline IDP]),[enable_ipfw=$enableval],[enable_ipfw=no]) |
89cee0ad | 553 | AS_IF([test "x$enable_ipfw" = "xyes"], [ |
ba81c4d2 | 554 | AC_DEFINE([IPFW],[1],[Enable FreeBSD IPFW support for inline IDP]) |
89cee0ad VJ |
555 | ]) |
556 | ||
7fb860ac | 557 | AC_ARG_ENABLE(coccinelle, |
20dd5939 | 558 | AS_HELP_STRING([--disable-coccinelle], [Disable coccinelle QA steps during make check]),[enable_coccinelle="$enableval"],[enable_coccinelle=yes]) |
7fb860ac VJ |
559 | AS_IF([test "x$enable_coccinelle" = "xyes"], [ |
560 | AC_PATH_PROG(HAVE_COCCINELLE_CONFIG, spatch, "no") | |
561 | if test "$HAVE_COCCINELLE_CONFIG" = "no"; then | |
e4b39a41 | 562 | enable_coccinelle=no |
7fb860ac VJ |
563 | fi |
564 | ]) | |
565 | AM_CONDITIONAL([HAVE_COCCINELLE], [test "x$enable_coccinelle" != "xno"]) | |
566 | ||
f4872a2f VJ |
567 | # disable detection |
568 | AC_ARG_ENABLE(detection, | |
20dd5939 | 569 | AS_HELP_STRING([--disable-detection], [Disable Detection Modules]), [enable_detection="$enableval"],[enable_detection=yes]) |
f4872a2f | 570 | AS_IF([test "x$enable_detection" = "xno"], [ |
65d8ae93 | 571 | AC_DEFINE([HAVE_DETECT_DISABLED], [1], [Detection is disabled]) |
f4872a2f VJ |
572 | ]) |
573 | ||
89cee0ad VJ |
574 | # libraries |
575 | ||
b60065ca GL |
576 | # zlib |
577 | AC_ARG_WITH(zlib_includes, | |
578 | [ --with-zlib-includes=DIR zlib include directory], | |
579 | [with_zlib_includes="$withval"],[with_zlib_includes=no]) | |
580 | AC_ARG_WITH(zlib_libraries, | |
581 | [ --with-zlib-libraries=DIR zlib library directory], | |
582 | [with_zlib_libraries="$withval"],[with_zlib_libraries="no"]) | |
583 | ||
584 | if test "$with_zlib_includes" != "no"; then | |
585 | CPPFLAGS="${CPPFLAGS} -I${with_zlib_includes}" | |
586 | fi | |
587 | ||
588 | AC_CHECK_HEADER(zlib.h, ZLIB="yes",ZLIB="no") | |
589 | if test "$ZLIB" = "yes"; then | |
590 | if test "$with_zlib_libraries" != "no"; then | |
591 | LDFLAGS="${LDFLAGS} -L${with_zlib_libraries}" | |
592 | fi | |
593 | ||
594 | # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work | |
595 | # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
596 | ZLIB="" | |
597 | TMPLIBS="${LIBS}" | |
598 | AC_CHECK_LIB(z,inflate,,ZLIB="no") | |
599 | ||
600 | if test "$ZLIB" = "no"; then | |
601 | echo | |
602 | echo " ERROR! zlib library not found, go get it" | |
b98c28a6 | 603 | echo " Debian/Ubuntu: apt install zlib1g-dev" |
604 | echo " Fedora: dnf install zlib-devel" | |
605 | echo " CentOS/RHEL: yum install zlib-devel" | |
b60065ca GL |
606 | echo |
607 | exit 1 | |
608 | fi | |
609 | LIBS="${TMPLIBS} -lz" | |
610 | fi | |
611 | ||
acb1ab08 PA |
612 | PCRE2="" |
613 | AC_CHECK_LIB(pcre2-8, pcre2_compile_8,,PCRE2="no") | |
614 | if test "$PCRE2" = "no"; then | |
615 | echo | |
616 | echo " ERROR! pcre2 library not found, go get it" | |
617 | echo " from www.pcre.org. Or from packages:" | |
618 | echo " Debian/Ubuntu: apt install libpcre2-dev" | |
619 | echo " Fedora: dnf install pcre2-devel" | |
620 | echo " CentOS/RHEL: yum install pcre2-devel" | |
621 | echo | |
622 | exit 1 | |
623 | fi | |
624 | ||
625 | AC_DEFINE([PCRE2_CODE_UNIT_WIDTH], [8], [Pcre code unit width is 8 bits]) | |
626 | AC_MSG_CHECKING(for PCRE2 JIT support) | |
627 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre2.h> ]], | |
628 | [[ | |
629 | int jit = 0; | |
630 | pcre2_config(PCRE2_CONFIG_JIT, &jit); | |
631 | ]])],[ pcre2_jit_available=yes ],[ pcre2_jit_available=no ] | |
632 | ) | |
633 | if test "x$pcre2_jit_available" = "xyes"; then | |
634 | AC_MSG_RESULT(yes) | |
635 | AC_DEFINE([PCRE2_HAVE_JIT], [1], [Pcre2 with JIT compiler support enabled]) | |
636 | else | |
637 | AC_MSG_RESULT(no) | |
638 | fi | |
639 | ||
13b87f5a JV |
640 | # libhs |
641 | enable_hyperscan="no" | |
642 | ||
643 | # Try pkg-config first: | |
644 | PKG_CHECK_MODULES([libhs], libhs,, [with_pkgconfig_libhs=no]) | |
645 | if test "$with_pkgconfig_libhs" != "no"; then | |
646 | CPPFLAGS="${CPPFLAGS} ${libhs_CFLAGS}" | |
647 | LIBS="${LIBS} ${libhs_LIBS}" | |
648 | fi | |
649 | ||
650 | AC_ARG_WITH(libhs_includes, | |
651 | [ --with-libhs-includes=DIR libhs include directory], | |
652 | [with_libhs_includes="$withval"],[with_libhs_includes=no]) | |
653 | AC_ARG_WITH(libhs_libraries, | |
654 | [ --with-libhs-libraries=DIR libhs library directory], | |
655 | [with_libhs_libraries="$withval"],[with_libhs_libraries="no"]) | |
656 | ||
657 | if test "$with_libhs_includes" != "no"; then | |
658 | CPPFLAGS="${CPPFLAGS} -I${with_libhs_includes}" | |
659 | fi | |
660 | AC_CHECK_HEADER(hs.h,HYPERSCAN="yes",HYPERSCAN="no") | |
661 | if test "$HYPERSCAN" = "yes"; then | |
662 | if test "$with_libhs_libraries" != "no"; then | |
663 | LDFLAGS="${LDFLAGS} -L${with_libhs_libraries}" | |
664 | fi | |
665 | ||
666 | AC_CHECK_LIB(hs,hs_compile,,HYPERSCAN="no") | |
e6044aaf | 667 | AC_CHECK_FUNCS(hs_valid_platform) |
13b87f5a JV |
668 | enable_hyperscan="yes" |
669 | if test "$HYPERSCAN" = "no"; then | |
670 | echo | |
671 | echo " Hyperscan headers are present, but link test failed." | |
672 | echo " Check that you have a shared library and C++ linkage available." | |
673 | echo | |
674 | enable_hyperscan="no" | |
675 | fi | |
676 | fi | |
677 | AS_IF([test "x$enable_hyperscan" = "xyes"], [AC_DEFINE([BUILD_HYPERSCAN], [1], [Intel Hyperscan support enabled])]) | |
678 | ||
89cee0ad | 679 | # libyaml |
c91a4baa JI |
680 | AC_ARG_WITH(libyaml_includes, |
681 | [ --with-libyaml-includes=DIR libyaml include directory], | |
682 | [with_libyaml_includes="$withval"],[with_libyaml_includes=no]) | |
683 | AC_ARG_WITH(libyaml_libraries, | |
684 | [ --with-libyaml-libraries=DIR libyaml library directory], | |
685 | [with_libyaml_libraries="$withval"],[with_libyaml_libraries="no"]) | |
686 | ||
687 | if test "$with_libyaml_includes" != "no"; then | |
89f83c2e | 688 | CPPFLAGS="${CPPFLAGS} -I${with_libyaml_includes}" |
c91a4baa JI |
689 | fi |
690 | ||
691 | AC_CHECK_HEADER(yaml.h,,LIBYAML="no") | |
692 | ||
693 | if test "$with_libyaml_libraries" != "no"; then | |
ba81c4d2 | 694 | LDFLAGS="${LDFLAGS} -L${with_libyaml_libraries}" |
c91a4baa JI |
695 | fi |
696 | ||
697 | LIBYAML="" | |
698 | AC_CHECK_LIB(yaml,yaml_parser_initialize,,LIBYAML="no") | |
699 | ||
700 | if test "$LIBYAML" = "no"; then | |
89cee0ad VJ |
701 | echo |
702 | echo " ERROR! libyaml library not found, go get it" | |
703 | echo " from http://pyyaml.org/wiki/LibYAML " | |
704 | echo " or your distribution:" | |
705 | echo | |
706 | echo " Ubuntu: apt-get install libyaml-dev" | |
015cd930 | 707 | echo " Fedora: dnf install libyaml-devel" |
708 | echo " CentOS/RHEL: yum install libyaml-devel" | |
89cee0ad VJ |
709 | echo |
710 | exit 1 | |
c91a4baa JI |
711 | fi |
712 | ||
89cee0ad | 713 | # libpthread |
a3510f20 WM |
714 | AC_ARG_WITH(libpthread_includes, |
715 | [ --with-libpthread-includes=DIR libpthread include directory], | |
716 | [with_libpthread_includes="$withval"],[with_libpthread_includes=no]) | |
717 | AC_ARG_WITH(libpthread_libraries, | |
718 | [ --with-libpthread-libraries=DIR libpthread library directory], | |
719 | [with_libpthread_libraries="$withval"],[with_libpthread_libraries="no"]) | |
720 | ||
721 | if test "$with_libpthread_includes" != "no"; then | |
89f83c2e | 722 | CPPFLAGS="${CPPFLAGS} -I${with_libpthread_includes}" |
a3510f20 | 723 | fi |
6899b3da | 724 | |
0795dc1e | 725 | dnl AC_CHECK_HEADER(pthread.h,,[AC_MSG_ERROR(pthread.h not found ...)]) |
6899b3da | 726 | |
a3510f20 | 727 | if test "$with_libpthread_libraries" != "no"; then |
89f83c2e | 728 | LDFLAGS="${LDFLAGS} -L${with_libpthread_libraries}" |
a3510f20 | 729 | fi |
6899b3da | 730 | |
a3510f20 WM |
731 | PTHREAD="" |
732 | AC_CHECK_LIB(pthread, pthread_create,, PTHREAD="no") | |
6899b3da | 733 | |
a3510f20 | 734 | if test "$PTHREAD" = "no"; then |
89f83c2e VJ |
735 | echo |
736 | echo " ERROR! libpthread library not found, glibc problem?" | |
737 | echo | |
738 | exit 1 | |
a3510f20 WM |
739 | fi |
740 | ||
9b05db7d FF |
741 | AC_CHECK_FUNCS([pthread_spin_unlock]) |
742 | ||
20a8b9db | 743 | # libjansson |
20a8b9db EL |
744 | AC_ARG_WITH(libjansson_includes, |
745 | [ --with-libjansson-includes=DIR libjansson include directory], | |
746 | [with_libjansson_includes="$withval"],[with_libjansson_includes=no]) | |
747 | AC_ARG_WITH(libjansson_libraries, | |
748 | [ --with-libjansson-libraries=DIR libjansson library directory], | |
749 | [with_libjansson_libraries="$withval"],[with_libjansson_libraries="no"]) | |
750 | ||
751 | if test "$with_libjansson_includes" != "no"; then | |
752 | CPPFLAGS="${CPPFLAGS} -I${with_libjansson_includes}" | |
753 | fi | |
754 | ||
e49c4042 JI |
755 | if test "$with_libjansson_libraries" != "no"; then |
756 | LDFLAGS="${LDFLAGS} -L${with_libjansson_libraries}" | |
757 | fi | |
758 | ||
759 | AC_CHECK_HEADER(jansson.h,JANSSON="yes",JANSSON="no") | |
760 | AC_CHECK_LIB(jansson, json_dump_callback,, JANSSON="no") | |
761 | ||
762 | if test "$JANSSON" = "no"; then | |
763 | echo "" | |
764 | echo " ERROR: Jansson is now required." | |
765 | echo "" | |
766 | echo " Go get it from your distribution or from:" | |
767 | echo " http://www.digip.org/jansson/" | |
768 | echo "" | |
769 | echo " Ubuntu/Debian: apt install libjansson-dev" | |
770 | echo " CentOS: yum install jansson-devel" | |
771 | echo " Fedora: dnf install jansson-devel" | |
772 | echo "" | |
773 | exit 1 | |
774 | fi | |
775 | ||
776 | enable_jansson="yes" | |
20a8b9db | 777 | enable_unixsocket="no" |
7d706563 EL |
778 | |
779 | AC_ARG_ENABLE(unix-socket, | |
780 | AS_HELP_STRING([--enable-unix-socket], [Enable unix socket [default=test]]),[enable_unixsocket="$enableval"],[enable_unixsocket=test]) | |
781 | ||
20a8b9db | 782 | if test "$JANSSON" = "yes"; then |
20a8b9db EL |
783 | enable_jansson="yes" |
784 | if test "$JANSSON" = "no"; then | |
785 | echo | |
0470c0f6 | 786 | echo " Jansson >= 2.2 is required for features like unix socket" |
42227e87 | 787 | echo " Go get it from your distribution or from:" |
b98c28a6 | 788 | echo " http://www.digip.org/jansson/" |
789 | echo " Ubuntu: apt-get install libjansson-dev" | |
790 | echo " Fedora: dnf install jansson-devel" | |
791 | echo " CentOS/RHEL: yum install jansson-devel" | |
20a8b9db | 792 | echo |
ba81c4d2 | 793 | if test "x$enable_unixsocket" = "xyes"; then |
7d706563 EL |
794 | exit 1 |
795 | fi | |
20a8b9db EL |
796 | enable_unixsocket="no" |
797 | enable_jansson="no" | |
798 | else | |
799 | case $host in | |
bae83e61 | 800 | *-*-mingw32*|*-*-msys*|*-*-cygwin) |
1261d30d | 801 | enable_unixsocket="no" |
ba81c4d2 | 802 | ;; |
20a8b9db | 803 | *) |
ba81c4d2 VJ |
804 | if test "x$enable_unixsocket" = "xtest"; then |
805 | enable_unixsocket="yes" | |
806 | fi | |
807 | ;; | |
20a8b9db EL |
808 | esac |
809 | fi | |
7d706563 EL |
810 | else |
811 | if test "x$enable_unixsocket" = "xyes"; then | |
812 | echo | |
813 | echo " Jansson >= 2.2 is required for features like unix socket" | |
42227e87 | 814 | echo " Go get it from your distribution or from:" |
7d706563 | 815 | echo " http://www.digip.org/jansson/" |
b98c28a6 | 816 | echo " Ubuntu: apt-get install libjansson-dev" |
817 | echo " Fedora: dnf install jansson-devel" | |
818 | echo " CentOS/RHEL: yum install jansson-devel" | |
7d706563 EL |
819 | echo |
820 | exit 1 | |
821 | fi | |
822 | enable_unixsocket="no" | |
20a8b9db EL |
823 | fi |
824 | ||
825 | AS_IF([test "x$enable_unixsocket" = "xyes"], [AC_DEFINE([BUILD_UNIX_SOCKET], [1], [Unix socket support enabled])]) | |
f55dbca5 | 826 | e_enable_evelog=$enable_jansson |
20a8b9db | 827 | |
5f4b745f EL |
828 | AC_ARG_ENABLE(nflog, |
829 | AS_HELP_STRING([--enable-nflog],[Enable libnetfilter_log support]), | |
d01ce2e5 | 830 | [ enable_nflog="$enableval"], |
5f4b745f EL |
831 | [ enable_nflog="no"]) |
832 | AC_ARG_ENABLE(nfqueue, | |
d01ce2e5 | 833 | AS_HELP_STRING([--enable-nfqueue], [Enable NFQUEUE support for inline IDP]),[enable_nfqueue=$enableval],[enable_nfqueue=no]) |
15766ce2 AH |
834 | if test "$enable_nfqueue" != "no"; then |
835 | PKG_CHECK_MODULES([libnetfilter_queue], [libnetfilter_queue], [enable_nfqueue=yes], [enable_nfqueue=no]) | |
836 | CPPFLAGS="${CPPFLAGS} ${libnetfilter_queue_CFLAGS}" | |
837 | fi | |
0ffa1c24 | 838 | |
5f4b745f EL |
839 | if test "x$enable_nflog" = "xyes" || test "x$enable_nfqueue" = "xyes"; then |
840 | # libnfnetlink | |
841 | case $host in | |
842 | *-*-mingw32*) | |
843 | ;; | |
844 | *) | |
845 | AC_ARG_WITH(libnfnetlink_includes, | |
846 | [ --with-libnfnetlink-includes=DIR libnfnetlink include directory], | |
847 | [with_libnfnetlink_includes="$withval"],[with_libnfnetlink_includes=no]) | |
848 | AC_ARG_WITH(libnfnetlink_libraries, | |
849 | [ --with-libnfnetlink-libraries=DIR libnfnetlink library directory], | |
850 | [with_libnfnetlink_libraries="$withval"],[with_libnfnetlink_libraries="no"]) | |
851 | ||
852 | if test "$with_libnfnetlink_includes" != "no"; then | |
853 | CPPFLAGS="${CPPFLAGS} -I${with_libnfnetlink_includes}" | |
854 | fi | |
0ffa1c24 | 855 | |
5f4b745f EL |
856 | if test "$with_libnfnetlink_libraries" != "no"; then |
857 | LDFLAGS="${LDFLAGS} -L${with_libnfnetlink_libraries}" | |
858 | fi | |
0ffa1c24 | 859 | |
5f4b745f EL |
860 | NFNL="" |
861 | AC_CHECK_LIB(nfnetlink, nfnl_fd,, NFNL="no") | |
862 | ||
863 | if test "$NFNL" = "no"; then | |
864 | echo | |
728d19ea | 865 | echo " nfnetlink library not found, go get it" |
5f4b745f EL |
866 | echo " from www.netfilter.org." |
867 | echo " we automatically append libnetfilter_queue/ when searching" | |
868 | echo " for headers etc. when the --with-libnfnetlink-includes directive" | |
869 | echo " is used" | |
b98c28a6 | 870 | echo " Ubuntu: apt-get install libnetfilter-queue-dev" |
871 | echo " Fedora: dnf install libnetfilter_queue-devel" | |
872 | echo " CentOS/RHEL: yum install libnetfilter_queue-devel" | |
5f4b745f EL |
873 | echo |
874 | fi | |
875 | ;; | |
876 | esac | |
877 | fi | |
0ffa1c24 | 878 | |
ba81c4d2 | 879 | # enable support for NFQUEUE |
3ff5dc36 | 880 | if test "x$enable_nfqueue" = "xyes"; then |
ba81c4d2 | 881 | AC_DEFINE_UNQUOTED([NFQ],[1],[Enable Linux Netfilter NFQUEUE support for inline IDP]) |
4851568a | 882 | |
3ff5dc36 VJ |
883 | #libnetfilter_queue |
884 | AC_ARG_WITH(libnetfilter_queue_includes, | |
a3510f20 WM |
885 | [ --with-libnetfilter_queue-includes=DIR libnetfilter_queue include directory], |
886 | [with_libnetfilter_queue_includes="$withval"],[with_libnetfilter_queue_includes=no]) | |
3ff5dc36 | 887 | AC_ARG_WITH(libnetfilter_queue_libraries, |
a3510f20 WM |
888 | [ --with-libnetfilter_queue-libraries=DIR libnetfilter_queue library directory], |
889 | [with_libnetfilter_queue_libraries="$withval"],[with_libnetfilter_queue_libraries="no"]) | |
890 | ||
3ff5dc36 VJ |
891 | if test "$with_libnetfilter_queue_includes" != "no"; then |
892 | CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_queue_includes}" | |
893 | fi | |
366671a8 | 894 | |
fbc9da45 JI |
895 | AC_CHECK_HEADER(libnetfilter_queue/libnetfilter_queue.h,, |
896 | [AC_MSG_ERROR(libnetfilter_queue/libnetfilter_queue.h not found ...)], | |
897 | [ | |
898 | #define _GNU_SOURCE | |
899 | #include <sys/types.h> | |
900 | #include <stdint.h> | |
901 | ]) | |
366671a8 | 902 | |
3ff5dc36 VJ |
903 | if test "$with_libnetfilter_queue_libraries" != "no"; then |
904 | LDFLAGS="${LDFLAGS} -L${with_libnetfilter_queue_libraries}" | |
89cee0ad | 905 | fi |
3ff5dc36 VJ |
906 | |
907 | NFQ="" | |
89cee0ad VJ |
908 | AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",) |
909 | 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]) | |
910 | 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]) | |
2c572759 | 911 | AC_CHECK_LIB([netfilter_queue], [nfq_set_queue_flags],AC_DEFINE_UNQUOTED([HAVE_NFQ_SET_QUEUE_FLAGS],[1],[Found nfq_set_queue_flags function in netfilter_queue]) ,,[-lnfnetlink]) |
8da02115 | 912 | AC_CHECK_LIB([netfilter_queue], [nfq_set_verdict_batch],AC_DEFINE_UNQUOTED([HAVE_NFQ_SET_VERDICT_BATCH],[1],[Found nfq_set_verdict_batch function in netfilter_queue]) ,,[-lnfnetlink]) |
89cee0ad VJ |
913 | |
914 | # check if the argument to nfq_get_payload is signed or unsigned | |
915 | AC_MSG_CHECKING([for signed nfq_get_payload payload argument]) | |
916 | STORECFLAGS="${CFLAGS}" | |
adbf85c4 EL |
917 | if test `basename $CC` = "clang"; then |
918 | CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types" | |
919 | else | |
58bf4ea4 | 920 | CFLAGS="${CFLAGS} -Werror" |
adbf85c4 | 921 | fi |
89cee0ad | 922 | AC_COMPILE_IFELSE( |
c9f9e3f9 VJ |
923 | [AC_LANG_PROGRAM( |
924 | [ | |
fbc9da45 JI |
925 | #define _GNU_SOURCE |
926 | #include <sys/types.h> | |
927 | #include <stdint.h> | |
3ff5dc36 VJ |
928 | #include <stdio.h> |
929 | #include <libnetfilter_queue/libnetfilter_queue.h> | |
c9f9e3f9 VJ |
930 | ], |
931 | [ | |
3ff5dc36 VJ |
932 | char *pktdata; |
933 | nfq_get_payload(NULL, &pktdata); | |
c9f9e3f9 VJ |
934 | ])], |
935 | [libnetfilter_queue_nfq_get_payload_signed="yes"], | |
936 | [libnetfilter_queue_nfq_get_payload_signed="no"]) | |
89cee0ad VJ |
937 | AC_MSG_RESULT($libnetfilter_queue_nfq_get_payload_signed) |
938 | if test "x$libnetfilter_queue_nfq_get_payload_signed" = "xyes"; then | |
adbf85c4 | 939 | AC_DEFINE([NFQ_GET_PAYLOAD_SIGNED], [1], [For signed version of nfq_get_payload]) |
89cee0ad VJ |
940 | fi |
941 | CFLAGS="${STORECFLAGS}" | |
0ffa1c24 | 942 | |
3ff5dc36 VJ |
943 | if test "$NFQ" = "no"; then |
944 | echo | |
945 | echo " ERROR! libnetfilter_queue library not found, go get it" | |
946 | echo " from www.netfilter.org." | |
947 | echo " we automatically append libnetfilter_queue/ when searching" | |
948 | echo " for headers etc. when the --with-libnfq-includes directive" | |
949 | echo " is used" | |
b98c28a6 | 950 | echo " Ubuntu: apt-get install libnetfilter-queue-dev" |
951 | echo " Fedora: dnf install libnetfilter_queue-devel" | |
952 | echo " CentOS/RHEL: yum install libnetfilter_queue-devel" | |
3ff5dc36 VJ |
953 | echo |
954 | exit 1 | |
955 | fi | |
a3510f20 | 956 | fi |
2b7b78f1 | 957 | |
4851568a | 958 | # libnetfilter_log |
4851568a GL |
959 | AC_ARG_WITH(libnetfilter_log_includes, |
960 | [ --with-libnetfilter_log-includes=DIR libnetfilter_log include directory], | |
961 | [with_libnetfilter_log_includes="$withval"],[with_libnetfilter_log_includes="no"]) | |
962 | AC_ARG_WITH(libnetfilter_log_libraries, | |
963 | [ --with-libnetfilter_log-libraries=DIR libnetfilter_log library directory], | |
964 | [with_libnetfilter_log_libraries="$withval"],[with_libnetfilter_log_libraries="no"]) | |
965 | ||
966 | if test "$enable_nflog" = "yes"; then | |
967 | if test "$with_libnetfilter_log_includes" != "no"; then | |
968 | CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_log_includes}" | |
969 | fi | |
970 | ||
0795dc1e | 971 | AC_CHECK_HEADER(libnetfilter_log/libnetfilter_log.h,,[AC_MSG_ERROR(libnetfilter_log.h not found ...)]) |
4851568a GL |
972 | |
973 | if test "$with_libnetfilter_log_libraries" != "no"; then | |
974 | LDFLAGS="${LDFLAGS} -L${with_libnetfilter_log_libraries}" | |
975 | fi | |
976 | ||
977 | NFLOG="" | |
978 | AC_CHECK_LIB(netfilter_log, nflog_open,, NFLOG="no") | |
979 | ||
980 | if test "$NFLOG" = "no"; then | |
981 | echo | |
982 | echo " ERROR! libnetfilter_log library not found, go get it" | |
983 | echo " from http://www.netfilter.org." | |
984 | echo | |
985 | exit 1 | |
986 | else | |
987 | AC_DEFINE([HAVE_NFLOG],[1],[nflog available]) | |
988 | enable_nflog="yes" | |
989 | fi | |
990 | fi | |
991 | ||
ec77632e JMS |
992 | # WinDivert support |
993 | AC_ARG_ENABLE(windivert, | |
d01ce2e5 | 994 | AS_HELP_STRING([--enable-windivert],[Enable WinDivert support [default=no]]),[enable_windivert=$enableval], |
ec77632e JMS |
995 | [enable_windivert="no"]) |
996 | ||
997 | # WinDivert can only be enabled on Windows builds | |
998 | AC_CHECK_DECL([OS_WIN32],,[enable_windivert="no"]) | |
999 | ||
1000 | if test "x$enable_windivert" = "xyes"; then | |
1001 | # WinDivert requires Vista at a minimum. If the user has selected their own NTDDI_VERSION | |
1002 | # then don't override it. | |
1003 | AC_CHECK_DECL([NTDDI_VERSION],, | |
1004 | [CFLAGS="${CFLAGS} -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA"]) | |
1005 | ||
1006 | AC_DEFINE_UNQUOTED([WINDIVERT],[1],[Enable Windows WinDivert support for inline IDP]) | |
1007 | ||
1008 | AC_ARG_WITH(windivert_include, | |
1009 | [ --with-windivert-include=DIR WinDivert include path], | |
1010 | [with_windivert_include="$withval"],[with_windivert_include="no"]) | |
1011 | AC_ARG_WITH(windivert_libraries, | |
1012 | [ --with-windivert-libraries=DIR WinDivert library path], | |
1013 | [with_windivert_libraries="$withval"],[with_windivert_libraries="no"]) | |
1014 | ||
1015 | if test "$with_windivert_include" != "no"; then | |
1016 | CPPFLAGS="${CPPFLAGS} -I${with_windivert_include}" | |
1017 | fi | |
1018 | ||
1019 | if test "$with_windivert_libraries" != "no"; then | |
1020 | LDFLAGS="${LDFLAGS} -L${with_windivert_libraries}" | |
1021 | fi | |
1022 | ||
1023 | AC_CHECK_HEADER(windivert.h,,WINDIVERT_INC="no") | |
1024 | AC_CHECK_LIB(WinDivert, WinDivertOpen,, WINDIVERT_LIB="no") | |
1025 | ||
1026 | if test "$WINDIVERT_LIB" = "no" || test "$WINDIVERT_INC" = "no"; then | |
1027 | echo | |
1028 | echo " ERROR! WinDivert not found, go get it from" | |
1029 | echo " https://www.reqrypt.org/windivert.html" | |
1030 | echo | |
1031 | exit 1 | |
1032 | fi | |
1033 | fi | |
1034 | # /WinDivert | |
1035 | ||
eb33dc16 | 1036 | |
89cee0ad | 1037 | # libnet |
a3510f20 WM |
1038 | AC_ARG_WITH(libnet_includes, |
1039 | [ --with-libnet-includes=DIR libnet include directory], | |
1040 | [with_libnet_includes="$withval"],[with_libnet_includes="no"]) | |
1041 | ||
1042 | AC_ARG_WITH(libnet_libraries, | |
1043 | [ --with-libnet-libraries=DIR libnet library directory], | |
1044 | [with_libnet_libraries="$withval"],[with_libnet_libraries="no"]) | |
1045 | ||
1046 | if test "x$with_libnet_includes" != "xno"; then | |
3678dda1 WM |
1047 | CPPFLAGS="${CPPFLAGS} -I${with_libnet_includes}" |
1048 | libnet_dir="${with_libnet_includes}" | |
f7111f38 | 1049 | else |
829238e4 | 1050 | libnet_dir="/usr/include /usr/local/include /usr/local/include/libnet11 /opt/local/include /usr/local/include/libnet-1.1" |
a3510f20 | 1051 | fi |
0ffa1c24 | 1052 | |
a3510f20 | 1053 | if test "x$with_libnet_libraries" != "xno"; then |
3678dda1 | 1054 | LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}" |
a3510f20 WM |
1055 | fi |
1056 | ||
3678dda1 | 1057 | LIBNET_DETECT_FAIL="no" |
a3510f20 | 1058 | LIBNET_INC_DIR="" |
3678dda1 | 1059 | |
a3510f20 WM |
1060 | for i in $libnet_dir; do |
1061 | if test -r "$i/libnet.h"; then | |
3678dda1 | 1062 | LIBNET_INC_DIR="$i" |
a3510f20 WM |
1063 | fi |
1064 | done | |
1065 | ||
439b62fe | 1066 | enable_libnet="no" |
3678dda1 | 1067 | AC_MSG_CHECKING(for libnet.h version 1.1.x) |
a3510f20 | 1068 | if test "$LIBNET_INC_DIR" != ""; then |
365015c2 AG |
1069 | LIBNET_VER=`grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep '1.[[12]]' | sed 's/[[^"]]*"\([[^"]]*\).*/\1/'` |
1070 | ||
1071 | if test -z "$LIBNET_VER" ; then | |
3678dda1 | 1072 | AC_MSG_RESULT(no) |
3678dda1 WM |
1073 | else |
1074 | AC_MSG_RESULT(yes) | |
1075 | fi | |
6e8c75ff | 1076 | |
3678dda1 WM |
1077 | #CentOS, Fedora, Ubuntu-LTS, Ubuntu all set defines to the same values. libnet-config seems |
1078 | #to have been depreciated but all distro's seem to include it as part of the package. | |
1079 | if test "$LIBNET_DETECT_FAIL" = "no"; then | |
1080 | LLIBNET="" | |
1081 | AC_CHECK_LIB(net, libnet_write,, LLIBNET="no") | |
1082 | if test "$LLIBNET" != "no"; then | |
ba81c4d2 VJ |
1083 | AC_DEFINE([HAVE_LIBNET11],[1],(libnet 1.1 available)) |
1084 | AC_DEFINE([_DEFAULT_SOURCE],[1],(default source)) | |
1085 | AC_DEFINE([_BSD_SOURCE],[1],(bsd source)) | |
1086 | AC_DEFINE([__BSD_SOURCE],[1],(bsd source)) | |
1087 | AC_DEFINE([__FAVOR_BSD],[1],(favor bsd)) | |
1088 | AC_DEFINE([HAVE_NET_ETHERNET_H],[1],(ethernet.h)) | |
439b62fe | 1089 | enable_libnet="yes" |
3678dda1 WM |
1090 | fi |
1091 | ||
1092 | # see if we have the patched libnet 1.1 | |
2e8678a5 | 1093 | # https://www.inliniac.net/blog/2007/10/16/libnet-11-ipv6-fixes-and-additions.html |
3678dda1 WM |
1094 | # |
1095 | # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work | |
1096 | # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
439b62fe | 1097 | if test "$enable_libnet" = "yes"; then |
3678dda1 WM |
1098 | LLIBNET="" |
1099 | TMPLIBS="${LIBS}" | |
1100 | AC_CHECK_LIB(net, libnet_build_icmpv6_unreach,, LLIBNET="no") | |
1101 | if test "$LLIBNET" != "no"; then | |
ba81c4d2 | 1102 | AC_DEFINE([HAVE_LIBNET_ICMPV6_UNREACH],[1],(libnet_build_icmpv6_unreach available)) |
3678dda1 WM |
1103 | fi |
1104 | LIBS="${TMPLIBS}" | |
1105 | fi | |
365015c2 AG |
1106 | |
1107 | # See if we have libnet 1.1.6 or newer - these versions handle capabilities correctly | |
1108 | # Some patched 1.1.4 versions are also good, but it's not guaranteed for all distros. | |
1109 | # | |
1110 | # Details: https://bugzilla.redhat.com/show_bug.cgi?id=589770 | |
1111 | AS_VERSION_COMPARE([LIBNET_VER], [1.1.6], | |
1112 | [], | |
1113 | [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))], | |
1114 | [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))]) | |
66346e46 VJ |
1115 | |
1116 | ||
1117 | # check if the argument to libnet_init is char* or const char* | |
1118 | AC_MSG_CHECKING([libnet_init dev type]) | |
1119 | STORECFLAGS="${CFLAGS}" | |
1120 | if test `basename $CC` = "clang"; then | |
1121 | CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types" | |
1122 | else | |
1123 | CFLAGS="${CFLAGS} -Werror" | |
1124 | fi | |
1125 | AC_COMPILE_IFELSE( | |
1126 | [AC_LANG_PROGRAM( | |
1127 | [ | |
1128 | #include <stdio.h> | |
1129 | #include <libnet.h> | |
1130 | ], | |
1131 | [[ | |
1132 | const char dev[32] = ""; | |
1133 | char ebuf[LIBNET_ERRBUF_SIZE]; | |
1134 | (void)libnet_init(LIBNET_LINK, dev, ebuf); | |
1135 | ]])], | |
1136 | [libnet_init_const="yes"], | |
1137 | [libnet_init_const="no"]) | |
1138 | AC_MSG_RESULT($libnet_init_const) | |
1139 | if test "x$libnet_init_const" = "xyes"; then | |
1140 | AC_DEFINE([HAVE_LIBNET_INIT_CONST], [1], [libnet_init takes const argument]) | |
1141 | fi | |
1142 | CFLAGS="${STORECFLAGS}" | |
3678dda1 | 1143 | fi |
a3510f20 | 1144 | else |
439b62fe | 1145 | AC_MSG_RESULT(no) |
a3510f20 | 1146 | fi |
0d15d4f6 MK |
1147 | |
1148 | # libpcap | |
1149 | AC_ARG_WITH(libpcap_includes, | |
1150 | [ --with-libpcap-includes=DIR libpcap include directory], | |
1151 | [with_libpcap_includes="$withval"],[with_libpcap_includes=no]) | |
1152 | AC_ARG_WITH(libpcap_libraries, | |
1153 | [ --with-libpcap-libraries=DIR libpcap library directory], | |
1154 | [with_libpcap_libraries="$withval"],[with_libpcap_libraries="no"]) | |
1155 | ||
1156 | if test "$with_libpcap_includes" != "no"; then | |
1157 | CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}" | |
1158 | fi | |
1159 | ||
f8159bd3 VJ |
1160 | AC_CHECK_HEADERS([pcap.h],[],[AC_MSG_ERROR(pcap.h not found ...)], |
1161 | [[ | |
1162 | #ifdef HAVE_WINSOCK2_H | |
1163 | #include <winsock2.h> | |
1164 | #endif | |
1165 | #define _DEFAULT_SOURCE 1 | |
1166 | ]]) | |
0d15d4f6 MK |
1167 | |
1168 | if test "$with_libpcap_libraries" != "no"; then | |
1169 | LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}" | |
1170 | fi | |
f8159bd3 VJ |
1171 | AC_CHECK_HEADERS([pcap.h pcap/pcap.h pcap/bpf.h],[],[], |
1172 | [[ | |
1173 | #ifdef HAVE_WINSOCK2_H | |
1174 | #include <winsock2.h> | |
1175 | #endif | |
1176 | #define _DEFAULT_SOURCE 1 | |
1177 | ]]) | |
0d15d4f6 MK |
1178 | |
1179 | LIBPCAP="" | |
b026fbb5 | 1180 | PKG_CHECK_MODULES([PCAP],libpcap,[CPPFLAGS="${CPPFLAGS} ${PCAP_CFLAGS}" LIBS="${LIBS} ${PCAP_LIBS}"],[:]) |
d1e839ea | 1181 | AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_open_live,, LIBPCAP="no") |
0d15d4f6 MK |
1182 | if test "$LIBPCAP" = "no"; then |
1183 | echo | |
1184 | echo " ERROR! libpcap library not found, go get it" | |
1185 | echo " from http://www.tcpdump.org or your distribution:" | |
1186 | echo | |
1187 | echo " Ubuntu: apt-get install libpcap-dev" | |
015cd930 | 1188 | echo " Fedora: dnf install libpcap-devel" |
1189 | echo " CentOS/RHEL: yum install libpcap-devel" | |
0d15d4f6 MK |
1190 | echo |
1191 | exit 1 | |
1192 | fi | |
1193 | ||
1194 | # pcap_activate and pcap_create only exists in libpcap >= 1.0 | |
1195 | LIBPCAPVTEST="" | |
1196 | #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work | |
1197 | #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
1198 | TMPLIBS="${LIBS}" | |
d1e839ea | 1199 | AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_activate,, LPCAPVTEST="no") |
cda6e029 VJ |
1200 | if test "$LPCAPVTEST" = "no"; then |
1201 | echo | |
1202 | echo " ERROR! libpcap library too old, need at least 1+, " | |
1203 | echo " go get it from http://www.tcpdump.org or your distribution:" | |
1204 | echo | |
1205 | echo " Ubuntu: apt-get install libpcap-dev" | |
015cd930 | 1206 | echo " Fedora: dnf install libpcap-devel" |
1207 | echo " CentOS/RHEL: yum install libpcap-devel" | |
cda6e029 VJ |
1208 | echo |
1209 | exit 1 | |
1210 | fi | |
1211 | AC_PATH_PROG(HAVE_PCAP_CONFIG, pcap-config, "no") | |
1212 | if test "$HAVE_PCAP_CONFIG" = "no" -o "$cross_compiling" = "yes"; then | |
1213 | AC_MSG_RESULT(no pcap-config is use) | |
0d15d4f6 | 1214 | else |
cda6e029 VJ |
1215 | PCAP_CFLAGS="$(pcap-config --defines) $(pcap-config --cflags)" |
1216 | AC_SUBST(PCAP_CFLAGS) | |
0d15d4f6 MK |
1217 | fi |
1218 | LIBS="${TMPLIBS}" | |
1219 | ||
1220 | #Appears as if pcap_set_buffer_size is linux only? | |
1221 | LIBPCAPSBUFF="" | |
1222 | #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work | |
1223 | #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
1224 | TMPLIBS="${LIBS}" | |
d1e839ea | 1225 | AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_set_buffer_size,, LPCAPSBUFF="no") |
0d15d4f6 | 1226 | if test "$LPCAPSBUFF" != "no"; then |
ba81c4d2 | 1227 | AC_DEFINE([HAVE_PCAP_SET_BUFF],[1],(libpcap has pcap_set_buffer_size function)) |
0d15d4f6 MK |
1228 | fi |
1229 | LIBS="${TMPLIBS}" | |
1230 | ||
1231 | # libpfring | |
89cee0ad VJ |
1232 | # libpfring (currently only supported for libpcap enabled pfring) |
1233 | # Error on the side of caution. If libpfring enabled pcap is being used and we don't link against -lpfring compilation will fail. | |
04b0f177 | 1234 | AC_ARG_ENABLE(pfring, |
d01ce2e5 | 1235 | AS_HELP_STRING([--enable-pfring], [Enable Native PF_RING support]),[enable_pfring=$enableval],[enable_pfring=no]) |
e07e9e16 | 1236 | AS_IF([test "x$enable_pfring" = "xyes"], [ |
ba81c4d2 | 1237 | AC_DEFINE([HAVE_PFRING],[1],(PF_RING support enabled)) |
ddf995da | 1238 | |
0795dc1e | 1239 | #We have to set CFLAGS for AC_COMPILE_IFELSE as it doesn't pay attention to CPPFLAGS |
6408feba W |
1240 | AC_ARG_WITH(libpfring_includes, |
1241 | [ --with-libpfring-includes=DIR libpfring include directory], | |
1242 | [with_libpfring_includes="$withval"],[with_libpfring_includes=no]) | |
1243 | AC_ARG_WITH(libpfring_libraries, | |
1244 | [ --with-libpfring-libraries=DIR libpfring library directory], | |
1245 | [with_libpfring_libraries="$withval"],[with_libpfring_libraries="no"]) | |
1246 | ||
1247 | if test "$with_libpfring_includes" != "no"; then | |
89f83c2e | 1248 | CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}" |
6408feba | 1249 | fi |
073d0421 | 1250 | |
6408feba | 1251 | if test "$with_libpfring_libraries" != "no"; then |
89f83c2e | 1252 | LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}" |
6408feba | 1253 | fi |
073d0421 | 1254 | |
6408feba | 1255 | LIBPFRING="" |
43ffd779 | 1256 | AC_CHECK_LIB(pfring, pfring_open,, LIBPFRING="no", [-lpcap]) |
dde78e49 GL |
1257 | if test "$LIBPFRING" != "no"; then |
1258 | STORECFLAGS="${CFLAGS}" | |
1259 | CFLAGS="${CFLAGS} -Werror" | |
1260 | AC_COMPILE_IFELSE( | |
1261 | [AC_LANG_PROGRAM( | |
1262 | [ | |
1263 | #include <pfring.h> | |
1264 | ], | |
1265 | [ | |
1266 | pfring_recv_chunk(NULL, NULL, 0, 0); | |
1267 | ])], | |
1268 | [pfring_recv_chunk="yes"], | |
1269 | [pfring_recv_chunk="no"]) | |
1270 | CFLAGS="${STORECFLAGS}" | |
1271 | if test "x$pfring_recv_chunk" != "xyes"; then | |
a75911e0 EL |
1272 | if test "x$enable_pfring" = "xyes"; then |
1273 | echo | |
dde78e49 GL |
1274 | echo " ERROR! --enable-pfring was passed but the library version is < 6, go get it" |
1275 | echo " from http://www.ntop.org/products/pf_ring/" | |
a75911e0 EL |
1276 | echo |
1277 | exit 1 | |
1278 | fi | |
6408feba | 1279 | fi |
b6baafb3 AC |
1280 | AC_COMPILE_IFELSE( |
1281 | [AC_LANG_SOURCE([[ | |
1282 | #include <pfring.h> | |
1283 | #ifndef PF_RING_FLOW_OFFLOAD | |
1284 | # error PF_RING_FLOW_OFFLOAD not defined | |
1285 | #endif | |
1286 | ]])], | |
1287 | [ | |
1288 | AC_DEFINE([HAVE_PF_RING_FLOW_OFFLOAD], [1], [PF_RING bypass support enabled]) | |
1289 | ], | |
1290 | [ | |
1291 | echo | |
1292 | echo " Warning! Pfring hw bypass not supported by this library version < 7," | |
1293 | echo " please upgrade to a newer version to use this feature." | |
1294 | echo | |
1295 | echo " Continuing for now with hw bypass support disabled..." | |
1296 | echo | |
1297 | ]) | |
6408feba | 1298 | else |
dde78e49 GL |
1299 | if test "x$enable_pfring" = "xyes"; then |
1300 | echo | |
1301 | echo " ERROR! --enable-pfring was passed but the library was not found, go get it" | |
1302 | echo " from http://www.ntop.org/products/pf_ring/" | |
1303 | echo | |
1304 | exit 1 | |
1305 | fi | |
dbf5d79e | 1306 | fi |
6408feba | 1307 | ]) |
ddf995da | 1308 | |
89cee0ad | 1309 | # AF_PACKET support |
e80b30c0 | 1310 | AC_ARG_ENABLE(af-packet, |
b2ebd4a1 | 1311 | AS_HELP_STRING([--enable-af-packet], [Enable AF_PACKET support [default=yes]]), |
d01ce2e5 | 1312 | [enable_af_packet=$enableval],[enable_af_packet=yes]) |
e80b30c0 | 1313 | AS_IF([test "x$enable_af_packet" = "xyes"], [ |
ac2d13d6 | 1314 | AC_CHECK_DECL([TPACKET_V2], |
e80b30c0 | 1315 | AC_DEFINE([HAVE_AF_PACKET],[1],[AF_PACKET support is available]), |
ac2d13d6 EL |
1316 | [enable_af_packet="no"], |
1317 | [[#include <sys/socket.h> | |
1318 | #include <linux/if_packet.h>]]) | |
851fcef9 EL |
1319 | AC_CHECK_DECL([PACKET_FANOUT_QM], |
1320 | AC_DEFINE([HAVE_PACKET_FANOUT],[1],[Recent packet fanout support is available]), | |
e80b30c0 EL |
1321 | [], |
1322 | [[#include <linux/if_packet.h>]]) | |
c2d0d938 EL |
1323 | AC_CHECK_DECL([TPACKET_V3], |
1324 | AC_DEFINE([HAVE_TPACKET_V3],[1],[AF_PACKET tpcket_v3 support is available]), | |
1325 | [], | |
1326 | [[#include <sys/socket.h> | |
1327 | #include <linux/if_packet.h>]]) | |
a40f08a2 EL |
1328 | AC_CHECK_DECL([SOF_TIMESTAMPING_RAW_HARDWARE], |
1329 | AC_DEFINE([HAVE_HW_TIMESTAMPING],[1],[Hardware timestamping support is available]), | |
1330 | [], | |
f79f6409 | 1331 | [[#include <linux/net_tstamp.h>]]) |
e80b30c0 EL |
1332 | ]) |
1333 | ||
10104066 | 1334 | # Netmap support |
1335 | AC_ARG_ENABLE(netmap, | |
d01ce2e5 | 1336 | AS_HELP_STRING([--enable-netmap], [Enable Netmap support]),[enable_netmap=$enableval],[enable_netmap=no]) |
10104066 | 1337 | AC_ARG_WITH(netmap_includes, |
1338 | [ --with-netmap-includes=DIR netmap include directory], | |
1339 | [with_netmap_includes="$withval"],[with_netmap_includes=no]) | |
1340 | ||
1341 | AS_IF([test "x$enable_netmap" = "xyes"], [ | |
ba81c4d2 | 1342 | AC_DEFINE([HAVE_NETMAP],[1],(NETMAP support enabled)) |
10104066 | 1343 | |
1344 | if test "$with_netmap_includes" != "no"; then | |
1345 | CPPFLAGS="${CPPFLAGS} -I${with_netmap_includes}" | |
1346 | fi | |
1347 | ||
0795dc1e | 1348 | AC_CHECK_HEADER(net/netmap_user.h,,[AC_MSG_ERROR(net/netmap_user.h not found ...)],) |
517b45ea VJ |
1349 | |
1350 | have_recent_netmap="no" | |
1351 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ | |
1352 | #include <net/netmap_user.h> | |
1353 | ],[ | |
1354 | #ifndef NETMAP_API | |
1c1c21be | 1355 | #error "Outdated netmap, need one with NETMAP_API" |
517b45ea | 1356 | #endif |
1c1c21be JL |
1357 | #if NETMAP_API < 14 |
1358 | #error "Outdated netmap, need at least API version 14" | |
517b45ea VJ |
1359 | #endif |
1360 | ])], [have_recent_netmap="yes"]) | |
1361 | if test "x$have_recent_netmap" != "xyes"; then | |
1c1c21be | 1362 | echo "ERROR: outdated netmap; need at least v14" |
517b45ea VJ |
1363 | exit 1 |
1364 | fi | |
1c1c21be JL |
1365 | have_netmap_version="v14+" |
1366 | AC_CHECK_HEADER(libnetmap.h,,[AC_MSG_ERROR(libnetmap.h not found ...)],) | |
1367 | LIBNETMAP="" | |
1368 | AC_SEARCH_LIBS([nmport_open],[netmap],,[LIBNETMAP="no"]) | |
1369 | if test "$LIBNETMAP" = "no"; then | |
1370 | echo | |
1371 | echo " ERROR! libnetmap library not found!" | |
1372 | echo " Go get it from https://github.com/luigirizzo/netmap" | |
1373 | echo " or your distribution." | |
1374 | echo | |
1375 | exit 1 | |
517b45ea | 1376 | fi |
1c1c21be | 1377 | AC_DEFINE([HAVE_NETMAP_V14],[1],(NETMAP API v14 support enabled)) |
10104066 | 1378 | ]) |
c45d8985 | 1379 | |
345ec58d JI |
1380 | # Suricata-Update. |
1381 | AC_ARG_ENABLE([suricata-update], AS_HELP_STRING([--disable-suricata-update], | |
1382 | [Disable suricata-update]), [enable_suricata_update=$enableval], | |
1383 | [enable_suricata_update="yes"]) | |
1384 | ||
1385 | # Assume suircata-update will not be installed. | |
1386 | have_suricata_update="no" | |
1387 | ruledirprefix="$sysconfdir" | |
345ec58d JI |
1388 | |
1389 | if test "$enable_suricata_update" = "yes"; then | |
c08ec8d8 FF |
1390 | if test -f "$srcdir/suricata-update/setup.py"; then |
1391 | have_suricata_update="yes" | |
1392 | fi | |
345ec58d | 1393 | fi |
345ec58d | 1394 | |
345ec58d JI |
1395 | if test "$have_suricata_update" = "yes"; then |
1396 | if test "$have_python_yaml" != "yes"; then | |
1397 | echo "" | |
1398 | echo " Warning: suricata-update will not be installed as the" | |
109cf368 | 1399 | echo " Python yaml module is not installed.." |
345ec58d | 1400 | echo "" |
109cf368 JI |
1401 | echo " Install the yaml module for Python ${pymv} to enable" |
1402 | echo " suricata-update." | |
b98c28a6 | 1403 | echo |
345ec58d | 1404 | else |
345ec58d JI |
1405 | SURICATA_UPDATE_DIR="suricata-update" |
1406 | AC_SUBST(SURICATA_UPDATE_DIR) | |
0795dc1e AH |
1407 | AC_CONFIG_FILES(suricata-update/Makefile) |
1408 | AC_OUTPUT | |
345ec58d | 1409 | ruledirprefix="$localstatedir/lib" |
345ec58d JI |
1410 | fi |
1411 | fi | |
cbcbc0f6 | 1412 | |
a69afd5c JI |
1413 | # Test to see if suricatactl (and suricatasc) can be installed. |
1414 | if test "x$enable_python" != "xyes"; then | |
1415 | install_suricatactl="requires python" | |
1416 | elif test "x$have_python_distutils" != "xyes"; then | |
a1ee536d | 1417 | install_suricatactl="no, requires distutils" |
a69afd5c JI |
1418 | else |
1419 | install_suricatactl="yes" | |
1420 | fi | |
1421 | ||
1422 | # Test to see if suricata-update can be installed. | |
1423 | if test "x$have_suricata_update" != "xyes"; then | |
abb3cc85 JI |
1424 | install_suricata_update="no, " |
1425 | install_suricata_update_reason="not bundled" | |
a69afd5c | 1426 | elif test "x$enable_python" != "xyes"; then |
abb3cc85 JI |
1427 | install_suricata_update="no, " |
1428 | install_suricata_update_reason="requires python" | |
a69afd5c | 1429 | elif test "x$have_python_distutils" != "xyes"; then |
abb3cc85 JI |
1430 | install_suricata_update="no, " |
1431 | install_suricata_update_reason="requires distutils" | |
a69afd5c | 1432 | elif test "x$have_python_yaml" != "xyes"; then |
abb3cc85 JI |
1433 | install_suricata_update="no, " |
1434 | install_suricata_update_reason="requires pyyaml" | |
a69afd5c JI |
1435 | else |
1436 | install_suricata_update="yes" | |
1437 | fi | |
1438 | ||
03da49bf JI |
1439 | AM_CONDITIONAL([INSTALL_SURICATA_UPDATE], |
1440 | [test "x$install_suricata_update" = "xyes"]) | |
abb3cc85 | 1441 | AC_SUBST([install_suricata_update_reason]) |
03da49bf | 1442 | |
89cee0ad | 1443 | # libhtp |
e07e9e16 | 1444 | AC_ARG_ENABLE(non-bundled-htp, |
d01ce2e5 | 1445 | AS_HELP_STRING([--enable-non-bundled-htp], [Enable the use of an already installed version of htp]),[enable_non_bundled_htp=$enableval],[enable_non_bundled_htp=no]) |
e07e9e16 | 1446 | AS_IF([test "x$enable_non_bundled_htp" = "xyes"], [ |
f8b8b6f7 EL |
1447 | PKG_CHECK_MODULES([libhtp], htp,, [with_pkgconfig_htp=no]) |
1448 | if test "$with_pkgconfig_htp" != "no"; then | |
1449 | CPPFLAGS="${CPPFLAGS} ${libhtp_CFLAGS}" | |
1450 | LIBS="${LIBS} ${libhtp_LIBS}" | |
1451 | fi | |
1452 | ||
e07e9e16 WM |
1453 | AC_ARG_WITH(libhtp_includes, |
1454 | [ --with-libhtp-includes=DIR libhtp include directory], | |
1455 | [with_libhtp_includes="$withval"],[with_libhtp_includes=no]) | |
1456 | AC_ARG_WITH(libhtp_libraries, | |
1457 | [ --with-libhtp-libraries=DIR libhtp library directory], | |
1458 | [with_libhtp_libraries="$withval"],[with_libhtp_libraries="no"]) | |
1459 | ||
1460 | if test "$with_libhtp_includes" != "no"; then | |
0c37f76f | 1461 | CPPFLAGS="-I${with_libhtp_includes} ${CPPFLAGS}" |
e07e9e16 | 1462 | fi |
07f7ba55 | 1463 | |
e07e9e16 | 1464 | if test "$with_libhtp_libraries" != "no"; then |
89cee0ad | 1465 | LDFLAGS="${LDFLAGS} -L${with_libhtp_libraries}" |
e07e9e16 | 1466 | fi |
ed856de9 | 1467 | |
0795dc1e | 1468 | AC_CHECK_HEADER(htp/htp.h,,[AC_MSG_ERROR(htp/htp.h not found ...)]) |
ed856de9 | 1469 | |
e07e9e16 WM |
1470 | LIBHTP="" |
1471 | AC_CHECK_LIB(htp, htp_conn_create,, LIBHTP="no") | |
1472 | if test "$LIBHTP" = "no"; then | |
89cee0ad VJ |
1473 | echo |
1474 | echo " ERROR! libhtp library not found" | |
1475 | echo | |
1476 | exit 1 | |
e07e9e16 | 1477 | fi |
f5af8864 | 1478 | PKG_CHECK_MODULES(LIBHTPMINVERSION, [htp >= 0.5.36],[libhtp_minver_found="yes"],[libhtp_minver_found="no"]) |
e07e9e16 | 1479 | if test "$libhtp_minver_found" = "no"; then |
f85a2dc8 AS |
1480 | PKG_CHECK_MODULES(LIBHTPDEVVERSION, [htp = 0.5.X],[libhtp_devver_found="yes"],[libhtp_devver_found="no"]) |
1481 | if test "$libhtp_devver_found" = "no"; then | |
1482 | echo | |
f5af8864 | 1483 | echo " ERROR! libhtp was found but it is neither >= 0.5.36, nor the dev 0.5.X" |
f85a2dc8 AS |
1484 | echo |
1485 | exit 1 | |
1486 | fi | |
d472d606 EL |
1487 | fi |
1488 | ||
a3e2b355 | 1489 | AC_CHECK_LIB([htp], [htp_config_register_request_uri_normalize],AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Found htp_config_register_request_uri_normalize function in libhtp]) ,,[-lhtp]) |
80fb33c6 VJ |
1490 | # check for htp_tx_get_response_headers_raw |
1491 | AC_CHECK_LIB([htp], [htp_tx_get_response_headers_raw],AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Found htp_tx_get_response_headers_raw in libhtp]) ,,[-lhtp]) | |
cc51eec5 | 1492 | AC_CHECK_LIB([htp], [htp_decode_query_inplace],AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Found htp_decode_query_inplace function in libhtp]) ,,[-lhtp]) |
5ec885e4 | 1493 | AC_CHECK_LIB([htp], [htp_config_set_response_decompression_layer_limit],AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_RESPONSE_DECOMPRESSION_LAYER_LIMIT],[1],[Found htp_config_set_response_decompression_layer_limit function in libhtp]) ,,[-lhtp]) |
6d225378 | 1494 | AC_EGREP_HEADER(htp_config_set_path_decode_u_encoding, htp/htp.h, AC_DEFINE_UNQUOTED([HAVE_HTP_SET_PATH_DECODE_U_ENCODING],[1],[Found usable htp_config_set_path_decode_u_encoding function in libhtp]) ) |
c9c23d5c | 1495 | AC_CHECK_LIB([htp], [htp_config_set_lzma_memlimit],AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_LZMA_MEMLIMIT],[1],[Found htp_config_set_lzma_memlimit function in libhtp]) ,,[-lhtp]) |
9b5c9233 | 1496 | AC_CHECK_LIB([htp], [htp_config_set_lzma_layers],AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_LZMA_LAYERS],[1],[Found htp_config_set_lzma_layers function in libhtp]) ,,[-lhtp]) |
af4f8162 | 1497 | AC_CHECK_LIB([htp], [htp_config_set_compression_bomb_limit],AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_COMPRESSION_BOMB_LIMIT],[1],[Found htp_config_set_compression_bomb_limit function in libhtp]) ,,[-lhtp]) |
a04b5566 | 1498 | AC_CHECK_LIB([htp], [htp_config_set_compression_time_limit],AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_COMPRESSION_TIME_LIMIT],[1],[Found htp_config_set_compression_time_limit function in libhtp]) ,,[-lhtp]) |
80fb33c6 | 1499 | ]) |
4acd5a04 | 1500 | |
aafc65c7 VJ |
1501 | if test "x$enable_non_bundled_htp" = "xno"; then |
1502 | # test if we have a bundled htp | |
1503 | if test -d "$srcdir/libhtp"; then | |
1504 | AC_CONFIG_SUBDIRS([libhtp]) | |
1505 | HTP_DIR="libhtp" | |
1506 | AC_SUBST(HTP_DIR) | |
1507 | HTP_LDADD="../libhtp/htp/libhtp.la" | |
1508 | AC_SUBST(HTP_LDADD) | |
1509 | # make sure libhtp is added to the includes | |
667e4e68 | 1510 | CPPFLAGS="-I\${srcdir}/../libhtp/ ${CPPFLAGS}" |
aafc65c7 | 1511 | |
0795dc1e | 1512 | AC_CHECK_HEADER(iconv.h,,[AC_MSG_ERROR(iconv.h not found ...)]) |
c0993495 | 1513 | AC_CHECK_LIB(iconv, libiconv_close) |
aafc65c7 VJ |
1514 | AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp]) |
1515 | AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Assuming htp_tx_get_response_headers_raw function in bundled libhtp]) | |
1516 | AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Assuming htp_decode_query_inplace function in bundled libhtp]) | |
5ec885e4 VJ |
1517 | # enable when libhtp has been updated |
1518 | AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_RESPONSE_DECOMPRESSION_LAYER_LIMIT],[1],[Assuming htp_config_set_response_decompression_layer_limit function in bundled libhtp]) | |
c9c23d5c | 1519 | AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_LZMA_MEMLIMIT],[1],[Assuming htp_config_set_lzma_memlimit function in bundled libhtp]) |
9b5c9233 | 1520 | AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_LZMA_LAYERS],[1],[Assuming htp_config_set_lzma_layers function in bundled libhtp]) |
af4f8162 | 1521 | AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_COMPRESSION_BOMB_LIMIT],[1],[Assuming htp_config_set_compression_bomb_limit function in bundled libhtp]) |
a04b5566 | 1522 | AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_COMPRESSION_TIME_LIMIT],[1],[Assuming htp_config_set_compression_time_limit function in bundled libhtp]) |
aafc65c7 VJ |
1523 | else |
1524 | echo | |
1bbbcf51 | 1525 | echo " ERROR: Libhtp is not bundled. Get libhtp by doing:" |
5ec885e4 | 1526 | echo " git clone https://github.com/OISF/libhtp" |
1bbbcf51 KS |
1527 | echo " Then re-run Suricata's autogen.sh and configure script." |
1528 | echo " Or, if libhtp is installed in a different location," | |
1529 | echo " pass --enable-non-bundled-htp to Suricata's configure script." | |
aafc65c7 VJ |
1530 | echo " Add --with-libhtp-includes=<dir> and --with-libhtp-libraries=<dir> if" |
1531 | echo " libhtp is not installed in the include and library paths." | |
1532 | echo | |
1533 | exit 1 | |
1534 | fi | |
1535 | fi | |
36917c7d | 1536 | |
08328f9d | 1537 | |
89cee0ad | 1538 | # Check for libcap-ng |
829238e4 VJ |
1539 | case $host in |
1540 | *-*-linux*) | |
070ed778 VJ |
1541 | AC_ARG_WITH(libcap_ng_includes, |
1542 | [ --with-libcap_ng-includes=DIR libcap_ng include directory], | |
f01027e9 | 1543 | [with_libcap_ng_includes="$withval"],[with_libcap_ng_includes=no]) |
070ed778 VJ |
1544 | AC_ARG_WITH(libcap_ng_libraries, |
1545 | [ --with-libcap_ng-libraries=DIR libcap_ng library directory], | |
1546 | [with_libcap_ng_libraries="$withval"],[with_libcap_ng_libraries="no"]) | |
1547 | ||
1548 | if test "$with_libcap_ng_includes" != "no"; then | |
89cee0ad | 1549 | CPPFLAGS="${CPPFLAGS} -I${with_libcap_ng_includes}" |
070ed778 VJ |
1550 | fi |
1551 | ||
1552 | if test "$with_libcap_ng_libraries" != "no"; then | |
89cee0ad | 1553 | LDFLAGS="${LDFLAGS} -L${with_libcap_ng_libraries}" |
070ed778 VJ |
1554 | fi |
1555 | ||
1556 | AC_CHECK_HEADER(cap-ng.h,,LIBCAP_NG="no") | |
1557 | if test "$LIBCAP_NG" != "no"; then | |
1558 | LIBCAP_NG="" | |
1559 | AC_CHECK_LIB(cap-ng,capng_clear,,LIBCAP_NG="no") | |
1560 | fi | |
1561 | ||
1562 | if test "$LIBCAP_NG" != "no"; then | |
ba81c4d2 | 1563 | AC_DEFINE([HAVE_LIBCAP_NG],[1],[Libpcap-ng support]) |
070ed778 VJ |
1564 | fi |
1565 | ||
1566 | if test "$LIBCAP_NG" = "no"; then | |
89cee0ad VJ |
1567 | echo |
1568 | echo " WARNING! libcap-ng library not found, go get it" | |
1569 | echo " from http://people.redhat.com/sgrubb/libcap-ng/" | |
1570 | echo " or your distribution:" | |
1571 | echo | |
1572 | echo " Ubuntu: apt-get install libcap-ng-dev" | |
015cd930 | 1573 | echo " Fedora: dnf install libcap-ng-devel" |
1574 | echo " CentOS/RHEL: yum install libcap-ng-devel" | |
89cee0ad VJ |
1575 | echo |
1576 | echo " Suricata will be built without support for dropping privs." | |
1577 | echo | |
070ed778 | 1578 | fi |
829238e4 VJ |
1579 | ;; |
1580 | esac | |
835630ef | 1581 | |
91e1256b EL |
1582 | |
1583 | AC_ARG_ENABLE(ebpf, | |
1584 | AS_HELP_STRING([--enable-ebpf],[Enable eBPF support]), | |
d01ce2e5 | 1585 | [ enable_ebpf="$enableval"], |
91e1256b EL |
1586 | [ enable_ebpf="no"]) |
1587 | ||
731c2b2e | 1588 | have_xdp="no" |
91e1256b EL |
1589 | if test "$enable_ebpf" = "yes"; then |
1590 | AC_CHECK_LIB(elf,elf_begin,,LIBELF="no") | |
1591 | if test "$LIBELF" = "no"; then | |
1592 | echo | |
1593 | echo " libelf library and development headers not found but" | |
1594 | echo " but needed to use eBPF code" | |
1595 | echo | |
1596 | exit 1 | |
1597 | fi; | |
1598 | ||
1599 | AC_CHECK_LIB(bpf,bpf_object__open,,LIBBPF="no") | |
1600 | if test "$LIBBPF" = "no"; then | |
1601 | echo | |
1602 | echo " libbpf library and development headers not found but" | |
ccb8f3cd EL |
1603 | echo " needed to use eBPF code. It can be found at" |
1604 | echo " https://github.com/libbpf/libbpf" | |
91e1256b EL |
1605 | echo |
1606 | exit 1 | |
1607 | fi; | |
1608 | AC_CHECK_DECL([PACKET_FANOUT_EBPF], | |
1609 | AC_DEFINE([HAVE_PACKET_EBPF],[1],[Recent ebpf fanout support is available]), | |
1610 | [], | |
1611 | [[#include <linux/if_packet.h>]]) | |
731c2b2e | 1612 | AC_CHECK_LIB(bpf, bpf_set_link_xdp_fd,have_xdp="yes") |
8c880879 EL |
1613 | if test "$have_xdp" = "yes"; then |
1614 | AC_DEFINE([HAVE_PACKET_XDP],[1],[XDP support is available]) | |
1615 | fi | |
d477d3a8 | 1616 | AC_CHECK_FUNCS(bpf_program__section_name) |
91e1256b EL |
1617 | fi; |
1618 | ||
89cee0ad | 1619 | # Check for DAG support. |
835630ef | 1620 | AC_ARG_ENABLE(dag, |
6913109b | 1621 | AS_HELP_STRING([--enable-dag],[Enable DAG capture]), |
d01ce2e5 | 1622 | [ enable_dag=$enableval ], |
835630ef JM |
1623 | [ enable_dag=no]) |
1624 | AC_ARG_WITH(dag_includes, | |
1625 | [ --with-dag-includes=DIR dagapi include directory], | |
1626 | [with_dag_includes="$withval"],[with_dag_includes="no"]) | |
1627 | AC_ARG_WITH(dag_libraries, | |
1628 | [ --with-dag-libraries=DIR dagapi library directory], | |
1629 | [with_dag_libraries="$withval"],[with_dag_libraries="no"]) | |
1630 | ||
1631 | if test "$enable_dag" = "yes"; then | |
1632 | ||
c9cc137d | 1633 | if test "$with_dag_includes" != "no"; then |
835630ef JM |
1634 | CPPFLAGS="${CPPFLAGS} -I${with_dag_includes}" |
1635 | fi | |
1636 | ||
1637 | if test "$with_dag_libraries" != "no"; then | |
573f31b2 | 1638 | LDFLAGS="${LDFLAGS} -L${with_dag_libraries}" |
835630ef JM |
1639 | fi |
1640 | ||
1641 | AC_CHECK_HEADER(dagapi.h,DAG="yes",DAG="no") | |
1642 | if test "$DAG" != "no"; then | |
1643 | DAG="" | |
ba81c4d2 | 1644 | AC_CHECK_LIB(dag,dag_open,,DAG="no",) |
835630ef JM |
1645 | fi |
1646 | ||
1647 | if test "$DAG" = "no"; then | |
1648 | echo | |
1649 | echo " ERROR! libdag library not found" | |
1650 | echo | |
1651 | exit 1 | |
1652 | fi | |
ba81c4d2 VJ |
1653 | |
1654 | AC_DEFINE([HAVE_DAG],[1],(Endace DAG card support enabled)) | |
835630ef JM |
1655 | fi |
1656 | ||
89cee0ad | 1657 | # libmagic |
810e43f3 VJ |
1658 | enable_magic="no" |
1659 | AC_ARG_ENABLE(libmagic, | |
1660 | AS_HELP_STRING([--enable-libmagic], [Enable libmagic support [default=yes]]), | |
d01ce2e5 | 1661 | [enable_magic=$enableval],[enable_magic=yes]) |
810e43f3 VJ |
1662 | if test "$enable_magic" = "yes"; then |
1663 | AC_ARG_WITH(libmagic_includes, | |
1664 | [ --with-libmagic-includes=DIR libmagic include directory], | |
1665 | [with_libmagic_includes="$withval"],[with_libmagic_includes=no]) | |
1666 | AC_ARG_WITH(libmagic_libraries, | |
1667 | [ --with-libmagic-libraries=DIR libmagic library directory], | |
1668 | [with_libmagic_libraries="$withval"],[with_libmagic_libraries="no"]) | |
1669 | ||
1670 | if test "$with_libmagic_includes" != "no"; then | |
1671 | CPPFLAGS="${CPPFLAGS} -I${with_libmagic_includes}" | |
1672 | fi | |
f4a6f4b2 | 1673 | |
810e43f3 VJ |
1674 | AC_CHECK_HEADER(magic.h,,MAGIC="no") |
1675 | if test "$MAGIC" != "no"; then | |
1676 | MAGIC="" | |
1677 | AC_CHECK_LIB(magic, magic_open,, MAGIC="no") | |
1678 | fi | |
f4a6f4b2 | 1679 | |
810e43f3 VJ |
1680 | if test "x$MAGIC" != "xno"; then |
1681 | if test "$with_libmagic_libraries" != "no"; then | |
1682 | LDFLAGS="${LDFLAGS} -L${with_libmagic_libraries}" | |
1683 | fi | |
1684 | AC_DEFINE([HAVE_MAGIC],[1],(Libmagic for file handling)) | |
1685 | else | |
1686 | echo | |
1687 | echo " WARNING! magic library not found, go get it" | |
1688 | echo " from http://www.darwinsys.com/file/ or your distribution:" | |
1689 | echo | |
1690 | echo " Ubuntu: apt-get install libmagic-dev" | |
015cd930 | 1691 | echo " Fedora: dnf install file-devel" |
1692 | echo " CentOS/RHEL: yum install file-devel" | |
810e43f3 VJ |
1693 | echo |
1694 | enable_magic="no" | |
1695 | fi | |
f4a6f4b2 VJ |
1696 | fi |
1697 | ||
1c995369 | 1698 | # Napatech - Using the 3GD API |
37e3de84 | 1699 | AC_ARG_ENABLE(napatech, |
6913109b | 1700 | AS_HELP_STRING([--enable-napatech],[Enabled Napatech Devices]), |
d01ce2e5 | 1701 | [ enable_napatech=$enableval ], |
37e3de84 | 1702 | [ enable_napatech=no]) |
1c995369 PY |
1703 | AC_ARG_ENABLE(napatech_bypass, |
1704 | AS_HELP_STRING([--disable-napatech-bypass],[Disable Bypass feature on Napatech cards]), | |
1705 | [ napatech_bypass=$enableval ], | |
1706 | [ napatech_bypass=yes]) | |
37e3de84 MK |
1707 | AC_ARG_WITH(napatech_includes, |
1708 | [ --with-napatech-includes=DIR napatech include directory], | |
1709 | [with_napatech_includes="$withval"],[with_napatech_includes="/opt/napatech3/include"]) | |
1710 | AC_ARG_WITH(napatech_libraries, | |
1711 | [ --with-napatech-libraries=DIR napatech library directory], | |
1712 | [with_napatech_libraries="$withval"],[with_napatech_libraries="/opt/napatech3/lib"]) | |
1713 | ||
1714 | if test "$enable_napatech" = "yes"; then | |
1715 | CPPFLAGS="${CPPFLAGS} -I${with_napatech_includes}" | |
1716 | LDFLAGS="${LDFLAGS} -L${with_napatech_libraries} -lntapi" | |
1717 | AC_CHECK_HEADER(nt.h,NAPATECH="yes",NAPATECH="no") | |
1718 | if test "$NAPATECH" != "no"; then | |
1719 | NAPATECH="" | |
1720 | AC_CHECK_LIB(ntapi, NT_Init,NAPATECH="yes",NAPATECH="no") | |
844e4dba MK |
1721 | fi |
1722 | ||
37e3de84 | 1723 | if test "$NAPATECH" = "no"; then |
844e4dba MK |
1724 | echo |
1725 | echo " ERROR! libntapi library not found" | |
1726 | echo | |
1727 | exit 1 | |
05271bfb PY |
1728 | else |
1729 | AC_CHECK_LIB(numa, numa_available,, LIBNUMA="no") | |
1730 | if test "$LIBNUMA" = "no"; then | |
1731 | echo | |
1732 | echo " WARNING: libnuma is required to use Napatech auto-config" | |
1733 | echo " libnuma is not found. Go get it" | |
1734 | echo " from http://github.com/numactl/numactl or your distribution:" | |
1735 | echo " Ubuntu: apt-get install libnuma-dev" | |
1736 | echo " Fedora: dnf install numactl-devel" | |
1737 | echo " CentOS/RHEL: yum install numactl-devel" | |
1738 | echo | |
1739 | exit 1 | |
1740 | fi | |
844e4dba | 1741 | fi |
ba81c4d2 VJ |
1742 | |
1743 | AC_DEFINE([HAVE_NAPATECH],[1],(Napatech capture card support)) | |
1c995369 PY |
1744 | if test "$napatech_bypass" = "yes"; then |
1745 | AC_CHECK_LIB(ntapi, NT_FlowOpenAttrInit,NTFLOW="yes",NTFLOW="no") | |
1746 | if test "$NTFLOW" = "yes"; then | |
1747 | echo " Napatech Flow Processing is Enabled (--disable-napatech-bypass if not needed)" | |
1748 | AC_DEFINE([NAPATECH_ENABLE_BYPASS],[1],(Napatech flowdirector support)) | |
1749 | else | |
1750 | echo "Napatech Flow Processing is not available" | |
1751 | fi | |
1752 | else | |
1753 | echo "Napatech Flow Processing is Disabled." | |
1754 | fi | |
844e4dba MK |
1755 | fi |
1756 | ||
e366c62c VJ |
1757 | # liblua |
1758 | AC_ARG_ENABLE(lua, | |
1759 | AS_HELP_STRING([--enable-lua],[Enable Lua support]), | |
d01ce2e5 | 1760 | [ enable_lua="$enableval"], |
e366c62c | 1761 | [ enable_lua="no"]) |
ba81c4d2 VJ |
1762 | AC_ARG_ENABLE(luajit, |
1763 | AS_HELP_STRING([--enable-luajit],[Enable Luajit support]), | |
d01ce2e5 | 1764 | [ enable_luajit="$enableval"], |
ba81c4d2 VJ |
1765 | [ enable_luajit="no"]) |
1766 | if test "$enable_lua" = "yes"; then | |
1767 | if test "$enable_luajit" = "yes"; then | |
1768 | echo "ERROR: can't enable liblua and luajit at the same time." | |
1769 | echo "For LuaJIT, just use --enable-luajit. For liblua (no jit)" | |
1770 | echo "support, use just --enable-lua." | |
1771 | echo "Both options will enable the Lua scripting capabilities" | |
1772 | echo "in Suricata". | |
1773 | echo | |
1774 | exit 1 | |
1775 | fi | |
1776 | fi | |
1777 | ||
e366c62c VJ |
1778 | AC_ARG_WITH(liblua_includes, |
1779 | [ --with-liblua-includes=DIR liblua include directory], | |
1780 | [with_liblua_includes="$withval"],[with_liblua_includes="no"]) | |
1781 | AC_ARG_WITH(liblua_libraries, | |
1782 | [ --with-liblua-libraries=DIR liblua library directory], | |
1783 | [with_liblua_libraries="$withval"],[with_liblua_libraries="no"]) | |
1784 | ||
1785 | if test "$enable_lua" = "yes"; then | |
1786 | if test "$with_liblua_includes" != "no"; then | |
1787 | CPPFLAGS="${CPPFLAGS} -I${with_liblua_includes}" | |
1788 | else | |
da1fe759 VJ |
1789 | # lua lua51 lua5.1 lua-5.1 |
1790 | PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [ | |
1791 | PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [ | |
1792 | PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [ | |
1793 | PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [ | |
1794 | LUA="no" | |
1795 | ]) | |
1796 | ]) | |
1797 | ]) | |
1798 | ]) | |
e366c62c VJ |
1799 | CPPFLAGS="${CPPFLAGS} ${LUA_CFLAGS}" |
1800 | fi | |
1801 | ||
1802 | AC_CHECK_HEADER(lualib.h,LUA="yes",LUA="no") | |
1803 | if test "$LUA" = "yes"; then | |
1804 | if test "$with_liblua_libraries" != "no"; then | |
1805 | LDFLAGS="${LDFLAGS} -L${with_liblua_libraries}" | |
da1fe759 VJ |
1806 | AC_CHECK_LIB(${LUA_LIB_NAME}, luaL_openlibs,, LUA="no") |
1807 | if test "$LUA" = "no"; then | |
1808 | echo | |
1809 | echo " ERROR! liblua library not found, go get it" | |
1810 | echo " from http://lua.org/index.html or your distribution:" | |
1811 | echo | |
5db32204 | 1812 | echo " Ubuntu: apt-get install liblua5.1-dev" |
015cd930 | 1813 | echo " Fedora: dnf install lua-devel" |
1814 | echo " CentOS/RHEL: yum install lua-devel" | |
da1fe759 VJ |
1815 | echo |
1816 | echo " If you installed software in a non-standard prefix" | |
1817 | echo " consider adjusting the PKG_CONFIG_PATH environment variable" | |
1818 | echo " or use --with-liblua-libraries configure option." | |
1819 | echo | |
1820 | exit 1 | |
1821 | fi | |
e366c62c | 1822 | else |
da1fe759 VJ |
1823 | # lua lua51 lua5.1 lua-5.1 |
1824 | PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [ | |
1825 | PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [ | |
1826 | PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [ | |
1827 | PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [ | |
1828 | LUA="no" | |
1829 | ]) | |
1830 | ]) | |
1831 | ]) | |
1832 | ]) | |
d648446c | 1833 | LIBS="${LIBS} ${LUA_LIBS}" |
e366c62c VJ |
1834 | fi |
1835 | ||
6228f5f6 VJ |
1836 | if test "$LUA" = "no"; then |
1837 | AC_CHECK_LIB(lua, luaL_openlibs,, LUA="no") | |
1838 | fi | |
1839 | ||
1840 | if test "$LUA" = "yes"; then | |
1841 | AC_DEFINE([HAVE_LUA],[1],[liblua available]) | |
1842 | enable_lua="yes" | |
1843 | fi | |
e366c62c VJ |
1844 | else |
1845 | echo | |
1846 | echo " ERROR! liblua headers not found, go get them" | |
1847 | echo " from http://lua.org/index.html or your distribution:" | |
1848 | echo | |
5db32204 | 1849 | echo " Ubuntu: apt-get install liblua5.1-dev" |
015cd930 | 1850 | echo " Fedora: dnf install lua-devel" |
1851 | echo " CentOS/RHEL: yum install lua-devel" | |
e366c62c VJ |
1852 | echo |
1853 | echo " If you installed software in a non-standard prefix" | |
1854 | echo " consider adjusting the PKG_CONFIG_PATH environment variable" | |
1855 | echo " or use --with-liblua-includes and --with-liblua-libraries" | |
1856 | echo " configure option." | |
1857 | echo | |
1858 | exit 1 | |
1859 | fi | |
1860 | fi | |
1861 | ||
5b2fbfb1 | 1862 | # libluajit |
5b2fbfb1 VJ |
1863 | AC_ARG_WITH(libluajit_includes, |
1864 | [ --with-libluajit-includes=DIR libluajit include directory], | |
c9cc137d | 1865 | [with_libluajit_includes="$withval"],[with_libluajit_includes="no"]) |
5b2fbfb1 VJ |
1866 | AC_ARG_WITH(libluajit_libraries, |
1867 | [ --with-libluajit-libraries=DIR libluajit library directory], | |
1868 | [with_libluajit_libraries="$withval"],[with_libluajit_libraries="no"]) | |
1869 | ||
c9cc137d VJ |
1870 | if test "$enable_luajit" = "yes"; then |
1871 | if test "$with_libluajit_includes" != "no"; then | |
1872 | CPPFLAGS="${CPPFLAGS} -I${with_libluajit_includes}" | |
819debdc | 1873 | else |
344ea3fa | 1874 | PKG_CHECK_MODULES([LUAJIT], [luajit], , LUAJIT="no") |
819debdc | 1875 | CPPFLAGS="${CPPFLAGS} ${LUAJIT_CFLAGS}" |
5b2fbfb1 VJ |
1876 | fi |
1877 | ||
c9cc137d VJ |
1878 | AC_CHECK_HEADER(lualib.h,LUAJIT="yes",LUAJIT="no") |
1879 | if test "$LUAJIT" = "yes"; then | |
1880 | if test "$with_libluajit_libraries" != "no"; then | |
1881 | LDFLAGS="${LDFLAGS} -L${with_libluajit_libraries}" | |
819debdc EL |
1882 | else |
1883 | PKG_CHECK_MODULES([LUAJIT], [luajit]) | |
d648446c | 1884 | LIBS="${LIBS} ${LUAJIT_LIBS}" |
c9cc137d | 1885 | fi |
5b2fbfb1 | 1886 | |
c9cc137d | 1887 | AC_CHECK_LIB(luajit-5.1, luaL_openlibs,, LUAJIT="no") |
5b2fbfb1 | 1888 | |
c9cc137d VJ |
1889 | if test "$LUAJIT" = "no"; then |
1890 | echo | |
1891 | echo " ERROR! libluajit library not found, go get it" | |
1892 | echo " from http://luajit.org/index.html or your distribution:" | |
1893 | echo | |
1894 | echo " Ubuntu: apt-get install libluajit-5.1-dev" | |
1895 | echo | |
344ea3fa EL |
1896 | echo " If you installed software in a non-standard prefix" |
1897 | echo " consider adjusting the PKG_CONFIG_PATH environment variable" | |
1898 | echo " or use --with-libluajit-libraries configure option." | |
1899 | echo | |
c9cc137d VJ |
1900 | exit 1 |
1901 | fi | |
1902 | ||
e366c62c | 1903 | AC_DEFINE([HAVE_LUA],[1],[lua support available]) |
c9cc137d | 1904 | AC_DEFINE([HAVE_LUAJIT],[1],[libluajit available]) |
ba81c4d2 | 1905 | enable_lua="yes, through luajit" |
c9cc137d | 1906 | enable_luajit="yes" |
e125869d EL |
1907 | else |
1908 | echo | |
1909 | echo " ERROR! libluajit headers not found, go get them" | |
1910 | echo " from http://luajit.org/index.html or your distribution:" | |
1911 | echo | |
1912 | echo " Ubuntu: apt-get install libluajit-5.1-dev" | |
1913 | echo | |
344ea3fa EL |
1914 | echo " If you installed software in a non-standard prefix" |
1915 | echo " consider adjusting the PKG_CONFIG_PATH environment variable" | |
1916 | echo " or use --with-libluajit-includes and --with-libluajit-libraries" | |
1917 | echo " configure option." | |
1918 | echo | |
e125869d | 1919 | exit 1 |
c9cc137d | 1920 | fi |
5b2fbfb1 VJ |
1921 | fi |
1922 | ||
9d687025 JI |
1923 | AM_CONDITIONAL([HAVE_LUA], [test "x$enable_lua" != "xno"]) |
1924 | ||
f9c9548b | 1925 | # If Lua is enabled, test the integer size. |
5c725d50 | 1926 | if test "x$enable_lua" = "xyes" -a "$cross_compiling" != "yes"; then |
1e50b2e4 VJ |
1927 | TMPLIBS="$LIBS" |
1928 | LIBS="" | |
1929 | ||
f9c9548b | 1930 | AC_MSG_CHECKING([size of lua integer]) |
1e50b2e4 | 1931 | AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <lua.h>]], |
f9c9548b JI |
1932 | [[ |
1933 | if (sizeof(lua_Integer) == 8) { | |
1e50b2e4 | 1934 | return 1; |
f9c9548b | 1935 | } |
1e50b2e4 | 1936 | return 0; |
f9c9548b JI |
1937 | ]])], |
1938 | [ | |
1939 | AC_MSG_RESULT([4]) | |
1940 | ], | |
1941 | [ | |
1942 | AC_MSG_RESULT([8]) | |
1943 | AC_SUBST([LUA_INT8], ["lua_int8"]) | |
1944 | ]) | |
1e50b2e4 | 1945 | LIBS="$TMPLIBS" |
f9c9548b JI |
1946 | fi |
1947 | ||
a291209e | 1948 | # libmaxminddb |
d771e081 | 1949 | AC_ARG_ENABLE(geoip, |
a291209e | 1950 | AS_HELP_STRING([--enable-geoip],[Enable GeoIP2 support]), |
61becb29 | 1951 | [ enable_geoip="$enableval"], |
d771e081 | 1952 | [ enable_geoip="no"]) |
a291209e BM |
1953 | AC_ARG_WITH(libmaxminddb_includes, |
1954 | [ --with-libmaxminddb-includes=DIR libmaxminddb include directory], | |
1955 | [with_libmaxminddb_includes="$withval"],[with_libmaxminddb_includes="no"]) | |
1956 | AC_ARG_WITH(libmaxminddb_libraries, | |
1957 | [ --with-libmaxminddb-libraries=DIR libmaxminddb library directory], | |
1958 | [with_libmaxminddb_libraries="$withval"],[with_libmaxminddb_libraries="no"]) | |
d771e081 IS |
1959 | |
1960 | if test "$enable_geoip" = "yes"; then | |
a291209e BM |
1961 | if test "$with_libmaxminddb_includes" != "no"; then |
1962 | CPPFLAGS="${CPPFLAGS} -I${with_libmaxminddb_includes}" | |
d771e081 IS |
1963 | fi |
1964 | ||
a291209e | 1965 | AC_CHECK_HEADER(maxminddb.h,GEOIP="yes",GEOIP="no") |
d771e081 | 1966 | if test "$GEOIP" = "yes"; then |
a291209e BM |
1967 | if test "$with_libmaxminddb_libraries" != "no"; then |
1968 | LDFLAGS="${LDFLAGS} -L${with_libmaxminddb_libraries}" | |
d771e081 | 1969 | fi |
a291209e | 1970 | AC_CHECK_LIB(maxminddb, MMDB_open,, GEOIP="no") |
d771e081 IS |
1971 | fi |
1972 | if test "$GEOIP" = "no"; then | |
1973 | echo | |
a291209e BM |
1974 | echo " ERROR! libmaxminddb GeoIP2 library not found, go get it" |
1975 | echo " from https://github.com/maxmind/libmaxminddb or your distribution:" | |
d771e081 | 1976 | echo |
a291209e BM |
1977 | echo " Ubuntu: apt-get install libmaxminddb-dev" |
1978 | echo " Fedora: dnf install libmaxminddb-devel" | |
1979 | echo " CentOS/RHEL: yum install libmaxminddb-devel" | |
d771e081 IS |
1980 | echo |
1981 | exit 1 | |
1982 | fi | |
ba81c4d2 | 1983 | |
a291209e | 1984 | AC_DEFINE([HAVE_GEOIP],[1],[libmaxminddb available]) |
ba81c4d2 | 1985 | enable_geoip="yes" |
d771e081 IS |
1986 | fi |
1987 | ||
437fe406 AG |
1988 | # Position Independent Executable |
1989 | AC_ARG_ENABLE(pie, | |
1990 | AS_HELP_STRING([--enable-pie],[Enable compiling as a position independent executable]), | |
d01ce2e5 | 1991 | [ enable_pie="$enableval"], |
437fe406 AG |
1992 | [ enable_pie="no"]) |
1993 | if test "$enable_pie" = "yes"; then | |
1994 | CPPFLAGS="${CPPFLAGS} -fPIC" | |
1995 | LDFLAGS="${LDFLAGS} -pie" | |
1996 | fi | |
1997 | ||
a64e5e77 | 1998 | #libevent includes and libraries |
1999 | AC_ARG_WITH(libevent_includes, | |
2000 | [ --with-libevent-includes=DIR libevent include directory], | |
2001 | [with_libevent_includes="$withval"],[with_libevent_includes="no"]) | |
2002 | AC_ARG_WITH(libevent_libraries, | |
2003 | [ --with-libevent-libraries=DIR libevent library directory], | |
2004 | [with_libevent_libraries="$withval"],[with_libevent_libraries="no"]) | |
2005 | ||
eef5678e EL |
2006 | # libhiredis |
2007 | AC_ARG_ENABLE(hiredis, | |
2008 | AS_HELP_STRING([--enable-hiredis],[Enable Redis support]), | |
d01ce2e5 | 2009 | [ enable_hiredis="$enableval"], |
eef5678e EL |
2010 | [ enable_hiredis="no"]) |
2011 | AC_ARG_WITH(libhiredis_includes, | |
2012 | [ --with-libhiredis-includes=DIR libhiredis include directory], | |
2013 | [with_libhiredis_includes="$withval"],[with_libhiredis_includes="no"]) | |
2014 | AC_ARG_WITH(libhiredis_libraries, | |
2015 | [ --with-libhiredis-libraries=DIR libhiredis library directory], | |
2016 | [with_libhiredis_libraries="$withval"],[with_libhiredis_libraries="no"]) | |
2017 | ||
a64e5e77 | 2018 | enable_hiredis_async="no" |
eef5678e EL |
2019 | if test "$enable_hiredis" = "yes"; then |
2020 | if test "$with_libhiredis_includes" != "no"; then | |
2021 | CPPFLAGS="${CPPFLAGS} -I${with_libhiredis_includes}" | |
2022 | fi | |
2023 | ||
2024 | AC_CHECK_HEADER("hiredis/hiredis.h",HIREDIS="yes",HIREDIS="no") | |
2025 | if test "$HIREDIS" = "yes"; then | |
2026 | if test "$with_libhiredis_libraries" != "no"; then | |
2027 | LDFLAGS="${LDFLAGS} -L${with_libhiredis_libraries}" | |
2028 | fi | |
2029 | AC_CHECK_LIB(hiredis, redisConnect,, HIREDIS="no") | |
2030 | fi | |
2031 | if test "$HIREDIS" = "no"; then | |
2032 | echo | |
2033 | echo " ERROR! libhiredis library not found, go get it" | |
2034 | echo " from https://github.com/redis/hiredis or your distribution:" | |
2035 | echo | |
2036 | echo " Ubuntu: apt-get install libhiredis-dev" | |
80bd59ae | 2037 | echo " Fedora: dnf install hiredis-devel" |
015cd930 | 2038 | echo " CentOS/RHEL: yum install hiredis-devel" |
eef5678e EL |
2039 | echo |
2040 | exit 1 | |
2041 | fi | |
2042 | if test "$HIREDIS" = "yes"; then | |
2043 | AC_DEFINE([HAVE_LIBHIREDIS],[1],[libhiredis available]) | |
2044 | enable_hiredis="yes" | |
a64e5e77 | 2045 | # |
2046 | # Check if async adapters and libevent is installed | |
2047 | # | |
2048 | AC_CHECK_HEADER("hiredis/adapters/libevent.h",HIREDIS_LIBEVENT_ADAPTER="yes",HIREDIS_LIBEVENT_ADAPTER="no") | |
2049 | if test "$HIREDIS_LIBEVENT_ADAPTER" = "yes"; then | |
2050 | #Look for libevent headers | |
2051 | if test "$with_libevent_includes" != "no"; then | |
2052 | CPPFLAGS="${CPPFLAGS} -I${with_libevent_includes}" | |
2053 | fi | |
2054 | AC_CHECK_HEADER("event.h",LIBEVENT="yes",LIBEVENT="no") | |
2055 | if test "$LIBEVENT" = "yes"; then | |
2056 | if test "$with_libevent_libraries" != "no"; then | |
2057 | LDFLAGS="${LDFLAGS} -L${with_libevent_libraries}" | |
2058 | fi | |
2059 | AC_CHECK_LIB(event, event_base_free,, HAVE_LIBEVENT="no") | |
2060 | AC_CHECK_LIB(event_pthreads, evthread_use_pthreads,, HAVE_LIBEVENT_PTHREADS="no") | |
2061 | fi | |
7ea80b5c | 2062 | if [ test "$HAVE_LIBEVENT" = "no" ] && [ -o test "$HAVE_LIBEVENT_PTHREADS" = "no"]; then |
a64e5e77 | 2063 | if test "$HAVE_LIBEVENT" = "no"; then |
2064 | echo | |
2065 | echo " Async mode for redis output will not be available." | |
2066 | echo " To enable it install libevent" | |
2067 | echo | |
2068 | echo " Ubuntu: apt-get install libevent-dev" | |
0f41172c | 2069 | echo " Fedora: dnf install libevent-devel" |
015cd930 | 2070 | echo " CentOS/RHEL: yum install libevent-devel" |
a64e5e77 | 2071 | echo |
2072 | fi | |
2073 | if test "$HAVE_LIBEVENT_PTHREADS" = "no"; then | |
2074 | echo | |
2075 | echo " Async mode for redis output will not be available." | |
2076 | echo " To enable it install libevent with pthreads support" | |
2077 | echo | |
2078 | echo " Ubuntu: apt-get install libevent-pthreads-2.0-5" | |
2079 | echo | |
2080 | fi | |
2081 | else | |
2082 | AC_DEFINE([HAVE_LIBEVENT],[1],[libevent available]) | |
2083 | enable_hiredis_async="yes" | |
2084 | fi | |
2085 | fi | |
eef5678e EL |
2086 | fi |
2087 | fi | |
2088 | ||
b85a0b18 | 2089 | # Check for lz4 |
58e92392 MF |
2090 | enable_liblz4="yes" |
2091 | AC_CHECK_LIB(lz4, LZ4F_createCompressionContext, , enable_liblz4="no") | |
2092 | ||
2093 | if test "$enable_liblz4" = "no"; then | |
2094 | echo | |
2095 | echo " Compressed pcap logging is not available without liblz4." | |
2096 | echo " If you want to enable compression, you need to install it." | |
2097 | echo | |
2098 | echo " Ubuntu: apt-get install liblz4-dev" | |
2099 | echo " Fedora: dnf install lz4-devel" | |
015cd930 | 2100 | echo " CentOS/RHEL: yum install epel-release" |
58e92392 MF |
2101 | echo " yum install lz4-devel" |
2102 | echo | |
2103 | fi | |
b85a0b18 | 2104 | |
724ad9e8 VJ |
2105 | # get cache line size |
2106 | AC_PATH_PROG(HAVE_GETCONF_CMD, getconf, "no") | |
2107 | if test "$HAVE_GETCONF_CMD" != "no"; then | |
2108 | CLS=$(getconf LEVEL1_DCACHE_LINESIZE) | |
fdc3b5ba | 2109 | if [test "$CLS" != "" && test "$CLS" != "0"]; then |
0ddd57cb | 2110 | AC_DEFINE_UNQUOTED([CLS],[${CLS}],[L1 cache line size]) |
71c22ddf | 2111 | else |
ba81c4d2 | 2112 | AC_DEFINE([CLS],[64],[L1 cache line size]) |
0ddd57cb | 2113 | fi |
71c22ddf | 2114 | else |
ba81c4d2 | 2115 | AC_DEFINE([CLS],[64],[L1 cache line size]) |
724ad9e8 | 2116 | fi |
d771e081 | 2117 | |
a5b344e0 JF |
2118 | # mscgen for devguide images |
2119 | AC_PATH_PROG([HAVE_MSCGEN], mscgen, "no") | |
2120 | if test "$HAVE_MSCGEN" = "no"; then | |
2121 | enable_mscgen=no | |
2122 | echo "WARNING! mscgen package not installed." | |
2123 | echo " Devguide images won't be generated!" | |
2124 | echo " Get mscgen package:" | |
2125 | echo " https://www.mcternan.me.uk/mscgen/" | |
2126 | echo " or install it from your distribution" | |
2127 | fi | |
2128 | AM_CONDITIONAL([HAVE_MSCGEN], [test "x$enable_mscgen" != "xno" ]) | |
2129 | ||
6eedd006 JI |
2130 | # sphinx for documentation |
2131 | AC_PATH_PROG(HAVE_SPHINXBUILD, sphinx-build, "no") | |
2132 | if test "$HAVE_SPHINXBUILD" = "no"; then | |
2133 | enable_sphinxbuild=no | |
7fa390de JI |
2134 | if test -e "$srcdir/doc/userguide/suricata.1"; then |
2135 | have_suricata_man=yes | |
2136 | fi | |
6eedd006 JI |
2137 | fi |
2138 | AM_CONDITIONAL([HAVE_SPHINXBUILD], [test "x$enable_sphinxbuild" != "xno"]) | |
7fa390de | 2139 | AM_CONDITIONAL([HAVE_SURICATA_MAN], [test "x$have_suricata_man" = "xyes"]) |
6eedd006 | 2140 | |
0792f809 JI |
2141 | # pdflatex for the pdf version of the user manual |
2142 | AC_PATH_PROG(HAVE_PDFLATEX, pdflatex, "no") | |
2143 | if test "$HAVE_PDFLATEX" = "no"; then | |
2144 | enable_pdflatex=no | |
2145 | fi | |
2146 | AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$enable_pdflatex" != "xno"]) | |
2147 | ||
75429bbe | 2148 | # Cargo/Rust |
c9cd7559 | 2149 | AM_CONDITIONAL([RUST_CROSS_COMPILE], [test "x$cross_compiling" = "xyes"]) |
75429bbe JI |
2150 | AC_PATH_PROG(RUSTC, rustc, "no") |
2151 | if test "$RUSTC" = "no"; then | |
2152 | echo "" | |
2153 | echo " ERROR: Suricata now requires Rust to build." | |
2154 | echo "" | |
2155 | echo " Ubuntu/Debian: apt install rustc cargo" | |
2156 | echo " Fedora: dnf install rustc cargo" | |
2157 | echo " CentOS: yum install rustc cargo (requires EPEL)" | |
2158 | echo "" | |
2159 | echo " Rustup works as well: https://rustup.rs/" | |
2160 | echo "" | |
2161 | exit 1 | |
2162 | fi | |
2163 | ||
2164 | AC_PATH_PROG(CARGO, cargo, "no") | |
2165 | if test "CARGO" = "no"; then | |
2166 | AC_MSG_ERROR([cargo required]) | |
2167 | fi | |
2168 | ||
2169 | AC_DEFINE([HAVE_RUST],[1],[Enable Rust language]) | |
2170 | AM_CONDITIONAL([HAVE_RUST],true) | |
2171 | AC_SUBST([CARGO], [$CARGO]) | |
2172 | ||
2173 | enable_rust="yes" | |
2174 | rust_compiler_version=$($RUSTC --version) | |
c9d569f4 | 2175 | rustc_version=$(echo "$rust_compiler_version" | sed 's/^.*[[^0-9]]\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\).*$/\1/') |
f2117774 JI |
2176 | cargo_version_output=$($CARGO --version) |
2177 | cargo_version=$(echo "$cargo_version_output" | sed 's/^.*[[^0-9]]\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\).*$/\1/') | |
4fe9292e | 2178 | |
95e7246b | 2179 | MIN_RUSTC_VERSION="1.34.2" |
c9d569f4 JI |
2180 | AC_MSG_CHECKING(for Rust version $MIN_RUSTC_VERSION or newer) |
2181 | AS_VERSION_COMPARE([$rustc_version], [$MIN_RUSTC_VERSION], | |
2182 | [ | |
2183 | echo "" | |
2184 | echo "ERROR: Rust $MIN_RUSTC_VERSION or newer required." | |
2185 | echo "" | |
2186 | echo "Rust version ${rustc_version} was found." | |
2187 | echo "" | |
2188 | exit 1 | |
2189 | ], | |
2190 | [], | |
2191 | []) | |
2192 | AC_MSG_RESULT(yes) | |
2193 | ||
ea1338b4 JI |
2194 | RUST_FEATURES="" |
2195 | AS_VERSION_COMPARE([$rustc_version], [1.38.0], | |
2196 | [], | |
2197 | [RUST_FEATURES="$RUST_FEATURES function-macro"], | |
2198 | [RUST_FEATURES="$RUST_FEATURES function-macro"]) | |
2199 | ||
8f81792d JI |
2200 | rust_vendor_comment="# " |
2201 | have_rust_vendor="no" | |
2202 | ||
c9cd7559 C |
2203 | if test "x$cross_compiling" = "xyes"; then |
2204 | RUST_SURICATA_LIB_XC_DIR="${host_alias}/" | |
2205 | else | |
4554ca16 PA |
2206 | if test "x$CARGO_BUILD_TARGET" = "x"; then |
2207 | RUST_SURICATA_LIB_XC_DIR= | |
2208 | else | |
2209 | RUST_SURICATA_LIB_XC_DIR="${CARGO_BUILD_TARGET}/" | |
2210 | fi | |
c9cd7559 C |
2211 | fi |
2212 | ||
75429bbe | 2213 | if test "x$enable_debug" = "xyes"; then |
f3c59ef8 | 2214 | RUST_SURICATA_LIBDIR="../rust/target/${RUST_SURICATA_LIB_XC_DIR}debug" |
75429bbe | 2215 | else |
f3c59ef8 | 2216 | RUST_SURICATA_LIBDIR="../rust/target/${RUST_SURICATA_LIB_XC_DIR}release" |
75429bbe | 2217 | fi |
f3c59ef8 | 2218 | RUST_SURICATA_LIB="${RUST_SURICATA_LIBDIR}/${RUST_SURICATA_LIBNAME}" |
f750e4ca | 2219 | |
e6668560 | 2220 | CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen -I\${srcdir}/../rust/dist" |
75429bbe JI |
2221 | AC_SUBST(RUST_SURICATA_LIB) |
2222 | AC_SUBST(RUST_LDADD) | |
2223 | if test "x$CARGO_HOME" = "x"; then | |
9ae87e79 | 2224 | if test "x$HAVE_CYGPATH" != "xno"; then |
ce0ae81d VJ |
2225 | CYGPATH_CARGO_HOME=$(cygpath -a -t mixed ~/.cargo) |
2226 | AC_SUBST([CARGO_HOME], [$CYGPATH_CARGO_HOME]) | |
2227 | else | |
2228 | AC_SUBST([CARGO_HOME], [~/.cargo]) | |
2229 | fi | |
75429bbe JI |
2230 | else |
2231 | AC_SUBST([CARGO_HOME], [$CARGO_HOME]) | |
8f81792d | 2232 | fi |
389272f4 JI |
2233 | |
2234 | # Check for rustup. RUSTUP_HOME needs to be set if rustup is in | |
2235 | # use, and a user uses sudo (depending on configuration), or su to | |
2236 | # perform the install | |
2237 | rustup_home_path="no" | |
2238 | if test "x$RUSTUP_HOME" != "x"; then | |
2239 | rustup_home_path="$RUSTUP_HOME" | |
2240 | else | |
2241 | AC_PATH_PROG(have_rustup, rustup, "no") | |
2242 | if test "x$have_rustup" != "xno"; then | |
2243 | rustup_home_path=$($have_rustup show home 2>/dev/null || echo "no") | |
2244 | fi | |
2245 | fi | |
2246 | rustup_home="" | |
2247 | if test "x$rustup_home_path" != "xno"; then | |
2248 | rustup_home="RUSTUP_HOME=\$(RUSTUP_HOME_PATH)" | |
2249 | fi | |
2250 | AC_SUBST([RUSTUP_HOME_PATH], [$rustup_home_path]) | |
2251 | AC_SUBST([rustup_home]) | |
2252 | ||
3ca7dcd8 | 2253 | if test -e "$srcdir/rust/vendor"; then |
c08ec8d8 | 2254 | have_rust_vendor="yes" |
c9cd7559 C |
2255 | fi |
2256 | ||
75429bbe JI |
2257 | if test "x$have_rust_vendor" = "xyes"; then |
2258 | rust_vendor_comment="" | |
2259 | fi | |
2260 | ||
8f81792d JI |
2261 | AC_SUBST(rust_vendor_comment) |
2262 | AM_CONDITIONAL([HAVE_RUST_VENDOR], [test "x$have_rust_vendor" = "xyes"]) | |
2263 | ||
f2117774 JI |
2264 | # With Rust/Cargo 1.37 and greater, cargo-vendor is built-in. |
2265 | AC_MSG_CHECKING(for cargo vendor support) | |
2266 | AS_VERSION_COMPARE([$cargo_version], [1.37.0], | |
2267 | [have_cargo_vendor="no"], | |
2268 | [have_cargo_vendor="yes"], | |
2269 | [have_cargo_vendor="yes"]) | |
2270 | AC_MSG_RESULT($have_cargo_vendor) | |
2271 | ||
2272 | # If Rust is older than 1.37, check for cargo-vendor as an | |
2273 | # external sub-command. | |
2274 | if test "x$have_cargo_vendor" != "xyes"; then | |
2275 | AC_CHECK_PROG(have_cargo_vendor_bin, cargo-vendor, yes, no) | |
2276 | have_cargo_vendor=$have_cargo_vendor_bin | |
8f81792d | 2277 | fi |
f2117774 | 2278 | |
da3930e4 JI |
2279 | have_rust_headers="no" |
2280 | AC_MSG_CHECKING(for $srcdir/rust/dist/rust-bindings.h) | |
2281 | if test -f "$srcdir/rust/dist/rust-bindings.h"; then | |
2282 | AC_MSG_RESULT(yes) | |
2283 | have_rust_headers="yes" | |
2284 | else | |
2285 | AC_MSG_RESULT(no) | |
2286 | AC_MSG_CHECKING(for $srcdir/rust/gen/rust-bindings.h) | |
2287 | if test -f "$srcdir/rust/gen/rust-bindings.h"; then | |
2288 | AC_MSG_RESULT(yes) | |
2289 | have_rust_headers="yes" | |
2290 | else | |
2291 | AC_MSG_RESULT(no) | |
2292 | fi | |
2293 | fi | |
2294 | ||
5fbe0205 JI |
2295 | AC_PATH_PROG(CBINDGEN, cbindgen, "no") |
2296 | if test "x$CBINDGEN" != "xno"; then | |
2297 | cbindgen_version=$(cbindgen --version | cut -d' ' -f2-) | |
2298 | min_cbindgen_version="0.10.0" | |
2299 | AS_VERSION_COMPARE([$cbindgen_version], [$min_cbindgen_version], | |
2300 | [cbindgen_ok="no"], | |
2301 | [cbindgen_ok="yes"], | |
2302 | [cbindgen_ok="yes"]) | |
2303 | if test "x$cbindgen_ok" != "xyes"; then | |
2304 | echo " Warning: cbindgen must be at least version $min_cbindgen_version," | |
2305 | echo " found $cbindgen_version." | |
2306 | echo " To update: cargo install --force cbindgen" | |
2307 | CBINDGEN="no" | |
2308 | else | |
2309 | have_rust_headers="no" | |
2310 | fi | |
2311 | fi | |
2312 | ||
e6668560 JI |
2313 | AC_SUBST([CBINDGEN], [$CBINDGEN]) |
2314 | ||
5fbe0205 | 2315 | # Require cbindgen if generated headers are not bundled. |
b573c16d | 2316 | if test "x$have_rust_headers" != "xyes"; then |
5fbe0205 JI |
2317 | if test "x$CBINDGEN" = "xno"; then |
2318 | echo " Warning: cbindgen too old or not found, it is required to " | |
2319 | echo " generate header files." | |
b573c16d DB |
2320 | echo " To install: cargo install --force cbindgen" |
2321 | AC_MSG_ERROR([cbindgen required]) | |
2322 | fi | |
b573c16d DB |
2323 | fi |
2324 | ||
5fbe0205 JI |
2325 | AM_CONDITIONAL([HAVE_RUST_HEADERS], [test "x$have_rust_headers" = "xyes"]) |
2326 | AM_CONDITIONAL([HAVE_CBINDGEN], [test "x$CBINDGEN" != "xno"]) | |
f2117774 | 2327 | AM_CONDITIONAL([HAVE_CARGO_VENDOR], [test "x$have_cargo_vendor" != "xno"]) |
8f81792d | 2328 | |
6a4cefb7 | 2329 | AC_ARG_ENABLE(rust_strict, |
d01ce2e5 | 2330 | AS_HELP_STRING([--enable-rust-strict], [Rust warnings as errors]),[enable_rust_strict=$enableval],[enable_rust_strict=no]) |
6a4cefb7 JI |
2331 | AS_IF([test "x$enable_rust_strict" = "xyes"], [ |
2332 | RUST_FEATURES="strict" | |
2333 | ]) | |
2334 | AC_SUBST(RUST_FEATURES) | |
2335 | ||
e8415f24 PA |
2336 | AC_CHECK_LIB(fuzzpcap, FPC_IsFuzzPacketCapture, HAS_FUZZPCAP="yes") |
2337 | AM_CONDITIONAL([HAS_FUZZPCAP], [test "x$HAS_FUZZPCAP" = "xyes"]) | |
4f963717 PA |
2338 | AC_ARG_ENABLE(fuzztargets, |
2339 | AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no]) | |
2340 | AM_CONDITIONAL([BUILD_FUZZTARGETS], [test "x$enable_fuzztargets" = "xyes"]) | |
46646688 | 2341 | AM_CONDITIONAL([RUST_BUILD_STD], [test "x$enable_fuzztargets" = "xyes" && echo "$rust_compiler_version" | grep -q nightly && echo "$RUSTFLAGS" | grep -v -q coverage]) |
4f963717 PA |
2342 | AC_PROG_CXX |
2343 | AS_IF([test "x$enable_fuzztargets" = "xyes"], [ | |
2344 | AS_IF([test "x$CARGO_BUILD_TARGET" = "x" && echo "$rust_compiler_version" | grep -q nightly], [ | |
2345 | CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu | |
2346 | AC_SUBST(CARGO_BUILD_TARGET) | |
2347 | ]) | |
2348 | AC_DEFINE([FUZZ], [1], [Fuzz targets are enabled]) | |
2349 | AC_DEFINE([AFLFUZZ_NO_RANDOM], [1], [Disable all use of random functions]) | |
2350 | CFLAGS_ORIG=$CFLAGS | |
2351 | CFLAGS="-Werror" | |
2352 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[while (__AFL_LOOP(1000))]])], | |
2353 | [AC_DEFINE([AFLFUZZ_PERSISTANT_MODE], [1], [Enable AFL PERSISTANT_MODE])], | |
2354 | []) | |
2355 | CFLAGS=$CFLAGS_ORIG | |
2356 | AC_LANG_PUSH(C++) | |
2357 | tmp_saved_flags=$[]_AC_LANG_PREFIX[]FLAGS | |
2358 | AS_IF([test "x$LIB_FUZZING_ENGINE" = "x"], [ | |
2359 | LIB_FUZZING_ENGINE=-fsanitize=fuzzer | |
2360 | AC_SUBST(LIB_FUZZING_ENGINE) | |
2361 | ]) | |
2362 | _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $LIB_FUZZING_ENGINE" | |
2363 | AC_MSG_CHECKING([whether $CXX accepts $LIB_FUZZING_ENGINE]) | |
2364 | AC_LINK_IFELSE([AC_LANG_SOURCE([[ | |
2365 | #include <sys/types.h> | |
2366 | extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size); | |
2367 | extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size) { | |
2368 | (void)Data; | |
2369 | (void)Size; | |
2370 | return 0; | |
2371 | } | |
2372 | ]])], | |
2373 | [ AC_MSG_RESULT(yes) | |
2374 | has_sanitizefuzzer=yes], | |
2375 | [ AC_MSG_RESULT(no) ] | |
2376 | ) | |
2377 | _AC_LANG_PREFIX[]FLAGS=$tmp_saved_flags | |
2378 | AC_LANG_POP() | |
2379 | ]) | |
2380 | ||
2381 | AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"]) | |
2382 | ||
e3bde3e9 VJ |
2383 | # get revision |
2384 | if test -f ./revision; then | |
2385 | REVISION=`cat ./revision` | |
ba81c4d2 | 2386 | AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision]) |
e3bde3e9 | 2387 | else |
042d0c6e VJ |
2388 | AC_PATH_PROG(HAVE_GIT_CMD, git, "no") |
2389 | if test "$HAVE_GIT_CMD" != "no"; then | |
5886ef82 VJ |
2390 | if [ test -d .git ]; then |
2391 | REVISION=`git rev-parse --short HEAD` | |
8c2c78f0 SB |
2392 | DATE=`git log -1 --date=short --pretty=format:%cd` |
2393 | REVISION="$REVISION $DATE" | |
ba81c4d2 | 2394 | AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision]) |
5886ef82 | 2395 | fi |
e3bde3e9 VJ |
2396 | fi |
2397 | fi | |
2398 | ||
53a62953 EL |
2399 | if test "${enable_ebpf}" = "yes" || test "${enable_unittests}" = "yes"; then |
2400 | AC_DEFINE([CAPTURE_OFFLOAD_MANAGER], [1],[Building flow bypass manager code]) | |
2401 | fi | |
1c995369 | 2402 | if test "${enable_ebpf}" = "yes" || test "${enable_nfqueue}" = "yes" || test "${enable_pfring}" = "yes" || test "${enable_napatech}" = "yes" || test "${enable_unittests}" = "yes"; then |
53a62953 EL |
2403 | AC_DEFINE([CAPTURE_OFFLOAD], [1],[Building flow capture bypass code]) |
2404 | fi | |
2405 | ||
0ffa1c24 WM |
2406 | AC_SUBST(CFLAGS) |
2407 | AC_SUBST(LDFLAGS) | |
2408 | AC_SUBST(CPPFLAGS) | |
2409 | ||
25804f5a EL |
2410 | define([EXPAND_VARIABLE], |
2411 | [$2=[$]$1 | |
2412 | if test $prefix = 'NONE'; then | |
2413 | prefix="/usr/local" | |
2414 | fi | |
2415 | while true; do | |
2416 | case "[$]$2" in | |
2417 | *\[$]* ) eval "$2=[$]$2" ;; | |
2418 | *) break ;; | |
2419 | esac | |
2420 | done | |
2421 | eval "$2=[$]$2$3" | |
2422 | ])dnl EXPAND_VARIABLE | |
2423 | ||
2424 | # suricata log dir | |
2425 | if test "$WINDOWS_PATH" = "yes"; then | |
6b751621 VJ |
2426 | case $host in |
2427 | x86_64-w64-mingw32) | |
2428 | e_winbase="C:\\\\Program Files\\\\Suricata" | |
2429 | ;; | |
2430 | *) | |
2431 | systemtype="`systeminfo | grep \"based PC\"`" | |
2432 | case "$systemtype" in | |
2433 | *x64*) | |
2434 | e_winbase="C:\\\\Program Files (x86)\\\\Suricata" | |
2435 | ;; | |
2436 | *) | |
2437 | e_winbase="C:\\\\Program Files\\\\Suricata" | |
2438 | ;; | |
2439 | esac | |
2440 | esac | |
d8356c5e | 2441 | |
6b751621 | 2442 | e_sysconfdir="${e_winbase}\\\\" |
e048a74e | 2443 | e_defaultruledir="$e_winbase\\\\rules\\\\" |
6b751621 VJ |
2444 | e_magic_file="$e_winbase\\\\magic.mgc" |
2445 | e_logdir="$e_winbase\\\\log" | |
2446 | e_logfilesdir="$e_logdir\\\\files" | |
2447 | e_logcertsdir="$e_logdir\\\\certs" | |
7bf49006 | 2448 | e_datarulesdir="$e_winbase\\\\rules\\\\" |
9ae87e79 | 2449 | if test "x$HAVE_CYGPATH" != "xno"; then |
24d6a164 VJ |
2450 | # turn srcdir into abs path and convert to the |
2451 | # mixed output (/c/Users/dev into c:/Users/dev) | |
2452 | e_rustdir="$(cygpath -a -t mixed ${srcdir})/rust" | |
2453 | else | |
2454 | e_abs_srcdir=$(cd $srcdir && pwd) | |
2455 | e_rustdir="$e_abs_srcdir/rust" | |
2456 | fi | |
25804f5a | 2457 | else |
6b751621 VJ |
2458 | EXPAND_VARIABLE(localstatedir, e_logdir, "/log/suricata/") |
2459 | EXPAND_VARIABLE(localstatedir, e_rundir, "/run/") | |
2460 | EXPAND_VARIABLE(localstatedir, e_logfilesdir, "/log/suricata/files") | |
2461 | EXPAND_VARIABLE(localstatedir, e_logcertsdir, "/log/suricata/certs") | |
2462 | EXPAND_VARIABLE(sysconfdir, e_sysconfdir, "/suricata/") | |
6b751621 | 2463 | EXPAND_VARIABLE(localstatedir, e_localstatedir, "/run/suricata") |
7bf49006 | 2464 | EXPAND_VARIABLE(datadir, e_datarulesdir, "/suricata/rules") |
5d5612f9 | 2465 | EXPAND_VARIABLE(localstatedir, e_datadir, "/lib/suricata/data") |
e048a74e | 2466 | EXPAND_VARIABLE(ruledirprefix, e_defaultruledir, "/suricata/rules") |
24d6a164 VJ |
2467 | |
2468 | e_abs_srcdir=$(cd $srcdir && pwd) | |
2469 | EXPAND_VARIABLE(e_abs_srcdir, e_rustdir, "/rust") | |
25804f5a EL |
2470 | fi |
2471 | AC_SUBST(e_logdir) | |
1c3546fe | 2472 | AC_SUBST(e_rundir) |
d8356c5e | 2473 | AC_SUBST(e_logfilesdir) |
55625d73 | 2474 | AC_SUBST(e_logcertsdir) |
25804f5a | 2475 | AC_SUBST(e_sysconfdir) |
5d5612f9 | 2476 | AC_DEFINE_UNQUOTED([CONFIG_DIR],["$e_sysconfdir"],[Our CONFIG_DIR]) |
20a8b9db | 2477 | AC_SUBST(e_localstatedir) |
5d5612f9 | 2478 | AC_DEFINE_UNQUOTED([DATA_DIR],["$e_datadir"],[Our DATA_DIR]) |
25804f5a | 2479 | AC_SUBST(e_magic_file) |
15c98c60 | 2480 | AC_SUBST(e_magic_file_comment) |
f55dbca5 | 2481 | AC_SUBST(e_enable_evelog) |
7bf49006 | 2482 | AC_SUBST(e_datarulesdir) |
e048a74e | 2483 | AC_SUBST(e_defaultruledir) |
24d6a164 | 2484 | AC_SUBST(e_rustdir) |
25804f5a | 2485 | |
ba81c4d2 VJ |
2486 | EXPAND_VARIABLE(prefix, CONFIGURE_PREFIX) |
2487 | EXPAND_VARIABLE(sysconfdir, CONFIGURE_SYSCONDIR) | |
2488 | EXPAND_VARIABLE(localstatedir, CONFIGURE_LOCALSTATEDIR) | |
5eb7f0f7 | 2489 | EXPAND_VARIABLE(datadir, CONFIGURE_DATAROOTDIR) |
ba81c4d2 VJ |
2490 | AC_SUBST(CONFIGURE_PREFIX) |
2491 | AC_SUBST(CONFIGURE_SYSCONDIR) | |
2492 | AC_SUBST(CONFIGURE_LOCALSTATEDIR) | |
5eb7f0f7 | 2493 | AC_SUBST(CONFIGURE_DATAROOTDIR) |
8f81792d | 2494 | AC_SUBST(PACKAGE_VERSION) |
ea1338b4 | 2495 | AC_SUBST(RUST_FEATURES) |
f3c59ef8 | 2496 | AC_SUBST(RUST_SURICATA_LIBDIR) |
dbae17db | 2497 | AC_SUBST(RUST_SURICATA_LIBNAME) |
dfd930a1 | 2498 | AC_SUBST(enable_non_bundled_htp) |
ba81c4d2 | 2499 | |
e227d97e JI |
2500 | AM_CONDITIONAL([BUILD_SHARED_LIBRARY], [test "x$enable_shared" = "xyes"] && [test "x$can_build_shared_library" = "xyes"]) |
2501 | ||
27d1ee98 | 2502 | AC_CONFIG_FILES(Makefile src/Makefile rust/Makefile rust/Cargo.toml rust/derive/Cargo.toml rust/.cargo/config) |
0795dc1e | 2503 | AC_CONFIG_FILES(qa/Makefile qa/coccinelle/Makefile) |
7b1699c5 | 2504 | AC_CONFIG_FILES(rules/Makefile doc/Makefile doc/userguide/Makefile doc/devguide/Makefile) |
0795dc1e AH |
2505 | AC_CONFIG_FILES(contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile) |
2506 | AC_CONFIG_FILES(suricata.yaml etc/Makefile etc/suricata.logrotate etc/suricata.service) | |
2507 | AC_CONFIG_FILES(python/Makefile python/suricata/config/defaults.py) | |
2508 | AC_CONFIG_FILES(ebpf/Makefile) | |
dfd930a1 | 2509 | AC_CONFIG_FILES(libsuricata-config) |
0795dc1e | 2510 | AC_OUTPUT |
a098e39b | 2511 | |
668113af | 2512 | SURICATA_BUILD_CONF="Suricata Configuration: |
73a1b972 | 2513 | AF_PACKET support: ${enable_af_packet} |
91e1256b | 2514 | eBPF support: ${enable_ebpf} |
8c880879 | 2515 | XDP support: ${have_xdp} |
73a1b972 | 2516 | PF_RING support: ${enable_pfring} |
ef463457 | 2517 | NFQueue support: ${enable_nfqueue} |
4851568a | 2518 | NFLOG support: ${enable_nflog} |
ef463457 | 2519 | IPFW support: ${enable_ipfw} |
517b45ea | 2520 | Netmap support: ${enable_netmap} ${have_netmap_version} |
73a1b972 | 2521 | DAG enabled: ${enable_dag} |
37e3de84 | 2522 | Napatech enabled: ${enable_napatech} |
ec77632e | 2523 | WinDivert enabled: ${enable_windivert} |
ba81c4d2 | 2524 | |
20a8b9db | 2525 | Unix socket enabled: ${enable_unixsocket} |
f4872a2f | 2526 | Detection enabled: ${enable_detection} |
73a1b972 | 2527 | |
810e43f3 | 2528 | Libmagic support: ${enable_magic} |
20a8b9db | 2529 | libjansson support: ${enable_jansson} |
eef5678e | 2530 | hiredis support: ${enable_hiredis} |
a64e5e77 | 2531 | hiredis async with libevent: ${enable_hiredis_async} |
bce3c468 | 2532 | PCRE jit: ${pcre2_jit_available} |
e366c62c | 2533 | LUA support: ${enable_lua} |
5b2fbfb1 | 2534 | libluajit: ${enable_luajit} |
a291209e | 2535 | GeoIP2 support: ${enable_geoip} |
73a1b972 | 2536 | Non-bundled htp: ${enable_non_bundled_htp} |
13b87f5a | 2537 | Hyperscan support: ${enable_hyperscan} |
439b62fe | 2538 | Libnet support: ${enable_libnet} |
58e92392 | 2539 | liblz4 support: ${enable_liblz4} |
73a1b972 | 2540 | |
ed712768 | 2541 | Rust support: ${enable_rust} |
6a4cefb7 | 2542 | Rust strict mode: ${enable_rust_strict} |
c9d569f4 JI |
2543 | Rust compiler path: ${RUSTC} |
2544 | Rust compiler version: ${rust_compiler_version} | |
2545 | Cargo path: ${CARGO} | |
f2117774 JI |
2546 | Cargo version: ${cargo_version_output} |
2547 | Cargo vendor: ${have_cargo_vendor} | |
8f81792d | 2548 | |
a228986c JI |
2549 | Python support: ${enable_python} |
2550 | Python path: ${python_path} | |
a69afd5c JI |
2551 | Python distutils ${have_python_distutils} |
2552 | Python yaml ${have_python_yaml} | |
2553 | Install suricatactl: ${install_suricatactl} | |
2554 | Install suricatasc: ${install_suricatactl} | |
abb3cc85 | 2555 | Install suricata-update: ${install_suricata_update}${install_suricata_update_reason} |
cd305c3a | 2556 | |
ef463457 | 2557 | Profiling enabled: ${enable_profiling} |
d908e707 | 2558 | Profiling locks enabled: ${enable_profiling_locks} |
439b62fe | 2559 | |
ff81212d JI |
2560 | Plugin support (experimental): ${plugin_support} |
2561 | ||
439b62fe | 2562 | Development settings: |
7fb860ac | 2563 | Coccinelle / spatch: ${enable_coccinelle} |
439b62fe VJ |
2564 | Unit tests enabled: ${enable_unittests} |
2565 | Debug output enabled: ${enable_debug} | |
2566 | Debug validation enabled: ${enable_debug_validation} | |
ef463457 EL |
2567 | |
2568 | Generic build parameters: | |
ba81c4d2 VJ |
2569 | Installation prefix: ${prefix} |
2570 | Configuration directory: ${e_sysconfdir} | |
2571 | Log directory: ${e_logdir} | |
2572 | ||
2573 | --prefix ${CONFIGURE_PREFIX} | |
2574 | --sysconfdir ${CONFIGURE_SYSCONDIR} | |
2575 | --localstatedir ${CONFIGURE_LOCALSTATEDIR} | |
5eb7f0f7 | 2576 | --datarootdir ${CONFIGURE_DATAROOTDIR} |
73a1b972 | 2577 | |
ef463457 | 2578 | Host: ${host} |
ba81c4d2 | 2579 | Compiler: ${CC} (exec name) / ${compiler} (real) |
ef463457 EL |
2580 | GCC Protect enabled: ${enable_gccprotect} |
2581 | GCC march native enabled: ${enable_gccmarch_native} | |
ba81c4d2 | 2582 | GCC Profile enabled: ${enable_gccprofile} |
437fe406 | 2583 | Position Independent Executable enabled: ${enable_pie} |
ba81c4d2 VJ |
2584 | CFLAGS ${CFLAGS} |
2585 | PCAP_CFLAGS ${PCAP_CFLAGS} | |
2586 | SECCFLAGS ${SECCFLAGS}" | |
668113af EL |
2587 | |
2588 | echo | |
2589 | echo "$SURICATA_BUILD_CONF" | |
4749420f VJ |
2590 | echo "printf(" >src/build-info.h |
2591 | echo "$SURICATA_BUILD_CONF" | sed -e 's/^/"/' | sed -e 's/$/\\n"/' >>src/build-info.h | |
2592 | echo ");" >>src/build-info.h | |
25804f5a | 2593 | |
668113af | 2594 | echo " |
25804f5a | 2595 | To build and install run 'make' and 'make install'. |
73a1b972 | 2596 | |
697e9e66 VJ |
2597 | You can run 'make install-conf' if you want to install initial configuration |
2598 | files to ${e_sysconfdir}. Running 'make install-full' will install configuration | |
2599 | and rules and provide you a ready-to-run suricata." | |
73a1b972 VJ |
2600 | echo |
2601 | echo "To install Suricata into /usr/bin/suricata, have the config in | |
2602 | /etc/suricata and use /var/log/suricata as log dir, use: | |
697e9e66 VJ |
2603 | ./configure --prefix=/usr/ --sysconfdir=/etc/ --localstatedir=/var/" |
2604 | echo |