1.1 --- a/common/autoconf/basics.m4 Tue Dec 18 09:57:01 2012 +0100 1.2 +++ b/common/autoconf/basics.m4 Tue Dec 18 17:54:39 2012 +0100 1.3 @@ -90,13 +90,25 @@ 1.4 tmp="$complete EOL" 1.5 arguments="${tmp#* }" 1.6 1.7 - new_path=`$WHICH $path 2> /dev/null` 1.8 + # Cannot rely on the command "which" here since it doesn't always work. 1.9 + is_absolute_path=`$ECHO "$path" | $GREP ^/` 1.10 + if test -z "$is_absolute_path"; then 1.11 + # Path to executable is not absolute. Find it. 1.12 + IFS_save="$IFS" 1.13 + IFS=: 1.14 + for p in $PATH; do 1.15 + if test -f "$p/$path" && test -x "$p/$path"; then 1.16 + new_path="$p/$path" 1.17 + break 1.18 + fi 1.19 + done 1.20 + IFS="$IFS_save" 1.21 + else 1.22 + AC_MSG_NOTICE([Resolving $1 (as $path) failed, using $path directly.]) 1.23 + new_path="$path" 1.24 + fi 1.25 + 1.26 if test "x$new_path" = x; then 1.27 - is_absolute_path=`$ECHO "$path" | $GREP ^/` 1.28 - if test "x$is_absolute_path" != x; then 1.29 - AC_MSG_NOTICE([Resolving $1 (as $path) with 'which' failed, using $path directly.]) 1.30 - new_path="$path" 1.31 - else 1.32 AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) 1.33 has_space=`$ECHO "$complete" | $GREP " "` 1.34 if test "x$has_space" != x; then 1.35 @@ -104,20 +116,19 @@ 1.36 fi 1.37 AC_MSG_ERROR([Cannot locate the the path of $1]) 1.38 fi 1.39 - fi 1.40 fi 1.41 1.42 - # Now join together the path and the arguments once again 1.43 - if test "x$arguments" != xEOL; then 1.44 - new_complete="$new_path ${arguments% *}" 1.45 - else 1.46 - new_complete="$new_path" 1.47 - fi 1.48 + # Now join together the path and the arguments once again 1.49 + if test "x$arguments" != xEOL; then 1.50 + new_complete="$new_path ${arguments% *}" 1.51 + else 1.52 + new_complete="$new_path" 1.53 + fi 1.54 1.55 if test "x$complete" != "x$new_complete"; then 1.56 - $1="$new_complete" 1.57 - AC_MSG_NOTICE([Rewriting $1 to "$new_complete"]) 1.58 - fi 1.59 + $1="$new_complete" 1.60 + AC_MSG_NOTICE([Rewriting $1 to "$new_complete"]) 1.61 + fi 1.62 ]) 1.63 1.64 AC_DEFUN([BASIC_REMOVE_SYMBOLIC_LINKS],