Avoid unnecessary sed calls for every libtool arg.

We only care about the optarg of --mode=, so just use shell
substitution in that case rather than running sed(1) for every option
which starts with "--=".
Replace a call to cat(1) with echo builtin.
Replace an expr(1) call with $(()) builtin.
Avoid using /bin/print on SunOS.

It isn't a bash builtin, but is tested first before printf, so we end
up using it and having to exec it many times.  Make it a bogus command
so that we pick the builtin printf instead.
Play fast and loose with the cache file.