Optimize tools detection by saving the result and reusing it.

Instead of iterating through every tool and every path every time,
save the result as a module file and use that if available. If a tool
is added you will need to delete the cached file or run "make clean"
to register it.