Skip to content

Commit

Permalink
m4: Add hard requirements for python in "configure"
Browse files Browse the repository at this point in the history
Since Python 2.7 and python-six are needed to build Open vSwitch,
./configure should return an error if they are missing or if they are too old

Signed-off-by: Timothy Redaelli <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
Tested-by: Timothy Redaelli <[email protected]>
Tested-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-April/330565.html
  • Loading branch information
drizzt authored and blp committed Apr 7, 2017
1 parent bfee85b commit 7777d53
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions m4/openvswitch.m4
Original file line number Diff line number Diff line change
Expand Up @@ -341,22 +341,26 @@ else:
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_PYTHON])
# Set $PYTHON from cache variable.
if test $ovs_cv_python = no; then
AC_MSG_ERROR([cannot find python 2.7 or higher.])
fi
AM_MISSING_PROG([PYTHON], [python])
if test $ovs_cv_python != no; then
PYTHON=$ovs_cv_python
HAVE_PYTHON=yes
else
HAVE_PYTHON=no
PYTHON=$ovs_cv_python
# HAVE_PYTHON is always true. (Python has not always been a build
# requirement, so this variable is now obsolete.)
AC_SUBST([HAVE_PYTHON])
HAVE_PYTHON=yes
AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])
AC_MSG_CHECKING([whether $PYTHON has six library])
if ! $PYTHON -c 'import six ; six.moves.range' >AS_MESSAGE_LOG_FD 2>&1; then
AC_MSG_ERROR([Missing Python six library or version too old.])
fi
AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])
AC_MSG_RESULT([yes])])

dnl Checks for Python 3.x, x >= 4.
AC_DEFUN([OVS_CHECK_PYTHON3],
Expand Down

0 comments on commit 7777d53

Please sign in to comment.