Tests: replace "which" with "command -v". Under Solaris "which" is totally unusable (it prints garbage to stdout, and doesn't set return code). POSIX's "command -v" seems to work ok on all supported systems.