summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorRussell Bryant <russell@ovn.org>2015-12-17 19:58:33 -0500
committerRussell Bryant <russell@ovn.org>2016-02-22 15:17:27 -0500
commit8fb7d02686ed85ad799dfd902ea88d977dab1868 (patch)
tree6ff3d96c45b1aad17fa010dd62a5e635877c9624 /m4
parent64eb96a9af0917a4c7b8e0441d2e49404fd247d5 (diff)
downloadopenvswitch-8fb7d02686ed85ad799dfd902ea88d977dab1868.tar.gz
configure: Check for presence of Python 3.
The configure script already checked for Python 2 (>=2.7). Add another check for Python 3 (>=3.4). This will be used later for automatically running tests with Python 3 as well if available. Signed-off-by: Russell Bryant <russell@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'm4')
-rw-r--r--m4/openvswitch.m442
1 files changed, 42 insertions, 0 deletions
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 0149c3078..fa85d3f30 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -358,6 +358,48 @@ else:
fi
AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])
+dnl Checks for Python 3.x, x >= 4.
+AC_DEFUN([OVS_CHECK_PYTHON3],
+ [AC_CACHE_CHECK(
+ [for Python 3.x for x >= 4],
+ [ovs_cv_python3],
+ [if test -n "$PYTHON3"; then
+ ovs_cv_python3=$PYTHON3
+ else
+ ovs_cv_python3=no
+ for binary in python3 python3.4; do
+ ovs_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ for dir in $PATH; do
+ IFS=$ovs_save_IFS
+ test -z "$dir" && dir=.
+ if test -x "$dir"/"$binary" && "$dir"/"$binary" -c 'import sys
+if sys.hexversion >= 0x03040000 and sys.hexversion < 0x04000000:
+ sys.exit(0)
+else:
+ sys.exit(1)'; then
+ ovs_cv_python3=$dir/$binary
+ break 2
+ fi
+ done
+ done
+ if test $ovs_cv_python != no; then
+ if test -x "$ovs_cv_python" && ! "$ovs_cv_python" -c 'import six' >/dev/null 2>&1; then
+ ovs_cv_python=no
+ AC_MSG_WARN([Missing Python six library.])
+ fi
+ fi
+ fi])
+ AC_SUBST([HAVE_PYTHON3])
+ AM_MISSING_PROG([PYTHON3], [python3])
+ if test $ovs_cv_python3 != no; then
+ PYTHON3=$ovs_cv_python3
+ HAVE_PYTHON3=yes
+ else
+ HAVE_PYTHON3=no
+ fi
+ AM_CONDITIONAL([HAVE_PYTHON3], [test "$HAVE_PYTHON3" = yes])])
+
+
dnl Checks for dot.
AC_DEFUN([OVS_CHECK_FLAKE8],
[AC_CACHE_CHECK(