]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
autoconf: prefer python 3 over python 2
authorJason Ish <ish@unx.ca>
Mon, 11 Feb 2019 17:27:38 +0000 (11:27 -0600)
committerJason Ish <ish@unx.ca>
Sat, 9 Mar 2019 13:57:35 +0000 (07:57 -0600)
When looking for Python, prefer "python3" over "python2" and
"python".

Also add information about the Python path and version to the
./configure summary.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2808

configure.ac

index c94b7e7406dea9fb28f2f3d152bd4d196ca6e5bd..34c79cb91d9d58d876f86c958e3c3431134c8f9f 100644 (file)
         exit 1
     fi
 
+    python_version="not set"
+    python_path="not set"
+
     AC_ARG_ENABLE(python,
-           AS_HELP_STRING([--enable-python], [Enable python]),[enable_python=$enableval],[enable_python=yes])
-    AC_PATH_PROGS(HAVE_PYTHON, python python2 python2.7, "no")
-    if test "x$enable_python" = "xno" ; then
-        echo
-        echo "   Warning! python disabled, you will not be      "
-        echo "   able to install suricatasc unix socket client   "
-        echo
-        enable_python="no"
-    fi
-    if test "$HAVE_PYTHON" = "no"; then
-        echo
-        echo "   Warning! python not found, you will not be     "
-        echo "   able to install suricatasc unix socket client   "
-        echo
+           AS_HELP_STRING([--enable-python], [Enable python]),
+          [enable_python=$enableval],[enable_python=yes])
+    if test "x$enable_python" != "xyes"; then
         enable_python="no"
+    else
+        AC_PATH_PROGS(HAVE_PYTHON, python3 python2.7 python2 python, "no")
+        if test "$HAVE_PYTHON" = "no"; then
+            echo
+            echo "   Warning! python not found, you will not be     "
+            echo "   able to install suricatasc unix socket client   "
+            echo
+            enable_python="no"
+       else
+           python_path="$HAVE_PYTHON"
+           python_version="$($HAVE_PYTHON --version)"
+        fi
     fi
     AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" = "xyes"])
 
@@ -2539,6 +2543,9 @@ SURICATA_BUILD_CONF="Suricata Configuration:
   Rust compiler:                           ${rust_compiler_version}
   Rust cargo:                              ${rust_cargo_version}
 
+  Python support:                          ${enable_python}
+  Python path:                             ${python_path}
+  Python version:                          ${python_version}
   Install suricatasc:                      ${enable_python}
   Install suricata-update:                 ${install_suricata_update}