automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make depmode=cpp work with Microsoft Visual C++ on MSYS.


From: Ralf Wildenhues
Subject: Re: Make depmode=cpp work with Microsoft Visual C++ on MSYS.
Date: Wed, 4 Mar 2009 00:07:28 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

* Peter Rosin wrote on Wed, Jan 28, 2009 at 12:57:43PM CET:
> But if you are looking for bugs to squash, one obvious problem is
> that the standard
> AC_PROG_CC
> AM_PROG_CC_C_O
> puts the dependency check before the -c -o check, which forces losers
> like me to configure CC=".../path/to/compile cl" for the dependency
> checker to work (as it compiles in subdirs with -c -o). Can some m4
> magic be applied so that the dependency check is moved down or the
> -c -o check moved up, that would be much appreciated!

Not a really nice fix, but I've come up with this below.  Can you try
it (at least the tests/dep* tests from automake, please)?

The thing bothering me most is that it won't fix things for other
compilers not grokking `-c -o'.  OTOH I think it is fairly safe.

Thanks,
Ralf

    Relax depcomp test for MSVC to not require minuso.
    
    * m4/depend.m4 (_AM_DEPENDENCIES): When checking the msvisualcpp
    and msvcmsys depmodes, do not require `-c -o' to work just yet.
    It is not needed by the depcomp script for these depmodes, and
    works around the ordering issue between the tests.
    Report by Peter Rosin.
    
    Signed-off-by: Ralf Wildenhues <address@hidden>

diff --git a/m4/depend.m4 b/m4/depend.m4
index fd09373..e67b6c4 100644
--- a/m4/depend.m4
+++ b/m4/depend.m4
@@ -1,12 +1,12 @@
 ##                                                          -*- Autoconf -*-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 9
+# serial 10
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -80,6 +80,12 @@ AC_CACHE_CHECK([dependency style of $depcc],
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
     case $depmode in
     nosideeffect)
       # after this tag, mechanisms are not by side-effect, so they'll
@@ -90,19 +96,23 @@ AC_CACHE_CHECK([dependency style of $depcc],
        break
       fi
       ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj
+      ;;
     none) break ;;
     esac
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.
     if depmode=$depmode \
-       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       source=sub/conftest.c object=$am__obj \
        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
          >/dev/null 2>conftest.err &&
        grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
       # icc doesn't choke on unknown options, it will just issue warnings
       # or remarks (even with -Werror).  So we grep stderr for any message




reply via email to

[Prev in Thread] Current Thread [Next in Thread]