Build static and shared libs, add guards to GCC-specific opts