From 2e50f42b7a6547ee6dfa61b8506877006542439f Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Thu, 3 Oct 2019 15:44:36 +0000 Subject: [PATCH] Bug 1577521 - Update configure to report an error if you try to build with mingw-gcc r=nalexander Differential Revision: https://phabricator.services.mozilla.com/D47857 --HG-- extra : moz-landing-system : lando --- js/src/old-configure.in | 14 +++++++------- old-configure.in | 20 +++++++------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/js/src/old-configure.in b/js/src/old-configure.in index 5d49dd3eaa2d..9069bc9313cb 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -527,6 +527,11 @@ case "$target" in DSO_CFLAGS= DSO_PIC_CFLAGS= if test -n "$GNU_CC" -o -n "$CLANG_CC"; then + # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang + if test -z "$CLANG_CC"; then + AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work) + fi + CC="$CC -mwindows" CXX="$CXX -mwindows" CPP="$CPP -mwindows" @@ -537,13 +542,8 @@ case "$target" in LIBS="$LIBS -lusp10 -lgdi32 -lwinmm -lwsock32" MOZ_FIX_LINK_PATHS= - if test -z "$CLANG_CC"; then - # Use static libgcc and libstdc++ - LDFLAGS="$LDFLAGS -static" - else - # Silence problematic clang warnings - CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct" - fi + # Silence problematic clang warnings + CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct" MOZ_OPTIMIZE_FLAGS="-O2" diff --git a/old-configure.in b/old-configure.in index eadac039b232..be53c10a8b99 100644 --- a/old-configure.in +++ b/old-configure.in @@ -645,6 +645,11 @@ case "$target" in # certain versions of cygwin's makedepend barf on the # #include vs -I./dist/include/string issue so don't use it if test -n "$GNU_CC" -o -n "$CLANG_CC"; then + # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang + if test -z "$CLANG_CC"; then + AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work) + fi + CC="$CC -mwindows" CXX="$CXX -mwindows" CPP="$CPP -mwindows" @@ -660,19 +665,8 @@ case "$target" in WIN32_CONSOLE_EXE_LDFLAGS=-mconsole WIN32_GUI_EXE_LDFLAGS=-mwindows - if test -z "$CLANG_CC"; then - # Use static libgcc and libstdc++ - LDFLAGS="$LDFLAGS -static" - - # GCC/binutils can't link to a function if we try to include dllexport function - # in the same library as dllimport caller. To work around it, we build NSPR - # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that - # function thunks need to be generated for cross-DLL calls. - MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport" - else - # Silence problematic clang warnings - CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct" - fi + # Silence problematic clang warnings + CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct" else TARGET_COMPILER_ABI=msvc RANLIB='echo not_ranlib'