Detect the prefix of the cl.exe -showIncludes output.

This commit is contained in:
Jan Holesovsky 2011-04-15 13:59:52 +02:00
parent 4d1bdd7a08
commit 15a1260bd7
3 changed files with 25 additions and 4 deletions

View file

@ -2113,6 +2113,7 @@ fi
dnl ===================================================================
dnl Check which Microsoft C/C++ or MinGW compiler is used for WINNT
dnl ===================================================================
SHOWINCLUDES_PREFIX=
if test "$_os" = "WINNT"; then
if test "$WITH_MINGW" != "yes"; then
AC_MSG_CHECKING([for a friendly Microsoft C/C++ compiler installation path])
@ -2163,7 +2164,7 @@ if test "$_os" = "WINNT"; then
fi
if test -z "$MSPDB_PATH"; then
AC_MSG_ERROR([You need a mspdb80.dllor mspdb100.dll, make sure it's in the path or use --with-mspdb-path])
AC_MSG_ERROR([You need a mspdb80.dllor mspdb100.dll, make sure it is in the path or use --with-mspdb-path])
fi
MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
@ -2222,6 +2223,19 @@ dnl The following find microsoft, matches nn.nn.nnnn then pulls numbers out
else
AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home or set path to cl.exe.])
fi
dnl We need to guess the prefix of the -showIncludes output, it can be
dnl localized
AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
echo "#include <stdlib.h>" > conftest.c
SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \
grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
rm -f conftest.c conftest.obj
if test -z "$SHOWINCLUDES_PREFIX" ; then
AC_MSG_ERROR([cannot determine the -showIncludes prefix])
else
AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
fi
else
AC_MSG_CHECKING([the MinGW C++ Compiler])
if test `$CC -dumpmachine | $SED -e 's/^.*-//'` = "mingw32"; then
@ -2239,6 +2253,7 @@ fi
AC_SUBST(COMEX)
AC_SUBST(MSPDB_PATH)
AC_SUBST(USE_MINGW)
AC_SUBST(SHOWINCLUDES_PREFIX)
dnl ===================================================================
dnl .NET needs special treatment

View file

@ -78,7 +78,7 @@ my ( $oldPATH, $SRC_ROOT, $SO_HOME, $JAVA_HOME, $JDK, $JAVAFLAGS, $OOO_SHELL,
$SOLARSRC, $DEVROOT, $SOLARVER, $SOLARVERSION, $WORKDIR, $OUTDIR, $SOLARENV, $SOLARDEFIMG,
$STAR_INIROOT, $STAR_INIROOTOLD, $STAR_STANDLST, $STAR_SSCOMMON, $STAR_SSOLARINI,
$DMAKEROOT, $CLASSPATH, $XCLASSPATH, $COMPATH,
$MSPDB_PATH, $MIDL_PATH, $CSC_PATH,
$MSPDB_PATH, $MIDL_PATH, $CSC_PATH, $SHOWINCLUDES_PREFIX,
$PATH, $SOLAREXTRAINC, $SOLAREXTRALIB, $SOLARLIB, $JAVALIB,
$SOLARINC, $LOCALINI, $FRAMEWORKSHOME, $COMEX, $PERL,
$COMP_ENV, $ILIB, $JAVAHOME, $PSDK_HOME, $DIRECTXSDK_LIB, $USE_NEW_SDK, $FRAME_HOME,
@ -659,6 +659,7 @@ elsif ( $platform =~ m/cygwin/ )
$MSPDB_PATH = PathFormat('@MSPDB_PATH@');
$MIDL_PATH = PathFormat('@MIDL_PATH@');
$CSC_PATH = PathFormat('@CSC_PATH@');
$SHOWINCLUDES_PREFIX = '@SHOWINCLUDES_PREFIX@';
$PSDK_HOME = PathFormat('@PSDK_HOME@');
$DIRECTXSDK_LIB = PathFormat('@DIRECTXSDK_LIB@');
$USE_DIRECTX5 = "";

View file

@ -20,14 +20,19 @@ if ( !defined $outfile || !defined $objfile || !defined $srcfile ) {
die "Not enough parameters to create dependencies.";
}
my $showincludes_prefix = $ENV{'SHOWINCLUDES_PREFIX'};
if ( !defined( $showincludes_prefix ) || $showincludes_prefix eq "" ) {
$showincludes_prefix = 'Note: including file:';
}
open( OUT, "> $outfile" ) or die "Cannot open $outfile for writing.";
print OUT "$objfile: \\\n $srcfile";
my %seen;
my $first_line = 1;
while ( <STDIN> ) {
if ( /^Note: including file:/ ) {
s/^Note: including file:\s*//;
if ( /^$showincludes_prefix/ ) {
s/^$showincludes_prefix\s*//;
s/\r$//;
chomp;