Use 'command -v' to detect whether and where software is installed (instead of 'which')

With this commit, the external command `which` isn't used anymore. `command -v` should be available for all POSIX conform environments.

Fixes https://github.com/owncloud/core/issues/5911
Fixes executable paths not being detected on ArchLinux (and probably other distros). Detection used to always fail:

> which: no libreoffice in ((null))