Bug 1397263 - move MIDL checks to moz.configure; r=glandium
authorTed Mielczarek <ted@mielczarek.org>
Wed, 03 Oct 2018 20:29:29 -0400
changeset 439563 73a4e7ed19f3447370cbe5fa7b7b30fc1a41710b
parent 439562 c8b45fb6a89dc3b4189995c0a96990e84868745b
child 439564 b4dec9b774a82ccbe834eeb9727186e793699e97
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 checks to moz.configure; r=glandium
old-configure.in
toolkit/moz.configure
--- a/old-configure.in
+++ b/old-configure.in
@@ -153,17 +153,16 @@ dnl ====================================
 
 WINVER=601
 
 case "$target" in
 *-mingw*)
     if test "$GCC" != "yes"; then
         # Check to see if we are really running in a msvc environemnt
         _WIN32_MSVC=1
-        AC_CHECK_PROGS(MIDL, midl)
 
         # Make sure compilers are valid
         CFLAGS="$CFLAGS -nologo"
         CXXFLAGS="$CXXFLAGS -TP -nologo"
         AC_LANG_SAVE
         AC_LANG_C
         AC_TRY_COMPILE([#include <stdio.h>],
             [ printf("Hello World\n"); ],,
@@ -316,17 +315,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
 
-        AC_CHECK_PROGS(MIDL, $target-widl widl)
         if test -n "$MIDL"; then
             case "$target" in
             i*86-*)
                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
                 ;;
             x86_64-*)
                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
                 ;;
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -1072,16 +1072,45 @@ option('--enable-proxy-bypass-protection
 
 @depends_if('--enable-proxy-bypass-protection')
 def proxy_bypass_protection(_):
     return True
 
 set_config('MOZ_PROXY_BYPASS_PROTECTION', proxy_bypass_protection)
 set_define('MOZ_PROXY_BYPASS_PROTECTION', proxy_bypass_protection)
 
+# MIDL
+# ==============================================================
+
+@depends(c_compiler, toolchain_prefix)
+def midl_names(c_compiler, toolchain_prefix):
+    if c_compiler and c_compiler.type in ['gcc', 'clang']:
+        # mingw
+        widl = ('widl', )
+        if toolchain_prefix:
+            prefixed = tuple('%s%s' % (p, 'widl') for p in toolchain_prefix)
+            widl = prefixed + widl
+        return widl
+
+    return ('midl',)
+
+@depends(target, '--enable-compile-environment')
+def check_for_midl(target, compile_environment):
+    if target.os != 'WINNT':
+        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
+add_old_configure_assignment('MIDL', midl)
+
 # Addon signing
 # ==============================================================
 
 option('--with-unsigned-addon-scopes',
        nargs='+', choices=('app', 'system'),
        help='Addon scopes where signature is not required')
 
 @depends('--with-unsigned-addon-scopes')