Don't use `which`, use the POSIX standard `command -v`. For example:
COMPRESS_OPTION="$(command -v compress)"
[ $? != 0 ] && echo "compress not found" || echo "compress is $COMPRESS_OPTION"
If you don't want to change all the instances of `which` in your script, add a function like the following near the start:
which() {
local w status
w="$(command -v "$1")"
status=$?
[ -n "$w" ] && echo "$w"
return $status
}