rust: enable by default

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.
pull/3500/head
Victor Julien 7 years ago
parent 4ece6ba758
commit ed712768d5

@ -2170,14 +2170,20 @@ fi
AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$enable_pdflatex" != "xno"]) AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$enable_pdflatex" != "xno"])
# Cargo/Rust. # 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_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_config_comment="#" # used in suricata.yaml.in to enable/disable eve loggers
rust_vendor_comment="# " rust_vendor_comment="# "
have_rust_vendor="no" 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" enable_rust="no"
else else
# Rust require jansson (json support). # Rust require jansson (json support).
@ -2189,7 +2195,11 @@ fi
echo " Fedora: dnf install jansson-devel" echo " Fedora: dnf install jansson-devel"
echo " CentOS/RHEL: yum install jansson-devel" echo " CentOS/RHEL: yum install jansson-devel"
echo "" echo ""
exit 1 if test "x$enable_rust" = "xyes"; then
exit 1
fi
echo " Rust support will be disabled."
enable_rust="no"
fi fi
AC_PATH_PROG(HAVE_CARGO, cargo, "no") AC_PATH_PROG(HAVE_CARGO, cargo, "no")
@ -2205,56 +2215,69 @@ fi
echo " Fedora: dnf install cargo" echo " Fedora: dnf install cargo"
echo " CentOS/RHEL: yum install cargo" echo " CentOS/RHEL: yum install cargo"
echo "" echo ""
exit 1 if test "x$enable_rust" = "xyes"; then
exit 1
fi
echo " Rust support will be disabled."
enable_rust="no"
fi fi
if test "x$HAVE_RUST" = "xno"; then if test "x$HAVE_RUST" = "xno"; then
echo "" echo ""
echo " ERROR! Rust support requested but rustc not found." echo " ERROR! Rust support requested but rustc not found."
echo echo
echo " Ubuntu: apt-get install rustc" 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 " Fedora: dnf install rust"
echo " CentOS/RHEL: yum install rust" echo " CentOS/RHEL: yum install rust"
echo "" echo ""
exit 1 if test "x$enable_rust" = "xyes"; then
exit 1
fi
echo " Rust support will be disabled."
enable_rust="no"
fi fi
if test "x$HAVE_CARGO" != "xno"; then if test "x$enable_rust" != "xno"; then
if test "x$HAVE_RUSTC" != "xno"; then if test "x$HAVE_CARGO" != "xno"; then
enable_rust="yes" if test "x$HAVE_RUSTC" != "xno"; then
AC_DEFINE([HAVE_RUST],[1],[Enable Rust language]) AC_DEFINE([HAVE_RUST],[1],[Enable Rust language])
if test "x$enable_debug" = "xyes"; then if test "x$enable_debug" = "xyes"; then
RUST_SURICATA_LIB="../rust/target/debug/${RUST_SURICATA_LIBNAME}" RUST_SURICATA_LIB="../rust/target/debug/${RUST_SURICATA_LIBNAME}"
else else
RUST_SURICATA_LIB="../rust/target/release/${RUST_SURICATA_LIBNAME}" RUST_SURICATA_LIB="../rust/target/release/${RUST_SURICATA_LIBNAME}"
fi fi
RUST_LDADD="${RUST_SURICATA_LIB} ${RUST_LDADD}" RUST_LDADD="${RUST_SURICATA_LIB} ${RUST_LDADD}"
CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen/c-headers" CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen/c-headers"
AC_SUBST(RUST_SURICATA_LIB) AC_SUBST(RUST_SURICATA_LIB)
AC_SUBST(RUST_LDADD) AC_SUBST(RUST_LDADD)
AC_SUBST([CARGO], [$HAVE_CARGO]) AC_SUBST([CARGO], [$HAVE_CARGO])
if test "x$CARGO_HOME" = "x"; then if test "x$CARGO_HOME" = "x"; then
AC_SUBST([CARGO_HOME], [~/.cargo]) AC_SUBST([CARGO_HOME], [~/.cargo])
else else
AC_SUBST([CARGO_HOME], [$CARGO_HOME]) AC_SUBST([CARGO_HOME], [$CARGO_HOME])
fi fi
AC_CHECK_FILES([$srcdir/rust/vendor], [have_rust_vendor="yes"]) AC_CHECK_FILES([$srcdir/rust/vendor], [have_rust_vendor="yes"])
if test "x$have_rust_vendor" = "xyes"; then if test "x$have_rust_vendor" = "xyes"; then
rust_vendor_comment="" rust_vendor_comment=""
fi fi
rust_config_enabled="yes" rust_config_enabled="yes"
rust_config_comment="" rust_config_comment=""
rust_compiler_version=$(rustc --version)
rust_cargo_version=$(cargo --version)
fi
fi fi
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_vendor_comment)
AC_SUBST(rust_config_enabled) AC_SUBST(rust_config_enabled)
AC_SUBST(rust_config_comment) AC_SUBST(rust_config_comment)
AM_CONDITIONAL([HAVE_RUST_VENDOR], [test "x$have_rust_vendor" = "xyes"]) 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") AC_PATH_PROG(HAVE_CARGO_VENDOR, cargo-vendor, "no")
if test "x$HAVE_CARGO_VENDOR" = "xno"; then if test "x$HAVE_CARGO_VENDOR" = "xno"; then
echo " Warning: cargo-vendor not found, but it is only required" echo " Warning: cargo-vendor not found, but it is only required"
@ -2405,9 +2428,11 @@ SURICATA_BUILD_CONF="Suricata Configuration:
Libnet support: ${enable_libnet} Libnet support: ${enable_libnet}
liblz4 support: ${enable_liblz4} liblz4 support: ${enable_liblz4}
Rust support (experimental): ${enable_rust} Rust support: ${enable_rust}
Rust strict mode: ${enable_rust_strict} Rust strict mode: ${enable_rust_strict}
Rust debug mode: ${enable_rust_debug} Rust debug mode: ${enable_rust_debug}
Rust compiler: ${rust_compiler_version}
Rust cargo: ${rust_cargo_version}
Suricatasc install: ${enable_python} Suricatasc install: ${enable_python}

@ -1000,7 +1000,7 @@ app-layer:
dp: 44818 dp: 44818
sp: 44818 sp: 44818
# Note: parser depends on experimental Rust support # Note: parser depends on Rust support
ntp: ntp:
enabled: @rust_config_enabled@ enabled: @rust_config_enabled@

Loading…
Cancel
Save