Migrated to the latest automake & libtool releases/prereleases, with all
[alexxy/gromacs.git] / config / depcomp
index 02458b8923a3c782231a882a322e2141e6c2c177..7bec128fed5d9c5060386c031453818a5c34e817 100755 (executable)
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.
 
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
 
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
@@ -50,8 +55,9 @@ fi
 case "$depmode" in
 gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
-## we want.  Yay!
-  "$@" -MT "$object" -MF "$tmpdepfile" -MD -MP
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
   stat=$?
   if test $stat -eq 0; then :
   else
@@ -194,9 +200,12 @@ aix)
 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
@@ -206,10 +215,16 @@ tru64)
    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
       sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
       # That's a space and a tab in the [].