]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: enable by default 3500/head
authorVictor Julien <victor@inliniac.net>
Sun, 7 Oct 2018 07:14:06 +0000 (09:14 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 8 Oct 2018 14:54:39 +0000 (16:54 +0200)
Remove 'experimental' label for Rust, and enable it by default if
rustc and cargo (and libjansson) are available.

Add rustc and cargo versions to the build-info.

configure.ac
suricata.yaml.in

index 43807c8a379da98e47e1042a19c823e3fbafb9e8..9a786ee50ebb031fd942211eabcc5e34a6f27174 100644 (file)
@@ -2170,14 +2170,20 @@ fi
     AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$enable_pdflatex" != "xno"])
 
 # Cargo/Rust.
-    AC_ARG_ENABLE([rust], AS_HELP_STRING([--enable-rust], [Enable Experimental Rust support]))
+    AC_ARG_ENABLE([rust], AS_HELP_STRING([--enable-rust], [Enable Rust support]),
+            [enable_rust="$enableval"], [enable_rust="yes (default)"])
 
     rust_config_enabled="no"        # used in suricata.yaml.in to enable/disable app-layers
     rust_config_comment="#"         # used in suricata.yaml.in to enable/disable eve loggers
     rust_vendor_comment="# "
     have_rust_vendor="no"
+    rust_compiler_version="not set"
+    rust_cargo_version="not set"
 
-    if test "x$enable_rust" != "xyes"; then
+
+    if test "x$enable_rust" != "xyes" && test "x$enable_rust" != "xyes (default)"; then
+      enable_rust="no"
+    elif test "x$enable_python" != "xyes" && test ! -f rust/gen/c-headers/rust-core-gen.h; then
       enable_rust="no"
     else
       # Rust require jansson (json support).
@@ -2189,7 +2195,11 @@ fi
         echo "   Fedora: dnf install jansson-devel"
         echo "   CentOS/RHEL: yum install jansson-devel"
         echo ""
-        exit 1
+        if test "x$enable_rust" = "xyes"; then
+            exit 1
+        fi
+        echo "   Rust support will be disabled."
+        enable_rust="no"
       fi
 
       AC_PATH_PROG(HAVE_CARGO, cargo, "no")
@@ -2205,56 +2215,69 @@ fi
         echo "   Fedora: dnf install cargo"
         echo "   CentOS/RHEL: yum install cargo"
         echo ""
-        exit 1
+        if test "x$enable_rust" = "xyes"; then
+            exit 1
+        fi
+        echo "   Rust support will be disabled."
+        enable_rust="no"
       fi
       if test "x$HAVE_RUST" = "xno"; then
         echo ""
         echo "   ERROR! Rust support requested but rustc not found."
         echo
         echo "   Ubuntu: apt-get install rustc"
+        echo "   Debian <= 9: use rustup to install"
+        echo "   Debian 10: apt-get install rustc"
         echo "   Fedora: dnf install rust"
         echo "   CentOS/RHEL: yum install rust"
         echo ""
-        exit 1
+        if test "x$enable_rust" = "xyes"; then
+            exit 1
+        fi
+        echo "   Rust support will be disabled."
+        enable_rust="no"
       fi
 
-      if test "x$HAVE_CARGO" != "xno"; then
-        if test "x$HAVE_RUSTC" != "xno"; then
-          enable_rust="yes"
-          AC_DEFINE([HAVE_RUST],[1],[Enable Rust language])
-          if test "x$enable_debug" = "xyes"; then
-            RUST_SURICATA_LIB="../rust/target/debug/${RUST_SURICATA_LIBNAME}"
-          else
-            RUST_SURICATA_LIB="../rust/target/release/${RUST_SURICATA_LIBNAME}"
-          fi
-          RUST_LDADD="${RUST_SURICATA_LIB} ${RUST_LDADD}"
-          CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen/c-headers"
-          AC_SUBST(RUST_SURICATA_LIB)
-          AC_SUBST(RUST_LDADD)
-          AC_SUBST([CARGO], [$HAVE_CARGO])
-          if test "x$CARGO_HOME" = "x"; then
+      if test "x$enable_rust" != "xno"; then
+        if test "x$HAVE_CARGO" != "xno"; then
+          if test "x$HAVE_RUSTC" != "xno"; then
+            AC_DEFINE([HAVE_RUST],[1],[Enable Rust language])
+            if test "x$enable_debug" = "xyes"; then
+              RUST_SURICATA_LIB="../rust/target/debug/${RUST_SURICATA_LIBNAME}"
+            else
+              RUST_SURICATA_LIB="../rust/target/release/${RUST_SURICATA_LIBNAME}"
+            fi
+            RUST_LDADD="${RUST_SURICATA_LIB} ${RUST_LDADD}"
+            CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen/c-headers"
+            AC_SUBST(RUST_SURICATA_LIB)
+            AC_SUBST(RUST_LDADD)
+            AC_SUBST([CARGO], [$HAVE_CARGO])
+            if test "x$CARGO_HOME" = "x"; then
               AC_SUBST([CARGO_HOME], [~/.cargo])
-          else
+            else
                  AC_SUBST([CARGO_HOME], [$CARGO_HOME])
-          fi
-          AC_CHECK_FILES([$srcdir/rust/vendor], [have_rust_vendor="yes"])
-          if test "x$have_rust_vendor" = "xyes"; then
+            fi
+            AC_CHECK_FILES([$srcdir/rust/vendor], [have_rust_vendor="yes"])
+            if test "x$have_rust_vendor" = "xyes"; then
                  rust_vendor_comment=""
-          fi
+            fi
 
-          rust_config_enabled="yes"
-          rust_config_comment=""
+            rust_config_enabled="yes"
+            rust_config_comment=""
+            rust_compiler_version=$(rustc --version)
+            rust_cargo_version=$(cargo --version)
+          fi
         fi
       fi
     fi
 
-    AM_CONDITIONAL([HAVE_RUST], [test "x$enable_rust" = "xyes"])
+    AM_CONDITIONAL([HAVE_RUST], [test "x$enable_rust" = "xyes" || test "x$enable_rust" = "xyes (default)"])
     AC_SUBST(rust_vendor_comment)
     AC_SUBST(rust_config_enabled)
     AC_SUBST(rust_config_comment)
     AM_CONDITIONAL([HAVE_RUST_VENDOR], [test "x$have_rust_vendor" = "xyes"])
 
-    if test "x$enable_rust" = "xyes"; then
+    if test "x$enable_rust" = "xyes" || test "x$enable_rust" = "xyes (default)"; then
       AC_PATH_PROG(HAVE_CARGO_VENDOR, cargo-vendor, "no")
       if test "x$HAVE_CARGO_VENDOR" = "xno"; then
         echo "   Warning: cargo-vendor not found, but it is only required"
@@ -2405,9 +2428,11 @@ SURICATA_BUILD_CONF="Suricata Configuration:
   Libnet support:                          ${enable_libnet}
   liblz4 support:                          ${enable_liblz4}
 
-  Rust support (experimental):             ${enable_rust}
+  Rust support:                            ${enable_rust}
   Rust strict mode:                        ${enable_rust_strict}
   Rust debug mode:                         ${enable_rust_debug}
+  Rust compiler:                           ${rust_compiler_version}
+  Rust cargo:                              ${rust_cargo_version}
 
   Suricatasc install:                      ${enable_python}
 
index 99c643589c8d693db817e2c1128057c036d4801f..03777f32eded49ddd94576e18aec8c8e115c89ad 100644 (file)
@@ -1000,7 +1000,7 @@ app-layer:
         dp: 44818
         sp: 44818
 
-    # Note: parser depends on experimental Rust support
+    # Note: parser depends on Rust support
     ntp:
       enabled: @rust_config_enabled@