build.sh: Only find the mingw compiler on Windows.

Fixes #2269
flac
Doug Coleman 2020-03-30 20:37:38 -05:00 committed by Steve Ayerhart
parent 648ffe8d46
commit 59e0ec6513
No known key found for this signature in database
GPG Key ID: 5BFD39C5359E967D
1 changed files with 15 additions and 12 deletions

View File

@ -154,21 +154,24 @@ clang_version_ok() {
} }
set_cc() { set_cc() {
# on Cygwin we MUST use the MinGW "cross-compiler", therefore check these first # on Cygwin we MUST use the MinGW "cross-compiler", therefore check these first
# furthermore, we prefer 64 bit over 32 bit versions if both are available # furthermore, we prefer 64 bit over 32 bit versions if both are available
test_programs_installed x86_64-w64-mingw32-gcc x86_64-w64-mingw32-g++
if [[ $? -ne 0 ]] ; then
[ -z "$CC" ] && CC=x86_64-w64-mingw32-gcc
[ -z "$CXX" ] && CXX=x86_64-w64-mingw32-g++
return
fi
test_programs_installed i686-w64-mingw32-gcc i686-w64-mingw32-g++ # we need this condition so we don't find a mingw32 compiler on linux
if [[ $? -ne 0 ]] ; then if [[ $OS == windows ]] ; then
[ -z "$CC" ] && CC=i686-w64-mingw32-gcc test_programs_installed x86_64-w64-mingw32-gcc x86_64-w64-mingw32-g++
[ -z "$CXX" ] && CXX=i686-w64-mingw32-g++ if [[ $? -ne 0 ]] ; then
return [ -z "$CC" ] && CC=x86_64-w64-mingw32-gcc
[ -z "$CXX" ] && CXX=x86_64-w64-mingw32-g++
return
fi
test_programs_installed i686-w64-mingw32-gcc i686-w64-mingw32-g++
if [[ $? -ne 0 ]] ; then
[ -z "$CC" ] && CC=i686-w64-mingw32-gcc
[ -z "$CXX" ] && CXX=i686-w64-mingw32-g++
return
fi
fi fi
test_programs_installed clang clang++ test_programs_installed clang clang++