diff options
-rwxr-xr-x | autogen.sh | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | m4/ax_python_module.m4 | 49 | ||||
-rw-r--r-- | m4/spice-deps.m4 | 19 |
4 files changed, 71 insertions, 1 deletions
@@ -15,5 +15,5 @@ autoreconf --verbose --force --install cd "$olddir" if [ -z "$NOCONFIGURE" ]; then - "$srcdir"/configure --enable-maintainer-mode ${1+"$@"} + "$srcdir"/configure --enable-maintainer-mode --enable-python-checks ${1+"$@"} fi diff --git a/configure.ac b/configure.ac index 73102c0..3a8c0e5 100644 --- a/configure.ac +++ b/configure.ac @@ -36,6 +36,8 @@ AC_CONFIG_SUBDIRS([spice-protocol]) PROTOCOL_CFLAGS='-I ${top_srcdir}/spice-protocol' AC_SUBST(PROTOCOL_CFLAGS) +SPICE_CHECK_PYTHON_MODULES() + SPICE_CHECK_PIXMAN(SPICE_COMMON) SPICE_CHECK_SMARTCARD(SPICE_COMMON) SPICE_CHECK_CELT051(SPICE_COMMON) diff --git a/m4/ax_python_module.m4 b/m4/ax_python_module.m4 new file mode 100644 index 0000000..3afc404 --- /dev/null +++ b/m4/ax_python_module.m4 @@ -0,0 +1,49 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_python_module.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PYTHON_MODULE(modname[, fatal]) +# +# DESCRIPTION +# +# Checks for Python module. +# +# If fatal is non-empty then absence of a module will trigger an error. +# +# LICENSE +# +# Copyright (c) 2008 Andrew Collier +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE]) +AC_DEFUN([AX_PYTHON_MODULE],[ + if test -z $PYTHON; + then + PYTHON="python" + fi + PYTHON_NAME=`basename $PYTHON` + AC_MSG_CHECKING($PYTHON_NAME module: $1) + $PYTHON -c "import $1" 2>/dev/null + if test $? -eq 0; + then + AC_MSG_RESULT(yes) + eval AS_TR_CPP(HAVE_PYMOD_$1)=yes + else + AC_MSG_RESULT(no) + eval AS_TR_CPP(HAVE_PYMOD_$1)=no + # + if test -n "$2" + then + AC_MSG_ERROR(failed to find required module $1) + exit 1 + fi + fi +]) diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4 index 2477dbc..600dd98 100644 --- a/m4/spice-deps.m4 +++ b/m4/spice-deps.m4 @@ -154,3 +154,22 @@ AC_DEFUN([SPICE_CHECK_GLIB2], [ AS_VAR_APPEND([$1_CFLAGS], [" $GLIB2_CFLAGS"]) AS_VAR_APPEND([$1_LIBS], [" $GLIB2_LIBS"]) ]) + +# SPICE_CHECK_PYTHON_MODULES() +# -------------------------- +# Adds a --enable-python-checks configure flags as well as checks for the +# availability of the python modules needed by the python scripts generating +# C code from spice.proto. These checks are not needed when building from +# tarballs so they are disabled by default. +#--------------------------- +AC_DEFUN([SPICE_CHECK_PYTHON_MODULES], [ + AC_ARG_ENABLE([python-checks], + AS_HELP_STRING([--enable-python-checks=@<:@yes/no@:>@], + [Enable checks for Python modules needed to build from git @<:@default=no@:>@]), + [], + [enable_python_checks="no"]) + if test "x$enable_python_checks" != "xno"; then + AX_PYTHON_MODULE([six], [1]) + AX_PYTHON_MODULE([pyparsing], [1]) + fi +]) |