automake
[Top][All Lists]
Advanced

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

Patches for dependency generation on alpha/linux/ccc


From: Erik Lindahl
Subject: Patches for dependency generation on alpha/linux/ccc
Date: Tue, 17 Jul 2001 17:14:20 +0200

Hi,

I've come across a couple of bugs with dependency generation
and depmode when using the compaq compilers on alpha/linux, 
and though you might be interested in including the minor
fixes in automake 1.5:

1. Compaq seems to have adopted their compiler to be more
   gcc-compatible; ccc version 6.2-504 running on redhat 6.1
   accepts the gcc flags for dependency generation, but the
   output is still tru64-style. _AM_DEPENDENCIES however 
   sets the depmode to "gcc", which gives an error when we
   try to include it in a makefile. 
   
   The fix is trivial - just try to include the generated file 
   in a makefile - if it chokes we continue and detect the
   correct tru64 mode. This is the patch versus CVS version
   1.19 of depend.m4:


###################################################################
Patch depend.m4 to check if dependency file can be included in makefile
--- depend.m4.vanilla   Tue Jul 17 16:56:25 2001
+++ depend.m4   Tue Jul 17 16:57:40 2001
@@ -56,6 +56,7 @@
     # This happens at least with the AIX C compiler.
     echo '#include "conftest.h"' > conftest.c
     echo 'int i;' > conftest.h
+    echo 'include conftest.Po' > Makefile
 
     case $depmode in
     nosideeffect)
@@ -76,7 +77,8 @@
        source=conftest.c object=conftest.o \
        depfile=conftest.Po tmpdepfile=conftest.TPo \
        $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null
2>&1 &&
-       grep conftest.h conftest.Po > /dev/null 2>&1; then
+       grep conftest.h conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} > /dev/null 2>&1; then
       am_cv_$1_dependencies_compiler_type=$depmode
       break
     fi



2. The second problem is that at least version 6.2-504 of ccc 
   generates dependencies in the file name.d instead of
   name.o.d which is the case on tru64 unix. I've worked around
   it by checking for both files in depcomp.
   The patch versus depcomp CVS version 1.26:

#######################################################################
Patch depcomp to look for the correct dependency file on linux/alpha/ccc
--- depcomp.vanilla     Tue Jul 17 16:55:57 2001
+++ depcomp     Tue Jul 17 16:57:43 2001
@@ -200,9 +200,12 @@
 tru64)
    # The Tru64 AIX compiler uses -MD to generate dependencies as a side
    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 
+   # dependencies in `foo.d' instead, so we check for that too.
    # Subdirectories are respected.
 
-   tmpdepfile="$object.d"
+   tmpdepfile1="$object.d"
+   tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` 
    if test "$libtool" = yes; then
       "$@" -Wc,-MD
    else
@@ -212,8 +215,14 @@
    stat=$?
    if test $stat -eq 0; then :
    else
-      rm -f "$tmpdepfile"
+      rm -f "$tmpdepfile1 $tmpdepfile2"
       exit $stat
+   fi
+
+   if test -f "$tmpdepfile1"; then
+     tmpdepfile="$tmpdepfile1"
+   else
+     tmpdepfile="$tmpdepfile2"
    fi
 
    if test -f "$tmpdepfile"; then



That's it. Trivial code, although I guess you can write it
in a neater way... Of course I'd be happy to see it included
in the 1.5 release; too short to be covered by copyright anyway. 
Our server is currently being moved to a new house, so I might 
not be able to respond until next week, but if you have any 
comments you could try to reach
me on address@hidden in the meantime.

Best wishes,

Erik Lindahl








reply via email to

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