libfoundation build fixes for Linux and OS X.