aclocal: Fix Python and Perl checking macros.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 8 Feb 2006 19:45:03 +0000 (19:45 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 8 Feb 2006 19:45:03 +0000 (19:45 +0000)
  * Both were grievously broken, trying to run binaries which just
    didn't exist.  Check existence (and executability) of binaries
    before actually running them.

  * Python version checking had m4 quoting problems.  Fix them by
    liberal application of changequote.

  * Both failed to quote the proposed binary names properly.  This
    probably wasn't a problem, but I wouldn't put money on it.

aclocal.glob

index b983ce6..a2ab1f6 100644 (file)
@@ -164,9 +164,12 @@ dnl Will fail hopelessly on Python < 1.5.2.  Nobody uses that any more,
 dnl right?
 
 AC_DEFUN([mdw__PYTHON_VERSION],
-[$1 -c 'from sys import *; v = argv[1]; vv = v.split("."); x = 0
+[changequote(<:, :>)dnl
+test -x $1 && dnl
+"$1" -c 'from sys import *; v = argv[1]; vv = v.split("."); x = 0
 for i in range(len(vv)): x = x | (int(vv[i]) << (24 - i * 8))
-exit(x > hexversion)' $2])
+exit(x > hexversion)' $2dnl
+changequote([, ])])
 
 dnl --- *@-mdw_PROG_PYTHON-@* ---
 dnl
@@ -197,7 +200,7 @@ if test -z "$PYTHON"; then
 [AC_CACHE_CHECK([for Python version $1 or later], mdw_cv_prog_python,
 [mdw_cv_prog_python="none"
 for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do
-  case $p in /*) ;; *) p=`pwd`/$p ;; esac
+  case "$p" in /*) ;; *) p=`pwd`/$p ;; esac
   if mdw__PYTHON_VERSION(["$p/python"], $1); then
     mdw_cv_prog_python="$p/python"
     break
@@ -246,8 +249,9 @@ dnl
 dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level.
 
 AC_DEFUN([mdw__PERL_VERSION], [mdw__PERL_VERSION_hack([$1], [$2])])
-changequote(<<, >>)
-define(<<mdw__PERL_VERSION_hack>>, <<$1 -e 'exit ($] < $2);' >&5 2>&5>>)
+changequote(<:, :>)
+define(<:mdw__PERL_VERSION_hack:>, 
+<:test -x $1 && $1 -e 'exit ($] < $2);' >&5 2>&5:>)
 changequote([, ])
 
 dnl --- *@-mdw_PROG_PERL-@* ---
@@ -278,7 +282,7 @@ if test -z "$PERL"; then
 [AC_CACHE_CHECK([for Perl version $1 or later], mdw_cv_prog_perl,
 [mdw_cv_prog_perl="none"
 for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do
-  case $p in /*) ;; *) p=`pwd`/$p ;; esac
+  case "$p" in /*) ;; *) p=`pwd`/$p ;; esac
   if mdw__PERL_VERSION(["$p/perl"], $1); then
     mdw_cv_prog_perl="$p/perl"
     break