1# $Id$ 2AC_INIT([snort], [m4_esyscmd_s([cat ./VERSION])]) 3AC_CONFIG_SRCDIR([src/snort.c]) 4AC_PREREQ(2.50) 5AM_CONFIG_HEADER(config.h) 6# When changing the snort version, please also update the VERSION 7# definition in "src/win32/WIN32-Includes/config.h" 8AM_INIT_AUTOMAKE(snort,2.9.18) 9 10NO_OPTIMIZE="no" 11 12AC_PROG_CC_STDC 13AC_PROG_CC 14AC_PROG_LIBTOOL 15AC_PROG_RANLIB 16AC_C_BIGENDIAN 17# AC_C_BIGENDIAN implicitly defines WORDS_BIGENDIAN, but the CCONFIGFLAGS also needs to be affected. 18if test "x$ac_cv_c_bigendian" = "xyes"; then 19 CCONFIGFLAGS="${CCONFIGFLAGS} -DSF_BIGENDIAN" 20fi 21AC_C_INLINE 22 23#AC_CANONICAL_HOST 24linux="no" 25sunos4="no" 26macos="no" 27so_with_static_lib="yes" 28 29case "$host" in 30 *-openbsd2.6|*-openbsd2.5|*-openbsd2.4|*-openbsd2.3*) 31 AC_DEFINE([OPENBSD],[1],[Define if OpenBSD]) 32 AC_DEFINE([BROKEN_SIOCGIFMTU],[1],[Define if BROKEN_SIOCGIFMTU]) 33 so_with_static_lib="no" 34 35 ;; 36 *-openbsd*) 37 AC_DEFINE([OPENBSD],[1],[Define if OpenBSD < 2.3]) 38 so_with_static_lib="no" 39 40 ;; 41 *-sgi-irix5*) 42 AC_DEFINE([IRIX],[1],[Define if Irix 5]) 43 no_libsocket="yes" 44 no_libnsl="yes" 45 if test -z "$GCC"; then 46 sgi_cc="yes" 47 fi 48 LDFLAGS="${LDFLAGS} -L/usr/local/lib" 49 extra_incl="-I/usr/local/include" 50 ;; 51 *-sgi-irix6*) 52 AC_DEFINE([IRIX],[1],[Define if Irix 6]) 53 no_libsocket="yes" 54 no_libnsl="yes" 55 if test -z "$GCC"; then 56 sgi_cc="yes" 57 fi 58 LDFLAGS="${LDFLAGS} -L/usr/local/lib" 59 extra_incl="-I/usr/local/include" 60 ;; 61 *-solaris*) 62 AC_DEFINE([SOLARIS],[1],[Define if Solaris]) 63 CONFIGFLAGS="${CONFIGFLAGS} -DBSD_COMP -D_REENTRANT" 64 rt_nanosleep="yes" 65 ;; 66 *-sunos*) 67 AC_DEFINE([SUNOS],[1],[Define if SunOS]) 68 sunos4="yes" 69 ;; 70 *-linux*) 71 linux="yes" 72 AC_DEFINE([LINUX],[1],[Define if Linux]) 73 AC_SUBST(extra_incl) 74 extra_incl="-I/usr/include/pcap" 75 ;; 76 *-hpux10*|*-hpux11*) 77 AC_DEFINE([HPUX],[1],[Define if HP-UX 10 or 11]) 78 if test "x$ac_cv_c_bigendian" = "xno"; then 79 # exception to AC_C_BIGENDIAN and test "x$ac_cv_c_bigendian" = "xyes" above 80 # causes the need for next three lines. 81 AC_MSG_NOTICE([bigendian byte-order not detected but asserted for $host]) 82 AC_DEFINE([WORDS_BIGENDIAN],[1],[Define if words are big endian]) 83 CCONFIGFLAGS="${CCONFIGFLAGS} -DSF_BIGENDIAN" 84 fi 85 AC_SUBST(extra_incl) 86 extra_incl="-I/usr/local/include" 87 ;; 88 *-freebsd*) 89 AC_DEFINE([FREEBSD],[1],[Define if FreeBSD]) 90 ;; 91 *-bsdi*) 92 AC_DEFINE([BSDI],[1],[Define if BSDi]) 93 ;; 94 *-aix*) 95 AC_DEFINE([AIX],[1],[Define if AIX]) 96 ;; 97 *-osf4*) 98 AC_DEFINE([OSF1],[1],[Define if OSF-4]) 99 CONFIGFLAGS="${CONFIGFLAGS} -DOSF1" 100 ;; 101 *-osf5.1*) 102 AC_DEFINE([OSF1],[1],[Define if OSF-5.1]) 103 CONFIGFLAGS="${CONFIGFLAGS} -DOSF1" 104 ;; 105 *-tru64*) 106 AC_DEFINE([OSF1],[1],[Define if Tru64]) 107 CONFIGFLAGS="${CONFIGFLAGS} -DOSF1" 108 ;; 109# it is actually <platform>-apple-darwin1.2 or <platform>-apple-rhapsody5.x but lets stick with this for the moment 110 *-apple*) 111 macos="yes" 112 AC_DEFINE([MACOS],[1],[Define if MacOS]) 113 AC_DEFINE([BROKEN_SIOCGIFMTU],[1],[Define if broken SIOCGIFMTU]) 114esac 115 116AC_HEADER_STDBOOL 117 118# ICC stuff 119ICC=no 120if eval "echo $CC | grep icc > /dev/null" ; then 121 if eval "$CC -help | grep libcxa > /dev/null" ; then 122 CFLAGS="$CFLAGS -static-libcxa" 123 LDFLAGS="$LDFLAGS -static-libcxa" 124 XCCFLAGS="-XCClinker -static-libcxa" 125 else 126 CFLAGS="$CFLAGS -static-intel" 127 LDFLAGS="$LDFLAGS -static-intel" 128 XCCFLAGS="-XCClinker -static-intel" 129 fi 130 #CFLAGS=`echo $CFLAGS | sed 's/-O2/-O3/'` 131 CFLAGS="$CFLAGS -O3 -ip -w1" 132 ICC=yes 133fi 134AC_SUBST(XCCFLAGS) 135 136# This is really meant for Solaris Sparc v9 where it has 32bit and 64bit 137# capability but builds 32bit by default 138AC_ARG_ENABLE(64bit-gcc, 139[ --enable-64bit-gcc Try to compile 64bit (only tested on Sparc Solaris 9 and 10).], 140 enable_64bit_gcc="$enableval", enable_64bit_gcc="no") 141if test "x$enable_64bit_gcc" = "xyes"; then 142 CFLAGS="$CFLAGS -m64" 143fi 144 145# AC_PROG_YACC defaults to "yacc" when not found 146# this check defaults to "none" 147AC_CHECK_PROGS(YACC,bison yacc,none) 148# AC_PROG_YACC includes the -y arg if bison is found 149if test "x$YACC" = "xbison"; then 150 YACC="$YACC -y" 151fi 152 153# AC_PROG_LEX defaults to ":" when not found 154# this check defaults to "none" 155# We're using flex specific options so we don't support lex 156AC_CHECK_PROGS(LEX,flex,none) 157 158# 159 160dnl checking headers 161AC_CHECK_HEADERS([ \ 162 inttypes.h \ 163 math.h \ 164 paths.h \ 165 stdlib.h \ 166 string.h \ 167 strings.h \ 168 unistd.h \ 169 wchar.h \ 170 sys/sockio.h \ 171]) 172 173if test "x$ac_cv_header_wchar_h" = "xyes"; then 174 CONFIGFLAGS="${CONFIGFLAGS} -DSF_WCHAR" 175fi 176AC_CHECK_LIB([m],[floor]) 177AC_CHECK_LIB([m],[ceil]) 178 179AC_CHECK_HEADERS(uuid/uuid.h, [AC_CHECK_LIB(uuid,uuid_parse)]) 180 181if test "x$rt_nanosleep" = "xyes"; then 182AC_CHECK_LIB([rt],[nanosleep]) 183fi 184 185dnl make sure we've got all our libraries 186if test -z "$no_libnsl"; then 187AC_CHECK_LIB(nsl, inet_ntoa) 188fi 189 190if test -z "$no_libsocket"; then 191AC_CHECK_LIB(socket, socket) 192fi 193 194# SunOS4 has several things `broken' 195if test "$sunos4" != "no"; then 196AC_CHECK_FUNCS(vsnprintf,, LIBS="$LIBS -ldb") 197AC_CHECK_FUNCS(strtoul,, LIBS="$LIBS -l44bsd") 198fi 199 200# some funky macro to be backwards compatible with earlier autoconfs 201# in current they have AC_CHECK_DECLS 202 203AC_DEFUN([SN_CHECK_DECL],[ 204AC_MSG_CHECKING([whether $1 must be declared]) 205AC_CACHE_VAL(sn_cv_decl_needed_$1, 206[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 207#include <stdio.h> 208#ifdef HAVE_STRING_H 209#include <string.h> 210#endif 211#ifdef HAVE_STRINGS_H 212#include <strings.h> 213#endif 214#ifdef HAVE_STDLIB_H 215#include <stdlib.h> 216#endif 217#ifdef HAVE_UNISTD_H 218#include <unistd.h> 219#endif 220#include <sys/types.h> 221#include <sys/socket.h> 222#include <syslog.h> 223]], [[char *(*pfn); pfn = (char *(*)) $1;]])],[eval "sn_cv_decl_needed_$1=no"],[eval "sn_cv_decl_needed_$1=yes"]) ]) 224 225if eval "test \"`echo '$sn_cv_decl_needed_'$1`\" != no"; then 226 AC_MSG_RESULT(yes) 227 ifelse([$2], , :, [$2]) 228else 229 AC_MSG_RESULT(no) 230 ifelse([$3], , ,[$3]) 231fi 232])dnl 233 234AC_DEFUN([SN_CHECK_DECLS], 235[for sn_decl in $1 236do 237sn_def_decl=`echo $sn_decl | tr [a-z] [A-Z]` 238SN_CHECK_DECL($sn_decl, 239[ 240AC_DEFINE_UNQUOTED(NEED_DECL_$sn_def_decl, 1, 241 [you have this cuz autoheader is dumb]) 242$2], $3)dnl 243done 244]) 245 246# some stuff for declarations which were missed on sunos4 platform too. 247# 248# add `#undef NEED_DECL_FUNCTIONAME to acconfig.h` because autoheader 249# fails to work properly with custom macroses. 250# you will see also #undef for each SN_CHECK_DECLS macros invocation 251# because autoheader doesn't execute shell script commands. 252# it is possible to make loops using m4 but the code would look even 253# more confusing.. 254SN_CHECK_DECLS(printf fprintf syslog puts fputs fputc fopen \ 255 fclose fwrite fflush getopt bzero bcopy memset strtol \ 256 strcasecmp strncasecmp strerror perror socket sendto \ 257 vsnprintf snprintf strtoul) 258 259AC_CHECK_FUNCS([sigaction strlcpy strlcat strerror vswprintf wprintf memrchr inet_ntop gettid]) 260 261AC_CHECK_FUNC([snprintf],[have_snprintf="yes"],[have_snprintf="no"]) 262AM_CONDITIONAL(BUILD_SNPRINTF, test "x$have_snprintf" != "xyes") 263if test "x$have_snprintf" = "xyes"; then 264 AC_DEFINE([HAVE_SNPRINTF], [], [snprintf function is available]) 265fi 266 267AC_CHECK_FUNCS([malloc_trim mallinfo]) 268 269AC_CHECK_SIZEOF([char]) 270AC_CHECK_SIZEOF([short]) 271AC_CHECK_SIZEOF([int]) 272AC_CHECK_SIZEOF([long int]) 273AC_CHECK_SIZEOF([long long int]) 274AC_CHECK_SIZEOF([unsigned int]) 275AC_CHECK_SIZEOF([unsigned long int]) 276AC_CHECK_SIZEOF([unsigned long long int]) 277 278# Check for int types 279AC_CHECK_TYPES([u_int8_t,u_int16_t,u_int32_t,u_int64_t,uint8_t,uint16_t,uint32_t,uint64_t]) 280AC_CHECK_TYPES([int8_t,int16_t,int32_t,int64_t]) 281 282AC_CHECK_TYPES([boolean]) 283 284# In case INADDR_NONE is not defined (like on Solaris) 285have_inaddr_none="no" 286AC_MSG_CHECKING([for INADDR_NONE]) 287AC_RUN_IFELSE( 288[AC_LANG_PROGRAM( 289[[ 290#include <sys/types.h> 291#include <netinet/in.h> 292#include <arpa/inet.h> 293]], 294[[ 295 if (inet_addr("10,5,2") == INADDR_NONE); 296 return 0; 297]])], 298[have_inaddr_none="yes"], 299[have_inaddr_none="no"]) 300AC_MSG_RESULT($have_inaddr_none) 301if test "x$have_inaddr_none" = "xno"; then 302 AC_DEFINE([INADDR_NONE],[-1],[For INADDR_NONE definition]) 303fi 304 305AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 306#include <stdio.h> 307]], [[const char *foo; foo = sys_errlist[0];]])],[AC_DEFINE(ERRLIST_PREDEFINED,1,Define if errlist is predefined)],[]) 308 309AC_MSG_CHECKING(for __FUNCTION__) 310AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 311#include <stdio.h> 312]], [[printf ("%s", __FUNCTION__);]])],[sn_cv_have___FUNCTION__=yes],[sn_cv__have___FUNCTION__=no]) 313if test "x$sn_cv_have___FUNCTION__" = "xyes"; then 314 AC_MSG_RESULT(yes) 315 AC_DEFINE([HAVE___FUNCTION__],[1],[Define if the compiler understands __FUNCTION__.]) 316else 317 AC_MSG_RESULT(no) 318 AC_MSG_CHECKING(for __func__) 319 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 320#include <stdio.h> 321]], [[printf ("%s", __func__);]])],[sn_cv_have___func__=yes],[sn_cv__have___func__=no]) 322 if test "x$sn_cv_have___func__" = "xyes"; then 323 AC_MSG_RESULT(yes) 324 AC_DEFINE([HAVE___func__],[1],[Define if the compiler understands __func__.]) 325 AC_DEFINE([__FUNCTION__],[__func__],[Define __FUNCTION__ as required.]) 326 else 327 AC_MSG_RESULT(no) 328 AC_DEFINE([__FUNCTION__],["mystery function"]) 329 fi 330fi 331 332AC_ARG_WITH(libpcap_includes, 333 [ --with-libpcap-includes=DIR libpcap include directory], 334 [with_libpcap_includes="$withval"],[with_libpcap_includes="no"]) 335 336AC_ARG_WITH(libpcap_libraries, 337 [ --with-libpcap-libraries=DIR libpcap library directory], 338 [with_libpcap_libraries="$withval"],[with_libpcap_libraries="no"]) 339 340 341if test "x$with_libpcap_includes" != "xno"; then 342 CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}" 343fi 344 345if test "x$with_libpcap_libraries" != "xno"; then 346 LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}" 347fi 348 349# --with-libpfring-* options 350AC_ARG_WITH(libpfring_includes, 351 [ --with-libpfring-includes=DIR libpfring include directory], 352 [with_libpfring_includes="$withval"],[with_libpfring_includes="no"]) 353 354AC_ARG_WITH(libpfring_libraries, 355 [ --with-libpfring-libraries=DIR libpfring library directory], 356 [with_libpfring_libraries="$withval"],[with_libpfring_libraries="no"]) 357 358if test "x$with_libpfring_includes" != "xno"; then 359 CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}" 360fi 361 362if test "x$with_libpfring_libraries" != "xno"; then 363 LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}" 364fi 365 366AC_ARG_WITH(daq_includes, 367 [ --with-daq-includes=DIR DAQ include directory], 368 [with_daq_includes="$withval"],[with_daq_includes="no"]) 369 370AC_ARG_WITH(daq_libraries, 371 [ --with-daq-libraries=DIR DAQ library directory], 372 [with_daq_libraries="$withval"],[with_daq_libraries="no"]) 373 374if test "x$with_daq_includes" != "xno"; then 375 CPPFLAGS="${CPPFLAGS} -I${with_daq_includes}" 376fi 377 378if test "x$with_daq_libraries" != "xno"; then 379 LDFLAGS="${LDFLAGS} -L${with_daq_libraries}" 380fi 381 382if test "x$enable_control_socket" = "xyes"; then 383 LSFBPF="" 384 AC_CHECK_LIB([sfbpf], [sfbpf_compile], 385 [LIBS="${LIBS} -lsfbpf"], [LSFBPF="no"], [ ]) 386 387 if test "x$LSFBPF" = "xno"; then 388 echo 389 echo " ERROR! sfbpf library not found, go get it from" 390 echo " http://www.snort.org/." 391 #AC_MSG_ERROR("Fatal!") 392 exit 1 393 fi 394fi 395 396LPCAP="" 397AC_CHECK_LIB(pcap, pcap_datalink,, LPCAP="no") 398 399# If the normal AC_CHECK_LIB for pcap fails then check to see if we are 400# using a pfring-enabled pcap. 401if test "x$LPCAP" = "xno"; then 402 PFRING_H="" 403 AC_CHECK_HEADERS(pfring.h,, PFRING_H="no") 404 405# It is important to have the AC_CHECK_LIB for the pfring library BEFORE 406# the one for pfring-enabled pcap. When the Makefile is created, all the 407# libraries used during linking are added to the LIBS variable in the 408# Makefile in the opposite order that their AC_CHECK_LIB macros appear 409# in configure.in. Durring linking, the pfring library (-lpfring) MUST come 410# _after_ the libpcap library (-lpcap) or linking will fail. 411 PFRING_L="" 412 AC_CHECK_LIB(pfring, pfring_open,, PFRING_L="no") 413 414 LPFRING_PCAP="" 415 AC_CHECK_LIB(pcap, pfring_open,, LPFRING_PCAP="no",-lpfring) 416fi 417 418# If both the AC_CHECK_LIB for normal pcap and pfring-enabled pcap fail then exit. 419if test "x$LPCAP" = "xno"; then 420 if test "x$LPFRING_PCAP" = "xno"; then 421 echo 422 echo " ERROR! Libpcap library/headers (libpcap.a (or .so)/pcap.h)" 423 echo " not found, go get it from http://www.tcpdump.org" 424 echo " or use the --with-libpcap-* options, if you have it installed" 425 echo " in unusual place. Also check if your libpcap depends on another" 426 echo " shared library that may be installed in an unusual place" 427 exit 1 428 fi 429fi 430 431AC_MSG_CHECKING([for pcap_lex_destroy]) 432AC_RUN_IFELSE( 433[AC_LANG_PROGRAM( 434[[ 435#include <pcap.h> 436]], 437[[ 438 pcap_lex_destroy(); 439]])], 440[have_pcap_lex_destroy="yes"], 441[have_pcap_lex_destroy="no"]) 442AC_MSG_RESULT($have_pcap_lex_destroy) 443if test "x$have_pcap_lex_destroy" = "xyes"; then 444 AC_DEFINE([HAVE_PCAP_LEX_DESTROY],[1],[Can cleanup lex buffer stack created by pcap bpf filter]) 445fi 446 447AC_MSG_CHECKING([for pcap_lib_version]) 448AC_LINK_IFELSE( 449 [AC_LANG_PROGRAM( 450 [[#include <pcap.h>]], 451 [[pcap_lib_version();]] 452 )], 453 [have_pcap_lib_version="yes"], 454 [have_pcap_lib_version="no"] 455) 456AC_MSG_RESULT($have_pcap_lib_version) 457 458if test "x$have_pcap_lib_version" = "xyes"; then 459 AC_DEFINE([HAVE_PCAP_LIB_VERSION],[1], 460 [Can output the library version.]) 461fi 462 463AC_DEFUN([FAIL_MESSAGE],[ 464 echo 465 echo 466 echo "**********************************************" 467 echo " ERROR: unable to find" $1 468 echo " checked in the following places" 469 for i in `echo $2`; do 470 echo " $i" 471 done 472 echo "**********************************************" 473 echo 474 exit 1 475]) 476 477AC_ARG_WITH(libpcre_includes, 478 [ --with-libpcre-includes=DIR libpcre include directory], 479 [with_libpcre_includes="$withval"],[with_libpcre_includes="no"]) 480 481AC_ARG_WITH(libpcre_libraries, 482 [ --with-libpcre-libraries=DIR libpcre library directory], 483 [with_libpcre_libraries="$withval"],[with_libpcre_libraries="no"]) 484 485if test "x$with_libpcre_includes" != "xno"; then 486 CPPFLAGS="${CPPFLAGS} -I${with_libpcre_includes}" 487 ICONFIGFLAGS="${ICONFIGFLAGS} -I${with_libpcre_includes}" 488else 489 CPPFLAGS="${CPPFLAGS} `pcre-config --cflags`" 490fi 491 492if test "x$with_libpcre_libraries" != "xno"; then 493 LDFLAGS="${LDFLAGS} -L${with_libpcre_libraries}" 494else 495 LDFLAGS="${LDFLAGS} `pcre-config --libs`" 496fi 497 498# PCRE configuration (required) 499# Verify that we have the headers 500PCRE_H="" 501AC_CHECK_HEADERS(pcre.h,, PCRE_H="no") 502if test "x$PCRE_H" = "xno"; then 503 echo 504 echo " ERROR! Libpcre header not found." 505 echo " Get it from http://www.pcre.org" 506 exit 1 507fi 508 509# Verify that we have the library 510PCRE_L="" 511pcre_version_six="" 512AC_CHECK_LIB(pcre, pcre_compile, ,PCRE_L="no") 513if test "x$PCRE_L" = "xno"; then 514 echo 515 echo " ERROR! Libpcre library not found." 516 echo " Get it from http://www.pcre.org" 517 echo 518 exit 1 519else 520 AC_MSG_CHECKING(for libpcre version 6.0 or greater) 521 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pcre.h>]], [[ 522 #if (PCRE_MAJOR < 6) 523 #error "Version failure" 524 #else 525 int a, b = 0, c = 0, d = 0; 526 pcre *tmp = NULL; 527 a = pcre_copy_named_substring(tmp, "", &b, c, "", "", d); 528 #endif 529 ]])],[pcre_version_six="yes"],[pcre_version_six="no"]) 530fi 531 532if test "x$pcre_version_six" != "xyes"; then 533 AC_MSG_RESULT(no) 534 echo 535 echo " ERROR! Libpcre library version >= 6.0 not found." 536 echo " Get it from http://www.pcre.org" 537 echo 538 exit 1 539else 540 AC_MSG_RESULT(yes) 541fi 542 543# OPENSSL SHA configuration (optional) 544AC_ARG_WITH(openssl_includes, 545 [ --with-openssl-includes=DIR openssl include directory], 546 [with_openssl_includes="$withval"],[with_openssl_includes="no"]) 547 548AC_ARG_WITH(openssl_libraries, 549 [ --with-openssl-libraries=DIR openssl library directory], 550 [with_openssl_libraries="$withval"],[with_openssl_libraries="no"]) 551 552if test "x$with_openssl_includes" != "xno"; then 553 CPPFLAGS="${CPPFLAGS} -I${with_openssl_includes}" 554 ICONFIGFLAGS="${ICONFIGFLAGS} -I${with_openssl_includes}" 555fi 556 557if test "x$with_openssl_libraries" != "xno"; then 558 LDFLAGS="${LDFLAGS} -L${with_openssl_libraries}" 559fi 560# Verify that we have the headers 561AC_CHECK_LIB([crypto],[SHA256_Init],AC_DEFINE([HAVE_OPENSSL_SHA],[1],openssl SHA available),) 562AC_CHECK_LIB([crypto],[MD5_Init],AC_DEFINE([HAVE_OPENSSL_MD5],[1],openssl MD5 available),) 563AM_CONDITIONAL([BUILD_OPENSSL_MD5], test "$ac_cv_lib_crypto_MD5_Init" != "yes" ) 564AM_CONDITIONAL([BUILD_OPENSSL_SHA], test "$ac_cv_lib_crypto_SHA256_Init" != "yes" ) 565if test "$ac_cv_lib_crypto_MD5_Init" = "yes"; then 566 LIBS="${LIBS} -lcrypto" 567fi 568 569AC_ARG_VAR(SIGNAL_SNORT_RELOAD, set the SIGNAL_SNORT_RELOAD value) 570if test "x$SIGNAL_SNORT_RELOAD" != "x" ; then 571 AC_DEFINE_UNQUOTED([SIGNAL_SNORT_RELOAD], [$SIGNAL_SNORT_RELOAD], [Set by user]) 572fi 573 574AC_ARG_VAR(SIGNAL_SNORT_DUMP_STATS, set the SIGNAL_SNORT_DUMP_STATS value) 575if test "x$SIGNAL_SNORT_DUMP_STATS" != "x" ; then 576 AC_DEFINE_UNQUOTED([SIGNAL_SNORT_DUMP_STATS], [$SIGNAL_SNORT_DUMP_STATS], [Set by user]) 577fi 578 579AC_ARG_VAR(SIGNAL_SNORT_ROTATE_STATS, set the SIGNAL_SNORT_ROTATE_STATS value) 580if test "x$SIGNAL_SNORT_ROTATE_STATS" != "x" ; then 581 AC_DEFINE_UNQUOTED([SIGNAL_SNORT_ROTATE_STATS], [$SIGNAL_SNORT_ROTATE_STATS], [Set by user]) 582fi 583 584AC_ARG_VAR(SIGNAL_SNORT_READ_ATTR_TBL, set the SIGNAL_SNORT_READ_ATTR_TBL value) 585if test "x$SIGNAL_SNORT_READ_ATTR_TBL" != "x" ; then 586 AC_DEFINE_UNQUOTED([SIGNAL_SNORT_READ_ATTR_TBL], [$SIGNAL_SNORT_READ_ATTR_TBL], [Set by user]) 587fi 588 589AC_ARG_ENABLE(so_with_static_lib, 590[ --enable-so-with-static-lib Enable linking of dynamically loaded preprocessors with a static preprocessor library], 591 enable_so_with_static_lib="$enableval", enable_so_with_static_lib=$so_with_static_lib) 592AM_CONDITIONAL(SO_WITH_STATIC_LIB, test "x$enable_so_with_static_lib" = "xyes") 593 594AC_ARG_ENABLE(control_socket, 595[ --enable-control-socket Enable the control socket], 596 enable_control_socket="$enableval", enable_control_socket="no") 597os=`(uname -s)` 598if test "x$linux" != "xyes"; then 599 if test "$OSTYPE" != "FreeBSD" && "$os" != "FreeBSD"; then 600 if test "x$enable_control_socket" = "xyes"; then 601 AC_MSG_WARN([[The control socket is only supported on Linux or FreeBSD systems.]]) 602 enable_control_socket="no" 603 fi 604 fi 605fi 606AM_CONDITIONAL(BUILD_CONTROL_SOCKET, test "x$enable_control_socket" = "xyes") 607if test "x$enable_control_socket" = "xyes"; then 608 CONFIGFLAGS="$CONFIGFLAGS -DCONTROL_SOCKET" 609fi 610 611AC_ARG_ENABLE(side_channel, 612[ --enable-side-channel Enable the side channel (Experimental)], 613 enable_side_channel="$enableval", enable_side_channel="no") 614if test "x$linux" != "xyes"; then 615 if test "$OSTYPE" != "FreeBSD" && "$os" != "FreeBSD"; then 616 if test "x$enable_side_channel" = "xyes"; then 617 AC_MSG_WARN([[The side channel is only supported on Linux or FreeBSD systems.]]) 618 enable_side_channel="no" 619 fi 620 fi 621fi 622AM_CONDITIONAL(BUILD_SIDE_CHANNEL, test "x$enable_side_channel" = "xyes") 623if test "x$enable_side_channel" = "xyes"; then 624 CONFIGFLAGS="$CONFIGFLAGS -DSIDE_CHANNEL" 625fi 626 627# check for dnet first since some DAQs need it 628AC_ARG_WITH(dnet_includes, 629 [ --with-dnet-includes=DIR libdnet include directory], 630 [with_dnet_includes="$withval"],[with_dnet_includes="no"]) 631 632AC_ARG_WITH(dnet_libraries, 633 [ --with-dnet-libraries=DIR libdnet library directory], 634 [with_dnet_libraries="$withval"],[with_dnet_libraries="no"]) 635 636if test "x$with_dnet_includes" != "xno"; then 637 CPPFLAGS="${CPPFLAGS} -I${with_dnet_includes}" 638 ICONFIGFLAGS="${ICONFIGFLAGS} -I${with_dnet_includes}" 639else 640 CPPFLAGS="${CPPFLAGS} `dnet-config --cflags 2>/dev/null`" 641fi 642 643if test "x$with_dnet_libraries" != "xno"; then 644 LDFLAGS="${LDFLAGS} -L${with_dnet_libraries}" 645else 646 LDFLAGS="${LDFLAGS} `dnet-config --libs 2>/dev/null`" 647fi 648 649AC_CHECK_HEADERS(dnet.h,,DNET_H="no") 650AC_CHECK_HEADERS(dumbnet.h,,DUMBNET_H="no") 651 652if test "x$DNET_H" = "xno" -a "x$DUMBNET_H" = "xno"; then 653 echo 654 echo " ERROR! dnet header not found, go get it from" 655 echo " http://code.google.com/p/libdnet/ or use the --with-dnet-*" 656 echo " options, if you have it installed in an unusual place" 657 exit 658fi 659 660AC_CHECK_LIB(dnet, eth_set,,[DNET="no"]) 661AC_CHECK_LIB(dumbnet, eth_set,,[DUMBNET="no"]) 662 663if test "x$DNET" = "xno" -a "x$DUMBNET" = "xno"; then 664 echo 665 echo " ERROR! dnet library not found, go get it from" 666 echo " http://code.google.com/p/libdnet/ or use the --with-dnet-*" 667 echo " options, if you have it installed in an unusual place" 668 exit 669fi 670 671AC_ARG_ENABLE(static_daq, 672[ --disable-static-daq Link static DAQ modules.], 673 enable_static_daq="$enableval", enable_static_daq="yes") 674 675AC_CHECK_LIB(dl, dlsym, DLLIB="yes", DLLIB="no") 676 677if test "$DLLIB" != "no"; then 678 LIBS="${LIBS} -ldl" 679else 680 AC_CHECK_LIB(c, dlsym, DLLIB="yes", DLLIB="no") 681 if test "$DLLIB" = "no"; then 682 echo 683 echo " ERROR! programmatic interface to dynamic link loader" 684 echo " not found. Cannot build Snort." 685 echo 686 exit 1 687 fi 688fi 689 690if test "x$enable_static_daq" = "xyes"; then 691 LDAQ="" 692 LIBS="${LIBS} `daq-modules-config --static --libs`" 693 AC_CHECK_LIB([daq_static], [daq_load_modules], 694 [LIBS="-ldaq_static ${LIBS}"], [LDAQ="no"], [ ]) 695 696 if test "x$LDAQ" = "xno"; then 697 echo 698 echo " ERROR! daq_static library not found, go get it from" 699 echo " http://www.snort.org/." 700 #AC_MSG_ERROR("Fatal!") # FIXTHIS switch over to this macro 701 exit 1 # instead of raw exits! 702 fi 703else 704 LDAQ="" 705 AC_CHECK_LIB([daq], [daq_load_modules], 706 [LIBS="${LIBS} -ldaq"], [LDAQ="no"], [ ]) 707 708 if test "x$LDAQ" = "xno"; then 709 echo 710 echo " ERROR! daq library not found, go get it from" 711 echo " http://www.snort.org/." 712 #AC_MSG_ERROR("Fatal!") 713 exit 1 714 fi 715fi 716 717AC_CHECK_FUNCS([daq_hup_apply] [daq_acquire_with_meta] [daq_dp_add_dc]) 718 719AC_MSG_CHECKING([for daq real addresses]) 720AC_RUN_IFELSE( 721[AC_LANG_PROGRAM( 722[[ 723#include <daq.h> 724]], 725[[ 726 DAQ_PktHdr_t hdr; 727 hdr.n_real_dPort = 0; 728]])], 729[have_daq_real_addresses="yes"], 730[have_daq_real_addresses="no"]) 731AC_MSG_RESULT($have_daq_real_addresses) 732if test "x$have_daq_real_addresses" = "xyes"; then 733 AC_DEFINE([HAVE_DAQ_REAL_ADDRESSES],[1], 734 [DAQ version supports real addresses in header.]) 735fi 736 737AC_CHECK_DECL([DAQ_PKT_FLAG_DECRYPTED_SSL], [have_daq_decrypted_ssl="yes"], 738[have_daq_decrypted_ssl="no"], [#include <daq_common.h>]) 739if test "x$have_daq_decrypted_ssl" = "xyes"; then 740 AC_DEFINE([HAVE_DAQ_DECRYPTED_SSL],[1], 741 [DAQ version supports decrypted ssl]) 742fi 743 744AC_CHECK_DECL([DAQ_PKT_FLAG_LOCALLY_ORIGINATED], 745[have_daq_locally_originated="yes"], 746[have_daq_locally_originated="no"], [#include <daq_common.h>]) 747if test "x$have_daq_locally_originated" = "xyes"; then 748 AC_DEFINE([HAVE_DAQ_LOCALLY_ORIGINATED],[1], 749 [DAQ version defines flags for locally originated traffic]) 750fi 751 752AC_CHECK_DECL([DAQ_PKT_FLAG_LOCALLY_DESTINED], 753[have_daq_locally_destined="yes"], 754[have_daq_locally_destined="no"], [#include <daq_common.h>]) 755if test "x$have_daq_locally_destined" = "xyes"; then 756 AC_DEFINE([HAVE_DAQ_LOCALLY_DESTINED],[1], 757 [DAQ version defines flags for locally destined traffic]) 758fi 759 760if test "x$ac_cv_func_daq_dp_add_dc" = "xyes"; then 761 762 AC_CHECK_MEMBER([struct _DAQ_DP_key_t.sa.src_ip4],[],[DAQ_C99_STRUCT="no"],[#include <daq_common.h>]) 763 764 if test "x$DAQ_C99_STRUCT" = "xno" ; then 765 echo 766 echo " ERROR! daq library missing C99 patch, upgrade to >=2.0.4, go get it from" 767 echo " http://www.snort.org/." 768 exit 1 769 fi 770 771fi 772 773AC_MSG_CHECKING([for daq address space ID]) 774AC_RUN_IFELSE( 775[AC_LANG_PROGRAM( 776[[ 777#include <daq.h> 778]], 779[[ 780 DAQ_PktHdr_t hdr; 781 hdr.address_space_id = 0; 782]])], 783[have_daq_address_space_id="yes"], 784[have_daq_address_space_id="no"]) 785AC_MSG_RESULT($have_daq_address_space_id) 786if test "x$have_daq_address_space_id" = "xyes"; then 787 AC_DEFINE([HAVE_DAQ_ADDRESS_SPACE_ID],[1], 788 [DAQ version supports address space ID in header.]) 789fi 790 791AC_MSG_CHECKING([for daq flow ID]) 792AC_RUN_IFELSE( 793[AC_LANG_PROGRAM( 794[[ 795#include <daq.h> 796]], 797[[ 798 DAQ_PktHdr_t hdr; 799 hdr.flow_id = 0; 800]])], 801[have_daq_flow_id="yes"], 802[have_daq_flow_id="no"]) 803AC_MSG_RESULT($have_daq_flow_id) 804if test "x$have_daq_flow_id" = "xyes"; then 805 AC_DEFINE([HAVE_DAQ_FLOW_ID],[1], 806 [DAQ version supports flow ID in header.]) 807fi 808 809AC_MSG_CHECKING([for daq extended flow modifiers]) 810AC_RUN_IFELSE( 811[AC_LANG_PROGRAM( 812[[ 813#include <daq.h> 814]], 815[[ 816 DAQ_ModFlow_t mod; 817 mod.type = 0; 818 mod.length = 0; 819 mod.value = NULL; 820]])], 821[have_daq_ext_modflow="yes"], 822[have_daq_ext_modflow="no"]) 823AC_MSG_RESULT($have_daq_ext_modflow) 824if test "x$have_daq_ext_modflow" = "xyes"; then 825 CCONFIGFLAGS="${CCONFIGFLAGS} -DHAVE_DAQ_EXT_MODFLOW" 826 AC_DEFINE([HAVE_DAQ_EXT_MODFLOW],[1], 827 [DAQ version supports extended flow modifiers.]) 828fi 829 830AC_MSG_CHECKING([for daq query flow]) 831AC_RUN_IFELSE( 832[AC_LANG_PROGRAM( 833[[ 834#include <daq.h> 835]], 836[[ 837 DAQ_QueryFlow_t mod; 838 mod.type = 0; 839 mod.length = 0; 840 mod.value = NULL; 841]])], 842[have_daq_queryflow="yes"], 843[have_daq_queryflow="no"]) 844AC_MSG_RESULT($have_daq_queryflow) 845if test "x$have_daq_queryflow" = "xyes"; then 846 CCONFIGFLAGS="${CCONFIGFLAGS} -DHAVE_DAQ_QUERYFLOW" 847 AC_DEFINE([HAVE_DAQ_QUERYFLOW],[1], 848 [DAQ version supports query flow.]) 849fi 850 851AC_MSG_CHECKING([for daq data channel flags]) 852AC_RUN_IFELSE( 853[AC_LANG_PROGRAM( 854[[ 855#include <daq.h> 856]], 857[[ 858 DAQ_Data_Channel_Params_t params; 859]])], 860[have_daq_data_channel_flags="yes"], 861[have_daq_data_channel_flags="no"]) 862AC_MSG_RESULT($have_daq_data_channel_flags) 863if test "x$have_daq_data_channel_flags" = "xyes"; then 864 CCONFIGFLAGS="${CCONFIGFLAGS} -DHAVE_DAQ_DATA_CHANNEL_PARAMS" 865 AC_DEFINE([HAVE_DAQ_DATA_CHANNEL_PARAMS],[1], 866 [DAQ version supports data channel.]) 867fi 868 869AC_MSG_CHECKING([for separate IP versions on pinhole endpoints]) 870AC_RUN_IFELSE( 871[AC_LANG_PROGRAM( 872[[ 873#include <daq.h> 874]], 875[[ 876 DAQ_DP_key_t dpKey; 877 dpKey.src_af = 0; 878]])], 879[have_daq_data_channel_separate_ip_versions="yes"], 880[have_daq_data_channel_separate_ip_versions="no"]) 881AC_MSG_RESULT($have_daq_data_channel_separate_ip_versions) 882if test "x$have_daq_data_channel_separate_ip_versions" = "xyes"; then 883 CCONFIGFLAGS="${CCONFIGFLAGS} -DHAVE_DAQ_DATA_CHANNEL_SEPARATE_IP_VERSIONS" 884 AC_DEFINE([HAVE_DAQ_DATA_CHANNEL_SEPARATE_IP_VERSIONS],[1], 885 [DAQ version supports separate IP versions on pinhole endpoints.]) 886fi 887 888AC_MSG_CHECKING([for DAQ_VERDICT_RETRY]) 889AC_RUN_IFELSE( 890[AC_LANG_PROGRAM( 891[[ 892#include <daq.h> 893]], 894[[ 895 DAQ_Verdict verdict; 896 verdict = DAQ_VERDICT_RETRY; 897]])], 898[have_daq_verdict_retry="yes"], 899[have_daq_verdict_retry="no"]) 900AC_MSG_RESULT($have_daq_verdict_retry) 901if test "x$have_daq_verdict_retry" = "xyes"; then 902 AC_DEFINE([HAVE_DAQ_VERDICT_RETRY],[1], 903 [DAQ version supports DAQ_VERDICT_RETRY in DAQ_Verdict.]) 904fi 905 906AC_MSG_CHECKING([for daq packet trace]) 907AC_RUN_IFELSE( 908[AC_LANG_PROGRAM( 909[[ 910#include <daq.h> 911]], 912[[ 913 DAQ_PktHdr_t hdr; 914 hdr.flags = DAQ_PKT_FLAG_TRACE_ENABLED; 915]])], 916[have_daq_packet_trace="yes"], 917[have_daq_packet_trace="no"]) 918AC_MSG_RESULT($have_daq_packet_trace) 919if test "x$have_daq_packet_trace" = "xyes"; then 920 AC_DEFINE([HAVE_DAQ_PKT_TRACE],[1], 921 [DAQ version supports packet trace.]) 922else 923 echo "DAQ version doesn't support packet trace." 924fi 925 926AC_MSG_CHECKING([for daq verdict reason]) 927AC_RUN_IFELSE( 928[AC_LANG_PROGRAM( 929[[ 930#include <daq.h> 931]], 932[[ 933 DAQ_ModFlow_t fl; 934 fl.type = DAQ_MODFLOW_TYPE_VER_REASON; 935]])], 936[have_daq_verdict_reason="yes"], 937[have_daq_verdict_reason="no"]) 938AC_MSG_RESULT($have_daq_verdict_reason) 939if test "x$have_daq_verdict_reason" = "xyes"; then 940 AC_DEFINE([HAVE_DAQ_VERDICT_REASON],[1], 941 [DAQ version supports tracing verdict reason.]) 942else 943 echo "DAQ version doesn't support tracing verdict reason." 944fi 945 946# any sparc platform has to have this one defined. 947AC_MSG_CHECKING(for sparc) 948if eval "echo $host_cpu|grep -i sparc >/dev/null"; then 949 AC_DEFINE([WORDS_MUSTALIGN],[1],[Define if words must align]) 950 AC_MSG_RESULT(yes) 951 952 # gcc, sparc and optimization not so good 953 if test -n "$GCC"; then 954 NO_OPTIMIZE="yes" 955 fi 956else 957 AC_MSG_RESULT(no) 958fi 959 960# check for sparc %time register 961if eval "echo $host_cpu|grep -i sparc >/dev/null"; then 962 OLD_CFLAGS="$CFLAGS" 963 CFLAGS="$CFLAGS -mcpu=v9 " 964 AC_MSG_CHECKING([for sparc %time register]) 965 AC_RUN_IFELSE( 966 [AC_LANG_PROGRAM( 967 [[]], 968 [[ 969 int val; 970 __asm__ __volatile__("rd %%tick, %0" : "=r"(val)); 971 ]])], 972 [sparcv9="yes"], 973 [sparcv9="no"]) 974 AC_MSG_RESULT($sparcv9) 975 if test "x$sparcv9" = "xyes"; then 976 AC_DEFINE([SPARCV9],[1],[For sparc v9 with %time register]) 977 else 978 CFLAGS="$OLD_CFLAGS" 979 fi 980fi 981 982# modified from gnulib/m4/visibility.m4 983AC_DEFUN([CC_VISIBILITY], 984[ 985 AC_REQUIRE([AC_PROG_CC]) 986 AC_MSG_CHECKING([for visibility support]) 987 AC_CACHE_VAL(gl_cv_cc_visibility, [ 988 gl_save_CFLAGS="$CFLAGS" 989 # Add -Werror flag since some compilers, e.g. icc 7.1, don't support it, 990 # but only warn about it instead of compilation failing 991 CFLAGS="$CFLAGS -Werror -fvisibility=hidden" 992 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 993 extern __attribute__((__visibility__("hidden"))) int hiddenvar; 994 extern __attribute__((__visibility__("default"))) int exportedvar; 995 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); 996 extern __attribute__((__visibility__("default"))) int exportedfunc (void);]], 997 [[]])], 998 [gl_cv_cc_visibility="yes"], 999 [gl_cv_cc_visibility="no"]) 1000 ]) 1001 AC_MSG_RESULT([$gl_cv_cc_visibility]) 1002 CFLAGS="$gl_save_CFLAGS" 1003 if test "x$gl_cv_cc_visibility" = "xyes"; then 1004 CFLAGS="${CFLAGS} -DSF_VISIBILITY -fvisibility=hidden" 1005 AC_DEFINE([HAVE_VISIBILITY],[1], 1006 [Define if the compiler supports visibility declarations.]) 1007 fi 1008]) 1009CC_VISIBILITY() 1010 1011AC_ARG_ENABLE(build-dynamic-examples, 1012[ --enable-build-dynamic-examples Enable building of example dynamically loaded preprocessor and rule (off by default)], 1013 build_dynamic_examples="$enableval", build_dynamic_examples="no") 1014AM_CONDITIONAL(BUILD_DYNAMIC_EXAMPLES, test "x$build_dynamic_examples" = "xyes") 1015 1016AC_ARG_ENABLE(dlclose, 1017[ --disable-dlclose Only use if you are developing dynamic preprocessors or shared object rules. Disable (--disable-dlclose) for testing valgrind leaks in dynamic libraries so a usable backtrace is reported. Enabled by default.], 1018 enable_dlclose="$enableval", enable_dlclose="yes") 1019if test "x$enable_dlclose" = "xno"; then 1020 AC_DEFINE([DISABLE_DLCLOSE_FOR_VALGRIND_TESTING],[1],[Don't close opened shared objects for valgrind leak testing of dynamic libraries]) 1021fi 1022 1023################################################## 1024# Fedora 28+ does not have inbuilt SunRPC support# 1025# in glibc and is separately availble in tirpc # 1026# package. Make sure we've got the library and # 1027# link it # 1028################################################## 1029 1030if test -f /etc/fedora-release ; then 1031 DISTRO_VERSION=$(awk '{ print $3 }' /etc/fedora-release) 1032 if test $DISTRO_VERSION -ge 28 ; then 1033 TIRPC="" 1034 AC_CHECK_LIB(tirpc,bindresvport,, TIRPC="no") 1035 echo "$TIRPC" 1036 if test "x$TIRPC" = "xno"; then 1037 echo 1038 echo " ERROR! tirpc not found, get it by running " 1039 echo " yum install libtirpc-devel " 1040 exit 1041 fi 1042 LIBS="${LIBS} -ltirpc" 1043 extra_incl="-I/usr/include/tirpc" 1044 fi 1045fi 1046 1047################################################## 1048# Centos 8+ does not have inbuilt SunRPC support # 1049# in glibc and is separately availble in tirpc # 1050# package. Make sure we've got the library and # 1051# link it # 1052################################################## 1053if test -f /etc/centos-release ; then 1054 LINUX_FLAVOUR=$(awk '{ print $1 }' /etc/centos-release) 1055 DISTRO_VERSION=`cut -d ' ' -f 4 /etc/centos-release | cut -d '.' -f 1` 1056 if [[ "$LINUX_FLAVOUR" == "CentOS" ]] && [[ $DISTRO_VERSION -ge 8 ]]; then 1057 TIRPC="" 1058 AC_CHECK_LIB(tirpc,bindresvport,, TIRPC="no") 1059 echo "$TIRPC" 1060 if test "x$TIRPC" = "xno"; then 1061 echo 1062 echo " ERROR! tirpc not found, get it by running " 1063 echo " yum install libtirpc-devel or dnf install libtirpc-devel" 1064 exit 1065 fi 1066 LIBS="${LIBS} -ltirpc" 1067 extra_incl="-I/usr/include/tirpc" 1068 fi 1069fi 1070 1071Z_LIB="" 1072AC_CHECK_HEADERS(zlib.h,, Z_LIB="no") 1073if test "x$Z_LIB" = "xno"; then 1074 echo 1075 echo " ERROR! zlib header not found, go get it from" 1076 echo " http://www.zlib.net" 1077 exit 1078fi 1079 1080Z_LIB="" 1081AC_CHECK_LIB(z, inflate,, Z_LIB="no") 1082if test "x$Z_LIB" = "xno"; then 1083 echo 1084 echo " ERROR! zlib library not found, go get it from" 1085 echo " http://www.zlib.net" 1086 exit 1087 fi 1088LIBS="$LIBS -lz" 1089 1090AC_ARG_ENABLE(lzma, 1091[ --disable-lzma Disable LZMA Decompression], 1092 enable_lzma="$enableval", enable_lzma="yes") 1093 1094AC_ARG_WITH(lzma_includes, 1095 [ --with-lzma-includes=DIR liblzma include directory], 1096 [with_lzma_includes="$withval"],[with_lzma_includes="no"]) 1097 1098AC_ARG_WITH(lzma_libraries, 1099 [ --with-lzma-libraries=DIR liblzma library directory], 1100 [with_lzma_libraries="$withval"],[with_lzma_libraries="no"]) 1101 1102AM_CONDITIONAL(HAVE_LZMA, test "x$enable_lzma" = "xyes") 1103if test "x$enable_lzma" = "xyes"; then 1104 1105 if test "x$with_lzma_includes" != "xno"; then 1106 CPPFLAGS="${CPPFLAGS} -I${with_lzma_includes}" 1107 LZMA_HEADERS="yes" 1108 else 1109 AC_CHECK_HEADERS(lzma.h, LZMA_HEADERS="yes", LZMA_HEADERS="no") 1110 fi 1111 1112 if test "x$with_lzma_libraries" != "xno"; then 1113 LDFLAGS="${LDFLAGS} -L${with_lzma_libraries}" 1114 LZMA_LIB="yes" 1115 else 1116 AC_CHECK_LIB(lzma, lzma_stream_decoder, LZMA_LIB="yes", LZMA_LIB="no") 1117 fi 1118 1119 if test "x$LZMA_LIB" != "xno"; then 1120 if test "x$LZMA_HEADERS" != "xno"; then 1121 CPPFLAGS="$CPPFLAGS -DLZMA" 1122 LIBS="$LIBS -llzma" 1123 fi 1124 fi 1125fi 1126 1127AC_ARG_ENABLE(gre, 1128[ --disable-gre Disable GRE and IP in IP encapsulation support], 1129 enable_gre="$enableval", enable_gre="yes") 1130if test "x$enable_gre" = "xyes"; then 1131 CPPFLAGS="$CPPFLAGS -DGRE" 1132fi 1133 1134AC_ARG_ENABLE(mpls, 1135[ --disable-mpls Disable MPLS support], 1136 enable_mpls="$enableval", enable_mpls="yes") 1137if test "x$enable_mpls" = "xyes"; then 1138 CPPFLAGS="$CPPFLAGS -DMPLS" 1139fi 1140 1141AC_ARG_ENABLE(targetbased, 1142[ --disable-targetbased Disable Target-Based Support in Stream, Frag, and Rules (adds pthread support implicitly)], 1143 enable_targetbased="$enableval", enable_targetbased="yes") 1144 1145AM_CONDITIONAL(HAVE_TARGET_BASED, test "x$enable_targetbased" = "xyes") 1146if test "x$enable_targetbased" = "xyes"; then 1147 CONFIGFLAGS="$CONFIGFLAGS -DTARGET_BASED" 1148 LIBS="$LIBS -lpthread" 1149 if test "$LEX" = "none"; then 1150 echo 1151 echo " ERROR! flex not found." 1152 echo " Get it from http://flex.sourceforge.net/" 1153 echo " (You may also try lex instead.)" 1154 echo 1155 exit 1 1156 fi 1157 if test "$YACC" = "none"; then 1158 echo 1159 echo " ERROR! bison not found." 1160 echo " Get it from http://www.gnu.org/software/bison/" 1161 echo " (You may also try byacc or yacc instead.)" 1162 echo 1163 exit 1 1164 fi 1165fi 1166 1167AC_ARG_ENABLE(ppm, 1168[ --disable-ppm Disable packet/rule performance monitor], 1169 enable_ppm="$enableval", enable_ppm="yes") 1170if test "x$enable_ppm" = "xyes"; then 1171 CPPFLAGS="$CPPFLAGS -DPPM_MGR" 1172fi 1173 1174AC_ARG_ENABLE(perfprofiling, 1175[ --disable-perfprofiling Disable preprocessor and rule performance profiling], 1176 enable_perfprofiling="$enableval", enable_perfprofiling="yes") 1177if test "x$enable_perfprofiling" = "xyes"; then 1178 CONFIGFLAGS="$CONFIGFLAGS -DPERF_PROFILING" 1179fi 1180 1181AC_ARG_ENABLE(linux-smp-stats, 1182[ --enable-linux-smp-stats Enable statistics reporting through proc], 1183 enable_linux_smp_stats="$enableval", enable_linux_smp_stats="no") 1184AM_CONDITIONAL(BUILD_PROCPIDSTATS, test "x$enable_linux_smp_stats" = "xyes") 1185if test "x$enable_linux_smp_stats" = "xyes"; then 1186 CPPFLAGS="$CPPFLAGS -DLINUX_SMP" 1187fi 1188 1189AC_ARG_ENABLE(inline-init-failopen, 1190[ --enable-inline-init-failopen Enable Fail Open during initialization for Inline Mode (adds pthread support implicitly)], 1191 enable_inline_init_failopen="$enableval", enable_inline_init_failopen="no") 1192if test "x$enable_inline_init_failopen" = "xyes"; then 1193 CPPFLAGS="$CPPFLAGS -DINLINE_FAILOPEN" 1194 LIBS="$LIBS -lpthread" 1195fi 1196 1197AC_ARG_ENABLE(jemalloc, 1198[ --enable-jemalloc Enable jemalloc allocator library], 1199 enable_jemalloc="$enableval", enable_jemalloc="no") 1200 1201AC_ARG_WITH(jemalloc_includes, 1202 [ --with-jemalloc-includes=DIR jemalloc include directory], 1203 [with_jemalloc_includes="$withval"],[with_jemalloc_includes="no"]) 1204 1205AC_ARG_WITH(jemalloc_libraries, 1206 [ --with-jemalloc-libraries=DIR jemalloc library directory], 1207 [with_jemalloc_libraries="$withval"],[with_jemalloc_libraries="no"]) 1208 1209AM_CONDITIONAL(HAVE_JEMALLOC, test "x$enable_jemalloc" = "xyes") 1210if test "x$enable_jemalloc" = "xyes"; then 1211 1212 if test "x$with_jemalloc_includes" != "xno"; then 1213 CPPFLAGS="${CPPFLAGS} -I${with_jemalloc_includes}" 1214 JEMALLOC_HEADERS="yes" 1215 else 1216 AC_CHECK_HEADERS(jemalloc.h, JEMALLOC_HEADERS="yes", JEMALLOC_HEADERS="no") 1217 fi 1218 1219 if test "x$with_jemalloc_libraries" != "xno"; then 1220 LDFLAGS="${LDFLAGS} -L${with_jemalloc_libraries} -Wl,-rpath,'\$\$ORIGIN/libs/jemalloc',-rpath,'\$\$ORIGIN/jemalloc'" 1221 JEMALLOC_LIB="yes" 1222 else 1223 AC_CHECK_LIB(jemalloc, malloc, JEMALLOC_LIB="yes", JEMALLOC_LIB="no") 1224 fi 1225 1226 if test "x$JEMALLOC_LIB" != "xno"; then 1227 if test "x$JEMALLOC_HEADERS" != "xno"; then 1228 CPPFLAGS="$CPPFLAGS -DJEMALLOC" 1229 LIBS="-ljemalloc $LIBS" 1230 fi 1231 fi 1232 1233 if test "x$JEMALLOC_LIB" = "xno"; then 1234 echo 1235 echo " ERROR! jemalloc library not found." 1236 echo " Go get it from http://jemalloc.net/ ." 1>&2; 1237 exit 1; 1238 fi 1239 1240 if test "x$JEMALLOC_HEADERS" = "xno"; then 1241 echo 1242 echo " ERROR! jemalloc header not found." 1243 echo " Go get it from http://jemalloc.net/ ." 1>&2; 1244 exit 1; 1245 fi 1246fi 1247 1248AC_ARG_ENABLE(pthread, 1249[ --disable-pthread Disable pthread support], 1250 enable_pthread="$enableval", enable_pthread="yes") 1251 1252if test "x$enable_pthread" = "xyes"; then 1253 LIBS="$LIBS -lpthread" 1254 AC_CHECK_FUNCS([pthread_tryjoin_np]) 1255fi 1256 1257AC_ARG_ENABLE(debug-msgs, 1258[ --enable-debug-msgs Enable debug printing options (bugreports and developers only)], 1259 enable_debug_msgs="$enableval", enable_debug_msgs="no") 1260if test "x$enable_debug_msgs" = "xyes"; then 1261 CPPFLAGS="$CPPFLAGS -DDEBUG_MSGS" 1262fi 1263 1264AC_ARG_ENABLE(debug, 1265[ --enable-debug Enable debugging options (bugreports and developers only)], 1266 enable_debug="$enableval", enable_debug="no") 1267 1268if test "x$enable_debug" = "xyes"; then 1269 NO_OPTIMIZE="yes" 1270 1271 # in case user override doesn't include -g 1272 if echo $CFLAGS | grep -qve -g ; then 1273 CFLAGS="$CFLAGS -g" 1274 fi 1275 1276 CPPFLAGS="$CPPFLAGS -DDEBUG" 1277else 1278 # disable assert()ions 1279 CPPFLAGS="$CPPFLAGS -DNDEBUG" 1280fi 1281 1282AC_ARG_ENABLE(gdb, 1283[ --enable-gdb Enable gdb debugging information], 1284 enable_gdb="$enableval", enable_gdb="no") 1285 1286if test "x$enable_gdb" = "xyes"; then 1287 CFLAGS="$CFLAGS -g -ggdb" 1288fi 1289 1290AC_ARG_ENABLE(profile, 1291[ --enable-profile Enable profiling options (developers only)], 1292 enable_profile="$enableval", enable_profile="no") 1293 1294if test "x$enable_profile" = "xyes"; then 1295 if test -n "$GCC"; then 1296 CPPFLAGS="$CPPFLAGS -DPROFILE" 1297 CFLAGS="$CFLAGS -pg" 1298 else 1299 CPPFLAGS="$CPPFLAGS -DPROFILE" 1300 fi 1301fi 1302 1303AC_ARG_ENABLE(test-coverage, 1304[ --enable-test-coverage Enable gcov test coverage tracking (developers only)], 1305 enable_test_coverage="$enableval", enable_test_coverage="no") 1306 1307if test "x$enable_test_coverage" = "xyes"; then 1308 CFLAGS=`echo $CFLAGS | sed 's/-O\d/-O0/g'` 1309 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage -O0" 1310fi 1311 1312AC_ARG_ENABLE(ppm-test, 1313[ --disable-ppm-test Disable packet/rule performance monitor], 1314 enable_ppm_test="$enableval", enable_ppm_test="no") 1315 1316if test "x$enable_ppm_test" = "xyes"; then 1317 CPPFLAGS="$CPPFLAGS -DPPM_TEST" 1318fi 1319 1320AC_ARG_ENABLE(sourcefire, 1321[ --enable-sourcefire Enable Sourcefire specific build options, encompasing --enable-perfprofiling and --enable-ppm], 1322 enable_sourcefire="$enableval", enable_sourcefire="no") 1323 1324if test "x$enable_sourcefire" = "xyes"; then 1325 CPPFLAGS="$CPPFLAGS -DSOURCEFIRE -DPPM_MGR" 1326 CONFIGFLAGS="$CONFIGFLAGS -DPERF_PROFILING" 1327fi 1328 1329AC_ARG_ENABLE(corefiles, 1330[ --disable-corefiles Prevent Snort from generating core files], 1331 enable_corefiles="$enableval", enable_corefiles="yes") 1332 1333if test "x$enable_corefiles" = "xno"; then 1334 CPPFLAGS="$CPPFLAGS -DNOCOREFILE" 1335fi 1336 1337 1338AC_ARG_ENABLE(active-response, 1339[ --disable-active-response Disable reject injection], 1340 enable_active_response="$enableval", enable_active_response="yes") 1341 1342AC_ARG_ENABLE(normalizer, 1343[ --disable-normalizer Disable packet/stream normalizations], 1344 enable_normalizer="$enableval", enable_normalizer="yes") 1345 1346AC_ARG_ENABLE(reload, 1347[ --disable-reload Disable reloading a configuration without restarting], 1348 enable_reload="$enableval", enable_reload="yes") 1349 1350AC_ARG_ENABLE(reload-error-restart, 1351[ --disable-reload-error-restart Disable restarting on reload error], 1352 enable_reload_error_restart="$enableval", enable_reload_error_restart="yes") 1353 1354AM_CONDITIONAL(BUILD_SNORT_RELOAD, test "x$enable_reload" = "xyes") 1355if test "x$enable_reload" = "xyes"; then 1356 if test "x$enable_reload_error_restart" = "xyes"; then 1357 CONFIGFLAGS="$CONFIGFLAGS -DSNORT_RELOAD" 1358 else 1359 CONFIGFLAGS="$CONFIGFLAGS -DSNORT_RELOAD -DRELOAD_ERROR_FATAL" 1360 fi 1361 1362 LIBS="$LIBS -lpthread" 1363fi 1364 1365AC_ARG_ENABLE(ha, 1366[ --enable-ha Enable high-availability state sharing (Experimental)], 1367 enable_ha="$enableval", enable_ha="no") 1368 1369AM_CONDITIONAL(BUILD_HA, test "x$enable_ha" = "xyes") 1370if test "x$enable_ha" = "xyes"; then 1371 CONFIGFLAGS="$CONFIGFLAGS -DENABLE_HA" 1372fi 1373 1374AC_ARG_ENABLE(buffer-dump, 1375[ --enable-buffer-dump Enable Buffer dump utility to dump packet buffers], 1376 enable_buffer_dump="$enableval", enable_buffer_dump="no") 1377 1378AM_CONDITIONAL(BUILD_BUFFER_DUMP, test "x$enable_buffer_dump" = "xyes") 1379if test "x$enable_buffer_dump" = "xyes"; then 1380 CONFIGFLAGS="$CONFIGFLAGS -DDUMP_BUFFER" 1381fi 1382 1383 1384# define NO_NON_ETHER_DECODERS by default 1385AC_ARG_ENABLE(non-ether-decoders, 1386[ --enable-non-ether-decoders Enable non Ethernet decoders.], 1387 enable_non_ether_decoders="$enableval", enable_non_ether_decoders="no") 1388 1389if test "x$enable_non_ether_decoders" = "xno"; then 1390 CONFIGFLAGS="$CONFIGFLAGS -DNO_NON_ETHER_DECODER" 1391fi 1392 1393AC_ARG_ENABLE(react, 1394[ --disable-react Disable interception and termination of offending HTTP accesses], 1395 enable_react="$enableval", enable_react="yes") 1396 1397AC_ARG_ENABLE(flexresp3, 1398[ --disable-flexresp3 Disable flexible responses (v3) on hostile connection attempts], 1399 enable_flexresp3="$enableval", enable_flexresp3="yes") 1400 1401# test for invalid configurations here after all AC_ARG_ENABLEs 1402if test "x$enable_flexresp3" = "xyes"; then 1403 # flexresp3 options are a union of flexresp (deleted) and flexresp2 1404 # options so we assume flexresp3 if multiple are enabled. 1405 if test "x$enable_flexresp2" = "xyes"; then 1406 echo "WARNING: multiple flexresp versions enabled; using flexresp3." 1407 enable_flexresp2="no" 1408 fi 1409fi 1410 1411AM_CONDITIONAL(BUILD_REACT, test "x$enable_react" = "xyes") 1412if test "x$enable_react" = "xyes"; then 1413 CPPFLAGS="${CPPFLAGS} -DENABLE_REACT" 1414fi 1415 1416AM_CONDITIONAL(BUILD_RESPOND3, test "x$enable_flexresp3" = "xyes") 1417if test "x$enable_flexresp3" = "xyes"; then 1418 CPPFLAGS="${CPPFLAGS} -DENABLE_RESPOND -DENABLE_RESPONSE3" 1419fi 1420 1421if test "x$enable_normalizer" = "xyes" \ 1422 -o "x$enable_sourcefire" = "xyes" ; \ 1423then 1424 CONFIGFLAGS="${CONFIGFLAGS} -DNORMALIZER" 1425fi 1426 1427if test "x$enable_active_response" = "xyes" \ 1428 -o "x$enable_flexresp3" = "xyes" \ 1429 -o "x$enable_react" = "xyes" \ 1430 -o "x$enable_sourcefire" = "xyes" ; \ 1431then 1432 CONFIGFLAGS="${CONFIGFLAGS} -DACTIVE_RESPONSE" 1433fi 1434 1435AC_ARG_ENABLE(intel_soft_cpm, 1436[ --enable-intel-soft-cpm Enable Intel Soft CPM support], 1437 enable_intel_soft_cpm="$enableval", enable_intel_soft_cpm="no") 1438 1439AC_ARG_WITH(intel_soft_cpm_includes, 1440 [ --with-intel-soft-cpm-includes=DIR Intel Soft CPM include directory], 1441 [with_intel_soft_cpm_includes="$withval"],[with_intel_soft_cpm_includes="no"]) 1442 1443AC_ARG_WITH(intel_soft_cpm_libraries, 1444 [ --with-intel-soft-cpm-libraries=DIR Intel Soft CPM library directory], 1445 [with_intel_soft_cpm_libraries="$withval"],[with_intel_soft_cpm_libraries="no"]) 1446 1447if test "x$with_intel_soft_cpm_includes" != "xno"; then 1448 enable_intel_soft_cpm="yes" 1449fi 1450 1451if test "x$with_intel_soft_cpm_libraries" != "xno"; then 1452 enable_intel_soft_cpm="yes" 1453fi 1454 1455AM_CONDITIONAL(HAVE_INTEL_SOFT_CPM, test "x$enable_intel_soft_cpm" = "xyes") 1456if test "x$enable_intel_soft_cpm" = "xyes"; then 1457 1458 if test "x$with_intel_soft_cpm_includes" != "xno"; then 1459 CPPFLAGS="${CPPFLAGS} -I${with_intel_soft_cpm_includes}" 1460 INTEL_SOFT_CPM_HEADERS="yes" 1461 else 1462 AC_CHECK_HEADERS(cpa.h, INTEL_SOFT_CPM_HEADERS="yes", INTEL_SOFT_CPM_HEADERS="no") 1463 fi 1464 1465 if test "x$with_intel_soft_cpm_libraries" != "xno"; then 1466 LDFLAGS="${LDFLAGS} -L${with_intel_soft_cpm_libraries}" 1467 INTEL_SOFT_CPM_LIB="yes" 1468 else 1469 AC_CHECK_LIB(pm, cpaPmPdbAddPattern, INTEL_SOFT_CPM_LIB="yes", INTEL_SOFT_CPM_LIB="no") 1470 fi 1471 1472 if test "x$INTEL_SOFT_CPM_LIB" != "xno"; then 1473 if test "x$INTEL_SOFT_CPM_HEADERS" != "xno"; then 1474 CPPFLAGS="$CPPFLAGS -DINTEL_SOFT_CPM" 1475 LIBS="$LIBS -lpm" 1476 fi 1477 fi 1478 1479 if test "x$INTEL_SOFT_CPM_HEADERS" = "xno"; then 1480 echo 1481 echo " ERROR! intel-soft-cpm header not found." 1>&2; 1482 exit 1; 1483 fi 1484 1485 if test "x$with_intel_soft_cpm_libraries" = "xno"; then 1486 echo 1487 echo " ERROR! intel-soft-cpm library not found." 1>&2; 1488 exit 1; 1489 fi 1490fi 1491 1492AC_ARG_ENABLE(shared_rep, 1493 [ --enable-shared-rep Enable use of Shared Memory for Reputation (Linux only)], 1494 enable_shared_rep="$enableval", enable_shared_rep="no") 1495 1496if test "x$enable_shared_rep" = "xyes"; then 1497 if test "x$linux" = "xyes"; then 1498 CPPFLAGS="${CPPFLAGS} -DSHARED_REP" 1499 LIBS="$LIBS -lrt" 1500 else 1501 echo "WARNING: shared reputation is only available on linux." 1502 enable_shared_rep="no" 1503 fi 1504fi 1505 1506AM_CONDITIONAL(HAVE_SHARED_REP, test "x$enable_shared_rep" = "xyes") 1507 1508# Define PKG_CHECK_MODULES if it doesnt already exist. 1509#file_ This prevents './configure' from erroring on machines that dont have 1510# 'pkgconfig' installed. 1511#m4_ifdef([PKG_CHECK_MODULES],[], [m4_define([PKG_CHECK_MODULES], 1512# [echo "PKG_CHECK_MODULES not defined"])]) 1513 1514AC_ARG_ENABLE(large-pcap, 1515[ --enable-large-pcap Enable support for pcaps larger than 2 GB], 1516 enable_large_pcap="$enableval", enable_large_pcap="no") 1517 1518if test "x$enable_large_pcap" = "xyes"; then 1519 CPPFLAGS="${CPPFLAGS} -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" 1520fi 1521 1522################################################### 1523## [!] File Type Inspection (Experimental) ## 1524################################################### 1525 1526AC_ARG_ENABLE([file-inspect], 1527 [AS_HELP_STRING([--enable-file-inspect],[Build with extended file inspection features. (Experimental)])], 1528 [enable_file_inspect=$enableval],[enable_file_inspect=no]) 1529 1530AS_IF([test x$enable_file_inspect = xyes], 1531 [AC_DEFINE([FEAT_FILE_INSPECT],[1],[Build with extended file inspection features. (Experimental)]) ]) 1532AM_CONDITIONAL([FEAT_FILE_INSPECT],[test x$enable_file_inspect = xyes]) 1533 1534export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH 1535 1536###### Start OpenAppId 1537AC_ARG_ENABLE([open-appid], 1538 [AS_HELP_STRING([--disable-open-appid],[Disable application identification support.])], 1539 [enable_open_appid="$enableval"],[enable_open_appid="yes"]) 1540 1541AM_CONDITIONAL([FEAT_OPEN_APPID],[test "x$enable_open_appid" = "xyes"]) 1542 1543if test "x$enable_open_appid" = "xyes"; then 1544 AC_DEFINE([FEAT_OPEN_APPID],[1],[Build with application identification support.]) 1545 CONFIGFLAGS="$CONFIGFLAGS -DFEAT_OPEN_APPID" 1546 1547 PKG_CHECK_MODULES(luajit, luajit,LLUAJIT="yes",LLUAJIT="no") 1548 if test "x$LLUAJIT" = "xyes"; then 1549 CONFIGFLAGS="$CONFIGFLAGS -DHAVE_LIBLUAJIT" 1550 LUA_CFLAGS="$luajit_CFLAGS" 1551 LUA_LIBS="$luajit_LIBS" 1552 AC_SUBST(LUA_CFLAGS) 1553 AC_SUBST(LUA_LIBS) 1554 if test "x$macos" != "xno"; then 1555 LDFLAGS="${LDFLAGS} -pagezero_size 10000 -image_base 100000000" 1556 fi 1557 1558 else 1559 echo 1560 echo " ERROR! LuaJIT library not found. Go get it from http://www.luajit.org/ (or)" 1561 echo " Try compiling without openAppId using '--disable-open-appid'" 1562 AC_MSG_ERROR("Fatal!") 1563 fi 1564 1565 AC_CHECK_HEADER(openssl/x509.h, [AC_CHECK_LIB(crypto, d2i_X509, openssl_x509=yes, openssl_x509=no)],openssl_x509=no) 1566 if test "x$openssl_x509" = "xno"; then 1567 echo 1568 echo " ERROR! openssl/x509.h or openssl library not found." 1569 echo " Try compiling without openAppId using '--disable-open-appid'" 1570 AC_MSG_ERROR("Fatal!") 1571 fi 1572fi 1573 1574###### End OpenAppId 1575 1576#include luajit libs 1577 1578AC_ARG_WITH(libluajit_includes, 1579 [ --with-libluajit-includes=DIR libluajit include directory], 1580 [with_libluajit_includes="$withval"],[with_libluajit_includes="no"]) 1581 1582AC_ARG_WITH(libluajit_libraries, 1583 [ --with-libluajit-libraries=DIR libluajit library directory], 1584 [with_libluajit_libraries="$withval"],[with_libluajit_libraries="no"]) 1585 1586if test "x$with_libluajit_libraries" != "xno"; then 1587 LDFLAGS="${LDFLAGS} -L${with_libluajit_libraries}" 1588fi 1589 1590#include nghttp2 libs 1591 1592AC_ARG_WITH(libnghttp2_includes, 1593 [ --with-libnghttp2-includes=DIR libnghttp2 include directory], 1594 [with_libnghttp2_includes="$withval"],[with_libnghttp2_includes="no"]) 1595 1596AC_ARG_WITH(libnghttp2_libraries, 1597 [ --with-libnghttp2-libraries=DIR libnghttp2 library directory], 1598 [with_libnghttp2_libraries="$withval"],[with_libnghttp2_libraries="no"]) 1599 1600if test "x$with_libnghttp2_includes" != "xno"; then 1601 CPPFLAGS="${CPPFLAGS} -I${with_libnghttp2_includes}" 1602 ICONFIGFLAGS="${ICONFIGFLAGS} -I${with_libnghttp2_includes}" 1603fi 1604 1605if test "x$with_libnghttp2_libraries" != "xno"; then 1606 LDFLAGS="${LDFLAGS} -L${with_libnghttp2_libraries}" 1607fi 1608 1609# Verify that we have the library 1610NGHTTP_L="" 1611AC_CHECK_LIB(nghttp2, nghttp2_option_new, ,NGHTTP_L="no") 1612if test "x$NGHTTP_L" = "xno"; then 1613 echo 1614 echo " Libnghttp2 library not found." 1615 echo " Get it from https://nghttp2.org/" 1616 echo 1617fi 1618 1619CFLAGS="${CFLAGS} ${CCONFIGFLAGS}" 1620CFLAGS=`echo $CFLAGS | sed -e 's/-I\/usr\/include //g'` 1621CPPFLAGS="${CPPFLAGS} ${CONFIGFLAGS}" 1622CPPFLAGS=`echo $CPPFLAGS | sed -e 's/-I\/usr\/include //g'` 1623 1624if test "x$GCC" = "xyes" ; then 1625 echo `$CC -v 2>&1` | grep "version 4" > /dev/null 1626 if test $? = 0 ; then 1627 CFLAGS="$CFLAGS -fno-strict-aliasing" 1628 fi 1629fi 1630 1631if test "x$linux" = "xyes"; then 1632 AC_MSG_CHECKING(for linuxthreads) 1633 tstr=`getconf GNU_LIBPTHREAD_VERSION 2>&1` 1634 if test $? = 0; then # GNU_LIBPTHREAD_VERSION is a valid system variable 1635 echo $tstr | grep -i linuxthreads > /dev/null 2>&1 1636 if test $? = 0; then 1637 AC_DEFINE([HAVE_LINUXTHREADS],[1],[Define whether linuxthreads is being used]) 1638 AC_MSG_RESULT(yes) 1639 else 1640 AC_MSG_RESULT(no) 1641 fi 1642 else 1643 # Use libc.so to see if linuxthreads is being used 1644 $( ldd `which --skip-alias ls` | grep libc.so | awk '{print $3}' ) | grep -i linuxthreads > /dev/null 2>&1 1645 if test $? = 0; then 1646 AC_DEFINE([HAVE_LINUXTHREADS],[1],[Define whether linuxthreads is being used]) 1647 AC_MSG_RESULT(yes) 1648 else 1649 AC_MSG_RESULT(no) 1650 fi 1651 fi 1652fi 1653 1654if test "$LEX" != "none"; then 1655 AC_MSG_CHECKING(for yylex_destroy support) 1656 1657 version=`$LEX --version | awk '{print $3}'` 1658 if test -z $version; then 1659 version=`$LEX --version | awk '{print $2}'` 1660 fi 1661 1662 have_yylex_destroy="no" 1663 if test $version; then 1664 major=`echo $version | awk -F. '{ print $1 }'` 1665 minor=`echo $version | awk -F. '{ print $2 }'` 1666 subminor=`echo $version | awk -F. '{ print $3 }'` 1667 1668 if test $major -a $minor -a $subminor; then 1669 if test $major -gt 2; then 1670 have_yylex_destroy="yes" 1671 else 1672 if test $major -eq 2; then 1673 if test $minor -gt 5; then 1674 have_yylex_destroy="yes" 1675 else 1676 if test $minor -eq 5; then 1677 if test $subminor -ge 9; then 1678 have_yylex_destroy="yes" 1679 fi 1680 fi 1681 fi 1682 fi 1683 fi 1684 fi 1685 fi 1686 1687 if test "x$have_yylex_destroy" = "xyes"; then 1688 AC_MSG_RESULT(yes) 1689 AC_DEFINE([HAVE_YYLEX_DESTROY],[1],[Define whether yylex_destroy is supported in flex version]) 1690 else 1691 AC_MSG_RESULT(no) 1692 fi 1693fi 1694 1695# Set to no optimization regardless of what user or autostuff set 1696if test "x$NO_OPTIMIZE" = "xyes"; then 1697 CFLAGS=`echo $CFLAGS | sed -e "s/-O./-O0/"` 1698 1699 # in case user override doesn't include -O 1700 if echo $CFLAGS | grep -qve -O0 ; then 1701 CFLAGS="$CFLAGS -O0" 1702 fi 1703fi 1704 1705# Question: Does ICC not support -Wall (VJR - Jan 14, 2015) 1706if test "$ICC" = "no"; then 1707 CFLAGS="$CFLAGS -Wall" 1708fi 1709 1710AC_MSG_CHECKING(for SFLINUX) 1711if test -f /etc/os.conf; then 1712 CFLAGS="${CFLAGS} -DSFLINUX" 1713 AC_MSG_RESULT(yes) 1714else 1715 AC_MSG_RESULT(no) 1716fi 1717 1718AC_MSG_CHECKING(for WRLINUX) 1719if test -f /etc/os-release && grep -q "wrlinux" /etc/os-release; then 1720 CFLAGS="${CFLAGS} -DWRLINUX" 1721 AC_MSG_RESULT(yes) 1722else 1723 AC_MSG_RESULT(no) 1724fi 1725 1726echo $CFLAGS > cflags.out 1727echo $CPPFLAGS > cppflags.out 1728 1729INCLUDES='-I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/src/sfutil $(extra_incl) -I$(top_srcdir)/src/output-plugins -I$(top_srcdir)/src/detection-plugins -I$(top_srcdir)/src/dynamic-plugins -I$(top_srcdir)/src/preprocessors -I$(top_srcdir)/src/preprocessors/portscan -I$(top_srcdir)/src/preprocessors/HttpInspect/include -I$(top_srcdir)/src/preprocessors/Session -I$(top_srcdir)/src/preprocessors/Stream6 -I$(top_srcdir)/src/target-based -I$(top_srcdir)/src/control -I$(top_srcdir)/src/file-process -I$(top_srcdir)/src/file-process/libs -I$(top_srcdir)/src/side-channel -I$(top_srcdir)/src/side-channel/plugins -I$(top_srcdir)/src/reload-adjust' 1730 1731AC_SUBST(INCLUDES) 1732AC_SUBST(CONFIGFLAGS) 1733AC_SUBST(CCONFIGFLAGS) 1734AC_SUBST(ICONFIGFLAGS) 1735 1736AC_PROG_INSTALL 1737AC_CONFIG_FILES([ \ 1738snort.pc \ 1739Makefile \ 1740src/Makefile \ 1741src/sfutil/Makefile \ 1742src/control/Makefile \ 1743src/file-process/Makefile \ 1744src/file-process/libs/Makefile \ 1745src/side-channel/Makefile \ 1746src/side-channel/dynamic-plugins/Makefile \ 1747src/side-channel/dynamic-plugins/snort_side_channel.pc \ 1748src/side-channel/plugins/Makefile \ 1749src/detection-plugins/Makefile \ 1750src/dynamic-examples/Makefile \ 1751src/dynamic-examples/dynamic-preprocessor/Makefile \ 1752src/dynamic-examples/dynamic-rule/Makefile \ 1753src/dynamic-plugins/Makefile \ 1754src/dynamic-plugins/sf_engine/Makefile \ 1755src/dynamic-plugins/sf_engine/examples/Makefile \ 1756src/dynamic-plugins/sf_preproc_example/Makefile \ 1757src/dynamic-preprocessors/Makefile \ 1758src/dynamic-preprocessors/libs/Makefile \ 1759src/dynamic-preprocessors/libs/snort_preproc.pc \ 1760src/dynamic-preprocessors/ftptelnet/Makefile \ 1761src/dynamic-preprocessors/smtp/Makefile \ 1762src/dynamic-preprocessors/ssh/Makefile \ 1763src/dynamic-preprocessors/sip/Makefile \ 1764src/dynamic-preprocessors/reputation/Makefile \ 1765src/dynamic-preprocessors/gtp/Makefile \ 1766src/dynamic-preprocessors/dcerpc2/Makefile \ 1767src/dynamic-preprocessors/pop/Makefile \ 1768src/dynamic-preprocessors/imap/Makefile \ 1769src/dynamic-preprocessors/sdf/Makefile \ 1770src/dynamic-preprocessors/dns/Makefile \ 1771src/dynamic-preprocessors/ssl/Makefile \ 1772src/dynamic-preprocessors/modbus/Makefile \ 1773src/dynamic-preprocessors/dnp3/Makefile \ 1774src/dynamic-preprocessors/s7commplus/Makefile \ 1775src/dynamic-preprocessors/file/Makefile \ 1776src/dynamic-preprocessors/appid/Makefile \ 1777src/dynamic-output/Makefile \ 1778src/dynamic-output/plugins/Makefile \ 1779src/dynamic-output/libs/Makefile \ 1780src/dynamic-output/libs/snort_output.pc \ 1781src/output-plugins/Makefile \ 1782src/preprocessors/Makefile \ 1783src/preprocessors/HttpInspect/Makefile \ 1784src/preprocessors/HttpInspect/include/Makefile \ 1785src/preprocessors/HttpInspect/utils/Makefile \ 1786src/preprocessors/HttpInspect/anomaly_detection/Makefile \ 1787src/preprocessors/HttpInspect/client/Makefile \ 1788src/preprocessors/HttpInspect/files/Makefile \ 1789src/preprocessors/HttpInspect/event_output/Makefile \ 1790src/preprocessors/HttpInspect/mode_inspection/Makefile \ 1791src/preprocessors/HttpInspect/normalization/Makefile \ 1792src/preprocessors/HttpInspect/server/Makefile \ 1793src/preprocessors/HttpInspect/session_inspection/Makefile \ 1794src/preprocessors/HttpInspect/user_interface/Makefile \ 1795src/preprocessors/Session/Makefile \ 1796src/preprocessors/Stream6/Makefile \ 1797src/parser/Makefile \ 1798src/target-based/Makefile \ 1799doc/Makefile \ 1800rpm/Makefile \ 1801preproc_rules/Makefile \ 1802m4/Makefile \ 1803etc/Makefile \ 1804templates/Makefile \ 1805tools/Makefile \ 1806tools/control/Makefile \ 1807tools/u2boat/Makefile \ 1808tools/u2spewfoo/Makefile \ 1809tools/u2openappid/Makefile \ 1810tools/u2streamer/Makefile \ 1811tools/file_server/Makefile \ 1812src/win32/Makefile \ 1813src/reload-adjust/Makefile]) 1814 1815AC_OUTPUT 1816