--- toast	2011/09/02 00:55:44	1.481
+++ toast	2011/09/14 00:31:57	1.482
@@ -1572,9 +1572,11 @@
 sub optwhich($)
 {
   my($prog) = @_;
+  local($_);
   for(split(/:/, $ENV{"PATH"}))
   {
-    my($path) = path($_, $prog);
+    next if $_ eq "";
+    my($path) = laxpath($_, $prog);
     $path = abspath($path) unless $path =~ m!^/!;
     return $path if -x($path);
   }
@@ -2992,14 +2994,9 @@
 sub helpccache($$$)
 {
   my($rootdir, $helperdir, $cmd) = @_;
-  return true unless ccache;
+  return true unless ccache && optwhich("ccache");
 
-  my($path) = $ENV{"PATH"};
-  my($found);
-  $found ||= -x(laxpath($_, "ccache")) for split(/:/, $path);
-  return true unless $found;
-
-  my $qpath = quote($path);
+  my $qpath = quote($ENV{"PATH"});
   for($cmd, "$cmd.helper")
   {
     writescript(path($helperdir, $_), qq[#!/bin/sh