Bug 980697 - Add a configure option to pull newer versions of the d3dcompiler dll from installed Windows SDKs. r=mshal,vlad
authorABE Hiroki (hATrayflood) <h.rayflood@gmail.com>
Sat, 22 Mar 2014 10:49:26 +0900
changeset 193384 cf2974b3e42eaec2b1d72073379bed7a3dbe7e41
parent 193383 2cc3ef8513ce443a88aabf4642f954ed95030bb6
child 193385 61e13cc8dcdd4a10356c36e243f5afed8490d973
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal, vlad
bugs980697
milestone31.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 980697 - Add a configure option to pull newer versions of the d3dcompiler dll from installed Windows SDKs. r=mshal,vlad
build/win32/mozconfig.vs2010-win64
build/win64/mozconfig.vs2010
config/config.mk
configure.in
gfx/angle/Makefile.in
gfx/angle/src/libEGL/Makefile.in
gfx/angle/src/libGLESv2/Makefile.in
toolkit/library/Makefile.in
--- a/build/win32/mozconfig.vs2010-win64
+++ b/build/win32/mozconfig.vs2010-win64
@@ -17,16 +17,19 @@ export INCLUDE=/c/Program\ Files\ \(x86\
 
 ## libs: win8 sdk x86 (32-bit) libs, msvc 10 (32-bit) std library, msvc 10 atl libs, directx sdk (32-bit) for d3d9  ##
 export LIBPATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x86:${_VSPATH}/vc/lib:${_VSPATH}/vc/atlmfc/lib:/c/tools/sdks/dx10/lib
 export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x86:${_VSPATH}/vc/lib:${_VSPATH}/vc/atlmfc/lib:/c/tools/sdks/dx10/lib
 
 ## paths: win8 sdk x86 (32-bit) tools, msvc 10 (32-bit) build toolchain, moz tools  ##
 export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x86:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:/c/mozilla-build/moztools:${PATH}"
 
+## WindowsSDKDir ##
+export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.0/"
+
 . $topsrcdir/build/mozconfig.vs2010-common
 
 mk_export_correct_style LIB
 mk_export_correct_style LIBPATH
 mk_export_correct_style PATH
 mk_export_correct_style INCLUDE
 mk_export_correct_style WIN32_REDIST_DIR
 
--- a/build/win64/mozconfig.vs2010
+++ b/build/win64/mozconfig.vs2010
@@ -14,16 +14,19 @@ export INCLUDE=/c/Program\ Files\ \(x86\
 
 ## libs: win8 sdk x64 (64-bit) libs, msvc 10 (64-bit) std library, msvc 10 atl libs, directx sdk (64-bit) for d3d9  ##
 export LIBPATH=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x64:${_VSPATH}/vc/lib/amd64:${_VSPATH}/vc/atlmfc/lib/amd64:/c/tools/sdks/dx10/lib/x64
 export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x64:${_VSPATH}/vc/lib/amd64:${_VSPATH}/vc/atlmfc/lib/amd64:/c/tools/sdks/dx10/lib/x64
 
 ## paths: win8 sdk x64 (64-bit) tools, msvc 10 (64-bit) build toolchain, moz tools  ##
 export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x64:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN/amd64:${_VSPATH}/VC/BIN/x86_amd64:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:${PATH}"
 
+## WindowsSDKDir ##
+export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.0/"
+
 # Use 32bit linker for PGO crash bug.
 # https://connect.microsoft.com/VisualStudio/feedback/details/686117/
 if [ -f /c/PROGRA~2/MICROS~2.0/VC/BIN/x86_amd64/link.exe ]; then
   # /c/Program Files (x86)/Microsoft Visual Studio 10.0
   export LD=c:/PROGRA~2/MICROS~2.0/VC/BIN/x86_amd64/link.exe
 else
   export LD=c:/tools/msvs10/VC/BIN/x86_amd64/link.exe
 fi
--- a/config/config.mk
+++ b/config/config.mk
@@ -898,15 +898,14 @@ LOCAL_INCLUDES += \
   -I$(topsrcdir)/ipc/chromium/src \
   -I$(topsrcdir)/ipc/glue \
   -I$(DEPTH)/ipc/ipdl/_ipdlheaders \
   $(NULL)
 
 ifeq (WINNT,$(OS_TARGET))
 # These get set via VC project file settings for normal GYP builds.
 DEFINES += -DUNICODE -D_UNICODE
-LOCAL_INCLUDES += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
 endif
 
 DISABLE_STL_WRAPPING := 1
 # Skip most Mozilla-specific include locations.
 INCLUDES = -I. $(LOCAL_INCLUDES) -I$(DEPTH)/dist/include
 endif
--- a/configure.in
+++ b/configure.in
@@ -5765,20 +5765,22 @@ if test -n "${JAVA_BIN_PATH}" -o \
 fi
 
 dnl ========================================================
 dnl = ANGLE OpenGL->D3D translator for WebGL
 dnl = * only applies to win32
 dnl = * enabled by default (shipping build); requires explicit --disable to disable
 dnl ========================================================
 MOZ_ANGLE_RENDERER=
+MOZ_DIRECTX_SDK_CPU_SUFFIX=
 MOZ_DIRECTX_SDK_PATH=
-MOZ_DIRECTX_SDK_CPU_SUFFIX=
+MOZ_D3DCOMPILER_DLL=
+MOZ_HAS_WINSDK_WITH_D3D=
+MOZ_D3DCOMPILER_DLL_PATH=
 MOZ_D3DCOMPILER_CAB=
-MOZ_D3DCOMPILER_DLL=
 case "$target_os" in
 *mingw*)
     MOZ_ANGLE_RENDERER=1
     ;;
 esac
 
 # The DirectX SDK libraries are split into x86 and x64 sub-directories
 case "${target_cpu}" in
@@ -5790,70 +5792,134 @@ x86_64)
   ;;
 esac
 
 MOZ_ARG_DISABLE_BOOL(webgl,
 [  --disable-webgl     Disable building of the WebGL implementation],
     MOZ_WEBGL_DISABLED=1,
     MOZ_WEBGL_DISABLED=)
 
+MOZ_ARG_ENABLE_BOOL(winsdk-directx,
+[  --enable-winsdk-directx use DirectX SDK in Windows SDK],
+    MOZ_WINSDK_DIRECTX=1,
+    MOZ_WINSDK_DIRECTX=)
+
 if test -n "$MOZ_WEBGL_DISABLED"; then
   MOZ_WEBGL=
   MOZ_ANGLE_RENDERER=
 fi
 
 if test -n "$MOZ_WEBGL"; then
   AC_DEFINE(MOZ_WEBGL)
 fi
 
 if test -n "$MOZ_WEBGL_CONFORMANT"; then
   AC_DEFINE(MOZ_WEBGL_CONFORMANT)
 fi
 
+
 # Locate a DirectX SDK here so we can use it for both ANGLE and
 # Joystick support.
 if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
   # Get the SDK path from the registry.
   # First try to get the June 2010 SDK
   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
     # Otherwise just take whatever comes first
     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
   fi
   MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'`
-fi
-
-if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
-  if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
-    AC_MSG_ERROR([Found the February 2010 DirectX SDK. Need the June 2010 DirectX SDK, or newer.  Upgrade your SDK or reconfigure with --disable-webgl.])
-  fi
 
   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
-     test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
      test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
   else
-    AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for WebGL. Either install it (June 2010 version or newer), or reconfigure with --disable-webgl.])
+    AC_MSG_RESULT([Couldn't find the DirectX SDK.])
   fi
-
-  # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
-  MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
-
-  if test -z "$MOZ_D3DX9_VERSION" ; then
-      AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for WebGL. Either reinstall the DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
+fi
+
+
+dnl ========================================================
+dnl D3D compiler DLL
+dnl ========================================================
+
+if test -n "$MOZ_ANGLE_RENDERER"; then
+  # Check that our DirectX SDK is acceptable.
+  if test -n "$MOZ_DIRECTX_SDK_PATH"; then
+    if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
+      AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
+      MOZ_DIRECTX_SDK_PATH_BAD=1
+    fi
+
+    if test -n "$MOZ_DIRECTX_SDK_PATH" &&
+       test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
+       test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
+      AC_MSG_RESULT([Found acceptable DirectX SDK for ANGLE.])
+    else
+      AC_MSG_RESULT([Found DirectX SDK is unacceptable for ANGLE.])
+      MOZ_DIRECTX_SDK_PATH_BAD=1
+    fi
+  fi
+
+  if test -n "$MOZ_DIRECTX_SDK_PATH_BAD"; then
+    AC_MSG_ERROR([Couldn't find an acceptable DirectX SDK for ANGLE. Either install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
   fi
 
-  MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
-
-  if test -z "$MOZ_D3DCOMPILER_CAB"; then
-    AC_MSG_ERROR([Couldn't find the DirectX redistributable files. Either reinstall the DirectX SDK (making sure the "DirectX Redistributable Files" option is selected), or reconfigure with --disable-webgl.])
+  # Find a D3D compiler DLL in a Windows SDK.
+  MOZ_D3DCOMPILER_DLL=
+  if test -n "$MOZ_WINSDK_DIRECTX"; then
+    case "$MOZ_WINSDK_MAXVER" in
+    0x0603*)
+      MOZ_D3DCOMPILER_DLL=d3dcompiler_47.dll
+      AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
+    ;;
+    0x0602*)
+      MOZ_D3DCOMPILER_DLL=d3dcompiler_46.dll
+      AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
+    ;;
+    esac
   fi
 
-  MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
-fi
+  if test -n "$MOZ_D3DCOMPILER_DLL"; then
+    # We have a name, now track down the path.
+    if test -n "$WINDOWSSDKDIR"; then
+      MOZ_D3DCOMPILER_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_DIRECTX_SDK_CPU_SUFFIX/$MOZ_D3DCOMPILER_DLL"
+      if test -f "$MOZ_D3DCOMPILER_DLL_PATH"; then
+        MOZ_HAS_WINSDK_WITH_D3D=1
+        AC_MSG_RESULT([Found MOZ_D3DCOMPILER_DLL_PATH: $MOZ_D3DCOMPILER_DLL_PATH])
+      else
+        AC_MSG_RESULT([MOZ_D3DCOMPILER_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_DLL_PATH])
+      fi
+    else
+      AC_MSG_RESULT([WINDOWSSDKDIR is missing.])
+    fi
+  fi
+
+  # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
+  # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
+  if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then
+    MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
+
+    if test -n "$MOZ_D3DX9_VERSION" ; then
+      MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
+      MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
+    else
+      AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
+    fi
+
+    if test -z "$MOZ_D3DCOMPILER_CAB"; then
+      AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
+    fi
+  fi
+
+  if test -z "$MOZ_D3DCOMPILER_DLL_PATH" -a -z "$MOZ_D3DCOMPILER_CAB"; then
+    AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL. Either install Windows SDK 8.0+ and reconfigure with --enable-winsdk-directx, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
+  fi
+fi
+
 
 dnl ========================================================
 dnl Gamepad support
 dnl ========================================================
 MOZ_GAMEPAD=
 MOZ_GAMEPAD_BACKEND=stub
 
 # Gamepad DOM is built on supported platforms by default.
@@ -5871,22 +5937,24 @@ MOZ_ARG_DISABLE_BOOL(gamepad,
     MOZ_GAMEPAD=1)
 
 if test "$MOZ_GAMEPAD"; then
     case "$OS_TARGET" in
     Darwin)
         MOZ_GAMEPAD_BACKEND=cocoa
         ;;
     WINNT)
-        if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
-            if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
-               MOZ_GAMEPAD=
+        if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then
+            if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
+                if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
+                   MOZ_GAMEPAD=
+                fi
+            elif test "$GCC" != "yes"; then
+                MOZ_GAMEPAD=
             fi
-        elif test "$GCC" != "yes"; then
-            MOZ_GAMEPAD=
         fi
         if test -z "$MOZ_GAMEPAD"; then
            AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for gamepad support. Please install it or, reconfigure with --disable-gamepad to disable gamepad support.])
         fi
         MOZ_GAMEPAD_BACKEND=windows
         ;;
     Linux)
         MOZ_CHECK_HEADER([linux/joystick.h])
@@ -8383,22 +8451,25 @@ AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
 AC_SUBST(MOZ_CRASHREPORTER)
 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
 AC_SUBST(MOZ_STUB_INSTALLER)
 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
 AC_SUBST(MOZ_ENABLE_SIGNMAR)
 AC_SUBST(MOZ_UPDATER)
+
 AC_SUBST(MOZ_ANGLE_RENDERER)
-AC_SUBST(MOZ_DIRECTX_SDK_PATH)
 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
-AC_SUBST(MOZ_D3DX9_VERSION)
+AC_SUBST(MOZ_DIRECTX_SDK_PATH)
+AC_SUBST(MOZ_D3DCOMPILER_DLL)
+AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
+AC_SUBST(MOZ_D3DCOMPILER_DLL_PATH)
 AC_SUBST(MOZ_D3DCOMPILER_CAB)
-AC_SUBST(MOZ_D3DCOMPILER_DLL)
+
 AC_SUBST(MOZ_METRO)
 
 AC_SUBST(MOZ_ANDROID_HISTORY)
 AC_SUBST(MOZ_WEBSMS_BACKEND)
 AC_SUBST(MOZ_ANDROID_BEAM)
 AC_SUBST(MOZ_ANDROID_SYNTHAPKS)
 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
 AC_SUBST(ENABLE_STRIP)
--- a/gfx/angle/Makefile.in
+++ b/gfx/angle/Makefile.in
@@ -1,18 +1,22 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 ifdef MOZ_ANGLE_RENDERER
 
 libs::
+ifdef MOZ_HAS_WINSDK_WITH_D3D
+	cp -fp "$(MOZ_D3DCOMPILER_DLL_PATH)" "$(DIST)/bin"
+else
 ifdef MOZ_D3DCOMPILER_CAB
 	expand '$(MOZ_D3DCOMPILER_CAB)' -F:$(MOZ_D3DCOMPILER_DLL) '$(DIST)/bin'
 endif
+endif
 
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 # We have to filter out -pedantic, because of
 # comma-at-end-of-enumerator list failures.  We can try to get this fixed
 # upstream at some point.
--- a/gfx/angle/src/libEGL/Makefile.in
+++ b/gfx/angle/src/libEGL/Makefile.in
@@ -8,24 +8,30 @@ OS_CPPFLAGS += -EHsc
 endif
 
 # Below is a transcription of the EGL target from build_angle.gypi.
 # Target: 'libEGL'
 #   Links with: 'libGLESv2'
 
 include $(topsrcdir)/config/rules.mk
 
+ifndef MOZ_HAS_WINSDK_WITH_D3D
 CXXFLAGS += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
+endif
 
 #OS_LIBS += $(call EXPAND_LIBNAME,dwmapi)
 
 ifdef GNU_CC
 
 OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions
 OS_LIBS += -ld3d9 -llibGLESv2
 
 else
 
+ifdef MOZ_HAS_WINSDK_WITH_D3D
+EXTRA_DSO_LDOPTS = d3d9.lib "$(DIST)/lib/libGLESv2.lib" delayimp.lib
+else
 EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib' \
                    '$(DIST)/lib/libGLESv2.lib' \
                    delayimp.lib
+endif
 
 endif
--- a/gfx/angle/src/libGLESv2/Makefile.in
+++ b/gfx/angle/src/libGLESv2/Makefile.in
@@ -6,22 +6,28 @@ ifndef GNU_CC
 # Enable unwind semantics for exception handlers in response to warning C4530.
 OS_CPPFLAGS += -EHsc
 endif
 
 # End build_angle.gypi transcription.
 
 include $(topsrcdir)/config/rules.mk
 
+ifndef MOZ_HAS_WINSDK_WITH_D3D
 CXXFLAGS += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
+endif
 
 ifdef GNU_CC
 
 OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions
 OS_LIBS += -ld3d9 -ldxguid
 
 else
 
+ifdef MOZ_HAS_WINSDK_WITH_D3D
+EXTRA_DSO_LDOPTS = d3d9.lib dxguid.lib delayimp.lib
+else
 EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib' \
                    '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/dxguid.lib' \
                    delayimp.lib
+endif
 
 endif
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -102,19 +102,21 @@ endif
 ifdef MOZ_DMD
 EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,dmd,$(DIST)/lib)
 endif
 
 EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib)
 
 ifdef MOZ_WEBRTC
 ifeq (WINNT,$(OS_TARGET))
+ifndef MOZ_HAS_WINSDK_WITH_D3D
 EXTRA_DSO_LDOPTS += \
   -LIBPATH:'$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)' \
   $(NULL)
+endif
 OS_LIBS += $(call EXPAND_LIBNAME,secur32 crypt32 iphlpapi strmiids dmoguids wmcodecdspuuid amstrmid msdmo wininet)
 endif
 endif
 
 
 ifdef MOZ_ALSA
 EXTRA_DSO_LDOPTS += $(MOZ_ALSA_LIBS)
 endif
@@ -227,21 +229,25 @@ OS_LIBS += $(call EXPAND_LIBNAME,shell32
 ifdef ACCESSIBILITY
 OS_LIBS += $(call EXPAND_LIBNAME,oleacc)
 endif
 ifdef MOZ_METRO
 OS_LIBS += $(call EXPAND_LIBNAME,uiautomationcore runtimeobject)
 endif
 ifdef MOZ_GAMEPAD
 ifndef GNU_CC
+ifdef MOZ_HAS_WINSDK_WITH_D3D
+OS_LIBS += dxguid.lib dinput8.lib
+else
 DXSDK := $(subst \,/,$(MOZ_DIRECTX_SDK_PATH))/Lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)
 OS_LIBS += \
   '$(DXSDK)/dxguid.lib' \
   '$(DXSDK)/dinput8.lib' \
   $(NULL)
+endif
 else
 OS_LIBS += $(call EXPAND_LIBNAME,dxguid dinput8)
 endif
 endif
 endif # WINNT
 
 ifdef MOZ_JPROF
 EXTRA_DSO_LDOPTS += -ljprof