Fix test for mfiltercc on Solaris.

On Solaris, the 'which' utility does not return a non-zero exit status
to indicate that the program (in this case, "mfiltercc") was not found,
so we ended up treating its error message output as a path.

scripts/mgnuc.in:
	Don't use 'which'.  Simply try to run any copy of mfiltercc on
	the PATH, with empty input.
Pass AR, RANLIB down to libatomic_ops build system.

This allows AR and RANLIB to be overridden.

boehm_gc/Makefile.direct:
boehm_gc/build_atomic_ops.sh:
	As above.
Avoid grep -q in configure.

The Solaris implementation of grep still doesn't support the -q option.

m4/mercury.m4:
	As above.