Adding some stuff to the buildsystem to facilitate static builds.