Bug 1397263 - move MIDL_FLAGS to toolkit/moz.configure; r=glandium
authorTed Mielczarek <ted@mielczarek.org>
Wed, 03 Oct 2018 20:29:29 -0400
changeset 439565 b3ad0438392892aeab8c88826d347164640ba602
parent 439564 b4dec9b774a82ccbe834eeb9727186e793699e97
child 439566 23f384237f7320a5f5ef99f19781feb0227faf7e
push id34779
push usernbeleuzu@mozilla.com
push dateThu, 04 Oct 2018 15:49:20 +0000
treeherdermozilla-central@f66e525e6978 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1397263
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1397263 - move MIDL_FLAGS to toolkit/moz.configure; r=glandium 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.
old-configure.in
toolkit/moz.configure
--- a/old-configure.in
+++ b/old-configure.in
@@ -258,29 +258,16 @@ case "$target" in
             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
             ;;
         esac
 
         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"
-            ;;
-        aarch64-*)
-            MIDL_FLAGS="${MIDL_FLAGS} -env arm64"
-            ;;
-        esac
-
         unset _MSVC_VER_FILTER
 
         WRAP_STL_INCLUDES=1
         STL_FLAGS="-I${DIST}/stl_wrappers"
         CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
         CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
     else
         # Check w32api version
@@ -313,27 +300,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)
@@ -350,17 +326,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)
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -1098,18 +1098,37 @@ def check_for_midl(target, compile_envir
         return
 
     if compile_environment:
         return True
 
 
 midl = check_prog('MIDL', midl_names, when=check_for_midl, allow_missing=True)
 
-# Needed until we move MIDL_FLAGS and --disable-accessibility from old-configure
+
+@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 and c_compiler.type in ('msvc', 'clang-cl'):
+        env = {
+            'x86': 'win32',
+            'x86_64': 'x64',
+            'aarch64': 'arm64',
+        }[target.cpu]
+        return ['-env', env]
+
+    # mingw
+    return {
+        'x86': ['--win32', '-m32'],
+        'x86_64': ['--win64', '-m64'],
+    }[target.cpu]
+
+
+# Needed until we move --disable-accessibility from old-configure
 add_old_configure_assignment('MIDL', midl)
+set_config('MIDL_FLAGS', midl_flags)
 
 # Addon signing
 # ==============================================================
 
 option('--with-unsigned-addon-scopes',
        nargs='+', choices=('app', 'system'),
        help='Addon scopes where signature is not required')