configure uses `command -v` instead of `which`

Fixes #13147

Not a shell pro myself, though after running the new config, make and make check still work ok.