Change the way we detect existing commands

`which` seems not very portable, so use `type` instead, because "type is standardized in POSIX" (thx @dbuenzli).

This should fix #471 and improve the BSD support.
Update CHANGES