Generalise findProgramOnSearchPath to calculate locations looked in
Generalise findProgramOnSearchPath to calculate locations looked in

But in this patch, don't actually return them yet, so not yet changing
the resturn type.

The purpose here is change monitoring. In cabal-install we want to be
able to automatically re-run various actions when the build environment
changes, including when programs have changed (e.g. due to a $PATH
change, finding the compiler in a different location). The basic
information required for such change monitoring is not only the location
where a program was ultimately found, but all the locations where it was
looked for and not found. Otherwise one will miss the case where having
previously found the program in one location, later on the program
appears earlier in the search path. In this case a build system should
notice and react, but if it only monitors the ultimate location where
the program was found then this is impossible. The build system also
needs to monitor the locations where the program was not found, to make
sure it is still not there. This principle actually applies anytime we
have a file search (e.g. hs-source-dirs), programs are just one example.

lukexi/cabal,bennofs/cabal,randen/cabal,gbaz/cabal,sopvop/cabal,sopvop/cabal,thomie/cabal,gbaz/cabal,thomie/cabal,Heather/cabal,mydaum/cabal,themoritz/cabal,lukexi/cabal,garetxe/cabal,headprogrammingczar/cabal,edsko/cabal,themoritz/cabal,sopvop/cabal,kolmodin/cabal,bennofs/cabal,kolmodin/cabal,headprogrammingczar/cabal,themoritz/cabal,mydaum/cabal,martinvlk/cabal,martinvlk/cabal,garetxe/cabal,randen/cabal,edsko/cabal,Heather/cabal