We are trying to find a way to craft a GNUmakefile that works on nearly all Unix compatibles. We were using `egrep` but it failed on MinGW. We switched to `grep -E` because it is [Posix](http://pubs.opengroup.org/onlinepubs/9699919799/), but testing shows it is failing on Solaris 11.
A typical usage in the makefile is:
GREP ?= grep
...
IS_X86 := $(shell uname -m | $(GREP) -v "x86_64" | $(GREP) -i -c -E "i.86|x86|i86")
IS_X64 := $(shell uname -m | $(GREP) -i -c -E "(_64|d64)")
The result is:
grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
grep: illegal option -- E
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
...
I don't see where `-E` and `-F` are optional in Posix (perhaps I missed it).
I found [Difference between Solaris and POSIX](https://stackoverflow.com/q/6599213/608639) on Stack Overflow, but it states, *"Solaris has a full set of POSIX interfaces ..."*.
Why is Solaris' `grep` failing to consume `-E`? Is there a way to engage regular expression support on Solaris besides switching to `egrep`?