Improve automatic configuration and compatibility with MSVC