]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
autotools: cleanup
authorVictor Julien <victor@inliniac.net>
Thu, 20 Aug 2015 11:37:09 +0000 (13:37 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 31 Aug 2015 14:12:09 +0000 (16:12 +0200)
Remove most of the CFLAGS updates from configure. Flags are now (mostly)
set in AM_CLFLAGS.

Update all -DBLAH additions to CFLAGS to use AC_DEFINE([BLAH], ...)

Improve Lua vs LuaJIT checking.

Improve the configure output a bit.

Lots of smaller cleanups.

configure.ac
src/Makefile.am

index f796b06a281a90d83570f127f6b21234b0993204..ea819f4a80323d7fe8180612f0a43e3717efd761 100644 (file)
@@ -1,6 +1,3 @@
-#TODO A better place for default CFLAGS?
-
-
     AC_INIT(suricata, 2.1dev)
     m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])AM_SILENT_RULES([yes])
     AC_CONFIG_HEADERS([config.h])
             echo
             ])
 
-    if test `basename $CC` = "clang"; then
-        CFLAGS="$CFLAGS -Wextra -Werror-implicit-function-declaration"
-        AC_MSG_CHECKING([clang __sync_bool_compare_and_swap])
-        AC_TRY_COMPILE([#include <stdio.h>],
+    dnl Taken from https://llvm.org/svn/llvm-project/llvm/trunk/autoconf/configure.ac
+    dnl check if we compile using clang or gcc. On some systems the gcc binary is
+    dnl is actually clang, so do a compile test.
+    AC_MSG_CHECKING([whether GCC or Clang is our compiler])
+    AC_LANG_PUSH([C])
+    compiler=unknown
+    AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __clang__
+                                        #error
+                                        #endif
+                                      ]])],
+                       compiler=clang,
+                      [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __GNUC__
+                                                           #error
+                                                           #endif
+                                                         ]])],
+                       compiler=gcc, [])])
+    AC_LANG_POP([C])
+    AC_MSG_RESULT([${compiler}])
+
+    case "$compiler" in
+        clang)
+            CLANG_CFLAGS="-Wextra -Werror-implicit-function-declaration"
+            AC_MSG_CHECKING([clang __sync_bool_compare_and_swap support])
+            AC_TRY_COMPILE([#include <stdio.h>],
                 [ unsigned int i = 0; (void)__sync_bool_compare_and_swap(&i, 1, 1);],
                 [
                     AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1], [1], [Fake GCC atomic support])
                     AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8], [1], [Fake GCC atomic support])
                     AC_MSG_RESULT([yes]) ],
                 [AC_MSG_RESULT([no])])
-    fi
-    if test `basename $CC` = "gcc"; then
-        dnl get gcc version
-        AC_MSG_CHECKING([gcc version])
-                gccver=$($CC -dumpversion)
-                gccvermajor=$(echo $gccver | cut -d . -f1)
-                gccverminor=$(echo $gccver | cut -d . -f2)
-                gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor)
-        AC_MSG_RESULT($gccver)
-
-        if test "$gccvernum" -ge "400"; then
+            AC_SUBST(CLANG_CFLAGS)
+            ;;
+        gcc)
+            dnl get gcc version
+            AC_MSG_CHECKING([gcc version])
+                    gccver=$($CC -dumpversion)
+                    gccvermajor=$(echo $gccver | cut -d . -f1)
+                    gccverminor=$(echo $gccver | cut -d . -f2)
+                    gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor)
+            AC_MSG_RESULT($gccver)
+
+            if test "$gccvernum" -ge "400"; then
                 dnl gcc 4.0 or later
-                CFLAGS="$CFLAGS -Wextra -Werror-implicit-function-declaration"
+                GCC_CFLAGS="-Wextra -Werror-implicit-function-declaration"
                 # remove optimization options that break our code
                 # VJ 2010/06/27: no-tree-pre added. It breaks ringbuffers code.
-                CFLAGS="$CFLAGS -fno-tree-pre"
-        else
-                CFLAGS="$CFLAGS -W"
-        fi
-    fi
-    CFLAGS="$CFLAGS -Wall"
-    CFLAGS="$CFLAGS -Wno-unused-parameter"
-    CFLAGS="$CFLAGS -std=gnu99"
+                GCC_CFLAGS="$GCC_CFLAGS -fno-tree-pre"
+            else
+                GCC_CFLAGS="-W"
+            fi
+            AC_SUBST(GCC_CFLAGS)
+            ;;
+        *)
+            AC_MSG_WARN([unsupported/untested compiler, this may or may not work])
+            ;;
+    esac
 
     # Checks for programs.
     AC_PROG_AWK
     AC_FUNC_MALLOC
     AC_FUNC_REALLOC
     AC_CHECK_FUNCS([gettimeofday memset strcasecmp strchr strdup strerror strncasecmp strtol strtoul memchr memrchr])
+
+    OCFLAGS=$CFLAGS
+    CFLAGS=""
     AC_CHECK_FUNCS([strlcpy strlcat])
+    CFLAGS=$OCFLAGS
 
     # Add large file support
     AC_SYS_LARGEFILE
         AC_MSG_CHECKING(for -fstack-protector)
         TMPCFLAGS="${CFLAGS}"
         CFLAGS="${CFLAGS} -fstack-protector"
-        AC_TRY_LINK(,,SECCFLAGS="${SECCFLAGS} -fstack-protector"
-        AC_MSG_RESULT(yes),
-        AC_MSG_RESULT(no))
+        AC_TRY_LINK(,,SECCFLAGS="-fstack-protector"
+            AC_MSG_RESULT(yes),
+            AC_MSG_RESULT(no))
         CFLAGS="${TMPCFLAGS}"
 
         #compile-time best-practices errors for certain libc functions, provides checks of buffer lengths and memory regions
         TMPCFLAGS="${CFLAGS}"
         CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=2"
         AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -D_FORTIFY_SOURCE=2"
-        AC_MSG_RESULT(yes),
-        AC_MSG_RESULT(no))
+            AC_MSG_RESULT(yes),
+            AC_MSG_RESULT(no))
         CFLAGS="${TMPCFLAGS}"
 
         #compile-time warnings about misuse of format strings
         TMPCFLAGS="${CFLAGS}"
         CFLAGS="${CFLAGS} -Wformat -Wformat-security"
         AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -Wformat -Wformat-security"
-        AC_MSG_RESULT(yes),
-        AC_MSG_RESULT(no))
+            AC_MSG_RESULT(yes),
+            AC_MSG_RESULT(no))
         CFLAGS="${TMPCFLAGS}"
 
         #provides a read-only relocation table area in the final ELF
         TMPLDFLAGS="${LDFLAGS}"
         LDFLAGS="${LDFLAGS} -z relro"
         AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z relro"
-        AC_MSG_RESULT(yes),
-        AC_MSG_RESULT(no))
+            AC_MSG_RESULT(yes),
+            AC_MSG_RESULT(no))
         LDFLAGS="${TMPLDFLAGS}"
 
         #forces all relocations to be resolved at run-time
         TMPLDFLAGS="${LDFLAGS}"
         LDFLAGS="${LDFLAGS} -z now"
         AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z now"
-        AC_MSG_RESULT(yes),
-        AC_MSG_RESULT(no))
+            AC_MSG_RESULT(yes),
+            AC_MSG_RESULT(no))
         LDFLAGS="${TMPLDFLAGS}"
 
-        CFLAGS="${CFLAGS} ${SECCFLAGS}"
-        LDFLAGS="${LDFLAGS} ${SECLDFLAGS}"
+        AC_SUBST(SECCFLAGS)
+        AC_SUBST(SECLDFLAGS)
     ])
 
     #enable profile generation
             AC_COMPILE_IFELSE(  [AC_LANG_PROGRAM([[#include <stdlib.h>]])],
                         [
                           AC_MSG_RESULT([yes])
-                          CFLAGS="$OFLAGS -march=native"
+                          OPTIMIZATION_CFLAGS="-march=native"
+                          AC_SUBST(OPTIMIZATION_CFLAGS)
                         ],
                         [
                           AC_MSG_RESULT([no])
     AC_ARG_ENABLE(unittests,
            AS_HELP_STRING([--enable-unittests], [Enable compilation of the unit tests]),,[enable_unittests=no])
     AS_IF([test "x$enable_unittests" = "xyes"], [
-        UT_ENABLED="yes"
-        CFLAGS="${CFLAGS} -DUNITTESTS"
+        AC_DEFINE([UNITTESTS],[1],[Enable built-in unittests])
     ])
-
     AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$enable_unittests" = "xyes"])
 
   # enable workaround for old barnyard2 for unified alert output
     AC_ARG_ENABLE(old-barnyard2,
            AS_HELP_STRING([--enable-old-barnyard2], [Use workaround for old barnyard2 in unified2 output]),,[enable_old_barnyard2=no])
     AS_IF([test "x$enable_old_barnyard2" = "xyes"], [
-        CFLAGS="${CFLAGS} -DHAVE_OLD_BARNYARD2"
+        AC_DEFINE([HAVE_OLD_BARNYARD2],[1],[Use workaround for old barnyard2 in unified2 output])
     ])
 
   # enable debug output
     AC_ARG_ENABLE(debug,
            AS_HELP_STRING([--enable-debug], [Enable debug output]),,[enable_debug=no])
     AS_IF([test "x$enable_debug" = "xyes"], [
-        CFLAGS="${CFLAGS} -DDEBUG"
+        AC_DEFINE([DEBUG],[1],[Enable debug output])
     ])
+    AM_CONDITIONAL([DEBUG], [test "x$enable_debug" = "xyes"])
 
   # enable debug validation functions & macro's output
     AC_ARG_ENABLE(debug-validation,
            AS_HELP_STRING([--enable-debug-validation], [Enable (debug) validation code output]),,[enable_debug_validation=no])
     AS_IF([test "x$enable_debug_validation" = "xyes"], [
-        CFLAGS="${CFLAGS} -DDEBUG_VALIDATION"
+        AC_DEFINE([DEBUG_VALIDATION],[1],[Enable (debug) validation code output])
     ])
 
   # profiling support
     AC_ARG_ENABLE(profiling,
            AS_HELP_STRING([--enable-profiling], [Enable performance profiling]),,[enable_profiling=no])
     AS_IF([test "x$enable_profiling" = "xyes"], [
-
-       case "$host" in
-           *-*-openbsd*)
-               AC_MSG_ERROR([profiling is not supported on OpenBSD])
-               ;;
-          *)
-               CFLAGS="${CFLAGS} -DPROFILING"
-               ;;
-        esac
+    case "$host" in
+        *-*-openbsd*)
+            AC_MSG_ERROR([profiling is not supported on OpenBSD])
+            ;;
+        *)
+            AC_DEFINE([PROFILING],[1],[Enable performance profiling])
+            ;;
+    esac
     ])
 
   # profiling support, locking
     AC_ARG_ENABLE(profiling-locks,
            AS_HELP_STRING([--enable-profiling-locks], [Enable performance profiling for locks]),,[enable_profiling_locks=no])
     AS_IF([test "x$enable_profiling_locks" = "xyes"], [
-        CFLAGS="${CFLAGS} -DPROFILING -DPROFILE_LOCKING"
+        AC_DEFINE([PROFILING],[1],[Enable performance profiling])
+        AC_DEFINE([PROFILE_LOCKING],[1],[Enable performance profiling for locks])
     ])
 
   # enable support for IPFW
     AC_ARG_ENABLE(ipfw,
             AS_HELP_STRING([--enable-ipfw], [Enable FreeBSD IPFW support for inline IDP]),,[enable_ipfw=no])
     AS_IF([test "x$enable_ipfw" = "xyes"], [
-        CFLAGS="$CFLAGS -DIPFW"
+        AC_DEFINE([IPFW],[1],[Enable FreeBSD IPFW support for inline IDP])
     ])
 
     AC_ARG_ENABLE(coccinelle,
         AC_DEFINE([HAVE_DETECT_DISABLED], [1], [Detection is disabled])
     ])
 
+  # Tilera PCIE logging
     AM_CONDITIONAL([BUILD_PCIE_LOGGING], [test ! -z "$TILERA_ROOT"])
 
 # libraries
     AC_CHECK_HEADER(pcre.h,,[AC_ERROR(pcre.h not found ...)])
 
     if test "$with_libpcre_libraries" != "no"; then
-        LDFLAGS="${LDFLAGS}  -L${with_libpcre_libraries}"
+        LDFLAGS="${LDFLAGS} -L${with_libpcre_libraries}"
     fi
     PCRE=""
     AC_CHECK_LIB(pcre, pcre_get_substring,, PCRE="no",-lpthread)
         [ pcre_match_limit_recursion_available=yes ], [:]
     )
     if test "$pcre_match_limit_recursion_available" != "yes"; then
-        CFLAGS="${CFLAGS} -DNO_PCRE_MATCH_RLIMIT"
         echo
         echo "   Warning! pcre extra opt PCRE_EXTRA_MATCH_LIMIT_RECURSION not found"
         echo "   This could lead to potential DoS please upgrade to pcre >= 6.5"
-        echo "   Continuing for now...."
         echo "   from www.pcre.org."
+        echo "   Continuing for now...."
         echo
+        AC_DEFINE([NO_PCRE_MATCH_RLIMIT],[1],[Pcre PCRE_EXTRA_MATCH_LIMIT_RECURSION not available])
     fi
 
     TMPCFLAGS="${CFLAGS}"
     AC_CHECK_HEADER(yaml.h,,LIBYAML="no")
 
     if test "$with_libyaml_libraries" != "no"; then
-        LDFLAGS="${LDFLAGS}  -L${with_libyaml_libraries}"
+        LDFLAGS="${LDFLAGS} -L${with_libyaml_libraries}"
     fi
 
     LIBYAML=""
             echo "   Go get it from your distribution or from:"
             echo "     http://www.digip.org/jansson/"
             echo
-           if test "x$enable_unixsocket" = "xyes"; then
+            if test "x$enable_unixsocket" = "xyes"; then
                 exit 1
             fi
             enable_unixsocket="no"
         else
             case $host in
                 *-*-mingw32*)
-                ;;
+                    ;;
                 *-*-cygwin)
-                ;;
+                    ;;
                 *)
-               if test "x$enable_unixsocket" = "xtest"; then
-                    enable_unixsocket="yes"
-               fi
-                ;;
+                    if test "x$enable_unixsocket" = "xtest"; then
+                        enable_unixsocket="yes"
+                    fi
+                    ;;
             esac
         fi
     else
         esac
     fi
 
-    #enable support for NFQUEUE
+    # enable support for NFQUEUE
     AS_IF([test "x$enable_nfqueue" = "xyes"], [
-        CFLAGS="$CFLAGS -DNFQ"
+        AC_DEFINE_UNQUOTED([NFQ],[1],[Enable Linux Netfilter NFQUEUE support for inline IDP])
 
   #libnetfilter_queue
     AC_ARG_WITH(libnetfilter_queue_includes,
             LLIBNET=""
             AC_CHECK_LIB(net, libnet_write,, LLIBNET="no")
             if test "$LLIBNET" != "no"; then
-                CFLAGS="${CFLAGS} -DHAVE_LIBNET11 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H"
+                AC_DEFINE([HAVE_LIBNET11],[1],(libnet 1.1 available))
+                AC_DEFINE([_DEFAULT_SOURCE],[1],(default source))
+                AC_DEFINE([_BSD_SOURCE],[1],(bsd source))
+                AC_DEFINE([__BSD_SOURCE],[1],(bsd source))
+                AC_DEFINE([__FAVOR_BSD],[1],(favor bsd))
+                AC_DEFINE([HAVE_NET_ETHERNET_H],[1],(ethernet.h))
             else
             #if we displayed a warning already no reason to do it again.
                 if test "$LIBNET_DETECT_FAIL" = "no"; then
                 TMPLIBS="${LIBS}"
                 AC_CHECK_LIB(net, libnet_build_icmpv6_unreach,, LLIBNET="no")
                 if test "$LLIBNET" != "no"; then
-                    CFLAGS="$CFLAGS -DHAVE_LIBNET_ICMPV6_UNREACH"
+                    AC_DEFINE([HAVE_LIBNET_ICMPV6_UNREACH],[1],(libnet_build_icmpv6_unreach available))
                 fi
                 LIBS="${TMPLIBS}"
             fi
     if test "$LPCAPVTEST" != "no"; then
         AC_PATH_PROG(HAVE_PCAP_CONFIG, pcap-config, "no")
         if test "$HAVE_PCAP_CONFIG" = "no" -o "$cross_compiling" = "yes"; then
-            CFLAGS="${CFLAGS} -DLIBPCAP_VERSION_MAJOR=1"
+            AC_DEFINE([LIBPCAP_VERSION_MAJOR],[1],(libpcap version 1.0+))
         else
-            CFLAGS="${CFLAGS} `pcap-config --defines` `pcap-config --cflags` -DLIBPCAP_VERSION_MAJOR=1"
+            PCAP_CFLAGS="$(pcap-config --defines) $(pcap-config --cflags)"
+            AC_SUBST(PCAP_CFLAGS)
+            AC_DEFINE([LIBPCAP_VERSION_MAJOR],[1],(libpcap version 1.0+))
         fi
     else
-        CFLAGS="${CFLAGS} -DLIBPCAP_VERSION_MAJOR=0"
+        AC_DEFINE([LIBPCAP_VERSION_MAJOR],[0],(libpcap version 0.x))
     fi
     LIBS="${TMPLIBS}"
 
     TMPLIBS="${LIBS}"
     AC_CHECK_LIB(pcap, pcap_set_buffer_size,, LPCAPSBUFF="no")
     if test "$LPCAPSBUFF" != "no"; then
-        CFLAGS="${CFLAGS} -DHAVE_PCAP_SET_BUFF"
+        AC_DEFINE([HAVE_PCAP_SET_BUFF],[1],(libpcap has pcap_set_buffer_size function))
     fi
     LIBS="${TMPLIBS}"
 
     AC_ARG_ENABLE(pfring,
            AS_HELP_STRING([--enable-pfring], [Enable Native PF_RING support]),,[enable_pfring=no])
     AS_IF([test "x$enable_pfring" = "xyes"], [
-        CFLAGS="$CFLAGS -DHAVE_PFRING"
+        AC_DEFINE([HAVE_PFRING],[1],(PF_RING support enabled))
 
         #We have to set CFLAGS for AC_TRY_COMPILE as it doesn't pay attention to CPPFLAGS
         AC_ARG_WITH(libpfring_includes,
             [with_netmap_includes="$withval"],[with_netmap_includes=no])
 
     AS_IF([test "x$enable_netmap" = "xyes"], [
-        CFLAGS="$CFLAGS -DHAVE_NETMAP"
+        AC_DEFINE([HAVE_NETMAP],[1],(NETMAP support enabled))
 
         if test "$with_netmap_includes" != "no"; then
             CPPFLAGS="${CPPFLAGS} -I${with_netmap_includes}"
                 [  --with-cuda-nvcc=DIR  cuda nvcc compiler directory],
                 [with_cuda_nvcc="$withval"],[with_cuda_nvcc=no])
 
-        CFLAGS="${CFLAGS} -D__SC_CUDA_SUPPORT__"
+        AC_DEFINE([SC_CUDA_SUPPORT__],[1],(CUDA support enabled))
 
         if test "$with_cuda_includes" != "no"; then
             CPPFLAGS="${CPPFLAGS} -I${with_cuda_includes}"
     fi
 
     if test "$LIBCAP_NG" != "no"; then
-    CFLAGS="${CFLAGS} -DHAVE_LIBCAP_NG"
+        AC_DEFINE([HAVE_LIBCAP_NG],[1],[Libpcap-ng support])
     fi
 
     if test "$LIBCAP_NG" = "no"; then
         AC_CHECK_HEADER(dagapi.h,DAG="yes",DAG="no")
         if test "$DAG" != "no"; then
             DAG=""
-           AC_CHECK_LIB(dag,dag_open,,DAG="no",)
-        fi
-
-        if test "$DAG" != "no"; then
-            CFLAGS="${CFLAGS} -DHAVE_DAG"
+               AC_CHECK_LIB(dag,dag_open,,DAG="no",)
         fi
 
         if test "$DAG" = "no"; then
             echo
             exit 1
         fi
+
+        AC_DEFINE([HAVE_DAG],[1],(Endace DAG card support enabled))
     fi
 
   # libnspr
             AC_CHECK_LIB(ntapi, NT_Init,NAPATECH="yes",NAPATECH="no")
         fi
 
-        if test "$NAPATECH" != "no"; then
-            CFLAGS="${CFLAGS} -DHAVE_NAPATECH"
-        fi
-
         if test "$NAPATECH" = "no"; then
             echo
             echo "  ERROR! libntapi library not found"
             echo
             exit 1
         fi
+
+        AC_DEFINE([HAVE_NAPATECH],[1],(Napatech capture card support))
     fi
 
   # liblua
                AS_HELP_STRING([--enable-lua],[Enable Lua support]),
                [ enable_lua="yes"],
                [ enable_lua="no"])
+    AC_ARG_ENABLE(luajit,
+               AS_HELP_STRING([--enable-luajit],[Enable Luajit support]),
+               [ enable_luajit="yes"],
+               [ enable_luajit="no"])
+    if test "$enable_lua" = "yes"; then
+        if test "$enable_luajit" = "yes"; then
+            echo "ERROR: can't enable liblua and luajit at the same time."
+            echo "For LuaJIT, just use --enable-luajit. For liblua (no jit)"
+            echo "support, use just --enable-lua."
+            echo "Both options will enable the Lua scripting capabilities"
+            echo "in Suricata".
+            echo
+            exit 1
+        fi
+    fi
+
     AC_ARG_WITH(liblua_includes,
             [  --with-liblua-includes=DIR  liblua include directory],
             [with_liblua_includes="$withval"],[with_liblua_includes="no"])
     fi
 
   # libluajit
-    AC_ARG_ENABLE(luajit,
-               AS_HELP_STRING([--enable-luajit],[Enable Luajit support]),
-               [ enable_luajit="yes"],
-               [ enable_luajit="no"])
     AC_ARG_WITH(libluajit_includes,
             [  --with-libluajit-includes=DIR  libluajit include directory],
             [with_libluajit_includes="$withval"],[with_libluajit_includes="no"])
 
             AC_DEFINE([HAVE_LUA],[1],[lua support available])
             AC_DEFINE([HAVE_LUAJIT],[1],[libluajit available])
-            enable_lua="yes"
+            enable_lua="yes, through luajit"
             enable_luajit="yes"
         else
                echo
         AC_CHECK_HEADER(GeoIP.h,GEOIP="yes",GEOIP="no")
         if test "$GEOIP" = "yes"; then
             if test "$with_libgeoip_libraries" != "no"; then
-                LDFLAGS="${LDFLAGS}  -L${with_libgeoip_libraries}"
+                LDFLAGS="${LDFLAGS} -L${with_libgeoip_libraries}"
             fi
             AC_CHECK_LIB(GeoIP, GeoIP_country_code_by_ipnum,, GEOIP="no")
         fi
             echo
             exit 1
         fi
-        if test "$GEOIP" = "yes"; then
-            AC_DEFINE([HAVE_GEOIP],[1],[libgeoip available])
-            enable_geoip="yes"
-        fi
+
+        AC_DEFINE([HAVE_GEOIP],[1],[libgeoip available])
+        enable_geoip="yes"
     fi
 
 # get cache line size
         if [test "$CLS" != "" && test "$CLS" != "0"]; then
             AC_DEFINE_UNQUOTED([CLS],[${CLS}],[L1 cache line size])
         else
-            AC_DEFINE_UNQUOTED([CLS],[64],[L1 cache line size])
+            AC_DEFINE([CLS],[64],[L1 cache line size])
         fi
     else
-        AC_DEFINE_UNQUOTED([CLS],[64],[L1 cache line size])
+        AC_DEFINE([CLS],[64],[L1 cache line size])
     fi
 
 # get revision
     if test -f ./revision; then
         REVISION=`cat ./revision`
-        CFLAGS="${CFLAGS} -DREVISION=\"${REVISION}\""
+        AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision])
     else
         AC_PATH_PROG(HAVE_GIT_CMD, git, "no")
         if test "$HAVE_GIT_CMD" != "no"; then
             if [ test -d .git ]; then
                 REVISION=`git rev-parse --short HEAD`
-                CFLAGS="${CFLAGS} -DREVISION=\"${REVISION}\""
+                AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision])
             fi
         fi
     fi
@@ -1730,6 +1769,13 @@ AC_SUBST(e_localstatedir)
 AC_DEFINE_UNQUOTED([CONFIG_DIR],["$e_sysconfdir"],[Our CONFIG_DIR])
 AC_SUBST(e_magic_file)
 
+EXPAND_VARIABLE(prefix, CONFIGURE_PREFIX)
+EXPAND_VARIABLE(sysconfdir, CONFIGURE_SYSCONDIR)
+EXPAND_VARIABLE(localstatedir, CONFIGURE_LOCALSTATEDIR)
+AC_SUBST(CONFIGURE_PREFIX)
+AC_SUBST(CONFIGURE_SYSCONDIR)
+AC_SUBST(CONFIGURE_LOCALSTATEDIR)
+
 AC_OUTPUT(Makefile src/Makefile qa/Makefile qa/coccinelle/Makefile rules/Makefile doc/Makefile contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile contrib/tile_pcie_logd/Makefile suricata.yaml scripts/Makefile scripts/suricatasc/Makefile scripts/suricatasc/suricatasc)
 
 SURICATA_BUILD_CONF="Suricata Configuration:
@@ -1741,6 +1787,7 @@ SURICATA_BUILD_CONF="Suricata Configuration:
   Netmap support:                          ${enable_netmap}
   DAG enabled:                             ${enable_dag}
   Napatech enabled:                        ${enable_napatech}
+
   Unix socket enabled:                     ${enable_unixsocket}
   Detection enabled:                       ${enable_detection}
 
@@ -1766,15 +1813,22 @@ SURICATA_BUILD_CONF="Suricata Configuration:
   Coccinelle / spatch:                     ${enable_coccinelle}
 
 Generic build parameters:
-  Installation prefix (--prefix):          ${prefix}
-  Configuration directory (--sysconfdir):  ${e_sysconfdir}
-  Log directory (--localstatedir) :        ${e_logdir}
+  Installation prefix:                     ${prefix}
+  Configuration directory:                 ${e_sysconfdir}
+  Log directory:                           ${e_logdir}
+
+  --prefix                                 ${CONFIGURE_PREFIX}
+  --sysconfdir                             ${CONFIGURE_SYSCONDIR}
+  --localstatedir                          ${CONFIGURE_LOCALSTATEDIR}
 
   Host:                                    ${host}
-  GCC binary:                              ${CC}
+  Compiler:                                ${CC} (exec name) / ${compiler} (real)
   GCC Protect enabled:                     ${enable_gccprotect}
   GCC march native enabled:                ${enable_gccmarch_native}
-  GCC Profile enabled:                     ${enable_gccprofile}"
+  GCC Profile enabled:                     ${enable_gccprofile}
+  CFLAGS                                   ${CFLAGS}
+  PCAP_CFLAGS                              ${PCAP_CFLAGS}
+  SECCFLAGS                                ${SECCFLAGS}"
 
 echo
 echo "$SURICATA_BUILD_CONF"
index e61e2ffa00c25591721d3dade597c00a0955f6c9..1d59a5082fca093b52f60c9b9b37de601f0dec65 100644 (file)
@@ -472,9 +472,14 @@ cuda-ptxdump.h: $(PTXS)
 CLEANFILES = $(PTXS) cuda-ptxdump.h
 endif
 
+# default CFLAGS
+AM_CFLAGS = ${OPTIMIZATION_CFLAGS} ${GCC_CFLAGS} ${CLANG_CFLAGS} ${SECCFLAGS} ${PCAP_CFLAGS} -Wall -Wno-unused-parameter -std=gnu99 -DLOCAL_STATE_DIR=\"$(localstatedir)\"
+# different flags for different cases
+if DEBUG
+AM_CFLAGS += -ggdb -O0
+endif
 
-#suricata_CFLAGS = -Wall -fno-strict-aliasing 
-AM_CFLAGS = -DLOCAL_STATE_DIR=\"$(localstatedir)\"
+AM_LDFLAGS = ${SECLDFLAGS}
 
 if BUILD_UNITTESTS
 check-am: