Hi, I currently write my first atuoconf macro to detect the gm2 Modula-2 compiler for my sdl wrapper. I'm unsure about some details. And some comments from advanced autoconf users would be nice.
Here's the code: AC_DEFUN([ACX_PROG_GM2], [ # Get the gm2 compiler path and check for the rquired version m4_if([$1],[],[AC_FATAL([No gm2 major version given!])], []) AC_MSG_CHECKING([for gm2 (>= $min_gm2_major_version)]) AC_CHECK_PROG([GM2], [gm2], [yes]) if test X$GM2 = xyes ; then GM2="gm2" else AC_MSG_RESULT([not found]) AC_MSG_ERROR([Couldn't find GNU-Modula-2 compiler!]) fi min_gm2_major_version=$1 min_gm2_minor_version=m4_if([$2], ,[0],$2) min_gm2_version=$min_gm2_major_version.$min_gm2_minor_version error_string="Gm2 outdated. Upgrade to version >= $min_gm2_version!" gm2_major_version=`$GM2 --version | \ sed -n 's/[[^ ]]* [[^ ]]* \([[0-9]]\).*/\1/p'` gm2_minor_version=`$GM2 --version | \ sed -n 's/[[^ ]]* [[^ ]]* [[0-9]][[.]]\([[0-9]]*\).*/\1/p'` gm2_version=$gm2_major_version.$gm2_minor_version AC_MSG_RESULT([$gm2_version]) if test $gm2_major_version -lt $min_gm2_major_version ; then AC_MSG_ERROR([$error_string]) if test $gm2_minor_version -lt $min_gm2_minor_version ; then AC_MSG_ERROR([$error_string]) AC_SUBST([GM2]) ])