From cd7736f09494af40d5c81d01b585aa81324f3886 Mon Sep 17 00:00:00 2001 From: Masatoshi Kimura Date: Fri, 17 Sep 2010 12:29:52 -0700 Subject: [PATCH] Add support for CL_INCLUDES_PREFIX environment variable for handling localized cl.exe /showIncludes output. (Bug 587372) r=ted a2.0=blocking2.0:final --- build/cl.py | 6 ++++-- config/autoconf.mk.in | 2 ++ configure.in | 9 +++++++++ js/src/build/cl.py | 6 ++++-- js/src/config/autoconf.mk.in | 2 ++ js/src/configure.in | 9 +++++++++ 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/build/cl.py b/build/cl.py index 4abd9c2be50..3f0a3fd048b 100644 --- a/build/cl.py +++ b/build/cl.py @@ -40,6 +40,8 @@ import os, os.path import subprocess import sys +CL_INCLUDES_PREFIX = os.environ.get("CL_INCLUDES_PREFIX", "Note: including file:") + def InvokeClWithDependencyGeneration(cmdline): target = "" # Figure out what the target is @@ -61,8 +63,8 @@ def InvokeClWithDependencyGeneration(cmdline): for line in cl.stdout: # cl -showIncludes prefixes every header with "Note: including file:" # and an indentation corresponding to the depth (which we don't need) - if line.startswith("Note: including file:"): - dep = line[21:].strip() + if line.startswith(CL_INCLUDES_PREFIX): + dep = line[len(CL_INCLUDES_PREFIX):].strip() # We can't handle pathes with spaces properly in mddepend.pl, but # we can assume that anything in a path with spaces is a system # header and throw it away. diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index d3eb8e85239..bf7b5c0076b 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -570,6 +570,8 @@ STATIC_LIBIDL = @STATIC_LIBIDL@ MOZ_NATIVE_MAKEDEPEND = @SYSTEM_MAKEDEPEND@ +export CL_INCLUDES_PREFIX = @CL_INCLUDES_PREFIX@ + MOZ_AUTO_DEPS = @MOZ_AUTO_DEPS@ COMPILER_DEPEND = @COMPILER_DEPEND@ MDDEPDIR := @MDDEPDIR@ diff --git a/configure.in b/configure.in index 381b1ec4a2c..4d4cfd72054 100644 --- a/configure.in +++ b/configure.in @@ -8028,6 +8028,15 @@ else _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT' _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT' else + echo '#include ' > dummy-hello.c + changequote(,) + CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'` + changequote([,]) + if test -z "$CL_INCLUDES_PREFIX"; then + AC_MSG_ERROR([Cannot find cl -showIncludes prefix.]) + fi + AC_SUBST(CL_INCLUDES_PREFIX) + rm -f dummy-hello.c _topsrcdirwin=`cd \`dirname $0\`; pwd -W` dnl cl.py provides dependency generation for MSVC CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py" diff --git a/js/src/build/cl.py b/js/src/build/cl.py index 4abd9c2be50..3f0a3fd048b 100644 --- a/js/src/build/cl.py +++ b/js/src/build/cl.py @@ -40,6 +40,8 @@ import os, os.path import subprocess import sys +CL_INCLUDES_PREFIX = os.environ.get("CL_INCLUDES_PREFIX", "Note: including file:") + def InvokeClWithDependencyGeneration(cmdline): target = "" # Figure out what the target is @@ -61,8 +63,8 @@ def InvokeClWithDependencyGeneration(cmdline): for line in cl.stdout: # cl -showIncludes prefixes every header with "Note: including file:" # and an indentation corresponding to the depth (which we don't need) - if line.startswith("Note: including file:"): - dep = line[21:].strip() + if line.startswith(CL_INCLUDES_PREFIX): + dep = line[len(CL_INCLUDES_PREFIX):].strip() # We can't handle pathes with spaces properly in mddepend.pl, but # we can assume that anything in a path with spaces is a system # header and throw it away. diff --git a/js/src/config/autoconf.mk.in b/js/src/config/autoconf.mk.in index 0b7228fa605..9d0d689de10 100644 --- a/js/src/config/autoconf.mk.in +++ b/js/src/config/autoconf.mk.in @@ -278,6 +278,8 @@ MOZ_TOOLKIT_REGISTRY_CFLAGS = \ MOZ_NATIVE_MAKEDEPEND = @SYSTEM_MAKEDEPEND@ +export CL_INCLUDES_PREFIX = @CL_INCLUDES_PREFIX@ + MOZ_AUTO_DEPS = @MOZ_AUTO_DEPS@ COMPILER_DEPEND = @COMPILER_DEPEND@ MDDEPDIR := @MDDEPDIR@ diff --git a/js/src/configure.in b/js/src/configure.in index dc50e2000bb..8b35d4ecdae 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -4966,6 +4966,15 @@ else _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT' _DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT' else + echo '#include ' > dummy-hello.c + changequote(,) + CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'` + changequote([,]) + if test -z "$CL_INCLUDES_PREFIX"; then + AC_MSG_ERROR([Cannot find cl -showIncludes prefix.]) + fi + AC_SUBST(CL_INCLUDES_PREFIX) + rm -f dummy-hello.c _topsrcdirwin=`cd \`dirname $0\`; pwd -W` dnl cl.py provides dependency generation for MSVC CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"