From 9bc707bb7a391f89cb5c0bd76fa79bece86957ea Mon Sep 17 00:00:00 2001 From: Vivek Thampi Date: Wed, 20 Feb 2013 23:31:45 -0800 Subject: [PATCH] Add configure check for yasm version (>= 1.2.0) --- configure.ac | 9 +++--- m4/ax_prog_yasm_version.m4 | 60 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 m4/ax_prog_yasm_version.m4 diff --git a/configure.ac b/configure.ac index 709ea03..0c34f43 100644 --- a/configure.ac +++ b/configure.ac @@ -50,13 +50,14 @@ if test "x$PYTHON" = "x"; then AC_MSG_ERROR( [Python not found. Use --with-python to specify path to python binary] ) fi -# Yasm for testing +# Yasm (>= 1.2.0) for testing AX_WITH_PROG(YASM,yasm) -AM_CONDITIONAL(HAVE_YASM, [test ! -z "$YASM"]) +AX_PROG_YASM_VERSION([1.2.0],[ac_have_yasm_version=1],[]) +AM_CONDITIONAL(HAVE_YASM, [test -n "$ac_have_yasm_version"]) -# Sphix for documentation +# Sphinx (>= 1.1.3) for documentation AX_WITH_PROG(SPHINX_BUILD,sphinx-build) -AX_PROG_SPHINX([1.1.3],[ac_have_sphinx_version=1][]) +AX_PROG_SPHINX([1.1.3],[ac_have_sphinx_version=1],[]) AM_CONDITIONAL(HAVE_SPHINX_DOC, [test -n "$ac_have_sphinx_version"]) AC_CHECK_HEADERS([assert.h stdio.h]) diff --git a/m4/ax_prog_yasm_version.m4 b/m4/ax_prog_yasm_version.m4 new file mode 100644 index 0000000..9adafcb --- /dev/null +++ b/m4/ax_prog_yasm_version.m4 @@ -0,0 +1,60 @@ +# SYNOPSIS +# +# AX_PROG_YASM_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE]) +# +# DESCRIPTION +# +# Makes sure that yasm supports the version indicated. If true +# the shell commands in ACTION-IF-TRUE are executed. If not the shell +# commands in ACTION-IF-FALSE are run. Note if $YASM is not set +# (for example by running AX_WITH_PROG) the macro will fail. +# +# Example: +# +# AX_WITH_PROG(YASM,yasm) +# AX_PROG_YASM_VERSION([1.1.1],[ ... ],[ ... ]) +# +# LICENSE +# +# ax_prog_python_version.m4 +# +# Copyright (c) 2009 Francesco Salvestrini +# +# 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. +# +# ax_prog_yasm_version.m4 +# +# Copyright (c) 2013 Vivek Thampi + + +AC_DEFUN([AX_PROG_YASM_VERSION],[ + AC_REQUIRE([AC_PROG_SED]) + AC_REQUIRE([AC_PROG_GREP]) + + + AS_IF([test -n "$YASM"],[ + ax_yasm_version="$1" + + AC_MSG_CHECKING([for yasm version]) + changequote(<<,>>) + yasm_version=`$YASM --version 2>&1 | $GREP "^yasm " | $SED -e 's/^.* \([0-9]*\.[0-9]*\.[0-9]*\)/\1/'` + changequote([,]) + AC_MSG_RESULT($yasm_version) + + AC_SUBST([YASM_VERSION],[$yasm_version]) + + AX_COMPARE_VERSION([$ax_yasm_version],[le],[$yasm_version],[ + : + $2 + ],[ + : + $3 + ]) + ],[ + AC_MSG_WARN([could not find the yasm]) + $3 + ]) +])