Honor variables so static builds work correctly.

Previously, try_compile() ignored these variables and so would happily
compile (for example) against libgsl.so, even if a static build was
requested.