Autoconf warnings

See individual commit messages for description.

Many of these warnings should be quickly fixed or worked around rather than disabling them, but I'd rather not mix code changes in with these, and do those as a next step if this is desired.

The whitespace changes in the .h make the diff hard to read, but the change is simple: if we're building internally, use the autoconf checks. Everything else is moved to the else block.