bug 1397263 - move MIDL_FLAGS to toolchain.configure. r?build draft
authorTed Mielczarek <ted@mielczarek.org>
Wed, 06 Sep 2017 16:25:25 -0400
changeset 706969 5db4c743f9f4d0fe772f52c34c44db16e7e933a0
parent 706968 8e6b1c7e229530e6dd612345b625ae80a3ad39db
child 706970 fbd0dde82d115128b03a2bcfc02f5d1580574e10
push id91972
push userbmo:ted@mielczarek.org
push dateMon, 04 Dec 2017 15:07:44 +0000
reviewersbuild
bugs1397263
milestone59.0a1
bug 1397263 - move MIDL_FLAGS to toolchain.configure. r?build This is a straightforward port of MIDL_FLAGS from old-configure to moz.configure. The only behavioral change is that it removes support for prepending MIDL_FLAGS from the environment in configure, but I doubt anyone uses that. MozReview-Commit-ID: 3bqb9UOdYYb
build/moz.configure/toolchain.configure
old-configure.in
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1555,24 +1555,43 @@ js_option('--enable-coverage', env='MOZ_
 def code_coverage(value):
     if value:
         return True
 
 
 set_config('MOZ_CODE_COVERAGE', code_coverage)
 set_define('MOZ_CODE_COVERAGE', code_coverage)
 
+# MIDL detection/flags.
+# ==============================================================
 
 @depends(c_compiler, toolchain_prefix)
 def midl_names(c_compiler, toolchain_prefix):
     if c_compiler.type in ['gcc', 'clang']:
         # mingw
         widl = ('widl', )
         if toolchain_prefix:
             widl = with_toolchain_prefix('widl', toolchain_prefix) + widl
         return widl
     else:
         return ('midl',)
 
+
 midl = check_prog('MIDL', midl_names, when=depends(target)(lambda t: t.kernel == 'WINNT'))
 
-# Needed until we move MIDL_FLAGS and --disable-accessibility from old-configure
+# Needed until we move --disable-accessibility from old-configure
 add_old_configure_assignment('MIDL', midl)
+
+@depends(c_compiler, target, when=depends(midl, target)(lambda m, t: m and t.kernel == 'WINNT'))
+def midl_flags(c_compiler, target):
+    if c_compiler.type in ('msvc', 'clang-cl'):
+        return {
+            'x86': ['-env', 'win32'],
+            'x86_64': ['-env', 'x64'],
+        }.get(target.cpu)
+    else:
+        # mingw
+        return {
+            'x86': ['--win32', '-m32'],
+            'x86_64': ['--win64', '-m64'],
+        }.get(target.cpu)
+
+set_config('MIDL_FLAGS', midl_flags)
--- a/old-configure.in
+++ b/old-configure.in
@@ -242,26 +242,16 @@ case "$target" in
         _LD_FULL_VERSION=`"${LINK}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
         fi
 
         INCREMENTAL_LINKER=1
 
-        # Set midl environment
-        case "$target" in
-        i*86-*)
-            MIDL_FLAGS="${MIDL_FLAGS} -env win32"
-            ;;
-        x86_64-*)
-            MIDL_FLAGS="${MIDL_FLAGS} -env x64"
-            ;;
-        esac
-
         unset _MSVC_VER_FILTER
 
         AC_CACHE_CHECK(for overridable _RAISE,
                        ac_cv_have__RAISE,
             [
                 AC_LANG_SAVE
                 AC_LANG_CPLUSPLUS
                 _SAVE_CXXFLAGS="$CXXFLAGS"
@@ -321,27 +311,16 @@ case "$target" in
                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
         then
             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
         fi
 
-        if test -n "$MIDL"; then
-            case "$target" in
-            i*86-*)
-                MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
-                ;;
-            x86_64-*)
-                MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
-                ;;
-            esac
-        fi
-
         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
         # causing problems with local implementations with the same name.
         AC_DEFINE(STRSAFE_NO_DEPRECATE)
     fi # !GNU_CC
 
     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
     # Require OS features provided by IE 8.0 (Win7)
@@ -358,17 +337,16 @@ if test -n "$_WIN32_MSVC"; then
     # Since we're skipping compiler and library checks, hard-code
     # some facts here.
     AC_DEFINE(HAVE_IO_H)
     AC_DEFINE(HAVE_ISATTY)
 fi
 
 fi # COMPILE_ENVIRONMENT
 
-AC_SUBST(MIDL_FLAGS)
 AC_SUBST(_MSC_VER)
 
 AC_SUBST(GNU_AS)
 AC_SUBST(GNU_CC)
 AC_SUBST(GNU_CXX)
 
 AC_SUBST_LIST(STL_FLAGS)
 AC_SUBST(WRAP_STL_INCLUDES)