diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2009-02-06 12:28:03 -0800 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2009-03-17 10:34:02 -0700 |
commit | 21a957428aa69b03f585378dc6e70ad9f5c513c6 (patch) | |
tree | 25bae0f797aac0f95cc6eec18db05e738587e10b | |
parent | 72d82ed965f9cfbc310897ec17d2dc10bddcef4e (diff) |
Use m4 for XORG_MACROS_VERSION to error during autoconf
Check the needed macros version with m4 so that the proper version is
determined during autoconf. This prevents a faulty configure from being
generated.
Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
-rw-r--r-- | xorg-macros.m4.in | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in index 66d80a9..80216e2 100644 --- a/xorg-macros.m4.in +++ b/xorg-macros.m4.in @@ -42,21 +42,17 @@ dnl of the copyright holder. # # See the "minimum version" comment for each macro you use to see what # version you require. -AC_DEFUN([XORG_MACROS_VERSION],[ - [XORG_MACROS_needed_version=$1 - XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'` - XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`] - AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}]) - [XORG_MACROS_version=@VERSION@ - XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'` - XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`] - if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then - AC_MSG_ERROR([configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_needed_major}.x]) - fi - if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then - AC_MSG_ERROR([configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}.0 or newer]) - fi - AC_MSG_RESULT([yes, $XORG_MACROS_version]) +m4_defun([XORG_MACROS_VERSION],[ +m4_define([vers_have], [@VERSION@]) +m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) +m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) +m4_if(m4_cmp(maj_have, maj_needed), 0,, + [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])]) +m4_if(m4_version_compare(vers_have, [$1]), -1, + [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])]) +m4_undefine([vers_have]) +m4_undefine([maj_have]) +m4_undefine([maj_needed]) ]) # XORG_MACROS_VERSION # XORG_PROG_RAWCPP() |