AC_DEFUN([ACX_PROG_GM2], [ # Get the gm2 compiler path and check for the required version # the compiler command is stored in GM2 AC_ARG_WITH([gm2-prefix], [AC_HELP_STRING([--with-gm2-prefix=PFX], [Prefix where gm2 is installed (optional)])], [gm2_prefix=$withval], [gm2_prefix=$PATH:/opt/gm2/bin:$HOME/opt/bin]) m4_if([$1],[],[AC_FATAL([No gm2 major version given!])], []) AC_CHECK_TOOL([GM2], [gm2], [:]) if test x$GM2 = x: ; then AC_MSG_ERROR([Couldn't find GNU-Modula-2 compiler! Is gm2 in your PATH?]) fi AC_MSG_CHECKING([for gm2 - version]) min_gm2_version=$1 min_gm2_major_version=`echo "$1" | \ sed 's/\([[0-9]]*\)[[.]][[0-9]]*/\1/'` min_gm2_minor_version=`echo "$1" | \ sed 's/[[0-9]]*[[.]]\([[0-9]]*\)/\1/'` gm2_version_str=`$GM2 --version` gm2_major_version=`echo "$gm2_version_str" | \ sed -n 's/[[^ ]]* [[^ ]]* \([[0-9]]\).*/\1/p'` gm2_minor_version=`echo "$gm2_version_str" | \ sed -n 's/[[^ ]]* [[^ ]]* [[0-9]][[.]]\([[0-9]]*\).*/\1/p'` gm2_version="$gm2_major_version.$gm2_minor_version" AC_MSG_RESULT([$gm2_version]) error_string="Gm2 outdated. Upgrade to version >= $min_gm2_version!" if test $gm2_major_version -lt $min_gm2_major_version ; then AC_MSG_ERROR([$error_string]) fi if test $gm2_minor_version -lt $min_gm2_minor_version ; then AC_MSG_ERROR([$error_string]) fi ])