Fixed Ubuntu 32bit detection.
Clean up detection mechanism for detecting types.

Largly based on a change by LibreSSL.
Fix x86 build.