set exclude-dir or exclude grep flags only if available
Merge pull request #2650 from kemko/patch-1

don't add --exclude-dir to GREP_OPTIONS on FreeBSD