diff options
Diffstat (limited to 'm4/ctng_version_check.m4')
-rw-r--r-- | m4/ctng_version_check.m4 | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/m4/ctng_version_check.m4 b/m4/ctng_version_check.m4 index 703661b6..4518e0c1 100644 --- a/m4/ctng_version_check.m4 +++ b/m4/ctng_version_check.m4 @@ -11,14 +11,27 @@ AC_DEFUN([CTNG_PROG_VERSION], CTNG_WITH_DEPRECATED([$3], [$1]) AC_ARG_VAR([$1], [Specify the full path to $2]) ctng_version_$1_ok=false - AC_CACHE_CHECK([for $3], [ac_cv_path_$1], - [AC_PATH_PROGS_FEATURE_CHECK([$1], [$4], - [[ver=$($ac_path_$1 --version 2>/dev/null| $EGREP $5) - test -z "$ac_cv_path_$1" && ac_cv_path_$1=$ac_path_$1 - test -n "$ver" && ac_cv_path_$1="$ac_path_$1" ac_path_$1_found=: ctng_version_$1_ok=:]])]) + # If a variable is already set, check if it an absolute path and convert if not. + # Autoconf's AC_PATH_PROGS* macros just blindly trust $1 to be correct - but + # AWK is set to just the command name by AC_INIT. AS_IF([test -n "$$1"], - [[ver=$($ac_cv_path_$1 --version 2>/dev/null| $EGREP $5) - test -n "$ver" && ctng_version_$1_ok=:]]) + [ac_cv_path_$1="$$1" + CTNG_PATH_ABSNAME([ac_cv_path_$1]) + CTNG_MSG_LOG_ENVVAR([ac_cv_path_$1]) + ver=$($ac_cv_path_$1 --version 2>/dev/null) + CTNG_MSG_LOG([looking for '[$5]' regexp in]) + CTNG_MSG_LOG_ENVVAR([ver], [version info for $ac_cv_path_$1]) + ver=$(AS_ECHO(["$ver"]) | $EGREP '[$5]') + test -n "$ver" && ctng_version_$1_ok=:], + [AC_CACHE_CHECK([for $3], [ac_cv_path_$1], + [AC_PATH_PROGS_FEATURE_CHECK([$1], [$4], + [CTNG_MSG_LOG_ENVVAR([ac_path_$1], [checking $1 at]) + ver=$($ac_path_$1 --version 2>/dev/null) + CTNG_MSG_LOG([looking for '[$5]' regexp in]) + CTNG_MSG_LOG_ENVVAR([ver], [version info]) + ver=$(AS_ECHO(["$ver"]) | $EGREP '[$5]') + test -z "$ac_cv_path_$1" && ac_cv_path_$1=$ac_path_$1 + test -n "$ver" && ac_cv_path_$1="$ac_path_$1" ac_path_$1_found=: ctng_version_$1_ok=:])])]) AC_MSG_CHECKING([for $2]) AS_IF([$ctng_version_$1_ok], [AC_MSG_RESULT([yes])], |