Set the locale per-thread instead of globally when generating shaders. Add cross-compatible versions of newlocale, uselocale and freelocale.

This commit fixes a rare race condition when generating shaders because setlocale is global.
Build fix: Android NDK doesn't support any locale switching.

Also, Mac OS X doesn't support DX9.
Adding Travis CI script

because a build test is useful