diff --git a/configure.ac b/configure.ac index 43807c8a37..9a786ee50e 100644 --- a/configure.ac +++ b/configure.ac @@ -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} diff --git a/suricata.yaml.in b/suricata.yaml.in index 99c643589c..03777f32ed 100644 --- a/suricata.yaml.in +++ b/suricata.yaml.in @@ -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@