Pass optimization and arch flags during configure

Currently we don't pass any optimization or arch flags during configure (the only things that get added are include paths and library paths), but I think this could be considered a bug, since it can result in different code being compiled during configure than during the actual build.

For example, see #23754, where passing `-march=native` during the build but not during configure resulted in misdetection of some capabilities and ultimately failure.

For another example, take building a universal cairo, which required stdenv. It doesn't anymore.

This class of bugs does not happen at all under stdenv, because we set CFLAGS and they are picked up during configure.