]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Autotools: move libhtp conditionals to configure
authorVictor Julien <victor@inliniac.net>
Wed, 10 Jul 2013 13:10:32 +0000 (15:10 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 11 Jul 2013 09:43:40 +0000 (11:43 +0200)
In preparation of the libhtp upgrade, move all libhtp related conditionals
to configure. This allows for one set of build scripts that works regardless
of the presence of a local libhtp dir.

Makefile.am
configure.ac
src/Makefile.am

index e9b55c6e51341114ddb66167303ad4da21065d8a..20b06aea46fecbd708ca632a4bf7d474b4bd40fe 100644 (file)
@@ -5,9 +5,6 @@ ACLOCAL_AMFLAGS = -I m4
 EXTRA_DIST = ChangeLog COPYING LICENSE suricata.yaml.in \
              classification.config threshold.config \
              reference.config
-if BUILD_LIBHTP
- HTP_DIR = libhtp
-endif
 SUBDIRS = $(HTP_DIR) src qa rules doc contrib scripts
 
 install-data-am:
index 6493729fee83507d24bd2e27d682f578a2545b31..680904871c58b4a91ace568ad8356fa6f8f65e43 100644 (file)
@@ -1072,14 +1072,30 @@ AC_INIT(configure.ac)
         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]) )
     ])
 
-    # even if we are using an installed htp lib we still need to gen Makefiles inside of htp
-    AC_CONFIG_SUBDIRS([libhtp])
-    AM_CONDITIONAL([BUILD_LIBHTP], [test "x$enable_non_bundled_htp" = "xno"])
-    AS_IF([test "x$enable_non_bundled_htp" = "xno"], [
-        AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp])
-        AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Assuming htp_tx_get_response_headers_raw function in bundled libhtp])
-        AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Assuming htp_decode_query_inplace function in bundled libhtp])
-    ])
+    if test "x$enable_non_bundled_htp" = "xno"; then
+        # test if we have a bundled htp
+        if test -d "$srcdir/libhtp"; then
+            AC_CONFIG_SUBDIRS([libhtp])
+            HTP_DIR="libhtp"
+            AC_SUBST(HTP_DIR)
+            HTP_LDADD="../libhtp/htp/libhtp.la"
+            AC_SUBST(HTP_LDADD)
+            # make sure libhtp is added to the includes
+            CPPFLAGS="${CPPFLAGS} -I${srcdir}/../libhtp/"
+
+            AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp])
+            AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Assuming htp_tx_get_response_headers_raw function in bundled libhtp])
+            AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Assuming htp_decode_query_inplace function in bundled libhtp])
+        else
+            echo
+            echo "  ERROR: Libhtp is not bundled. Get libhtp from https://github.com/ironbee/libhtp"
+            echo "  and pass --enable-non-bundled-htp to Suricata's configure script."
+            echo "  Add --with-libhtp-includes=<dir> and --with-libhtp-libraries=<dir> if"
+            echo "  libhtp is not installed in the include and library paths."
+            echo
+            exit 1
+        fi
+    fi
 
 
   # enable CUDA output
index 85c28a87e8371996cbca2c394ec21ae241a5a6e7..ddf8d3740cceab3d27dd1beeb79873c7bb38db79 100644 (file)
@@ -342,11 +342,7 @@ INCLUDES= $(all_includes)
 
 # the library search path.
 suricata_LDFLAGS = $(all_libraries)
-
-if BUILD_LIBHTP
-suricata_LDADD = $(top_builddir)/libhtp/htp/libhtp.la
-INCLUDES += -I$(top_srcdir)/libhtp
-endif
+suricata_LDADD = $(HTP_LDADD)
 
 # Rules to build CUDA ptx modules
 if BUILD_CUDA