build: only attempt to use -Og if it's supported

Commit a1d411f9c991c03488c74c6266eb37cc2bab970e just assumes that gcc
will support the `-Og` option, but gcc that comes with Ubuntu 12.04 does
not.  Let's check to see if the flag is supported, and then decide
whether to enable it or not.
Merge pull request #1440 from jszakmeister/fix-og-flag-usage

build: only attempt to use -Og if it's supported